[553310] Move EMF Facet Packages to MoDisco Facet
diff --git a/org.eclipse.gmt.modisco.infra.browser.custom.ui/src/org/eclipse/gmt/modisco/infra/browser/custom/ui/views/CustomizationsView.java b/org.eclipse.gmt.modisco.infra.browser.custom.ui/src/org/eclipse/gmt/modisco/infra/browser/custom/ui/views/CustomizationsView.java index 1f8ecd6..87b6b7d 100644 --- a/org.eclipse.gmt.modisco.infra.browser.custom.ui/src/org/eclipse/gmt/modisco/infra/browser/custom/ui/views/CustomizationsView.java +++ b/org.eclipse.gmt.modisco.infra.browser.custom.ui/src/org/eclipse/gmt/modisco/infra/browser/custom/ui/views/CustomizationsView.java
@@ -20,7 +20,6 @@ import org.eclipse.emf.common.ui.URIEditorInput; import org.eclipse.emf.common.util.EList; import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.facet.common.ui.internal.views.AbstractTreeView; import org.eclipse.gmt.modisco.infra.browser.custom.MetamodelView; import org.eclipse.gmt.modisco.infra.browser.custom.core.CustomizationsCatalog; import org.eclipse.gmt.modisco.infra.browser.custom.ui.Activator; @@ -32,6 +31,7 @@ import org.eclipse.jface.viewers.IContentProvider; import org.eclipse.jface.viewers.ITreeContentProvider; import org.eclipse.jface.viewers.Viewer; +import org.eclipse.modisco.facet.common.ui.internal.views.AbstractTreeView; import org.eclipse.swt.graphics.Color; import org.eclipse.swt.graphics.Image; import org.eclipse.swt.widgets.Composite;
diff --git a/org.eclipse.gmt.modisco.infra.browser/src/org/eclipse/gmt/modisco/infra/browser/editors/EcoreBrowser.java b/org.eclipse.gmt.modisco.infra.browser/src/org/eclipse/gmt/modisco/infra/browser/editors/EcoreBrowser.java index 75f2e4a..b1884c3 100644 --- a/org.eclipse.gmt.modisco.infra.browser/src/org/eclipse/gmt/modisco/infra/browser/editors/EcoreBrowser.java +++ b/org.eclipse.gmt.modisco.infra.browser/src/org/eclipse/gmt/modisco/infra/browser/editors/EcoreBrowser.java
@@ -98,7 +98,6 @@ import org.eclipse.emf.edit.ui.util.EditUIMarkerHelper; import org.eclipse.emf.edit.ui.util.EditUIUtil; import org.eclipse.emf.edit.ui.view.ExtendedPropertySheetPage; -import org.eclipse.emf.facet.util.core.Logger; import org.eclipse.gmt.modisco.infra.browser.Messages; import org.eclipse.gmt.modisco.infra.browser.MoDiscoBrowserPlugin; import org.eclipse.gmt.modisco.infra.browser.actions.LoadFacetsAction; @@ -168,6 +167,7 @@ import org.eclipse.jface.viewers.TreeSelection; import org.eclipse.jface.viewers.TreeViewer; import org.eclipse.jface.viewers.Viewer; +import org.eclipse.modisco.facet.util.core.Logger; import org.eclipse.modisco.util.emf.core.internal.allinstances.MetaclassInstances; import org.eclipse.osgi.util.NLS; import org.eclipse.swt.SWT;
diff --git a/org.eclipse.gmt.modisco.infra.browser/src/org/eclipse/gmt/modisco/infra/browser/opener/BrowserOpener.java b/org.eclipse.gmt.modisco.infra.browser/src/org/eclipse/gmt/modisco/infra/browser/opener/BrowserOpener.java index 31de697..e0648fe 100644 --- a/org.eclipse.gmt.modisco.infra.browser/src/org/eclipse/gmt/modisco/infra/browser/opener/BrowserOpener.java +++ b/org.eclipse.gmt.modisco.infra.browser/src/org/eclipse/gmt/modisco/infra/browser/opener/BrowserOpener.java
@@ -15,14 +15,14 @@ import org.eclipse.emf.ecore.EObject; import org.eclipse.emf.ecore.EPackage; import org.eclipse.emf.ecore.resource.Resource; -import org.eclipse.emf.facet.util.emf.core.IEObjectBrowserOpener; -import org.eclipse.emf.facet.util.emf.core.IEPackageBrowserOpener; -import org.eclipse.emf.facet.util.emf.core.IResourceBrowserOpener; import org.eclipse.gmt.modisco.infra.browser.MoDiscoBrowserPlugin; import org.eclipse.gmt.modisco.infra.browser.editors.BrowserUtils; import org.eclipse.gmt.modisco.infra.browser.editors.EcoreBrowser; import org.eclipse.gmt.modisco.infra.common.core.logging.MoDiscoLogger; import org.eclipse.gmt.modisco.infra.common.ui.internal.editorInputs.ResourceEditorInput; +import org.eclipse.modisco.facet.util.emf.core.IEObjectBrowserOpener; +import org.eclipse.modisco.facet.util.emf.core.IEPackageBrowserOpener; +import org.eclipse.modisco.facet.util.emf.core.IResourceBrowserOpener; import org.eclipse.swt.widgets.Display; import org.eclipse.ui.IEditorInput; import org.eclipse.ui.IWorkbenchPage;
diff --git a/org.eclipse.gmt.modisco.infra.facet.ui/src/org/eclipse/gmt/modisco/infra/facet/ui/views/FacetView.java b/org.eclipse.gmt.modisco.infra.facet.ui/src/org/eclipse/gmt/modisco/infra/facet/ui/views/FacetView.java index 1f3d1c6..ed77425 100644 --- a/org.eclipse.gmt.modisco.infra.facet.ui/src/org/eclipse/gmt/modisco/infra/facet/ui/views/FacetView.java +++ b/org.eclipse.gmt.modisco.infra.facet.ui/src/org/eclipse/gmt/modisco/infra/facet/ui/views/FacetView.java
@@ -21,7 +21,6 @@ import org.eclipse.emf.ecore.EObject; import org.eclipse.emf.ecore.EPackage; import org.eclipse.emf.ecore.EStructuralFeature; -import org.eclipse.emf.facet.common.ui.internal.views.AbstractTreeView; import org.eclipse.gmt.modisco.infra.common.core.internal.builder.AbstractMoDiscoCatalog.ModiscoCatalogChangeListener; import org.eclipse.gmt.modisco.infra.common.core.logging.MoDiscoLogger; import org.eclipse.gmt.modisco.infra.common.ui.internal.util.ImageUtils; @@ -34,6 +33,7 @@ import org.eclipse.gmt.modisco.infra.facet.ui.Messages; import org.eclipse.jface.viewers.ColumnLabelProvider; import org.eclipse.jface.viewers.IContentProvider; +import org.eclipse.modisco.facet.common.ui.internal.views.AbstractTreeView; import org.eclipse.swt.graphics.Image; import org.eclipse.swt.widgets.Composite; import org.eclipse.ui.IEditorPart;
diff --git a/org.eclipse.gmt.modisco.infra.query.ui/src/org/eclipse/gmt/modisco/infra/query/ui/views/ModelQueryView.java b/org.eclipse.gmt.modisco.infra.query.ui/src/org/eclipse/gmt/modisco/infra/query/ui/views/ModelQueryView.java index b0dd94e..fd6528d 100644 --- a/org.eclipse.gmt.modisco.infra.query.ui/src/org/eclipse/gmt/modisco/infra/query/ui/views/ModelQueryView.java +++ b/org.eclipse.gmt.modisco.infra.query.ui/src/org/eclipse/gmt/modisco/infra/query/ui/views/ModelQueryView.java
@@ -18,7 +18,6 @@ import org.eclipse.core.resources.IFile; import org.eclipse.emf.common.ui.URIEditorInput; import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.facet.common.ui.internal.views.AbstractTreeView; import org.eclipse.gmt.modisco.infra.common.core.internal.builder.AbstractMoDiscoCatalog.ModiscoCatalogChangeListener; import org.eclipse.gmt.modisco.infra.common.core.logging.MoDiscoLogger; import org.eclipse.gmt.modisco.infra.common.ui.internal.util.ImageUtils; @@ -32,6 +31,7 @@ import org.eclipse.jface.viewers.IContentProvider; import org.eclipse.jface.viewers.ITreeContentProvider; import org.eclipse.jface.viewers.Viewer; +import org.eclipse.modisco.facet.common.ui.internal.views.AbstractTreeView; import org.eclipse.swt.graphics.Image; import org.eclipse.swt.widgets.Composite; import org.eclipse.ui.IEditorPart;
diff --git a/org.eclipse.modisco.facet.common.core/META-INF/MANIFEST.MF b/org.eclipse.modisco.facet.common.core/META-INF/MANIFEST.MF index 6e7f416..78e187f 100644 --- a/org.eclipse.modisco.facet.common.core/META-INF/MANIFEST.MF +++ b/org.eclipse.modisco.facet.common.core/META-INF/MANIFEST.MF
@@ -3,12 +3,12 @@ Bundle-Name: %Bundle-Name Bundle-SymbolicName: org.eclipse.emf.facet.common.core;singleton:=true Bundle-Version: 1.3.0.qualifier -Bundle-Activator: org.eclipse.emf.facet.common.core.internal.Activator +Bundle-Activator: org.eclipse.modisco.facet.common.core.internal.Activator Bundle-Vendor: %Bundle-Vendor Require-Bundle: org.eclipse.core.runtime;bundle-version="3.6.0", com.ibm.icu;bundle-version="4.2.1" Bundle-RequiredExecutionEnvironment: JavaSE-1.8 Bundle-ActivationPolicy: lazy -Export-Package: org.eclipse.emf.facet.common.core.internal;x-friends:="org.eclipse.emf.facet.common.ui", - org.eclipse.emf.facet.common.core.internal.utils;x-friends:="org.eclipse.emf.facet.common.ui" +Export-Package: org.eclipse.modisco.facet.common.core.internal;x-friends:="org.eclipse.emf.facet.common.ui", + org.eclipse.modisco.facet.common.core.internal.utils;x-friends:="org.eclipse.emf.facet.common.ui" Automatic-Module-Name: org.eclipse.emf.facet.common.core
diff --git a/org.eclipse.modisco.facet.common.core/src/org/eclipse/emf/facet/common/core/internal/Activator.java b/org.eclipse.modisco.facet.common.core/src/org/eclipse/emf/facet/common/core/internal/Activator.java deleted file mode 100644 index f3c0a8c..0000000 --- a/org.eclipse.modisco.facet.common.core/src/org/eclipse/emf/facet/common/core/internal/Activator.java +++ /dev/null
@@ -1,47 +0,0 @@ -/** - * Copyright (c) 2011 Mia-Software. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Nicolas Guyomar (Mia-Software) - Bug 333652 Extension point offering the possibility to declare an EPackage browser - * Nicolas Guyomar (Mia-Software) - Bug 334000 Simple catalog manager - */ -package org.eclipse.emf.facet.common.core.internal; - -import org.eclipse.core.runtime.Plugin; -import org.osgi.framework.BundleContext; - -public class Activator extends Plugin { - - private static BundleContext context; - - // The shared instance - private static Activator plugin; - - public static Plugin getDefault() { - return Activator.plugin; - } - - static BundleContext getContext() { - return Activator.context; - } - - @Override - public void start(final BundleContext bundleContext) throws Exception { - super.start(bundleContext); - Activator.context = bundleContext; - Activator.plugin = this; - } - - @Override - public void stop(final BundleContext bundleContext) throws Exception { - Activator.context = null; - Activator.plugin = null; - super.stop(bundleContext); - } - -}
diff --git a/org.eclipse.modisco.facet.common.core/src/org/eclipse/emf/facet/common/core/internal/utils/StringMatcher.java b/org.eclipse.modisco.facet.common.core/src/org/eclipse/emf/facet/common/core/internal/utils/StringMatcher.java deleted file mode 100644 index 5ff5a00..0000000 --- a/org.eclipse.modisco.facet.common.core/src/org/eclipse/emf/facet/common/core/internal/utils/StringMatcher.java +++ /dev/null
@@ -1,500 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2010 Mia-Software. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Nicolas Bros (Mia-Software) - initial API and implementation - * Nicolas Guyomar (Mia-Software) - Bug 333652 Extension point offering the possibility to declare an EPackage browser - *******************************************************************************/ -package org.eclipse.emf.facet.common.core.internal.utils; - -import java.util.Vector; - -import com.ibm.icu.lang.UCharacter; - -/** - * A string pattern matcher. Supports '*' and '?' wildcards. - * - * FIXME yet another duplicated version of StringMatcher (Bug 269424) - */ -public class StringMatcher { - private final String fPattern; - - private final int fLength; // pattern length - - private final boolean fIgnoreWildCards; - - private final boolean fIgnoreCase; - - private boolean fHasLeadingStar; - - private boolean fHasTrailingStar; - - private String[] fSegments; // the given pattern is split into * separated - // segments - - /* boundary value beyond which we don't need to search in the text */ - private int fBound = 0; - - private static final char SINGLE_WILD_CARD = '\u0000'; - - public static class Position { - private final int start; // inclusive - private final int end; // exclusive - - public Position(final int start, final int end) { - this.start = start; - this.end = end; - } - - public int getStart() { - return this.start; - } - - public int getEnd() { - return this.end; - } - } - - /** - * StringMatcher constructor takes in a String object that is a simple - * pattern which may contain '*' for 0 and many characters and '?' for - * exactly one character. - * - * Literal '*' and '?' characters must be escaped in the pattern e.g., - * "\*" means literal "*", etc. - * - * Escaping any other character (including the escape character itself), - * just results in that character in the pattern. e.g., "\a" means "a" and - * "\\" means "\" - * - * If invoking the StringMatcher with string literals in Java, don't forget - * escape characters are represented by "\\". - * - * @param pattern - * the pattern to match text against - * @param ignoreCase - * if true, case is ignored - * @param ignoreWildCards - * if true, wild cards and their escape sequences are ignored - * (everything is taken literally). - */ - public StringMatcher(final String pattern, final boolean ignoreCase, - final boolean ignoreWildCards) { - if (pattern == null) { - throw new IllegalArgumentException(); - } - this.fIgnoreCase = ignoreCase; - this.fIgnoreWildCards = ignoreWildCards; - this.fPattern = pattern; - this.fLength = pattern.length(); - - if (this.fIgnoreWildCards) { - parseNoWildCards(); - } else { - parseWildCards(); - } - } - - /** - * Find the first occurrence of the pattern between <code>start</code> - * )(inclusive) and <code>end</code>(exclusive). - * - * @param text - * the String object to search in - * @param start - * the starting index of the search range, inclusive - * @param end - * the ending index of the search range, exclusive - * @return a <code>StringMatcher.Position</code> object that keeps the - * starting (inclusive) and ending positions (exclusive) of the - * first occurrence of the pattern in the specified range of the - * text; return null if not found or subtext is empty (start==end). - * A pair of zeros is returned if pattern is empty string Note that - * for pattern like "*abc*" with leading and trailing stars, - * position of "abc" is returned. For a pattern like"*??*" in text - * "abcdf", (1,3) is returned - */ - public StringMatcher.Position find(final String text, final int start, - final int end) { - int newStart = start; - int newEnd = end; - - if (text == null) { - throw new IllegalArgumentException(); - } - - int tlen = text.length(); - if (newStart < 0) { - newStart = 0; - } - if (newEnd > tlen) { - newEnd = tlen; - } - if (newEnd < 0 || newStart >= newEnd) { - return null; - } - if (this.fLength == 0) { - return new Position(newStart, newStart); - } - if (this.fIgnoreWildCards) { - int x = posIn(text, newStart, newEnd); - if (x < 0) { - return null; - } - return new Position(x, x + this.fLength); - } - - int segCount = this.fSegments.length; - if (segCount == 0) { - // pattern contains only '*'(s) - return new Position(newStart, newEnd); - } - - int curPos = newStart; - int matchStart = -1; - int i; - for (i = 0; i < segCount && curPos < newEnd; ++i) { - String current = this.fSegments[i]; - int nextMatch = regExpPosIn(text, curPos, newEnd, current); - if (nextMatch < 0) { - return null; - } - if (i == 0) { - matchStart = nextMatch; - } - curPos = nextMatch + current.length(); - } - if (i < segCount) { - return null; - } - return new Position(matchStart, curPos); - } - - /** - * match the given <code>text</code> with the pattern - * - * @return true if matched otherwise false - * @param text - * a String object - */ - public boolean match(final String text) { - return match(text, 0, text.length()); - } - - /** - * Given the starting (inclusive) and the ending (exclusive) positions in - * the <code>text</code>, determine if the given substring matches with - * aPattern - * - * @return true if the specified portion of the text matches the pattern - * @param text - * a String object that contains the substring to match - * @param start - * marks the starting position (inclusive) of the substring - * @param end - * marks the ending index (exclusive) of the substring - */ - public boolean match(final String text, final int start, final int end) { - int newStart = start; - int newEnd = end; - - if (null == text) { - throw new IllegalArgumentException(); - } - - if (newStart > newEnd) { - return false; - } - - if (this.fIgnoreWildCards) { - return (newEnd - newStart == this.fLength) - && this.fPattern.regionMatches(this.fIgnoreCase, 0, text, - newStart, this.fLength); - } - int segCount = this.fSegments.length; - if (segCount == 0 && (this.fHasLeadingStar || this.fHasTrailingStar)) { - // pattern contains only '*'(s) - return true; - } - if (newStart == newEnd) { - return this.fLength == 0; - } - if (this.fLength == 0) { - return newStart == newEnd; - } - - int tlen = text.length(); - if (newStart < 0) { - newStart = 0; - } - if (newEnd > tlen) { - newEnd = tlen; - } - - int tCurPos = newStart; - int bound = newEnd - this.fBound; - if (bound < 0) { - return false; - } - int i = 0; - String current = this.fSegments[i]; - int segLength = current.length(); - - /* process first segment */ - if (!this.fHasLeadingStar) { - if (!regExpRegionMatches(text, newStart, current, 0, segLength)) { - return false; - } - ++i; - tCurPos = tCurPos + segLength; - } - if ((this.fSegments.length == 1) && (!this.fHasLeadingStar) - && (!this.fHasTrailingStar)) { - // only one segment to match, no wildcards specified - return tCurPos == newEnd; - } - /* process middle segments */ - for (; i < segCount && tCurPos <= bound; ++i) { - current = this.fSegments[i]; - int currentMatch; - int k = current.indexOf(StringMatcher.SINGLE_WILD_CARD); - if (k < 0) { - currentMatch = textPosIn(text, tCurPos, newEnd, current); - if (currentMatch < 0) { - return false; - } - } else { - currentMatch = regExpPosIn(text, tCurPos, newEnd, current); - if (currentMatch < 0) { - return false; - } - } - tCurPos = currentMatch + current.length(); - } - - /* process final segment */ - if (!this.fHasTrailingStar && tCurPos != newEnd) { - int clen = current.length(); - return regExpRegionMatches(text, newEnd - clen, current, 0, clen); - } - return i == segCount; - } - - /** - * This method parses the given pattern into segments seperated by wildcard - * '*' characters. Since wildcards are not being used in this case, the - * pattern consists of a single segment. - */ - private void parseNoWildCards() { - this.fSegments = new String[1]; - this.fSegments[0] = this.fPattern; - this.fBound = this.fLength; - } - - /** - * Parses the given pattern into segments separated by wildcard '*' - * characters. - */ - private void parseWildCards() { - if (this.fPattern.startsWith("*")) { //$NON-NLS-1$ - this.fHasLeadingStar = true; - } - if (this.fPattern.endsWith("*")) { //$NON-NLS-1$ - /* make sure it's not an escaped wildcard */ - if (this.fLength > 1 - && this.fPattern.charAt(this.fLength - 2) != '\\') { - this.fHasTrailingStar = true; - } - } - - Vector<String> temp = new Vector<String>(); - - int pos = 0; - StringBuffer buf = new StringBuffer(); - while (pos < this.fLength) { - char c = this.fPattern.charAt(pos++); - switch (c) { - case '\\': - if (pos >= this.fLength) { - buf.append(c); - } else { - char next = this.fPattern.charAt(pos++); - /* if it's an escape sequence */ - if (next == '*' || next == '?' || next == '\\') { - buf.append(next); - } else { - /* not an escape sequence, just insert literally */ - buf.append(c); - buf.append(next); - } - } - break; - case '*': - if (buf.length() > 0) { - /* new segment */ - temp.addElement(buf.toString()); - this.fBound += buf.length(); - buf.setLength(0); - } - break; - case '?': - /* append special character representing single match wildcard */ - buf.append(StringMatcher.SINGLE_WILD_CARD); - break; - default: - buf.append(c); - } - } - - /* add last buffer to segment list */ - if (buf.length() > 0) { - temp.addElement(buf.toString()); - this.fBound += buf.length(); - } - - this.fSegments = new String[temp.size()]; - temp.copyInto(this.fSegments); - } - - /** - * @param text - * a string which contains no wildcard - * @param start - * the starting index in the text for search, inclusive - * @param end - * the stopping point of search, exclusive - * @return the starting index in the text of the pattern , or -1 if not - * found - */ - protected int posIn(final String text, final int start, final int end) { - int max = end - this.fLength; - - if (!this.fIgnoreCase) { - int i = text.indexOf(this.fPattern, start); - if (i == -1 || i > max) { - return -1; - } - return i; - } - - for (int i = start; i <= max; ++i) { - if (text.regionMatches(true, i, this.fPattern, 0, this.fLength)) { - return i; - } - } - - return -1; - } - - /** - * @param text - * a simple regular expression that may only contain '?'(s) - * @param start - * the starting index in the text for search, inclusive - * @param end - * the stopping point of search, exclusive - * @param p - * a simple regular expression that may contains '?' - * @return the starting index in the text of the pattern , or -1 if not - * found - */ - protected int regExpPosIn(final String text, final int start, - final int end, final String p) { - int plen = p.length(); - - int max = end - plen; - for (int i = start; i <= max; ++i) { - if (regExpRegionMatches(text, i, p, 0, plen)) { - return i; - } - } - return -1; - } - - /** - * - * @return boolean - * @param text - * a String to match - * @param tStart - * indicates the starting index of match, inclusive - * @param p - * a simple regular expression that may contain '?' - */ - protected boolean regExpRegionMatches(final String text, final int tStart, - final String p, final int pStart, final int plen) { - int curTStart = tStart; - int curPStart = pStart; - int curPlen = plen; - - while (curPlen-- > 0) { - char tchar = text.charAt(curTStart++); - char pchar = p.charAt(curPStart++); - - /* process wild cards */ - if (!this.fIgnoreWildCards) { - /* skip single wild cards */ - if (pchar == StringMatcher.SINGLE_WILD_CARD) { - continue; - } - } - if (pchar == tchar) { - continue; - } - if (this.fIgnoreCase) { - if (UCharacter.toUpperCase(tchar) == UCharacter - .toUpperCase(pchar)) { - continue; - } - // comparing after converting to upper case doesn't handle all - // cases; - // also compare after converting to lower case - if (UCharacter.toLowerCase(tchar) == UCharacter - .toLowerCase(pchar)) { - continue; - } - } - return false; - } - return true; - } - - /** - * @param text - * the string to match - * @param start - * the starting index in the text for search, inclusive - * @param end - * the stopping point of search, exclusive - * @param p - * a string that has no wildcard - * @return the starting index in the text of the pattern , or -1 if not - * found - */ - protected int textPosIn(final String text, final int start, final int end, - final String p) { - - int plen = p.length(); - int max = end - plen; - - if (!this.fIgnoreCase) { - int i = text.indexOf(p, start); - if (i == -1 || i > max) { - return -1; - } - return i; - } - - for (int i = start; i <= max; ++i) { - if (text.regionMatches(true, i, p, 0, plen)) { - return i; - } - } - - return -1; - } -}
diff --git a/org.eclipse.modisco.facet.common.core/src/org/eclipse/modisco/facet/common/core/internal/Activator.java b/org.eclipse.modisco.facet.common.core/src/org/eclipse/modisco/facet/common/core/internal/Activator.java new file mode 100644 index 0000000..f6673ff --- /dev/null +++ b/org.eclipse.modisco.facet.common.core/src/org/eclipse/modisco/facet/common/core/internal/Activator.java
@@ -0,0 +1,47 @@ +/** + * Copyright (c) 2011 Mia-Software. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Nicolas Guyomar (Mia-Software) - Bug 333652 Extension point offering the possibility to declare an EPackage browser + * Nicolas Guyomar (Mia-Software) - Bug 334000 Simple catalog manager + */ +package org.eclipse.modisco.facet.common.core.internal; + +import org.eclipse.core.runtime.Plugin; +import org.osgi.framework.BundleContext; + +public class Activator extends Plugin { + + private static BundleContext context; + + // The shared instance + private static Activator plugin; + + public static Plugin getDefault() { + return Activator.plugin; + } + + static BundleContext getContext() { + return Activator.context; + } + + @Override + public void start(final BundleContext bundleContext) throws Exception { + super.start(bundleContext); + Activator.context = bundleContext; + Activator.plugin = this; + } + + @Override + public void stop(final BundleContext bundleContext) throws Exception { + Activator.context = null; + Activator.plugin = null; + super.stop(bundleContext); + } + +}
diff --git a/org.eclipse.modisco.facet.common.core/src/org/eclipse/modisco/facet/common/core/internal/utils/StringMatcher.java b/org.eclipse.modisco.facet.common.core/src/org/eclipse/modisco/facet/common/core/internal/utils/StringMatcher.java new file mode 100644 index 0000000..2339413 --- /dev/null +++ b/org.eclipse.modisco.facet.common.core/src/org/eclipse/modisco/facet/common/core/internal/utils/StringMatcher.java
@@ -0,0 +1,500 @@ +/******************************************************************************* + * Copyright (c) 2009, 2010 Mia-Software. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Nicolas Bros (Mia-Software) - initial API and implementation + * Nicolas Guyomar (Mia-Software) - Bug 333652 Extension point offering the possibility to declare an EPackage browser + *******************************************************************************/ +package org.eclipse.modisco.facet.common.core.internal.utils; + +import java.util.Vector; + +import com.ibm.icu.lang.UCharacter; + +/** + * A string pattern matcher. Supports '*' and '?' wildcards. + * + * FIXME yet another duplicated version of StringMatcher (Bug 269424) + */ +public class StringMatcher { + private final String fPattern; + + private final int fLength; // pattern length + + private final boolean fIgnoreWildCards; + + private final boolean fIgnoreCase; + + private boolean fHasLeadingStar; + + private boolean fHasTrailingStar; + + private String[] fSegments; // the given pattern is split into * separated + // segments + + /* boundary value beyond which we don't need to search in the text */ + private int fBound = 0; + + private static final char SINGLE_WILD_CARD = '\u0000'; + + public static class Position { + private final int start; // inclusive + private final int end; // exclusive + + public Position(final int start, final int end) { + this.start = start; + this.end = end; + } + + public int getStart() { + return this.start; + } + + public int getEnd() { + return this.end; + } + } + + /** + * StringMatcher constructor takes in a String object that is a simple + * pattern which may contain '*' for 0 and many characters and '?' for + * exactly one character. + * + * Literal '*' and '?' characters must be escaped in the pattern e.g., + * "\*" means literal "*", etc. + * + * Escaping any other character (including the escape character itself), + * just results in that character in the pattern. e.g., "\a" means "a" and + * "\\" means "\" + * + * If invoking the StringMatcher with string literals in Java, don't forget + * escape characters are represented by "\\". + * + * @param pattern + * the pattern to match text against + * @param ignoreCase + * if true, case is ignored + * @param ignoreWildCards + * if true, wild cards and their escape sequences are ignored + * (everything is taken literally). + */ + public StringMatcher(final String pattern, final boolean ignoreCase, + final boolean ignoreWildCards) { + if (pattern == null) { + throw new IllegalArgumentException(); + } + this.fIgnoreCase = ignoreCase; + this.fIgnoreWildCards = ignoreWildCards; + this.fPattern = pattern; + this.fLength = pattern.length(); + + if (this.fIgnoreWildCards) { + parseNoWildCards(); + } else { + parseWildCards(); + } + } + + /** + * Find the first occurrence of the pattern between <code>start</code> + * )(inclusive) and <code>end</code>(exclusive). + * + * @param text + * the String object to search in + * @param start + * the starting index of the search range, inclusive + * @param end + * the ending index of the search range, exclusive + * @return a <code>StringMatcher.Position</code> object that keeps the + * starting (inclusive) and ending positions (exclusive) of the + * first occurrence of the pattern in the specified range of the + * text; return null if not found or subtext is empty (start==end). + * A pair of zeros is returned if pattern is empty string Note that + * for pattern like "*abc*" with leading and trailing stars, + * position of "abc" is returned. For a pattern like"*??*" in text + * "abcdf", (1,3) is returned + */ + public StringMatcher.Position find(final String text, final int start, + final int end) { + int newStart = start; + int newEnd = end; + + if (text == null) { + throw new IllegalArgumentException(); + } + + int tlen = text.length(); + if (newStart < 0) { + newStart = 0; + } + if (newEnd > tlen) { + newEnd = tlen; + } + if (newEnd < 0 || newStart >= newEnd) { + return null; + } + if (this.fLength == 0) { + return new Position(newStart, newStart); + } + if (this.fIgnoreWildCards) { + int x = posIn(text, newStart, newEnd); + if (x < 0) { + return null; + } + return new Position(x, x + this.fLength); + } + + int segCount = this.fSegments.length; + if (segCount == 0) { + // pattern contains only '*'(s) + return new Position(newStart, newEnd); + } + + int curPos = newStart; + int matchStart = -1; + int i; + for (i = 0; i < segCount && curPos < newEnd; ++i) { + String current = this.fSegments[i]; + int nextMatch = regExpPosIn(text, curPos, newEnd, current); + if (nextMatch < 0) { + return null; + } + if (i == 0) { + matchStart = nextMatch; + } + curPos = nextMatch + current.length(); + } + if (i < segCount) { + return null; + } + return new Position(matchStart, curPos); + } + + /** + * match the given <code>text</code> with the pattern + * + * @return true if matched otherwise false + * @param text + * a String object + */ + public boolean match(final String text) { + return match(text, 0, text.length()); + } + + /** + * Given the starting (inclusive) and the ending (exclusive) positions in + * the <code>text</code>, determine if the given substring matches with + * aPattern + * + * @return true if the specified portion of the text matches the pattern + * @param text + * a String object that contains the substring to match + * @param start + * marks the starting position (inclusive) of the substring + * @param end + * marks the ending index (exclusive) of the substring + */ + public boolean match(final String text, final int start, final int end) { + int newStart = start; + int newEnd = end; + + if (null == text) { + throw new IllegalArgumentException(); + } + + if (newStart > newEnd) { + return false; + } + + if (this.fIgnoreWildCards) { + return (newEnd - newStart == this.fLength) + && this.fPattern.regionMatches(this.fIgnoreCase, 0, text, + newStart, this.fLength); + } + int segCount = this.fSegments.length; + if (segCount == 0 && (this.fHasLeadingStar || this.fHasTrailingStar)) { + // pattern contains only '*'(s) + return true; + } + if (newStart == newEnd) { + return this.fLength == 0; + } + if (this.fLength == 0) { + return newStart == newEnd; + } + + int tlen = text.length(); + if (newStart < 0) { + newStart = 0; + } + if (newEnd > tlen) { + newEnd = tlen; + } + + int tCurPos = newStart; + int bound = newEnd - this.fBound; + if (bound < 0) { + return false; + } + int i = 0; + String current = this.fSegments[i]; + int segLength = current.length(); + + /* process first segment */ + if (!this.fHasLeadingStar) { + if (!regExpRegionMatches(text, newStart, current, 0, segLength)) { + return false; + } + ++i; + tCurPos = tCurPos + segLength; + } + if ((this.fSegments.length == 1) && (!this.fHasLeadingStar) + && (!this.fHasTrailingStar)) { + // only one segment to match, no wildcards specified + return tCurPos == newEnd; + } + /* process middle segments */ + for (; i < segCount && tCurPos <= bound; ++i) { + current = this.fSegments[i]; + int currentMatch; + int k = current.indexOf(StringMatcher.SINGLE_WILD_CARD); + if (k < 0) { + currentMatch = textPosIn(text, tCurPos, newEnd, current); + if (currentMatch < 0) { + return false; + } + } else { + currentMatch = regExpPosIn(text, tCurPos, newEnd, current); + if (currentMatch < 0) { + return false; + } + } + tCurPos = currentMatch + current.length(); + } + + /* process final segment */ + if (!this.fHasTrailingStar && tCurPos != newEnd) { + int clen = current.length(); + return regExpRegionMatches(text, newEnd - clen, current, 0, clen); + } + return i == segCount; + } + + /** + * This method parses the given pattern into segments seperated by wildcard + * '*' characters. Since wildcards are not being used in this case, the + * pattern consists of a single segment. + */ + private void parseNoWildCards() { + this.fSegments = new String[1]; + this.fSegments[0] = this.fPattern; + this.fBound = this.fLength; + } + + /** + * Parses the given pattern into segments separated by wildcard '*' + * characters. + */ + private void parseWildCards() { + if (this.fPattern.startsWith("*")) { //$NON-NLS-1$ + this.fHasLeadingStar = true; + } + if (this.fPattern.endsWith("*")) { //$NON-NLS-1$ + /* make sure it's not an escaped wildcard */ + if (this.fLength > 1 + && this.fPattern.charAt(this.fLength - 2) != '\\') { + this.fHasTrailingStar = true; + } + } + + Vector<String> temp = new Vector<String>(); + + int pos = 0; + StringBuffer buf = new StringBuffer(); + while (pos < this.fLength) { + char c = this.fPattern.charAt(pos++); + switch (c) { + case '\\': + if (pos >= this.fLength) { + buf.append(c); + } else { + char next = this.fPattern.charAt(pos++); + /* if it's an escape sequence */ + if (next == '*' || next == '?' || next == '\\') { + buf.append(next); + } else { + /* not an escape sequence, just insert literally */ + buf.append(c); + buf.append(next); + } + } + break; + case '*': + if (buf.length() > 0) { + /* new segment */ + temp.addElement(buf.toString()); + this.fBound += buf.length(); + buf.setLength(0); + } + break; + case '?': + /* append special character representing single match wildcard */ + buf.append(StringMatcher.SINGLE_WILD_CARD); + break; + default: + buf.append(c); + } + } + + /* add last buffer to segment list */ + if (buf.length() > 0) { + temp.addElement(buf.toString()); + this.fBound += buf.length(); + } + + this.fSegments = new String[temp.size()]; + temp.copyInto(this.fSegments); + } + + /** + * @param text + * a string which contains no wildcard + * @param start + * the starting index in the text for search, inclusive + * @param end + * the stopping point of search, exclusive + * @return the starting index in the text of the pattern , or -1 if not + * found + */ + protected int posIn(final String text, final int start, final int end) { + int max = end - this.fLength; + + if (!this.fIgnoreCase) { + int i = text.indexOf(this.fPattern, start); + if (i == -1 || i > max) { + return -1; + } + return i; + } + + for (int i = start; i <= max; ++i) { + if (text.regionMatches(true, i, this.fPattern, 0, this.fLength)) { + return i; + } + } + + return -1; + } + + /** + * @param text + * a simple regular expression that may only contain '?'(s) + * @param start + * the starting index in the text for search, inclusive + * @param end + * the stopping point of search, exclusive + * @param p + * a simple regular expression that may contains '?' + * @return the starting index in the text of the pattern , or -1 if not + * found + */ + protected int regExpPosIn(final String text, final int start, + final int end, final String p) { + int plen = p.length(); + + int max = end - plen; + for (int i = start; i <= max; ++i) { + if (regExpRegionMatches(text, i, p, 0, plen)) { + return i; + } + } + return -1; + } + + /** + * + * @return boolean + * @param text + * a String to match + * @param tStart + * indicates the starting index of match, inclusive + * @param p + * a simple regular expression that may contain '?' + */ + protected boolean regExpRegionMatches(final String text, final int tStart, + final String p, final int pStart, final int plen) { + int curTStart = tStart; + int curPStart = pStart; + int curPlen = plen; + + while (curPlen-- > 0) { + char tchar = text.charAt(curTStart++); + char pchar = p.charAt(curPStart++); + + /* process wild cards */ + if (!this.fIgnoreWildCards) { + /* skip single wild cards */ + if (pchar == StringMatcher.SINGLE_WILD_CARD) { + continue; + } + } + if (pchar == tchar) { + continue; + } + if (this.fIgnoreCase) { + if (UCharacter.toUpperCase(tchar) == UCharacter + .toUpperCase(pchar)) { + continue; + } + // comparing after converting to upper case doesn't handle all + // cases; + // also compare after converting to lower case + if (UCharacter.toLowerCase(tchar) == UCharacter + .toLowerCase(pchar)) { + continue; + } + } + return false; + } + return true; + } + + /** + * @param text + * the string to match + * @param start + * the starting index in the text for search, inclusive + * @param end + * the stopping point of search, exclusive + * @param p + * a string that has no wildcard + * @return the starting index in the text of the pattern , or -1 if not + * found + */ + protected int textPosIn(final String text, final int start, final int end, + final String p) { + + int plen = p.length(); + int max = end - plen; + + if (!this.fIgnoreCase) { + int i = text.indexOf(p, start); + if (i == -1 || i > max) { + return -1; + } + return i; + } + + for (int i = start; i <= max; ++i) { + if (text.regionMatches(true, i, p, 0, plen)) { + return i; + } + } + + return -1; + } +}
diff --git a/org.eclipse.modisco.facet.common.ui/.settings/org.eclipse.core.resources.prefs b/org.eclipse.modisco.facet.common.ui/.settings/org.eclipse.core.resources.prefs index 0475629..06a98ea 100644 --- a/org.eclipse.modisco.facet.common.ui/.settings/org.eclipse.core.resources.prefs +++ b/org.eclipse.modisco.facet.common.ui/.settings/org.eclipse.core.resources.prefs
@@ -1,3 +1,3 @@ eclipse.preferences.version=1 -encoding//src/org/eclipse/emf/facet/common/ui/internal/messages.properties=ISO-8859-1 +encoding//src/org/eclipse/modisco/facet/common/ui/internal/messages.properties=ISO-8859-1 encoding/<project>=UTF-8
diff --git a/org.eclipse.modisco.facet.common.ui/META-INF/MANIFEST.MF b/org.eclipse.modisco.facet.common.ui/META-INF/MANIFEST.MF index da45f58..d0066bf 100644 --- a/org.eclipse.modisco.facet.common.ui/META-INF/MANIFEST.MF +++ b/org.eclipse.modisco.facet.common.ui/META-INF/MANIFEST.MF
@@ -3,7 +3,7 @@ Bundle-Name: %Bundle-Name Bundle-SymbolicName: org.eclipse.emf.facet.common.ui;singleton:=true Bundle-Version: 1.3.0.qualifier -Bundle-Activator: org.eclipse.emf.facet.common.ui.internal.Activator +Bundle-Activator: org.eclipse.modisco.facet.common.ui.internal.Activator Bundle-Vendor: %Bundle-Vendor Require-Bundle: org.eclipse.ui, org.eclipse.core.runtime, @@ -13,8 +13,8 @@ org.eclipse.ui.ide;bundle-version="3.6.0" Bundle-RequiredExecutionEnvironment: JavaSE-1.8 Bundle-ActivationPolicy: lazy -Export-Package: org.eclipse.emf.facet.common.ui.internal.controls;x-friends:="org.eclipse.modisco.infra.discovery.ui", - org.eclipse.emf.facet.common.ui.internal.exported.views;x-friends:="org.eclipse.emf.facet.custom.ui,org.eclipse.emf.facet.efacet.ui", - org.eclipse.emf.facet.common.ui.internal.views;x-friends:="org.eclipse.emf.facet.util.emf.ui,org.eclipse.emf.facet.aggregate.tests", - org.eclipse.emf.facet.common.ui.internal.widgets;x-friends:="org.eclipse.emf.facet.efacet.ui,org.eclipse.emf.facet.util.emf.ui" +Export-Package: org.eclipse.modisco.facet.common.ui.internal.controls;x-friends:="org.eclipse.modisco.infra.discovery.ui", + org.eclipse.modisco.facet.common.ui.internal.exported.views;x-friends:="org.eclipse.emf.facet.custom.ui,org.eclipse.emf.facet.efacet.ui", + org.eclipse.modisco.facet.common.ui.internal.views;x-friends:="org.eclipse.emf.facet.util.emf.ui,org.eclipse.emf.facet.aggregate.tests", + org.eclipse.modisco.facet.common.ui.internal.widgets;x-friends:="org.eclipse.emf.facet.efacet.ui,org.eclipse.emf.facet.util.emf.ui" Automatic-Module-Name: org.eclipse.emf.facet.common.ui
diff --git a/org.eclipse.modisco.facet.common.ui/plugin.xml b/org.eclipse.modisco.facet.common.ui/plugin.xml index 03a577f..079e69c 100644 --- a/org.eclipse.modisco.facet.common.ui/plugin.xml +++ b/org.eclipse.modisco.facet.common.ui/plugin.xml
@@ -16,7 +16,7 @@ <extension point="org.eclipse.ui.preferencePages"> <page - class="org.eclipse.emf.facet.common.ui.internal.preference.pages.EmfFacetRootPreferencePage" + class="org.eclipse.modisco.facet.common.ui.internal.preference.pages.EmfFacetRootPreferencePage" id="org.eclipse.emf.facet.common.ui.preference.pages.EmfFacetRootPreferencePage" name="%page.name"> </page>
diff --git a/org.eclipse.modisco.facet.common.ui/src/org/eclipse/emf/facet/common/ui/internal/Activator.java b/org.eclipse.modisco.facet.common.ui/src/org/eclipse/emf/facet/common/ui/internal/Activator.java deleted file mode 100644 index c5b1667..0000000 --- a/org.eclipse.modisco.facet.common.ui/src/org/eclipse/emf/facet/common/ui/internal/Activator.java +++ /dev/null
@@ -1,53 +0,0 @@ -/** - * Copyright (c) 2011 Mia-Software. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Nicolas Guyomar (Mia-Software) - Bug 333652 Extension point offering the possibility to declare an EPackage browser - */ -package org.eclipse.emf.facet.common.ui.internal; - -import org.eclipse.ui.plugin.AbstractUIPlugin; -import org.osgi.framework.BundleContext; - -/** - * The activator class controls the plug-in life cycle - */ -public class Activator extends AbstractUIPlugin { - - public static final String PLUGIN_ID = "org.eclipse.emf.facet.common.ui"; //$NON-NLS-1$ - - private static Activator plugin; - - /** - * The constructor - */ - public Activator() { - } - - @Override - public void start(final BundleContext context) throws Exception { - super.start(context); - Activator.plugin = this; - } - - @Override - public void stop(final BundleContext context) throws Exception { - Activator.plugin = null; - super.stop(context); - } - - /** - * Returns the shared instance - * - * @return the shared instance - */ - public static Activator getDefault() { - return Activator.plugin; - } - -}
diff --git a/org.eclipse.modisco.facet.common.ui/src/org/eclipse/emf/facet/common/ui/internal/Messages.java b/org.eclipse.modisco.facet.common.ui/src/org/eclipse/emf/facet/common/ui/internal/Messages.java deleted file mode 100644 index e7cbdcb..0000000 --- a/org.eclipse.modisco.facet.common.ui/src/org/eclipse/emf/facet/common/ui/internal/Messages.java +++ /dev/null
@@ -1,25 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2012 CEA LIST. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Nicolas Bros (Mia-Software) - Bug 372732 - [Facet] Rewrite the catalog views for 0.2 - *******************************************************************************/ -package org.eclipse.emf.facet.common.ui.internal; - -import org.eclipse.osgi.util.NLS; - -public class Messages extends NLS { - private static final String BUNDLE_NAME = "org.eclipse.emf.facet.common.ui.internal.messages"; //$NON-NLS-1$ - public static String ElementsView_refreshJobTitle; - static { - // initialize resource bundle - NLS.initializeMessages(BUNDLE_NAME, Messages.class); - } - - private Messages() { - } -}
diff --git a/org.eclipse.modisco.facet.common.ui/src/org/eclipse/emf/facet/common/ui/internal/controls/PersistableColumn.java b/org.eclipse.modisco.facet.common.ui/src/org/eclipse/emf/facet/common/ui/internal/controls/PersistableColumn.java deleted file mode 100644 index 56a7b58..0000000 --- a/org.eclipse.modisco.facet.common.ui/src/org/eclipse/emf/facet/common/ui/internal/controls/PersistableColumn.java +++ /dev/null
@@ -1,217 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2011 Mia-Software. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Nicolas Bros (Mia-Software) - initial API and implementation - * Nicolas Bros (Mia-Software) - Bug 334116 - common tree view with columns - *******************************************************************************/ -package org.eclipse.emf.facet.common.ui.internal.controls; - -import java.util.HashMap; -import java.util.Map; - -import org.eclipse.emf.facet.common.ui.internal.controls.wrappers.Column; -import org.eclipse.emf.facet.common.ui.internal.controls.wrappers.SortableTable; -import org.eclipse.emf.facet.common.ui.internal.controls.wrappers.SortableTree; -import org.eclipse.emf.facet.common.ui.internal.controls.wrappers.SortableWidget; -import org.eclipse.emf.facet.common.ui.internal.controls.wrappers.SortableWidgetFactory; -import org.eclipse.emf.facet.common.ui.internal.controls.wrappers.TableColumn; -import org.eclipse.emf.facet.common.ui.internal.controls.wrappers.TreeColumn; -import org.eclipse.jface.viewers.ColumnLabelProvider; -import org.eclipse.jface.viewers.TableViewer; -import org.eclipse.jface.viewers.TableViewerColumn; -import org.eclipse.jface.viewers.TreeViewer; -import org.eclipse.jface.viewers.TreeViewerColumn; -import org.eclipse.jface.viewers.Viewer; -import org.eclipse.jface.viewers.ViewerColumn; -import org.eclipse.jface.viewers.ViewerSorter; -import org.eclipse.swt.SWT; -import org.eclipse.swt.events.ControlAdapter; -import org.eclipse.swt.events.ControlEvent; -import org.eclipse.swt.events.SelectionAdapter; -import org.eclipse.swt.events.SelectionEvent; -import org.eclipse.ui.IMemento; -import org.eclipse.ui.part.ViewPart; - -/** - * A column in a {@link TreeViewer} or {@link TableViewer} that is sortable (using the given - * {@link ColumnLabelProvider}) and can save its width to an {@link IMemento}. - */ -public class PersistableColumn { - - /** - * Saved column widths, static because we want to be able to save column widths during the - * session (if a view is closed and re-opened), instead of only when the workbench is closed - * (which is the case with {@link ViewPart#saveState(org.eclipse.ui.IMemento)}) - */ - private static final Map<String, Integer> COLUMN_WIDTHS = new HashMap<String, Integer>(); - - /** The unique id associated to this column */ - private String fUniqueID; - - /** The underlying JFace column */ - private final ViewerColumn fViewerColumn; - - private Column getColumn() { - if (this.fViewerColumn instanceof TreeViewerColumn) { - TreeViewerColumn treeViewerColumn = (TreeViewerColumn) this.fViewerColumn; - return new TreeColumn(treeViewerColumn.getColumn()); - } else if (this.fViewerColumn instanceof TableViewerColumn) { - TableViewerColumn tableViewerColumn = (TableViewerColumn) this.fViewerColumn; - return new TableColumn(tableViewerColumn.getColumn()); - } - throw new IllegalStateException("neither a table nor tree column"); //$NON-NLS-1$ - } - - /** - * Initialize a sortable column that can be persisted to an {@link IMemento} . - * - * @param columnText - * the title of the column - * @param uniqueID - * a unique id used to persist the column width - * @param defaultWidth - * the width to use if no previous information was saved - * @param columnLabelProvider - * the label provider for this column - */ - protected void init(final String columnText, final String uniqueID, final int defaultWidth, - final ColumnLabelProvider columnLabelProvider) { - this.fUniqueID = uniqueID; - final Column column = getColumn(); - column.setText(columnText); - - Integer width = PersistableColumn.getColumnWidths().get(uniqueID); - if (width != null) { - column.setWidth(width.intValue()); - } else { - column.setWidth(defaultWidth); - } - column.addControlListener(new ControlAdapter() { - @Override - public void controlResized(final ControlEvent e) { - PersistableColumn.getColumnWidths().put(uniqueID, new Integer(column.getWidth())); - } - }); - - this.fViewerColumn.setLabelProvider(columnLabelProvider); - } - - /** - * Create a sortable column that can be persisted to an {@link IMemento}. - * - * @param columnText - * the title of the column - * @param uniqueID - * a unique id used to persist the column width - * @param defaultWidth - * the width to use if no previous information was saved - * @param columnLabelProvider - * the label provider for this column - * @param treeViewer - * the {@link TreeViewer} in which to create the column - */ - public PersistableColumn(final String columnText, final String uniqueID, - final int defaultWidth, final ColumnLabelProvider columnLabelProvider, - final TreeViewer treeViewer) { - TreeViewerColumn treeViewerColumn = new TreeViewerColumn(treeViewer, SWT.NONE); - this.fViewerColumn = treeViewerColumn; - init(columnText, uniqueID, defaultWidth, columnLabelProvider); - - addSorter(new TreeColumn(treeViewerColumn.getColumn()), - getViewerSorter(columnLabelProvider), new SortableTree(treeViewer)); - } - - /** - * Create a sortable column that can be persisted to an {@link IMemento}. - * - * @param columnText - * the title of the column - * @param uniqueID - * a unique id used to persist the column width - * @param defaultWidth - * the width to use if no previous information was saved - * @param columnLabelProvider - * the label provider for this column - * @param tableViewer - * the {@link TableViewer} in which to create the column - */ - public PersistableColumn(final String columnText, final String uniqueID, - final int defaultWidth, final ColumnLabelProvider columnLabelProvider, - final TableViewer tableViewer) { - TableViewerColumn tableViewerColumn = new TableViewerColumn(tableViewer, SWT.NONE); - this.fViewerColumn = tableViewerColumn; - init(columnText, uniqueID, defaultWidth, columnLabelProvider); - - addSorter(new TableColumn(tableViewerColumn.getColumn()), - getViewerSorter(columnLabelProvider), new SortableTable(tableViewer)); - } - - private static ViewerSorter getViewerSorter(final ColumnLabelProvider columnLabelProvider) { - return new ViewerSorter() { - @Override - public int compare(final Viewer viewer, final Object e1, final Object e2) { - String text1 = columnLabelProvider.getText(e1); - String text2 = columnLabelProvider.getText(e2); - if (text1 == null) { - return -1; - } - int compare = text1.compareTo(text2); - SortableWidget sortableWidget = SortableWidgetFactory.createSortableWidget(viewer); - if (sortableWidget.getSortDirection() == SWT.DOWN) { - compare = compare * -1; - } - return compare; - } - }; - } - - private static void addSorter(final Column column, final ViewerSorter viewerSorter, - final SortableWidget sortableWidget) { - column.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(final SelectionEvent e) { - sortableWidget.setSorter(viewerSorter); - sortableWidget.setSortColumn(column); - if (sortableWidget.getSortDirection() == SWT.UP) { - sortableWidget.setSortDirection(SWT.DOWN); - } else if (sortableWidget.getSortDirection() == SWT.DOWN) { - sortableWidget.setSortDirection(SWT.UP); - } else { - sortableWidget.setSortDirection(SWT.UP); - } - sortableWidget.refresh(); - } - }); - } - - public void saveState(final IMemento memento) { - Integer width = PersistableColumn.getColumnWidths().get(this.fUniqueID); - if (width != null) { - memento.putInteger(this.fUniqueID, width.intValue()); - } - } - - /** - * Loads the saved state from the given {@link IMemento}. Columns created using the given id - * after this call will have their width set to the value that was loaded. - */ - public static void loadState(final IMemento memento, final String columnID) { - Integer width = memento.getInteger(columnID); - if (width != null) { - PersistableColumn.getColumnWidths().put(columnID, width); - } - } - - public void setWidth(final int width) { - getColumn().setWidth(width); - } - - protected static Map<String, Integer> getColumnWidths() { - return PersistableColumn.COLUMN_WIDTHS; - } -}
diff --git a/org.eclipse.modisco.facet.common.ui/src/org/eclipse/emf/facet/common/ui/internal/controls/wrappers/Column.java b/org.eclipse.modisco.facet.common.ui/src/org/eclipse/emf/facet/common/ui/internal/controls/wrappers/Column.java deleted file mode 100644 index 74ceb38..0000000 --- a/org.eclipse.modisco.facet.common.ui/src/org/eclipse/emf/facet/common/ui/internal/controls/wrappers/Column.java +++ /dev/null
@@ -1,33 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2011 Mia-Software. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Nicolas Bros (Mia-Software) - initial API and implementation - * Nicolas Bros (Mia-Software) - Bug 334116 - common tree view with columns - *******************************************************************************/ -package org.eclipse.emf.facet.common.ui.internal.controls.wrappers; - -import org.eclipse.swt.events.ControlListener; -import org.eclipse.swt.events.SelectionListener; -import org.eclipse.swt.widgets.Item; -import org.eclipse.swt.widgets.TableColumn; -import org.eclipse.swt.widgets.TreeColumn; - -/** Provides a unified API over both SWT {@link TreeColumn} and {@link TableColumn} */ -public interface Column { - void setText(String columnText); - - void addControlListener(ControlListener controlListener); - - void addSelectionListener(SelectionListener selectionListener); - - void setWidth(int width); - - int getWidth(); - - Item getColumn(); -} \ No newline at end of file
diff --git a/org.eclipse.modisco.facet.common.ui/src/org/eclipse/emf/facet/common/ui/internal/controls/wrappers/SortableTable.java b/org.eclipse.modisco.facet.common.ui/src/org/eclipse/emf/facet/common/ui/internal/controls/wrappers/SortableTable.java deleted file mode 100644 index ef0b755..0000000 --- a/org.eclipse.modisco.facet.common.ui/src/org/eclipse/emf/facet/common/ui/internal/controls/wrappers/SortableTable.java +++ /dev/null
@@ -1,47 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2011 Mia-Software. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Nicolas Bros (Mia-Software) - initial API and implementation - * Nicolas Bros (Mia-Software) - Bug 334116 - common tree view with columns - *******************************************************************************/ -package org.eclipse.emf.facet.common.ui.internal.controls.wrappers; - -import org.eclipse.jface.viewers.TableViewer; -import org.eclipse.jface.viewers.ViewerSorter; - -/** - * Implements {@link SortableWidget}'s unified API for the JFace {@link TableViewer}. - */ -public class SortableTable implements SortableWidget { - private final TableViewer tableViewer; - - public SortableTable(final TableViewer tableViewer) { - this.tableViewer = tableViewer; - } - - public void setSorter(final ViewerSorter viewerSorter) { - this.tableViewer.setSorter(viewerSorter); - } - - public int getSortDirection() { - return this.tableViewer.getTable().getSortDirection(); - } - - public void setSortDirection(final int direction) { - this.tableViewer.getTable().setSortDirection(direction); - } - - public void setSortColumn(final Column column) { - this.tableViewer.getTable().setSortColumn( - (org.eclipse.swt.widgets.TableColumn) column.getColumn()); - } - - public void refresh() { - this.tableViewer.refresh(); - } -} \ No newline at end of file
diff --git a/org.eclipse.modisco.facet.common.ui/src/org/eclipse/emf/facet/common/ui/internal/controls/wrappers/SortableTree.java b/org.eclipse.modisco.facet.common.ui/src/org/eclipse/emf/facet/common/ui/internal/controls/wrappers/SortableTree.java deleted file mode 100644 index 3f66f24..0000000 --- a/org.eclipse.modisco.facet.common.ui/src/org/eclipse/emf/facet/common/ui/internal/controls/wrappers/SortableTree.java +++ /dev/null
@@ -1,47 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2011 Mia-Software. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Nicolas Bros (Mia-Software) - initial API and implementation - * Nicolas Bros (Mia-Software) - Bug 334116 - common tree view with columns - *******************************************************************************/ -package org.eclipse.emf.facet.common.ui.internal.controls.wrappers; - -import org.eclipse.jface.viewers.TreeViewer; -import org.eclipse.jface.viewers.ViewerSorter; - -/** - * Implements {@link SortableWidget}'s unified API for the JFace {@link TreeViewer}. - */ -public class SortableTree implements SortableWidget { - private final TreeViewer treeViewer; - - public SortableTree(final TreeViewer treeViewer) { - this.treeViewer = treeViewer; - } - - public void setSorter(final ViewerSorter viewerSorter) { - this.treeViewer.setSorter(viewerSorter); - } - - public int getSortDirection() { - return this.treeViewer.getTree().getSortDirection(); - } - - public void setSortDirection(final int direction) { - this.treeViewer.getTree().setSortDirection(direction); - } - - public void setSortColumn(final Column column) { - this.treeViewer.getTree().setSortColumn( - (org.eclipse.swt.widgets.TreeColumn) column.getColumn()); - } - - public void refresh() { - this.treeViewer.refresh(); - } -} \ No newline at end of file
diff --git a/org.eclipse.modisco.facet.common.ui/src/org/eclipse/emf/facet/common/ui/internal/controls/wrappers/SortableWidget.java b/org.eclipse.modisco.facet.common.ui/src/org/eclipse/emf/facet/common/ui/internal/controls/wrappers/SortableWidget.java deleted file mode 100644 index ff9dfd9..0000000 --- a/org.eclipse.modisco.facet.common.ui/src/org/eclipse/emf/facet/common/ui/internal/controls/wrappers/SortableWidget.java +++ /dev/null
@@ -1,30 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2011 Mia-Software. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Nicolas Bros (Mia-Software) - initial API and implementation - * Nicolas Bros (Mia-Software) - Bug 334116 - common tree view with columns - *******************************************************************************/ -package org.eclipse.emf.facet.common.ui.internal.controls.wrappers; - -import org.eclipse.jface.viewers.ViewerSorter; -import org.eclipse.swt.widgets.Table; -import org.eclipse.swt.widgets.Tree; - -/** Provides a unified API over both SWT {@link Tree} and {@link Table} */ -public interface SortableWidget { - void setSorter(ViewerSorter viewerSorter); - - int getSortDirection(); - - void setSortDirection(int direction); - - void setSortColumn(Column column); - - void refresh(); - -} \ No newline at end of file
diff --git a/org.eclipse.modisco.facet.common.ui/src/org/eclipse/emf/facet/common/ui/internal/controls/wrappers/SortableWidgetFactory.java b/org.eclipse.modisco.facet.common.ui/src/org/eclipse/emf/facet/common/ui/internal/controls/wrappers/SortableWidgetFactory.java deleted file mode 100644 index ea310f5..0000000 --- a/org.eclipse.modisco.facet.common.ui/src/org/eclipse/emf/facet/common/ui/internal/controls/wrappers/SortableWidgetFactory.java +++ /dev/null
@@ -1,48 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2011 Mia-Software. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Nicolas Bros (Mia-Software) - initial API and implementation - * Nicolas Bros (Mia-Software) - Bug 334116 - common tree view with columns - *******************************************************************************/ -package org.eclipse.emf.facet.common.ui.internal.controls.wrappers; - -import org.eclipse.jface.viewers.TableViewer; -import org.eclipse.jface.viewers.TreeViewer; -import org.eclipse.jface.viewers.Viewer; -import org.eclipse.swt.widgets.Table; -import org.eclipse.swt.widgets.Tree; - -/** - * A factory to obtain a {@link SortableWidget}, that provides a unified API over both SWT - * {@link Tree} and {@link Table}. - */ -public final class SortableWidgetFactory { - - private SortableWidgetFactory() { - // utility class - } - - /** - * Get a {@link SortableWidget} for the given {@link Viewer}, that can be either a - * {@link TreeViewer} or a {@link TableViewer}. - * - * @param viewer - * a {@link TreeViewer} or a {@link TableViewer} - * @return a {@link SortableWidget} that delegates to the given viewer - */ - public static SortableWidget createSortableWidget(final Viewer viewer) { - if (viewer instanceof TreeViewer) { - TreeViewer treeViewer = (TreeViewer) viewer; - return new SortableTree(treeViewer); - } else if (viewer instanceof TableViewer) { - TableViewer tableViewer = (TableViewer) viewer; - return new SortableTable(tableViewer); - } - throw new IllegalArgumentException(); - } -} \ No newline at end of file
diff --git a/org.eclipse.modisco.facet.common.ui/src/org/eclipse/emf/facet/common/ui/internal/controls/wrappers/TableColumn.java b/org.eclipse.modisco.facet.common.ui/src/org/eclipse/emf/facet/common/ui/internal/controls/wrappers/TableColumn.java deleted file mode 100644 index 141a06f..0000000 --- a/org.eclipse.modisco.facet.common.ui/src/org/eclipse/emf/facet/common/ui/internal/controls/wrappers/TableColumn.java +++ /dev/null
@@ -1,49 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2011 Mia-Software. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Nicolas Bros (Mia-Software) - initial API and implementation - * Nicolas Bros (Mia-Software) - Bug 334116 - common tree view with columns - *******************************************************************************/ -package org.eclipse.emf.facet.common.ui.internal.controls.wrappers; - -import org.eclipse.swt.events.ControlListener; -import org.eclipse.swt.events.SelectionListener; - -/** Implements {@link Column}'s unified API for the SWT {@link org.eclipse.swt.widgets.TableColumn} */ -public class TableColumn implements Column { - private final org.eclipse.swt.widgets.TableColumn column; - - public TableColumn(final org.eclipse.swt.widgets.TableColumn column) { - this.column = column; - } - - public void setText(final String columnText) { - this.column.setText(columnText); - } - - public void setWidth(final int width) { - this.column.setWidth(width); - - } - - public void addControlListener(final ControlListener controlListener) { - this.column.addControlListener(controlListener); - } - - public void addSelectionListener(final SelectionListener selectionListener) { - this.column.addSelectionListener(selectionListener); - } - - public int getWidth() { - return this.column.getWidth(); - } - - public org.eclipse.swt.widgets.TableColumn getColumn() { - return this.column; - } -} \ No newline at end of file
diff --git a/org.eclipse.modisco.facet.common.ui/src/org/eclipse/emf/facet/common/ui/internal/controls/wrappers/TreeColumn.java b/org.eclipse.modisco.facet.common.ui/src/org/eclipse/emf/facet/common/ui/internal/controls/wrappers/TreeColumn.java deleted file mode 100644 index c30a1fb..0000000 --- a/org.eclipse.modisco.facet.common.ui/src/org/eclipse/emf/facet/common/ui/internal/controls/wrappers/TreeColumn.java +++ /dev/null
@@ -1,49 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2011 Mia-Software. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Nicolas Bros (Mia-Software) - initial API and implementation - * Nicolas Bros (Mia-Software) - Bug 334116 - common tree view with columns - *******************************************************************************/ -package org.eclipse.emf.facet.common.ui.internal.controls.wrappers; - -import org.eclipse.swt.events.ControlListener; -import org.eclipse.swt.events.SelectionListener; - -/** Implements {@link Column}'s unified API for the SWT {@link org.eclipse.swt.widgets.TreeColumn} */ -public class TreeColumn implements Column { - private final org.eclipse.swt.widgets.TreeColumn column; - - public TreeColumn(final org.eclipse.swt.widgets.TreeColumn column) { - this.column = column; - } - - public void setText(final String columnText) { - this.column.setText(columnText); - } - - public void setWidth(final int width) { - this.column.setWidth(width); - - } - - public void addControlListener(final ControlListener controlListener) { - this.column.addControlListener(controlListener); - } - - public void addSelectionListener(final SelectionListener selectionListener) { - this.column.addSelectionListener(selectionListener); - } - - public int getWidth() { - return this.column.getWidth(); - } - - public org.eclipse.swt.widgets.TreeColumn getColumn() { - return this.column; - } -} \ No newline at end of file
diff --git a/org.eclipse.modisco.facet.common.ui/src/org/eclipse/emf/facet/common/ui/internal/exported/views/IColumnDescription.java b/org.eclipse.modisco.facet.common.ui/src/org/eclipse/emf/facet/common/ui/internal/exported/views/IColumnDescription.java deleted file mode 100644 index 6aa0199..0000000 --- a/org.eclipse.modisco.facet.common.ui/src/org/eclipse/emf/facet/common/ui/internal/exported/views/IColumnDescription.java +++ /dev/null
@@ -1,34 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2012 CEA LIST. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Nicolas Bros (Mia-Software) - Bug 372732 - [Facet] Rewrite the catalog views for 0.2 - *******************************************************************************/ -package org.eclipse.emf.facet.common.ui.internal.exported.views; - -import org.eclipse.jface.viewers.ColumnLabelProvider; - -/** - * Contains the data necessary to create a column in a view created by - * {@link IElementsViewFactory#createElementsView(java.util.Collection, org.eclipse.jface.viewers.ITreeContentProvider, Object, String, org.eclipse.swt.graphics.Image, org.eclipse.jface.viewers.IOpenListener) IElementsViewFactory#createElementsView} - */ -public interface IColumnDescription { - /** The column's label */ - String getTitle(); - - /** A unique id for the column */ - String getUniqueID(); - - /** The default width that will be used the first time the column is displayed */ - int getDefaultWidth(); - - /** - * A label provider that returns the text (and optionally image and other font attributes) for each element in this - * column - */ - ColumnLabelProvider getColumnLabelProvider(); -}
diff --git a/org.eclipse.modisco.facet.common.ui/src/org/eclipse/emf/facet/common/ui/internal/exported/views/IElementsViewFactory.java b/org.eclipse.modisco.facet.common.ui/src/org/eclipse/emf/facet/common/ui/internal/exported/views/IElementsViewFactory.java deleted file mode 100644 index 271e4c9..0000000 --- a/org.eclipse.modisco.facet.common.ui/src/org/eclipse/emf/facet/common/ui/internal/exported/views/IElementsViewFactory.java +++ /dev/null
@@ -1,68 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2012 CEA LIST. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Nicolas Bros (Mia-Software) - Bug 372732 - [Facet] Rewrite the catalog views for 0.2 - *******************************************************************************/ - -package org.eclipse.emf.facet.common.ui.internal.exported.views; - -import java.util.Collection; - -import org.eclipse.emf.facet.common.ui.internal.views.ElementsViewFactory; -import org.eclipse.jface.viewers.ColumnLabelProvider; -import org.eclipse.jface.viewers.IOpenListener; -import org.eclipse.jface.viewers.ITreeContentProvider; -import org.eclipse.swt.graphics.Image; -import org.eclipse.ui.part.ViewPart; - -/** - * Creates Eclipse views to display lists of elements. To be able to register this view in a non-RCP Eclipse, you will - * have to register an IExecutableExtensionFactory that will do the actual instantiation. - */ -public interface IElementsViewFactory { - IElementsViewFactory DEFAULT = new ElementsViewFactory(); - - /** - * Creates a view with columns. Each column has a default width, and memorizes its width once resized. - * - * @param columnDescriptions - * describes the columns - * @param contentProvider - * provides the content from the input - * @param input - * the view's input - * @param title - * the part's label - * @param titleImage - * the part's image - * @param openListener - * a listener called when hitting Enter or double-clicking on an element in the view - * @return the view part - */ - ViewPart createElementsView(Collection<? extends IColumnDescription> columnDescriptions, - ITreeContentProvider contentProvider, Object input, String title, Image titleImage, IOpenListener openListener); - - /** - * Creates a column description for - * {@link IElementsViewFactory#createElementsView(Collection, ITreeContentProvider, Object, String, Image, IOpenListener) - * createElementsView} - * - * @param title - * the column label - * @param uniqueID - * a unique ID that will identify the column (used for serialization) - * @param defaultWidth - * the initial width of the column, before the user resizes it - * @param columnLabelProvider - * A label provider that returns the text (and optionally image and other font attributes) for each - * element in this column - * @return a column description - */ - IColumnDescription createColumnDescription(String title, String uniqueID, - int defaultWidth, ColumnLabelProvider columnLabelProvider); -}
diff --git a/org.eclipse.modisco.facet.common.ui/src/org/eclipse/emf/facet/common/ui/internal/preference/pages/EmfFacetRootPreferencePage.java b/org.eclipse.modisco.facet.common.ui/src/org/eclipse/emf/facet/common/ui/internal/preference/pages/EmfFacetRootPreferencePage.java deleted file mode 100644 index 28708ad..0000000 --- a/org.eclipse.modisco.facet.common.ui/src/org/eclipse/emf/facet/common/ui/internal/preference/pages/EmfFacetRootPreferencePage.java +++ /dev/null
@@ -1,59 +0,0 @@ -/********************************************************************************** - * Copyright (c) 2011 Mia-Software. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Nicolas Guyomar (Mia-Software) - Bug 333652 Extension point offering the possibility to declare an EPackage browser - ***********************************************************************************/ -package org.eclipse.emf.facet.common.ui.internal.preference.pages; - -import org.eclipse.emf.facet.common.ui.internal.Activator; -import org.eclipse.jface.preference.FieldEditorPreferencePage; -import org.eclipse.ui.IWorkbench; -import org.eclipse.ui.IWorkbenchPreferencePage; - -/** - * This class is the EmfFacet root preference page that is contributed to the - * Preferences dialog. By sub-classing {@link FieldEditorPreferencePage}, we can - * use the field support built into JFace that allows us to create a page that - * is small and knows how to save, restore and apply itself. - * <p> - * This page is used to modify preferences, that are stored in the preference - * store that belongs to the main plug-in class. That way, preferences can be - * accessed directly via the preference store. - */ - -public class EmfFacetRootPreferencePage extends FieldEditorPreferencePage - implements IWorkbenchPreferencePage { - - public static final String P_DEFAULT_EPACKAGE_VIEWER = "emf_facet_default_epackage_viewer"; //$NON-NLS-1$ - - public EmfFacetRootPreferencePage() { - super(FieldEditorPreferencePage.GRID); - setPreferenceStore(Activator.getDefault().getPreferenceStore()); - } - - /** - * Creates the field editors. Field editors are abstractions of the common - * GUI blocks needed to manipulate various types of preferences. Each field - * editor knows how to save and restore itself. - */ - @Override - public void createFieldEditors() { - // The page is empty for now - } - - /* - * (non-Javadoc) - * - * @see - * org.eclipse.ui.IWorkbenchPreferencePage#init(org.eclipse.ui.IWorkbench) - */ - public void init(final IWorkbench workbench) { - // Nothing to do - } - -} \ No newline at end of file
diff --git a/org.eclipse.modisco.facet.common.ui/src/org/eclipse/emf/facet/common/ui/internal/views/AbstractTreeView.java b/org.eclipse.modisco.facet.common.ui/src/org/eclipse/emf/facet/common/ui/internal/views/AbstractTreeView.java deleted file mode 100644 index 5b17612..0000000 --- a/org.eclipse.modisco.facet.common.ui/src/org/eclipse/emf/facet/common/ui/internal/views/AbstractTreeView.java +++ /dev/null
@@ -1,176 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Mia-Software. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Nicolas Bros (Mia-Software) - initial API and implementation - * Nicolas Bros (Mia-Software) - Bug 334116 - common tree view with columns - *******************************************************************************/ - -package org.eclipse.emf.facet.common.ui.internal.views; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.Status; -import org.eclipse.core.runtime.jobs.Job; -import org.eclipse.emf.facet.common.ui.internal.Activator; -import org.eclipse.emf.facet.common.ui.internal.controls.PersistableColumn; -import org.eclipse.emf.facet.util.core.Logger; -import org.eclipse.jface.action.GroupMarker; -import org.eclipse.jface.action.MenuManager; -import org.eclipse.jface.viewers.ColumnLabelProvider; -import org.eclipse.jface.viewers.IContentProvider; -import org.eclipse.jface.viewers.IOpenListener; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.jface.viewers.OpenEvent; -import org.eclipse.jface.viewers.TreeViewer; -import org.eclipse.swt.SWT; -import org.eclipse.swt.layout.FillLayout; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Display; -import org.eclipse.swt.widgets.Menu; -import org.eclipse.ui.IMemento; -import org.eclipse.ui.IViewSite; -import org.eclipse.ui.IWorkbenchActionConstants; -import org.eclipse.ui.PartInitException; -import org.eclipse.ui.part.ViewPart; - -/** An abstract Eclipse view that displays a list of elements. */ -public abstract class AbstractTreeView extends ViewPart { - - private final List<PersistableColumn> columns = new ArrayList<PersistableColumn>(); - private final Map<String, Integer> persistedValues = new HashMap<String, Integer>(); - - private static final int JOB_SCHEDULE_DELAY = 500; - private Job fRefreshJob = null; - - private TreeViewer fTreeViewer; - - public TreeViewer getViewer() { - return this.fTreeViewer; - } - - @Override - public void createPartControl(final Composite parent) { - parent.setLayout(new FillLayout()); - - this.fTreeViewer = new TreeViewer(parent, SWT.H_SCROLL | SWT.V_SCROLL | SWT.SINGLE - | SWT.FULL_SELECTION); - this.fTreeViewer.getTree().setLinesVisible(true); - this.fTreeViewer.getTree().setHeaderVisible(true); - - this.fTreeViewer.addOpenListener(new IOpenListener() { - public void open(final OpenEvent event) { - IStructuredSelection selection = (IStructuredSelection) AbstractTreeView.this - .getViewer().getSelection(); - openElement(selection.getFirstElement()); - } - }); - - createColumns(); - - this.fTreeViewer.setContentProvider(getContentProvider()); - - createContextMenu(); - getSite().setSelectionProvider(this.fTreeViewer); - refresh(false); - } - - protected void createContextMenu() { - final MenuManager contextMenu = new MenuManager("#PopUp"); //$NON-NLS-1$ - contextMenu.add(new GroupMarker(IWorkbenchActionConstants.MB_ADDITIONS)); - final Menu menu = contextMenu.createContextMenu(getViewer().getControl()); - getViewer().getControl().setMenu(menu); - getSite().registerContextMenu(contextMenu, getViewer()); - } - - protected abstract void createColumns(); - - protected abstract IContentProvider getContentProvider(); - - protected abstract void openElement(Object element); - - @Override - public void setFocus() { - this.fTreeViewer.getControl().setFocus(); - } - - /** Optionally delayed refresh */ - protected void refresh(final boolean delayed) { - if (this.fRefreshJob == null) { - this.fRefreshJob = new Job(getRefreshMessage()) { - @Override - protected IStatus run(final IProgressMonitor monitor) { - doRefresh(); - return Status.OK_STATUS; - } - }; - } - // delayed until it stops changing - this.fRefreshJob.cancel(); - if (delayed) { - this.fRefreshJob.setPriority(Job.DECORATE); - this.fRefreshJob.schedule(AbstractTreeView.JOB_SCHEDULE_DELAY); - } else { - this.fRefreshJob.setPriority(Job.INTERACTIVE); - this.fRefreshJob.schedule(); - } - } - - protected abstract String getRefreshMessage(); - - protected abstract Object getInput(); - - protected void doRefresh() { - // Accesses the catalog, which can block if done inside the UI thread. - final Object input = getInput(); - Display.getDefault().asyncExec(new Runnable() { - public void run() { - getViewer().setInput(input); - getViewer().refresh(); - } - }); - } - - protected void createColumn(final String columnText, final String uniqueID, - final int defaultWidth, final ColumnLabelProvider columnLabelProvider) { - PersistableColumn persistableColumn = new PersistableColumn(columnText, uniqueID, - defaultWidth, columnLabelProvider, this.fTreeViewer); - this.columns.add(persistableColumn); - Integer width = this.persistedValues.get(uniqueID); - if (width != null) { - persistableColumn.setWidth(width.intValue()); - } - } - - @Override - public void saveState(final IMemento memento) { - super.saveState(memento); - try { - for (PersistableColumn column : this.columns) { - column.saveState(memento); - } - } catch (Exception e) { - Logger.logError(e, "Error saving view state", Activator.getDefault()); //$NON-NLS-1$ - } - } - - @Override - public void init(final IViewSite site, final IMemento memento) throws PartInitException { - super.init(site, memento); - if (memento != null) { - String[] attributeKeys = memento.getAttributeKeys(); - for (String key : attributeKeys) { - this.persistedValues.put(key, memento.getInteger(key)); - } - } - } -}
diff --git a/org.eclipse.modisco.facet.common.ui/src/org/eclipse/emf/facet/common/ui/internal/views/ElementsView.java b/org.eclipse.modisco.facet.common.ui/src/org/eclipse/emf/facet/common/ui/internal/views/ElementsView.java deleted file mode 100644 index 28d18ad..0000000 --- a/org.eclipse.modisco.facet.common.ui/src/org/eclipse/emf/facet/common/ui/internal/views/ElementsView.java +++ /dev/null
@@ -1,208 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010-2012 Mia-Software. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Nicolas Bros (Mia-Software) - initial API and implementation - * Nicolas Bros (Mia-Software) - Bug 334116 - common tree view with columns - * Nicolas Bros (Mia-Software) - Bug 372732 - [Facet] Rewrite the catalog views for 0.2 - *******************************************************************************/ -package org.eclipse.emf.facet.common.ui.internal.views; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.Status; -import org.eclipse.core.runtime.jobs.Job; -import org.eclipse.emf.facet.common.ui.internal.Activator; -import org.eclipse.emf.facet.common.ui.internal.Messages; -import org.eclipse.emf.facet.common.ui.internal.controls.PersistableColumn; -import org.eclipse.emf.facet.common.ui.internal.exported.views.IColumnDescription; -import org.eclipse.emf.facet.util.core.Logger; -import org.eclipse.jface.action.GroupMarker; -import org.eclipse.jface.action.MenuManager; -import org.eclipse.jface.viewers.ColumnLabelProvider; -import org.eclipse.jface.viewers.IContentProvider; -import org.eclipse.jface.viewers.IOpenListener; -import org.eclipse.jface.viewers.ITreeContentProvider; -import org.eclipse.jface.viewers.OpenEvent; -import org.eclipse.jface.viewers.TreeViewer; -import org.eclipse.osgi.util.NLS; -import org.eclipse.swt.SWT; -import org.eclipse.swt.graphics.Image; -import org.eclipse.swt.layout.FillLayout; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Display; -import org.eclipse.swt.widgets.Menu; -import org.eclipse.ui.IMemento; -import org.eclipse.ui.IViewSite; -import org.eclipse.ui.IWorkbenchActionConstants; -import org.eclipse.ui.PartInitException; -import org.eclipse.ui.part.ViewPart; - -public class ElementsView extends ViewPart { - - private static final int JOB_SCHEDULE_DELAY = 500; - private final Collection<? extends IColumnDescription> columnDescriptions; - private final ITreeContentProvider contentProvider; - private final Object input; - private final List<PersistableColumn> columns = new ArrayList<PersistableColumn>(); - private final Map<String, Integer> persistedValues = new HashMap<String, Integer>(); - private TreeViewer treeViewer; - private Job refreshJob = null; - private final IOpenListener openListener; - private final String title; - private final Image titleImage; - - public ElementsView(final Collection<? extends IColumnDescription> columnDescriptions, - final ITreeContentProvider contentProvider, final Object input, final String title, final Image titleImage, final IOpenListener openListener) { - this.columnDescriptions = columnDescriptions; - this.contentProvider = contentProvider; - this.input = input; - this.title = title; - this.titleImage = titleImage; - this.openListener = openListener; - } - - public TreeViewer getViewer() { - return this.treeViewer; - } - - @Override - public void createPartControl(final Composite parent) { - setPartName(this.title); - setTitleImage(this.titleImage); - parent.setLayout(new FillLayout()); - - this.treeViewer = new TreeViewer(parent, SWT.H_SCROLL | SWT.V_SCROLL | SWT.SINGLE - | SWT.FULL_SELECTION); - this.treeViewer.getTree().setLinesVisible(true); - this.treeViewer.getTree().setHeaderVisible(true); - - this.treeViewer.addOpenListener(new IOpenListener() { - public void open(final OpenEvent event) { - ElementsView.this.open(event); - } - }); - - createColumns(); - this.treeViewer.setContentProvider(getContentProvider()); - createContextMenu(); - getSite().setSelectionProvider(this.treeViewer); - refresh(false); - } - - protected void createContextMenu() { - final MenuManager contextMenu = new MenuManager("#PopUp"); //$NON-NLS-1$ - contextMenu.add(new GroupMarker(IWorkbenchActionConstants.MB_ADDITIONS)); - final Menu menu = contextMenu.createContextMenu(getViewer().getControl()); - getViewer().getControl().setMenu(menu); - getSite().registerContextMenu(contextMenu, getViewer()); - } - - protected void createColumns() { - for (IColumnDescription columnDescription : this.columnDescriptions) { - createColumn(columnDescription.getTitle(), columnDescription.getUniqueID(), - columnDescription.getDefaultWidth(), columnDescription.getColumnLabelProvider()); - } - } - - protected IContentProvider getContentProvider() { - return this.contentProvider; - } - - protected void open(final OpenEvent event) { - if (this.openListener != null) { - this.openListener.open(event); - } - } - - @Override - public void setFocus() { - this.treeViewer.getControl().setFocus(); - } - - /** Optionally delayed refresh */ - protected void refresh(final boolean delayed) { - if (this.refreshJob == null) { - this.refreshJob = new Job(getRefreshMessage()) { - @Override - protected IStatus run(final IProgressMonitor monitor) { - doRefresh(); - return Status.OK_STATUS; - } - }; - } - // delayed until it stops changing - this.refreshJob.cancel(); - if (delayed) { - this.refreshJob.setPriority(Job.DECORATE); - this.refreshJob.schedule(ElementsView.JOB_SCHEDULE_DELAY); - } else { - this.refreshJob.setPriority(Job.INTERACTIVE); - this.refreshJob.schedule(); - } - } - - protected String getRefreshMessage() { - return NLS.bind(Messages.ElementsView_refreshJobTitle, this.title); - } - - protected Object getInput() { - return this.input; - } - - protected void doRefresh() { - // Accesses the catalog, which can block if done inside the UI thread. - final Object viewerInput = getInput(); - Display.getDefault().asyncExec(new Runnable() { - public void run() { - getViewer().setInput(viewerInput); - getViewer().refresh(); - } - }); - } - - protected void createColumn(final String columnText, final String uniqueID, - final int defaultWidth, final ColumnLabelProvider columnLabelProvider) { - PersistableColumn persistableColumn = new PersistableColumn(columnText, uniqueID, - defaultWidth, columnLabelProvider, this.treeViewer); - this.columns.add(persistableColumn); - Integer width = this.persistedValues.get(uniqueID); - if (width != null) { - persistableColumn.setWidth(width.intValue()); - } - } - - @Override - public void saveState(final IMemento memento) { - super.saveState(memento); - try { - for (PersistableColumn column : this.columns) { - column.saveState(memento); - } - } catch (Exception e) { - Logger.logError(e, "Error saving view state", Activator.getDefault()); //$NON-NLS-1$ - } - } - - @Override - public void init(final IViewSite site, final IMemento memento) throws PartInitException { - super.init(site, memento); - if (memento != null) { - String[] attributeKeys = memento.getAttributeKeys(); - for (String key : attributeKeys) { - this.persistedValues.put(key, memento.getInteger(key)); - } - } - } - -}
diff --git a/org.eclipse.modisco.facet.common.ui/src/org/eclipse/emf/facet/common/ui/internal/views/ElementsViewFactory.java b/org.eclipse.modisco.facet.common.ui/src/org/eclipse/emf/facet/common/ui/internal/views/ElementsViewFactory.java deleted file mode 100644 index ed4539a..0000000 --- a/org.eclipse.modisco.facet.common.ui/src/org/eclipse/emf/facet/common/ui/internal/views/ElementsViewFactory.java +++ /dev/null
@@ -1,52 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2012 CEA LIST. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Nicolas Bros (Mia-Software) - Bug 372732 - [Facet] Rewrite the catalog views for 0.2 - *******************************************************************************/ - -package org.eclipse.emf.facet.common.ui.internal.views; - -import java.util.Collection; - -import org.eclipse.emf.facet.common.ui.internal.exported.views.IColumnDescription; -import org.eclipse.emf.facet.common.ui.internal.exported.views.IElementsViewFactory; -import org.eclipse.jface.viewers.ColumnLabelProvider; -import org.eclipse.jface.viewers.IOpenListener; -import org.eclipse.jface.viewers.ITreeContentProvider; -import org.eclipse.swt.graphics.Image; -import org.eclipse.ui.part.ViewPart; - -public class ElementsViewFactory implements IElementsViewFactory { - - public ViewPart createElementsView(final Collection<? extends IColumnDescription> columns, - final ITreeContentProvider contentProvider, final Object input, final String title, final Image titleImage, final IOpenListener openListener) { - return new ElementsView(columns, contentProvider, input, title, titleImage, openListener); - } - - public IColumnDescription createColumnDescription(final String columnText, - final String uniqueID, final int defaultWidth, - final ColumnLabelProvider columnLabelProvider) { - return new IColumnDescription() { - public String getUniqueID() { - return uniqueID; - } - - public int getDefaultWidth() { - return defaultWidth; - } - - public String getTitle() { - return columnText; - } - - public ColumnLabelProvider getColumnLabelProvider() { - return columnLabelProvider; - } - }; - } -}
diff --git a/org.eclipse.modisco.facet.common.ui/src/org/eclipse/emf/facet/common/ui/internal/widgets/AnywhereFilterMatcher.java b/org.eclipse.modisco.facet.common.ui/src/org/eclipse/emf/facet/common/ui/internal/widgets/AnywhereFilterMatcher.java deleted file mode 100644 index 393a2ad..0000000 --- a/org.eclipse.modisco.facet.common.ui/src/org/eclipse/emf/facet/common/ui/internal/widgets/AnywhereFilterMatcher.java +++ /dev/null
@@ -1,28 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Mia-Software. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Nicolas Bros (Mia-Software) - *******************************************************************************/ -package org.eclipse.emf.facet.common.ui.internal.widgets; - -import org.eclipse.emf.facet.common.core.internal.utils.StringMatcher; -import org.eclipse.ui.dialogs.FilteredList.FilterMatcher; - -/** This is a matcher that matches anywhere, not just at the beginning. */ -public class AnywhereFilterMatcher implements FilterMatcher { - private StringMatcher fMatcher; - - public void setFilter(final String pattern, final boolean ignoreCase, - final boolean ignoreWildCards) { - this.fMatcher = new StringMatcher('*' + pattern + '*', ignoreCase, ignoreWildCards); - } - - public boolean match(final Object element) { - return this.fMatcher.match(element.toString()); - } -}
diff --git a/org.eclipse.modisco.facet.common.ui/src/org/eclipse/modisco/facet/common/ui/internal/Activator.java b/org.eclipse.modisco.facet.common.ui/src/org/eclipse/modisco/facet/common/ui/internal/Activator.java new file mode 100644 index 0000000..fbf84e4 --- /dev/null +++ b/org.eclipse.modisco.facet.common.ui/src/org/eclipse/modisco/facet/common/ui/internal/Activator.java
@@ -0,0 +1,53 @@ +/** + * Copyright (c) 2011 Mia-Software. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Nicolas Guyomar (Mia-Software) - Bug 333652 Extension point offering the possibility to declare an EPackage browser + */ +package org.eclipse.modisco.facet.common.ui.internal; + +import org.eclipse.ui.plugin.AbstractUIPlugin; +import org.osgi.framework.BundleContext; + +/** + * The activator class controls the plug-in life cycle + */ +public class Activator extends AbstractUIPlugin { + + public static final String PLUGIN_ID = "org.eclipse.emf.facet.common.ui"; //$NON-NLS-1$ + + private static Activator plugin; + + /** + * The constructor + */ + public Activator() { + } + + @Override + public void start(final BundleContext context) throws Exception { + super.start(context); + Activator.plugin = this; + } + + @Override + public void stop(final BundleContext context) throws Exception { + Activator.plugin = null; + super.stop(context); + } + + /** + * Returns the shared instance + * + * @return the shared instance + */ + public static Activator getDefault() { + return Activator.plugin; + } + +}
diff --git a/org.eclipse.modisco.facet.common.ui/src/org/eclipse/modisco/facet/common/ui/internal/Messages.java b/org.eclipse.modisco.facet.common.ui/src/org/eclipse/modisco/facet/common/ui/internal/Messages.java new file mode 100644 index 0000000..751ae7a --- /dev/null +++ b/org.eclipse.modisco.facet.common.ui/src/org/eclipse/modisco/facet/common/ui/internal/Messages.java
@@ -0,0 +1,25 @@ +/******************************************************************************* + * Copyright (c) 2012 CEA LIST. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Nicolas Bros (Mia-Software) - Bug 372732 - [Facet] Rewrite the catalog views for 0.2 + *******************************************************************************/ +package org.eclipse.modisco.facet.common.ui.internal; + +import org.eclipse.osgi.util.NLS; + +public class Messages extends NLS { + private static final String BUNDLE_NAME = "org.eclipse.emf.facet.common.ui.internal.messages"; //$NON-NLS-1$ + public static String ElementsView_refreshJobTitle; + static { + // initialize resource bundle + NLS.initializeMessages(BUNDLE_NAME, Messages.class); + } + + private Messages() { + } +}
diff --git a/org.eclipse.modisco.facet.common.ui/src/org/eclipse/modisco/facet/common/ui/internal/controls/PersistableColumn.java b/org.eclipse.modisco.facet.common.ui/src/org/eclipse/modisco/facet/common/ui/internal/controls/PersistableColumn.java new file mode 100644 index 0000000..e890296 --- /dev/null +++ b/org.eclipse.modisco.facet.common.ui/src/org/eclipse/modisco/facet/common/ui/internal/controls/PersistableColumn.java
@@ -0,0 +1,217 @@ +/******************************************************************************* + * Copyright (c) 2011 Mia-Software. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Nicolas Bros (Mia-Software) - initial API and implementation + * Nicolas Bros (Mia-Software) - Bug 334116 - common tree view with columns + *******************************************************************************/ +package org.eclipse.modisco.facet.common.ui.internal.controls; + +import java.util.HashMap; +import java.util.Map; + +import org.eclipse.jface.viewers.ColumnLabelProvider; +import org.eclipse.jface.viewers.TableViewer; +import org.eclipse.jface.viewers.TableViewerColumn; +import org.eclipse.jface.viewers.TreeViewer; +import org.eclipse.jface.viewers.TreeViewerColumn; +import org.eclipse.jface.viewers.Viewer; +import org.eclipse.jface.viewers.ViewerColumn; +import org.eclipse.jface.viewers.ViewerSorter; +import org.eclipse.modisco.facet.common.ui.internal.controls.wrappers.Column; +import org.eclipse.modisco.facet.common.ui.internal.controls.wrappers.SortableTable; +import org.eclipse.modisco.facet.common.ui.internal.controls.wrappers.SortableTree; +import org.eclipse.modisco.facet.common.ui.internal.controls.wrappers.SortableWidget; +import org.eclipse.modisco.facet.common.ui.internal.controls.wrappers.SortableWidgetFactory; +import org.eclipse.modisco.facet.common.ui.internal.controls.wrappers.TableColumn; +import org.eclipse.modisco.facet.common.ui.internal.controls.wrappers.TreeColumn; +import org.eclipse.swt.SWT; +import org.eclipse.swt.events.ControlAdapter; +import org.eclipse.swt.events.ControlEvent; +import org.eclipse.swt.events.SelectionAdapter; +import org.eclipse.swt.events.SelectionEvent; +import org.eclipse.ui.IMemento; +import org.eclipse.ui.part.ViewPart; + +/** + * A column in a {@link TreeViewer} or {@link TableViewer} that is sortable (using the given + * {@link ColumnLabelProvider}) and can save its width to an {@link IMemento}. + */ +public class PersistableColumn { + + /** + * Saved column widths, static because we want to be able to save column widths during the + * session (if a view is closed and re-opened), instead of only when the workbench is closed + * (which is the case with {@link ViewPart#saveState(org.eclipse.ui.IMemento)}) + */ + private static final Map<String, Integer> COLUMN_WIDTHS = new HashMap<String, Integer>(); + + /** The unique id associated to this column */ + private String fUniqueID; + + /** The underlying JFace column */ + private final ViewerColumn fViewerColumn; + + private Column getColumn() { + if (this.fViewerColumn instanceof TreeViewerColumn) { + TreeViewerColumn treeViewerColumn = (TreeViewerColumn) this.fViewerColumn; + return new TreeColumn(treeViewerColumn.getColumn()); + } else if (this.fViewerColumn instanceof TableViewerColumn) { + TableViewerColumn tableViewerColumn = (TableViewerColumn) this.fViewerColumn; + return new TableColumn(tableViewerColumn.getColumn()); + } + throw new IllegalStateException("neither a table nor tree column"); //$NON-NLS-1$ + } + + /** + * Initialize a sortable column that can be persisted to an {@link IMemento} . + * + * @param columnText + * the title of the column + * @param uniqueID + * a unique id used to persist the column width + * @param defaultWidth + * the width to use if no previous information was saved + * @param columnLabelProvider + * the label provider for this column + */ + protected void init(final String columnText, final String uniqueID, final int defaultWidth, + final ColumnLabelProvider columnLabelProvider) { + this.fUniqueID = uniqueID; + final Column column = getColumn(); + column.setText(columnText); + + Integer width = PersistableColumn.getColumnWidths().get(uniqueID); + if (width != null) { + column.setWidth(width.intValue()); + } else { + column.setWidth(defaultWidth); + } + column.addControlListener(new ControlAdapter() { + @Override + public void controlResized(final ControlEvent e) { + PersistableColumn.getColumnWidths().put(uniqueID, new Integer(column.getWidth())); + } + }); + + this.fViewerColumn.setLabelProvider(columnLabelProvider); + } + + /** + * Create a sortable column that can be persisted to an {@link IMemento}. + * + * @param columnText + * the title of the column + * @param uniqueID + * a unique id used to persist the column width + * @param defaultWidth + * the width to use if no previous information was saved + * @param columnLabelProvider + * the label provider for this column + * @param treeViewer + * the {@link TreeViewer} in which to create the column + */ + public PersistableColumn(final String columnText, final String uniqueID, + final int defaultWidth, final ColumnLabelProvider columnLabelProvider, + final TreeViewer treeViewer) { + TreeViewerColumn treeViewerColumn = new TreeViewerColumn(treeViewer, SWT.NONE); + this.fViewerColumn = treeViewerColumn; + init(columnText, uniqueID, defaultWidth, columnLabelProvider); + + addSorter(new TreeColumn(treeViewerColumn.getColumn()), + getViewerSorter(columnLabelProvider), new SortableTree(treeViewer)); + } + + /** + * Create a sortable column that can be persisted to an {@link IMemento}. + * + * @param columnText + * the title of the column + * @param uniqueID + * a unique id used to persist the column width + * @param defaultWidth + * the width to use if no previous information was saved + * @param columnLabelProvider + * the label provider for this column + * @param tableViewer + * the {@link TableViewer} in which to create the column + */ + public PersistableColumn(final String columnText, final String uniqueID, + final int defaultWidth, final ColumnLabelProvider columnLabelProvider, + final TableViewer tableViewer) { + TableViewerColumn tableViewerColumn = new TableViewerColumn(tableViewer, SWT.NONE); + this.fViewerColumn = tableViewerColumn; + init(columnText, uniqueID, defaultWidth, columnLabelProvider); + + addSorter(new TableColumn(tableViewerColumn.getColumn()), + getViewerSorter(columnLabelProvider), new SortableTable(tableViewer)); + } + + private static ViewerSorter getViewerSorter(final ColumnLabelProvider columnLabelProvider) { + return new ViewerSorter() { + @Override + public int compare(final Viewer viewer, final Object e1, final Object e2) { + String text1 = columnLabelProvider.getText(e1); + String text2 = columnLabelProvider.getText(e2); + if (text1 == null) { + return -1; + } + int compare = text1.compareTo(text2); + SortableWidget sortableWidget = SortableWidgetFactory.createSortableWidget(viewer); + if (sortableWidget.getSortDirection() == SWT.DOWN) { + compare = compare * -1; + } + return compare; + } + }; + } + + private static void addSorter(final Column column, final ViewerSorter viewerSorter, + final SortableWidget sortableWidget) { + column.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(final SelectionEvent e) { + sortableWidget.setSorter(viewerSorter); + sortableWidget.setSortColumn(column); + if (sortableWidget.getSortDirection() == SWT.UP) { + sortableWidget.setSortDirection(SWT.DOWN); + } else if (sortableWidget.getSortDirection() == SWT.DOWN) { + sortableWidget.setSortDirection(SWT.UP); + } else { + sortableWidget.setSortDirection(SWT.UP); + } + sortableWidget.refresh(); + } + }); + } + + public void saveState(final IMemento memento) { + Integer width = PersistableColumn.getColumnWidths().get(this.fUniqueID); + if (width != null) { + memento.putInteger(this.fUniqueID, width.intValue()); + } + } + + /** + * Loads the saved state from the given {@link IMemento}. Columns created using the given id + * after this call will have their width set to the value that was loaded. + */ + public static void loadState(final IMemento memento, final String columnID) { + Integer width = memento.getInteger(columnID); + if (width != null) { + PersistableColumn.getColumnWidths().put(columnID, width); + } + } + + public void setWidth(final int width) { + getColumn().setWidth(width); + } + + protected static Map<String, Integer> getColumnWidths() { + return PersistableColumn.COLUMN_WIDTHS; + } +}
diff --git a/org.eclipse.modisco.facet.common.ui/src/org/eclipse/modisco/facet/common/ui/internal/controls/wrappers/Column.java b/org.eclipse.modisco.facet.common.ui/src/org/eclipse/modisco/facet/common/ui/internal/controls/wrappers/Column.java new file mode 100644 index 0000000..8855752 --- /dev/null +++ b/org.eclipse.modisco.facet.common.ui/src/org/eclipse/modisco/facet/common/ui/internal/controls/wrappers/Column.java
@@ -0,0 +1,33 @@ +/******************************************************************************* + * Copyright (c) 2011 Mia-Software. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Nicolas Bros (Mia-Software) - initial API and implementation + * Nicolas Bros (Mia-Software) - Bug 334116 - common tree view with columns + *******************************************************************************/ +package org.eclipse.modisco.facet.common.ui.internal.controls.wrappers; + +import org.eclipse.swt.events.ControlListener; +import org.eclipse.swt.events.SelectionListener; +import org.eclipse.swt.widgets.Item; +import org.eclipse.swt.widgets.TableColumn; +import org.eclipse.swt.widgets.TreeColumn; + +/** Provides a unified API over both SWT {@link TreeColumn} and {@link TableColumn} */ +public interface Column { + void setText(String columnText); + + void addControlListener(ControlListener controlListener); + + void addSelectionListener(SelectionListener selectionListener); + + void setWidth(int width); + + int getWidth(); + + Item getColumn(); +} \ No newline at end of file
diff --git a/org.eclipse.modisco.facet.common.ui/src/org/eclipse/modisco/facet/common/ui/internal/controls/wrappers/SortableTable.java b/org.eclipse.modisco.facet.common.ui/src/org/eclipse/modisco/facet/common/ui/internal/controls/wrappers/SortableTable.java new file mode 100644 index 0000000..0012dbe --- /dev/null +++ b/org.eclipse.modisco.facet.common.ui/src/org/eclipse/modisco/facet/common/ui/internal/controls/wrappers/SortableTable.java
@@ -0,0 +1,47 @@ +/******************************************************************************* + * Copyright (c) 2011 Mia-Software. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Nicolas Bros (Mia-Software) - initial API and implementation + * Nicolas Bros (Mia-Software) - Bug 334116 - common tree view with columns + *******************************************************************************/ +package org.eclipse.modisco.facet.common.ui.internal.controls.wrappers; + +import org.eclipse.jface.viewers.TableViewer; +import org.eclipse.jface.viewers.ViewerSorter; + +/** + * Implements {@link SortableWidget}'s unified API for the JFace {@link TableViewer}. + */ +public class SortableTable implements SortableWidget { + private final TableViewer tableViewer; + + public SortableTable(final TableViewer tableViewer) { + this.tableViewer = tableViewer; + } + + public void setSorter(final ViewerSorter viewerSorter) { + this.tableViewer.setSorter(viewerSorter); + } + + public int getSortDirection() { + return this.tableViewer.getTable().getSortDirection(); + } + + public void setSortDirection(final int direction) { + this.tableViewer.getTable().setSortDirection(direction); + } + + public void setSortColumn(final Column column) { + this.tableViewer.getTable().setSortColumn( + (org.eclipse.swt.widgets.TableColumn) column.getColumn()); + } + + public void refresh() { + this.tableViewer.refresh(); + } +} \ No newline at end of file
diff --git a/org.eclipse.modisco.facet.common.ui/src/org/eclipse/modisco/facet/common/ui/internal/controls/wrappers/SortableTree.java b/org.eclipse.modisco.facet.common.ui/src/org/eclipse/modisco/facet/common/ui/internal/controls/wrappers/SortableTree.java new file mode 100644 index 0000000..272f00a --- /dev/null +++ b/org.eclipse.modisco.facet.common.ui/src/org/eclipse/modisco/facet/common/ui/internal/controls/wrappers/SortableTree.java
@@ -0,0 +1,47 @@ +/******************************************************************************* + * Copyright (c) 2011 Mia-Software. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Nicolas Bros (Mia-Software) - initial API and implementation + * Nicolas Bros (Mia-Software) - Bug 334116 - common tree view with columns + *******************************************************************************/ +package org.eclipse.modisco.facet.common.ui.internal.controls.wrappers; + +import org.eclipse.jface.viewers.TreeViewer; +import org.eclipse.jface.viewers.ViewerSorter; + +/** + * Implements {@link SortableWidget}'s unified API for the JFace {@link TreeViewer}. + */ +public class SortableTree implements SortableWidget { + private final TreeViewer treeViewer; + + public SortableTree(final TreeViewer treeViewer) { + this.treeViewer = treeViewer; + } + + public void setSorter(final ViewerSorter viewerSorter) { + this.treeViewer.setSorter(viewerSorter); + } + + public int getSortDirection() { + return this.treeViewer.getTree().getSortDirection(); + } + + public void setSortDirection(final int direction) { + this.treeViewer.getTree().setSortDirection(direction); + } + + public void setSortColumn(final Column column) { + this.treeViewer.getTree().setSortColumn( + (org.eclipse.swt.widgets.TreeColumn) column.getColumn()); + } + + public void refresh() { + this.treeViewer.refresh(); + } +} \ No newline at end of file
diff --git a/org.eclipse.modisco.facet.common.ui/src/org/eclipse/modisco/facet/common/ui/internal/controls/wrappers/SortableWidget.java b/org.eclipse.modisco.facet.common.ui/src/org/eclipse/modisco/facet/common/ui/internal/controls/wrappers/SortableWidget.java new file mode 100644 index 0000000..57877e0 --- /dev/null +++ b/org.eclipse.modisco.facet.common.ui/src/org/eclipse/modisco/facet/common/ui/internal/controls/wrappers/SortableWidget.java
@@ -0,0 +1,30 @@ +/******************************************************************************* + * Copyright (c) 2011 Mia-Software. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Nicolas Bros (Mia-Software) - initial API and implementation + * Nicolas Bros (Mia-Software) - Bug 334116 - common tree view with columns + *******************************************************************************/ +package org.eclipse.modisco.facet.common.ui.internal.controls.wrappers; + +import org.eclipse.jface.viewers.ViewerSorter; +import org.eclipse.swt.widgets.Table; +import org.eclipse.swt.widgets.Tree; + +/** Provides a unified API over both SWT {@link Tree} and {@link Table} */ +public interface SortableWidget { + void setSorter(ViewerSorter viewerSorter); + + int getSortDirection(); + + void setSortDirection(int direction); + + void setSortColumn(Column column); + + void refresh(); + +} \ No newline at end of file
diff --git a/org.eclipse.modisco.facet.common.ui/src/org/eclipse/modisco/facet/common/ui/internal/controls/wrappers/SortableWidgetFactory.java b/org.eclipse.modisco.facet.common.ui/src/org/eclipse/modisco/facet/common/ui/internal/controls/wrappers/SortableWidgetFactory.java new file mode 100644 index 0000000..1d7d9f7 --- /dev/null +++ b/org.eclipse.modisco.facet.common.ui/src/org/eclipse/modisco/facet/common/ui/internal/controls/wrappers/SortableWidgetFactory.java
@@ -0,0 +1,48 @@ +/******************************************************************************* + * Copyright (c) 2011 Mia-Software. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Nicolas Bros (Mia-Software) - initial API and implementation + * Nicolas Bros (Mia-Software) - Bug 334116 - common tree view with columns + *******************************************************************************/ +package org.eclipse.modisco.facet.common.ui.internal.controls.wrappers; + +import org.eclipse.jface.viewers.TableViewer; +import org.eclipse.jface.viewers.TreeViewer; +import org.eclipse.jface.viewers.Viewer; +import org.eclipse.swt.widgets.Table; +import org.eclipse.swt.widgets.Tree; + +/** + * A factory to obtain a {@link SortableWidget}, that provides a unified API over both SWT + * {@link Tree} and {@link Table}. + */ +public final class SortableWidgetFactory { + + private SortableWidgetFactory() { + // utility class + } + + /** + * Get a {@link SortableWidget} for the given {@link Viewer}, that can be either a + * {@link TreeViewer} or a {@link TableViewer}. + * + * @param viewer + * a {@link TreeViewer} or a {@link TableViewer} + * @return a {@link SortableWidget} that delegates to the given viewer + */ + public static SortableWidget createSortableWidget(final Viewer viewer) { + if (viewer instanceof TreeViewer) { + TreeViewer treeViewer = (TreeViewer) viewer; + return new SortableTree(treeViewer); + } else if (viewer instanceof TableViewer) { + TableViewer tableViewer = (TableViewer) viewer; + return new SortableTable(tableViewer); + } + throw new IllegalArgumentException(); + } +} \ No newline at end of file
diff --git a/org.eclipse.modisco.facet.common.ui/src/org/eclipse/modisco/facet/common/ui/internal/controls/wrappers/TableColumn.java b/org.eclipse.modisco.facet.common.ui/src/org/eclipse/modisco/facet/common/ui/internal/controls/wrappers/TableColumn.java new file mode 100644 index 0000000..8b263aa --- /dev/null +++ b/org.eclipse.modisco.facet.common.ui/src/org/eclipse/modisco/facet/common/ui/internal/controls/wrappers/TableColumn.java
@@ -0,0 +1,49 @@ +/******************************************************************************* + * Copyright (c) 2011 Mia-Software. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Nicolas Bros (Mia-Software) - initial API and implementation + * Nicolas Bros (Mia-Software) - Bug 334116 - common tree view with columns + *******************************************************************************/ +package org.eclipse.modisco.facet.common.ui.internal.controls.wrappers; + +import org.eclipse.swt.events.ControlListener; +import org.eclipse.swt.events.SelectionListener; + +/** Implements {@link Column}'s unified API for the SWT {@link org.eclipse.swt.widgets.TableColumn} */ +public class TableColumn implements Column { + private final org.eclipse.swt.widgets.TableColumn column; + + public TableColumn(final org.eclipse.swt.widgets.TableColumn column) { + this.column = column; + } + + public void setText(final String columnText) { + this.column.setText(columnText); + } + + public void setWidth(final int width) { + this.column.setWidth(width); + + } + + public void addControlListener(final ControlListener controlListener) { + this.column.addControlListener(controlListener); + } + + public void addSelectionListener(final SelectionListener selectionListener) { + this.column.addSelectionListener(selectionListener); + } + + public int getWidth() { + return this.column.getWidth(); + } + + public org.eclipse.swt.widgets.TableColumn getColumn() { + return this.column; + } +} \ No newline at end of file
diff --git a/org.eclipse.modisco.facet.common.ui/src/org/eclipse/modisco/facet/common/ui/internal/controls/wrappers/TreeColumn.java b/org.eclipse.modisco.facet.common.ui/src/org/eclipse/modisco/facet/common/ui/internal/controls/wrappers/TreeColumn.java new file mode 100644 index 0000000..b96a0ee --- /dev/null +++ b/org.eclipse.modisco.facet.common.ui/src/org/eclipse/modisco/facet/common/ui/internal/controls/wrappers/TreeColumn.java
@@ -0,0 +1,49 @@ +/******************************************************************************* + * Copyright (c) 2011 Mia-Software. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Nicolas Bros (Mia-Software) - initial API and implementation + * Nicolas Bros (Mia-Software) - Bug 334116 - common tree view with columns + *******************************************************************************/ +package org.eclipse.modisco.facet.common.ui.internal.controls.wrappers; + +import org.eclipse.swt.events.ControlListener; +import org.eclipse.swt.events.SelectionListener; + +/** Implements {@link Column}'s unified API for the SWT {@link org.eclipse.swt.widgets.TreeColumn} */ +public class TreeColumn implements Column { + private final org.eclipse.swt.widgets.TreeColumn column; + + public TreeColumn(final org.eclipse.swt.widgets.TreeColumn column) { + this.column = column; + } + + public void setText(final String columnText) { + this.column.setText(columnText); + } + + public void setWidth(final int width) { + this.column.setWidth(width); + + } + + public void addControlListener(final ControlListener controlListener) { + this.column.addControlListener(controlListener); + } + + public void addSelectionListener(final SelectionListener selectionListener) { + this.column.addSelectionListener(selectionListener); + } + + public int getWidth() { + return this.column.getWidth(); + } + + public org.eclipse.swt.widgets.TreeColumn getColumn() { + return this.column; + } +} \ No newline at end of file
diff --git a/org.eclipse.modisco.facet.common.ui/src/org/eclipse/modisco/facet/common/ui/internal/exported/views/IColumnDescription.java b/org.eclipse.modisco.facet.common.ui/src/org/eclipse/modisco/facet/common/ui/internal/exported/views/IColumnDescription.java new file mode 100644 index 0000000..5747caf --- /dev/null +++ b/org.eclipse.modisco.facet.common.ui/src/org/eclipse/modisco/facet/common/ui/internal/exported/views/IColumnDescription.java
@@ -0,0 +1,34 @@ +/******************************************************************************* + * Copyright (c) 2012 CEA LIST. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Nicolas Bros (Mia-Software) - Bug 372732 - [Facet] Rewrite the catalog views for 0.2 + *******************************************************************************/ +package org.eclipse.modisco.facet.common.ui.internal.exported.views; + +import org.eclipse.jface.viewers.ColumnLabelProvider; + +/** + * Contains the data necessary to create a column in a view created by + * {@link IElementsViewFactory#createElementsView(java.util.Collection, org.eclipse.jface.viewers.ITreeContentProvider, Object, String, org.eclipse.swt.graphics.Image, org.eclipse.jface.viewers.IOpenListener) IElementsViewFactory#createElementsView} + */ +public interface IColumnDescription { + /** The column's label */ + String getTitle(); + + /** A unique id for the column */ + String getUniqueID(); + + /** The default width that will be used the first time the column is displayed */ + int getDefaultWidth(); + + /** + * A label provider that returns the text (and optionally image and other font attributes) for each element in this + * column + */ + ColumnLabelProvider getColumnLabelProvider(); +}
diff --git a/org.eclipse.modisco.facet.common.ui/src/org/eclipse/modisco/facet/common/ui/internal/exported/views/IElementsViewFactory.java b/org.eclipse.modisco.facet.common.ui/src/org/eclipse/modisco/facet/common/ui/internal/exported/views/IElementsViewFactory.java new file mode 100644 index 0000000..95ccfce --- /dev/null +++ b/org.eclipse.modisco.facet.common.ui/src/org/eclipse/modisco/facet/common/ui/internal/exported/views/IElementsViewFactory.java
@@ -0,0 +1,68 @@ +/******************************************************************************* + * Copyright (c) 2012 CEA LIST. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Nicolas Bros (Mia-Software) - Bug 372732 - [Facet] Rewrite the catalog views for 0.2 + *******************************************************************************/ + +package org.eclipse.modisco.facet.common.ui.internal.exported.views; + +import java.util.Collection; + +import org.eclipse.jface.viewers.ColumnLabelProvider; +import org.eclipse.jface.viewers.IOpenListener; +import org.eclipse.jface.viewers.ITreeContentProvider; +import org.eclipse.modisco.facet.common.ui.internal.views.ElementsViewFactory; +import org.eclipse.swt.graphics.Image; +import org.eclipse.ui.part.ViewPart; + +/** + * Creates Eclipse views to display lists of elements. To be able to register this view in a non-RCP Eclipse, you will + * have to register an IExecutableExtensionFactory that will do the actual instantiation. + */ +public interface IElementsViewFactory { + IElementsViewFactory DEFAULT = new ElementsViewFactory(); + + /** + * Creates a view with columns. Each column has a default width, and memorizes its width once resized. + * + * @param columnDescriptions + * describes the columns + * @param contentProvider + * provides the content from the input + * @param input + * the view's input + * @param title + * the part's label + * @param titleImage + * the part's image + * @param openListener + * a listener called when hitting Enter or double-clicking on an element in the view + * @return the view part + */ + ViewPart createElementsView(Collection<? extends IColumnDescription> columnDescriptions, + ITreeContentProvider contentProvider, Object input, String title, Image titleImage, IOpenListener openListener); + + /** + * Creates a column description for + * {@link IElementsViewFactory#createElementsView(Collection, ITreeContentProvider, Object, String, Image, IOpenListener) + * createElementsView} + * + * @param title + * the column label + * @param uniqueID + * a unique ID that will identify the column (used for serialization) + * @param defaultWidth + * the initial width of the column, before the user resizes it + * @param columnLabelProvider + * A label provider that returns the text (and optionally image and other font attributes) for each + * element in this column + * @return a column description + */ + IColumnDescription createColumnDescription(String title, String uniqueID, + int defaultWidth, ColumnLabelProvider columnLabelProvider); +}
diff --git a/org.eclipse.modisco.facet.common.ui/src/org/eclipse/emf/facet/common/ui/internal/messages.properties b/org.eclipse.modisco.facet.common.ui/src/org/eclipse/modisco/facet/common/ui/internal/messages.properties similarity index 100% rename from org.eclipse.modisco.facet.common.ui/src/org/eclipse/emf/facet/common/ui/internal/messages.properties rename to org.eclipse.modisco.facet.common.ui/src/org/eclipse/modisco/facet/common/ui/internal/messages.properties
diff --git a/org.eclipse.modisco.facet.common.ui/src/org/eclipse/modisco/facet/common/ui/internal/preference/pages/EmfFacetRootPreferencePage.java b/org.eclipse.modisco.facet.common.ui/src/org/eclipse/modisco/facet/common/ui/internal/preference/pages/EmfFacetRootPreferencePage.java new file mode 100644 index 0000000..7bf2439 --- /dev/null +++ b/org.eclipse.modisco.facet.common.ui/src/org/eclipse/modisco/facet/common/ui/internal/preference/pages/EmfFacetRootPreferencePage.java
@@ -0,0 +1,59 @@ +/********************************************************************************** + * Copyright (c) 2011 Mia-Software. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Nicolas Guyomar (Mia-Software) - Bug 333652 Extension point offering the possibility to declare an EPackage browser + ***********************************************************************************/ +package org.eclipse.modisco.facet.common.ui.internal.preference.pages; + +import org.eclipse.jface.preference.FieldEditorPreferencePage; +import org.eclipse.modisco.facet.common.ui.internal.Activator; +import org.eclipse.ui.IWorkbench; +import org.eclipse.ui.IWorkbenchPreferencePage; + +/** + * This class is the EmfFacet root preference page that is contributed to the + * Preferences dialog. By sub-classing {@link FieldEditorPreferencePage}, we can + * use the field support built into JFace that allows us to create a page that + * is small and knows how to save, restore and apply itself. + * <p> + * This page is used to modify preferences, that are stored in the preference + * store that belongs to the main plug-in class. That way, preferences can be + * accessed directly via the preference store. + */ + +public class EmfFacetRootPreferencePage extends FieldEditorPreferencePage + implements IWorkbenchPreferencePage { + + public static final String P_DEFAULT_EPACKAGE_VIEWER = "emf_facet_default_epackage_viewer"; //$NON-NLS-1$ + + public EmfFacetRootPreferencePage() { + super(FieldEditorPreferencePage.GRID); + setPreferenceStore(Activator.getDefault().getPreferenceStore()); + } + + /** + * Creates the field editors. Field editors are abstractions of the common + * GUI blocks needed to manipulate various types of preferences. Each field + * editor knows how to save and restore itself. + */ + @Override + public void createFieldEditors() { + // The page is empty for now + } + + /* + * (non-Javadoc) + * + * @see + * org.eclipse.ui.IWorkbenchPreferencePage#init(org.eclipse.ui.IWorkbench) + */ + public void init(final IWorkbench workbench) { + // Nothing to do + } + +} \ No newline at end of file
diff --git a/org.eclipse.modisco.facet.common.ui/src/org/eclipse/modisco/facet/common/ui/internal/views/AbstractTreeView.java b/org.eclipse.modisco.facet.common.ui/src/org/eclipse/modisco/facet/common/ui/internal/views/AbstractTreeView.java new file mode 100644 index 0000000..e60a2b6 --- /dev/null +++ b/org.eclipse.modisco.facet.common.ui/src/org/eclipse/modisco/facet/common/ui/internal/views/AbstractTreeView.java
@@ -0,0 +1,176 @@ +/******************************************************************************* + * Copyright (c) 2010 Mia-Software. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Nicolas Bros (Mia-Software) - initial API and implementation + * Nicolas Bros (Mia-Software) - Bug 334116 - common tree view with columns + *******************************************************************************/ + +package org.eclipse.modisco.facet.common.ui.internal.views; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.core.runtime.IStatus; +import org.eclipse.core.runtime.Status; +import org.eclipse.core.runtime.jobs.Job; +import org.eclipse.jface.action.GroupMarker; +import org.eclipse.jface.action.MenuManager; +import org.eclipse.jface.viewers.ColumnLabelProvider; +import org.eclipse.jface.viewers.IContentProvider; +import org.eclipse.jface.viewers.IOpenListener; +import org.eclipse.jface.viewers.IStructuredSelection; +import org.eclipse.jface.viewers.OpenEvent; +import org.eclipse.jface.viewers.TreeViewer; +import org.eclipse.modisco.facet.common.ui.internal.Activator; +import org.eclipse.modisco.facet.common.ui.internal.controls.PersistableColumn; +import org.eclipse.modisco.facet.util.core.Logger; +import org.eclipse.swt.SWT; +import org.eclipse.swt.layout.FillLayout; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Display; +import org.eclipse.swt.widgets.Menu; +import org.eclipse.ui.IMemento; +import org.eclipse.ui.IViewSite; +import org.eclipse.ui.IWorkbenchActionConstants; +import org.eclipse.ui.PartInitException; +import org.eclipse.ui.part.ViewPart; + +/** An abstract Eclipse view that displays a list of elements. */ +public abstract class AbstractTreeView extends ViewPart { + + private final List<PersistableColumn> columns = new ArrayList<PersistableColumn>(); + private final Map<String, Integer> persistedValues = new HashMap<String, Integer>(); + + private static final int JOB_SCHEDULE_DELAY = 500; + private Job fRefreshJob = null; + + private TreeViewer fTreeViewer; + + public TreeViewer getViewer() { + return this.fTreeViewer; + } + + @Override + public void createPartControl(final Composite parent) { + parent.setLayout(new FillLayout()); + + this.fTreeViewer = new TreeViewer(parent, SWT.H_SCROLL | SWT.V_SCROLL | SWT.SINGLE + | SWT.FULL_SELECTION); + this.fTreeViewer.getTree().setLinesVisible(true); + this.fTreeViewer.getTree().setHeaderVisible(true); + + this.fTreeViewer.addOpenListener(new IOpenListener() { + public void open(final OpenEvent event) { + IStructuredSelection selection = (IStructuredSelection) AbstractTreeView.this + .getViewer().getSelection(); + openElement(selection.getFirstElement()); + } + }); + + createColumns(); + + this.fTreeViewer.setContentProvider(getContentProvider()); + + createContextMenu(); + getSite().setSelectionProvider(this.fTreeViewer); + refresh(false); + } + + protected void createContextMenu() { + final MenuManager contextMenu = new MenuManager("#PopUp"); //$NON-NLS-1$ + contextMenu.add(new GroupMarker(IWorkbenchActionConstants.MB_ADDITIONS)); + final Menu menu = contextMenu.createContextMenu(getViewer().getControl()); + getViewer().getControl().setMenu(menu); + getSite().registerContextMenu(contextMenu, getViewer()); + } + + protected abstract void createColumns(); + + protected abstract IContentProvider getContentProvider(); + + protected abstract void openElement(Object element); + + @Override + public void setFocus() { + this.fTreeViewer.getControl().setFocus(); + } + + /** Optionally delayed refresh */ + protected void refresh(final boolean delayed) { + if (this.fRefreshJob == null) { + this.fRefreshJob = new Job(getRefreshMessage()) { + @Override + protected IStatus run(final IProgressMonitor monitor) { + doRefresh(); + return Status.OK_STATUS; + } + }; + } + // delayed until it stops changing + this.fRefreshJob.cancel(); + if (delayed) { + this.fRefreshJob.setPriority(Job.DECORATE); + this.fRefreshJob.schedule(AbstractTreeView.JOB_SCHEDULE_DELAY); + } else { + this.fRefreshJob.setPriority(Job.INTERACTIVE); + this.fRefreshJob.schedule(); + } + } + + protected abstract String getRefreshMessage(); + + protected abstract Object getInput(); + + protected void doRefresh() { + // Accesses the catalog, which can block if done inside the UI thread. + final Object input = getInput(); + Display.getDefault().asyncExec(new Runnable() { + public void run() { + getViewer().setInput(input); + getViewer().refresh(); + } + }); + } + + protected void createColumn(final String columnText, final String uniqueID, + final int defaultWidth, final ColumnLabelProvider columnLabelProvider) { + PersistableColumn persistableColumn = new PersistableColumn(columnText, uniqueID, + defaultWidth, columnLabelProvider, this.fTreeViewer); + this.columns.add(persistableColumn); + Integer width = this.persistedValues.get(uniqueID); + if (width != null) { + persistableColumn.setWidth(width.intValue()); + } + } + + @Override + public void saveState(final IMemento memento) { + super.saveState(memento); + try { + for (PersistableColumn column : this.columns) { + column.saveState(memento); + } + } catch (Exception e) { + Logger.logError(e, "Error saving view state", Activator.getDefault()); //$NON-NLS-1$ + } + } + + @Override + public void init(final IViewSite site, final IMemento memento) throws PartInitException { + super.init(site, memento); + if (memento != null) { + String[] attributeKeys = memento.getAttributeKeys(); + for (String key : attributeKeys) { + this.persistedValues.put(key, memento.getInteger(key)); + } + } + } +}
diff --git a/org.eclipse.modisco.facet.common.ui/src/org/eclipse/modisco/facet/common/ui/internal/views/ElementsView.java b/org.eclipse.modisco.facet.common.ui/src/org/eclipse/modisco/facet/common/ui/internal/views/ElementsView.java new file mode 100644 index 0000000..88f0854 --- /dev/null +++ b/org.eclipse.modisco.facet.common.ui/src/org/eclipse/modisco/facet/common/ui/internal/views/ElementsView.java
@@ -0,0 +1,208 @@ +/******************************************************************************* + * Copyright (c) 2010-2012 Mia-Software. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Nicolas Bros (Mia-Software) - initial API and implementation + * Nicolas Bros (Mia-Software) - Bug 334116 - common tree view with columns + * Nicolas Bros (Mia-Software) - Bug 372732 - [Facet] Rewrite the catalog views for 0.2 + *******************************************************************************/ +package org.eclipse.modisco.facet.common.ui.internal.views; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.core.runtime.IStatus; +import org.eclipse.core.runtime.Status; +import org.eclipse.core.runtime.jobs.Job; +import org.eclipse.jface.action.GroupMarker; +import org.eclipse.jface.action.MenuManager; +import org.eclipse.jface.viewers.ColumnLabelProvider; +import org.eclipse.jface.viewers.IContentProvider; +import org.eclipse.jface.viewers.IOpenListener; +import org.eclipse.jface.viewers.ITreeContentProvider; +import org.eclipse.jface.viewers.OpenEvent; +import org.eclipse.jface.viewers.TreeViewer; +import org.eclipse.modisco.facet.common.ui.internal.Activator; +import org.eclipse.modisco.facet.common.ui.internal.Messages; +import org.eclipse.modisco.facet.common.ui.internal.controls.PersistableColumn; +import org.eclipse.modisco.facet.common.ui.internal.exported.views.IColumnDescription; +import org.eclipse.modisco.facet.util.core.Logger; +import org.eclipse.osgi.util.NLS; +import org.eclipse.swt.SWT; +import org.eclipse.swt.graphics.Image; +import org.eclipse.swt.layout.FillLayout; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Display; +import org.eclipse.swt.widgets.Menu; +import org.eclipse.ui.IMemento; +import org.eclipse.ui.IViewSite; +import org.eclipse.ui.IWorkbenchActionConstants; +import org.eclipse.ui.PartInitException; +import org.eclipse.ui.part.ViewPart; + +public class ElementsView extends ViewPart { + + private static final int JOB_SCHEDULE_DELAY = 500; + private final Collection<? extends IColumnDescription> columnDescriptions; + private final ITreeContentProvider contentProvider; + private final Object input; + private final List<PersistableColumn> columns = new ArrayList<PersistableColumn>(); + private final Map<String, Integer> persistedValues = new HashMap<String, Integer>(); + private TreeViewer treeViewer; + private Job refreshJob = null; + private final IOpenListener openListener; + private final String title; + private final Image titleImage; + + public ElementsView(final Collection<? extends IColumnDescription> columnDescriptions, + final ITreeContentProvider contentProvider, final Object input, final String title, final Image titleImage, final IOpenListener openListener) { + this.columnDescriptions = columnDescriptions; + this.contentProvider = contentProvider; + this.input = input; + this.title = title; + this.titleImage = titleImage; + this.openListener = openListener; + } + + public TreeViewer getViewer() { + return this.treeViewer; + } + + @Override + public void createPartControl(final Composite parent) { + setPartName(this.title); + setTitleImage(this.titleImage); + parent.setLayout(new FillLayout()); + + this.treeViewer = new TreeViewer(parent, SWT.H_SCROLL | SWT.V_SCROLL | SWT.SINGLE + | SWT.FULL_SELECTION); + this.treeViewer.getTree().setLinesVisible(true); + this.treeViewer.getTree().setHeaderVisible(true); + + this.treeViewer.addOpenListener(new IOpenListener() { + public void open(final OpenEvent event) { + ElementsView.this.open(event); + } + }); + + createColumns(); + this.treeViewer.setContentProvider(getContentProvider()); + createContextMenu(); + getSite().setSelectionProvider(this.treeViewer); + refresh(false); + } + + protected void createContextMenu() { + final MenuManager contextMenu = new MenuManager("#PopUp"); //$NON-NLS-1$ + contextMenu.add(new GroupMarker(IWorkbenchActionConstants.MB_ADDITIONS)); + final Menu menu = contextMenu.createContextMenu(getViewer().getControl()); + getViewer().getControl().setMenu(menu); + getSite().registerContextMenu(contextMenu, getViewer()); + } + + protected void createColumns() { + for (IColumnDescription columnDescription : this.columnDescriptions) { + createColumn(columnDescription.getTitle(), columnDescription.getUniqueID(), + columnDescription.getDefaultWidth(), columnDescription.getColumnLabelProvider()); + } + } + + protected IContentProvider getContentProvider() { + return this.contentProvider; + } + + protected void open(final OpenEvent event) { + if (this.openListener != null) { + this.openListener.open(event); + } + } + + @Override + public void setFocus() { + this.treeViewer.getControl().setFocus(); + } + + /** Optionally delayed refresh */ + protected void refresh(final boolean delayed) { + if (this.refreshJob == null) { + this.refreshJob = new Job(getRefreshMessage()) { + @Override + protected IStatus run(final IProgressMonitor monitor) { + doRefresh(); + return Status.OK_STATUS; + } + }; + } + // delayed until it stops changing + this.refreshJob.cancel(); + if (delayed) { + this.refreshJob.setPriority(Job.DECORATE); + this.refreshJob.schedule(ElementsView.JOB_SCHEDULE_DELAY); + } else { + this.refreshJob.setPriority(Job.INTERACTIVE); + this.refreshJob.schedule(); + } + } + + protected String getRefreshMessage() { + return NLS.bind(Messages.ElementsView_refreshJobTitle, this.title); + } + + protected Object getInput() { + return this.input; + } + + protected void doRefresh() { + // Accesses the catalog, which can block if done inside the UI thread. + final Object viewerInput = getInput(); + Display.getDefault().asyncExec(new Runnable() { + public void run() { + getViewer().setInput(viewerInput); + getViewer().refresh(); + } + }); + } + + protected void createColumn(final String columnText, final String uniqueID, + final int defaultWidth, final ColumnLabelProvider columnLabelProvider) { + PersistableColumn persistableColumn = new PersistableColumn(columnText, uniqueID, + defaultWidth, columnLabelProvider, this.treeViewer); + this.columns.add(persistableColumn); + Integer width = this.persistedValues.get(uniqueID); + if (width != null) { + persistableColumn.setWidth(width.intValue()); + } + } + + @Override + public void saveState(final IMemento memento) { + super.saveState(memento); + try { + for (PersistableColumn column : this.columns) { + column.saveState(memento); + } + } catch (Exception e) { + Logger.logError(e, "Error saving view state", Activator.getDefault()); //$NON-NLS-1$ + } + } + + @Override + public void init(final IViewSite site, final IMemento memento) throws PartInitException { + super.init(site, memento); + if (memento != null) { + String[] attributeKeys = memento.getAttributeKeys(); + for (String key : attributeKeys) { + this.persistedValues.put(key, memento.getInteger(key)); + } + } + } + +}
diff --git a/org.eclipse.modisco.facet.common.ui/src/org/eclipse/modisco/facet/common/ui/internal/views/ElementsViewFactory.java b/org.eclipse.modisco.facet.common.ui/src/org/eclipse/modisco/facet/common/ui/internal/views/ElementsViewFactory.java new file mode 100644 index 0000000..08097c9 --- /dev/null +++ b/org.eclipse.modisco.facet.common.ui/src/org/eclipse/modisco/facet/common/ui/internal/views/ElementsViewFactory.java
@@ -0,0 +1,52 @@ +/******************************************************************************* + * Copyright (c) 2012 CEA LIST. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Nicolas Bros (Mia-Software) - Bug 372732 - [Facet] Rewrite the catalog views for 0.2 + *******************************************************************************/ + +package org.eclipse.modisco.facet.common.ui.internal.views; + +import java.util.Collection; + +import org.eclipse.jface.viewers.ColumnLabelProvider; +import org.eclipse.jface.viewers.IOpenListener; +import org.eclipse.jface.viewers.ITreeContentProvider; +import org.eclipse.modisco.facet.common.ui.internal.exported.views.IColumnDescription; +import org.eclipse.modisco.facet.common.ui.internal.exported.views.IElementsViewFactory; +import org.eclipse.swt.graphics.Image; +import org.eclipse.ui.part.ViewPart; + +public class ElementsViewFactory implements IElementsViewFactory { + + public ViewPart createElementsView(final Collection<? extends IColumnDescription> columns, + final ITreeContentProvider contentProvider, final Object input, final String title, final Image titleImage, final IOpenListener openListener) { + return new ElementsView(columns, contentProvider, input, title, titleImage, openListener); + } + + public IColumnDescription createColumnDescription(final String columnText, + final String uniqueID, final int defaultWidth, + final ColumnLabelProvider columnLabelProvider) { + return new IColumnDescription() { + public String getUniqueID() { + return uniqueID; + } + + public int getDefaultWidth() { + return defaultWidth; + } + + public String getTitle() { + return columnText; + } + + public ColumnLabelProvider getColumnLabelProvider() { + return columnLabelProvider; + } + }; + } +}
diff --git a/org.eclipse.modisco.facet.common.ui/src/org/eclipse/modisco/facet/common/ui/internal/widgets/AnywhereFilterMatcher.java b/org.eclipse.modisco.facet.common.ui/src/org/eclipse/modisco/facet/common/ui/internal/widgets/AnywhereFilterMatcher.java new file mode 100644 index 0000000..2b6a6fd --- /dev/null +++ b/org.eclipse.modisco.facet.common.ui/src/org/eclipse/modisco/facet/common/ui/internal/widgets/AnywhereFilterMatcher.java
@@ -0,0 +1,28 @@ +/******************************************************************************* + * Copyright (c) 2010 Mia-Software. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Nicolas Bros (Mia-Software) + *******************************************************************************/ +package org.eclipse.modisco.facet.common.ui.internal.widgets; + +import org.eclipse.modisco.facet.common.core.internal.utils.StringMatcher; +import org.eclipse.ui.dialogs.FilteredList.FilterMatcher; + +/** This is a matcher that matches anywhere, not just at the beginning. */ +public class AnywhereFilterMatcher implements FilterMatcher { + private StringMatcher fMatcher; + + public void setFilter(final String pattern, final boolean ignoreCase, + final boolean ignoreWildCards) { + this.fMatcher = new StringMatcher('*' + pattern + '*', ignoreCase, ignoreWildCards); + } + + public boolean match(final Object element) { + return this.fMatcher.match(element.toString()); + } +}
diff --git a/org.eclipse.modisco.facet.custom.core/META-INF/MANIFEST.MF b/org.eclipse.modisco.facet.custom.core/META-INF/MANIFEST.MF index b99a664..3176703 100644 --- a/org.eclipse.modisco.facet.custom.core/META-INF/MANIFEST.MF +++ b/org.eclipse.modisco.facet.custom.core/META-INF/MANIFEST.MF
@@ -3,7 +3,7 @@ Bundle-Name: %Bundle-Name Bundle-SymbolicName: org.eclipse.emf.facet.custom.core;singleton:=true Bundle-Version: 1.3.0.qualifier -Bundle-Activator: org.eclipse.emf.facet.custom.core.internal.Activator +Bundle-Activator: org.eclipse.modisco.facet.custom.core.internal.Activator Bundle-Vendor: %Bundle-Vendor Require-Bundle: org.eclipse.ui, org.eclipse.core.runtime, @@ -16,9 +16,9 @@ org.eclipse.emf.validation;bundle-version="1.4.0" Bundle-RequiredExecutionEnvironment: JavaSE-1.8 Bundle-ActivationPolicy: lazy -Export-Package: org.eclipse.emf.facet.custom.core, - org.eclipse.emf.facet.custom.core.exception, - org.eclipse.emf.facet.custom.core.internal.exported; +Export-Package: org.eclipse.modisco.facet.custom.core, + org.eclipse.modisco.facet.custom.core.exception, + org.eclipse.modisco.facet.custom.core.internal.exported; x-friends:="org.eclipse.emf.facet.custom.ui, org.eclipse.emf.facet.custom.sdk.core, org.eclipse.emf.facet.custom.tests,
diff --git a/org.eclipse.modisco.facet.custom.core/src/org/eclipse/emf/facet/custom/core/ICustomizationCatalogManager.java b/org.eclipse.modisco.facet.custom.core/src/org/eclipse/emf/facet/custom/core/ICustomizationCatalogManager.java deleted file mode 100644 index cc107a6..0000000 --- a/org.eclipse.modisco.facet.custom.core/src/org/eclipse/emf/facet/custom/core/ICustomizationCatalogManager.java +++ /dev/null
@@ -1,65 +0,0 @@ -/** - * Copyright (c) 2011, 2012 Mia-Software. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Gregoire Dupe (Mia-Software) - Bug 361794 - [Restructuring] New customization meta-model - * Nicolas Bros (Mia-Software) - Bug 372626 - Aggregates - * Gregoire Dupe (Mia-Software) - Bug 369987 - [Restructuring][Table] Switch to the new customization and facet framework - * Gregoire Dupe (Mia-Software) - Bug 373078 - API Cleaning - */ -package org.eclipse.emf.facet.custom.core; - -import java.util.Collection; -import java.util.List; - -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.facet.custom.metamodel.v0_2_0.custom.Customization; - -/** - * This interface allows to access the customization catalog. - * - * @author Gregoire Dupe - * @since 0.2 - * @noextend This interface is not intended to be extended by clients. - * @noimplement This interface is not intended to be implemented by clients. - */ -public interface ICustomizationCatalogManager { - - /** - * This method is used to get all the registered customizations. - * - * @return all the registered customizations (may contain aggregates) - */ - List<Customization> getRegisteredCustomizations(); - - /** - * This method is used to get all the customization which can be applied on a list of - * eObjects and on the sub elements of those eObjects. - * - * Inheritance is handled. For example, assuming meta-model A extends - * meta-model B, the customizations declared on meta-model B have to - * be available on the instances of meta-model A. Furthermore all - * customizations containing a customization of EObject have to be applicable - * on all the models. - * - * @param eObjects the {@link EObject}s for which to get the applicable customizations - * @return a list of customizations - */ - List<Customization> getCustomizationsApplicableOn( - Collection<EObject> eObjects); - - /** - * This method is used to register a customization which has not been declared through the - * regular way (extension point). - * - * @param customization - * the customization to register - */ - void registerCustomization(Customization customization); - -}
diff --git a/org.eclipse.modisco.facet.custom.core/src/org/eclipse/emf/facet/custom/core/ICustomizationCatalogManagerFactory.java b/org.eclipse.modisco.facet.custom.core/src/org/eclipse/emf/facet/custom/core/ICustomizationCatalogManagerFactory.java deleted file mode 100644 index 9bb1e1c..0000000 --- a/org.eclipse.modisco.facet.custom.core/src/org/eclipse/emf/facet/custom/core/ICustomizationCatalogManagerFactory.java +++ /dev/null
@@ -1,31 +0,0 @@ -/** - * Copyright (c) 2012 Mia-Software. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Gregoire Dupe (Mia-Software) - Bug 369987 - [Restructuring][Table] Switch to the new customization and facet framework - * Gregoire Dupe (Mia-Software) - Bug 373078 - API Cleaning - */ -package org.eclipse.emf.facet.custom.core; - -import org.eclipse.emf.ecore.resource.ResourceSet; -import org.eclipse.emf.facet.custom.core.internal.CustomizationCatalogManagerFactory; - -/** - * A factory for {@link ICustomizationCatalogManager} - * - * @since 0.2 - * @noextend This interface is not intended to be extended by clients. - * @noimplement This interface is not intended to be implemented by clients. - */ -public interface ICustomizationCatalogManagerFactory { - - ICustomizationCatalogManagerFactory DEFAULT = new CustomizationCatalogManagerFactory(); - - ICustomizationCatalogManager getOrCreateCustomizationCatalogManager( - ResourceSet resourceSet); -}
diff --git a/org.eclipse.modisco.facet.custom.core/src/org/eclipse/emf/facet/custom/core/ICustomizationManager.java b/org.eclipse.modisco.facet.custom.core/src/org/eclipse/emf/facet/custom/core/ICustomizationManager.java deleted file mode 100644 index 5d94e00..0000000 --- a/org.eclipse.modisco.facet.custom.core/src/org/eclipse/emf/facet/custom/core/ICustomizationManager.java +++ /dev/null
@@ -1,91 +0,0 @@ -/** - * Copyright (c) 2011 Mia-Software. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Gregoire Dupe (Mia-Software) - Bug 361794 - [Restructuring] New customization meta-model - * Gregoire Dupe (Mia-Software) - Bug 369987 - [Restructuring][Table] Switch to the new customization and facet framework - * Gregoire Dupe (Mia-Software) - Bug 373078 - API Cleaning - */ -package org.eclipse.emf.facet.custom.core; - -import java.util.List; - -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.ETypedElement; -import org.eclipse.emf.ecore.resource.ResourceSet; -import org.eclipse.emf.facet.custom.core.exception.CustomizationException; -import org.eclipse.emf.facet.custom.metamodel.v0_2_0.custom.Customization; -import org.eclipse.emf.facet.efacet.core.IFacetManager; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.FacetOperation; - -/** - * This interface allows to access the customization manager. A customization - * manager will compute the customization property depending on the loaded - * customizations. Be careful, the load order has an impact on the customization - * property value. Customizations are loaded in a stack. If there is a conflict - * between two customizations, the higher customization (the nearest from the - * top of the stack) gets the priority. - * - * @author Gregoire Dupe - * @since 0.2 - * @noextend This interface is not intended to be extended by clients. - * @noimplement This interface is not intended to be implemented by clients. - */ -public interface ICustomizationManager { - - /** - * This method is used to get the customization stack. The top - * customization in the stack will be the first in the list. - * - * @return a mutable list of customizations - */ - List<Customization> getManagedCustomizations(); - - /** - * This method is used to get the value of a customization property for a - * chosen eObject. - * - * @param eObject - * @param customProperty - * @param classs - * the expected result type - * @return a value having a type depending a the customizationProperty type. - * (Can be null.) - */ - <T> T getCustomValueOf(EObject eObject, - FacetOperation customProperty, Class<T> classs) - throws CustomizationException; - - /** - * This method is used to get the value of a customization property for a - * chosen eObject and a chosen eStructuralFeature. - * - * @param eObject - * @param structuralFeature - * must not be null - * @param customProperty - * must not be null - * @param classs - * the expected result type - * @return a value having a type depending a the customizationProperty type. - * (Can be null.) - */ - <T> T getCustomValueOf(EObject eObject, - ETypedElement structuralFeature, - FacetOperation customProperty, Class<T> classs) - throws CustomizationException; - - /** - * This method returns the resourceSet used to manage the customization - * models. - */ - ResourceSet getResourceSet(); - - IFacetManager getFacetManager(); - -}
diff --git a/org.eclipse.modisco.facet.custom.core/src/org/eclipse/emf/facet/custom/core/ICustomizationManagerFactory.java b/org.eclipse.modisco.facet.custom.core/src/org/eclipse/emf/facet/custom/core/ICustomizationManagerFactory.java deleted file mode 100644 index 7680446..0000000 --- a/org.eclipse.modisco.facet.custom.core/src/org/eclipse/emf/facet/custom/core/ICustomizationManagerFactory.java +++ /dev/null
@@ -1,51 +0,0 @@ -/** - * Copyright (c) 2011 Mia-Software. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Gregoire Dupe (Mia-Software) - Bug 361794 - [Restructuring] New customization meta-model - * Gregoire Dupe (Mia-Software) - Bug 373078 - API Cleaning - * Gregoire Dupe (Mia-Software) - Bug 372626 - Aggregates - */ -package org.eclipse.emf.facet.custom.core; - -import org.eclipse.emf.ecore.resource.ResourceSet; -import org.eclipse.emf.facet.custom.core.internal.CustomizationManagerFactory; -import org.eclipse.emf.facet.efacet.core.IFacetManager; - -/** - * Used to instantiate a customization manager - * @author Gregoire Dupe - * @since 0.2 - * @noextend This interface is not intended to be extended by clients. - * @noimplement This interface is not intended to be implemented by clients. - */ -public interface ICustomizationManagerFactory { - - /** - * Default factory instance. - */ - ICustomizationManagerFactory DEFAULT = new CustomizationManagerFactory(); - - /** - * This method is used to instantiate a customization manager - * - * @param resourceSet - * the resource set to use to manage the customization models. - * @return - */ - ICustomizationManager getOrCreateICustomizationManager(ResourceSet resourceSet); - - /** - * - * @param facetManager - * @return - * @since 0.2 - */ - ICustomizationManager createICustomizationManager(IFacetManager facetManager); - -}
diff --git a/org.eclipse.modisco.facet.custom.core/src/org/eclipse/emf/facet/custom/core/ICustomizationManagerProvider.java b/org.eclipse.modisco.facet.custom.core/src/org/eclipse/emf/facet/custom/core/ICustomizationManagerProvider.java deleted file mode 100644 index 8126c64..0000000 --- a/org.eclipse.modisco.facet.custom.core/src/org/eclipse/emf/facet/custom/core/ICustomizationManagerProvider.java +++ /dev/null
@@ -1,21 +0,0 @@ -/** - * Copyright (c) 2014 Mia-Software. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Gregoire Dupe (Mia-Software) - Bug 441051 - Reusable customization and facet loading dialogs - */ -package org.eclipse.emf.facet.custom.core; - -/** - * @since 1.0 - */ -public interface ICustomizationManagerProvider { - - ICustomizationManager getCustomizationManager(); - -}
diff --git a/org.eclipse.modisco.facet.custom.core/src/org/eclipse/emf/facet/custom/core/ICustomizationPropertiesCatalogManager.java b/org.eclipse.modisco.facet.custom.core/src/org/eclipse/emf/facet/custom/core/ICustomizationPropertiesCatalogManager.java deleted file mode 100644 index d38dec8..0000000 --- a/org.eclipse.modisco.facet.custom.core/src/org/eclipse/emf/facet/custom/core/ICustomizationPropertiesCatalogManager.java +++ /dev/null
@@ -1,42 +0,0 @@ -/** - * Copyright (c) 2011, 2012 Mia-Software. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Gregoire Dupe (Mia-Software) - Bug 361794 - [Restructuring] EMF Facet customization meta-model - * Gregoire Dupe (Mia-Software) - Bug 369987 - [Restructuring][Table] Switch to the new customization and facet framework - * Gregoire Dupe (Mia-Software) - Bug 373078 - API Cleaning - * Alban Ménager (Soft-Maint) - Bug 387470 - [EFacet][Custom] Editors - */ -package org.eclipse.emf.facet.custom.core; - -import java.util.List; - -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.FacetOperation; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.FacetSet; - -/** - * This interface allows to access the customization catalog. - * - * @author Gregoire Dupe - * @since 0.3 - * @noextend This interface is not intended to be extended by clients. - * @noimplement This interface is not intended to be implemented by clients. - */ -public interface ICustomizationPropertiesCatalogManager { - - /** - * This method is used to get all the registered customization properties (facetSet). - * - * @return all the registered customizations - */ - List<FacetSet> getAllRegisteredCustomizationPropertySet(); - - List<FacetOperation> getCustomizationPropertiesByName( - String propertyName); - -}
diff --git a/org.eclipse.modisco.facet.custom.core/src/org/eclipse/emf/facet/custom/core/ICustomizationPropertiesCatalogManagerFactory.java b/org.eclipse.modisco.facet.custom.core/src/org/eclipse/emf/facet/custom/core/ICustomizationPropertiesCatalogManagerFactory.java deleted file mode 100644 index 4b13ca9..0000000 --- a/org.eclipse.modisco.facet.custom.core/src/org/eclipse/emf/facet/custom/core/ICustomizationPropertiesCatalogManagerFactory.java +++ /dev/null
@@ -1,31 +0,0 @@ -/** - * Copyright (c) 2012 Mia-Software. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Alban Ménager (Soft-Maint) - Bug 387470 - [EFacet][Custom] Editors - */ -package org.eclipse.emf.facet.custom.core; - -import org.eclipse.emf.ecore.resource.ResourceSet; -import org.eclipse.emf.facet.custom.core.internal.CustomizationPropertiesCatalogManagerFactory; - -/** - * This interface provides the customization catalog manager. - * - * @since 0.3 - * @noextend This interface is not intended to be extended by clients. - * @noimplement This interface is not intended to be implemented by clients. - */ -public interface ICustomizationPropertiesCatalogManagerFactory { - - ICustomizationPropertiesCatalogManagerFactory INSTANCE = new CustomizationPropertiesCatalogManagerFactory(); - - ICustomizationPropertiesCatalogManager getOrCreateCustomizationPropertiesCatalogManager( - final ResourceSet resourceSet); - -} \ No newline at end of file
diff --git a/org.eclipse.modisco.facet.custom.core/src/org/eclipse/emf/facet/custom/core/exception/CustomizationException.java b/org.eclipse.modisco.facet.custom.core/src/org/eclipse/emf/facet/custom/core/exception/CustomizationException.java deleted file mode 100644 index de798fa..0000000 --- a/org.eclipse.modisco.facet.custom.core/src/org/eclipse/emf/facet/custom/core/exception/CustomizationException.java +++ /dev/null
@@ -1,40 +0,0 @@ -/** - * Copyright (c) 2011 Mia-Software. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Gregoire Dupe (Mia-Software) - Bug 361794 - [Restructuring] New customization meta-model - * Gregoire Dupe (Mia-Software) - Bug 373078 - API Cleaning - */ -package org.eclipse.emf.facet.custom.core.exception; - -/** - * This exception is thrown when the computation of a customization property value failed. - * @author Gregoire Dupe - * @noinstantiate This class is not intended to be instantiated by clients. - */ -public final class CustomizationException extends Exception { - - private static final long serialVersionUID = -4070159863668577038L; - - public CustomizationException() { - super(); - } - - public CustomizationException(final String message) { - super(message); - } - - public CustomizationException(final Throwable cause) { - super(cause); - } - - public CustomizationException(final String message, final Throwable cause) { - super(message, cause); - } - -}
diff --git a/org.eclipse.modisco.facet.custom.core/src/org/eclipse/emf/facet/custom/core/internal/Activator.java b/org.eclipse.modisco.facet.custom.core/src/org/eclipse/emf/facet/custom/core/internal/Activator.java deleted file mode 100644 index 0a7285a..0000000 --- a/org.eclipse.modisco.facet.custom.core/src/org/eclipse/emf/facet/custom/core/internal/Activator.java +++ /dev/null
@@ -1,62 +0,0 @@ -/** - * Copyright (c) 2011 Mia-Software. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Gregoire Dupe (Mia-Software) - Bug 361794 - [Restructuring] New customization meta-model - * Nicolas Bros (Mia-Software) - Bug 375054 - Add validation warning for overlay on EClass - */ -package org.eclipse.emf.facet.custom.core.internal; - -import org.eclipse.core.runtime.Plugin; -import org.osgi.framework.BundleContext; - -/** - * The activator class controls the plug-in life cycle - */ -public class Activator extends Plugin { - - // The shared instance - private static Activator plugin; - - /** - * The constructor - */ - public Activator() { - } - - /* - * (non-Javadoc) - * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext) - */ - @Override - public void start(final BundleContext context) throws Exception { - super.start(context); - Activator.plugin = this; - } - - /* - * (non-Javadoc) - * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext) - */ - @Override - public void stop(final BundleContext context) throws Exception { - Activator.plugin = null; - super.stop(context); - } - - /** - * Returns the shared instance - * - * @return the shared instance - */ - public static Activator getDefault() { - return Activator.plugin; - } - - -}
diff --git a/org.eclipse.modisco.facet.custom.core/src/org/eclipse/emf/facet/custom/core/internal/CustomizationCatalogManager.java b/org.eclipse.modisco.facet.custom.core/src/org/eclipse/emf/facet/custom/core/internal/CustomizationCatalogManager.java deleted file mode 100644 index 41e9973..0000000 --- a/org.eclipse.modisco.facet.custom.core/src/org/eclipse/emf/facet/custom/core/internal/CustomizationCatalogManager.java +++ /dev/null
@@ -1,104 +0,0 @@ -/** - * Copyright (c) 2011, 2016 Mia-Software. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Grégoire Dupé (Mia-Software) - Bug 361794 - [Restructuring] New customization meta-model - * Grégoire Dupé (Mia-Software) - Bug 369987 - [Restructuring][Table] Switch to the new customization and facet framework - * Nicolas Bros (Mia-Software) - Bug 372626 - Aggregates - * Grégoire Dupé (Mia-Software) - Bug 373078 - API Cleaning - * Grégoire Dupé (Mia-Software) - Bug 477657 - The catalog manager should be able to manage workspace model - * Grégoire Dupé (Mia-Software) - Bug 482887 - CatalogManager create files with too long name - */ -package org.eclipse.emf.facet.custom.core.internal; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.Collections; -import java.util.List; - -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.resource.ResourceSet; -import org.eclipse.emf.facet.custom.core.ICustomizationCatalogManager; -import org.eclipse.emf.facet.custom.metamodel.v0_2_0.custom.Customization; -import org.eclipse.emf.facet.util.emf.core.catalog.ICatalogManager; -import org.eclipse.emf.facet.util.emf.core.catalog.ICatalogManagerConfiguration; -import org.eclipse.emf.facet.util.emf.core.catalog.ICatalogManagerFactory; - -/** - * Customization catalog implementation using the catalog manager features provided by the plug-in - * org.eclipse.emf.facet.util.emf.core - * - * @author Grégoire Dupé - * - */ -public class CustomizationCatalogManager implements - ICustomizationCatalogManager { - - private final ICatalogManager catalogMgr; - - public CustomizationCatalogManager(final ResourceSet resourceSet) { - final ICatalogManagerConfiguration catalogMgrConfig = - new CatalogManagerConfiguration(); - this.catalogMgr = ICatalogManagerFactory.DEFAULT.getOrCreateCatalogManager( - catalogMgrConfig, resourceSet, this.getClass().getName()); - } - - - public List<Customization> getCustomizationsByName(final String name) { - final List<Customization> result = new ArrayList<Customization>(); - for (EObject eObject : this.catalogMgr.getInstalledEntries(EObject.class)) { - if (eObject instanceof Customization) { - final Customization customization = (Customization) eObject; - if (name.equals(customization.getName())) { - result.add(customization); - } - } else { - throw new RuntimeException("Only customizations (and aggregates) must be stored in the customization catalog"); //$NON-NLS-1$ - } - } - return result; - } - - public void registerCustomization(final Customization customization) { - this.catalogMgr.addWsEntry(customization); - } - - public List<Customization> getCustomizationsApplicableOn( - final Collection<EObject> eObjects) { - // TODO Auto-generated method stub - return null; - } - - public List<Customization> getRegisteredCustomizations() { - final List<Customization> result = new ArrayList<Customization>(); - final List<EObject> installedEntries = this.catalogMgr - .getInstalledEntries(EObject.class); - for (EObject eObject : installedEntries) { - if (eObject instanceof Customization) { - final Customization customization = (Customization) eObject; - result.add(customization); - } else { - throw new RuntimeException("Only customizations (and aggregates) must be stored in the customization catalog"); //$NON-NLS-1$ - } - } - return Collections.unmodifiableList(result); - } - - public class CatalogManagerConfiguration implements ICatalogManagerConfiguration { - - public boolean canBeManaged(final EObject root) { - return root instanceof Customization; - } - - public boolean isValid(final EObject root) { - return true; - } - - } - -}
diff --git a/org.eclipse.modisco.facet.custom.core/src/org/eclipse/emf/facet/custom/core/internal/CustomizationCatalogManagerFactory.java b/org.eclipse.modisco.facet.custom.core/src/org/eclipse/emf/facet/custom/core/internal/CustomizationCatalogManagerFactory.java deleted file mode 100644 index 12ab3d2..0000000 --- a/org.eclipse.modisco.facet.custom.core/src/org/eclipse/emf/facet/custom/core/internal/CustomizationCatalogManagerFactory.java +++ /dev/null
@@ -1,26 +0,0 @@ -/** - * Copyright (c) 2012, 2015 Mia-Software. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Gregoire Dupe (Mia-Software) - Bug 369987 - [Restructuring][Table] Switch to the new customization and facet framework - * Gregoire Dupe (Mia-Software) - Bug 477657 - The catalog manager should be able to manage workspace model - */ -package org.eclipse.emf.facet.custom.core.internal; - -import org.eclipse.emf.ecore.resource.ResourceSet; -import org.eclipse.emf.facet.custom.core.ICustomizationCatalogManager; - -public class CustomizationCatalogManagerFactory implements - org.eclipse.emf.facet.custom.core.ICustomizationCatalogManagerFactory { - - public ICustomizationCatalogManager getOrCreateCustomizationCatalogManager( - final ResourceSet resourceSet) { - return new CustomizationCatalogManager(resourceSet); - } - -}
diff --git a/org.eclipse.modisco.facet.custom.core/src/org/eclipse/emf/facet/custom/core/internal/CustomizationManager.java b/org.eclipse.modisco.facet.custom.core/src/org/eclipse/emf/facet/custom/core/internal/CustomizationManager.java deleted file mode 100644 index eaae23e..0000000 --- a/org.eclipse.modisco.facet.custom.core/src/org/eclipse/emf/facet/custom/core/internal/CustomizationManager.java +++ /dev/null
@@ -1,182 +0,0 @@ -/** - * Copyright (c) 2011-2012 Mia-Software. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Gregoire Dupe (Mia-Software) - Bug 361794 - [Restructuring] EMF Facet customization meta-model - * Gregoire Dupe (Mia-Software) - Bug 369987 - [Restructuring][Table] Switch to the new customization and facet framework - * Nicolas Bros (Mia-Software) - Bug 372626 - Aggregates - * Gregoire Dupe (Mia-Software) - Bug 373078 - API Cleaning - * Nicolas Bros (Mia-Software) - Bug 378271 - [Table] Select Columns To Hide is broken - */ -package org.eclipse.emf.facet.custom.core.internal; - -import java.util.ArrayList; -import java.util.HashSet; -import java.util.Iterator; -import java.util.LinkedList; -import java.util.List; - -import org.eclipse.emf.common.util.URI; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.ETypedElement; -import org.eclipse.emf.ecore.resource.Resource; -import org.eclipse.emf.ecore.resource.ResourceSet; -import org.eclipse.emf.facet.custom.core.ICustomizationManager; -import org.eclipse.emf.facet.custom.core.exception.CustomizationException; -import org.eclipse.emf.facet.custom.metamodel.v0_2_0.custom.Customization; -import org.eclipse.emf.facet.efacet.core.IFacetManager; -import org.eclipse.emf.facet.efacet.core.IFacetManagerFactory; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.FacetOperation; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.FacetSet; - -public class CustomizationManager implements ICustomizationManager { - - private final HashSet<FacetOperation> customProperties = new HashSet<FacetOperation>(); - private final IFacetManager facetManager; - - public CustomizationManager(final ResourceSet resourceSet) { - this.facetManager = IFacetManagerFactory.DEFAULT.getOrCreateFacetManager(resourceSet); - } - - public CustomizationManager(final IFacetManager facetManager) { - this.facetManager = facetManager; - } - - public void addFrontManagedCustomization(final Customization customization) { - this.facetManager.getManagedFacetSets().add(0, customization); - } - - public void removeCustomization(final Customization customization) { - this.facetManager.getManagedFacetSets().remove(customization); - } - - public List<Customization> getManagedCustomizations() { - return new CustomizationsDelegatingList(this.facetManager.getManagedFacetSets()); - } - - public <T> T getCustomValueOf(final EObject eObject, - final FacetOperation customizationProperty, - final Class<T> classs) - throws CustomizationException { - // Begin precondition checking section - /* The scope of a customization property is not available yet in new customization meta-model - if (!(customizationProperty.getScope().contains( - CustomizationPropertyScope.ECLASS) || (customizationProperty - .getScope().contains(CustomizationPropertyScope.FACET)))) { - throw new RuntimeException( - "The customization property is expected to be applicable on an EClass or on a Facet"); //$NON-NLS-1$ - } - */ - // End precondition checking section - T result = null; - try { - // the structural feature : null - final Object[] args = new Object[] { null }; - result = this.facetManager.invoke(eObject, customizationProperty, - classs, null, args); - } catch (final Exception e) { - throw new CustomizationException(e); - } - return result; - } - - public <T> T getCustomValueOf(final EObject eObject, - final ETypedElement eTypedElement, - final FacetOperation customizationProperty, - final Class<T> classs) - throws CustomizationException { - // Begin precondition checking section - if (eObject == null) { - throw new IllegalArgumentException( - "The parameter 'eObject' must not be null."); //$NON-NLS-1$ - } - if (customizationProperty == null) { - throw new IllegalArgumentException( - "The parameter 'customizationProperty' must not be null."); //$NON-NLS-1$ - } - /* The scope of a customization property is not available yet in new customization meta-model - if (!(eStructuralFeature instanceof EReference)) { - if (customizationProperty.getScope().equals( - CustomizationPropertyScope.EREFERENCE)) { - throw new CustomizationException( - "The eStructuralFeature is an instance of " //$NON-NLS-1$ - + eStructuralFeature.getClass().getName() - + " but EReference is expected."); //$NON-NLS-1$ - } - } - - if (!(eStructuralFeature instanceof EAttribute)) { - if (customizationProperty.getScope().equals( - CustomizationPropertyScope.EATTRIBUTE)) { - throw new CustomizationException( - "The eStructuralFeature is an instance of " //$NON-NLS-1$ - + eStructuralFeature.getClass().getName() - + " but EAttribute is expected."); //$NON-NLS-1$ - } - } - */ - // End precondition checking section - try { - return this.facetManager.invoke(eObject, customizationProperty, classs, null, new Object[] { eTypedElement }); - } catch (Exception e) { - throw new CustomizationException(e); - } - } - - public List<FacetOperation> getCustomizationPropertiesByName( - final String name) { - if (name == null) { - throw new IllegalArgumentException( - "The parameter 'name' must not be null."); //$NON-NLS-1$ - } - List<FacetOperation> results = new ArrayList<FacetOperation>(); - for (FacetOperation customizationProperty : this.customProperties) { - if (name.equals(customizationProperty.getName())) { - results.add(customizationProperty); - } - } - return results; - } - - public void addCustomization(final URI uri) { - if (uri == null) { - throw new IllegalArgumentException( - "The parameter 'uri' must not be null."); //$NON-NLS-1$ - } - Resource resource = this.facetManager.getResourceSet().getResource(uri, true); - Iterator<EObject> iterator = resource.getAllContents(); - while (iterator.hasNext()) { - EObject eObject = iterator.next(); - if (eObject instanceof FacetOperation) { - FacetOperation customizationProperty = (FacetOperation) eObject; - this.customProperties.add(customizationProperty); - } - } - } - - public ResourceSet getResourceSet() { - return this.facetManager.getResourceSet(); - } - - public void removeAllCustomizations() { - List<Customization> customizationsToRemove = new LinkedList<Customization>(); - for (FacetSet facetSet : this.facetManager.getManagedFacetSets()) { - if (facetSet instanceof Customization) { - Customization customization = (Customization) facetSet; - customizationsToRemove.add(customization); - } - } - for (Customization customization : customizationsToRemove) { - this.facetManager.getManagedFacetSets().remove(customization); - } - } - - public IFacetManager getFacetManager() { - return this.facetManager; - } -}
diff --git a/org.eclipse.modisco.facet.custom.core/src/org/eclipse/emf/facet/custom/core/internal/CustomizationManagerFactory.java b/org.eclipse.modisco.facet.custom.core/src/org/eclipse/emf/facet/custom/core/internal/CustomizationManagerFactory.java deleted file mode 100644 index 50af2f3..0000000 --- a/org.eclipse.modisco.facet.custom.core/src/org/eclipse/emf/facet/custom/core/internal/CustomizationManagerFactory.java +++ /dev/null
@@ -1,32 +0,0 @@ -/** - * Copyright (c) 2011 Mia-Software. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Gregoire Dupe (Mia-Software) - Bug 361794 - [Restructuring] New customization meta-model - * Gregoire Dupe (Mia-Software) - Bug 373078 - API Cleaning - */ -package org.eclipse.emf.facet.custom.core.internal; - -import org.eclipse.emf.ecore.resource.ResourceSet; -import org.eclipse.emf.facet.custom.core.ICustomizationManager; -import org.eclipse.emf.facet.custom.core.ICustomizationManagerFactory; -import org.eclipse.emf.facet.efacet.core.IFacetManager; - -public class CustomizationManagerFactory implements - ICustomizationManagerFactory { - - public ICustomizationManager getOrCreateICustomizationManager(final ResourceSet resourceSet) { - return new CustomizationManager(resourceSet); - } - - public ICustomizationManager createICustomizationManager( - final IFacetManager facetManager) { - return new CustomizationManager(facetManager); - } - -}
diff --git a/org.eclipse.modisco.facet.custom.core/src/org/eclipse/emf/facet/custom/core/internal/CustomizationPropertiesCatalogManager.java b/org.eclipse.modisco.facet.custom.core/src/org/eclipse/emf/facet/custom/core/internal/CustomizationPropertiesCatalogManager.java deleted file mode 100644 index eb26bea..0000000 --- a/org.eclipse.modisco.facet.custom.core/src/org/eclipse/emf/facet/custom/core/internal/CustomizationPropertiesCatalogManager.java +++ /dev/null
@@ -1,106 +0,0 @@ -/** - * Copyright (c) 2011, 2016 Mia-Software. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Gregoire Dupe (Mia-Software) - Bug 361794 - [Restructuring] EMF Facet customization meta-model - * Gregoire Dupe (Mia-Software) - Bug 369987 - [Restructuring][Table] Switch to the new customization and facet framework - * Gregoire Dupe (Mia-Software) - Bug 373078 - API Cleaning - * Alban Ménager (Soft-Maint) - Bug 387470 - [EFacet][Custom] Editors - * Gregoire Dupe (Mia-Software) - Bug 477657 - The catalog manager should be able to manage workspace model - * Grégoire Dupé (Mia-Software) - Bug 482887 - CatalogManager create files with too long name - */ -package org.eclipse.emf.facet.custom.core.internal; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; - -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.resource.ResourceSet; -import org.eclipse.emf.facet.custom.core.ICustomizationPropertiesCatalogManager; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.FacetOperation; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.FacetSet; -import org.eclipse.emf.facet.util.emf.core.catalog.ICatalogManager; -import org.eclipse.emf.facet.util.emf.core.catalog.ICatalogManagerConfiguration; -import org.eclipse.emf.facet.util.emf.core.catalog.ICatalogManagerFactory; - -/** - * Customization catalog implementation using the catalog manager features - * provided by the plug-in org.eclipse.emf.facet.util.emf.core - * - * @author Gregoire Dupe - * - */ -public class CustomizationPropertiesCatalogManager implements - ICustomizationPropertiesCatalogManager { - - private static final String CUSTOM_SUFIX = "customproperties"; //$NON-NLS-1$ - private final ICatalogManager catalogMgr; - - public CustomizationPropertiesCatalogManager(final ResourceSet resourceSet) { - final ICatalogManagerConfiguration catalogMgrConfig = - new CatalogManagerConfiguration(); - this.catalogMgr = ICatalogManagerFactory.DEFAULT.getOrCreateCatalogManager( - catalogMgrConfig, resourceSet, this.getClass().getName()); - } - - public List<FacetSet> getAllRegisteredCustomizationPropertySet() { - final List<FacetSet> result = new ArrayList<FacetSet>(); - for (final EObject eObject : this.catalogMgr.getInstalledEntries(EObject.class)) { - if (eObject instanceof FacetSet) { - final FacetSet facetSet = (FacetSet) eObject; - result.add(facetSet); - } else { - throw new RuntimeException( - "Only facetSets must be stored in the customization properties catalog"); //$NON-NLS-1$ - } - } - return result; - } - - public List<FacetOperation> getCustomizationPropertiesByName( - final String customPropName) { - final List<FacetOperation> result = new ArrayList<FacetOperation>(); - for (final EObject facetSet : this.catalogMgr.getInstalledEntries(EObject.class)) { - final Iterator<EObject> iterator = facetSet.eAllContents(); - while (iterator.hasNext()) { - final EObject eObject = iterator.next(); - if (eObject instanceof FacetOperation) { - final FacetOperation customProperty = (FacetOperation) eObject; - if (customPropName.equals(customProperty.getName())) { - result.add(customProperty); - } - } - } - } - return result; - } - - - public class CatalogManagerConfiguration implements ICatalogManagerConfiguration { - - public boolean canBeManaged(final EObject root) { - return root instanceof FacetSet; - } - - public boolean isValid(final EObject root) { - boolean result = false; - if (root instanceof FacetSet) { - final FacetSet customProperties = (FacetSet) root; - // We have to force the integrator to use the suffix - // "customproperties" to name them facetSet declaring custom - // properties. Otherwise we won't be able to know if a facetSet is a - // custom property declaration - result = customProperties.getName().endsWith(CUSTOM_SUFIX); - } - return result; - } - - } - -} \ No newline at end of file
diff --git a/org.eclipse.modisco.facet.custom.core/src/org/eclipse/emf/facet/custom/core/internal/CustomizationPropertiesCatalogManagerFactory.java b/org.eclipse.modisco.facet.custom.core/src/org/eclipse/emf/facet/custom/core/internal/CustomizationPropertiesCatalogManagerFactory.java deleted file mode 100644 index 0a1c23f..0000000 --- a/org.eclipse.modisco.facet.custom.core/src/org/eclipse/emf/facet/custom/core/internal/CustomizationPropertiesCatalogManagerFactory.java +++ /dev/null
@@ -1,29 +0,0 @@ -/** - * Copyright (c) 2012, 2015 Mia-Software. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Alban Ménager (Soft-Maint) - Bug 387470 - [EFacet][Custom] Editors - * Gregoire Dupe (Mia-Software) - Bug 477657 - The catalog manager should be able to manage workspace model - */ -package org.eclipse.emf.facet.custom.core.internal; - -import org.eclipse.emf.ecore.resource.ResourceSet; -import org.eclipse.emf.facet.custom.core.ICustomizationPropertiesCatalogManager; -import org.eclipse.emf.facet.custom.core.ICustomizationPropertiesCatalogManagerFactory; - -/** - * Implementation of {@link ICustomizationPropertiesCatalogManagerFactory}. - */ -public class CustomizationPropertiesCatalogManagerFactory implements ICustomizationPropertiesCatalogManagerFactory { - - public ICustomizationPropertiesCatalogManager getOrCreateCustomizationPropertiesCatalogManager( - final ResourceSet resourceSet) { - return new CustomizationPropertiesCatalogManager(resourceSet); - } - -}
diff --git a/org.eclipse.modisco.facet.custom.core/src/org/eclipse/emf/facet/custom/core/internal/CustomizationsDelegatingList.java b/org.eclipse.modisco.facet.custom.core/src/org/eclipse/emf/facet/custom/core/internal/CustomizationsDelegatingList.java deleted file mode 100644 index 91fbda6..0000000 --- a/org.eclipse.modisco.facet.custom.core/src/org/eclipse/emf/facet/custom/core/internal/CustomizationsDelegatingList.java +++ /dev/null
@@ -1,264 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2012, 2015 CEA LIST, Soft-Maint and Mia-Software. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Nicolas Bros (Mia-Software) - Bug 374758 - [Table] repair the table - * Gregoire Dupe (Mia-Software) - Bug 372626 - Aggregates - * Thomas Cicognani (Soft-Maint) - Bug 420192 - UnsupportedOperationException in a usefull method - * Thomas Cicognani (Soft-Maint) - Bug 435882 - org.eclipse.emf.facet.custom.core.internal.CustomizationsDelegatingList not fully implemented - * Thomas Cicognani (Soft-Maint) - Bug 441317 - Clearing a CustomizationsDelegatingList doesn't notify listeners - * Grégoire Dupé (Mia-Software) - Bug 476141 - Facet manger can fail with ConcurrentModificationException - *******************************************************************************/ -package org.eclipse.emf.facet.custom.core.internal; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.Iterator; -import java.util.List; -import java.util.ListIterator; - -import org.eclipse.emf.facet.custom.metamodel.v0_2_0.custom.Customization; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.FacetSet; - -/** Represents a list of {@link Customization}s that exists as a subset of a delegate list of {@link FacetSet}s. */ -public class CustomizationsDelegatingList implements List<Customization> { - private final List<FacetSet> delegate; - - public CustomizationsDelegatingList(final List<FacetSet> delegate) { - this.delegate = delegate; - } - - private List<Customization> createSubList() { - final List<Customization> customizations = new ArrayList<Customization>(this.delegate.size()); - for (FacetSet facetSet : this.delegate) { - if (facetSet instanceof Customization) { - final Customization customization = (Customization) facetSet; - customizations.add(customization); - } - } - return customizations; - } - - private static void throwOutOfBoundException(final int index, final int customIndex) { - final String message = String.format("Index: %d, Size: %d", //$NON-NLS-1$ - Integer.valueOf(index), Integer.valueOf(customIndex)); - throw new IndexOutOfBoundsException(message); - } - - public int size() { - return this.createSubList().size(); - } - - public boolean isEmpty() { - return this.createSubList().isEmpty(); - } - - public boolean contains(final Object element) { - return element instanceof Customization && this.delegate.contains(element); - } - - public Iterator<Customization> iterator() { - final List<Customization> customizations = createSubList(); - return customizations.iterator(); - } - - - public Object[] toArray() { - return createSubList().toArray(); - } - - public <T> T[] toArray(final T[] array) { - return createSubList().toArray(array); - } - - public boolean add(final Customization customization) { - return this.delegate.add(customization); - } - - public boolean remove(final Object element) { - return this.delegate.remove(element); - } - - public boolean containsAll(final Collection<?> collection) { - return createSubList().containsAll(collection); - } - - public boolean addAll(final Collection<? extends Customization> collection) { - return this.delegate.addAll(collection); - } - - public boolean addAll(final int index, - final Collection<? extends Customization> collection) { - boolean addAllDone = false; - int customIndex = 0; - for (int i = 0; i < this.delegate.size(); i++) { - final FacetSet facetSet = this.delegate.get(i); - if (facetSet instanceof Customization) { - if (customIndex == index) { - addAllDone = true; - this.delegate.addAll(i, collection); - break; - } - customIndex++; - } - } - return addAllDone; - } - - public boolean removeAll(final Collection<?> collection) { - return this.delegate.removeAll(collection); - } - - public boolean retainAll(final Collection<?> collection) { - boolean modified = false; - final Iterator<FacetSet> iterator = this.delegate.iterator(); - while (iterator.hasNext()) { - final FacetSet next = iterator.next(); - if (next instanceof Customization && !collection.contains(next)) { - this.delegate.remove(next); - modified = true; - } - } - return modified; - } - - public void clear() { - final List<Customization> customToClear = new ArrayList<Customization>(); - final Iterator<FacetSet> iterator = this.delegate.iterator(); - while (iterator.hasNext()) { - final FacetSet facetSet = iterator.next(); - if (facetSet instanceof Customization) { - customToClear.add((Customization) facetSet); - } - } - this.delegate.removeAll(customToClear); - } - - public Customization get(final int index) { - Customization getValue = null; - int customIndex = 0; - for (FacetSet facetSet : this.delegate) { - if (facetSet instanceof Customization) { - if (customIndex == index) { - getValue = (Customization) facetSet; - break; - } - customIndex++; - } - } - if (getValue == null) { - throwOutOfBoundException(index, customIndex); - } - return getValue; - } - - public Customization set(final int index, final Customization element) { - Customization oldValue = null; - int customIndex = 0; - for (int i = 0; i < this.delegate.size(); i++) { - final FacetSet facetSet = this.delegate.get(i); - if (facetSet instanceof Customization) { - if (customIndex == index) { - oldValue = (Customization) facetSet; - this.delegate.set(i, element); - break; - } - customIndex++; - } - } - if (oldValue == null) { - throwOutOfBoundException(index, customIndex); - } - return oldValue; - } - - public void add(final int index, final Customization element) { - Customization movedFacet = null; - int customIndex = 0; - if (index == 0) { - this.delegate.add(0, element); - } else { - for (int i = 0; i < this.delegate.size(); i++) { - final FacetSet facetSet = this.delegate.get(i); - if (facetSet instanceof Customization) { - if (customIndex == index) { - movedFacet = (Customization) facetSet; - this.delegate.add(i, element); - break; - } - customIndex++; - } - } - if (movedFacet == null) { - throwOutOfBoundException(index, customIndex); - } - } - } - - public Customization remove(final int index) { - Customization removedCustom = null; - int customIndex = 0; - for (int i = 0; i < this.delegate.size(); i++) { - final FacetSet facetSet = this.delegate.get(i); - if (facetSet instanceof Customization) { - if (customIndex == index) { - removedCustom = (Customization) facetSet; - this.delegate.remove(i); - break; - } - customIndex++; - } - } - if (removedCustom == null) { - throwOutOfBoundException(index, customIndex); - } - return removedCustom; - } - - public int indexOf(final Object element) { - int indexOfElement = -1; - int customIndex = 0; - for (FacetSet facetSet : this.delegate) { - if (facetSet instanceof Customization) { - if (facetSet.equals(element)) { - indexOfElement = customIndex; - break; - } - customIndex++; - } - } - return indexOfElement; - } - - public int lastIndexOf(final Object element) { - return createSubList().lastIndexOf(element); - } - - public ListIterator<Customization> listIterator() { - return this.createSubList().listIterator(); - } - - public ListIterator<Customization> listIterator(final int index) { - return createSubList().listIterator(index); - } - - public List<Customization> subList(final int fromIndex, final int toIndex) { - final List<Customization> subList = new ArrayList<Customization>(); - int customIndex = 0; - for (FacetSet facetSet : this.delegate) { - if (facetSet instanceof Customization) { - if (customIndex >= fromIndex && customIndex < toIndex) { - subList.add((Customization) facetSet); - } else if (customIndex >= toIndex) { - break; - } - customIndex++; - } - } - return subList; - } -}
diff --git a/org.eclipse.modisco.facet.custom.core/src/org/eclipse/emf/facet/custom/core/internal/exception/CustomizationCatalogRuntimeException.java b/org.eclipse.modisco.facet.custom.core/src/org/eclipse/emf/facet/custom/core/internal/exception/CustomizationCatalogRuntimeException.java deleted file mode 100644 index cdf9f22..0000000 --- a/org.eclipse.modisco.facet.custom.core/src/org/eclipse/emf/facet/custom/core/internal/exception/CustomizationCatalogRuntimeException.java +++ /dev/null
@@ -1,40 +0,0 @@ -/** - * Copyright (c) 2011 Mia-Software. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Gregoire Dupe (Mia-Software) - Bug 369987 - [Restructuring][Table] Switch to the new customization and facet framework - * Gregoire Dupe (Mia-Software) - Bug 373078 - API Cleaning - */ -package org.eclipse.emf.facet.custom.core.internal.exception; - -/** - * @noinstantiate This class is not intended to be instantiated by clients. - * @author Gregoire Dupe - * - */ -public final class CustomizationCatalogRuntimeException extends RuntimeException { - - private static final long serialVersionUID = 6589838701903506569L; - - public CustomizationCatalogRuntimeException() { - super(); - } - - public CustomizationCatalogRuntimeException(final String message) { - super(message); - } - - public CustomizationCatalogRuntimeException(final Throwable cause) { - super(cause); - } - - public CustomizationCatalogRuntimeException(final String message, final Throwable cause) { - super(message, cause); - } - -}
diff --git a/org.eclipse.modisco.facet.custom.core/src/org/eclipse/emf/facet/custom/core/internal/exported/Constants.java b/org.eclipse.modisco.facet.custom.core/src/org/eclipse/emf/facet/custom/core/internal/exported/Constants.java deleted file mode 100644 index 14defed..0000000 --- a/org.eclipse.modisco.facet.custom.core/src/org/eclipse/emf/facet/custom/core/internal/exported/Constants.java +++ /dev/null
@@ -1,21 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2012 CEA LIST. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Gregoire Dupe (Mia-Software) - Bug 375054 - Add validation warning for overlay on EClass - *******************************************************************************/ - -package org.eclipse.emf.facet.custom.core.internal.exported; - -public final class Constants { - - private Constants() { - // Must not be used - } - - public static final String CUSTOM_FILE_EXT = "custom"; //$NON-NLS-1$ -}
diff --git a/org.eclipse.modisco.facet.custom.core/src/org/eclipse/emf/facet/custom/core/internal/exported/CustomizationUtils.java b/org.eclipse.modisco.facet.custom.core/src/org/eclipse/emf/facet/custom/core/internal/exported/CustomizationUtils.java deleted file mode 100644 index 36291e9..0000000 --- a/org.eclipse.modisco.facet.custom.core/src/org/eclipse/emf/facet/custom/core/internal/exported/CustomizationUtils.java +++ /dev/null
@@ -1,132 +0,0 @@ -/** - * Copyright (c) 2011, 2012 Mia-Software. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Gregoire Dupe (Mia-Software) - Bug 373078 - API Cleaning - * Gregoire Dupe (Mia-Software) - Bug 376576 - [EFacet] Change the multiplicity of Facet::extendedFacet - * David Couvrand (Soft-Maint) - Bug 418418 - [Customization] Overlay icons not implemented - */ -package org.eclipse.emf.facet.custom.core.internal.exported; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.LinkedList; -import java.util.List; - -import org.eclipse.emf.ecore.EClassifier; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.EPackage; -import org.eclipse.emf.ecore.ETypedElement; -import org.eclipse.emf.facet.custom.core.ICustomizationManager; -import org.eclipse.emf.facet.custom.core.exception.CustomizationException; -import org.eclipse.emf.facet.custom.core.internal.Activator; -import org.eclipse.emf.facet.custom.metamodel.v0_2_0.custom.Customization; -import org.eclipse.emf.facet.custom.metamodel.v0_2_0.custom.EClassCustomization; -import org.eclipse.emf.facet.custom.metamodel.v0_2_0.custom.FacetCustomization; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.FacetOperation; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.FacetSet; -import org.eclipse.emf.facet.util.core.Logger; - -/** - * @since 0.2 - */ -public final class CustomizationUtils { - - private static final String FILE_EXTENSION = "custom"; //$NON-NLS-1$ - - private CustomizationUtils() { - // Must not be used - } - - public static EPackage getCustomizedEPackage( - final Customization customization) { - EPackage result = null; - for (EClassifier eClassifier : customization.getEClassifiers()) { - for (EPackage ePackage : getExtendedEPackage(eClassifier)) { - if (ePackage != null && !(ePackage instanceof FacetSet)) { - result = ePackage; - break; - } - } - } - return result; - } - - private static List<EPackage> getExtendedEPackage( - final EClassifier eClassifier) { - final List<EClassifier> extended = new ArrayList<EClassifier>(); - if (eClassifier instanceof FacetCustomization) { - final FacetCustomization facetCustom = (FacetCustomization) eClassifier; - extended.addAll(facetCustom.getExtendedFacets()); - } else if (eClassifier instanceof EClassCustomization) { - final EClassCustomization eClassCustom = (EClassCustomization) eClassifier; - extended.add(eClassCustom.getExtendedMetaclass()); - } - final List<EPackage> ePackages = new LinkedList<EPackage>(); - for (EClassifier extCassifier : extended) { - if (extCassifier != null) { - ePackages.add(extCassifier.getEPackage()); - } - } - return ePackages; - } - - /** - * Return the default file extension of a customization file. - * - * @return the file extension without the dot. - */ - public static String getDefaultFileExtension() { - return CustomizationUtils.FILE_EXTENSION; - } - - /** - * Find a Customization with the given name among the given list of Customizations. If several Customizations have the same name, - * then return the first one. - * - * @param customizations - * where to look for - * @param name - * the name of the Customization to find - * @return the Customization, or <code>null</code> if not found in the given list - */ - public static Customization getCustomization(final Collection<Customization> customizations, final String name) { - Customization result = null; - for (Customization customization : customizations) { - if (name.equals(customization.getName())) { - result = customization; - } - } - return result; - } - - public static <T> T getPropertyValue( - final ICustomizationManager customManager, final Object element, - final FacetOperation property, final ETypedElement eTypedElement, - final Class<T> classs) { - T result = null; - if (element instanceof EObject) { - final EObject eObject = (EObject) element; - try { - if (eTypedElement == null) { - result = customManager.getCustomValueOf(eObject, property, - classs); - } else { - result = customManager.getCustomValueOf(eObject, - eTypedElement, property, classs); - } - } catch (final CustomizationException e) { - Logger.logError( - e, - "Failed to get the value of '" + property.getName() + "' for " + element, //$NON-NLS-1$ //$NON-NLS-2$ - Activator.getDefault()); - } - } - return result; - } -}
diff --git a/org.eclipse.modisco.facet.custom.core/src/org/eclipse/emf/facet/custom/core/internal/query/SwitchQueryImplementation.java b/org.eclipse.modisco.facet.custom.core/src/org/eclipse/emf/facet/custom/core/internal/query/SwitchQueryImplementation.java deleted file mode 100644 index 4db0028..0000000 --- a/org.eclipse.modisco.facet.custom.core/src/org/eclipse/emf/facet/custom/core/internal/query/SwitchQueryImplementation.java +++ /dev/null
@@ -1,97 +0,0 @@ -/** - * Copyright (c) 2013 Mia-Software. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Gregoire Dupe (Mia-Software) - Bug 418885 - ETypedElementSwitchQuery implemented using a deprecated query evaluator extension point - * Gregoire Dupe (Mia-Software) - Bug 443682 - Access to the super facet - */ -package org.eclipse.emf.facet.custom.core.internal.query; - -import java.util.List; - -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.EStructuralFeature; -import org.eclipse.emf.facet.custom.metamodel.v0_2_0.custom.ETypedElementCase; -import org.eclipse.emf.facet.custom.metamodel.v0_2_0.custom.ETypedElementSwitchQuery; -import org.eclipse.emf.facet.efacet.core.IDerivedTypedElementManager; -import org.eclipse.emf.facet.efacet.core.IFacetManager; -import org.eclipse.emf.facet.efacet.core.exception.DerivedTypedElementException; -import org.eclipse.emf.facet.efacet.core.exception.FacetManagerException; -import org.eclipse.emf.facet.efacet.core.query.IQueryImplementation; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.DerivedTypedElement; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.ParameterValue; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.extensible.Query; - -public class SwitchQueryImplementation implements IQueryImplementation { - - private static final String PARAM_NAME = "eStructuralFeature"; //$NON-NLS-1$ - private final ETypedElementSwitchQuery query; - private boolean checkResultType = false; - - /** - * @param query - * @param query - * the javaQuery to be evaluated - */ - public SwitchQueryImplementation(final ETypedElementSwitchQuery query) { - this.query = query; - } - - public Object getValue(final Query query2, - final DerivedTypedElement feature, final EObject source, - final List<ParameterValue> parameterValues, - final IFacetManager facetManager) - throws DerivedTypedElementException { - Object result = null; - EStructuralFeature sfParam = null; - for (final ParameterValue parameterValue : parameterValues) { - if (parameterValue.getParameter().getName().equals(PARAM_NAME)) { - sfParam = (EStructuralFeature) parameterValue.getValue(); - } - } - for (ETypedElementCase eTECase : this.query.getCases()) { - if (eTECase.getCase() == sfParam) { - final Query subquery = eTECase.getValue(); - if (subquery == null) { - try { - result = facetManager.getSuperValueOf(feature, source, - parameterValues, Object.class); - } catch (Exception e) { - throw new DerivedTypedElementException(e); - } - } else { - result = IDerivedTypedElementManager.INSTANCE.evaluate( - subquery, source, parameterValues, facetManager); - } - break; - } else { - try { - result = facetManager.getSuperValueOf(feature, source, - parameterValues, Object.class); - } catch (Exception e) { - throw new DerivedTypedElementException(e); - } - } - } - return result; - } - - public void setValue(final Query query2, final DerivedTypedElement feature, - final EObject source, final List<ParameterValue> parameterValues, - final Object newValue) throws DerivedTypedElementException { - throw new UnsupportedOperationException("Not implemented yet"); //$NON-NLS-1$ - } - - public boolean isCheckResultType() { - return this.checkResultType; - } - - public void setCheckResultType(final boolean checkResultType) { - this.checkResultType = checkResultType; - } - -}
diff --git a/org.eclipse.modisco.facet.custom.core/src/org/eclipse/emf/facet/custom/core/internal/query/SwitchQueryImplementationFactory.java b/org.eclipse.modisco.facet.custom.core/src/org/eclipse/emf/facet/custom/core/internal/query/SwitchQueryImplementationFactory.java deleted file mode 100644 index d7bc220..0000000 --- a/org.eclipse.modisco.facet.custom.core/src/org/eclipse/emf/facet/custom/core/internal/query/SwitchQueryImplementationFactory.java +++ /dev/null
@@ -1,40 +0,0 @@ -/** - * Copyright (c) 2013 Mia-Software. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Gregoire Dupe (Mia-Software) - Bug 418885 - ETypedElementSwitchQuery implemented using a deprecated query evaluator extension point - */ -package org.eclipse.emf.facet.custom.core.internal.query; - -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.facet.custom.metamodel.v0_2_0.custom.CustomPackage; -import org.eclipse.emf.facet.custom.metamodel.v0_2_0.custom.ETypedElementSwitchQuery; -import org.eclipse.emf.facet.efacet.core.IDerivedTypedElementManager; -import org.eclipse.emf.facet.efacet.core.exception.DerivedTypedElementException; -import org.eclipse.emf.facet.efacet.core.query.IQueryImplementation; -import org.eclipse.emf.facet.efacet.core.query.IQueryImplementationFactory; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.extensible.Query; -import org.osgi.framework.Bundle; - -public class SwitchQueryImplementationFactory implements - IQueryImplementationFactory { - - public IQueryImplementation create(final Query query, final Bundle bundle, - final IDerivedTypedElementManager manager) - throws DerivedTypedElementException { - if (!(query instanceof ETypedElementSwitchQuery)) { - throw new IllegalArgumentException( - "The given DerivedTypedElement does not have a ETypedElementSwitchQuery"); //$NON-NLS-1$ - } - final ETypedElementSwitchQuery switchQuery = (ETypedElementSwitchQuery) query; - return new SwitchQueryImplementation(switchQuery); - } - - public EClass getManagedQueryType() { - return CustomPackage.eINSTANCE.getETypedElementSwitchQuery(); - } -}
diff --git a/org.eclipse.modisco.facet.custom.core/src/org/eclipse/modisco/facet/custom/core/ICustomizationCatalogManager.java b/org.eclipse.modisco.facet.custom.core/src/org/eclipse/modisco/facet/custom/core/ICustomizationCatalogManager.java new file mode 100644 index 0000000..89203c9 --- /dev/null +++ b/org.eclipse.modisco.facet.custom.core/src/org/eclipse/modisco/facet/custom/core/ICustomizationCatalogManager.java
@@ -0,0 +1,65 @@ +/** + * Copyright (c) 2011, 2012 Mia-Software. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Gregoire Dupe (Mia-Software) - Bug 361794 - [Restructuring] New customization meta-model + * Nicolas Bros (Mia-Software) - Bug 372626 - Aggregates + * Gregoire Dupe (Mia-Software) - Bug 369987 - [Restructuring][Table] Switch to the new customization and facet framework + * Gregoire Dupe (Mia-Software) - Bug 373078 - API Cleaning + */ +package org.eclipse.modisco.facet.custom.core; + +import java.util.Collection; +import java.util.List; + +import org.eclipse.emf.ecore.EObject; +import org.eclipse.modisco.facet.custom.metamodel.v0_2_0.custom.Customization; + +/** + * This interface allows to access the customization catalog. + * + * @author Gregoire Dupe + * @since 0.2 + * @noextend This interface is not intended to be extended by clients. + * @noimplement This interface is not intended to be implemented by clients. + */ +public interface ICustomizationCatalogManager { + + /** + * This method is used to get all the registered customizations. + * + * @return all the registered customizations (may contain aggregates) + */ + List<Customization> getRegisteredCustomizations(); + + /** + * This method is used to get all the customization which can be applied on a list of + * eObjects and on the sub elements of those eObjects. + * + * Inheritance is handled. For example, assuming meta-model A extends + * meta-model B, the customizations declared on meta-model B have to + * be available on the instances of meta-model A. Furthermore all + * customizations containing a customization of EObject have to be applicable + * on all the models. + * + * @param eObjects the {@link EObject}s for which to get the applicable customizations + * @return a list of customizations + */ + List<Customization> getCustomizationsApplicableOn( + Collection<EObject> eObjects); + + /** + * This method is used to register a customization which has not been declared through the + * regular way (extension point). + * + * @param customization + * the customization to register + */ + void registerCustomization(Customization customization); + +}
diff --git a/org.eclipse.modisco.facet.custom.core/src/org/eclipse/modisco/facet/custom/core/ICustomizationCatalogManagerFactory.java b/org.eclipse.modisco.facet.custom.core/src/org/eclipse/modisco/facet/custom/core/ICustomizationCatalogManagerFactory.java new file mode 100644 index 0000000..5b5737e --- /dev/null +++ b/org.eclipse.modisco.facet.custom.core/src/org/eclipse/modisco/facet/custom/core/ICustomizationCatalogManagerFactory.java
@@ -0,0 +1,31 @@ +/** + * Copyright (c) 2012 Mia-Software. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Gregoire Dupe (Mia-Software) - Bug 369987 - [Restructuring][Table] Switch to the new customization and facet framework + * Gregoire Dupe (Mia-Software) - Bug 373078 - API Cleaning + */ +package org.eclipse.modisco.facet.custom.core; + +import org.eclipse.emf.ecore.resource.ResourceSet; +import org.eclipse.modisco.facet.custom.core.internal.CustomizationCatalogManagerFactory; + +/** + * A factory for {@link ICustomizationCatalogManager} + * + * @since 0.2 + * @noextend This interface is not intended to be extended by clients. + * @noimplement This interface is not intended to be implemented by clients. + */ +public interface ICustomizationCatalogManagerFactory { + + ICustomizationCatalogManagerFactory DEFAULT = new CustomizationCatalogManagerFactory(); + + ICustomizationCatalogManager getOrCreateCustomizationCatalogManager( + ResourceSet resourceSet); +}
diff --git a/org.eclipse.modisco.facet.custom.core/src/org/eclipse/modisco/facet/custom/core/ICustomizationManager.java b/org.eclipse.modisco.facet.custom.core/src/org/eclipse/modisco/facet/custom/core/ICustomizationManager.java new file mode 100644 index 0000000..db75de3 --- /dev/null +++ b/org.eclipse.modisco.facet.custom.core/src/org/eclipse/modisco/facet/custom/core/ICustomizationManager.java
@@ -0,0 +1,91 @@ +/** + * Copyright (c) 2011 Mia-Software. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Gregoire Dupe (Mia-Software) - Bug 361794 - [Restructuring] New customization meta-model + * Gregoire Dupe (Mia-Software) - Bug 369987 - [Restructuring][Table] Switch to the new customization and facet framework + * Gregoire Dupe (Mia-Software) - Bug 373078 - API Cleaning + */ +package org.eclipse.modisco.facet.custom.core; + +import java.util.List; + +import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.ecore.ETypedElement; +import org.eclipse.emf.ecore.resource.ResourceSet; +import org.eclipse.modisco.facet.custom.core.exception.CustomizationException; +import org.eclipse.modisco.facet.custom.metamodel.v0_2_0.custom.Customization; +import org.eclipse.modisco.facet.efacet.core.IFacetManager; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.FacetOperation; + +/** + * This interface allows to access the customization manager. A customization + * manager will compute the customization property depending on the loaded + * customizations. Be careful, the load order has an impact on the customization + * property value. Customizations are loaded in a stack. If there is a conflict + * between two customizations, the higher customization (the nearest from the + * top of the stack) gets the priority. + * + * @author Gregoire Dupe + * @since 0.2 + * @noextend This interface is not intended to be extended by clients. + * @noimplement This interface is not intended to be implemented by clients. + */ +public interface ICustomizationManager { + + /** + * This method is used to get the customization stack. The top + * customization in the stack will be the first in the list. + * + * @return a mutable list of customizations + */ + List<Customization> getManagedCustomizations(); + + /** + * This method is used to get the value of a customization property for a + * chosen eObject. + * + * @param eObject + * @param customProperty + * @param classs + * the expected result type + * @return a value having a type depending a the customizationProperty type. + * (Can be null.) + */ + <T> T getCustomValueOf(EObject eObject, + FacetOperation customProperty, Class<T> classs) + throws CustomizationException; + + /** + * This method is used to get the value of a customization property for a + * chosen eObject and a chosen eStructuralFeature. + * + * @param eObject + * @param structuralFeature + * must not be null + * @param customProperty + * must not be null + * @param classs + * the expected result type + * @return a value having a type depending a the customizationProperty type. + * (Can be null.) + */ + <T> T getCustomValueOf(EObject eObject, + ETypedElement structuralFeature, + FacetOperation customProperty, Class<T> classs) + throws CustomizationException; + + /** + * This method returns the resourceSet used to manage the customization + * models. + */ + ResourceSet getResourceSet(); + + IFacetManager getFacetManager(); + +}
diff --git a/org.eclipse.modisco.facet.custom.core/src/org/eclipse/modisco/facet/custom/core/ICustomizationManagerFactory.java b/org.eclipse.modisco.facet.custom.core/src/org/eclipse/modisco/facet/custom/core/ICustomizationManagerFactory.java new file mode 100644 index 0000000..498e885 --- /dev/null +++ b/org.eclipse.modisco.facet.custom.core/src/org/eclipse/modisco/facet/custom/core/ICustomizationManagerFactory.java
@@ -0,0 +1,51 @@ +/** + * Copyright (c) 2011 Mia-Software. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Gregoire Dupe (Mia-Software) - Bug 361794 - [Restructuring] New customization meta-model + * Gregoire Dupe (Mia-Software) - Bug 373078 - API Cleaning + * Gregoire Dupe (Mia-Software) - Bug 372626 - Aggregates + */ +package org.eclipse.modisco.facet.custom.core; + +import org.eclipse.emf.ecore.resource.ResourceSet; +import org.eclipse.modisco.facet.custom.core.internal.CustomizationManagerFactory; +import org.eclipse.modisco.facet.efacet.core.IFacetManager; + +/** + * Used to instantiate a customization manager + * @author Gregoire Dupe + * @since 0.2 + * @noextend This interface is not intended to be extended by clients. + * @noimplement This interface is not intended to be implemented by clients. + */ +public interface ICustomizationManagerFactory { + + /** + * Default factory instance. + */ + ICustomizationManagerFactory DEFAULT = new CustomizationManagerFactory(); + + /** + * This method is used to instantiate a customization manager + * + * @param resourceSet + * the resource set to use to manage the customization models. + * @return + */ + ICustomizationManager getOrCreateICustomizationManager(ResourceSet resourceSet); + + /** + * + * @param facetManager + * @return + * @since 0.2 + */ + ICustomizationManager createICustomizationManager(IFacetManager facetManager); + +}
diff --git a/org.eclipse.modisco.facet.custom.core/src/org/eclipse/modisco/facet/custom/core/ICustomizationManagerProvider.java b/org.eclipse.modisco.facet.custom.core/src/org/eclipse/modisco/facet/custom/core/ICustomizationManagerProvider.java new file mode 100644 index 0000000..07a9eed --- /dev/null +++ b/org.eclipse.modisco.facet.custom.core/src/org/eclipse/modisco/facet/custom/core/ICustomizationManagerProvider.java
@@ -0,0 +1,21 @@ +/** + * Copyright (c) 2014 Mia-Software. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Gregoire Dupe (Mia-Software) - Bug 441051 - Reusable customization and facet loading dialogs + */ +package org.eclipse.modisco.facet.custom.core; + +/** + * @since 1.0 + */ +public interface ICustomizationManagerProvider { + + ICustomizationManager getCustomizationManager(); + +}
diff --git a/org.eclipse.modisco.facet.custom.core/src/org/eclipse/modisco/facet/custom/core/ICustomizationPropertiesCatalogManager.java b/org.eclipse.modisco.facet.custom.core/src/org/eclipse/modisco/facet/custom/core/ICustomizationPropertiesCatalogManager.java new file mode 100644 index 0000000..3b42fb0 --- /dev/null +++ b/org.eclipse.modisco.facet.custom.core/src/org/eclipse/modisco/facet/custom/core/ICustomizationPropertiesCatalogManager.java
@@ -0,0 +1,42 @@ +/** + * Copyright (c) 2011, 2012 Mia-Software. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Gregoire Dupe (Mia-Software) - Bug 361794 - [Restructuring] EMF Facet customization meta-model + * Gregoire Dupe (Mia-Software) - Bug 369987 - [Restructuring][Table] Switch to the new customization and facet framework + * Gregoire Dupe (Mia-Software) - Bug 373078 - API Cleaning + * Alban Ménager (Soft-Maint) - Bug 387470 - [EFacet][Custom] Editors + */ +package org.eclipse.modisco.facet.custom.core; + +import java.util.List; + +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.FacetOperation; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.FacetSet; + +/** + * This interface allows to access the customization catalog. + * + * @author Gregoire Dupe + * @since 0.3 + * @noextend This interface is not intended to be extended by clients. + * @noimplement This interface is not intended to be implemented by clients. + */ +public interface ICustomizationPropertiesCatalogManager { + + /** + * This method is used to get all the registered customization properties (facetSet). + * + * @return all the registered customizations + */ + List<FacetSet> getAllRegisteredCustomizationPropertySet(); + + List<FacetOperation> getCustomizationPropertiesByName( + String propertyName); + +}
diff --git a/org.eclipse.modisco.facet.custom.core/src/org/eclipse/modisco/facet/custom/core/ICustomizationPropertiesCatalogManagerFactory.java b/org.eclipse.modisco.facet.custom.core/src/org/eclipse/modisco/facet/custom/core/ICustomizationPropertiesCatalogManagerFactory.java new file mode 100644 index 0000000..418d6d5 --- /dev/null +++ b/org.eclipse.modisco.facet.custom.core/src/org/eclipse/modisco/facet/custom/core/ICustomizationPropertiesCatalogManagerFactory.java
@@ -0,0 +1,31 @@ +/** + * Copyright (c) 2012 Mia-Software. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Alban Ménager (Soft-Maint) - Bug 387470 - [EFacet][Custom] Editors + */ +package org.eclipse.modisco.facet.custom.core; + +import org.eclipse.emf.ecore.resource.ResourceSet; +import org.eclipse.modisco.facet.custom.core.internal.CustomizationPropertiesCatalogManagerFactory; + +/** + * This interface provides the customization catalog manager. + * + * @since 0.3 + * @noextend This interface is not intended to be extended by clients. + * @noimplement This interface is not intended to be implemented by clients. + */ +public interface ICustomizationPropertiesCatalogManagerFactory { + + ICustomizationPropertiesCatalogManagerFactory INSTANCE = new CustomizationPropertiesCatalogManagerFactory(); + + ICustomizationPropertiesCatalogManager getOrCreateCustomizationPropertiesCatalogManager( + final ResourceSet resourceSet); + +} \ No newline at end of file
diff --git a/org.eclipse.modisco.facet.custom.core/src/org/eclipse/modisco/facet/custom/core/exception/CustomizationException.java b/org.eclipse.modisco.facet.custom.core/src/org/eclipse/modisco/facet/custom/core/exception/CustomizationException.java new file mode 100644 index 0000000..63dccb0 --- /dev/null +++ b/org.eclipse.modisco.facet.custom.core/src/org/eclipse/modisco/facet/custom/core/exception/CustomizationException.java
@@ -0,0 +1,40 @@ +/** + * Copyright (c) 2011 Mia-Software. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Gregoire Dupe (Mia-Software) - Bug 361794 - [Restructuring] New customization meta-model + * Gregoire Dupe (Mia-Software) - Bug 373078 - API Cleaning + */ +package org.eclipse.modisco.facet.custom.core.exception; + +/** + * This exception is thrown when the computation of a customization property value failed. + * @author Gregoire Dupe + * @noinstantiate This class is not intended to be instantiated by clients. + */ +public final class CustomizationException extends Exception { + + private static final long serialVersionUID = -4070159863668577038L; + + public CustomizationException() { + super(); + } + + public CustomizationException(final String message) { + super(message); + } + + public CustomizationException(final Throwable cause) { + super(cause); + } + + public CustomizationException(final String message, final Throwable cause) { + super(message, cause); + } + +}
diff --git a/org.eclipse.modisco.facet.custom.core/src/org/eclipse/modisco/facet/custom/core/internal/Activator.java b/org.eclipse.modisco.facet.custom.core/src/org/eclipse/modisco/facet/custom/core/internal/Activator.java new file mode 100644 index 0000000..1e338e3 --- /dev/null +++ b/org.eclipse.modisco.facet.custom.core/src/org/eclipse/modisco/facet/custom/core/internal/Activator.java
@@ -0,0 +1,62 @@ +/** + * Copyright (c) 2011 Mia-Software. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Gregoire Dupe (Mia-Software) - Bug 361794 - [Restructuring] New customization meta-model + * Nicolas Bros (Mia-Software) - Bug 375054 - Add validation warning for overlay on EClass + */ +package org.eclipse.modisco.facet.custom.core.internal; + +import org.eclipse.core.runtime.Plugin; +import org.osgi.framework.BundleContext; + +/** + * The activator class controls the plug-in life cycle + */ +public class Activator extends Plugin { + + // The shared instance + private static Activator plugin; + + /** + * The constructor + */ + public Activator() { + } + + /* + * (non-Javadoc) + * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext) + */ + @Override + public void start(final BundleContext context) throws Exception { + super.start(context); + Activator.plugin = this; + } + + /* + * (non-Javadoc) + * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext) + */ + @Override + public void stop(final BundleContext context) throws Exception { + Activator.plugin = null; + super.stop(context); + } + + /** + * Returns the shared instance + * + * @return the shared instance + */ + public static Activator getDefault() { + return Activator.plugin; + } + + +}
diff --git a/org.eclipse.modisco.facet.custom.core/src/org/eclipse/modisco/facet/custom/core/internal/CustomizationCatalogManager.java b/org.eclipse.modisco.facet.custom.core/src/org/eclipse/modisco/facet/custom/core/internal/CustomizationCatalogManager.java new file mode 100644 index 0000000..949b32e --- /dev/null +++ b/org.eclipse.modisco.facet.custom.core/src/org/eclipse/modisco/facet/custom/core/internal/CustomizationCatalogManager.java
@@ -0,0 +1,104 @@ +/** + * Copyright (c) 2011, 2016 Mia-Software. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Grégoire Dupé (Mia-Software) - Bug 361794 - [Restructuring] New customization meta-model + * Grégoire Dupé (Mia-Software) - Bug 369987 - [Restructuring][Table] Switch to the new customization and facet framework + * Nicolas Bros (Mia-Software) - Bug 372626 - Aggregates + * Grégoire Dupé (Mia-Software) - Bug 373078 - API Cleaning + * Grégoire Dupé (Mia-Software) - Bug 477657 - The catalog manager should be able to manage workspace model + * Grégoire Dupé (Mia-Software) - Bug 482887 - CatalogManager create files with too long name + */ +package org.eclipse.modisco.facet.custom.core.internal; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.Collections; +import java.util.List; + +import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.ecore.resource.ResourceSet; +import org.eclipse.modisco.facet.custom.core.ICustomizationCatalogManager; +import org.eclipse.modisco.facet.custom.metamodel.v0_2_0.custom.Customization; +import org.eclipse.modisco.facet.util.emf.core.catalog.ICatalogManager; +import org.eclipse.modisco.facet.util.emf.core.catalog.ICatalogManagerConfiguration; +import org.eclipse.modisco.facet.util.emf.core.catalog.ICatalogManagerFactory; + +/** + * Customization catalog implementation using the catalog manager features provided by the plug-in + * org.eclipse.emf.facet.util.emf.core + * + * @author Grégoire Dupé + * + */ +public class CustomizationCatalogManager implements + ICustomizationCatalogManager { + + private final ICatalogManager catalogMgr; + + public CustomizationCatalogManager(final ResourceSet resourceSet) { + final ICatalogManagerConfiguration catalogMgrConfig = + new CatalogManagerConfiguration(); + this.catalogMgr = ICatalogManagerFactory.DEFAULT.getOrCreateCatalogManager( + catalogMgrConfig, resourceSet, this.getClass().getName()); + } + + + public List<Customization> getCustomizationsByName(final String name) { + final List<Customization> result = new ArrayList<Customization>(); + for (EObject eObject : this.catalogMgr.getInstalledEntries(EObject.class)) { + if (eObject instanceof Customization) { + final Customization customization = (Customization) eObject; + if (name.equals(customization.getName())) { + result.add(customization); + } + } else { + throw new RuntimeException("Only customizations (and aggregates) must be stored in the customization catalog"); //$NON-NLS-1$ + } + } + return result; + } + + public void registerCustomization(final Customization customization) { + this.catalogMgr.addWsEntry(customization); + } + + public List<Customization> getCustomizationsApplicableOn( + final Collection<EObject> eObjects) { + // TODO Auto-generated method stub + return null; + } + + public List<Customization> getRegisteredCustomizations() { + final List<Customization> result = new ArrayList<Customization>(); + final List<EObject> installedEntries = this.catalogMgr + .getInstalledEntries(EObject.class); + for (EObject eObject : installedEntries) { + if (eObject instanceof Customization) { + final Customization customization = (Customization) eObject; + result.add(customization); + } else { + throw new RuntimeException("Only customizations (and aggregates) must be stored in the customization catalog"); //$NON-NLS-1$ + } + } + return Collections.unmodifiableList(result); + } + + public class CatalogManagerConfiguration implements ICatalogManagerConfiguration { + + public boolean canBeManaged(final EObject root) { + return root instanceof Customization; + } + + public boolean isValid(final EObject root) { + return true; + } + + } + +}
diff --git a/org.eclipse.modisco.facet.custom.core/src/org/eclipse/modisco/facet/custom/core/internal/CustomizationCatalogManagerFactory.java b/org.eclipse.modisco.facet.custom.core/src/org/eclipse/modisco/facet/custom/core/internal/CustomizationCatalogManagerFactory.java new file mode 100644 index 0000000..f59c058 --- /dev/null +++ b/org.eclipse.modisco.facet.custom.core/src/org/eclipse/modisco/facet/custom/core/internal/CustomizationCatalogManagerFactory.java
@@ -0,0 +1,26 @@ +/** + * Copyright (c) 2012, 2015 Mia-Software. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Gregoire Dupe (Mia-Software) - Bug 369987 - [Restructuring][Table] Switch to the new customization and facet framework + * Gregoire Dupe (Mia-Software) - Bug 477657 - The catalog manager should be able to manage workspace model + */ +package org.eclipse.modisco.facet.custom.core.internal; + +import org.eclipse.emf.ecore.resource.ResourceSet; +import org.eclipse.modisco.facet.custom.core.ICustomizationCatalogManager; + +public class CustomizationCatalogManagerFactory implements + org.eclipse.modisco.facet.custom.core.ICustomizationCatalogManagerFactory { + + public ICustomizationCatalogManager getOrCreateCustomizationCatalogManager( + final ResourceSet resourceSet) { + return new CustomizationCatalogManager(resourceSet); + } + +}
diff --git a/org.eclipse.modisco.facet.custom.core/src/org/eclipse/modisco/facet/custom/core/internal/CustomizationManager.java b/org.eclipse.modisco.facet.custom.core/src/org/eclipse/modisco/facet/custom/core/internal/CustomizationManager.java new file mode 100644 index 0000000..b546849 --- /dev/null +++ b/org.eclipse.modisco.facet.custom.core/src/org/eclipse/modisco/facet/custom/core/internal/CustomizationManager.java
@@ -0,0 +1,182 @@ +/** + * Copyright (c) 2011-2012 Mia-Software. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Gregoire Dupe (Mia-Software) - Bug 361794 - [Restructuring] EMF Facet customization meta-model + * Gregoire Dupe (Mia-Software) - Bug 369987 - [Restructuring][Table] Switch to the new customization and facet framework + * Nicolas Bros (Mia-Software) - Bug 372626 - Aggregates + * Gregoire Dupe (Mia-Software) - Bug 373078 - API Cleaning + * Nicolas Bros (Mia-Software) - Bug 378271 - [Table] Select Columns To Hide is broken + */ +package org.eclipse.modisco.facet.custom.core.internal; + +import java.util.ArrayList; +import java.util.HashSet; +import java.util.Iterator; +import java.util.LinkedList; +import java.util.List; + +import org.eclipse.emf.common.util.URI; +import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.ecore.ETypedElement; +import org.eclipse.emf.ecore.resource.Resource; +import org.eclipse.emf.ecore.resource.ResourceSet; +import org.eclipse.modisco.facet.custom.core.ICustomizationManager; +import org.eclipse.modisco.facet.custom.core.exception.CustomizationException; +import org.eclipse.modisco.facet.custom.metamodel.v0_2_0.custom.Customization; +import org.eclipse.modisco.facet.efacet.core.IFacetManager; +import org.eclipse.modisco.facet.efacet.core.IFacetManagerFactory; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.FacetOperation; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.FacetSet; + +public class CustomizationManager implements ICustomizationManager { + + private final HashSet<FacetOperation> customProperties = new HashSet<FacetOperation>(); + private final IFacetManager facetManager; + + public CustomizationManager(final ResourceSet resourceSet) { + this.facetManager = IFacetManagerFactory.DEFAULT.getOrCreateFacetManager(resourceSet); + } + + public CustomizationManager(final IFacetManager facetManager) { + this.facetManager = facetManager; + } + + public void addFrontManagedCustomization(final Customization customization) { + this.facetManager.getManagedFacetSets().add(0, customization); + } + + public void removeCustomization(final Customization customization) { + this.facetManager.getManagedFacetSets().remove(customization); + } + + public List<Customization> getManagedCustomizations() { + return new CustomizationsDelegatingList(this.facetManager.getManagedFacetSets()); + } + + public <T> T getCustomValueOf(final EObject eObject, + final FacetOperation customizationProperty, + final Class<T> classs) + throws CustomizationException { + // Begin precondition checking section + /* The scope of a customization property is not available yet in new customization meta-model + if (!(customizationProperty.getScope().contains( + CustomizationPropertyScope.ECLASS) || (customizationProperty + .getScope().contains(CustomizationPropertyScope.FACET)))) { + throw new RuntimeException( + "The customization property is expected to be applicable on an EClass or on a Facet"); //$NON-NLS-1$ + } + */ + // End precondition checking section + T result = null; + try { + // the structural feature : null + final Object[] args = new Object[] { null }; + result = this.facetManager.invoke(eObject, customizationProperty, + classs, null, args); + } catch (final Exception e) { + throw new CustomizationException(e); + } + return result; + } + + public <T> T getCustomValueOf(final EObject eObject, + final ETypedElement eTypedElement, + final FacetOperation customizationProperty, + final Class<T> classs) + throws CustomizationException { + // Begin precondition checking section + if (eObject == null) { + throw new IllegalArgumentException( + "The parameter 'eObject' must not be null."); //$NON-NLS-1$ + } + if (customizationProperty == null) { + throw new IllegalArgumentException( + "The parameter 'customizationProperty' must not be null."); //$NON-NLS-1$ + } + /* The scope of a customization property is not available yet in new customization meta-model + if (!(eStructuralFeature instanceof EReference)) { + if (customizationProperty.getScope().equals( + CustomizationPropertyScope.EREFERENCE)) { + throw new CustomizationException( + "The eStructuralFeature is an instance of " //$NON-NLS-1$ + + eStructuralFeature.getClass().getName() + + " but EReference is expected."); //$NON-NLS-1$ + } + } + + if (!(eStructuralFeature instanceof EAttribute)) { + if (customizationProperty.getScope().equals( + CustomizationPropertyScope.EATTRIBUTE)) { + throw new CustomizationException( + "The eStructuralFeature is an instance of " //$NON-NLS-1$ + + eStructuralFeature.getClass().getName() + + " but EAttribute is expected."); //$NON-NLS-1$ + } + } + */ + // End precondition checking section + try { + return this.facetManager.invoke(eObject, customizationProperty, classs, null, new Object[] { eTypedElement }); + } catch (Exception e) { + throw new CustomizationException(e); + } + } + + public List<FacetOperation> getCustomizationPropertiesByName( + final String name) { + if (name == null) { + throw new IllegalArgumentException( + "The parameter 'name' must not be null."); //$NON-NLS-1$ + } + List<FacetOperation> results = new ArrayList<FacetOperation>(); + for (FacetOperation customizationProperty : this.customProperties) { + if (name.equals(customizationProperty.getName())) { + results.add(customizationProperty); + } + } + return results; + } + + public void addCustomization(final URI uri) { + if (uri == null) { + throw new IllegalArgumentException( + "The parameter 'uri' must not be null."); //$NON-NLS-1$ + } + Resource resource = this.facetManager.getResourceSet().getResource(uri, true); + Iterator<EObject> iterator = resource.getAllContents(); + while (iterator.hasNext()) { + EObject eObject = iterator.next(); + if (eObject instanceof FacetOperation) { + FacetOperation customizationProperty = (FacetOperation) eObject; + this.customProperties.add(customizationProperty); + } + } + } + + public ResourceSet getResourceSet() { + return this.facetManager.getResourceSet(); + } + + public void removeAllCustomizations() { + List<Customization> customizationsToRemove = new LinkedList<Customization>(); + for (FacetSet facetSet : this.facetManager.getManagedFacetSets()) { + if (facetSet instanceof Customization) { + Customization customization = (Customization) facetSet; + customizationsToRemove.add(customization); + } + } + for (Customization customization : customizationsToRemove) { + this.facetManager.getManagedFacetSets().remove(customization); + } + } + + public IFacetManager getFacetManager() { + return this.facetManager; + } +}
diff --git a/org.eclipse.modisco.facet.custom.core/src/org/eclipse/modisco/facet/custom/core/internal/CustomizationManagerFactory.java b/org.eclipse.modisco.facet.custom.core/src/org/eclipse/modisco/facet/custom/core/internal/CustomizationManagerFactory.java new file mode 100644 index 0000000..5234aff --- /dev/null +++ b/org.eclipse.modisco.facet.custom.core/src/org/eclipse/modisco/facet/custom/core/internal/CustomizationManagerFactory.java
@@ -0,0 +1,32 @@ +/** + * Copyright (c) 2011 Mia-Software. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Gregoire Dupe (Mia-Software) - Bug 361794 - [Restructuring] New customization meta-model + * Gregoire Dupe (Mia-Software) - Bug 373078 - API Cleaning + */ +package org.eclipse.modisco.facet.custom.core.internal; + +import org.eclipse.emf.ecore.resource.ResourceSet; +import org.eclipse.modisco.facet.custom.core.ICustomizationManager; +import org.eclipse.modisco.facet.custom.core.ICustomizationManagerFactory; +import org.eclipse.modisco.facet.efacet.core.IFacetManager; + +public class CustomizationManagerFactory implements + ICustomizationManagerFactory { + + public ICustomizationManager getOrCreateICustomizationManager(final ResourceSet resourceSet) { + return new CustomizationManager(resourceSet); + } + + public ICustomizationManager createICustomizationManager( + final IFacetManager facetManager) { + return new CustomizationManager(facetManager); + } + +}
diff --git a/org.eclipse.modisco.facet.custom.core/src/org/eclipse/modisco/facet/custom/core/internal/CustomizationPropertiesCatalogManager.java b/org.eclipse.modisco.facet.custom.core/src/org/eclipse/modisco/facet/custom/core/internal/CustomizationPropertiesCatalogManager.java new file mode 100644 index 0000000..04063d3 --- /dev/null +++ b/org.eclipse.modisco.facet.custom.core/src/org/eclipse/modisco/facet/custom/core/internal/CustomizationPropertiesCatalogManager.java
@@ -0,0 +1,106 @@ +/** + * Copyright (c) 2011, 2016 Mia-Software. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Gregoire Dupe (Mia-Software) - Bug 361794 - [Restructuring] EMF Facet customization meta-model + * Gregoire Dupe (Mia-Software) - Bug 369987 - [Restructuring][Table] Switch to the new customization and facet framework + * Gregoire Dupe (Mia-Software) - Bug 373078 - API Cleaning + * Alban Ménager (Soft-Maint) - Bug 387470 - [EFacet][Custom] Editors + * Gregoire Dupe (Mia-Software) - Bug 477657 - The catalog manager should be able to manage workspace model + * Grégoire Dupé (Mia-Software) - Bug 482887 - CatalogManager create files with too long name + */ +package org.eclipse.modisco.facet.custom.core.internal; + +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; + +import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.ecore.resource.ResourceSet; +import org.eclipse.modisco.facet.custom.core.ICustomizationPropertiesCatalogManager; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.FacetOperation; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.FacetSet; +import org.eclipse.modisco.facet.util.emf.core.catalog.ICatalogManager; +import org.eclipse.modisco.facet.util.emf.core.catalog.ICatalogManagerConfiguration; +import org.eclipse.modisco.facet.util.emf.core.catalog.ICatalogManagerFactory; + +/** + * Customization catalog implementation using the catalog manager features + * provided by the plug-in org.eclipse.emf.facet.util.emf.core + * + * @author Gregoire Dupe + * + */ +public class CustomizationPropertiesCatalogManager implements + ICustomizationPropertiesCatalogManager { + + private static final String CUSTOM_SUFIX = "customproperties"; //$NON-NLS-1$ + private final ICatalogManager catalogMgr; + + public CustomizationPropertiesCatalogManager(final ResourceSet resourceSet) { + final ICatalogManagerConfiguration catalogMgrConfig = + new CatalogManagerConfiguration(); + this.catalogMgr = ICatalogManagerFactory.DEFAULT.getOrCreateCatalogManager( + catalogMgrConfig, resourceSet, this.getClass().getName()); + } + + public List<FacetSet> getAllRegisteredCustomizationPropertySet() { + final List<FacetSet> result = new ArrayList<FacetSet>(); + for (final EObject eObject : this.catalogMgr.getInstalledEntries(EObject.class)) { + if (eObject instanceof FacetSet) { + final FacetSet facetSet = (FacetSet) eObject; + result.add(facetSet); + } else { + throw new RuntimeException( + "Only facetSets must be stored in the customization properties catalog"); //$NON-NLS-1$ + } + } + return result; + } + + public List<FacetOperation> getCustomizationPropertiesByName( + final String customPropName) { + final List<FacetOperation> result = new ArrayList<FacetOperation>(); + for (final EObject facetSet : this.catalogMgr.getInstalledEntries(EObject.class)) { + final Iterator<EObject> iterator = facetSet.eAllContents(); + while (iterator.hasNext()) { + final EObject eObject = iterator.next(); + if (eObject instanceof FacetOperation) { + final FacetOperation customProperty = (FacetOperation) eObject; + if (customPropName.equals(customProperty.getName())) { + result.add(customProperty); + } + } + } + } + return result; + } + + + public class CatalogManagerConfiguration implements ICatalogManagerConfiguration { + + public boolean canBeManaged(final EObject root) { + return root instanceof FacetSet; + } + + public boolean isValid(final EObject root) { + boolean result = false; + if (root instanceof FacetSet) { + final FacetSet customProperties = (FacetSet) root; + // We have to force the integrator to use the suffix + // "customproperties" to name them facetSet declaring custom + // properties. Otherwise we won't be able to know if a facetSet is a + // custom property declaration + result = customProperties.getName().endsWith(CUSTOM_SUFIX); + } + return result; + } + + } + +} \ No newline at end of file
diff --git a/org.eclipse.modisco.facet.custom.core/src/org/eclipse/modisco/facet/custom/core/internal/CustomizationPropertiesCatalogManagerFactory.java b/org.eclipse.modisco.facet.custom.core/src/org/eclipse/modisco/facet/custom/core/internal/CustomizationPropertiesCatalogManagerFactory.java new file mode 100644 index 0000000..7f139e5 --- /dev/null +++ b/org.eclipse.modisco.facet.custom.core/src/org/eclipse/modisco/facet/custom/core/internal/CustomizationPropertiesCatalogManagerFactory.java
@@ -0,0 +1,29 @@ +/** + * Copyright (c) 2012, 2015 Mia-Software. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Alban Ménager (Soft-Maint) - Bug 387470 - [EFacet][Custom] Editors + * Gregoire Dupe (Mia-Software) - Bug 477657 - The catalog manager should be able to manage workspace model + */ +package org.eclipse.modisco.facet.custom.core.internal; + +import org.eclipse.emf.ecore.resource.ResourceSet; +import org.eclipse.modisco.facet.custom.core.ICustomizationPropertiesCatalogManager; +import org.eclipse.modisco.facet.custom.core.ICustomizationPropertiesCatalogManagerFactory; + +/** + * Implementation of {@link ICustomizationPropertiesCatalogManagerFactory}. + */ +public class CustomizationPropertiesCatalogManagerFactory implements ICustomizationPropertiesCatalogManagerFactory { + + public ICustomizationPropertiesCatalogManager getOrCreateCustomizationPropertiesCatalogManager( + final ResourceSet resourceSet) { + return new CustomizationPropertiesCatalogManager(resourceSet); + } + +}
diff --git a/org.eclipse.modisco.facet.custom.core/src/org/eclipse/modisco/facet/custom/core/internal/CustomizationsDelegatingList.java b/org.eclipse.modisco.facet.custom.core/src/org/eclipse/modisco/facet/custom/core/internal/CustomizationsDelegatingList.java new file mode 100644 index 0000000..f18ac31 --- /dev/null +++ b/org.eclipse.modisco.facet.custom.core/src/org/eclipse/modisco/facet/custom/core/internal/CustomizationsDelegatingList.java
@@ -0,0 +1,264 @@ +/******************************************************************************* + * Copyright (c) 2012, 2015 CEA LIST, Soft-Maint and Mia-Software. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Nicolas Bros (Mia-Software) - Bug 374758 - [Table] repair the table + * Gregoire Dupe (Mia-Software) - Bug 372626 - Aggregates + * Thomas Cicognani (Soft-Maint) - Bug 420192 - UnsupportedOperationException in a usefull method + * Thomas Cicognani (Soft-Maint) - Bug 435882 - org.eclipse.emf.facet.custom.core.internal.CustomizationsDelegatingList not fully implemented + * Thomas Cicognani (Soft-Maint) - Bug 441317 - Clearing a CustomizationsDelegatingList doesn't notify listeners + * Grégoire Dupé (Mia-Software) - Bug 476141 - Facet manger can fail with ConcurrentModificationException + *******************************************************************************/ +package org.eclipse.modisco.facet.custom.core.internal; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.Iterator; +import java.util.List; +import java.util.ListIterator; + +import org.eclipse.modisco.facet.custom.metamodel.v0_2_0.custom.Customization; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.FacetSet; + +/** Represents a list of {@link Customization}s that exists as a subset of a delegate list of {@link FacetSet}s. */ +public class CustomizationsDelegatingList implements List<Customization> { + private final List<FacetSet> delegate; + + public CustomizationsDelegatingList(final List<FacetSet> delegate) { + this.delegate = delegate; + } + + private List<Customization> createSubList() { + final List<Customization> customizations = new ArrayList<Customization>(this.delegate.size()); + for (FacetSet facetSet : this.delegate) { + if (facetSet instanceof Customization) { + final Customization customization = (Customization) facetSet; + customizations.add(customization); + } + } + return customizations; + } + + private static void throwOutOfBoundException(final int index, final int customIndex) { + final String message = String.format("Index: %d, Size: %d", //$NON-NLS-1$ + Integer.valueOf(index), Integer.valueOf(customIndex)); + throw new IndexOutOfBoundsException(message); + } + + public int size() { + return this.createSubList().size(); + } + + public boolean isEmpty() { + return this.createSubList().isEmpty(); + } + + public boolean contains(final Object element) { + return element instanceof Customization && this.delegate.contains(element); + } + + public Iterator<Customization> iterator() { + final List<Customization> customizations = createSubList(); + return customizations.iterator(); + } + + + public Object[] toArray() { + return createSubList().toArray(); + } + + public <T> T[] toArray(final T[] array) { + return createSubList().toArray(array); + } + + public boolean add(final Customization customization) { + return this.delegate.add(customization); + } + + public boolean remove(final Object element) { + return this.delegate.remove(element); + } + + public boolean containsAll(final Collection<?> collection) { + return createSubList().containsAll(collection); + } + + public boolean addAll(final Collection<? extends Customization> collection) { + return this.delegate.addAll(collection); + } + + public boolean addAll(final int index, + final Collection<? extends Customization> collection) { + boolean addAllDone = false; + int customIndex = 0; + for (int i = 0; i < this.delegate.size(); i++) { + final FacetSet facetSet = this.delegate.get(i); + if (facetSet instanceof Customization) { + if (customIndex == index) { + addAllDone = true; + this.delegate.addAll(i, collection); + break; + } + customIndex++; + } + } + return addAllDone; + } + + public boolean removeAll(final Collection<?> collection) { + return this.delegate.removeAll(collection); + } + + public boolean retainAll(final Collection<?> collection) { + boolean modified = false; + final Iterator<FacetSet> iterator = this.delegate.iterator(); + while (iterator.hasNext()) { + final FacetSet next = iterator.next(); + if (next instanceof Customization && !collection.contains(next)) { + this.delegate.remove(next); + modified = true; + } + } + return modified; + } + + public void clear() { + final List<Customization> customToClear = new ArrayList<Customization>(); + final Iterator<FacetSet> iterator = this.delegate.iterator(); + while (iterator.hasNext()) { + final FacetSet facetSet = iterator.next(); + if (facetSet instanceof Customization) { + customToClear.add((Customization) facetSet); + } + } + this.delegate.removeAll(customToClear); + } + + public Customization get(final int index) { + Customization getValue = null; + int customIndex = 0; + for (FacetSet facetSet : this.delegate) { + if (facetSet instanceof Customization) { + if (customIndex == index) { + getValue = (Customization) facetSet; + break; + } + customIndex++; + } + } + if (getValue == null) { + throwOutOfBoundException(index, customIndex); + } + return getValue; + } + + public Customization set(final int index, final Customization element) { + Customization oldValue = null; + int customIndex = 0; + for (int i = 0; i < this.delegate.size(); i++) { + final FacetSet facetSet = this.delegate.get(i); + if (facetSet instanceof Customization) { + if (customIndex == index) { + oldValue = (Customization) facetSet; + this.delegate.set(i, element); + break; + } + customIndex++; + } + } + if (oldValue == null) { + throwOutOfBoundException(index, customIndex); + } + return oldValue; + } + + public void add(final int index, final Customization element) { + Customization movedFacet = null; + int customIndex = 0; + if (index == 0) { + this.delegate.add(0, element); + } else { + for (int i = 0; i < this.delegate.size(); i++) { + final FacetSet facetSet = this.delegate.get(i); + if (facetSet instanceof Customization) { + if (customIndex == index) { + movedFacet = (Customization) facetSet; + this.delegate.add(i, element); + break; + } + customIndex++; + } + } + if (movedFacet == null) { + throwOutOfBoundException(index, customIndex); + } + } + } + + public Customization remove(final int index) { + Customization removedCustom = null; + int customIndex = 0; + for (int i = 0; i < this.delegate.size(); i++) { + final FacetSet facetSet = this.delegate.get(i); + if (facetSet instanceof Customization) { + if (customIndex == index) { + removedCustom = (Customization) facetSet; + this.delegate.remove(i); + break; + } + customIndex++; + } + } + if (removedCustom == null) { + throwOutOfBoundException(index, customIndex); + } + return removedCustom; + } + + public int indexOf(final Object element) { + int indexOfElement = -1; + int customIndex = 0; + for (FacetSet facetSet : this.delegate) { + if (facetSet instanceof Customization) { + if (facetSet.equals(element)) { + indexOfElement = customIndex; + break; + } + customIndex++; + } + } + return indexOfElement; + } + + public int lastIndexOf(final Object element) { + return createSubList().lastIndexOf(element); + } + + public ListIterator<Customization> listIterator() { + return this.createSubList().listIterator(); + } + + public ListIterator<Customization> listIterator(final int index) { + return createSubList().listIterator(index); + } + + public List<Customization> subList(final int fromIndex, final int toIndex) { + final List<Customization> subList = new ArrayList<Customization>(); + int customIndex = 0; + for (FacetSet facetSet : this.delegate) { + if (facetSet instanceof Customization) { + if (customIndex >= fromIndex && customIndex < toIndex) { + subList.add((Customization) facetSet); + } else if (customIndex >= toIndex) { + break; + } + customIndex++; + } + } + return subList; + } +}
diff --git a/org.eclipse.modisco.facet.custom.core/src/org/eclipse/modisco/facet/custom/core/internal/exception/CustomizationCatalogRuntimeException.java b/org.eclipse.modisco.facet.custom.core/src/org/eclipse/modisco/facet/custom/core/internal/exception/CustomizationCatalogRuntimeException.java new file mode 100644 index 0000000..f0e3fc2 --- /dev/null +++ b/org.eclipse.modisco.facet.custom.core/src/org/eclipse/modisco/facet/custom/core/internal/exception/CustomizationCatalogRuntimeException.java
@@ -0,0 +1,40 @@ +/** + * Copyright (c) 2011 Mia-Software. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Gregoire Dupe (Mia-Software) - Bug 369987 - [Restructuring][Table] Switch to the new customization and facet framework + * Gregoire Dupe (Mia-Software) - Bug 373078 - API Cleaning + */ +package org.eclipse.modisco.facet.custom.core.internal.exception; + +/** + * @noinstantiate This class is not intended to be instantiated by clients. + * @author Gregoire Dupe + * + */ +public final class CustomizationCatalogRuntimeException extends RuntimeException { + + private static final long serialVersionUID = 6589838701903506569L; + + public CustomizationCatalogRuntimeException() { + super(); + } + + public CustomizationCatalogRuntimeException(final String message) { + super(message); + } + + public CustomizationCatalogRuntimeException(final Throwable cause) { + super(cause); + } + + public CustomizationCatalogRuntimeException(final String message, final Throwable cause) { + super(message, cause); + } + +}
diff --git a/org.eclipse.modisco.facet.custom.core/src/org/eclipse/modisco/facet/custom/core/internal/exported/Constants.java b/org.eclipse.modisco.facet.custom.core/src/org/eclipse/modisco/facet/custom/core/internal/exported/Constants.java new file mode 100644 index 0000000..1031fb6 --- /dev/null +++ b/org.eclipse.modisco.facet.custom.core/src/org/eclipse/modisco/facet/custom/core/internal/exported/Constants.java
@@ -0,0 +1,21 @@ +/******************************************************************************* + * Copyright (c) 2012 CEA LIST. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Gregoire Dupe (Mia-Software) - Bug 375054 - Add validation warning for overlay on EClass + *******************************************************************************/ + +package org.eclipse.modisco.facet.custom.core.internal.exported; + +public final class Constants { + + private Constants() { + // Must not be used + } + + public static final String CUSTOM_FILE_EXT = "custom"; //$NON-NLS-1$ +}
diff --git a/org.eclipse.modisco.facet.custom.core/src/org/eclipse/modisco/facet/custom/core/internal/exported/CustomizationUtils.java b/org.eclipse.modisco.facet.custom.core/src/org/eclipse/modisco/facet/custom/core/internal/exported/CustomizationUtils.java new file mode 100644 index 0000000..2c83a0a --- /dev/null +++ b/org.eclipse.modisco.facet.custom.core/src/org/eclipse/modisco/facet/custom/core/internal/exported/CustomizationUtils.java
@@ -0,0 +1,132 @@ +/** + * Copyright (c) 2011, 2012 Mia-Software. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Gregoire Dupe (Mia-Software) - Bug 373078 - API Cleaning + * Gregoire Dupe (Mia-Software) - Bug 376576 - [EFacet] Change the multiplicity of Facet::extendedFacet + * David Couvrand (Soft-Maint) - Bug 418418 - [Customization] Overlay icons not implemented + */ +package org.eclipse.modisco.facet.custom.core.internal.exported; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.LinkedList; +import java.util.List; + +import org.eclipse.emf.ecore.EClassifier; +import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.ecore.EPackage; +import org.eclipse.emf.ecore.ETypedElement; +import org.eclipse.modisco.facet.custom.core.ICustomizationManager; +import org.eclipse.modisco.facet.custom.core.exception.CustomizationException; +import org.eclipse.modisco.facet.custom.core.internal.Activator; +import org.eclipse.modisco.facet.custom.metamodel.v0_2_0.custom.Customization; +import org.eclipse.modisco.facet.custom.metamodel.v0_2_0.custom.EClassCustomization; +import org.eclipse.modisco.facet.custom.metamodel.v0_2_0.custom.FacetCustomization; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.FacetOperation; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.FacetSet; +import org.eclipse.modisco.facet.util.core.Logger; + +/** + * @since 0.2 + */ +public final class CustomizationUtils { + + private static final String FILE_EXTENSION = "custom"; //$NON-NLS-1$ + + private CustomizationUtils() { + // Must not be used + } + + public static EPackage getCustomizedEPackage( + final Customization customization) { + EPackage result = null; + for (EClassifier eClassifier : customization.getEClassifiers()) { + for (EPackage ePackage : getExtendedEPackage(eClassifier)) { + if (ePackage != null && !(ePackage instanceof FacetSet)) { + result = ePackage; + break; + } + } + } + return result; + } + + private static List<EPackage> getExtendedEPackage( + final EClassifier eClassifier) { + final List<EClassifier> extended = new ArrayList<EClassifier>(); + if (eClassifier instanceof FacetCustomization) { + final FacetCustomization facetCustom = (FacetCustomization) eClassifier; + extended.addAll(facetCustom.getExtendedFacets()); + } else if (eClassifier instanceof EClassCustomization) { + final EClassCustomization eClassCustom = (EClassCustomization) eClassifier; + extended.add(eClassCustom.getExtendedMetaclass()); + } + final List<EPackage> ePackages = new LinkedList<EPackage>(); + for (EClassifier extCassifier : extended) { + if (extCassifier != null) { + ePackages.add(extCassifier.getEPackage()); + } + } + return ePackages; + } + + /** + * Return the default file extension of a customization file. + * + * @return the file extension without the dot. + */ + public static String getDefaultFileExtension() { + return CustomizationUtils.FILE_EXTENSION; + } + + /** + * Find a Customization with the given name among the given list of Customizations. If several Customizations have the same name, + * then return the first one. + * + * @param customizations + * where to look for + * @param name + * the name of the Customization to find + * @return the Customization, or <code>null</code> if not found in the given list + */ + public static Customization getCustomization(final Collection<Customization> customizations, final String name) { + Customization result = null; + for (Customization customization : customizations) { + if (name.equals(customization.getName())) { + result = customization; + } + } + return result; + } + + public static <T> T getPropertyValue( + final ICustomizationManager customManager, final Object element, + final FacetOperation property, final ETypedElement eTypedElement, + final Class<T> classs) { + T result = null; + if (element instanceof EObject) { + final EObject eObject = (EObject) element; + try { + if (eTypedElement == null) { + result = customManager.getCustomValueOf(eObject, property, + classs); + } else { + result = customManager.getCustomValueOf(eObject, + eTypedElement, property, classs); + } + } catch (final CustomizationException e) { + Logger.logError( + e, + "Failed to get the value of '" + property.getName() + "' for " + element, //$NON-NLS-1$ //$NON-NLS-2$ + Activator.getDefault()); + } + } + return result; + } +}
diff --git a/org.eclipse.modisco.facet.custom.core/src/org/eclipse/modisco/facet/custom/core/internal/query/SwitchQueryImplementation.java b/org.eclipse.modisco.facet.custom.core/src/org/eclipse/modisco/facet/custom/core/internal/query/SwitchQueryImplementation.java new file mode 100644 index 0000000..0bce052 --- /dev/null +++ b/org.eclipse.modisco.facet.custom.core/src/org/eclipse/modisco/facet/custom/core/internal/query/SwitchQueryImplementation.java
@@ -0,0 +1,97 @@ +/** + * Copyright (c) 2013 Mia-Software. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Gregoire Dupe (Mia-Software) - Bug 418885 - ETypedElementSwitchQuery implemented using a deprecated query evaluator extension point + * Gregoire Dupe (Mia-Software) - Bug 443682 - Access to the super facet + */ +package org.eclipse.modisco.facet.custom.core.internal.query; + +import java.util.List; + +import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.ecore.EStructuralFeature; +import org.eclipse.modisco.facet.custom.metamodel.v0_2_0.custom.ETypedElementCase; +import org.eclipse.modisco.facet.custom.metamodel.v0_2_0.custom.ETypedElementSwitchQuery; +import org.eclipse.modisco.facet.efacet.core.IDerivedTypedElementManager; +import org.eclipse.modisco.facet.efacet.core.IFacetManager; +import org.eclipse.modisco.facet.efacet.core.exception.DerivedTypedElementException; +import org.eclipse.modisco.facet.efacet.core.exception.FacetManagerException; +import org.eclipse.modisco.facet.efacet.core.query.IQueryImplementation; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.DerivedTypedElement; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.ParameterValue; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.extensible.Query; + +public class SwitchQueryImplementation implements IQueryImplementation { + + private static final String PARAM_NAME = "eStructuralFeature"; //$NON-NLS-1$ + private final ETypedElementSwitchQuery query; + private boolean checkResultType = false; + + /** + * @param query + * @param query + * the javaQuery to be evaluated + */ + public SwitchQueryImplementation(final ETypedElementSwitchQuery query) { + this.query = query; + } + + public Object getValue(final Query query2, + final DerivedTypedElement feature, final EObject source, + final List<ParameterValue> parameterValues, + final IFacetManager facetManager) + throws DerivedTypedElementException { + Object result = null; + EStructuralFeature sfParam = null; + for (final ParameterValue parameterValue : parameterValues) { + if (parameterValue.getParameter().getName().equals(PARAM_NAME)) { + sfParam = (EStructuralFeature) parameterValue.getValue(); + } + } + for (ETypedElementCase eTECase : this.query.getCases()) { + if (eTECase.getCase() == sfParam) { + final Query subquery = eTECase.getValue(); + if (subquery == null) { + try { + result = facetManager.getSuperValueOf(feature, source, + parameterValues, Object.class); + } catch (Exception e) { + throw new DerivedTypedElementException(e); + } + } else { + result = IDerivedTypedElementManager.INSTANCE.evaluate( + subquery, source, parameterValues, facetManager); + } + break; + } else { + try { + result = facetManager.getSuperValueOf(feature, source, + parameterValues, Object.class); + } catch (Exception e) { + throw new DerivedTypedElementException(e); + } + } + } + return result; + } + + public void setValue(final Query query2, final DerivedTypedElement feature, + final EObject source, final List<ParameterValue> parameterValues, + final Object newValue) throws DerivedTypedElementException { + throw new UnsupportedOperationException("Not implemented yet"); //$NON-NLS-1$ + } + + public boolean isCheckResultType() { + return this.checkResultType; + } + + public void setCheckResultType(final boolean checkResultType) { + this.checkResultType = checkResultType; + } + +}
diff --git a/org.eclipse.modisco.facet.custom.core/src/org/eclipse/modisco/facet/custom/core/internal/query/SwitchQueryImplementationFactory.java b/org.eclipse.modisco.facet.custom.core/src/org/eclipse/modisco/facet/custom/core/internal/query/SwitchQueryImplementationFactory.java new file mode 100644 index 0000000..91abbef --- /dev/null +++ b/org.eclipse.modisco.facet.custom.core/src/org/eclipse/modisco/facet/custom/core/internal/query/SwitchQueryImplementationFactory.java
@@ -0,0 +1,40 @@ +/** + * Copyright (c) 2013 Mia-Software. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Gregoire Dupe (Mia-Software) - Bug 418885 - ETypedElementSwitchQuery implemented using a deprecated query evaluator extension point + */ +package org.eclipse.modisco.facet.custom.core.internal.query; + +import org.eclipse.emf.ecore.EClass; +import org.eclipse.modisco.facet.custom.metamodel.v0_2_0.custom.CustomPackage; +import org.eclipse.modisco.facet.custom.metamodel.v0_2_0.custom.ETypedElementSwitchQuery; +import org.eclipse.modisco.facet.efacet.core.IDerivedTypedElementManager; +import org.eclipse.modisco.facet.efacet.core.exception.DerivedTypedElementException; +import org.eclipse.modisco.facet.efacet.core.query.IQueryImplementation; +import org.eclipse.modisco.facet.efacet.core.query.IQueryImplementationFactory; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.extensible.Query; +import org.osgi.framework.Bundle; + +public class SwitchQueryImplementationFactory implements + IQueryImplementationFactory { + + public IQueryImplementation create(final Query query, final Bundle bundle, + final IDerivedTypedElementManager manager) + throws DerivedTypedElementException { + if (!(query instanceof ETypedElementSwitchQuery)) { + throw new IllegalArgumentException( + "The given DerivedTypedElement does not have a ETypedElementSwitchQuery"); //$NON-NLS-1$ + } + final ETypedElementSwitchQuery switchQuery = (ETypedElementSwitchQuery) query; + return new SwitchQueryImplementation(switchQuery); + } + + public EClass getManagedQueryType() { + return CustomPackage.eINSTANCE.getETypedElementSwitchQuery(); + } +}
diff --git a/org.eclipse.modisco.facet.custom.metamodel/META-INF/MANIFEST.MF b/org.eclipse.modisco.facet.custom.metamodel/META-INF/MANIFEST.MF index cf5f98a..469ae0e 100644 --- a/org.eclipse.modisco.facet.custom.metamodel/META-INF/MANIFEST.MF +++ b/org.eclipse.modisco.facet.custom.metamodel/META-INF/MANIFEST.MF
@@ -7,21 +7,21 @@ Bundle-Vendor: %providerName Bundle-RequiredExecutionEnvironment: JavaSE-1.8 Export-Package: - org.eclipse.emf.facet.custom.metamodel.custompt, - org.eclipse.emf.facet.custom.metamodel.v0_2_0.custom, - org.eclipse.emf.facet.custom.metamodel.v0_2_0.custom.impl;x-friends:="org.eclipse.emf.facet.aggregate.metamodel,org.eclipse.emf.facet.aggregate.metamodel.notgenerated", - org.eclipse.emf.facet.custom.metamodel.v0_2_0.custom.util;x-friends:="org.eclipse.emf.facet.custom.metamodel.edit", - org.eclipse.emf.facet.custom.metamodel.v0_2_0.customizationcatalog;x-friends:="org.eclipse.emf.facet.custom.core", - org.eclipse.emf.facet.custom.metamodel.v0_2_0.customizationcatalog.impl;x-internal:=true, - org.eclipse.emf.facet.custom.metamodel.v0_2_0.customizationcatalog.util;x-internal:=true, - org.eclipse.emf.facet.custom.metamodel.v0_2_0.custompt;x-internal:=true, - org.eclipse.emf.facet.custom.metamodel.v0_2_0.custompt.impl;x-internal:=true, - org.eclipse.emf.facet.custom.metamodel.v0_2_0.internal.treeproxy;x-friends:="org.eclipse.emf.facet.custom.ui,org.eclipse.emf.facet.custom.tests", - org.eclipse.emf.facet.custom.metamodel.v0_2_0.internal.treeproxy.impl;x-internal:=true, - org.eclipse.emf.facet.custom.metamodel.v0_2_0.internal.treeproxy.util;x-internal:=true, - org.eclipse.emf.facet.custom.metamodel.v0_3_0.query, - org.eclipse.emf.facet.custom.metamodel.v0_3_0.query.impl;x-internal:=true, - org.eclipse.emf.facet.custom.metamodel.v0_3_0.query.util;x-internal:=true + org.eclipse.modisco.facet.custom.metamodel.custompt, + org.eclipse.modisco.facet.custom.metamodel.v0_2_0.custom, + org.eclipse.modisco.facet.custom.metamodel.v0_2_0.custom.impl;x-friends:="org.eclipse.emf.facet.aggregate.metamodel,org.eclipse.emf.facet.aggregate.metamodel.notgenerated", + org.eclipse.modisco.facet.custom.metamodel.v0_2_0.custom.util;x-friends:="org.eclipse.emf.facet.custom.metamodel.edit", + org.eclipse.modisco.facet.custom.metamodel.v0_2_0.customizationcatalog;x-friends:="org.eclipse.emf.facet.custom.core", + org.eclipse.modisco.facet.custom.metamodel.v0_2_0.customizationcatalog.impl;x-internal:=true, + org.eclipse.modisco.facet.custom.metamodel.v0_2_0.customizationcatalog.util;x-internal:=true, + org.eclipse.modisco.facet.custom.metamodel.v0_2_0.custompt;x-internal:=true, + org.eclipse.modisco.facet.custom.metamodel.v0_2_0.custompt.impl;x-internal:=true, + org.eclipse.modisco.facet.custom.metamodel.v0_2_0.internal.treeproxy;x-friends:="org.eclipse.emf.facet.custom.ui,org.eclipse.emf.facet.custom.tests", + org.eclipse.modisco.facet.custom.metamodel.v0_2_0.internal.treeproxy.impl;x-internal:=true, + org.eclipse.modisco.facet.custom.metamodel.v0_2_0.internal.treeproxy.util;x-internal:=true, + org.eclipse.modisco.facet.custom.metamodel.v0_3_0.query, + org.eclipse.modisco.facet.custom.metamodel.v0_3_0.query.impl;x-internal:=true, + org.eclipse.modisco.facet.custom.metamodel.v0_3_0.query.util;x-internal:=true Require-Bundle: org.eclipse.core.runtime, org.eclipse.emf.ecore, org.eclipse.emf.facet.efacet.metamodel;visibility:=reexport,
diff --git a/org.eclipse.modisco.facet.custom.metamodel/plugin.xml b/org.eclipse.modisco.facet.custom.metamodel/plugin.xml index b96f245..5d7db15 100644 --- a/org.eclipse.modisco.facet.custom.metamodel/plugin.xml +++ b/org.eclipse.modisco.facet.custom.metamodel/plugin.xml
@@ -20,21 +20,21 @@ <extension point="org.eclipse.emf.ecore.generated_package"> <package uri="http://www.eclipse.org/emf/facet/custom/0.2.incubation/custom" - class="org.eclipse.emf.facet.custom.metamodel.v0_2_0.custom.CustomPackage" + class="org.eclipse.modisco.facet.custom.metamodel.v0_2_0.custom.CustomPackage" genModel="model/custom-0.2.0.genmodel"/> </extension> <extension point="org.eclipse.emf.ecore.generated_package"> <package uri="http://www.eclipse.org/emf/facet/custom/0.2.incubation/custom_primitive_types" - class="org.eclipse.emf.facet.custom.metamodel.v0_2_0.custompt.CustomptPackage" + class="org.eclipse.modisco.facet.custom.metamodel.v0_2_0.custompt.CustomptPackage" genModel="model/custom_primitive_types-0.2.0.genmodel"/> </extension> <extension point="org.eclipse.emf.ecore.generated_package"> <package uri="http://www.eclipse.org/emf/facet/custom/0.3.incubation/query" - class="org.eclipse.emf.facet.custom.metamodel.v0_3_0.query.QueryPackage" + class="org.eclipse.modisco.facet.custom.metamodel.v0_3_0.query.QueryPackage" genModel="model/query-0.3.0.genmodel"/> </extension>
diff --git a/org.eclipse.modisco.facet.custom.metamodel/src/org/eclipse/emf/facet/custom/metamodel/custompt/IColor.java b/org.eclipse.modisco.facet.custom.metamodel/src/org/eclipse/emf/facet/custom/metamodel/custompt/IColor.java deleted file mode 100644 index 6029b9e..0000000 --- a/org.eclipse.modisco.facet.custom.metamodel/src/org/eclipse/emf/facet/custom/metamodel/custompt/IColor.java +++ /dev/null
@@ -1,23 +0,0 @@ -/** - * Copyright (c) 2012 Mia-Software. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Gregoire Dupe (Mia-Software) - Bug 361794 - [Restructuring] New customization meta-model - */ -package org.eclipse.emf.facet.custom.metamodel.custompt; - -import java.io.Serializable; - -/** - * @noextend This interface is not intended to be extended by clients. - */ -public interface IColor extends Serializable { - int getRed(); - int getGreen(); - int getBlue(); -}
diff --git a/org.eclipse.modisco.facet.custom.metamodel/src/org/eclipse/emf/facet/custom/metamodel/custompt/IImage.java b/org.eclipse.modisco.facet.custom.metamodel/src/org/eclipse/emf/facet/custom/metamodel/custompt/IImage.java deleted file mode 100644 index c648830..0000000 --- a/org.eclipse.modisco.facet.custom.metamodel/src/org/eclipse/emf/facet/custom/metamodel/custompt/IImage.java +++ /dev/null
@@ -1,22 +0,0 @@ -/** - * Copyright (c) 2012 Mia-Software. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Gregoire Dupe (Mia-Software) - Bug 361794 - [Restructuring] New customization meta-model - */ -package org.eclipse.emf.facet.custom.metamodel.custompt; - -import java.io.InputStream; -import java.io.Serializable; - -/** - * @noextend This interface is not intended to be extended by clients. - */ -public interface IImage extends Serializable { - InputStream getInputStream(); -}
diff --git a/org.eclipse.modisco.facet.custom.metamodel/src/org/eclipse/emf/facet/custom/metamodel/v0_2_0/custom/CustomFactory.java b/org.eclipse.modisco.facet.custom.metamodel/src/org/eclipse/emf/facet/custom/metamodel/v0_2_0/custom/CustomFactory.java deleted file mode 100644 index b6fd21b..0000000 --- a/org.eclipse.modisco.facet.custom.metamodel/src/org/eclipse/emf/facet/custom/metamodel/v0_2_0/custom/CustomFactory.java +++ /dev/null
@@ -1,87 +0,0 @@ -/** - * Copyright (c) 2011 Mia-Software. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Gregoire Dupe (Mia-Software) - Bug 361794 - [Restructuring] New customization meta-model - * Gregoire Dupe (Mia-Software) - Bug 369987 - [Restructuring][Table] Switch to the new customization and facet framework - * Gregoire Dupe (Mia-Software) - Bug 373078 - API Cleaning - */ -package org.eclipse.emf.facet.custom.metamodel.v0_2_0.custom; - -import org.eclipse.emf.ecore.EFactory; - -/** - * <!-- begin-user-doc --> The <b>Factory</b> for the model. It provides a - * create method for each non-abstract class of the model. <!-- end-user-doc --> - * @see org.eclipse.emf.facet.custom.metamodel.v0_2_0.custom.CustomPackage - * @generated - */ -public interface CustomFactory extends EFactory { - /** - * The singleton instance of the factory. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - CustomFactory eINSTANCE = org.eclipse.emf.facet.custom.metamodel.v0_2_0.custom.impl.CustomFactoryImpl.init(); - - /** - * Returns a new object of class '<em>Customization</em>'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return a new object of class '<em>Customization</em>'. - * @generated - */ - Customization createCustomization(); - - /** - * Returns a new object of class '<em>EClass Customization</em>'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return a new object of class '<em>EClass Customization</em>'. - * @generated - */ - EClassCustomization createEClassCustomization(); - - /** - * Returns a new object of class '<em>Facet Customization</em>'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return a new object of class '<em>Facet Customization</em>'. - * @generated - */ - FacetCustomization createFacetCustomization(); - - /** - * Returns a new object of class '<em>ETyped Element Switch Query</em>'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return a new object of class '<em>ETyped Element Switch Query</em>'. - * @generated - */ - ETypedElementSwitchQuery createETypedElementSwitchQuery(); - - /** - * Returns a new object of class '<em>ETyped Element Case</em>'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return a new object of class '<em>ETyped Element Case</em>'. - * @generated - */ - ETypedElementCase createETypedElementCase(); - - /** - * Returns the package supported by this factory. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the package supported by this factory. - * @generated - */ - CustomPackage getCustomPackage(); - -} //CustomFactory
diff --git a/org.eclipse.modisco.facet.custom.metamodel/src/org/eclipse/emf/facet/custom/metamodel/v0_2_0/custom/CustomPackage.java b/org.eclipse.modisco.facet.custom.metamodel/src/org/eclipse/emf/facet/custom/metamodel/v0_2_0/custom/CustomPackage.java deleted file mode 100644 index de0bb81..0000000 --- a/org.eclipse.modisco.facet.custom.metamodel/src/org/eclipse/emf/facet/custom/metamodel/v0_2_0/custom/CustomPackage.java +++ /dev/null
@@ -1,793 +0,0 @@ -/** - * Copyright (c) 2011 Mia-Software. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Gregoire Dupe (Mia-Software) - Bug 361794 - [Restructuring] New customization meta-model - * Gregoire Dupe (Mia-Software) - Bug 369987 - [Restructuring][Table] Switch to the new customization and facet framework - * Gregoire Dupe (Mia-Software) - Bug 373078 - API Cleaning - * Gregoire Dupe (Mia-Software) - Bug 376576 - [EFacet] Change the multiplicity of Facet::extendedFacet - */ -package org.eclipse.emf.facet.custom.metamodel.v0_2_0.custom; - -import org.eclipse.emf.ecore.EAttribute; -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.ecore.EPackage; -import org.eclipse.emf.ecore.EReference; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.EFacetPackage; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.extensible.ExtensiblePackage; - -/** - * <!-- begin-user-doc --> The <b>Package</b> for the model. It contains - * accessors for the meta objects to represent - * <ul> - * <li>each class,</li> - * <li>each feature of each class,</li> - * <li>each enum,</li> - * <li>and each data type</li> - * </ul> - * <!-- end-user-doc --> - * @see org.eclipse.emf.facet.custom.metamodel.v0_2_0.custom.CustomFactory - * @model kind="package" - * @generated - */ -public interface CustomPackage extends EPackage { - /** - * The package name. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - String eNAME = "custom"; - - /** - * The package namespace URI. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - String eNS_URI = "http://www.eclipse.org/emf/facet/custom/0.2.incubation/custom"; - - /** - * The package namespace name. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - String eNS_PREFIX = "custom"; - - /** - * The singleton instance of the package. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - CustomPackage eINSTANCE = org.eclipse.emf.facet.custom.metamodel.v0_2_0.custom.impl.CustomPackageImpl.init(); - - /** - * The meta object id for the '{@link org.eclipse.emf.facet.custom.metamodel.v0_2_0.custom.impl.CustomizationImpl <em>Customization</em>}' class. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see org.eclipse.emf.facet.custom.metamodel.v0_2_0.custom.impl.CustomizationImpl - * @see org.eclipse.emf.facet.custom.metamodel.v0_2_0.custom.impl.CustomPackageImpl#getCustomization() - * @generated - */ - int CUSTOMIZATION = 0; - - /** - * The feature id for the '<em><b>EAnnotations</b></em>' containment reference list. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int CUSTOMIZATION__EANNOTATIONS = EFacetPackage.FACET_SET__EANNOTATIONS; - - /** - * The feature id for the '<em><b>Name</b></em>' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int CUSTOMIZATION__NAME = EFacetPackage.FACET_SET__NAME; - - /** - * The feature id for the '<em><b>Ns URI</b></em>' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int CUSTOMIZATION__NS_URI = EFacetPackage.FACET_SET__NS_URI; - - /** - * The feature id for the '<em><b>Ns Prefix</b></em>' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int CUSTOMIZATION__NS_PREFIX = EFacetPackage.FACET_SET__NS_PREFIX; - - /** - * The feature id for the '<em><b>EFactory Instance</b></em>' reference. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int CUSTOMIZATION__EFACTORY_INSTANCE = EFacetPackage.FACET_SET__EFACTORY_INSTANCE; - - /** - * The feature id for the '<em><b>EClassifiers</b></em>' containment reference list. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int CUSTOMIZATION__ECLASSIFIERS = EFacetPackage.FACET_SET__ECLASSIFIERS; - - /** - * The feature id for the '<em><b>ESubpackages</b></em>' containment reference list. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int CUSTOMIZATION__ESUBPACKAGES = EFacetPackage.FACET_SET__ESUBPACKAGES; - - /** - * The feature id for the '<em><b>ESuper Package</b></em>' container reference. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int CUSTOMIZATION__ESUPER_PACKAGE = EFacetPackage.FACET_SET__ESUPER_PACKAGE; - - /** - * The feature id for the '<em><b>Documentation</b></em>' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int CUSTOMIZATION__DOCUMENTATION = EFacetPackage.FACET_SET__DOCUMENTATION; - - /** - * The feature id for the '<em><b>Categories</b></em>' containment reference list. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int CUSTOMIZATION__CATEGORIES = EFacetPackage.FACET_SET__CATEGORIES; - - /** - * The feature id for the '<em><b>Must Be Loaded By Default</b></em>' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int CUSTOMIZATION__MUST_BE_LOADED_BY_DEFAULT = EFacetPackage.FACET_SET_FEATURE_COUNT + 0; - - /** - * The number of structural features of the '<em>Customization</em>' class. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int CUSTOMIZATION_FEATURE_COUNT = EFacetPackage.FACET_SET_FEATURE_COUNT + 1; - - /** - * The meta object id for the '{@link org.eclipse.emf.facet.custom.metamodel.v0_2_0.custom.impl.EClassCustomizationImpl <em>EClass Customization</em>}' class. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see org.eclipse.emf.facet.custom.metamodel.v0_2_0.custom.impl.EClassCustomizationImpl - * @see org.eclipse.emf.facet.custom.metamodel.v0_2_0.custom.impl.CustomPackageImpl#getEClassCustomization() - * @generated - */ - int ECLASS_CUSTOMIZATION = 1; - - /** - * The feature id for the '<em><b>EAnnotations</b></em>' containment reference list. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int ECLASS_CUSTOMIZATION__EANNOTATIONS = EFacetPackage.FACET__EANNOTATIONS; - - /** - * The feature id for the '<em><b>Name</b></em>' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int ECLASS_CUSTOMIZATION__NAME = EFacetPackage.FACET__NAME; - - /** - * The feature id for the '<em><b>Instance Class Name</b></em>' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int ECLASS_CUSTOMIZATION__INSTANCE_CLASS_NAME = EFacetPackage.FACET__INSTANCE_CLASS_NAME; - - /** - * The feature id for the '<em><b>Instance Class</b></em>' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int ECLASS_CUSTOMIZATION__INSTANCE_CLASS = EFacetPackage.FACET__INSTANCE_CLASS; - - /** - * The feature id for the '<em><b>Default Value</b></em>' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int ECLASS_CUSTOMIZATION__DEFAULT_VALUE = EFacetPackage.FACET__DEFAULT_VALUE; - - /** - * The feature id for the '<em><b>Instance Type Name</b></em>' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int ECLASS_CUSTOMIZATION__INSTANCE_TYPE_NAME = EFacetPackage.FACET__INSTANCE_TYPE_NAME; - - /** - * The feature id for the '<em><b>EPackage</b></em>' container reference. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int ECLASS_CUSTOMIZATION__EPACKAGE = EFacetPackage.FACET__EPACKAGE; - - /** - * The feature id for the '<em><b>EType Parameters</b></em>' containment reference list. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int ECLASS_CUSTOMIZATION__ETYPE_PARAMETERS = EFacetPackage.FACET__ETYPE_PARAMETERS; - - /** - * The feature id for the '<em><b>Documentation</b></em>' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int ECLASS_CUSTOMIZATION__DOCUMENTATION = EFacetPackage.FACET__DOCUMENTATION; - - /** - * The feature id for the '<em><b>Extended Metaclass</b></em>' reference. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int ECLASS_CUSTOMIZATION__EXTENDED_METACLASS = EFacetPackage.FACET__EXTENDED_METACLASS; - - /** - * The feature id for the '<em><b>Facet Elements</b></em>' containment reference list. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int ECLASS_CUSTOMIZATION__FACET_ELEMENTS = EFacetPackage.FACET__FACET_ELEMENTS; - - /** - * The feature id for the '<em><b>Facet Operations</b></em>' containment reference list. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int ECLASS_CUSTOMIZATION__FACET_OPERATIONS = EFacetPackage.FACET__FACET_OPERATIONS; - - /** - * The feature id for the '<em><b>Conformance Typed Element</b></em>' reference. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int ECLASS_CUSTOMIZATION__CONFORMANCE_TYPED_ELEMENT = EFacetPackage.FACET__CONFORMANCE_TYPED_ELEMENT; - - /** - * The feature id for the '<em><b>Extended Facets</b></em>' reference list. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - * @since 0.2 - */ - int ECLASS_CUSTOMIZATION__EXTENDED_FACETS = EFacetPackage.FACET__EXTENDED_FACETS; - - /** - * The number of structural features of the '<em>EClass Customization</em>' class. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int ECLASS_CUSTOMIZATION_FEATURE_COUNT = EFacetPackage.FACET_FEATURE_COUNT + 0; - - /** - * The meta object id for the '{@link org.eclipse.emf.facet.custom.metamodel.v0_2_0.custom.impl.FacetCustomizationImpl <em>Facet Customization</em>}' class. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see org.eclipse.emf.facet.custom.metamodel.v0_2_0.custom.impl.FacetCustomizationImpl - * @see org.eclipse.emf.facet.custom.metamodel.v0_2_0.custom.impl.CustomPackageImpl#getFacetCustomization() - * @generated - */ - int FACET_CUSTOMIZATION = 2; - - /** - * The feature id for the '<em><b>EAnnotations</b></em>' containment reference list. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int FACET_CUSTOMIZATION__EANNOTATIONS = EFacetPackage.FACET__EANNOTATIONS; - - /** - * The feature id for the '<em><b>Name</b></em>' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int FACET_CUSTOMIZATION__NAME = EFacetPackage.FACET__NAME; - - /** - * The feature id for the '<em><b>Instance Class Name</b></em>' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int FACET_CUSTOMIZATION__INSTANCE_CLASS_NAME = EFacetPackage.FACET__INSTANCE_CLASS_NAME; - - /** - * The feature id for the '<em><b>Instance Class</b></em>' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int FACET_CUSTOMIZATION__INSTANCE_CLASS = EFacetPackage.FACET__INSTANCE_CLASS; - - /** - * The feature id for the '<em><b>Default Value</b></em>' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int FACET_CUSTOMIZATION__DEFAULT_VALUE = EFacetPackage.FACET__DEFAULT_VALUE; - - /** - * The feature id for the '<em><b>Instance Type Name</b></em>' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int FACET_CUSTOMIZATION__INSTANCE_TYPE_NAME = EFacetPackage.FACET__INSTANCE_TYPE_NAME; - - /** - * The feature id for the '<em><b>EPackage</b></em>' container reference. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int FACET_CUSTOMIZATION__EPACKAGE = EFacetPackage.FACET__EPACKAGE; - - /** - * The feature id for the '<em><b>EType Parameters</b></em>' containment reference list. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int FACET_CUSTOMIZATION__ETYPE_PARAMETERS = EFacetPackage.FACET__ETYPE_PARAMETERS; - - /** - * The feature id for the '<em><b>Documentation</b></em>' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int FACET_CUSTOMIZATION__DOCUMENTATION = EFacetPackage.FACET__DOCUMENTATION; - - /** - * The feature id for the '<em><b>Extended Metaclass</b></em>' reference. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int FACET_CUSTOMIZATION__EXTENDED_METACLASS = EFacetPackage.FACET__EXTENDED_METACLASS; - - /** - * The feature id for the '<em><b>Facet Elements</b></em>' containment reference list. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int FACET_CUSTOMIZATION__FACET_ELEMENTS = EFacetPackage.FACET__FACET_ELEMENTS; - - /** - * The feature id for the '<em><b>Facet Operations</b></em>' containment reference list. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int FACET_CUSTOMIZATION__FACET_OPERATIONS = EFacetPackage.FACET__FACET_OPERATIONS; - - /** - * The feature id for the '<em><b>Conformance Typed Element</b></em>' reference. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int FACET_CUSTOMIZATION__CONFORMANCE_TYPED_ELEMENT = EFacetPackage.FACET__CONFORMANCE_TYPED_ELEMENT; - - /** - * The feature id for the '<em><b>Extended Facets</b></em>' reference list. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - * @since 0.2 - */ - int FACET_CUSTOMIZATION__EXTENDED_FACETS = EFacetPackage.FACET__EXTENDED_FACETS; - - /** - * The feature id for the '<em><b>Customized Facet</b></em>' reference. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int FACET_CUSTOMIZATION__CUSTOMIZED_FACET = EFacetPackage.FACET_FEATURE_COUNT + 0; - - /** - * The number of structural features of the '<em>Facet Customization</em>' class. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int FACET_CUSTOMIZATION_FEATURE_COUNT = EFacetPackage.FACET_FEATURE_COUNT + 1; - - /** - * The meta object id for the '{@link org.eclipse.emf.facet.custom.metamodel.v0_2_0.custom.impl.ETypedElementSwitchQueryImpl <em>ETyped Element Switch Query</em>}' class. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see org.eclipse.emf.facet.custom.metamodel.v0_2_0.custom.impl.ETypedElementSwitchQueryImpl - * @see org.eclipse.emf.facet.custom.metamodel.v0_2_0.custom.impl.CustomPackageImpl#getETypedElementSwitchQuery() - * @generated - */ - int ETYPED_ELEMENT_SWITCH_QUERY = 3; - - /** - * The feature id for the '<em><b>Can Have Side Effects</b></em>' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int ETYPED_ELEMENT_SWITCH_QUERY__CAN_HAVE_SIDE_EFFECTS = ExtensiblePackage.QUERY__CAN_HAVE_SIDE_EFFECTS; - - /** - * The feature id for the '<em><b>Can Be Cached</b></em>' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int ETYPED_ELEMENT_SWITCH_QUERY__CAN_BE_CACHED = ExtensiblePackage.QUERY__CAN_BE_CACHED; - - /** - * The feature id for the '<em><b>Cases</b></em>' containment reference list. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int ETYPED_ELEMENT_SWITCH_QUERY__CASES = ExtensiblePackage.QUERY_FEATURE_COUNT + 0; - - /** - * The number of structural features of the '<em>ETyped Element Switch Query</em>' class. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int ETYPED_ELEMENT_SWITCH_QUERY_FEATURE_COUNT = ExtensiblePackage.QUERY_FEATURE_COUNT + 1; - - /** - * The meta object id for the '{@link org.eclipse.emf.facet.custom.metamodel.v0_2_0.custom.impl.ETypedElementCaseImpl <em>ETyped Element Case</em>}' class. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see org.eclipse.emf.facet.custom.metamodel.v0_2_0.custom.impl.ETypedElementCaseImpl - * @see org.eclipse.emf.facet.custom.metamodel.v0_2_0.custom.impl.CustomPackageImpl#getETypedElementCase() - * @generated - */ - int ETYPED_ELEMENT_CASE = 4; - - /** - * The feature id for the '<em><b>Case</b></em>' reference. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int ETYPED_ELEMENT_CASE__CASE = 0; - - /** - * The feature id for the '<em><b>Value</b></em>' containment reference. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int ETYPED_ELEMENT_CASE__VALUE = 1; - - /** - * The number of structural features of the '<em>ETyped Element Case</em>' class. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int ETYPED_ELEMENT_CASE_FEATURE_COUNT = 2; - - - /** - * Returns the meta object for class '{@link org.eclipse.emf.facet.custom.metamodel.v0_2_0.custom.Customization <em>Customization</em>}'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the meta object for class '<em>Customization</em>'. - * @see org.eclipse.emf.facet.custom.metamodel.v0_2_0.custom.Customization - * @generated - */ - EClass getCustomization(); - - /** - * Returns the meta object for the attribute '{@link org.eclipse.emf.facet.custom.metamodel.v0_2_0.custom.Customization#isMustBeLoadedByDefault <em>Must Be Loaded By Default</em>}'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the meta object for the attribute '<em>Must Be Loaded By Default</em>'. - * @see org.eclipse.emf.facet.custom.metamodel.v0_2_0.custom.Customization#isMustBeLoadedByDefault() - * @see #getCustomization() - * @generated - */ - EAttribute getCustomization_MustBeLoadedByDefault(); - - /** - * Returns the meta object for class '{@link org.eclipse.emf.facet.custom.metamodel.v0_2_0.custom.EClassCustomization <em>EClass Customization</em>}'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the meta object for class '<em>EClass Customization</em>'. - * @see org.eclipse.emf.facet.custom.metamodel.v0_2_0.custom.EClassCustomization - * @generated - */ - EClass getEClassCustomization(); - - /** - * Returns the meta object for class '{@link org.eclipse.emf.facet.custom.metamodel.v0_2_0.custom.FacetCustomization <em>Facet Customization</em>}'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the meta object for class '<em>Facet Customization</em>'. - * @see org.eclipse.emf.facet.custom.metamodel.v0_2_0.custom.FacetCustomization - * @generated - */ - EClass getFacetCustomization(); - - /** - * Returns the meta object for the reference '{@link org.eclipse.emf.facet.custom.metamodel.v0_2_0.custom.FacetCustomization#getCustomizedFacet <em>Customized Facet</em>}'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the meta object for the reference '<em>Customized Facet</em>'. - * @see org.eclipse.emf.facet.custom.metamodel.v0_2_0.custom.FacetCustomization#getCustomizedFacet() - * @see #getFacetCustomization() - * @generated - */ - EReference getFacetCustomization_CustomizedFacet(); - - /** - * Returns the meta object for class '{@link org.eclipse.emf.facet.custom.metamodel.v0_2_0.custom.ETypedElementSwitchQuery <em>ETyped Element Switch Query</em>}'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the meta object for class '<em>ETyped Element Switch Query</em>'. - * @see org.eclipse.emf.facet.custom.metamodel.v0_2_0.custom.ETypedElementSwitchQuery - * @generated - */ - EClass getETypedElementSwitchQuery(); - - /** - * Returns the meta object for the containment reference list '{@link org.eclipse.emf.facet.custom.metamodel.v0_2_0.custom.ETypedElementSwitchQuery#getCases <em>Cases</em>}'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the meta object for the containment reference list '<em>Cases</em>'. - * @see org.eclipse.emf.facet.custom.metamodel.v0_2_0.custom.ETypedElementSwitchQuery#getCases() - * @see #getETypedElementSwitchQuery() - * @generated - */ - EReference getETypedElementSwitchQuery_Cases(); - - /** - * Returns the meta object for class '{@link org.eclipse.emf.facet.custom.metamodel.v0_2_0.custom.ETypedElementCase <em>ETyped Element Case</em>}'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the meta object for class '<em>ETyped Element Case</em>'. - * @see org.eclipse.emf.facet.custom.metamodel.v0_2_0.custom.ETypedElementCase - * @generated - */ - EClass getETypedElementCase(); - - /** - * Returns the meta object for the reference '{@link org.eclipse.emf.facet.custom.metamodel.v0_2_0.custom.ETypedElementCase#getCase <em>Case</em>}'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the meta object for the reference '<em>Case</em>'. - * @see org.eclipse.emf.facet.custom.metamodel.v0_2_0.custom.ETypedElementCase#getCase() - * @see #getETypedElementCase() - * @generated - */ - EReference getETypedElementCase_Case(); - - /** - * Returns the meta object for the containment reference '{@link org.eclipse.emf.facet.custom.metamodel.v0_2_0.custom.ETypedElementCase#getValue <em>Value</em>}'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the meta object for the containment reference '<em>Value</em>'. - * @see org.eclipse.emf.facet.custom.metamodel.v0_2_0.custom.ETypedElementCase#getValue() - * @see #getETypedElementCase() - * @generated - */ - EReference getETypedElementCase_Value(); - - /** - * Returns the factory that creates the instances of the model. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the factory that creates the instances of the model. - * @generated - */ - CustomFactory getCustomFactory(); - - /** - * <!-- begin-user-doc --> - * Defines literals for the meta objects that represent - * <ul> - * <li>each class,</li> - * <li>each feature of each class,</li> - * <li>each enum,</li> - * <li>and each data type</li> - * </ul> - * <!-- end-user-doc --> - * @generated - */ - interface Literals { - /** - * The meta object literal for the '{@link org.eclipse.emf.facet.custom.metamodel.v0_2_0.custom.impl.CustomizationImpl <em>Customization</em>}' class. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see org.eclipse.emf.facet.custom.metamodel.v0_2_0.custom.impl.CustomizationImpl - * @see org.eclipse.emf.facet.custom.metamodel.v0_2_0.custom.impl.CustomPackageImpl#getCustomization() - * @generated - */ - EClass CUSTOMIZATION = eINSTANCE.getCustomization(); - - /** - * The meta object literal for the '<em><b>Must Be Loaded By Default</b></em>' attribute feature. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - EAttribute CUSTOMIZATION__MUST_BE_LOADED_BY_DEFAULT = eINSTANCE.getCustomization_MustBeLoadedByDefault(); - - /** - * The meta object literal for the '{@link org.eclipse.emf.facet.custom.metamodel.v0_2_0.custom.impl.EClassCustomizationImpl <em>EClass Customization</em>}' class. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see org.eclipse.emf.facet.custom.metamodel.v0_2_0.custom.impl.EClassCustomizationImpl - * @see org.eclipse.emf.facet.custom.metamodel.v0_2_0.custom.impl.CustomPackageImpl#getEClassCustomization() - * @generated - */ - EClass ECLASS_CUSTOMIZATION = eINSTANCE.getEClassCustomization(); - - /** - * The meta object literal for the '{@link org.eclipse.emf.facet.custom.metamodel.v0_2_0.custom.impl.FacetCustomizationImpl <em>Facet Customization</em>}' class. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see org.eclipse.emf.facet.custom.metamodel.v0_2_0.custom.impl.FacetCustomizationImpl - * @see org.eclipse.emf.facet.custom.metamodel.v0_2_0.custom.impl.CustomPackageImpl#getFacetCustomization() - * @generated - */ - EClass FACET_CUSTOMIZATION = eINSTANCE.getFacetCustomization(); - - /** - * The meta object literal for the '<em><b>Customized Facet</b></em>' reference feature. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - EReference FACET_CUSTOMIZATION__CUSTOMIZED_FACET = eINSTANCE.getFacetCustomization_CustomizedFacet(); - - /** - * The meta object literal for the '{@link org.eclipse.emf.facet.custom.metamodel.v0_2_0.custom.impl.ETypedElementSwitchQueryImpl <em>ETyped Element Switch Query</em>}' class. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see org.eclipse.emf.facet.custom.metamodel.v0_2_0.custom.impl.ETypedElementSwitchQueryImpl - * @see org.eclipse.emf.facet.custom.metamodel.v0_2_0.custom.impl.CustomPackageImpl#getETypedElementSwitchQuery() - * @generated - */ - EClass ETYPED_ELEMENT_SWITCH_QUERY = eINSTANCE.getETypedElementSwitchQuery(); - - /** - * The meta object literal for the '<em><b>Cases</b></em>' containment reference list feature. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - EReference ETYPED_ELEMENT_SWITCH_QUERY__CASES = eINSTANCE.getETypedElementSwitchQuery_Cases(); - - /** - * The meta object literal for the '{@link org.eclipse.emf.facet.custom.metamodel.v0_2_0.custom.impl.ETypedElementCaseImpl <em>ETyped Element Case</em>}' class. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see org.eclipse.emf.facet.custom.metamodel.v0_2_0.custom.impl.ETypedElementCaseImpl - * @see org.eclipse.emf.facet.custom.metamodel.v0_2_0.custom.impl.CustomPackageImpl#getETypedElementCase() - * @generated - */ - EClass ETYPED_ELEMENT_CASE = eINSTANCE.getETypedElementCase(); - - /** - * The meta object literal for the '<em><b>Case</b></em>' reference feature. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - EReference ETYPED_ELEMENT_CASE__CASE = eINSTANCE.getETypedElementCase_Case(); - - /** - * The meta object literal for the '<em><b>Value</b></em>' containment reference feature. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - EReference ETYPED_ELEMENT_CASE__VALUE = eINSTANCE.getETypedElementCase_Value(); - - } - -} //CustomPackage
diff --git a/org.eclipse.modisco.facet.custom.metamodel/src/org/eclipse/emf/facet/custom/metamodel/v0_2_0/custom/Customization.java b/org.eclipse.modisco.facet.custom.metamodel/src/org/eclipse/emf/facet/custom/metamodel/v0_2_0/custom/Customization.java deleted file mode 100644 index 5a63055..0000000 --- a/org.eclipse.modisco.facet.custom.metamodel/src/org/eclipse/emf/facet/custom/metamodel/v0_2_0/custom/Customization.java +++ /dev/null
@@ -1,65 +0,0 @@ -/** - * Copyright (c) 2011 Mia-Software. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Gregoire Dupe (Mia-Software) - Bug 361794 - [Restructuring] New customization meta-model - * Gregoire Dupe (Mia-Software) - Bug 369987 - [Restructuring][Table] Switch to the new customization and facet framework - * Gregoire Dupe (Mia-Software) - Bug 373078 - API Cleaning - */ -package org.eclipse.emf.facet.custom.metamodel.v0_2_0.custom; - -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.FacetSet; - -/** - * <!-- begin-user-doc --> - * A representation of the model object '<em><b>Customization</b></em>'. - * <!-- end-user-doc --> - * - * <!-- begin-model-doc --> - * The customization model element is the root of a customization model. A customization is applied to only one ePackage and contains EClassCustomizations. - * <!-- end-model-doc --> - * - * <p> - * The following features are supported: - * <ul> - * <li>{@link org.eclipse.emf.facet.custom.metamodel.v0_2_0.custom.Customization#isMustBeLoadedByDefault <em>Must Be Loaded By Default</em>}</li> - * </ul> - * </p> - * - * @see org.eclipse.emf.facet.custom.metamodel.v0_2_0.custom.CustomPackage#getCustomization() - * @model - * @generated - */ -public interface Customization extends FacetSet { - /** - * Returns the value of the '<em><b>Must Be Loaded By Default</b></em>' attribute. - * The default value is <code>"false"</code>. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * <!-- begin-model-doc --> - * When Customization::mustBeloadedByDefault is true, the customization will be automatically loaded in the customizable model browsers. - * <!-- end-model-doc --> - * @return the value of the '<em>Must Be Loaded By Default</em>' attribute. - * @see #setMustBeLoadedByDefault(boolean) - * @see org.eclipse.emf.facet.custom.metamodel.v0_2_0.custom.CustomPackage#getCustomization_MustBeLoadedByDefault() - * @model default="false" required="true" - * @generated - */ - boolean isMustBeLoadedByDefault(); - - /** - * Sets the value of the '{@link org.eclipse.emf.facet.custom.metamodel.v0_2_0.custom.Customization#isMustBeLoadedByDefault <em>Must Be Loaded By Default</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @param value the new value of the '<em>Must Be Loaded By Default</em>' attribute. - * @see #isMustBeLoadedByDefault() - * @generated - */ - void setMustBeLoadedByDefault(boolean value); - -} // Customization
diff --git a/org.eclipse.modisco.facet.custom.metamodel/src/org/eclipse/emf/facet/custom/metamodel/v0_2_0/custom/EClassCustomization.java b/org.eclipse.modisco.facet.custom.metamodel/src/org/eclipse/emf/facet/custom/metamodel/v0_2_0/custom/EClassCustomization.java deleted file mode 100644 index 9c23666..0000000 --- a/org.eclipse.modisco.facet.custom.metamodel/src/org/eclipse/emf/facet/custom/metamodel/v0_2_0/custom/EClassCustomization.java +++ /dev/null
@@ -1,34 +0,0 @@ -/** - * Copyright (c) 2011 Mia-Software. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Gregoire Dupe (Mia-Software) - Bug 361794 - [Restructuring] New customization meta-model - * Gregoire Dupe (Mia-Software) - Bug 369987 - [Restructuring][Table] Switch to the new customization and facet framework - * Gregoire Dupe (Mia-Software) - Bug 373078 - API Cleaning - */ -package org.eclipse.emf.facet.custom.metamodel.v0_2_0.custom; - -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.Facet; -import org.eclipse.emf.ecore.EObject; - -/** - * <!-- begin-user-doc --> - * A representation of the model object '<em><b>EClass Customization</b></em>'. - * <!-- end-user-doc --> - * - * <!-- begin-model-doc --> - * An EClassCustomization contains the customization for an EClass. There must not exist two EClassCustomizations customizing the same EClass in the same customization. - * <!-- end-model-doc --> - * - * - * @see org.eclipse.emf.facet.custom.metamodel.v0_2_0.custom.CustomPackage#getEClassCustomization() - * @model - * @generated - */ -public interface EClassCustomization extends Facet { -} // EClassCustomization
diff --git a/org.eclipse.modisco.facet.custom.metamodel/src/org/eclipse/emf/facet/custom/metamodel/v0_2_0/custom/ETypedElementCase.java b/org.eclipse.modisco.facet.custom.metamodel/src/org/eclipse/emf/facet/custom/metamodel/v0_2_0/custom/ETypedElementCase.java deleted file mode 100644 index 1673f98..0000000 --- a/org.eclipse.modisco.facet.custom.metamodel/src/org/eclipse/emf/facet/custom/metamodel/v0_2_0/custom/ETypedElementCase.java +++ /dev/null
@@ -1,95 +0,0 @@ -/** - * Copyright (c) 2011 Mia-Software. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Gregoire Dupe (Mia-Software) - Bug 361794 - [Restructuring] New customization meta-model - * Gregoire Dupe (Mia-Software) - Bug 369987 - [Restructuring][Table] Switch to the new customization and facet framework - * Gregoire Dupe (Mia-Software) - Bug 373078 - API Cleaning - */ -package org.eclipse.emf.facet.custom.metamodel.v0_2_0.custom; - -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.ETypedElement; - -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.extensible.Query; - -/** - * <!-- begin-user-doc --> - * A representation of the model object '<em><b>ETyped Element Case</b></em>'. - * <!-- end-user-doc --> - * - * <!-- begin-model-doc --> - * Case part of the ETypedElementSwitchQuery. - * <!-- end-model-doc --> - * - * <p> - * The following features are supported: - * <ul> - * <li>{@link org.eclipse.emf.facet.custom.metamodel.v0_2_0.custom.ETypedElementCase#getCase <em>Case</em>}</li> - * <li>{@link org.eclipse.emf.facet.custom.metamodel.v0_2_0.custom.ETypedElementCase#getValue <em>Value</em>}</li> - * </ul> - * </p> - * - * @see org.eclipse.emf.facet.custom.metamodel.v0_2_0.custom.CustomPackage#getETypedElementCase() - * @model - * @generated - */ -public interface ETypedElementCase extends EObject { - /** - * Returns the value of the '<em><b>Case</b></em>' reference. - * <!-- begin-user-doc --> - * <p> - * If the meaning of the '<em>Case</em>' reference isn't clear, - * there really should be more of a description here... - * </p> - * <!-- end-user-doc --> - * @return the value of the '<em>Case</em>' reference. - * @see #setCase(ETypedElement) - * @see org.eclipse.emf.facet.custom.metamodel.v0_2_0.custom.CustomPackage#getETypedElementCase_Case() - * @model required="true" - * @generated - */ - ETypedElement getCase(); - - /** - * Sets the value of the '{@link org.eclipse.emf.facet.custom.metamodel.v0_2_0.custom.ETypedElementCase#getCase <em>Case</em>}' reference. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @param value the new value of the '<em>Case</em>' reference. - * @see #getCase() - * @generated - */ - void setCase(ETypedElement value); - - /** - * Returns the value of the '<em><b>Value</b></em>' containment reference. - * <!-- begin-user-doc --> - * <p> - * If the meaning of the '<em>Value</em>' containment reference isn't clear, - * there really should be more of a description here... - * </p> - * <!-- end-user-doc --> - * @return the value of the '<em>Value</em>' containment reference. - * @see #setValue(Query) - * @see org.eclipse.emf.facet.custom.metamodel.v0_2_0.custom.CustomPackage#getETypedElementCase_Value() - * @model containment="true" - * @generated - */ - Query getValue(); - - /** - * Sets the value of the '{@link org.eclipse.emf.facet.custom.metamodel.v0_2_0.custom.ETypedElementCase#getValue <em>Value</em>}' containment reference. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @param value the new value of the '<em>Value</em>' containment reference. - * @see #getValue() - * @generated - */ - void setValue(Query value); - -} // ETypedElementCase
diff --git a/org.eclipse.modisco.facet.custom.metamodel/src/org/eclipse/emf/facet/custom/metamodel/v0_2_0/custom/ETypedElementSwitchQuery.java b/org.eclipse.modisco.facet.custom.metamodel/src/org/eclipse/emf/facet/custom/metamodel/v0_2_0/custom/ETypedElementSwitchQuery.java deleted file mode 100644 index 0649aa7..0000000 --- a/org.eclipse.modisco.facet.custom.metamodel/src/org/eclipse/emf/facet/custom/metamodel/v0_2_0/custom/ETypedElementSwitchQuery.java +++ /dev/null
@@ -1,57 +0,0 @@ -/** - * Copyright (c) 2011 Mia-Software. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Gregoire Dupe (Mia-Software) - Bug 361794 - [Restructuring] New customization meta-model - * Gregoire Dupe (Mia-Software) - Bug 369987 - [Restructuring][Table] Switch to the new customization and facet framework - * Gregoire Dupe (Mia-Software) - Bug 373078 - API Cleaning - */ -package org.eclipse.emf.facet.custom.metamodel.v0_2_0.custom; - -import org.eclipse.emf.common.util.EList; - -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.extensible.Query; - -/** - * <!-- begin-user-doc --> - * A representation of the model object '<em><b>ETyped Element Switch Query</b></em>'. - * <!-- end-user-doc --> - * - * <!-- begin-model-doc --> - * This query can return a value depending of an instance of ETypedElement. This query is dedicated to the definition of customizations. - * <!-- end-model-doc --> - * - * <p> - * The following features are supported: - * <ul> - * <li>{@link org.eclipse.emf.facet.custom.metamodel.v0_2_0.custom.ETypedElementSwitchQuery#getCases <em>Cases</em>}</li> - * </ul> - * </p> - * - * @see org.eclipse.emf.facet.custom.metamodel.v0_2_0.custom.CustomPackage#getETypedElementSwitchQuery() - * @model - * @generated - */ -public interface ETypedElementSwitchQuery extends Query { - /** - * Returns the value of the '<em><b>Cases</b></em>' containment reference list. - * The list contents are of type {@link org.eclipse.emf.facet.custom.metamodel.v0_2_0.custom.ETypedElementCase}. - * <!-- begin-user-doc --> - * <p> - * If the meaning of the '<em>Cases</em>' containment reference list isn't clear, - * there really should be more of a description here... - * </p> - * <!-- end-user-doc --> - * @return the value of the '<em>Cases</em>' containment reference list. - * @see org.eclipse.emf.facet.custom.metamodel.v0_2_0.custom.CustomPackage#getETypedElementSwitchQuery_Cases() - * @model containment="true" - * @generated - */ - EList<ETypedElementCase> getCases(); - -} // ETypedElementSwitchQuery
diff --git a/org.eclipse.modisco.facet.custom.metamodel/src/org/eclipse/emf/facet/custom/metamodel/v0_2_0/custom/FacetCustomization.java b/org.eclipse.modisco.facet.custom.metamodel/src/org/eclipse/emf/facet/custom/metamodel/v0_2_0/custom/FacetCustomization.java deleted file mode 100644 index 215dc03..0000000 --- a/org.eclipse.modisco.facet.custom.metamodel/src/org/eclipse/emf/facet/custom/metamodel/v0_2_0/custom/FacetCustomization.java +++ /dev/null
@@ -1,67 +0,0 @@ -/** - * Copyright (c) 2011 Mia-Software. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Gregoire Dupe (Mia-Software) - Bug 361794 - [Restructuring] New customization meta-model - * Gregoire Dupe (Mia-Software) - Bug 369987 - [Restructuring][Table] Switch to the new customization and facet framework - * Gregoire Dupe (Mia-Software) - Bug 373078 - API Cleaning - */ -package org.eclipse.emf.facet.custom.metamodel.v0_2_0.custom; - -import org.eclipse.emf.ecore.EObject; - -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.Facet; - -/** - * <!-- begin-user-doc --> - * A representation of the model object '<em><b>Facet Customization</b></em>'. - * <!-- end-user-doc --> - * - * <!-- begin-model-doc --> - * A FacetCustomization contains the customization for a Facet. There must not exist two FacetCustomizations customizing the same facet in the same customization. - * <!-- end-model-doc --> - * - * <p> - * The following features are supported: - * <ul> - * <li>{@link org.eclipse.emf.facet.custom.metamodel.v0_2_0.custom.FacetCustomization#getCustomizedFacet <em>Customized Facet</em>}</li> - * </ul> - * </p> - * - * @see org.eclipse.emf.facet.custom.metamodel.v0_2_0.custom.CustomPackage#getFacetCustomization() - * @model - * @generated - */ -public interface FacetCustomization extends Facet { - /** - * Returns the value of the '<em><b>Customized Facet</b></em>' reference. - * <!-- begin-user-doc --> - * <p> - * If the meaning of the '<em>Customized Facet</em>' reference isn't clear, - * there really should be more of a description here... - * </p> - * <!-- end-user-doc --> - * @return the value of the '<em>Customized Facet</em>' reference. - * @see #setCustomizedFacet(Facet) - * @see org.eclipse.emf.facet.custom.metamodel.v0_2_0.custom.CustomPackage#getFacetCustomization_CustomizedFacet() - * @model required="true" - * @generated - */ - Facet getCustomizedFacet(); - - /** - * Sets the value of the '{@link org.eclipse.emf.facet.custom.metamodel.v0_2_0.custom.FacetCustomization#getCustomizedFacet <em>Customized Facet</em>}' reference. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @param value the new value of the '<em>Customized Facet</em>' reference. - * @see #getCustomizedFacet() - * @generated - */ - void setCustomizedFacet(Facet value); - -} // FacetCustomization
diff --git a/org.eclipse.modisco.facet.custom.metamodel/src/org/eclipse/emf/facet/custom/metamodel/v0_2_0/custom/impl/CustomFactoryImpl.java b/org.eclipse.modisco.facet.custom.metamodel/src/org/eclipse/emf/facet/custom/metamodel/v0_2_0/custom/impl/CustomFactoryImpl.java deleted file mode 100644 index 5fbe48d..0000000 --- a/org.eclipse.modisco.facet.custom.metamodel/src/org/eclipse/emf/facet/custom/metamodel/v0_2_0/custom/impl/CustomFactoryImpl.java +++ /dev/null
@@ -1,150 +0,0 @@ -/** - * Copyright (c) 2011 Mia-Software. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Gregoire Dupe (Mia-Software) - Bug 361794 - [Restructuring] New customization meta-model - * Gregoire Dupe (Mia-Software) - Bug 369987 - [Restructuring][Table] Switch to the new customization and facet framework - * Gregoire Dupe (Mia-Software) - Bug 373078 - API Cleaning - */ -package org.eclipse.emf.facet.custom.metamodel.v0_2_0.custom.impl; - -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.EPackage; - -import org.eclipse.emf.ecore.impl.EFactoryImpl; - -import org.eclipse.emf.ecore.plugin.EcorePlugin; - -import org.eclipse.emf.facet.custom.metamodel.v0_2_0.custom.*; - -/** - * <!-- begin-user-doc --> - * An implementation of the model <b>Factory</b>. - * <!-- end-user-doc --> - * @generated - */ -public class CustomFactoryImpl extends EFactoryImpl implements CustomFactory { - /** - * Creates the default factory implementation. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public static CustomFactory init() { - try { - CustomFactory theCustomFactory = (CustomFactory)EPackage.Registry.INSTANCE.getEFactory("http://www.eclipse.org/emf/facet/custom/0.2.incubation/custom"); - if (theCustomFactory != null) { - return theCustomFactory; - } - } - catch (Exception exception) { - EcorePlugin.INSTANCE.log(exception); - } - return new CustomFactoryImpl(); - } - - /** - * Creates an instance of the factory. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public CustomFactoryImpl() { - super(); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public EObject create(EClass eClass) { - switch (eClass.getClassifierID()) { - case CustomPackage.CUSTOMIZATION: return createCustomization(); - case CustomPackage.ECLASS_CUSTOMIZATION: return createEClassCustomization(); - case CustomPackage.FACET_CUSTOMIZATION: return createFacetCustomization(); - case CustomPackage.ETYPED_ELEMENT_SWITCH_QUERY: return createETypedElementSwitchQuery(); - case CustomPackage.ETYPED_ELEMENT_CASE: return createETypedElementCase(); - default: - throw new IllegalArgumentException("The class '" + eClass.getName() + "' is not a valid classifier"); - } - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public Customization createCustomization() { - CustomizationImpl customization = new CustomizationImpl(); - return customization; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EClassCustomization createEClassCustomization() { - EClassCustomizationImpl eClassCustomization = new EClassCustomizationImpl(); - return eClassCustomization; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public FacetCustomization createFacetCustomization() { - FacetCustomizationImpl facetCustomization = new FacetCustomizationImpl(); - return facetCustomization; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public ETypedElementSwitchQuery createETypedElementSwitchQuery() { - ETypedElementSwitchQueryImpl eTypedElementSwitchQuery = new ETypedElementSwitchQueryImpl(); - return eTypedElementSwitchQuery; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public ETypedElementCase createETypedElementCase() { - ETypedElementCaseImpl eTypedElementCase = new ETypedElementCaseImpl(); - return eTypedElementCase; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public CustomPackage getCustomPackage() { - return (CustomPackage)getEPackage(); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @deprecated - * @generated - */ - @Deprecated - public static CustomPackage getPackage() { - return CustomPackage.eINSTANCE; - } - -} //CustomFactoryImpl
diff --git a/org.eclipse.modisco.facet.custom.metamodel/src/org/eclipse/emf/facet/custom/metamodel/v0_2_0/custom/impl/CustomPackageImpl.java b/org.eclipse.modisco.facet.custom.metamodel/src/org/eclipse/emf/facet/custom/metamodel/v0_2_0/custom/impl/CustomPackageImpl.java deleted file mode 100644 index 3f70042..0000000 --- a/org.eclipse.modisco.facet.custom.metamodel/src/org/eclipse/emf/facet/custom/metamodel/v0_2_0/custom/impl/CustomPackageImpl.java +++ /dev/null
@@ -1,332 +0,0 @@ -/** - * Copyright (c) 2011 Mia-Software. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Gregoire Dupe (Mia-Software) - Bug 361794 - [Restructuring] New customization meta-model - * Gregoire Dupe (Mia-Software) - Bug 369987 - [Restructuring][Table] Switch to the new customization and facet framework - * Gregoire Dupe (Mia-Software) - Bug 373078 - API Cleaning - */ -package org.eclipse.emf.facet.custom.metamodel.v0_2_0.custom.impl; - -import org.eclipse.emf.ecore.EAttribute; -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.ecore.EPackage; -import org.eclipse.emf.ecore.EReference; - -import org.eclipse.emf.ecore.impl.EPackageImpl; - -import org.eclipse.emf.facet.custom.metamodel.v0_2_0.custom.CustomFactory; -import org.eclipse.emf.facet.custom.metamodel.v0_2_0.custom.CustomPackage; -import org.eclipse.emf.facet.custom.metamodel.v0_2_0.custom.Customization; -import org.eclipse.emf.facet.custom.metamodel.v0_2_0.custom.EClassCustomization; -import org.eclipse.emf.facet.custom.metamodel.v0_2_0.custom.ETypedElementCase; -import org.eclipse.emf.facet.custom.metamodel.v0_2_0.custom.ETypedElementSwitchQuery; -import org.eclipse.emf.facet.custom.metamodel.v0_2_0.custom.FacetCustomization; - -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.EFacetPackage; - -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.extensible.ExtensiblePackage; - -/** - * <!-- begin-user-doc --> - * An implementation of the model <b>Package</b>. - * <!-- end-user-doc --> - * @generated - */ -public class CustomPackageImpl extends EPackageImpl implements CustomPackage { - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - private EClass customizationEClass = null; - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - private EClass eClassCustomizationEClass = null; - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - private EClass facetCustomizationEClass = null; - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - private EClass eTypedElementSwitchQueryEClass = null; - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - private EClass eTypedElementCaseEClass = null; - - /** - * Creates an instance of the model <b>Package</b>, registered with - * {@link org.eclipse.emf.ecore.EPackage.Registry EPackage.Registry} by the package - * package URI value. - * <p>Note: the correct way to create the package is via the static - * factory method {@link #init init()}, which also performs - * initialization of the package, or returns the registered package, - * if one already exists. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see org.eclipse.emf.ecore.EPackage.Registry - * @see org.eclipse.emf.facet.custom.metamodel.v0_2_0.custom.CustomPackage#eNS_URI - * @see #init() - * @generated - */ - private CustomPackageImpl() { - super(eNS_URI, CustomFactory.eINSTANCE); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - private static boolean isInited = false; - - /** - * Creates, registers, and initializes the <b>Package</b> for this model, and for any others upon which it depends. - * - * <p>This method is used to initialize {@link CustomPackage#eINSTANCE} when that field is accessed. - * Clients should not invoke it directly. Instead, they should simply access that field to obtain the package. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #eNS_URI - * @see #createPackageContents() - * @see #initializePackageContents() - * @generated - */ - public static CustomPackage init() { - if (isInited) return (CustomPackage)EPackage.Registry.INSTANCE.getEPackage(CustomPackage.eNS_URI); - - // Obtain or create and register package - CustomPackageImpl theCustomPackage = (CustomPackageImpl)(EPackage.Registry.INSTANCE.get(eNS_URI) instanceof CustomPackageImpl ? EPackage.Registry.INSTANCE.get(eNS_URI) : new CustomPackageImpl()); - - isInited = true; - - // Initialize simple dependencies - EFacetPackage.eINSTANCE.eClass(); - - // Create package meta-data objects - theCustomPackage.createPackageContents(); - - // Initialize created meta-data - theCustomPackage.initializePackageContents(); - - // Mark meta-data to indicate it can't be changed - theCustomPackage.freeze(); - - - // Update the registry and return the package - EPackage.Registry.INSTANCE.put(CustomPackage.eNS_URI, theCustomPackage); - return theCustomPackage; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EClass getCustomization() { - return customizationEClass; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EAttribute getCustomization_MustBeLoadedByDefault() { - return (EAttribute)customizationEClass.getEStructuralFeatures().get(0); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EClass getEClassCustomization() { - return eClassCustomizationEClass; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EClass getFacetCustomization() { - return facetCustomizationEClass; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EReference getFacetCustomization_CustomizedFacet() { - return (EReference)facetCustomizationEClass.getEStructuralFeatures().get(0); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EClass getETypedElementSwitchQuery() { - return eTypedElementSwitchQueryEClass; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EReference getETypedElementSwitchQuery_Cases() { - return (EReference)eTypedElementSwitchQueryEClass.getEStructuralFeatures().get(0); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EClass getETypedElementCase() { - return eTypedElementCaseEClass; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EReference getETypedElementCase_Case() { - return (EReference)eTypedElementCaseEClass.getEStructuralFeatures().get(0); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EReference getETypedElementCase_Value() { - return (EReference)eTypedElementCaseEClass.getEStructuralFeatures().get(1); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public CustomFactory getCustomFactory() { - return (CustomFactory)getEFactoryInstance(); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - private boolean isCreated = false; - - /** - * Creates the meta-model objects for the package. This method is - * guarded to have no affect on any invocation but its first. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public void createPackageContents() { - if (isCreated) return; - isCreated = true; - - // Create classes and their features - customizationEClass = createEClass(CUSTOMIZATION); - createEAttribute(customizationEClass, CUSTOMIZATION__MUST_BE_LOADED_BY_DEFAULT); - - eClassCustomizationEClass = createEClass(ECLASS_CUSTOMIZATION); - - facetCustomizationEClass = createEClass(FACET_CUSTOMIZATION); - createEReference(facetCustomizationEClass, FACET_CUSTOMIZATION__CUSTOMIZED_FACET); - - eTypedElementSwitchQueryEClass = createEClass(ETYPED_ELEMENT_SWITCH_QUERY); - createEReference(eTypedElementSwitchQueryEClass, ETYPED_ELEMENT_SWITCH_QUERY__CASES); - - eTypedElementCaseEClass = createEClass(ETYPED_ELEMENT_CASE); - createEReference(eTypedElementCaseEClass, ETYPED_ELEMENT_CASE__CASE); - createEReference(eTypedElementCaseEClass, ETYPED_ELEMENT_CASE__VALUE); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - private boolean isInitialized = false; - - /** - * Complete the initialization of the package and its meta-model. This - * method is guarded to have no affect on any invocation but its first. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public void initializePackageContents() { - if (isInitialized) return; - isInitialized = true; - - // Initialize package - setName(eNAME); - setNsPrefix(eNS_PREFIX); - setNsURI(eNS_URI); - - // Obtain other dependent packages - EFacetPackage theEFacetPackage = (EFacetPackage)EPackage.Registry.INSTANCE.getEPackage(EFacetPackage.eNS_URI); - ExtensiblePackage theExtensiblePackage = (ExtensiblePackage)EPackage.Registry.INSTANCE.getEPackage(ExtensiblePackage.eNS_URI); - - // Create type parameters - - // Set bounds for type parameters - - // Add supertypes to classes - customizationEClass.getESuperTypes().add(theEFacetPackage.getFacetSet()); - eClassCustomizationEClass.getESuperTypes().add(theEFacetPackage.getFacet()); - facetCustomizationEClass.getESuperTypes().add(theEFacetPackage.getFacet()); - eTypedElementSwitchQueryEClass.getESuperTypes().add(theExtensiblePackage.getQuery()); - - // Initialize classes and features; add operations and parameters - initEClass(customizationEClass, Customization.class, "Customization", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); - initEAttribute(getCustomization_MustBeLoadedByDefault(), ecorePackage.getEBoolean(), "mustBeLoadedByDefault", "false", 1, 1, Customization.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); - - initEClass(eClassCustomizationEClass, EClassCustomization.class, "EClassCustomization", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); - - initEClass(facetCustomizationEClass, FacetCustomization.class, "FacetCustomization", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); - initEReference(getFacetCustomization_CustomizedFacet(), theEFacetPackage.getFacet(), null, "customizedFacet", null, 1, 1, FacetCustomization.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); - - initEClass(eTypedElementSwitchQueryEClass, ETypedElementSwitchQuery.class, "ETypedElementSwitchQuery", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); - initEReference(getETypedElementSwitchQuery_Cases(), this.getETypedElementCase(), null, "cases", null, 0, -1, ETypedElementSwitchQuery.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); - - initEClass(eTypedElementCaseEClass, ETypedElementCase.class, "ETypedElementCase", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); - initEReference(getETypedElementCase_Case(), ecorePackage.getETypedElement(), null, "case", null, 1, 1, ETypedElementCase.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); - initEReference(getETypedElementCase_Value(), theExtensiblePackage.getQuery(), null, "value", null, 0, 1, ETypedElementCase.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); - - // Create resource - createResource(eNS_URI); - } - -} //CustomPackageImpl
diff --git a/org.eclipse.modisco.facet.custom.metamodel/src/org/eclipse/emf/facet/custom/metamodel/v0_2_0/custom/impl/CustomizationImpl.java b/org.eclipse.modisco.facet.custom.metamodel/src/org/eclipse/emf/facet/custom/metamodel/v0_2_0/custom/impl/CustomizationImpl.java deleted file mode 100644 index e29bc2a..0000000 --- a/org.eclipse.modisco.facet.custom.metamodel/src/org/eclipse/emf/facet/custom/metamodel/v0_2_0/custom/impl/CustomizationImpl.java +++ /dev/null
@@ -1,175 +0,0 @@ -/** - * Copyright (c) 2011 Mia-Software. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Gregoire Dupe (Mia-Software) - Bug 361794 - [Restructuring] New customization meta-model - * Gregoire Dupe (Mia-Software) - Bug 369987 - [Restructuring][Table] Switch to the new customization and facet framework - * Gregoire Dupe (Mia-Software) - Bug 373078 - API Cleaning - */ -package org.eclipse.emf.facet.custom.metamodel.v0_2_0.custom.impl; - -import org.eclipse.emf.common.notify.Notification; - -import org.eclipse.emf.ecore.EClass; - -import org.eclipse.emf.ecore.impl.ENotificationImpl; - -import org.eclipse.emf.facet.custom.metamodel.v0_2_0.custom.CustomPackage; -import org.eclipse.emf.facet.custom.metamodel.v0_2_0.custom.Customization; - -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.impl.FacetSetImpl; - -/** - * <!-- begin-user-doc --> - * An implementation of the model object '<em><b>Customization</b></em>'. - * <!-- end-user-doc --> - * <p> - * The following features are implemented: - * <ul> - * <li>{@link org.eclipse.emf.facet.custom.metamodel.v0_2_0.custom.impl.CustomizationImpl#isMustBeLoadedByDefault <em>Must Be Loaded By Default</em>}</li> - * </ul> - * </p> - * - * @generated - */ -public class CustomizationImpl extends FacetSetImpl implements Customization { - /** - * The default value of the '{@link #isMustBeLoadedByDefault() <em>Must Be Loaded By Default</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #isMustBeLoadedByDefault() - * @generated - * @ordered - */ - protected static final boolean MUST_BE_LOADED_BY_DEFAULT_EDEFAULT = false; - - /** - * The cached value of the '{@link #isMustBeLoadedByDefault() <em>Must Be Loaded By Default</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #isMustBeLoadedByDefault() - * @generated - * @ordered - */ - protected boolean mustBeLoadedByDefault = MUST_BE_LOADED_BY_DEFAULT_EDEFAULT; - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected CustomizationImpl() { - super(); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - protected EClass eStaticClass() { - return CustomPackage.Literals.CUSTOMIZATION; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public boolean isMustBeLoadedByDefault() { - return mustBeLoadedByDefault; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public void setMustBeLoadedByDefault(boolean newMustBeLoadedByDefault) { - boolean oldMustBeLoadedByDefault = mustBeLoadedByDefault; - mustBeLoadedByDefault = newMustBeLoadedByDefault; - if (eNotificationRequired()) - eNotify(new ENotificationImpl(this, Notification.SET, CustomPackage.CUSTOMIZATION__MUST_BE_LOADED_BY_DEFAULT, oldMustBeLoadedByDefault, mustBeLoadedByDefault)); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public Object eGet(int featureID, boolean resolve, boolean coreType) { - switch (featureID) { - case CustomPackage.CUSTOMIZATION__MUST_BE_LOADED_BY_DEFAULT: - return isMustBeLoadedByDefault(); - } - return super.eGet(featureID, resolve, coreType); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public void eSet(int featureID, Object newValue) { - switch (featureID) { - case CustomPackage.CUSTOMIZATION__MUST_BE_LOADED_BY_DEFAULT: - setMustBeLoadedByDefault((Boolean)newValue); - return; - } - super.eSet(featureID, newValue); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public void eUnset(int featureID) { - switch (featureID) { - case CustomPackage.CUSTOMIZATION__MUST_BE_LOADED_BY_DEFAULT: - setMustBeLoadedByDefault(MUST_BE_LOADED_BY_DEFAULT_EDEFAULT); - return; - } - super.eUnset(featureID); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public boolean eIsSet(int featureID) { - switch (featureID) { - case CustomPackage.CUSTOMIZATION__MUST_BE_LOADED_BY_DEFAULT: - return mustBeLoadedByDefault != MUST_BE_LOADED_BY_DEFAULT_EDEFAULT; - } - return super.eIsSet(featureID); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public String toString() { - if (eIsProxy()) return super.toString(); - - StringBuffer result = new StringBuffer(super.toString()); - result.append(" (mustBeLoadedByDefault: "); - result.append(mustBeLoadedByDefault); - result.append(')'); - return result.toString(); - } - -} //CustomizationImpl
diff --git a/org.eclipse.modisco.facet.custom.metamodel/src/org/eclipse/emf/facet/custom/metamodel/v0_2_0/custom/impl/EClassCustomizationImpl.java b/org.eclipse.modisco.facet.custom.metamodel/src/org/eclipse/emf/facet/custom/metamodel/v0_2_0/custom/impl/EClassCustomizationImpl.java deleted file mode 100644 index d47b917..0000000 --- a/org.eclipse.modisco.facet.custom.metamodel/src/org/eclipse/emf/facet/custom/metamodel/v0_2_0/custom/impl/EClassCustomizationImpl.java +++ /dev/null
@@ -1,53 +0,0 @@ -/** - * Copyright (c) 2011 Mia-Software. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Gregoire Dupe (Mia-Software) - Bug 361794 - [Restructuring] New customization meta-model - * Gregoire Dupe (Mia-Software) - Bug 369987 - [Restructuring][Table] Switch to the new customization and facet framework - * Gregoire Dupe (Mia-Software) - Bug 373078 - API Cleaning - */ -package org.eclipse.emf.facet.custom.metamodel.v0_2_0.custom.impl; - -import org.eclipse.emf.ecore.EClass; - -import org.eclipse.emf.ecore.impl.EObjectImpl; - -import org.eclipse.emf.facet.custom.metamodel.v0_2_0.custom.CustomPackage; -import org.eclipse.emf.facet.custom.metamodel.v0_2_0.custom.EClassCustomization; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.impl.FacetImpl; - -/** - * <!-- begin-user-doc --> - * An implementation of the model object '<em><b>EClass Customization</b></em>'. - * <!-- end-user-doc --> - * <p> - * </p> - * - * @generated - */ -public class EClassCustomizationImpl extends FacetImpl implements EClassCustomization { - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected EClassCustomizationImpl() { - super(); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - protected EClass eStaticClass() { - return CustomPackage.Literals.ECLASS_CUSTOMIZATION; - } - -} //EClassCustomizationImpl
diff --git a/org.eclipse.modisco.facet.custom.metamodel/src/org/eclipse/emf/facet/custom/metamodel/v0_2_0/custom/impl/ETypedElementCaseImpl.java b/org.eclipse.modisco.facet.custom.metamodel/src/org/eclipse/emf/facet/custom/metamodel/v0_2_0/custom/impl/ETypedElementCaseImpl.java deleted file mode 100644 index 5c4c0d9..0000000 --- a/org.eclipse.modisco.facet.custom.metamodel/src/org/eclipse/emf/facet/custom/metamodel/v0_2_0/custom/impl/ETypedElementCaseImpl.java +++ /dev/null
@@ -1,249 +0,0 @@ -/** - * Copyright (c) 2011 Mia-Software. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Gregoire Dupe (Mia-Software) - Bug 361794 - [Restructuring] New customization meta-model - * Gregoire Dupe (Mia-Software) - Bug 369987 - [Restructuring][Table] Switch to the new customization and facet framework - * Gregoire Dupe (Mia-Software) - Bug 373078 - API Cleaning - */ -package org.eclipse.emf.facet.custom.metamodel.v0_2_0.custom.impl; - -import org.eclipse.emf.common.notify.Notification; -import org.eclipse.emf.common.notify.NotificationChain; - -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.ecore.ETypedElement; -import org.eclipse.emf.ecore.InternalEObject; - -import org.eclipse.emf.ecore.impl.ENotificationImpl; -import org.eclipse.emf.ecore.impl.EObjectImpl; - -import org.eclipse.emf.facet.custom.metamodel.v0_2_0.custom.CustomPackage; -import org.eclipse.emf.facet.custom.metamodel.v0_2_0.custom.ETypedElementCase; - -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.extensible.Query; - -/** - * <!-- begin-user-doc --> - * An implementation of the model object '<em><b>ETyped Element Case</b></em>'. - * <!-- end-user-doc --> - * <p> - * The following features are implemented: - * <ul> - * <li>{@link org.eclipse.emf.facet.custom.metamodel.v0_2_0.custom.impl.ETypedElementCaseImpl#getCase <em>Case</em>}</li> - * <li>{@link org.eclipse.emf.facet.custom.metamodel.v0_2_0.custom.impl.ETypedElementCaseImpl#getValue <em>Value</em>}</li> - * </ul> - * </p> - * - * @generated - */ -public class ETypedElementCaseImpl extends EObjectImpl implements ETypedElementCase { - /** - * The cached value of the '{@link #getCase() <em>Case</em>}' reference. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #getCase() - * @generated - * @ordered - */ - protected ETypedElement case_; - - /** - * The cached value of the '{@link #getValue() <em>Value</em>}' containment reference. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #getValue() - * @generated - * @ordered - */ - protected Query value; - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected ETypedElementCaseImpl() { - super(); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - protected EClass eStaticClass() { - return CustomPackage.Literals.ETYPED_ELEMENT_CASE; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public ETypedElement getCase() { - if (case_ != null && case_.eIsProxy()) { - InternalEObject oldCase = (InternalEObject)case_; - case_ = (ETypedElement)eResolveProxy(oldCase); - if (case_ != oldCase) { - if (eNotificationRequired()) - eNotify(new ENotificationImpl(this, Notification.RESOLVE, CustomPackage.ETYPED_ELEMENT_CASE__CASE, oldCase, case_)); - } - } - return case_; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public ETypedElement basicGetCase() { - return case_; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public void setCase(ETypedElement newCase) { - ETypedElement oldCase = case_; - case_ = newCase; - if (eNotificationRequired()) - eNotify(new ENotificationImpl(this, Notification.SET, CustomPackage.ETYPED_ELEMENT_CASE__CASE, oldCase, case_)); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public Query getValue() { - return value; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public NotificationChain basicSetValue(Query newValue, NotificationChain msgs) { - Query oldValue = value; - value = newValue; - if (eNotificationRequired()) { - ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, CustomPackage.ETYPED_ELEMENT_CASE__VALUE, oldValue, newValue); - if (msgs == null) msgs = notification; else msgs.add(notification); - } - return msgs; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public void setValue(Query newValue) { - if (newValue != value) { - NotificationChain msgs = null; - if (value != null) - msgs = ((InternalEObject)value).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - CustomPackage.ETYPED_ELEMENT_CASE__VALUE, null, msgs); - if (newValue != null) - msgs = ((InternalEObject)newValue).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - CustomPackage.ETYPED_ELEMENT_CASE__VALUE, null, msgs); - msgs = basicSetValue(newValue, msgs); - if (msgs != null) msgs.dispatch(); - } - else if (eNotificationRequired()) - eNotify(new ENotificationImpl(this, Notification.SET, CustomPackage.ETYPED_ELEMENT_CASE__VALUE, newValue, newValue)); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { - switch (featureID) { - case CustomPackage.ETYPED_ELEMENT_CASE__VALUE: - return basicSetValue(null, msgs); - } - return super.eInverseRemove(otherEnd, featureID, msgs); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public Object eGet(int featureID, boolean resolve, boolean coreType) { - switch (featureID) { - case CustomPackage.ETYPED_ELEMENT_CASE__CASE: - if (resolve) return getCase(); - return basicGetCase(); - case CustomPackage.ETYPED_ELEMENT_CASE__VALUE: - return getValue(); - } - return super.eGet(featureID, resolve, coreType); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public void eSet(int featureID, Object newValue) { - switch (featureID) { - case CustomPackage.ETYPED_ELEMENT_CASE__CASE: - setCase((ETypedElement)newValue); - return; - case CustomPackage.ETYPED_ELEMENT_CASE__VALUE: - setValue((Query)newValue); - return; - } - super.eSet(featureID, newValue); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public void eUnset(int featureID) { - switch (featureID) { - case CustomPackage.ETYPED_ELEMENT_CASE__CASE: - setCase((ETypedElement)null); - return; - case CustomPackage.ETYPED_ELEMENT_CASE__VALUE: - setValue((Query)null); - return; - } - super.eUnset(featureID); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public boolean eIsSet(int featureID) { - switch (featureID) { - case CustomPackage.ETYPED_ELEMENT_CASE__CASE: - return case_ != null; - case CustomPackage.ETYPED_ELEMENT_CASE__VALUE: - return value != null; - } - return super.eIsSet(featureID); - } - -} //ETypedElementCaseImpl
diff --git a/org.eclipse.modisco.facet.custom.metamodel/src/org/eclipse/emf/facet/custom/metamodel/v0_2_0/custom/impl/ETypedElementSwitchQueryImpl.java b/org.eclipse.modisco.facet.custom.metamodel/src/org/eclipse/emf/facet/custom/metamodel/v0_2_0/custom/impl/ETypedElementSwitchQueryImpl.java deleted file mode 100644 index effa40a..0000000 --- a/org.eclipse.modisco.facet.custom.metamodel/src/org/eclipse/emf/facet/custom/metamodel/v0_2_0/custom/impl/ETypedElementSwitchQueryImpl.java +++ /dev/null
@@ -1,163 +0,0 @@ -/** - * Copyright (c) 2011 Mia-Software. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Gregoire Dupe (Mia-Software) - Bug 361794 - [Restructuring] New customization meta-model - * Gregoire Dupe (Mia-Software) - Bug 369987 - [Restructuring][Table] Switch to the new customization and facet framework - * Gregoire Dupe (Mia-Software) - Bug 373078 - API Cleaning - */ -package org.eclipse.emf.facet.custom.metamodel.v0_2_0.custom.impl; - -import java.util.Collection; - -import org.eclipse.emf.common.notify.NotificationChain; - -import org.eclipse.emf.common.util.EList; - -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.ecore.InternalEObject; - -import org.eclipse.emf.ecore.util.EObjectContainmentEList; -import org.eclipse.emf.ecore.util.InternalEList; - -import org.eclipse.emf.facet.custom.metamodel.v0_2_0.custom.CustomPackage; -import org.eclipse.emf.facet.custom.metamodel.v0_2_0.custom.ETypedElementCase; -import org.eclipse.emf.facet.custom.metamodel.v0_2_0.custom.ETypedElementSwitchQuery; - -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.extensible.impl.QueryImpl; - -/** - * <!-- begin-user-doc --> - * An implementation of the model object '<em><b>ETyped Element Switch Query</b></em>'. - * <!-- end-user-doc --> - * <p> - * The following features are implemented: - * <ul> - * <li>{@link org.eclipse.emf.facet.custom.metamodel.v0_2_0.custom.impl.ETypedElementSwitchQueryImpl#getCases <em>Cases</em>}</li> - * </ul> - * </p> - * - * @generated - */ -public class ETypedElementSwitchQueryImpl extends QueryImpl implements ETypedElementSwitchQuery { - /** - * The cached value of the '{@link #getCases() <em>Cases</em>}' containment reference list. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #getCases() - * @generated - * @ordered - */ - protected EList<ETypedElementCase> cases; - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected ETypedElementSwitchQueryImpl() { - super(); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - protected EClass eStaticClass() { - return CustomPackage.Literals.ETYPED_ELEMENT_SWITCH_QUERY; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EList<ETypedElementCase> getCases() { - if (cases == null) { - cases = new EObjectContainmentEList<ETypedElementCase>(ETypedElementCase.class, this, CustomPackage.ETYPED_ELEMENT_SWITCH_QUERY__CASES); - } - return cases; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { - switch (featureID) { - case CustomPackage.ETYPED_ELEMENT_SWITCH_QUERY__CASES: - return ((InternalEList<?>)getCases()).basicRemove(otherEnd, msgs); - } - return super.eInverseRemove(otherEnd, featureID, msgs); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public Object eGet(int featureID, boolean resolve, boolean coreType) { - switch (featureID) { - case CustomPackage.ETYPED_ELEMENT_SWITCH_QUERY__CASES: - return getCases(); - } - return super.eGet(featureID, resolve, coreType); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @SuppressWarnings("unchecked") - @Override - public void eSet(int featureID, Object newValue) { - switch (featureID) { - case CustomPackage.ETYPED_ELEMENT_SWITCH_QUERY__CASES: - getCases().clear(); - getCases().addAll((Collection<? extends ETypedElementCase>)newValue); - return; - } - super.eSet(featureID, newValue); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public void eUnset(int featureID) { - switch (featureID) { - case CustomPackage.ETYPED_ELEMENT_SWITCH_QUERY__CASES: - getCases().clear(); - return; - } - super.eUnset(featureID); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public boolean eIsSet(int featureID) { - switch (featureID) { - case CustomPackage.ETYPED_ELEMENT_SWITCH_QUERY__CASES: - return cases != null && !cases.isEmpty(); - } - return super.eIsSet(featureID); - } - -} //ETypedElementSwitchQueryImpl
diff --git a/org.eclipse.modisco.facet.custom.metamodel/src/org/eclipse/emf/facet/custom/metamodel/v0_2_0/custom/impl/FacetCustomizationImpl.java b/org.eclipse.modisco.facet.custom.metamodel/src/org/eclipse/emf/facet/custom/metamodel/v0_2_0/custom/impl/FacetCustomizationImpl.java deleted file mode 100644 index 26bdfe4..0000000 --- a/org.eclipse.modisco.facet.custom.metamodel/src/org/eclipse/emf/facet/custom/metamodel/v0_2_0/custom/impl/FacetCustomizationImpl.java +++ /dev/null
@@ -1,170 +0,0 @@ -/** - * Copyright (c) 2011 Mia-Software. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Gregoire Dupe (Mia-Software) - Bug 361794 - [Restructuring] New customization meta-model - * Gregoire Dupe (Mia-Software) - Bug 369987 - [Restructuring][Table] Switch to the new customization and facet framework - * Gregoire Dupe (Mia-Software) - Bug 373078 - API Cleaning - */ -package org.eclipse.emf.facet.custom.metamodel.v0_2_0.custom.impl; - -import org.eclipse.emf.common.notify.Notification; - -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.ecore.InternalEObject; - -import org.eclipse.emf.ecore.impl.ENotificationImpl; -import org.eclipse.emf.ecore.impl.EObjectImpl; - -import org.eclipse.emf.facet.custom.metamodel.v0_2_0.custom.CustomPackage; -import org.eclipse.emf.facet.custom.metamodel.v0_2_0.custom.FacetCustomization; - -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.Facet; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.impl.FacetImpl; - -/** - * <!-- begin-user-doc --> - * An implementation of the model object '<em><b>Facet Customization</b></em>'. - * <!-- end-user-doc --> - * <p> - * The following features are implemented: - * <ul> - * <li>{@link org.eclipse.emf.facet.custom.metamodel.v0_2_0.custom.impl.FacetCustomizationImpl#getCustomizedFacet <em>Customized Facet</em>}</li> - * </ul> - * </p> - * - * @generated - */ -public class FacetCustomizationImpl extends FacetImpl implements FacetCustomization { - /** - * The cached value of the '{@link #getCustomizedFacet() <em>Customized Facet</em>}' reference. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #getCustomizedFacet() - * @generated - * @ordered - */ - protected Facet customizedFacet; - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected FacetCustomizationImpl() { - super(); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - protected EClass eStaticClass() { - return CustomPackage.Literals.FACET_CUSTOMIZATION; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public Facet getCustomizedFacet() { - if (customizedFacet != null && customizedFacet.eIsProxy()) { - InternalEObject oldCustomizedFacet = (InternalEObject)customizedFacet; - customizedFacet = (Facet)eResolveProxy(oldCustomizedFacet); - if (customizedFacet != oldCustomizedFacet) { - if (eNotificationRequired()) - eNotify(new ENotificationImpl(this, Notification.RESOLVE, CustomPackage.FACET_CUSTOMIZATION__CUSTOMIZED_FACET, oldCustomizedFacet, customizedFacet)); - } - } - return customizedFacet; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public Facet basicGetCustomizedFacet() { - return customizedFacet; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public void setCustomizedFacet(Facet newCustomizedFacet) { - Facet oldCustomizedFacet = customizedFacet; - customizedFacet = newCustomizedFacet; - if (eNotificationRequired()) - eNotify(new ENotificationImpl(this, Notification.SET, CustomPackage.FACET_CUSTOMIZATION__CUSTOMIZED_FACET, oldCustomizedFacet, customizedFacet)); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public Object eGet(int featureID, boolean resolve, boolean coreType) { - switch (featureID) { - case CustomPackage.FACET_CUSTOMIZATION__CUSTOMIZED_FACET: - if (resolve) return getCustomizedFacet(); - return basicGetCustomizedFacet(); - } - return super.eGet(featureID, resolve, coreType); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public void eSet(int featureID, Object newValue) { - switch (featureID) { - case CustomPackage.FACET_CUSTOMIZATION__CUSTOMIZED_FACET: - setCustomizedFacet((Facet)newValue); - return; - } - super.eSet(featureID, newValue); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public void eUnset(int featureID) { - switch (featureID) { - case CustomPackage.FACET_CUSTOMIZATION__CUSTOMIZED_FACET: - setCustomizedFacet((Facet)null); - return; - } - super.eUnset(featureID); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public boolean eIsSet(int featureID) { - switch (featureID) { - case CustomPackage.FACET_CUSTOMIZATION__CUSTOMIZED_FACET: - return customizedFacet != null; - } - return super.eIsSet(featureID); - } - -} //FacetCustomizationImpl
diff --git a/org.eclipse.modisco.facet.custom.metamodel/src/org/eclipse/emf/facet/custom/metamodel/v0_2_0/custom/util/CustomAdapterFactory.java b/org.eclipse.modisco.facet.custom.metamodel/src/org/eclipse/emf/facet/custom/metamodel/v0_2_0/custom/util/CustomAdapterFactory.java deleted file mode 100644 index 39a08b4..0000000 --- a/org.eclipse.modisco.facet.custom.metamodel/src/org/eclipse/emf/facet/custom/metamodel/v0_2_0/custom/util/CustomAdapterFactory.java +++ /dev/null
@@ -1,357 +0,0 @@ -/** - * Copyright (c) 2011 Mia-Software. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Gregoire Dupe (Mia-Software) - Bug 361794 - [Restructuring] New customization meta-model - * Gregoire Dupe (Mia-Software) - Bug 369987 - [Restructuring][Table] Switch to the new customization and facet framework - * Gregoire Dupe (Mia-Software) - Bug 373078 - API Cleaning - */ -package org.eclipse.emf.facet.custom.metamodel.v0_2_0.custom.util; - -import org.eclipse.emf.common.notify.Adapter; -import org.eclipse.emf.common.notify.Notifier; - -import org.eclipse.emf.common.notify.impl.AdapterFactoryImpl; - -import org.eclipse.emf.ecore.EClassifier; -import org.eclipse.emf.ecore.EModelElement; -import org.eclipse.emf.ecore.ENamedElement; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.EPackage; - -import org.eclipse.emf.facet.custom.metamodel.v0_2_0.custom.*; - -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.DocumentedElement; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.Facet; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.FacetSet; - -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.extensible.Query; - -/** - * <!-- begin-user-doc --> - * The <b>Adapter Factory</b> for the model. - * It provides an adapter <code>createXXX</code> method for each class of the model. - * <!-- end-user-doc --> - * @see org.eclipse.emf.facet.custom.metamodel.v0_2_0.custom.CustomPackage - * @generated - */ -public class CustomAdapterFactory extends AdapterFactoryImpl { - /** - * The cached model package. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected static CustomPackage modelPackage; - - /** - * Creates an instance of the adapter factory. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public CustomAdapterFactory() { - if (modelPackage == null) { - modelPackage = CustomPackage.eINSTANCE; - } - } - - /** - * Returns whether this factory is applicable for the type of the object. - * <!-- begin-user-doc --> - * This implementation returns <code>true</code> if the object is either the model's package or is an instance object of the model. - * <!-- end-user-doc --> - * @return whether this factory is applicable for the type of the object. - * @generated - */ - @Override - public boolean isFactoryForType(Object object) { - if (object == modelPackage) { - return true; - } - if (object instanceof EObject) { - return ((EObject)object).eClass().getEPackage() == modelPackage; - } - return false; - } - - /** - * The switch that delegates to the <code>createXXX</code> methods. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected CustomSwitch<Adapter> modelSwitch = - new CustomSwitch<Adapter>() { - @Override - public Adapter caseCustomization(Customization object) { - return createCustomizationAdapter(); - } - @Override - public Adapter caseEClassCustomization(EClassCustomization object) { - return createEClassCustomizationAdapter(); - } - @Override - public Adapter caseFacetCustomization(FacetCustomization object) { - return createFacetCustomizationAdapter(); - } - @Override - public Adapter caseETypedElementSwitchQuery(ETypedElementSwitchQuery object) { - return createETypedElementSwitchQueryAdapter(); - } - @Override - public Adapter caseETypedElementCase(ETypedElementCase object) { - return createETypedElementCaseAdapter(); - } - @Override - public Adapter caseEModelElement(EModelElement object) { - return createEModelElementAdapter(); - } - @Override - public Adapter caseENamedElement(ENamedElement object) { - return createENamedElementAdapter(); - } - @Override - public Adapter caseEPackage(EPackage object) { - return createEPackageAdapter(); - } - @Override - public Adapter caseDocumentedElement(DocumentedElement object) { - return createDocumentedElementAdapter(); - } - @Override - public Adapter caseFacetSet(FacetSet object) { - return createFacetSetAdapter(); - } - @Override - public Adapter caseEClassifier(EClassifier object) { - return createEClassifierAdapter(); - } - @Override - public Adapter caseFacet(Facet object) { - return createFacetAdapter(); - } - @Override - public Adapter caseQuery(Query object) { - return createQueryAdapter(); - } - @Override - public Adapter defaultCase(EObject object) { - return createEObjectAdapter(); - } - }; - - /** - * Creates an adapter for the <code>target</code>. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @param target the object to adapt. - * @return the adapter for the <code>target</code>. - * @generated - */ - @Override - public Adapter createAdapter(Notifier target) { - return modelSwitch.doSwitch((EObject)target); - } - - - /** - * Creates a new adapter for an object of class '{@link org.eclipse.emf.facet.custom.metamodel.v0_2_0.custom.Customization <em>Customization</em>}'. - * <!-- begin-user-doc --> - * This default implementation returns null so that we can easily ignore cases; - * it's useful to ignore a case when inheritance will catch all the cases anyway. - * <!-- end-user-doc --> - * @return the new adapter. - * @see org.eclipse.emf.facet.custom.metamodel.v0_2_0.custom.Customization - * @generated - */ - public Adapter createCustomizationAdapter() { - return null; - } - - /** - * Creates a new adapter for an object of class '{@link org.eclipse.emf.facet.custom.metamodel.v0_2_0.custom.EClassCustomization <em>EClass Customization</em>}'. - * <!-- begin-user-doc --> - * This default implementation returns null so that we can easily ignore cases; - * it's useful to ignore a case when inheritance will catch all the cases anyway. - * <!-- end-user-doc --> - * @return the new adapter. - * @see org.eclipse.emf.facet.custom.metamodel.v0_2_0.custom.EClassCustomization - * @generated - */ - public Adapter createEClassCustomizationAdapter() { - return null; - } - - /** - * Creates a new adapter for an object of class '{@link org.eclipse.emf.facet.custom.metamodel.v0_2_0.custom.FacetCustomization <em>Facet Customization</em>}'. - * <!-- begin-user-doc --> - * This default implementation returns null so that we can easily ignore cases; - * it's useful to ignore a case when inheritance will catch all the cases anyway. - * <!-- end-user-doc --> - * @return the new adapter. - * @see org.eclipse.emf.facet.custom.metamodel.v0_2_0.custom.FacetCustomization - * @generated - */ - public Adapter createFacetCustomizationAdapter() { - return null; - } - - /** - * Creates a new adapter for an object of class '{@link org.eclipse.emf.facet.custom.metamodel.v0_2_0.custom.ETypedElementSwitchQuery <em>ETyped Element Switch Query</em>}'. - * <!-- begin-user-doc --> - * This default implementation returns null so that we can easily ignore cases; - * it's useful to ignore a case when inheritance will catch all the cases anyway. - * <!-- end-user-doc --> - * @return the new adapter. - * @see org.eclipse.emf.facet.custom.metamodel.v0_2_0.custom.ETypedElementSwitchQuery - * @generated - */ - public Adapter createETypedElementSwitchQueryAdapter() { - return null; - } - - /** - * Creates a new adapter for an object of class '{@link org.eclipse.emf.facet.custom.metamodel.v0_2_0.custom.ETypedElementCase <em>ETyped Element Case</em>}'. - * <!-- begin-user-doc --> - * This default implementation returns null so that we can easily ignore cases; - * it's useful to ignore a case when inheritance will catch all the cases anyway. - * <!-- end-user-doc --> - * @return the new adapter. - * @see org.eclipse.emf.facet.custom.metamodel.v0_2_0.custom.ETypedElementCase - * @generated - */ - public Adapter createETypedElementCaseAdapter() { - return null; - } - - /** - * Creates a new adapter for an object of class '{@link org.eclipse.emf.ecore.EModelElement <em>EModel Element</em>}'. - * <!-- begin-user-doc --> - * This default implementation returns null so that we can easily ignore cases; - * it's useful to ignore a case when inheritance will catch all the cases anyway. - * <!-- end-user-doc --> - * @return the new adapter. - * @see org.eclipse.emf.ecore.EModelElement - * @generated - */ - public Adapter createEModelElementAdapter() { - return null; - } - - /** - * Creates a new adapter for an object of class '{@link org.eclipse.emf.ecore.ENamedElement <em>ENamed Element</em>}'. - * <!-- begin-user-doc --> - * This default implementation returns null so that we can easily ignore cases; - * it's useful to ignore a case when inheritance will catch all the cases anyway. - * <!-- end-user-doc --> - * @return the new adapter. - * @see org.eclipse.emf.ecore.ENamedElement - * @generated - */ - public Adapter createENamedElementAdapter() { - return null; - } - - /** - * Creates a new adapter for an object of class '{@link org.eclipse.emf.ecore.EPackage <em>EPackage</em>}'. - * <!-- begin-user-doc --> - * This default implementation returns null so that we can easily ignore cases; - * it's useful to ignore a case when inheritance will catch all the cases anyway. - * <!-- end-user-doc --> - * @return the new adapter. - * @see org.eclipse.emf.ecore.EPackage - * @generated - */ - public Adapter createEPackageAdapter() { - return null; - } - - /** - * Creates a new adapter for an object of class '{@link org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.DocumentedElement <em>Documented Element</em>}'. - * <!-- begin-user-doc --> - * This default implementation returns null so that we can easily ignore cases; - * it's useful to ignore a case when inheritance will catch all the cases anyway. - * <!-- end-user-doc --> - * @return the new adapter. - * @see org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.DocumentedElement - * @generated - */ - public Adapter createDocumentedElementAdapter() { - return null; - } - - /** - * Creates a new adapter for an object of class '{@link org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.FacetSet <em>Facet Set</em>}'. - * <!-- begin-user-doc --> - * This default implementation returns null so that we can easily ignore cases; - * it's useful to ignore a case when inheritance will catch all the cases anyway. - * <!-- end-user-doc --> - * @return the new adapter. - * @see org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.FacetSet - * @generated - */ - public Adapter createFacetSetAdapter() { - return null; - } - - /** - * Creates a new adapter for an object of class '{@link org.eclipse.emf.ecore.EClassifier <em>EClassifier</em>}'. - * <!-- begin-user-doc --> - * This default implementation returns null so that we can easily ignore cases; - * it's useful to ignore a case when inheritance will catch all the cases anyway. - * <!-- end-user-doc --> - * @return the new adapter. - * @see org.eclipse.emf.ecore.EClassifier - * @generated - */ - public Adapter createEClassifierAdapter() { - return null; - } - - /** - * Creates a new adapter for an object of class '{@link org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.Facet <em>Facet</em>}'. - * <!-- begin-user-doc --> - * This default implementation returns null so that we can easily ignore cases; - * it's useful to ignore a case when inheritance will catch all the cases anyway. - * <!-- end-user-doc --> - * @return the new adapter. - * @see org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.Facet - * @generated - */ - public Adapter createFacetAdapter() { - return null; - } - - /** - * Creates a new adapter for an object of class '{@link org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.extensible.Query <em>Query</em>}'. - * <!-- begin-user-doc --> - * This default implementation returns null so that we can easily ignore cases; - * it's useful to ignore a case when inheritance will catch all the cases anyway. - * <!-- end-user-doc --> - * @return the new adapter. - * @see org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.extensible.Query - * @generated - */ - public Adapter createQueryAdapter() { - return null; - } - - /** - * Creates a new adapter for the default case. - * <!-- begin-user-doc --> - * This default implementation returns null. - * <!-- end-user-doc --> - * @return the new adapter. - * @generated - */ - public Adapter createEObjectAdapter() { - return null; - } - -} //CustomAdapterFactory
diff --git a/org.eclipse.modisco.facet.custom.metamodel/src/org/eclipse/emf/facet/custom/metamodel/v0_2_0/custom/util/CustomSwitch.java b/org.eclipse.modisco.facet.custom.metamodel/src/org/eclipse/emf/facet/custom/metamodel/v0_2_0/custom/util/CustomSwitch.java deleted file mode 100644 index 3d24474..0000000 --- a/org.eclipse.modisco.facet.custom.metamodel/src/org/eclipse/emf/facet/custom/metamodel/v0_2_0/custom/util/CustomSwitch.java +++ /dev/null
@@ -1,367 +0,0 @@ -/** - * Copyright (c) 2011 Mia-Software. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Gregoire Dupe (Mia-Software) - Bug 361794 - [Restructuring] New customization meta-model - * Gregoire Dupe (Mia-Software) - Bug 369987 - [Restructuring][Table] Switch to the new customization and facet framework - * Gregoire Dupe (Mia-Software) - Bug 373078 - API Cleaning - */ -package org.eclipse.emf.facet.custom.metamodel.v0_2_0.custom.util; - -import java.util.List; - -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.ecore.EClassifier; -import org.eclipse.emf.ecore.EModelElement; -import org.eclipse.emf.ecore.ENamedElement; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.EPackage; - -import org.eclipse.emf.facet.custom.metamodel.v0_2_0.custom.*; - -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.DocumentedElement; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.Facet; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.FacetSet; - -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.extensible.Query; - -/** - * <!-- begin-user-doc --> - * The <b>Switch</b> for the model's inheritance hierarchy. - * It supports the call {@link #doSwitch(EObject) doSwitch(object)} - * to invoke the <code>caseXXX</code> method for each class of the model, - * starting with the actual class of the object - * and proceeding up the inheritance hierarchy - * until a non-null result is returned, - * which is the result of the switch. - * <!-- end-user-doc --> - * @see org.eclipse.emf.facet.custom.metamodel.v0_2_0.custom.CustomPackage - * @generated - */ -public class CustomSwitch<T> { - /** - * The cached model package - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected static CustomPackage modelPackage; - - /** - * Creates an instance of the switch. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public CustomSwitch() { - if (modelPackage == null) { - modelPackage = CustomPackage.eINSTANCE; - } - } - - /** - * Calls <code>caseXXX</code> for each class of the model until one returns a non null result; it yields that result. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the first non-null result returned by a <code>caseXXX</code> call. - * @generated - */ - public T doSwitch(EObject theEObject) { - return doSwitch(theEObject.eClass(), theEObject); - } - - /** - * Calls <code>caseXXX</code> for each class of the model until one returns a non null result; it yields that result. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the first non-null result returned by a <code>caseXXX</code> call. - * @generated - */ - protected T doSwitch(EClass theEClass, EObject theEObject) { - if (theEClass.eContainer() == modelPackage) { - return doSwitch(theEClass.getClassifierID(), theEObject); - } - else { - List<EClass> eSuperTypes = theEClass.getESuperTypes(); - return - eSuperTypes.isEmpty() ? - defaultCase(theEObject) : - doSwitch(eSuperTypes.get(0), theEObject); - } - } - - /** - * Calls <code>caseXXX</code> for each class of the model until one returns a non null result; it yields that result. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the first non-null result returned by a <code>caseXXX</code> call. - * @generated - */ - protected T doSwitch(int classifierID, EObject theEObject) { - switch (classifierID) { - case CustomPackage.CUSTOMIZATION: { - Customization customization = (Customization)theEObject; - T result = caseCustomization(customization); - if (result == null) result = caseFacetSet(customization); - if (result == null) result = caseEPackage(customization); - if (result == null) result = caseDocumentedElement(customization); - if (result == null) result = caseENamedElement(customization); - if (result == null) result = caseEModelElement(customization); - if (result == null) result = defaultCase(theEObject); - return result; - } - case CustomPackage.ECLASS_CUSTOMIZATION: { - EClassCustomization eClassCustomization = (EClassCustomization)theEObject; - T result = caseEClassCustomization(eClassCustomization); - if (result == null) result = caseFacet(eClassCustomization); - if (result == null) result = caseEClassifier(eClassCustomization); - if (result == null) result = caseDocumentedElement(eClassCustomization); - if (result == null) result = caseENamedElement(eClassCustomization); - if (result == null) result = caseEModelElement(eClassCustomization); - if (result == null) result = defaultCase(theEObject); - return result; - } - case CustomPackage.FACET_CUSTOMIZATION: { - FacetCustomization facetCustomization = (FacetCustomization)theEObject; - T result = caseFacetCustomization(facetCustomization); - if (result == null) result = caseFacet(facetCustomization); - if (result == null) result = caseEClassifier(facetCustomization); - if (result == null) result = caseDocumentedElement(facetCustomization); - if (result == null) result = caseENamedElement(facetCustomization); - if (result == null) result = caseEModelElement(facetCustomization); - if (result == null) result = defaultCase(theEObject); - return result; - } - case CustomPackage.ETYPED_ELEMENT_SWITCH_QUERY: { - ETypedElementSwitchQuery eTypedElementSwitchQuery = (ETypedElementSwitchQuery)theEObject; - T result = caseETypedElementSwitchQuery(eTypedElementSwitchQuery); - if (result == null) result = caseQuery(eTypedElementSwitchQuery); - if (result == null) result = defaultCase(theEObject); - return result; - } - case CustomPackage.ETYPED_ELEMENT_CASE: { - ETypedElementCase eTypedElementCase = (ETypedElementCase)theEObject; - T result = caseETypedElementCase(eTypedElementCase); - if (result == null) result = defaultCase(theEObject); - return result; - } - default: return defaultCase(theEObject); - } - } - - /** - * Returns the result of interpreting the object as an instance of '<em>Customization</em>'. - * <!-- begin-user-doc --> - * This implementation returns null; - * returning a non-null result will terminate the switch. - * <!-- end-user-doc --> - * @param object the target of the switch. - * @return the result of interpreting the object as an instance of '<em>Customization</em>'. - * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) - * @generated - */ - public T caseCustomization(Customization object) { - return null; - } - - /** - * Returns the result of interpreting the object as an instance of '<em>EClass Customization</em>'. - * <!-- begin-user-doc --> - * This implementation returns null; - * returning a non-null result will terminate the switch. - * <!-- end-user-doc --> - * @param object the target of the switch. - * @return the result of interpreting the object as an instance of '<em>EClass Customization</em>'. - * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) - * @generated - */ - public T caseEClassCustomization(EClassCustomization object) { - return null; - } - - /** - * Returns the result of interpreting the object as an instance of '<em>Facet Customization</em>'. - * <!-- begin-user-doc --> - * This implementation returns null; - * returning a non-null result will terminate the switch. - * <!-- end-user-doc --> - * @param object the target of the switch. - * @return the result of interpreting the object as an instance of '<em>Facet Customization</em>'. - * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) - * @generated - */ - public T caseFacetCustomization(FacetCustomization object) { - return null; - } - - /** - * Returns the result of interpreting the object as an instance of '<em>ETyped Element Switch Query</em>'. - * <!-- begin-user-doc --> - * This implementation returns null; - * returning a non-null result will terminate the switch. - * <!-- end-user-doc --> - * @param object the target of the switch. - * @return the result of interpreting the object as an instance of '<em>ETyped Element Switch Query</em>'. - * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) - * @generated - */ - public T caseETypedElementSwitchQuery(ETypedElementSwitchQuery object) { - return null; - } - - /** - * Returns the result of interpreting the object as an instance of '<em>ETyped Element Case</em>'. - * <!-- begin-user-doc --> - * This implementation returns null; - * returning a non-null result will terminate the switch. - * <!-- end-user-doc --> - * @param object the target of the switch. - * @return the result of interpreting the object as an instance of '<em>ETyped Element Case</em>'. - * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) - * @generated - */ - public T caseETypedElementCase(ETypedElementCase object) { - return null; - } - - /** - * Returns the result of interpreting the object as an instance of '<em>EModel Element</em>'. - * <!-- begin-user-doc --> - * This implementation returns null; - * returning a non-null result will terminate the switch. - * <!-- end-user-doc --> - * @param object the target of the switch. - * @return the result of interpreting the object as an instance of '<em>EModel Element</em>'. - * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) - * @generated - */ - public T caseEModelElement(EModelElement object) { - return null; - } - - /** - * Returns the result of interpreting the object as an instance of '<em>ENamed Element</em>'. - * <!-- begin-user-doc --> - * This implementation returns null; - * returning a non-null result will terminate the switch. - * <!-- end-user-doc --> - * @param object the target of the switch. - * @return the result of interpreting the object as an instance of '<em>ENamed Element</em>'. - * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) - * @generated - */ - public T caseENamedElement(ENamedElement object) { - return null; - } - - /** - * Returns the result of interpreting the object as an instance of '<em>EPackage</em>'. - * <!-- begin-user-doc --> - * This implementation returns null; - * returning a non-null result will terminate the switch. - * <!-- end-user-doc --> - * @param object the target of the switch. - * @return the result of interpreting the object as an instance of '<em>EPackage</em>'. - * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) - * @generated - */ - public T caseEPackage(EPackage object) { - return null; - } - - /** - * Returns the result of interpreting the object as an instance of '<em>Documented Element</em>'. - * <!-- begin-user-doc --> - * This implementation returns null; - * returning a non-null result will terminate the switch. - * <!-- end-user-doc --> - * @param object the target of the switch. - * @return the result of interpreting the object as an instance of '<em>Documented Element</em>'. - * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) - * @generated - */ - public T caseDocumentedElement(DocumentedElement object) { - return null; - } - - /** - * Returns the result of interpreting the object as an instance of '<em>Facet Set</em>'. - * <!-- begin-user-doc --> - * This implementation returns null; - * returning a non-null result will terminate the switch. - * <!-- end-user-doc --> - * @param object the target of the switch. - * @return the result of interpreting the object as an instance of '<em>Facet Set</em>'. - * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) - * @generated - */ - public T caseFacetSet(FacetSet object) { - return null; - } - - /** - * Returns the result of interpreting the object as an instance of '<em>EClassifier</em>'. - * <!-- begin-user-doc --> - * This implementation returns null; - * returning a non-null result will terminate the switch. - * <!-- end-user-doc --> - * @param object the target of the switch. - * @return the result of interpreting the object as an instance of '<em>EClassifier</em>'. - * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) - * @generated - */ - public T caseEClassifier(EClassifier object) { - return null; - } - - /** - * Returns the result of interpreting the object as an instance of '<em>Facet</em>'. - * <!-- begin-user-doc --> - * This implementation returns null; - * returning a non-null result will terminate the switch. - * <!-- end-user-doc --> - * @param object the target of the switch. - * @return the result of interpreting the object as an instance of '<em>Facet</em>'. - * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) - * @generated - */ - public T caseFacet(Facet object) { - return null; - } - - /** - * Returns the result of interpreting the object as an instance of '<em>Query</em>'. - * <!-- begin-user-doc --> - * This implementation returns null; - * returning a non-null result will terminate the switch. - * <!-- end-user-doc --> - * @param object the target of the switch. - * @return the result of interpreting the object as an instance of '<em>Query</em>'. - * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) - * @generated - */ - public T caseQuery(Query object) { - return null; - } - - /** - * Returns the result of interpreting the object as an instance of '<em>EObject</em>'. - * <!-- begin-user-doc --> - * This implementation returns null; - * returning a non-null result will terminate the switch, but this is the last case anyway. - * <!-- end-user-doc --> - * @param object the target of the switch. - * @return the result of interpreting the object as an instance of '<em>EObject</em>'. - * @see #doSwitch(org.eclipse.emf.ecore.EObject) - * @generated - */ - public T defaultCase(EObject object) { - return null; - } - -} //CustomSwitch
diff --git a/org.eclipse.modisco.facet.custom.metamodel/src/org/eclipse/emf/facet/custom/metamodel/v0_2_0/customizationcatalog/CustomizationCatalog.java b/org.eclipse.modisco.facet.custom.metamodel/src/org/eclipse/emf/facet/custom/metamodel/v0_2_0/customizationcatalog/CustomizationCatalog.java deleted file mode 100644 index 61a9628..0000000 --- a/org.eclipse.modisco.facet.custom.metamodel/src/org/eclipse/emf/facet/custom/metamodel/v0_2_0/customizationcatalog/CustomizationCatalog.java +++ /dev/null
@@ -1,30 +0,0 @@ -/** - * Copyright (c) 2011, 2015 Mia-Software. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Grégoire Dupé (Mia-Software) - Bug 361794 - [Restructuring] New customization meta-model - * Grégoire Dupé (Mia-Software) - Bug 373078 - API Cleaning - * Grégoire Dupé (Mia-Software) - Bug 477657 - The catalog manager should be able to manage workspace model - */ -package org.eclipse.emf.facet.custom.metamodel.v0_2_0.customizationcatalog; - -import org.eclipse.emf.facet.util.emf.catalog.Catalog; - -/** - * <!-- begin-user-doc --> - * A representation of the model object '<em><b>Customization Catalog</b></em>'. - * <!-- end-user-doc --> - * - * - * @see org.eclipse.emf.facet.custom.metamodel.v0_2_0.customizationcatalog.CustomizationcatalogPackage#getCustomizationCatalog() - * @model - * @generated - */ -@Deprecated -public interface CustomizationCatalog extends Catalog { -} // CustomizationCatalog
diff --git a/org.eclipse.modisco.facet.custom.metamodel/src/org/eclipse/emf/facet/custom/metamodel/v0_2_0/customizationcatalog/CustomizationPropertiesCatalog.java b/org.eclipse.modisco.facet.custom.metamodel/src/org/eclipse/emf/facet/custom/metamodel/v0_2_0/customizationcatalog/CustomizationPropertiesCatalog.java deleted file mode 100644 index aec5d33..0000000 --- a/org.eclipse.modisco.facet.custom.metamodel/src/org/eclipse/emf/facet/custom/metamodel/v0_2_0/customizationcatalog/CustomizationPropertiesCatalog.java +++ /dev/null
@@ -1,30 +0,0 @@ -/** - * Copyright (c) 2011, 2015 Mia-Software. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Grégoire Dupé (Mia-Software) - Bug 361794 - [Restructuring] New customization meta-model - * Grégoire Dupé (Mia-Software) - Bug 373078 - API Cleaning - * Grégoire Dupé (Mia-Software) - Bug 477657 - The catalog manager should be able to manage workspace model - */ -package org.eclipse.emf.facet.custom.metamodel.v0_2_0.customizationcatalog; - -import org.eclipse.emf.facet.util.emf.catalog.Catalog; - -/** - * <!-- begin-user-doc --> - * A representation of the model object '<em><b>Customization Properties Catalog</b></em>'. - * <!-- end-user-doc --> - * - * - * @see org.eclipse.emf.facet.custom.metamodel.v0_2_0.customizationcatalog.CustomizationcatalogPackage#getCustomizationPropertiesCatalog() - * @model - * @generated - */ -@Deprecated -public interface CustomizationPropertiesCatalog extends Catalog { -} // CustomizationPropertiesCatalog
diff --git a/org.eclipse.modisco.facet.custom.metamodel/src/org/eclipse/emf/facet/custom/metamodel/v0_2_0/customizationcatalog/CustomizationcatalogFactory.java b/org.eclipse.modisco.facet.custom.metamodel/src/org/eclipse/emf/facet/custom/metamodel/v0_2_0/customizationcatalog/CustomizationcatalogFactory.java deleted file mode 100644 index 939e88b..0000000 --- a/org.eclipse.modisco.facet.custom.metamodel/src/org/eclipse/emf/facet/custom/metamodel/v0_2_0/customizationcatalog/CustomizationcatalogFactory.java +++ /dev/null
@@ -1,64 +0,0 @@ -/** - * Copyright (c) 2011, 2015 Mia-Software. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Grégoire Dupé (Mia-Software) - Bug 361794 - [Restructuring] New customization meta-model - * Grégoire Dupé (Mia-Software) - Bug 373078 - API Cleaning - * Grégoire Dupé (Mia-Software) - Bug 477657 - The catalog manager should be able to manage workspace model - */ -package org.eclipse.emf.facet.custom.metamodel.v0_2_0.customizationcatalog; - -import org.eclipse.emf.ecore.EFactory; - -/** - * <!-- begin-user-doc --> The <b>Factory</b> for the model. It provides a - * create method for each non-abstract class of the model. <!-- end-user-doc --> - * - * @see org.eclipse.emf.facet.custom.metamodel.v0_2_0.customizationcatalog.CustomizationcatalogPackage - * @generated - * @noextend This interface is not intended to be extended by clients. - * @noimplement This interface is not intended to be implemented by clients. - */ -@Deprecated -public interface CustomizationcatalogFactory extends EFactory { - /** - * The singleton instance of the factory. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - CustomizationcatalogFactory eINSTANCE = org.eclipse.emf.facet.custom.metamodel.v0_2_0.customizationcatalog.impl.CustomizationcatalogFactoryImpl.init(); - - /** - * Returns a new object of class '<em>Customization Catalog</em>'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return a new object of class '<em>Customization Catalog</em>'. - * @generated - */ - CustomizationCatalog createCustomizationCatalog(); - - /** - * Returns a new object of class '<em>Customization Properties Catalog</em>'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return a new object of class '<em>Customization Properties Catalog</em>'. - * @generated - */ - CustomizationPropertiesCatalog createCustomizationPropertiesCatalog(); - - /** - * Returns the package supported by this factory. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the package supported by this factory. - * @generated - */ - CustomizationcatalogPackage getCustomizationcatalogPackage(); - -} //CustomizationcatalogFactory
diff --git a/org.eclipse.modisco.facet.custom.metamodel/src/org/eclipse/emf/facet/custom/metamodel/v0_2_0/customizationcatalog/CustomizationcatalogPackage.java b/org.eclipse.modisco.facet.custom.metamodel/src/org/eclipse/emf/facet/custom/metamodel/v0_2_0/customizationcatalog/CustomizationcatalogPackage.java deleted file mode 100644 index 7faeb40..0000000 --- a/org.eclipse.modisco.facet.custom.metamodel/src/org/eclipse/emf/facet/custom/metamodel/v0_2_0/customizationcatalog/CustomizationcatalogPackage.java +++ /dev/null
@@ -1,210 +0,0 @@ -/** - * Copyright (c) 2011, 2015 Mia-Software. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Grégoire Dupé (Mia-Software) - Bug 361794 - [Restructuring] New customization meta-model - * Grégoire Dupé (Mia-Software) - Bug 373078 - API Cleaning - * Grégoire Dupé (Mia-Software) - Bug 477657 - The catalog manager should be able to manage workspace model - */ -package org.eclipse.emf.facet.custom.metamodel.v0_2_0.customizationcatalog; - -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.ecore.EPackage; -import org.eclipse.emf.facet.util.emf.catalog.CatalogPackage; - -/** - * <!-- begin-user-doc --> The <b>Package</b> for the model. It contains - * accessors for the meta objects to represent - * <ul> - * <li>each class,</li> - * <li>each feature of each class,</li> - * <li>each enum,</li> - * <li>and each data type</li> - * </ul> - * <!-- end-user-doc --> - * - * @see org.eclipse.emf.facet.custom.metamodel.v0_2_0.customizationcatalog.CustomizationcatalogFactory - * @model kind="package" - * @generated - * @noextend This interface is not intended to be extended by clients. - * @noimplement This interface is not intended to be implemented by clients. - */ -@Deprecated -public interface CustomizationcatalogPackage extends EPackage { - /** - * The package name. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - String eNAME = "customizationcatalog"; - - /** - * The package namespace URI. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - String eNS_URI = "http://www.eclipse.org/emf/facet/custom/0.2.internal/customizationcatalog"; - - /** - * The package namespace name. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - String eNS_PREFIX = "customizationcatalog"; - - /** - * The singleton instance of the package. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - CustomizationcatalogPackage eINSTANCE = org.eclipse.emf.facet.custom.metamodel.v0_2_0.customizationcatalog.impl.CustomizationcatalogPackageImpl.init(); - - /** - * The meta object id for the '{@link org.eclipse.emf.facet.custom.metamodel.v0_2_0.customizationcatalog.impl.CustomizationCatalogImpl <em>Customization Catalog</em>}' class. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see org.eclipse.emf.facet.custom.metamodel.v0_2_0.customizationcatalog.impl.CustomizationCatalogImpl - * @see org.eclipse.emf.facet.custom.metamodel.v0_2_0.customizationcatalog.impl.CustomizationcatalogPackageImpl#getCustomizationCatalog() - * @generated - */ - int CUSTOMIZATION_CATALOG = 0; - - /** - * The feature id for the '<em><b>Installed Entries</b></em>' reference list. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int CUSTOMIZATION_CATALOG__INSTALLED_ENTRIES = CatalogPackage.CATALOG__INSTALLED_ENTRIES; - - /** - * The feature id for the '<em><b>Name</b></em>' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int CUSTOMIZATION_CATALOG__NAME = CatalogPackage.CATALOG__NAME; - - /** - * The number of structural features of the '<em>Customization Catalog</em>' class. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int CUSTOMIZATION_CATALOG_FEATURE_COUNT = CatalogPackage.CATALOG_FEATURE_COUNT + 0; - - /** - * The meta object id for the '{@link org.eclipse.emf.facet.custom.metamodel.v0_2_0.customizationcatalog.impl.CustomizationPropertiesCatalogImpl <em>Customization Properties Catalog</em>}' class. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see org.eclipse.emf.facet.custom.metamodel.v0_2_0.customizationcatalog.impl.CustomizationPropertiesCatalogImpl - * @see org.eclipse.emf.facet.custom.metamodel.v0_2_0.customizationcatalog.impl.CustomizationcatalogPackageImpl#getCustomizationPropertiesCatalog() - * @generated - */ - int CUSTOMIZATION_PROPERTIES_CATALOG = 1; - - /** - * The feature id for the '<em><b>Installed Entries</b></em>' reference list. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int CUSTOMIZATION_PROPERTIES_CATALOG__INSTALLED_ENTRIES = CatalogPackage.CATALOG__INSTALLED_ENTRIES; - - /** - * The feature id for the '<em><b>Name</b></em>' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int CUSTOMIZATION_PROPERTIES_CATALOG__NAME = CatalogPackage.CATALOG__NAME; - - /** - * The number of structural features of the '<em>Customization Properties Catalog</em>' class. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int CUSTOMIZATION_PROPERTIES_CATALOG_FEATURE_COUNT = CatalogPackage.CATALOG_FEATURE_COUNT + 0; - - - /** - * Returns the meta object for class '{@link org.eclipse.emf.facet.custom.metamodel.v0_2_0.customizationcatalog.CustomizationCatalog <em>Customization Catalog</em>}'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the meta object for class '<em>Customization Catalog</em>'. - * @see org.eclipse.emf.facet.custom.metamodel.v0_2_0.customizationcatalog.CustomizationCatalog - * @generated - */ - EClass getCustomizationCatalog(); - - /** - * Returns the meta object for class '{@link org.eclipse.emf.facet.custom.metamodel.v0_2_0.customizationcatalog.CustomizationPropertiesCatalog <em>Customization Properties Catalog</em>}'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the meta object for class '<em>Customization Properties Catalog</em>'. - * @see org.eclipse.emf.facet.custom.metamodel.v0_2_0.customizationcatalog.CustomizationPropertiesCatalog - * @generated - */ - EClass getCustomizationPropertiesCatalog(); - - /** - * Returns the factory that creates the instances of the model. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the factory that creates the instances of the model. - * @generated - */ - CustomizationcatalogFactory getCustomizationcatalogFactory(); - - /** - * <!-- begin-user-doc --> - * Defines literals for the meta objects that represent - * <ul> - * <li>each class,</li> - * <li>each feature of each class,</li> - * <li>each enum,</li> - * <li>and each data type</li> - * </ul> - * <!-- end-user-doc --> - * @generated - */ - interface Literals { - /** - * The meta object literal for the '{@link org.eclipse.emf.facet.custom.metamodel.v0_2_0.customizationcatalog.impl.CustomizationCatalogImpl <em>Customization Catalog</em>}' class. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see org.eclipse.emf.facet.custom.metamodel.v0_2_0.customizationcatalog.impl.CustomizationCatalogImpl - * @see org.eclipse.emf.facet.custom.metamodel.v0_2_0.customizationcatalog.impl.CustomizationcatalogPackageImpl#getCustomizationCatalog() - * @generated - */ - EClass CUSTOMIZATION_CATALOG = eINSTANCE.getCustomizationCatalog(); - - /** - * The meta object literal for the '{@link org.eclipse.emf.facet.custom.metamodel.v0_2_0.customizationcatalog.impl.CustomizationPropertiesCatalogImpl <em>Customization Properties Catalog</em>}' class. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see org.eclipse.emf.facet.custom.metamodel.v0_2_0.customizationcatalog.impl.CustomizationPropertiesCatalogImpl - * @see org.eclipse.emf.facet.custom.metamodel.v0_2_0.customizationcatalog.impl.CustomizationcatalogPackageImpl#getCustomizationPropertiesCatalog() - * @generated - */ - EClass CUSTOMIZATION_PROPERTIES_CATALOG = eINSTANCE.getCustomizationPropertiesCatalog(); - - } - -} //CustomizationcatalogPackage
diff --git a/org.eclipse.modisco.facet.custom.metamodel/src/org/eclipse/emf/facet/custom/metamodel/v0_2_0/customizationcatalog/impl/CustomizationCatalogImpl.java b/org.eclipse.modisco.facet.custom.metamodel/src/org/eclipse/emf/facet/custom/metamodel/v0_2_0/customizationcatalog/impl/CustomizationCatalogImpl.java deleted file mode 100644 index d2c0505..0000000 --- a/org.eclipse.modisco.facet.custom.metamodel/src/org/eclipse/emf/facet/custom/metamodel/v0_2_0/customizationcatalog/impl/CustomizationCatalogImpl.java +++ /dev/null
@@ -1,217 +0,0 @@ -/** - * Copyright (c) 2011, 2015 Mia-Software. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Grégoire Dupé (Mia-Software) - Bug 361794 - [Restructuring] New customization meta-model - * Grégoire Dupé (Mia-Software) - Bug 373078 - API Cleaning - * Grégoire Dupé (Mia-Software) - Bug 477657 - The catalog manager should be able to manage workspace model - */ -package org.eclipse.emf.facet.custom.metamodel.v0_2_0.customizationcatalog.impl; - -import java.util.Collection; - -import org.eclipse.emf.common.notify.Notification; - -import org.eclipse.emf.common.util.EList; - -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.ecore.EObject; - -import org.eclipse.emf.ecore.impl.ENotificationImpl; -import org.eclipse.emf.ecore.impl.EObjectImpl; - -import org.eclipse.emf.ecore.util.EObjectResolvingEList; - -import org.eclipse.emf.facet.custom.metamodel.v0_2_0.customizationcatalog.CustomizationCatalog; -import org.eclipse.emf.facet.custom.metamodel.v0_2_0.customizationcatalog.CustomizationcatalogPackage; - -/** - * <!-- begin-user-doc --> - * An implementation of the model object '<em><b>Customization Catalog</b></em>'. - * <!-- end-user-doc --> - * <p> - * The following features are implemented: - * <ul> - * <li>{@link org.eclipse.emf.facet.custom.metamodel.v0_2_0.customizationcatalog.impl.CustomizationCatalogImpl#getInstalledEntries <em>Installed Entries</em>}</li> - * <li>{@link org.eclipse.emf.facet.custom.metamodel.v0_2_0.customizationcatalog.impl.CustomizationCatalogImpl#getName <em>Name</em>}</li> - * </ul> - * </p> - * - * @generated - */ -@Deprecated -public class CustomizationCatalogImpl extends EObjectImpl implements CustomizationCatalog { - /** - * The cached value of the '{@link #getInstalledEntries() <em>Installed Entries</em>}' reference list. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #getInstalledEntries() - * @generated - * @ordered - */ - protected EList<EObject> installedEntries; - - /** - * The default value of the '{@link #getName() <em>Name</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #getName() - * @generated - * @ordered - */ - protected static final String NAME_EDEFAULT = null; - - /** - * The cached value of the '{@link #getName() <em>Name</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #getName() - * @generated - * @ordered - */ - protected String name = NAME_EDEFAULT; - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected CustomizationCatalogImpl() { - super(); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - protected EClass eStaticClass() { - return CustomizationcatalogPackage.Literals.CUSTOMIZATION_CATALOG; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EList<EObject> getInstalledEntries() { - if (installedEntries == null) { - installedEntries = new EObjectResolvingEList<EObject>(EObject.class, this, CustomizationcatalogPackage.CUSTOMIZATION_CATALOG__INSTALLED_ENTRIES); - } - return installedEntries; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public String getName() { - return name; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public void setName(String newName) { - String oldName = name; - name = newName; - if (eNotificationRequired()) - eNotify(new ENotificationImpl(this, Notification.SET, CustomizationcatalogPackage.CUSTOMIZATION_CATALOG__NAME, oldName, name)); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public Object eGet(int featureID, boolean resolve, boolean coreType) { - switch (featureID) { - case CustomizationcatalogPackage.CUSTOMIZATION_CATALOG__INSTALLED_ENTRIES: - return getInstalledEntries(); - case CustomizationcatalogPackage.CUSTOMIZATION_CATALOG__NAME: - return getName(); - } - return super.eGet(featureID, resolve, coreType); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @SuppressWarnings("unchecked") - @Override - public void eSet(int featureID, Object newValue) { - switch (featureID) { - case CustomizationcatalogPackage.CUSTOMIZATION_CATALOG__INSTALLED_ENTRIES: - getInstalledEntries().clear(); - getInstalledEntries().addAll((Collection<? extends EObject>)newValue); - return; - case CustomizationcatalogPackage.CUSTOMIZATION_CATALOG__NAME: - setName((String)newValue); - return; - } - super.eSet(featureID, newValue); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public void eUnset(int featureID) { - switch (featureID) { - case CustomizationcatalogPackage.CUSTOMIZATION_CATALOG__INSTALLED_ENTRIES: - getInstalledEntries().clear(); - return; - case CustomizationcatalogPackage.CUSTOMIZATION_CATALOG__NAME: - setName(NAME_EDEFAULT); - return; - } - super.eUnset(featureID); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public boolean eIsSet(int featureID) { - switch (featureID) { - case CustomizationcatalogPackage.CUSTOMIZATION_CATALOG__INSTALLED_ENTRIES: - return installedEntries != null && !installedEntries.isEmpty(); - case CustomizationcatalogPackage.CUSTOMIZATION_CATALOG__NAME: - return NAME_EDEFAULT == null ? name != null : !NAME_EDEFAULT.equals(name); - } - return super.eIsSet(featureID); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public String toString() { - if (eIsProxy()) return super.toString(); - - StringBuffer result = new StringBuffer(super.toString()); - result.append(" (name: "); - result.append(name); - result.append(')'); - return result.toString(); - } - -} //CustomizationCatalogImpl
diff --git a/org.eclipse.modisco.facet.custom.metamodel/src/org/eclipse/emf/facet/custom/metamodel/v0_2_0/customizationcatalog/impl/CustomizationPropertiesCatalogImpl.java b/org.eclipse.modisco.facet.custom.metamodel/src/org/eclipse/emf/facet/custom/metamodel/v0_2_0/customizationcatalog/impl/CustomizationPropertiesCatalogImpl.java deleted file mode 100644 index fe36ce8..0000000 --- a/org.eclipse.modisco.facet.custom.metamodel/src/org/eclipse/emf/facet/custom/metamodel/v0_2_0/customizationcatalog/impl/CustomizationPropertiesCatalogImpl.java +++ /dev/null
@@ -1,217 +0,0 @@ -/** - * Copyright (c) 2011, 2015 Mia-Software. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Grégoire Dupé (Mia-Software) - Bug 361794 - [Restructuring] New customization meta-model - * Grégoire Dupé (Mia-Software) - Bug 373078 - API Cleaning - * Grégoire Dupé (Mia-Software) - Bug 477657 - The catalog manager should be able to manage workspace model - */ -package org.eclipse.emf.facet.custom.metamodel.v0_2_0.customizationcatalog.impl; - -import java.util.Collection; - -import org.eclipse.emf.common.notify.Notification; - -import org.eclipse.emf.common.util.EList; - -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.ecore.EObject; - -import org.eclipse.emf.ecore.impl.ENotificationImpl; -import org.eclipse.emf.ecore.impl.EObjectImpl; - -import org.eclipse.emf.ecore.util.EObjectResolvingEList; - -import org.eclipse.emf.facet.custom.metamodel.v0_2_0.customizationcatalog.CustomizationPropertiesCatalog; -import org.eclipse.emf.facet.custom.metamodel.v0_2_0.customizationcatalog.CustomizationcatalogPackage; - -/** - * <!-- begin-user-doc --> - * An implementation of the model object '<em><b>Customization Properties Catalog</b></em>'. - * <!-- end-user-doc --> - * <p> - * The following features are implemented: - * <ul> - * <li>{@link org.eclipse.emf.facet.custom.metamodel.v0_2_0.customizationcatalog.impl.CustomizationPropertiesCatalogImpl#getInstalledEntries <em>Installed Entries</em>}</li> - * <li>{@link org.eclipse.emf.facet.custom.metamodel.v0_2_0.customizationcatalog.impl.CustomizationPropertiesCatalogImpl#getName <em>Name</em>}</li> - * </ul> - * </p> - * - * @generated - */ -@Deprecated -public class CustomizationPropertiesCatalogImpl extends EObjectImpl implements CustomizationPropertiesCatalog { - /** - * The cached value of the '{@link #getInstalledEntries() <em>Installed Entries</em>}' reference list. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #getInstalledEntries() - * @generated - * @ordered - */ - protected EList<EObject> installedEntries; - - /** - * The default value of the '{@link #getName() <em>Name</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #getName() - * @generated - * @ordered - */ - protected static final String NAME_EDEFAULT = null; - - /** - * The cached value of the '{@link #getName() <em>Name</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #getName() - * @generated - * @ordered - */ - protected String name = NAME_EDEFAULT; - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected CustomizationPropertiesCatalogImpl() { - super(); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - protected EClass eStaticClass() { - return CustomizationcatalogPackage.Literals.CUSTOMIZATION_PROPERTIES_CATALOG; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EList<EObject> getInstalledEntries() { - if (installedEntries == null) { - installedEntries = new EObjectResolvingEList<EObject>(EObject.class, this, CustomizationcatalogPackage.CUSTOMIZATION_PROPERTIES_CATALOG__INSTALLED_ENTRIES); - } - return installedEntries; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public String getName() { - return name; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public void setName(String newName) { - String oldName = name; - name = newName; - if (eNotificationRequired()) - eNotify(new ENotificationImpl(this, Notification.SET, CustomizationcatalogPackage.CUSTOMIZATION_PROPERTIES_CATALOG__NAME, oldName, name)); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public Object eGet(int featureID, boolean resolve, boolean coreType) { - switch (featureID) { - case CustomizationcatalogPackage.CUSTOMIZATION_PROPERTIES_CATALOG__INSTALLED_ENTRIES: - return getInstalledEntries(); - case CustomizationcatalogPackage.CUSTOMIZATION_PROPERTIES_CATALOG__NAME: - return getName(); - } - return super.eGet(featureID, resolve, coreType); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @SuppressWarnings("unchecked") - @Override - public void eSet(int featureID, Object newValue) { - switch (featureID) { - case CustomizationcatalogPackage.CUSTOMIZATION_PROPERTIES_CATALOG__INSTALLED_ENTRIES: - getInstalledEntries().clear(); - getInstalledEntries().addAll((Collection<? extends EObject>)newValue); - return; - case CustomizationcatalogPackage.CUSTOMIZATION_PROPERTIES_CATALOG__NAME: - setName((String)newValue); - return; - } - super.eSet(featureID, newValue); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public void eUnset(int featureID) { - switch (featureID) { - case CustomizationcatalogPackage.CUSTOMIZATION_PROPERTIES_CATALOG__INSTALLED_ENTRIES: - getInstalledEntries().clear(); - return; - case CustomizationcatalogPackage.CUSTOMIZATION_PROPERTIES_CATALOG__NAME: - setName(NAME_EDEFAULT); - return; - } - super.eUnset(featureID); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public boolean eIsSet(int featureID) { - switch (featureID) { - case CustomizationcatalogPackage.CUSTOMIZATION_PROPERTIES_CATALOG__INSTALLED_ENTRIES: - return installedEntries != null && !installedEntries.isEmpty(); - case CustomizationcatalogPackage.CUSTOMIZATION_PROPERTIES_CATALOG__NAME: - return NAME_EDEFAULT == null ? name != null : !NAME_EDEFAULT.equals(name); - } - return super.eIsSet(featureID); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public String toString() { - if (eIsProxy()) return super.toString(); - - StringBuffer result = new StringBuffer(super.toString()); - result.append(" (name: "); - result.append(name); - result.append(')'); - return result.toString(); - } - -} //CustomizationPropertiesCatalogImpl
diff --git a/org.eclipse.modisco.facet.custom.metamodel/src/org/eclipse/emf/facet/custom/metamodel/v0_2_0/customizationcatalog/impl/CustomizationcatalogFactoryImpl.java b/org.eclipse.modisco.facet.custom.metamodel/src/org/eclipse/emf/facet/custom/metamodel/v0_2_0/customizationcatalog/impl/CustomizationcatalogFactoryImpl.java deleted file mode 100644 index 37139b3..0000000 --- a/org.eclipse.modisco.facet.custom.metamodel/src/org/eclipse/emf/facet/custom/metamodel/v0_2_0/customizationcatalog/impl/CustomizationcatalogFactoryImpl.java +++ /dev/null
@@ -1,118 +0,0 @@ -/** - * Copyright (c) 2011, 2015 Mia-Software. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Grégoire Dupé (Mia-Software) - Bug 361794 - [Restructuring] New customization meta-model - * Grégoire Dupé (Mia-Software) - Bug 373078 - API Cleaning - * Grégoire Dupé (Mia-Software) - Bug 477657 - The catalog manager should be able to manage workspace model - */ -package org.eclipse.emf.facet.custom.metamodel.v0_2_0.customizationcatalog.impl; - -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.EPackage; - -import org.eclipse.emf.ecore.impl.EFactoryImpl; - -import org.eclipse.emf.ecore.plugin.EcorePlugin; - -import org.eclipse.emf.facet.custom.metamodel.v0_2_0.customizationcatalog.*; - -/** - * <!-- begin-user-doc --> - * An implementation of the model <b>Factory</b>. - * <!-- end-user-doc --> - * @generated - */ -@Deprecated -public class CustomizationcatalogFactoryImpl extends EFactoryImpl implements CustomizationcatalogFactory { - /** - * Creates the default factory implementation. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public static CustomizationcatalogFactory init() { - try { - CustomizationcatalogFactory theCustomizationcatalogFactory = (CustomizationcatalogFactory)EPackage.Registry.INSTANCE.getEFactory("http://www.eclipse.org/emf/facet/custom/0.2.internal/customizationcatalog"); - if (theCustomizationcatalogFactory != null) { - return theCustomizationcatalogFactory; - } - } - catch (Exception exception) { - EcorePlugin.INSTANCE.log(exception); - } - return new CustomizationcatalogFactoryImpl(); - } - - /** - * Creates an instance of the factory. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public CustomizationcatalogFactoryImpl() { - super(); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public EObject create(EClass eClass) { - switch (eClass.getClassifierID()) { - case CustomizationcatalogPackage.CUSTOMIZATION_CATALOG: return createCustomizationCatalog(); - case CustomizationcatalogPackage.CUSTOMIZATION_PROPERTIES_CATALOG: return createCustomizationPropertiesCatalog(); - default: - throw new IllegalArgumentException("The class '" + eClass.getName() + "' is not a valid classifier"); - } - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public CustomizationCatalog createCustomizationCatalog() { - CustomizationCatalogImpl customizationCatalog = new CustomizationCatalogImpl(); - return customizationCatalog; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public CustomizationPropertiesCatalog createCustomizationPropertiesCatalog() { - CustomizationPropertiesCatalogImpl customizationPropertiesCatalog = new CustomizationPropertiesCatalogImpl(); - return customizationPropertiesCatalog; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public CustomizationcatalogPackage getCustomizationcatalogPackage() { - return (CustomizationcatalogPackage)getEPackage(); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @deprecated - * @generated - */ - @Deprecated - public static CustomizationcatalogPackage getPackage() { - return CustomizationcatalogPackage.eINSTANCE; - } - -} //CustomizationcatalogFactoryImpl
diff --git a/org.eclipse.modisco.facet.custom.metamodel/src/org/eclipse/emf/facet/custom/metamodel/v0_2_0/customizationcatalog/impl/CustomizationcatalogPackageImpl.java b/org.eclipse.modisco.facet.custom.metamodel/src/org/eclipse/emf/facet/custom/metamodel/v0_2_0/customizationcatalog/impl/CustomizationcatalogPackageImpl.java deleted file mode 100644 index 65b6af4..0000000 --- a/org.eclipse.modisco.facet.custom.metamodel/src/org/eclipse/emf/facet/custom/metamodel/v0_2_0/customizationcatalog/impl/CustomizationcatalogPackageImpl.java +++ /dev/null
@@ -1,208 +0,0 @@ -/** - * Copyright (c) 2011, 2015 Mia-Software. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Grégoire Dupé (Mia-Software) - Bug 361794 - [Restructuring] New customization meta-model - * Grégoire Dupé (Mia-Software) - Bug 373078 - API Cleaning - * Grégoire Dupé (Mia-Software) - Bug 477657 - The catalog manager should be able to manage workspace model - */ -package org.eclipse.emf.facet.custom.metamodel.v0_2_0.customizationcatalog.impl; - -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.ecore.EPackage; - -import org.eclipse.emf.ecore.impl.EPackageImpl; - -import org.eclipse.emf.facet.custom.metamodel.v0_2_0.customizationcatalog.CustomizationCatalog; -import org.eclipse.emf.facet.custom.metamodel.v0_2_0.customizationcatalog.CustomizationPropertiesCatalog; -import org.eclipse.emf.facet.custom.metamodel.v0_2_0.customizationcatalog.CustomizationcatalogFactory; -import org.eclipse.emf.facet.custom.metamodel.v0_2_0.customizationcatalog.CustomizationcatalogPackage; - -import org.eclipse.emf.facet.util.emf.catalog.CatalogPackage; - -/** - * <!-- begin-user-doc --> - * An implementation of the model <b>Package</b>. - * <!-- end-user-doc --> - * @generated - */ -@Deprecated -public class CustomizationcatalogPackageImpl extends EPackageImpl implements CustomizationcatalogPackage { - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - private EClass customizationCatalogEClass = null; - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - private EClass customizationPropertiesCatalogEClass = null; - - /** - * Creates an instance of the model <b>Package</b>, registered with - * {@link org.eclipse.emf.ecore.EPackage.Registry EPackage.Registry} by the package - * package URI value. - * <p>Note: the correct way to create the package is via the static - * factory method {@link #init init()}, which also performs - * initialization of the package, or returns the registered package, - * if one already exists. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see org.eclipse.emf.ecore.EPackage.Registry - * @see org.eclipse.emf.facet.custom.metamodel.v0_2_0.customizationcatalog.CustomizationcatalogPackage#eNS_URI - * @see #init() - * @generated - */ - private CustomizationcatalogPackageImpl() { - super(eNS_URI, CustomizationcatalogFactory.eINSTANCE); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - private static boolean isInited = false; - - /** - * Creates, registers, and initializes the <b>Package</b> for this model, and for any others upon which it depends. - * - * <p>This method is used to initialize {@link CustomizationcatalogPackage#eINSTANCE} when that field is accessed. - * Clients should not invoke it directly. Instead, they should simply access that field to obtain the package. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #eNS_URI - * @see #createPackageContents() - * @see #initializePackageContents() - * @generated - */ - public static CustomizationcatalogPackage init() { - if (isInited) return (CustomizationcatalogPackage)EPackage.Registry.INSTANCE.getEPackage(CustomizationcatalogPackage.eNS_URI); - - // Obtain or create and register package - CustomizationcatalogPackageImpl theCustomizationcatalogPackage = (CustomizationcatalogPackageImpl)(EPackage.Registry.INSTANCE.get(eNS_URI) instanceof CustomizationcatalogPackageImpl ? EPackage.Registry.INSTANCE.get(eNS_URI) : new CustomizationcatalogPackageImpl()); - - isInited = true; - - // Initialize simple dependencies - CatalogPackage.eINSTANCE.eClass(); - - // Create package meta-data objects - theCustomizationcatalogPackage.createPackageContents(); - - // Initialize created meta-data - theCustomizationcatalogPackage.initializePackageContents(); - - // Mark meta-data to indicate it can't be changed - theCustomizationcatalogPackage.freeze(); - - - // Update the registry and return the package - EPackage.Registry.INSTANCE.put(CustomizationcatalogPackage.eNS_URI, theCustomizationcatalogPackage); - return theCustomizationcatalogPackage; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EClass getCustomizationCatalog() { - return customizationCatalogEClass; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EClass getCustomizationPropertiesCatalog() { - return customizationPropertiesCatalogEClass; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public CustomizationcatalogFactory getCustomizationcatalogFactory() { - return (CustomizationcatalogFactory)getEFactoryInstance(); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - private boolean isCreated = false; - - /** - * Creates the meta-model objects for the package. This method is - * guarded to have no affect on any invocation but its first. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public void createPackageContents() { - if (isCreated) return; - isCreated = true; - - // Create classes and their features - customizationCatalogEClass = createEClass(CUSTOMIZATION_CATALOG); - - customizationPropertiesCatalogEClass = createEClass(CUSTOMIZATION_PROPERTIES_CATALOG); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - private boolean isInitialized = false; - - /** - * Complete the initialization of the package and its meta-model. This - * method is guarded to have no affect on any invocation but its first. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public void initializePackageContents() { - if (isInitialized) return; - isInitialized = true; - - // Initialize package - setName(eNAME); - setNsPrefix(eNS_PREFIX); - setNsURI(eNS_URI); - - // Obtain other dependent packages - CatalogPackage theCatalogPackage = (CatalogPackage)EPackage.Registry.INSTANCE.getEPackage(CatalogPackage.eNS_URI); - - // Create type parameters - - // Set bounds for type parameters - - // Add supertypes to classes - customizationCatalogEClass.getESuperTypes().add(theCatalogPackage.getCatalog()); - customizationPropertiesCatalogEClass.getESuperTypes().add(theCatalogPackage.getCatalog()); - - // Initialize classes and features; add operations and parameters - initEClass(customizationCatalogEClass, CustomizationCatalog.class, "CustomizationCatalog", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); - - initEClass(customizationPropertiesCatalogEClass, CustomizationPropertiesCatalog.class, "CustomizationPropertiesCatalog", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); - - // Create resource - createResource(eNS_URI); - } - -} //CustomizationcatalogPackageImpl
diff --git a/org.eclipse.modisco.facet.custom.metamodel/src/org/eclipse/emf/facet/custom/metamodel/v0_2_0/customizationcatalog/util/CustomizationcatalogAdapterFactory.java b/org.eclipse.modisco.facet.custom.metamodel/src/org/eclipse/emf/facet/custom/metamodel/v0_2_0/customizationcatalog/util/CustomizationcatalogAdapterFactory.java deleted file mode 100644 index 3a1379e..0000000 --- a/org.eclipse.modisco.facet.custom.metamodel/src/org/eclipse/emf/facet/custom/metamodel/v0_2_0/customizationcatalog/util/CustomizationcatalogAdapterFactory.java +++ /dev/null
@@ -1,170 +0,0 @@ -/** - * Copyright (c) 2011, 2015 Mia-Software. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Grégoire Dupé (Mia-Software) - Bug 361794 - [Restructuring] New customization meta-model - * Grégoire Dupé (Mia-Software) - Bug 373078 - API Cleaning - * Grégoire Dupé (Mia-Software) - Bug 477657 - The catalog manager should be able to manage workspace model - */ -package org.eclipse.emf.facet.custom.metamodel.v0_2_0.customizationcatalog.util; - -import org.eclipse.emf.common.notify.Adapter; -import org.eclipse.emf.common.notify.Notifier; - -import org.eclipse.emf.common.notify.impl.AdapterFactoryImpl; - -import org.eclipse.emf.ecore.EObject; - -import org.eclipse.emf.facet.custom.metamodel.v0_2_0.customizationcatalog.*; - -import org.eclipse.emf.facet.util.emf.catalog.Catalog; - -/** - * <!-- begin-user-doc --> - * The <b>Adapter Factory</b> for the model. - * It provides an adapter <code>createXXX</code> method for each class of the model. - * <!-- end-user-doc --> - * @see org.eclipse.emf.facet.custom.metamodel.v0_2_0.customizationcatalog.CustomizationcatalogPackage - * @generated - */ -@Deprecated -public class CustomizationcatalogAdapterFactory extends AdapterFactoryImpl { - /** - * The cached model package. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected static CustomizationcatalogPackage modelPackage; - - /** - * Creates an instance of the adapter factory. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public CustomizationcatalogAdapterFactory() { - if (modelPackage == null) { - modelPackage = CustomizationcatalogPackage.eINSTANCE; - } - } - - /** - * Returns whether this factory is applicable for the type of the object. - * <!-- begin-user-doc --> - * This implementation returns <code>true</code> if the object is either the model's package or is an instance object of the model. - * <!-- end-user-doc --> - * @return whether this factory is applicable for the type of the object. - * @generated - */ - @Override - public boolean isFactoryForType(Object object) { - if (object == modelPackage) { - return true; - } - if (object instanceof EObject) { - return ((EObject)object).eClass().getEPackage() == modelPackage; - } - return false; - } - - /** - * The switch that delegates to the <code>createXXX</code> methods. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected CustomizationcatalogSwitch<Adapter> modelSwitch = - new CustomizationcatalogSwitch<Adapter>() { - @Override - public Adapter caseCustomizationCatalog(CustomizationCatalog object) { - return createCustomizationCatalogAdapter(); - } - @Override - public Adapter caseCustomizationPropertiesCatalog(CustomizationPropertiesCatalog object) { - return createCustomizationPropertiesCatalogAdapter(); - } - @Override - public Adapter caseCatalog(Catalog object) { - return createCatalogAdapter(); - } - @Override - public Adapter defaultCase(EObject object) { - return createEObjectAdapter(); - } - }; - - /** - * Creates an adapter for the <code>target</code>. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @param target the object to adapt. - * @return the adapter for the <code>target</code>. - * @generated - */ - @Override - public Adapter createAdapter(Notifier target) { - return modelSwitch.doSwitch((EObject)target); - } - - - /** - * Creates a new adapter for an object of class '{@link org.eclipse.emf.facet.custom.metamodel.v0_2_0.customizationcatalog.CustomizationCatalog <em>Customization Catalog</em>}'. - * <!-- begin-user-doc --> - * This default implementation returns null so that we can easily ignore cases; - * it's useful to ignore a case when inheritance will catch all the cases anyway. - * <!-- end-user-doc --> - * @return the new adapter. - * @see org.eclipse.emf.facet.custom.metamodel.v0_2_0.customizationcatalog.CustomizationCatalog - * @generated - */ - public Adapter createCustomizationCatalogAdapter() { - return null; - } - - /** - * Creates a new adapter for an object of class '{@link org.eclipse.emf.facet.custom.metamodel.v0_2_0.customizationcatalog.CustomizationPropertiesCatalog <em>Customization Properties Catalog</em>}'. - * <!-- begin-user-doc --> - * This default implementation returns null so that we can easily ignore cases; - * it's useful to ignore a case when inheritance will catch all the cases anyway. - * <!-- end-user-doc --> - * @return the new adapter. - * @see org.eclipse.emf.facet.custom.metamodel.v0_2_0.customizationcatalog.CustomizationPropertiesCatalog - * @generated - */ - public Adapter createCustomizationPropertiesCatalogAdapter() { - return null; - } - - /** - * Creates a new adapter for an object of class '{@link org.eclipse.emf.facet.util.emf.catalog.Catalog <em>Catalog</em>}'. - * <!-- begin-user-doc --> - * This default implementation returns null so that we can easily ignore cases; - * it's useful to ignore a case when inheritance will catch all the cases anyway. - * <!-- end-user-doc --> - * @return the new adapter. - * @see org.eclipse.emf.facet.util.emf.catalog.Catalog - * @generated - */ - public Adapter createCatalogAdapter() { - return null; - } - - /** - * Creates a new adapter for the default case. - * <!-- begin-user-doc --> - * This default implementation returns null. - * <!-- end-user-doc --> - * @return the new adapter. - * @generated - */ - public Adapter createEObjectAdapter() { - return null; - } - -} //CustomizationcatalogAdapterFactory
diff --git a/org.eclipse.modisco.facet.custom.metamodel/src/org/eclipse/emf/facet/custom/metamodel/v0_2_0/customizationcatalog/util/CustomizationcatalogSwitch.java b/org.eclipse.modisco.facet.custom.metamodel/src/org/eclipse/emf/facet/custom/metamodel/v0_2_0/customizationcatalog/util/CustomizationcatalogSwitch.java deleted file mode 100644 index 80a350a..0000000 --- a/org.eclipse.modisco.facet.custom.metamodel/src/org/eclipse/emf/facet/custom/metamodel/v0_2_0/customizationcatalog/util/CustomizationcatalogSwitch.java +++ /dev/null
@@ -1,178 +0,0 @@ -/** - * Copyright (c) 2011, 2015 Mia-Software. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Grégoire Dupé (Mia-Software) - Bug 361794 - [Restructuring] New customization meta-model - * Grégoire Dupé (Mia-Software) - Bug 373078 - API Cleaning - * Grégoire Dupé (Mia-Software) - Bug 477657 - The catalog manager should be able to manage workspace model - */ -package org.eclipse.emf.facet.custom.metamodel.v0_2_0.customizationcatalog.util; - -import java.util.List; - -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.ecore.EObject; - -import org.eclipse.emf.facet.custom.metamodel.v0_2_0.customizationcatalog.*; - -import org.eclipse.emf.facet.util.emf.catalog.Catalog; - -/** - * <!-- begin-user-doc --> - * The <b>Switch</b> for the model's inheritance hierarchy. - * It supports the call {@link #doSwitch(EObject) doSwitch(object)} - * to invoke the <code>caseXXX</code> method for each class of the model, - * starting with the actual class of the object - * and proceeding up the inheritance hierarchy - * until a non-null result is returned, - * which is the result of the switch. - * <!-- end-user-doc --> - * @see org.eclipse.emf.facet.custom.metamodel.v0_2_0.customizationcatalog.CustomizationcatalogPackage - * @generated - */ -@Deprecated -public class CustomizationcatalogSwitch<T> { - /** - * The cached model package - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected static CustomizationcatalogPackage modelPackage; - - /** - * Creates an instance of the switch. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public CustomizationcatalogSwitch() { - if (modelPackage == null) { - modelPackage = CustomizationcatalogPackage.eINSTANCE; - } - } - - /** - * Calls <code>caseXXX</code> for each class of the model until one returns a non null result; it yields that result. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the first non-null result returned by a <code>caseXXX</code> call. - * @generated - */ - public T doSwitch(EObject theEObject) { - return doSwitch(theEObject.eClass(), theEObject); - } - - /** - * Calls <code>caseXXX</code> for each class of the model until one returns a non null result; it yields that result. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the first non-null result returned by a <code>caseXXX</code> call. - * @generated - */ - protected T doSwitch(EClass theEClass, EObject theEObject) { - if (theEClass.eContainer() == modelPackage) { - return doSwitch(theEClass.getClassifierID(), theEObject); - } - else { - List<EClass> eSuperTypes = theEClass.getESuperTypes(); - return - eSuperTypes.isEmpty() ? - defaultCase(theEObject) : - doSwitch(eSuperTypes.get(0), theEObject); - } - } - - /** - * Calls <code>caseXXX</code> for each class of the model until one returns a non null result; it yields that result. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the first non-null result returned by a <code>caseXXX</code> call. - * @generated - */ - protected T doSwitch(int classifierID, EObject theEObject) { - switch (classifierID) { - case CustomizationcatalogPackage.CUSTOMIZATION_CATALOG: { - CustomizationCatalog customizationCatalog = (CustomizationCatalog)theEObject; - T result = caseCustomizationCatalog(customizationCatalog); - if (result == null) result = caseCatalog(customizationCatalog); - if (result == null) result = defaultCase(theEObject); - return result; - } - case CustomizationcatalogPackage.CUSTOMIZATION_PROPERTIES_CATALOG: { - CustomizationPropertiesCatalog customizationPropertiesCatalog = (CustomizationPropertiesCatalog)theEObject; - T result = caseCustomizationPropertiesCatalog(customizationPropertiesCatalog); - if (result == null) result = caseCatalog(customizationPropertiesCatalog); - if (result == null) result = defaultCase(theEObject); - return result; - } - default: return defaultCase(theEObject); - } - } - - /** - * Returns the result of interpreting the object as an instance of '<em>Customization Catalog</em>'. - * <!-- begin-user-doc --> - * This implementation returns null; - * returning a non-null result will terminate the switch. - * <!-- end-user-doc --> - * @param object the target of the switch. - * @return the result of interpreting the object as an instance of '<em>Customization Catalog</em>'. - * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) - * @generated - */ - public T caseCustomizationCatalog(CustomizationCatalog object) { - return null; - } - - /** - * Returns the result of interpreting the object as an instance of '<em>Customization Properties Catalog</em>'. - * <!-- begin-user-doc --> - * This implementation returns null; - * returning a non-null result will terminate the switch. - * <!-- end-user-doc --> - * @param object the target of the switch. - * @return the result of interpreting the object as an instance of '<em>Customization Properties Catalog</em>'. - * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) - * @generated - */ - public T caseCustomizationPropertiesCatalog(CustomizationPropertiesCatalog object) { - return null; - } - - /** - * Returns the result of interpreting the object as an instance of '<em>Catalog</em>'. - * <!-- begin-user-doc --> - * This implementation returns null; - * returning a non-null result will terminate the switch. - * <!-- end-user-doc --> - * @param object the target of the switch. - * @return the result of interpreting the object as an instance of '<em>Catalog</em>'. - * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) - * @generated - */ - public T caseCatalog(Catalog object) { - return null; - } - - /** - * Returns the result of interpreting the object as an instance of '<em>EObject</em>'. - * <!-- begin-user-doc --> - * This implementation returns null; - * returning a non-null result will terminate the switch, but this is the last case anyway. - * <!-- end-user-doc --> - * @param object the target of the switch. - * @return the result of interpreting the object as an instance of '<em>EObject</em>'. - * @see #doSwitch(org.eclipse.emf.ecore.EObject) - * @generated - */ - public T defaultCase(EObject object) { - return null; - } - -} //CustomizationcatalogSwitch
diff --git a/org.eclipse.modisco.facet.custom.metamodel/src/org/eclipse/emf/facet/custom/metamodel/v0_2_0/custompt/Alignment.java b/org.eclipse.modisco.facet.custom.metamodel/src/org/eclipse/emf/facet/custom/metamodel/v0_2_0/custompt/Alignment.java deleted file mode 100644 index 125cd53..0000000 --- a/org.eclipse.modisco.facet.custom.metamodel/src/org/eclipse/emf/facet/custom/metamodel/v0_2_0/custompt/Alignment.java +++ /dev/null
@@ -1,246 +0,0 @@ -/** - * Copyright (c) 2012 Mia-Software. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Gregoire Dupe (Mia-Software) - Bug 361794 - [Restructuring] New customization meta-model - * Vincent Lorenzo (CEA-LIST) - Bug 372644 - Create Customizable tooltips for the TreeViewer using a CustomizableLabelProvider - * - */ -package org.eclipse.emf.facet.custom.metamodel.v0_2_0.custompt; - -import java.util.Arrays; -import java.util.Collections; -import java.util.List; - -import org.eclipse.emf.common.util.Enumerator; - -/** - * <!-- begin-user-doc --> - * A representation of the literals of the enumeration '<em><b>Alignment</b></em>', - * and utility methods for working with them. - * <!-- end-user-doc --> - * @see org.eclipse.emf.facet.custom.metamodel.v0_2_0.custompt.CustomptPackage#getAlignment() - * @model - * @generated - */ -public enum Alignment implements Enumerator { - /** - * The '<em><b>LEFT</b></em>' literal object. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #LEFT_VALUE - * @generated - * @ordered - */ - LEFT(0, "LEFT", "LEFT"), - - /** - * The '<em><b>CENTER</b></em>' literal object. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #CENTER_VALUE - * @generated - * @ordered - */ - CENTER(1, "CENTER", "CENTER"), - - /** - * The '<em><b>RIGHT</b></em>' literal object. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #RIGHT_VALUE - * @generated - * @ordered - */ - RIGHT(2, "RIGHT", "RIGHT"); - - /** - * The '<em><b>LEFT</b></em>' literal value. - * <!-- begin-user-doc --> - * <p> - * If the meaning of '<em><b>LEFT</b></em>' literal object isn't clear, - * there really should be more of a description here... - * </p> - * <!-- end-user-doc --> - * @see #LEFT - * @model - * @generated - * @ordered - */ - public static final int LEFT_VALUE = 0; - - /** - * The '<em><b>CENTER</b></em>' literal value. - * <!-- begin-user-doc --> - * <p> - * If the meaning of '<em><b>CENTER</b></em>' literal object isn't clear, - * there really should be more of a description here... - * </p> - * <!-- end-user-doc --> - * @see #CENTER - * @model - * @generated - * @ordered - */ - public static final int CENTER_VALUE = 1; - - /** - * The '<em><b>RIGHT</b></em>' literal value. - * <!-- begin-user-doc --> - * <p> - * If the meaning of '<em><b>RIGHT</b></em>' literal object isn't clear, - * there really should be more of a description here... - * </p> - * <!-- end-user-doc --> - * @see #RIGHT - * @model - * @generated - * @ordered - */ - public static final int RIGHT_VALUE = 2; - - /** - * An array of all the '<em><b>Alignment</b></em>' enumerators. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - private static final Alignment[] VALUES_ARRAY = - new Alignment[] { - LEFT, - CENTER, - RIGHT, - }; - - /** - * A public read-only list of all the '<em><b>Alignment</b></em>' enumerators. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public static final List<Alignment> VALUES = Collections.unmodifiableList(Arrays.asList(VALUES_ARRAY)); - - /** - * Returns the '<em><b>Alignment</b></em>' literal with the specified literal value. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public static Alignment get(String literal) { - for (int i = 0; i < VALUES_ARRAY.length; ++i) { - Alignment result = VALUES_ARRAY[i]; - if (result.toString().equals(literal)) { - return result; - } - } - return null; - } - - /** - * Returns the '<em><b>Alignment</b></em>' literal with the specified name. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public static Alignment getByName(String name) { - for (int i = 0; i < VALUES_ARRAY.length; ++i) { - Alignment result = VALUES_ARRAY[i]; - if (result.getName().equals(name)) { - return result; - } - } - return null; - } - - /** - * Returns the '<em><b>Alignment</b></em>' literal with the specified integer value. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public static Alignment get(int value) { - switch (value) { - case LEFT_VALUE: return LEFT; - case CENTER_VALUE: return CENTER; - case RIGHT_VALUE: return RIGHT; - } - return null; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - private final int value; - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - private final String name; - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - private final String literal; - - /** - * Only this class can construct instances. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - private Alignment(int value, String name, String literal) { - this.value = value; - this.name = name; - this.literal = literal; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public int getValue() { - return value; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public String getName() { - return name; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public String getLiteral() { - return literal; - } - - /** - * Returns the literal value of the enumerator, which is its string representation. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public String toString() { - return literal; - } - -} //Alignment
diff --git a/org.eclipse.modisco.facet.custom.metamodel/src/org/eclipse/emf/facet/custom/metamodel/v0_2_0/custompt/CustomptFactory.java b/org.eclipse.modisco.facet.custom.metamodel/src/org/eclipse/emf/facet/custom/metamodel/v0_2_0/custompt/CustomptFactory.java deleted file mode 100644 index 20dd0be..0000000 --- a/org.eclipse.modisco.facet.custom.metamodel/src/org/eclipse/emf/facet/custom/metamodel/v0_2_0/custompt/CustomptFactory.java +++ /dev/null
@@ -1,45 +0,0 @@ -/** - * Copyright (c) 2012 Mia-Software. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Gregoire Dupe (Mia-Software) - Bug 361794 - [Restructuring] New customization meta-model - * - * - */ -package org.eclipse.emf.facet.custom.metamodel.v0_2_0.custompt; - -import org.eclipse.emf.ecore.EFactory; - -/** - * <!-- begin-user-doc --> The <b>Factory</b> for the model. It provides a - * create method for each non-abstract class of the model. <!-- end-user-doc --> - * - * @see org.eclipse.emf.facet.custom.metamodel.v0_2_0.custompt.CustomptPackage - * @generated - * @noextend This interface is not intended to be extended by clients. - * @noimplement This interface is not intended to be implemented by clients. - */ -public interface CustomptFactory extends EFactory { - /** - * The singleton instance of the factory. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - CustomptFactory eINSTANCE = org.eclipse.emf.facet.custom.metamodel.v0_2_0.custompt.impl.CustomptFactoryImpl.init(); - - /** - * Returns the package supported by this factory. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the package supported by this factory. - * @generated - */ - CustomptPackage getCustomptPackage(); - -} //CustomptFactory
diff --git a/org.eclipse.modisco.facet.custom.metamodel/src/org/eclipse/emf/facet/custom/metamodel/v0_2_0/custompt/CustomptPackage.java b/org.eclipse.modisco.facet.custom.metamodel/src/org/eclipse/emf/facet/custom/metamodel/v0_2_0/custompt/CustomptPackage.java deleted file mode 100644 index 235af21..0000000 --- a/org.eclipse.modisco.facet.custom.metamodel/src/org/eclipse/emf/facet/custom/metamodel/v0_2_0/custompt/CustomptPackage.java +++ /dev/null
@@ -1,214 +0,0 @@ -/** - * Copyright (c) 2012 Mia-Software. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Gregoire Dupe (Mia-Software) - Bug 361794 - [Restructuring] New customization meta-model - * - * - */ -package org.eclipse.emf.facet.custom.metamodel.v0_2_0.custompt; - -import org.eclipse.emf.ecore.EDataType; -import org.eclipse.emf.ecore.EEnum; -import org.eclipse.emf.ecore.EPackage; - -/** - * <!-- begin-user-doc --> - * The <b>Package</b> for the model. - * It contains accessors for the meta objects to represent - * <ul> - * <li>each class,</li> - * <li>each feature of each class,</li> - * <li>each enum,</li> - * <li>and each data type</li> - * </ul> - * <!-- end-user-doc --> - * @see org.eclipse.emf.facet.custom.metamodel.v0_2_0.custompt.CustomptFactory - * @model kind="package" - * @generated - */ -public interface CustomptPackage extends EPackage { - /** - * The package name. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - String eNAME = "custompt"; - - /** - * The package namespace URI. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - String eNS_URI = "http://www.eclipse.org/emf/facet/custom/0.2.incubation/custom_primitive_types"; - - /** - * The package namespace name. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - String eNS_PREFIX = "custompt"; - - /** - * The singleton instance of the package. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - CustomptPackage eINSTANCE = org.eclipse.emf.facet.custom.metamodel.v0_2_0.custompt.impl.CustomptPackageImpl.init(); - - /** - * The meta object id for the '{@link org.eclipse.emf.facet.custom.metamodel.v0_2_0.custompt.Shadow <em>Shadow</em>}' enum. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see org.eclipse.emf.facet.custom.metamodel.v0_2_0.custompt.Shadow - * @see org.eclipse.emf.facet.custom.metamodel.v0_2_0.custompt.impl.CustomptPackageImpl#getShadow() - * @generated - */ - int SHADOW = 0; - - /** - * The meta object id for the '{@link org.eclipse.emf.facet.custom.metamodel.v0_2_0.custompt.Alignment <em>Alignment</em>}' enum. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see org.eclipse.emf.facet.custom.metamodel.v0_2_0.custompt.Alignment - * @see org.eclipse.emf.facet.custom.metamodel.v0_2_0.custompt.impl.CustomptPackageImpl#getAlignment() - * @generated - */ - int ALIGNMENT = 1; - - /** - * The meta object id for the '<em>Image</em>' data type. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see org.eclipse.emf.facet.custom.metamodel.custompt.IImage - * @see org.eclipse.emf.facet.custom.metamodel.v0_2_0.custompt.impl.CustomptPackageImpl#getImage() - * @generated - */ - int IMAGE = 2; - - /** - * The meta object id for the '<em>Color</em>' data type. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see org.eclipse.emf.facet.custom.metamodel.custompt.IColor - * @see org.eclipse.emf.facet.custom.metamodel.v0_2_0.custompt.impl.CustomptPackageImpl#getColor() - * @generated - */ - int COLOR = 3; - - /** - * Returns the meta object for enum '{@link org.eclipse.emf.facet.custom.metamodel.v0_2_0.custompt.Shadow <em>Shadow</em>}'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the meta object for enum '<em>Shadow</em>'. - * @see org.eclipse.emf.facet.custom.metamodel.v0_2_0.custompt.Shadow - * @generated - */ - EEnum getShadow(); - - /** - * Returns the meta object for enum '{@link org.eclipse.emf.facet.custom.metamodel.v0_2_0.custompt.Alignment <em>Alignment</em>}'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the meta object for enum '<em>Alignment</em>'. - * @see org.eclipse.emf.facet.custom.metamodel.v0_2_0.custompt.Alignment - * @generated - */ - EEnum getAlignment(); - - /** - * Returns the meta object for data type '{@link org.eclipse.emf.facet.custom.metamodel.custompt.IImage <em>Image</em>}'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the meta object for data type '<em>Image</em>'. - * @see org.eclipse.emf.facet.custom.metamodel.custompt.IImage - * @model instanceClass="org.eclipse.emf.facet.custom.metamodel.custompt.IImage" - * @generated - */ - EDataType getImage(); - - /** - * Returns the meta object for data type '{@link org.eclipse.emf.facet.custom.metamodel.custompt.IColor <em>Color</em>}'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the meta object for data type '<em>Color</em>'. - * @see org.eclipse.emf.facet.custom.metamodel.custompt.IColor - * @model instanceClass="org.eclipse.emf.facet.custom.metamodel.custompt.IColor" - * @generated - */ - EDataType getColor(); - - /** - * Returns the factory that creates the instances of the model. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the factory that creates the instances of the model. - * @generated - */ - CustomptFactory getCustomptFactory(); - - /** - * <!-- begin-user-doc --> - * Defines literals for the meta objects that represent - * <ul> - * <li>each class,</li> - * <li>each feature of each class,</li> - * <li>each enum,</li> - * <li>and each data type</li> - * </ul> - * <!-- end-user-doc --> - * @generated - */ - interface Literals { - /** - * The meta object literal for the '{@link org.eclipse.emf.facet.custom.metamodel.v0_2_0.custompt.Shadow <em>Shadow</em>}' enum. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see org.eclipse.emf.facet.custom.metamodel.v0_2_0.custompt.Shadow - * @see org.eclipse.emf.facet.custom.metamodel.v0_2_0.custompt.impl.CustomptPackageImpl#getShadow() - * @generated - */ - EEnum SHADOW = eINSTANCE.getShadow(); - - /** - * The meta object literal for the '{@link org.eclipse.emf.facet.custom.metamodel.v0_2_0.custompt.Alignment <em>Alignment</em>}' enum. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see org.eclipse.emf.facet.custom.metamodel.v0_2_0.custompt.Alignment - * @see org.eclipse.emf.facet.custom.metamodel.v0_2_0.custompt.impl.CustomptPackageImpl#getAlignment() - * @generated - */ - EEnum ALIGNMENT = eINSTANCE.getAlignment(); - - /** - * The meta object literal for the '<em>Image</em>' data type. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see org.eclipse.emf.facet.custom.metamodel.custompt.IImage - * @see org.eclipse.emf.facet.custom.metamodel.v0_2_0.custompt.impl.CustomptPackageImpl#getImage() - * @generated - */ - EDataType IMAGE = eINSTANCE.getImage(); - - /** - * The meta object literal for the '<em>Color</em>' data type. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see org.eclipse.emf.facet.custom.metamodel.custompt.IColor - * @see org.eclipse.emf.facet.custom.metamodel.v0_2_0.custompt.impl.CustomptPackageImpl#getColor() - * @generated - */ - EDataType COLOR = eINSTANCE.getColor(); - - } - -} //CustomptPackage
diff --git a/org.eclipse.modisco.facet.custom.metamodel/src/org/eclipse/emf/facet/custom/metamodel/v0_2_0/custompt/Shadow.java b/org.eclipse.modisco.facet.custom.metamodel/src/org/eclipse/emf/facet/custom/metamodel/v0_2_0/custompt/Shadow.java deleted file mode 100644 index b854fdd..0000000 --- a/org.eclipse.modisco.facet.custom.metamodel/src/org/eclipse/emf/facet/custom/metamodel/v0_2_0/custompt/Shadow.java +++ /dev/null
@@ -1,246 +0,0 @@ -/** - * Copyright (c) 2012 Mia-Software. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Gregoire Dupe (Mia-Software) - Bug 361794 - [Restructuring] New customization meta-model - * Vincent Lorenzo (CEA-LIST) - Bug 372644 - Create Customizable tooltips for the TreeViewer using a CustomizableLabelProvider - * - */ -package org.eclipse.emf.facet.custom.metamodel.v0_2_0.custompt; - -import java.util.Arrays; -import java.util.Collections; -import java.util.List; - -import org.eclipse.emf.common.util.Enumerator; - -/** - * <!-- begin-user-doc --> - * A representation of the literals of the enumeration '<em><b>Shadow</b></em>', - * and utility methods for working with them. - * <!-- end-user-doc --> - * @see org.eclipse.emf.facet.custom.metamodel.v0_2_0.custompt.CustomptPackage#getShadow() - * @model - * @generated - */ -public enum Shadow implements Enumerator { - /** - * The '<em><b>NONE</b></em>' literal object. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #NONE_VALUE - * @generated - * @ordered - */ - NONE(0, "NONE", "NONE"), - - /** - * The '<em><b>IN</b></em>' literal object. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #IN_VALUE - * @generated - * @ordered - */ - IN(1, "IN", "IN"), - - /** - * The '<em><b>OUT</b></em>' literal object. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #OUT_VALUE - * @generated - * @ordered - */ - OUT(2, "OUT", "OUT"); - - /** - * The '<em><b>NONE</b></em>' literal value. - * <!-- begin-user-doc --> - * <p> - * If the meaning of '<em><b>NONE</b></em>' literal object isn't clear, - * there really should be more of a description here... - * </p> - * <!-- end-user-doc --> - * @see #NONE - * @model - * @generated - * @ordered - */ - public static final int NONE_VALUE = 0; - - /** - * The '<em><b>IN</b></em>' literal value. - * <!-- begin-user-doc --> - * <p> - * If the meaning of '<em><b>IN</b></em>' literal object isn't clear, - * there really should be more of a description here... - * </p> - * <!-- end-user-doc --> - * @see #IN - * @model - * @generated - * @ordered - */ - public static final int IN_VALUE = 1; - - /** - * The '<em><b>OUT</b></em>' literal value. - * <!-- begin-user-doc --> - * <p> - * If the meaning of '<em><b>OUT</b></em>' literal object isn't clear, - * there really should be more of a description here... - * </p> - * <!-- end-user-doc --> - * @see #OUT - * @model - * @generated - * @ordered - */ - public static final int OUT_VALUE = 2; - - /** - * An array of all the '<em><b>Shadow</b></em>' enumerators. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - private static final Shadow[] VALUES_ARRAY = - new Shadow[] { - NONE, - IN, - OUT, - }; - - /** - * A public read-only list of all the '<em><b>Shadow</b></em>' enumerators. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public static final List<Shadow> VALUES = Collections.unmodifiableList(Arrays.asList(VALUES_ARRAY)); - - /** - * Returns the '<em><b>Shadow</b></em>' literal with the specified literal value. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public static Shadow get(String literal) { - for (int i = 0; i < VALUES_ARRAY.length; ++i) { - Shadow result = VALUES_ARRAY[i]; - if (result.toString().equals(literal)) { - return result; - } - } - return null; - } - - /** - * Returns the '<em><b>Shadow</b></em>' literal with the specified name. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public static Shadow getByName(String name) { - for (int i = 0; i < VALUES_ARRAY.length; ++i) { - Shadow result = VALUES_ARRAY[i]; - if (result.getName().equals(name)) { - return result; - } - } - return null; - } - - /** - * Returns the '<em><b>Shadow</b></em>' literal with the specified integer value. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public static Shadow get(int value) { - switch (value) { - case NONE_VALUE: return NONE; - case IN_VALUE: return IN; - case OUT_VALUE: return OUT; - } - return null; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - private final int value; - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - private final String name; - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - private final String literal; - - /** - * Only this class can construct instances. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - private Shadow(int value, String name, String literal) { - this.value = value; - this.name = name; - this.literal = literal; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public int getValue() { - return value; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public String getName() { - return name; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public String getLiteral() { - return literal; - } - - /** - * Returns the literal value of the enumerator, which is its string representation. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public String toString() { - return literal; - } - -} //Shadow
diff --git a/org.eclipse.modisco.facet.custom.metamodel/src/org/eclipse/emf/facet/custom/metamodel/v0_2_0/custompt/impl/CustomptFactoryImpl.java b/org.eclipse.modisco.facet.custom.metamodel/src/org/eclipse/emf/facet/custom/metamodel/v0_2_0/custompt/impl/CustomptFactoryImpl.java deleted file mode 100644 index a0b6c2c..0000000 --- a/org.eclipse.modisco.facet.custom.metamodel/src/org/eclipse/emf/facet/custom/metamodel/v0_2_0/custompt/impl/CustomptFactoryImpl.java +++ /dev/null
@@ -1,215 +0,0 @@ -/** - * Copyright (c) 2012 Mia-Software. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Gregoire Dupe (Mia-Software) - Bug 361794 - [Restructuring] New customization meta-model - * - * - */ -package org.eclipse.emf.facet.custom.metamodel.v0_2_0.custompt.impl; - -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.ecore.EDataType; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.EPackage; -import org.eclipse.emf.ecore.impl.EFactoryImpl; -import org.eclipse.emf.ecore.plugin.EcorePlugin; -import org.eclipse.emf.facet.custom.metamodel.custompt.IColor; -import org.eclipse.emf.facet.custom.metamodel.custompt.IImage; -import org.eclipse.emf.facet.custom.metamodel.v0_2_0.custompt.*; -import org.eclipse.emf.facet.custom.metamodel.v0_2_0.custompt.CustomptFactory; -import org.eclipse.emf.facet.custom.metamodel.v0_2_0.custompt.CustomptPackage; - -/** - * <!-- begin-user-doc --> - * An implementation of the model <b>Factory</b>. - * <!-- end-user-doc --> - * @generated - */ -public class CustomptFactoryImpl extends EFactoryImpl implements CustomptFactory { - /** - * Creates the default factory implementation. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public static CustomptFactory init() { - try { - CustomptFactory theCustomptFactory = (CustomptFactory)EPackage.Registry.INSTANCE.getEFactory("http://www.eclipse.org/emf/facet/custom/0.2.incubation/custom_primitive_types"); - if (theCustomptFactory != null) { - return theCustomptFactory; - } - } - catch (Exception exception) { - EcorePlugin.INSTANCE.log(exception); - } - return new CustomptFactoryImpl(); - } - - /** - * Creates an instance of the factory. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public CustomptFactoryImpl() { - super(); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public EObject create(EClass eClass) { - switch (eClass.getClassifierID()) { - default: - throw new IllegalArgumentException("The class '" + eClass.getName() + "' is not a valid classifier"); - } - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public Object createFromString(EDataType eDataType, String initialValue) { - switch (eDataType.getClassifierID()) { - case CustomptPackage.SHADOW: - return createShadowFromString(eDataType, initialValue); - case CustomptPackage.ALIGNMENT: - return createAlignmentFromString(eDataType, initialValue); - case CustomptPackage.IMAGE: - return createImageFromString(eDataType, initialValue); - case CustomptPackage.COLOR: - return createColorFromString(eDataType, initialValue); - default: - throw new IllegalArgumentException("The datatype '" + eDataType.getName() + "' is not a valid classifier"); - } - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public String convertToString(EDataType eDataType, Object instanceValue) { - switch (eDataType.getClassifierID()) { - case CustomptPackage.SHADOW: - return convertShadowToString(eDataType, instanceValue); - case CustomptPackage.ALIGNMENT: - return convertAlignmentToString(eDataType, instanceValue); - case CustomptPackage.IMAGE: - return convertImageToString(eDataType, instanceValue); - case CustomptPackage.COLOR: - return convertColorToString(eDataType, instanceValue); - default: - throw new IllegalArgumentException("The datatype '" + eDataType.getName() + "' is not a valid classifier"); - } - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public Shadow createShadowFromString(EDataType eDataType, String initialValue) { - Shadow result = Shadow.get(initialValue); - if (result == null) throw new IllegalArgumentException("The value '" + initialValue + "' is not a valid enumerator of '" + eDataType.getName() + "'"); - return result; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public String convertShadowToString(EDataType eDataType, Object instanceValue) { - return instanceValue == null ? null : instanceValue.toString(); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public Alignment createAlignmentFromString(EDataType eDataType, String initialValue) { - Alignment result = Alignment.get(initialValue); - if (result == null) throw new IllegalArgumentException("The value '" + initialValue + "' is not a valid enumerator of '" + eDataType.getName() + "'"); - return result; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public String convertAlignmentToString(EDataType eDataType, Object instanceValue) { - return instanceValue == null ? null : instanceValue.toString(); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public IImage createImageFromString(EDataType eDataType, String initialValue) { - return (IImage)super.createFromString(eDataType, initialValue); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public String convertImageToString(EDataType eDataType, Object instanceValue) { - return super.convertToString(eDataType, instanceValue); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public IColor createColorFromString(EDataType eDataType, String initialValue) { - return (IColor)super.createFromString(eDataType, initialValue); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public String convertColorToString(EDataType eDataType, Object instanceValue) { - return super.convertToString(eDataType, instanceValue); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public CustomptPackage getCustomptPackage() { - return (CustomptPackage)getEPackage(); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @deprecated - * @generated - */ - @Deprecated - public static CustomptPackage getPackage() { - return CustomptPackage.eINSTANCE; - } - -} //CustomptFactoryImpl
diff --git a/org.eclipse.modisco.facet.custom.metamodel/src/org/eclipse/emf/facet/custom/metamodel/v0_2_0/custompt/impl/CustomptPackageImpl.java b/org.eclipse.modisco.facet.custom.metamodel/src/org/eclipse/emf/facet/custom/metamodel/v0_2_0/custompt/impl/CustomptPackageImpl.java deleted file mode 100644 index 1bc592c..0000000 --- a/org.eclipse.modisco.facet.custom.metamodel/src/org/eclipse/emf/facet/custom/metamodel/v0_2_0/custompt/impl/CustomptPackageImpl.java +++ /dev/null
@@ -1,237 +0,0 @@ -/** - * Copyright (c) 2012 Mia-Software. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Gregoire Dupe (Mia-Software) - Bug 361794 - [Restructuring] New customization meta-model - * - * - */ -package org.eclipse.emf.facet.custom.metamodel.v0_2_0.custompt.impl; - -import org.eclipse.emf.ecore.EDataType; -import org.eclipse.emf.ecore.EEnum; -import org.eclipse.emf.ecore.EPackage; -import org.eclipse.emf.ecore.impl.EPackageImpl; -import org.eclipse.emf.facet.custom.metamodel.custompt.IColor; -import org.eclipse.emf.facet.custom.metamodel.custompt.IImage; -import org.eclipse.emf.facet.custom.metamodel.v0_2_0.custompt.Alignment; -import org.eclipse.emf.facet.custom.metamodel.v0_2_0.custompt.CustomptFactory; -import org.eclipse.emf.facet.custom.metamodel.v0_2_0.custompt.CustomptPackage; -import org.eclipse.emf.facet.custom.metamodel.v0_2_0.custompt.Shadow; - -/** - * <!-- begin-user-doc --> - * An implementation of the model <b>Package</b>. - * <!-- end-user-doc --> - * @generated - */ -public class CustomptPackageImpl extends EPackageImpl implements CustomptPackage { - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - private EEnum shadowEEnum = null; - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - private EEnum alignmentEEnum = null; - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - private EDataType imageEDataType = null; - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - private EDataType colorEDataType = null; - - /** - * Creates an instance of the model <b>Package</b>, registered with - * {@link org.eclipse.emf.ecore.EPackage.Registry EPackage.Registry} by the package - * package URI value. - * <p>Note: the correct way to create the package is via the static - * factory method {@link #init init()}, which also performs - * initialization of the package, or returns the registered package, - * if one already exists. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see org.eclipse.emf.ecore.EPackage.Registry - * @see org.eclipse.emf.facet.custom.metamodel.v0_2_0.custompt.CustomptPackage#eNS_URI - * @see #init() - * @generated - */ - private CustomptPackageImpl() { - super(eNS_URI, CustomptFactory.eINSTANCE); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - private static boolean isInited = false; - - /** - * Creates, registers, and initializes the <b>Package</b> for this model, and for any others upon which it depends. - * - * <p>This method is used to initialize {@link CustomptPackage#eINSTANCE} when that field is accessed. - * Clients should not invoke it directly. Instead, they should simply access that field to obtain the package. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #eNS_URI - * @see #createPackageContents() - * @see #initializePackageContents() - * @generated - */ - public static CustomptPackage init() { - if (isInited) return (CustomptPackage)EPackage.Registry.INSTANCE.getEPackage(CustomptPackage.eNS_URI); - - // Obtain or create and register package - CustomptPackageImpl theCustomptPackage = (CustomptPackageImpl)(EPackage.Registry.INSTANCE.get(eNS_URI) instanceof CustomptPackageImpl ? EPackage.Registry.INSTANCE.get(eNS_URI) : new CustomptPackageImpl()); - - isInited = true; - - // Create package meta-data objects - theCustomptPackage.createPackageContents(); - - // Initialize created meta-data - theCustomptPackage.initializePackageContents(); - - // Mark meta-data to indicate it can't be changed - theCustomptPackage.freeze(); - - - // Update the registry and return the package - EPackage.Registry.INSTANCE.put(CustomptPackage.eNS_URI, theCustomptPackage); - return theCustomptPackage; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EEnum getShadow() { - return shadowEEnum; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EEnum getAlignment() { - return alignmentEEnum; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EDataType getImage() { - return imageEDataType; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EDataType getColor() { - return colorEDataType; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public CustomptFactory getCustomptFactory() { - return (CustomptFactory)getEFactoryInstance(); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - private boolean isCreated = false; - - /** - * Creates the meta-model objects for the package. This method is - * guarded to have no affect on any invocation but its first. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public void createPackageContents() { - if (isCreated) return; - isCreated = true; - - // Create enums - shadowEEnum = createEEnum(SHADOW); - alignmentEEnum = createEEnum(ALIGNMENT); - - // Create data types - imageEDataType = createEDataType(IMAGE); - colorEDataType = createEDataType(COLOR); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - private boolean isInitialized = false; - - /** - * Complete the initialization of the package and its meta-model. This - * method is guarded to have no affect on any invocation but its first. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public void initializePackageContents() { - if (isInitialized) return; - isInitialized = true; - - // Initialize package - setName(eNAME); - setNsPrefix(eNS_PREFIX); - setNsURI(eNS_URI); - - // Initialize enums and add enum literals - initEEnum(shadowEEnum, Shadow.class, "Shadow"); - addEEnumLiteral(shadowEEnum, Shadow.NONE); - addEEnumLiteral(shadowEEnum, Shadow.IN); - addEEnumLiteral(shadowEEnum, Shadow.OUT); - - initEEnum(alignmentEEnum, Alignment.class, "Alignment"); - addEEnumLiteral(alignmentEEnum, Alignment.LEFT); - addEEnumLiteral(alignmentEEnum, Alignment.CENTER); - addEEnumLiteral(alignmentEEnum, Alignment.RIGHT); - - // Initialize data types - initEDataType(imageEDataType, IImage.class, "Image", IS_SERIALIZABLE, !IS_GENERATED_INSTANCE_CLASS); - initEDataType(colorEDataType, IColor.class, "Color", IS_SERIALIZABLE, !IS_GENERATED_INSTANCE_CLASS); - - // Create resource - createResource(eNS_URI); - } - -} //CustomptPackageImpl
diff --git a/org.eclipse.modisco.facet.custom.metamodel/src/org/eclipse/emf/facet/custom/metamodel/v0_2_0/internal/treeproxy/EAttributeTreeElement.java b/org.eclipse.modisco.facet.custom.metamodel/src/org/eclipse/emf/facet/custom/metamodel/v0_2_0/internal/treeproxy/EAttributeTreeElement.java deleted file mode 100644 index ca41bdf..0000000 --- a/org.eclipse.modisco.facet.custom.metamodel/src/org/eclipse/emf/facet/custom/metamodel/v0_2_0/internal/treeproxy/EAttributeTreeElement.java +++ /dev/null
@@ -1,53 +0,0 @@ -/** - * Copyright (c) 2012,2014 Mia-Software. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Nicolas Bros (Mia-Software) - Bug 379683 - customizable Tree content provider - * Gregoire Dupe (Mia-Software) - Bug 386387 - [CustomizedTreeContentProvider] The TreeElements are not preserved between two calls to getElements() - * Thomas Cicognani (Soft-Maint) - Bug 441321 - isVisible customisation doesn't work after refreshing a tree - */ -package org.eclipse.emf.facet.custom.metamodel.v0_2_0.internal.treeproxy; - -import org.eclipse.emf.ecore.EAttribute; - -/** - * <!-- begin-user-doc --> - * A representation of the model object '<em><b>EAttribute Tree Element</b></em>'. - * <!-- end-user-doc --> - * - * <!-- begin-model-doc --> - * Represents an EAttribute in a tree view - * <!-- end-model-doc --> - * - * <p> - * The following features are supported: - * <ul> - * <li>{@link org.eclipse.emf.facet.custom.metamodel.v0_2_0.internal.treeproxy.EAttributeTreeElement#getEAttribute <em>EAttribute</em>}</li> - * </ul> - * </p> - * - * @see org.eclipse.emf.facet.custom.metamodel.v0_2_0.internal.treeproxy.TreeproxyPackage#getEAttributeTreeElement() - * @model - * @generated - */ -public interface EAttributeTreeElement extends EStructuralFeatureTreeElement { - /** - * Returns the value of the '<em><b>EAttribute</b></em>' reference. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * <!-- begin-model-doc --> - * The EAttribute represented by this tree element - * <!-- end-model-doc --> - * @return the value of the '<em>EAttribute</em>' reference. - * @see org.eclipse.emf.facet.custom.metamodel.v0_2_0.internal.treeproxy.TreeproxyPackage#getEAttributeTreeElement_EAttribute() - * @model transient="true" changeable="false" volatile="true" derived="true" - * annotation="http://www.eclipse.org/emf/2002/Ecore/OCL derivation='self.eStructuralFeature.oclAsType(ecore::EAttribute)'" - * @generated - */ - EAttribute getEAttribute(); - -} // EAttributeTreeElement
diff --git a/org.eclipse.modisco.facet.custom.metamodel/src/org/eclipse/emf/facet/custom/metamodel/v0_2_0/internal/treeproxy/EObjectTreeElement.java b/org.eclipse.modisco.facet.custom.metamodel/src/org/eclipse/emf/facet/custom/metamodel/v0_2_0/internal/treeproxy/EObjectTreeElement.java deleted file mode 100644 index 1c3723f..0000000 --- a/org.eclipse.modisco.facet.custom.metamodel/src/org/eclipse/emf/facet/custom/metamodel/v0_2_0/internal/treeproxy/EObjectTreeElement.java +++ /dev/null
@@ -1,63 +0,0 @@ -/** - * Copyright (c) 2012,2014 Mia-Software. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Nicolas Bros (Mia-Software) - Bug 379683 - customizable Tree content provider - * Gregoire Dupe (Mia-Software) - Bug 386387 - [CustomizedTreeContentProvider] The TreeElements are not preserved between two calls to getElements() - * Thomas Cicognani (Soft-Maint) - Bug 441321 - isVisible customisation doesn't work after refreshing a tree - */ -package org.eclipse.emf.facet.custom.metamodel.v0_2_0.internal.treeproxy; - -import org.eclipse.emf.ecore.EObject; - -/** - * <!-- begin-user-doc --> - * A representation of the model object '<em><b>EObject Tree Element</b></em>'. - * <!-- end-user-doc --> - * - * <!-- begin-model-doc --> - * Represents a model element in a tree view - * <!-- end-model-doc --> - * - * <p> - * The following features are supported: - * <ul> - * <li>{@link org.eclipse.emf.facet.custom.metamodel.v0_2_0.internal.treeproxy.EObjectTreeElement#getEObject <em>EObject</em>}</li> - * </ul> - * </p> - * - * @see org.eclipse.emf.facet.custom.metamodel.v0_2_0.internal.treeproxy.TreeproxyPackage#getEObjectTreeElement() - * @model - * @generated - */ -public interface EObjectTreeElement extends TreeElement { - /** - * Returns the value of the '<em><b>EObject</b></em>' reference. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * <!-- begin-model-doc --> - * The model element represented by this tree element - * <!-- end-model-doc --> - * @return the value of the '<em>EObject</em>' reference. - * @see #setEObject(EObject) - * @see org.eclipse.emf.facet.custom.metamodel.v0_2_0.internal.treeproxy.TreeproxyPackage#getEObjectTreeElement_EObject() - * @model - * @generated - */ - EObject getEObject(); - - /** - * Sets the value of the '{@link org.eclipse.emf.facet.custom.metamodel.v0_2_0.internal.treeproxy.EObjectTreeElement#getEObject <em>EObject</em>}' reference. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @param value the new value of the '<em>EObject</em>' reference. - * @see #getEObject() - * @generated - */ - void setEObject(EObject value); - -} // EObjectTreeElement
diff --git a/org.eclipse.modisco.facet.custom.metamodel/src/org/eclipse/emf/facet/custom/metamodel/v0_2_0/internal/treeproxy/EReferenceTreeElement.java b/org.eclipse.modisco.facet.custom.metamodel/src/org/eclipse/emf/facet/custom/metamodel/v0_2_0/internal/treeproxy/EReferenceTreeElement.java deleted file mode 100644 index cd1fbde..0000000 --- a/org.eclipse.modisco.facet.custom.metamodel/src/org/eclipse/emf/facet/custom/metamodel/v0_2_0/internal/treeproxy/EReferenceTreeElement.java +++ /dev/null
@@ -1,53 +0,0 @@ -/** - * Copyright (c) 2012,2014 Mia-Software. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Nicolas Bros (Mia-Software) - Bug 379683 - customizable Tree content provider - * Gregoire Dupe (Mia-Software) - Bug 386387 - [CustomizedTreeContentProvider] The TreeElements are not preserved between two calls to getElements() - * Thomas Cicognani (Soft-Maint) - Bug 441321 - isVisible customisation doesn't work after refreshing a tree - */ -package org.eclipse.emf.facet.custom.metamodel.v0_2_0.internal.treeproxy; - -import org.eclipse.emf.ecore.EReference; - -/** - * <!-- begin-user-doc --> - * A representation of the model object '<em><b>EReference Tree Element</b></em>'. - * <!-- end-user-doc --> - * - * <!-- begin-model-doc --> - * Represents an EReference as a link between two model elements in a tree view - * <!-- end-model-doc --> - * - * <p> - * The following features are supported: - * <ul> - * <li>{@link org.eclipse.emf.facet.custom.metamodel.v0_2_0.internal.treeproxy.EReferenceTreeElement#getEReference <em>EReference</em>}</li> - * </ul> - * </p> - * - * @see org.eclipse.emf.facet.custom.metamodel.v0_2_0.internal.treeproxy.TreeproxyPackage#getEReferenceTreeElement() - * @model - * @generated - */ -public interface EReferenceTreeElement extends EStructuralFeatureTreeElement { - /** - * Returns the value of the '<em><b>EReference</b></em>' reference. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * <!-- begin-model-doc --> - * The EReference represented by this tree element - * <!-- end-model-doc --> - * @return the value of the '<em>EReference</em>' reference. - * @see org.eclipse.emf.facet.custom.metamodel.v0_2_0.internal.treeproxy.TreeproxyPackage#getEReferenceTreeElement_EReference() - * @model transient="true" changeable="false" volatile="true" derived="true" - * annotation="http://www.eclipse.org/emf/2002/Ecore/OCL derivation='self.eStructuralFeature.oclAsType(ecore::EReference)'" - * @generated - */ - EReference getEReference(); - -} // EReferenceTreeElement
diff --git a/org.eclipse.modisco.facet.custom.metamodel/src/org/eclipse/emf/facet/custom/metamodel/v0_2_0/internal/treeproxy/EStructuralFeatureTreeElement.java b/org.eclipse.modisco.facet.custom.metamodel/src/org/eclipse/emf/facet/custom/metamodel/v0_2_0/internal/treeproxy/EStructuralFeatureTreeElement.java deleted file mode 100644 index ed890f6..0000000 --- a/org.eclipse.modisco.facet.custom.metamodel/src/org/eclipse/emf/facet/custom/metamodel/v0_2_0/internal/treeproxy/EStructuralFeatureTreeElement.java +++ /dev/null
@@ -1,60 +0,0 @@ -/** - * Copyright (c) 2012,2014 Mia-Software. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Nicolas Bros (Mia-Software) - Bug 379683 - customizable Tree content provider - * Gregoire Dupe (Mia-Software) - Bug 386387 - [CustomizedTreeContentProvider] The TreeElements are not preserved between two calls to getElements() - * Thomas Cicognani (Soft-Maint) - Bug 441321 - isVisible customisation doesn't work after refreshing a tree - */ -package org.eclipse.emf.facet.custom.metamodel.v0_2_0.internal.treeproxy; - -import org.eclipse.emf.ecore.EStructuralFeature; - -/** - * <!-- begin-user-doc --> - * A representation of the model object '<em><b>EStructural Feature Tree Element</b></em>'. - * <!-- end-user-doc --> - * - * <p> - * The following features are supported: - * <ul> - * <li>{@link org.eclipse.emf.facet.custom.metamodel.v0_2_0.internal.treeproxy.EStructuralFeatureTreeElement#getEStructuralFeature <em>EStructural Feature</em>}</li> - * </ul> - * </p> - * - * @see org.eclipse.emf.facet.custom.metamodel.v0_2_0.internal.treeproxy.TreeproxyPackage#getEStructuralFeatureTreeElement() - * @model abstract="true" - * @generated - */ -public interface EStructuralFeatureTreeElement extends TreeElement { - /** - * Returns the value of the '<em><b>EStructural Feature</b></em>' reference. - * <!-- begin-user-doc --> - * <p> - * If the meaning of the '<em>EStructural Feature</em>' reference isn't clear, - * there really should be more of a description here... - * </p> - * <!-- end-user-doc --> - * @return the value of the '<em>EStructural Feature</em>' reference. - * @see #setEStructuralFeature(EStructuralFeature) - * @see org.eclipse.emf.facet.custom.metamodel.v0_2_0.internal.treeproxy.TreeproxyPackage#getEStructuralFeatureTreeElement_EStructuralFeature() - * @model derived="true" - * @generated - */ - EStructuralFeature getEStructuralFeature(); - - /** - * Sets the value of the '{@link org.eclipse.emf.facet.custom.metamodel.v0_2_0.internal.treeproxy.EStructuralFeatureTreeElement#getEStructuralFeature <em>EStructural Feature</em>}' reference. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @param value the new value of the '<em>EStructural Feature</em>' reference. - * @see #getEStructuralFeature() - * @generated - */ - void setEStructuralFeature(EStructuralFeature value); - -} // EStructuralFeatureTreeElement
diff --git a/org.eclipse.modisco.facet.custom.metamodel/src/org/eclipse/emf/facet/custom/metamodel/v0_2_0/internal/treeproxy/TreeElement.java b/org.eclipse.modisco.facet.custom.metamodel/src/org/eclipse/emf/facet/custom/metamodel/v0_2_0/internal/treeproxy/TreeElement.java deleted file mode 100644 index 50dc34d..0000000 --- a/org.eclipse.modisco.facet.custom.metamodel/src/org/eclipse/emf/facet/custom/metamodel/v0_2_0/internal/treeproxy/TreeElement.java +++ /dev/null
@@ -1,87 +0,0 @@ -/** - * Copyright (c) 2012,2014 Mia-Software. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Nicolas Bros (Mia-Software) - Bug 379683 - customizable Tree content provider - * Gregoire Dupe (Mia-Software) - Bug 386387 - [CustomizedTreeContentProvider] The TreeElements are not preserved between two calls to getElements() - * Thomas Cicognani (Soft-Maint) - Bug 441321 - isVisible customisation doesn't work after refreshing a tree - */ -package org.eclipse.emf.facet.custom.metamodel.v0_2_0.internal.treeproxy; - -import org.eclipse.emf.common.util.EList; - -import org.eclipse.emf.ecore.EObject; - -/** - * <!-- begin-user-doc --> - * A representation of the model object '<em><b>Tree Element</b></em>'. - * <!-- end-user-doc --> - * - * <!-- begin-model-doc --> - * Represents a proxy element in a tree view - * <!-- end-model-doc --> - * - * <p> - * The following features are supported: - * <ul> - * <li>{@link org.eclipse.emf.facet.custom.metamodel.v0_2_0.internal.treeproxy.TreeElement#getParent <em>Parent</em>}</li> - * <li>{@link org.eclipse.emf.facet.custom.metamodel.v0_2_0.internal.treeproxy.TreeElement#getChildren <em>Children</em>}</li> - * </ul> - * </p> - * - * @see org.eclipse.emf.facet.custom.metamodel.v0_2_0.internal.treeproxy.TreeproxyPackage#getTreeElement() - * @model abstract="true" - * @generated - */ -public interface TreeElement extends EObject { - /** - * Returns the value of the '<em><b>Parent</b></em>' container reference. - * It is bidirectional and its opposite is '{@link org.eclipse.emf.facet.custom.metamodel.v0_2_0.internal.treeproxy.TreeElement#getChildren <em>Children</em>}'. - * <!-- begin-user-doc --> - * <p> - * If the meaning of the '<em>Parent</em>' container reference isn't clear, - * there really should be more of a description here... - * </p> - * <!-- end-user-doc --> - * @return the value of the '<em>Parent</em>' container reference. - * @see #setParent(TreeElement) - * @see org.eclipse.emf.facet.custom.metamodel.v0_2_0.internal.treeproxy.TreeproxyPackage#getTreeElement_Parent() - * @see org.eclipse.emf.facet.custom.metamodel.v0_2_0.internal.treeproxy.TreeElement#getChildren - * @model opposite="children" transient="false" - * @generated - */ - TreeElement getParent(); - - /** - * Sets the value of the '{@link org.eclipse.emf.facet.custom.metamodel.v0_2_0.internal.treeproxy.TreeElement#getParent <em>Parent</em>}' container reference. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @param value the new value of the '<em>Parent</em>' container reference. - * @see #getParent() - * @generated - */ - void setParent(TreeElement value); - - /** - * Returns the value of the '<em><b>Children</b></em>' containment reference list. - * The list contents are of type {@link org.eclipse.emf.facet.custom.metamodel.v0_2_0.internal.treeproxy.TreeElement}. - * It is bidirectional and its opposite is '{@link org.eclipse.emf.facet.custom.metamodel.v0_2_0.internal.treeproxy.TreeElement#getParent <em>Parent</em>}'. - * <!-- begin-user-doc --> - * <p> - * If the meaning of the '<em>Children</em>' containment reference list isn't clear, - * there really should be more of a description here... - * </p> - * <!-- end-user-doc --> - * @return the value of the '<em>Children</em>' containment reference list. - * @see org.eclipse.emf.facet.custom.metamodel.v0_2_0.internal.treeproxy.TreeproxyPackage#getTreeElement_Children() - * @see org.eclipse.emf.facet.custom.metamodel.v0_2_0.internal.treeproxy.TreeElement#getParent - * @model opposite="parent" containment="true" - * @generated - */ - EList<TreeElement> getChildren(); - -} // TreeElement
diff --git a/org.eclipse.modisco.facet.custom.metamodel/src/org/eclipse/emf/facet/custom/metamodel/v0_2_0/internal/treeproxy/TreeproxyFactory.java b/org.eclipse.modisco.facet.custom.metamodel/src/org/eclipse/emf/facet/custom/metamodel/v0_2_0/internal/treeproxy/TreeproxyFactory.java deleted file mode 100644 index 45da54e..0000000 --- a/org.eclipse.modisco.facet.custom.metamodel/src/org/eclipse/emf/facet/custom/metamodel/v0_2_0/internal/treeproxy/TreeproxyFactory.java +++ /dev/null
@@ -1,70 +0,0 @@ -/** - * Copyright (c) 2012,2014 Mia-Software. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Nicolas Bros (Mia-Software) - Bug 379683 - customizable Tree content provider - * Gregoire Dupe (Mia-Software) - Bug 386387 - [CustomizedTreeContentProvider] The TreeElements are not preserved between two calls to getElements() - * Thomas Cicognani (Soft-Maint) - Bug 441321 - isVisible customisation doesn't work after refreshing a tree - */ -package org.eclipse.emf.facet.custom.metamodel.v0_2_0.internal.treeproxy; - -import org.eclipse.emf.ecore.EFactory; - -/** - * <!-- begin-user-doc --> - * The <b>Factory</b> for the model. - * It provides a create method for each non-abstract class of the model. - * <!-- end-user-doc --> - * @see org.eclipse.emf.facet.custom.metamodel.v0_2_0.internal.treeproxy.TreeproxyPackage - * @generated - */ -public interface TreeproxyFactory extends EFactory { - /** - * The singleton instance of the factory. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - TreeproxyFactory eINSTANCE = org.eclipse.emf.facet.custom.metamodel.v0_2_0.internal.treeproxy.impl.TreeproxyFactoryImpl.init(); - - /** - * Returns a new object of class '<em>EObject Tree Element</em>'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return a new object of class '<em>EObject Tree Element</em>'. - * @generated - */ - EObjectTreeElement createEObjectTreeElement(); - - /** - * Returns a new object of class '<em>EReference Tree Element</em>'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return a new object of class '<em>EReference Tree Element</em>'. - * @generated - */ - EReferenceTreeElement createEReferenceTreeElement(); - - /** - * Returns a new object of class '<em>EAttribute Tree Element</em>'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return a new object of class '<em>EAttribute Tree Element</em>'. - * @generated - */ - EAttributeTreeElement createEAttributeTreeElement(); - - /** - * Returns the package supported by this factory. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the package supported by this factory. - * @generated - */ - TreeproxyPackage getTreeproxyPackage(); - -} //TreeproxyFactory
diff --git a/org.eclipse.modisco.facet.custom.metamodel/src/org/eclipse/emf/facet/custom/metamodel/v0_2_0/internal/treeproxy/TreeproxyPackage.java b/org.eclipse.modisco.facet.custom.metamodel/src/org/eclipse/emf/facet/custom/metamodel/v0_2_0/internal/treeproxy/TreeproxyPackage.java deleted file mode 100644 index 426946f..0000000 --- a/org.eclipse.modisco.facet.custom.metamodel/src/org/eclipse/emf/facet/custom/metamodel/v0_2_0/internal/treeproxy/TreeproxyPackage.java +++ /dev/null
@@ -1,546 +0,0 @@ -/** - * Copyright (c) 2012,2014 Mia-Software. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Nicolas Bros (Mia-Software) - Bug 379683 - customizable Tree content provider - * Gregoire Dupe (Mia-Software) - Bug 386387 - [CustomizedTreeContentProvider] The TreeElements are not preserved between two calls to getElements() - * Thomas Cicognani (Soft-Maint) - Bug 441321 - isVisible customisation doesn't work after refreshing a tree - */ -package org.eclipse.emf.facet.custom.metamodel.v0_2_0.internal.treeproxy; - -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.ecore.EPackage; -import org.eclipse.emf.ecore.EReference; - -/** - * <!-- begin-user-doc --> - * The <b>Package</b> for the model. - * It contains accessors for the meta objects to represent - * <ul> - * <li>each class,</li> - * <li>each feature of each class,</li> - * <li>each enum,</li> - * <li>and each data type</li> - * </ul> - * <!-- end-user-doc --> - * @see org.eclipse.emf.facet.custom.metamodel.v0_2_0.internal.treeproxy.TreeproxyFactory - * @model kind="package" - * annotation="http://www.eclipse.org/emf/2002/Ecore settingDelegates='http://www.eclipse.org/emf/2002/Ecore/OCL'" - * @generated - */ -public interface TreeproxyPackage extends EPackage { - /** - * The package name. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - String eNAME = "treeproxy"; - - /** - * The package namespace URI. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - String eNS_URI = "http://www.eclipse.org/emf/facet/custom/0.2.incubation/internal/treeproxy"; - - /** - * The package namespace name. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - String eNS_PREFIX = "treeproxy"; - - /** - * The singleton instance of the package. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - TreeproxyPackage eINSTANCE = org.eclipse.emf.facet.custom.metamodel.v0_2_0.internal.treeproxy.impl.TreeproxyPackageImpl.init(); - - /** - * The meta object id for the '{@link org.eclipse.emf.facet.custom.metamodel.v0_2_0.internal.treeproxy.impl.TreeElementImpl <em>Tree Element</em>}' class. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see org.eclipse.emf.facet.custom.metamodel.v0_2_0.internal.treeproxy.impl.TreeElementImpl - * @see org.eclipse.emf.facet.custom.metamodel.v0_2_0.internal.treeproxy.impl.TreeproxyPackageImpl#getTreeElement() - * @generated - */ - int TREE_ELEMENT = 0; - - /** - * The feature id for the '<em><b>Parent</b></em>' container reference. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int TREE_ELEMENT__PARENT = 0; - - /** - * The feature id for the '<em><b>Children</b></em>' containment reference list. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int TREE_ELEMENT__CHILDREN = 1; - - /** - * The number of structural features of the '<em>Tree Element</em>' class. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int TREE_ELEMENT_FEATURE_COUNT = 2; - - /** - * The meta object id for the '{@link org.eclipse.emf.facet.custom.metamodel.v0_2_0.internal.treeproxy.impl.EObjectTreeElementImpl <em>EObject Tree Element</em>}' class. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see org.eclipse.emf.facet.custom.metamodel.v0_2_0.internal.treeproxy.impl.EObjectTreeElementImpl - * @see org.eclipse.emf.facet.custom.metamodel.v0_2_0.internal.treeproxy.impl.TreeproxyPackageImpl#getEObjectTreeElement() - * @generated - */ - int EOBJECT_TREE_ELEMENT = 1; - - /** - * The feature id for the '<em><b>Parent</b></em>' container reference. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int EOBJECT_TREE_ELEMENT__PARENT = TREE_ELEMENT__PARENT; - - /** - * The feature id for the '<em><b>Children</b></em>' containment reference list. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int EOBJECT_TREE_ELEMENT__CHILDREN = TREE_ELEMENT__CHILDREN; - - /** - * The feature id for the '<em><b>EObject</b></em>' reference. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int EOBJECT_TREE_ELEMENT__EOBJECT = TREE_ELEMENT_FEATURE_COUNT + 0; - - /** - * The number of structural features of the '<em>EObject Tree Element</em>' class. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int EOBJECT_TREE_ELEMENT_FEATURE_COUNT = TREE_ELEMENT_FEATURE_COUNT + 1; - - /** - * The meta object id for the '{@link org.eclipse.emf.facet.custom.metamodel.v0_2_0.internal.treeproxy.impl.EStructuralFeatureTreeElementImpl <em>EStructural Feature Tree Element</em>}' class. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see org.eclipse.emf.facet.custom.metamodel.v0_2_0.internal.treeproxy.impl.EStructuralFeatureTreeElementImpl - * @see org.eclipse.emf.facet.custom.metamodel.v0_2_0.internal.treeproxy.impl.TreeproxyPackageImpl#getEStructuralFeatureTreeElement() - * @generated - */ - int ESTRUCTURAL_FEATURE_TREE_ELEMENT = 4; - - /** - * The feature id for the '<em><b>Parent</b></em>' container reference. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int ESTRUCTURAL_FEATURE_TREE_ELEMENT__PARENT = TREE_ELEMENT__PARENT; - - /** - * The feature id for the '<em><b>Children</b></em>' containment reference list. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int ESTRUCTURAL_FEATURE_TREE_ELEMENT__CHILDREN = TREE_ELEMENT__CHILDREN; - - /** - * The feature id for the '<em><b>EStructural Feature</b></em>' reference. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int ESTRUCTURAL_FEATURE_TREE_ELEMENT__ESTRUCTURAL_FEATURE = TREE_ELEMENT_FEATURE_COUNT + 0; - - /** - * The number of structural features of the '<em>EStructural Feature Tree Element</em>' class. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int ESTRUCTURAL_FEATURE_TREE_ELEMENT_FEATURE_COUNT = TREE_ELEMENT_FEATURE_COUNT + 1; - - /** - * The meta object id for the '{@link org.eclipse.emf.facet.custom.metamodel.v0_2_0.internal.treeproxy.impl.EReferenceTreeElementImpl <em>EReference Tree Element</em>}' class. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see org.eclipse.emf.facet.custom.metamodel.v0_2_0.internal.treeproxy.impl.EReferenceTreeElementImpl - * @see org.eclipse.emf.facet.custom.metamodel.v0_2_0.internal.treeproxy.impl.TreeproxyPackageImpl#getEReferenceTreeElement() - * @generated - */ - int EREFERENCE_TREE_ELEMENT = 2; - - /** - * The feature id for the '<em><b>Parent</b></em>' container reference. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int EREFERENCE_TREE_ELEMENT__PARENT = ESTRUCTURAL_FEATURE_TREE_ELEMENT__PARENT; - - /** - * The feature id for the '<em><b>Children</b></em>' containment reference list. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int EREFERENCE_TREE_ELEMENT__CHILDREN = ESTRUCTURAL_FEATURE_TREE_ELEMENT__CHILDREN; - - /** - * The feature id for the '<em><b>EStructural Feature</b></em>' reference. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int EREFERENCE_TREE_ELEMENT__ESTRUCTURAL_FEATURE = ESTRUCTURAL_FEATURE_TREE_ELEMENT__ESTRUCTURAL_FEATURE; - - /** - * The feature id for the '<em><b>EReference</b></em>' reference. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int EREFERENCE_TREE_ELEMENT__EREFERENCE = ESTRUCTURAL_FEATURE_TREE_ELEMENT_FEATURE_COUNT + 0; - - /** - * The number of structural features of the '<em>EReference Tree Element</em>' class. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int EREFERENCE_TREE_ELEMENT_FEATURE_COUNT = ESTRUCTURAL_FEATURE_TREE_ELEMENT_FEATURE_COUNT + 1; - - /** - * The meta object id for the '{@link org.eclipse.emf.facet.custom.metamodel.v0_2_0.internal.treeproxy.impl.EAttributeTreeElementImpl <em>EAttribute Tree Element</em>}' class. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see org.eclipse.emf.facet.custom.metamodel.v0_2_0.internal.treeproxy.impl.EAttributeTreeElementImpl - * @see org.eclipse.emf.facet.custom.metamodel.v0_2_0.internal.treeproxy.impl.TreeproxyPackageImpl#getEAttributeTreeElement() - * @generated - */ - int EATTRIBUTE_TREE_ELEMENT = 3; - - /** - * The feature id for the '<em><b>Parent</b></em>' container reference. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int EATTRIBUTE_TREE_ELEMENT__PARENT = ESTRUCTURAL_FEATURE_TREE_ELEMENT__PARENT; - - /** - * The feature id for the '<em><b>Children</b></em>' containment reference list. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int EATTRIBUTE_TREE_ELEMENT__CHILDREN = ESTRUCTURAL_FEATURE_TREE_ELEMENT__CHILDREN; - - /** - * The feature id for the '<em><b>EStructural Feature</b></em>' reference. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int EATTRIBUTE_TREE_ELEMENT__ESTRUCTURAL_FEATURE = ESTRUCTURAL_FEATURE_TREE_ELEMENT__ESTRUCTURAL_FEATURE; - - /** - * The feature id for the '<em><b>EAttribute</b></em>' reference. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int EATTRIBUTE_TREE_ELEMENT__EATTRIBUTE = ESTRUCTURAL_FEATURE_TREE_ELEMENT_FEATURE_COUNT + 0; - - /** - * The number of structural features of the '<em>EAttribute Tree Element</em>' class. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int EATTRIBUTE_TREE_ELEMENT_FEATURE_COUNT = ESTRUCTURAL_FEATURE_TREE_ELEMENT_FEATURE_COUNT + 1; - - - /** - * Returns the meta object for class '{@link org.eclipse.emf.facet.custom.metamodel.v0_2_0.internal.treeproxy.TreeElement <em>Tree Element</em>}'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the meta object for class '<em>Tree Element</em>'. - * @see org.eclipse.emf.facet.custom.metamodel.v0_2_0.internal.treeproxy.TreeElement - * @generated - */ - EClass getTreeElement(); - - /** - * Returns the meta object for the container reference '{@link org.eclipse.emf.facet.custom.metamodel.v0_2_0.internal.treeproxy.TreeElement#getParent <em>Parent</em>}'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the meta object for the container reference '<em>Parent</em>'. - * @see org.eclipse.emf.facet.custom.metamodel.v0_2_0.internal.treeproxy.TreeElement#getParent() - * @see #getTreeElement() - * @generated - */ - EReference getTreeElement_Parent(); - - /** - * Returns the meta object for the containment reference list '{@link org.eclipse.emf.facet.custom.metamodel.v0_2_0.internal.treeproxy.TreeElement#getChildren <em>Children</em>}'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the meta object for the containment reference list '<em>Children</em>'. - * @see org.eclipse.emf.facet.custom.metamodel.v0_2_0.internal.treeproxy.TreeElement#getChildren() - * @see #getTreeElement() - * @generated - */ - EReference getTreeElement_Children(); - - /** - * Returns the meta object for class '{@link org.eclipse.emf.facet.custom.metamodel.v0_2_0.internal.treeproxy.EObjectTreeElement <em>EObject Tree Element</em>}'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the meta object for class '<em>EObject Tree Element</em>'. - * @see org.eclipse.emf.facet.custom.metamodel.v0_2_0.internal.treeproxy.EObjectTreeElement - * @generated - */ - EClass getEObjectTreeElement(); - - /** - * Returns the meta object for the reference '{@link org.eclipse.emf.facet.custom.metamodel.v0_2_0.internal.treeproxy.EObjectTreeElement#getEObject <em>EObject</em>}'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the meta object for the reference '<em>EObject</em>'. - * @see org.eclipse.emf.facet.custom.metamodel.v0_2_0.internal.treeproxy.EObjectTreeElement#getEObject() - * @see #getEObjectTreeElement() - * @generated - */ - EReference getEObjectTreeElement_EObject(); - - /** - * Returns the meta object for class '{@link org.eclipse.emf.facet.custom.metamodel.v0_2_0.internal.treeproxy.EReferenceTreeElement <em>EReference Tree Element</em>}'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the meta object for class '<em>EReference Tree Element</em>'. - * @see org.eclipse.emf.facet.custom.metamodel.v0_2_0.internal.treeproxy.EReferenceTreeElement - * @generated - */ - EClass getEReferenceTreeElement(); - - /** - * Returns the meta object for the reference '{@link org.eclipse.emf.facet.custom.metamodel.v0_2_0.internal.treeproxy.EReferenceTreeElement#getEReference <em>EReference</em>}'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the meta object for the reference '<em>EReference</em>'. - * @see org.eclipse.emf.facet.custom.metamodel.v0_2_0.internal.treeproxy.EReferenceTreeElement#getEReference() - * @see #getEReferenceTreeElement() - * @generated - */ - EReference getEReferenceTreeElement_EReference(); - - /** - * Returns the meta object for class '{@link org.eclipse.emf.facet.custom.metamodel.v0_2_0.internal.treeproxy.EAttributeTreeElement <em>EAttribute Tree Element</em>}'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the meta object for class '<em>EAttribute Tree Element</em>'. - * @see org.eclipse.emf.facet.custom.metamodel.v0_2_0.internal.treeproxy.EAttributeTreeElement - * @generated - */ - EClass getEAttributeTreeElement(); - - /** - * Returns the meta object for the reference '{@link org.eclipse.emf.facet.custom.metamodel.v0_2_0.internal.treeproxy.EAttributeTreeElement#getEAttribute <em>EAttribute</em>}'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the meta object for the reference '<em>EAttribute</em>'. - * @see org.eclipse.emf.facet.custom.metamodel.v0_2_0.internal.treeproxy.EAttributeTreeElement#getEAttribute() - * @see #getEAttributeTreeElement() - * @generated - */ - EReference getEAttributeTreeElement_EAttribute(); - - /** - * Returns the meta object for class '{@link org.eclipse.emf.facet.custom.metamodel.v0_2_0.internal.treeproxy.EStructuralFeatureTreeElement <em>EStructural Feature Tree Element</em>}'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the meta object for class '<em>EStructural Feature Tree Element</em>'. - * @see org.eclipse.emf.facet.custom.metamodel.v0_2_0.internal.treeproxy.EStructuralFeatureTreeElement - * @generated - */ - EClass getEStructuralFeatureTreeElement(); - - /** - * Returns the meta object for the reference '{@link org.eclipse.emf.facet.custom.metamodel.v0_2_0.internal.treeproxy.EStructuralFeatureTreeElement#getEStructuralFeature <em>EStructural Feature</em>}'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the meta object for the reference '<em>EStructural Feature</em>'. - * @see org.eclipse.emf.facet.custom.metamodel.v0_2_0.internal.treeproxy.EStructuralFeatureTreeElement#getEStructuralFeature() - * @see #getEStructuralFeatureTreeElement() - * @generated - */ - EReference getEStructuralFeatureTreeElement_EStructuralFeature(); - - /** - * Returns the factory that creates the instances of the model. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the factory that creates the instances of the model. - * @generated - */ - TreeproxyFactory getTreeproxyFactory(); - - /** - * <!-- begin-user-doc --> - * Defines literals for the meta objects that represent - * <ul> - * <li>each class,</li> - * <li>each feature of each class,</li> - * <li>each enum,</li> - * <li>and each data type</li> - * </ul> - * <!-- end-user-doc --> - * @generated - */ - interface Literals { - /** - * The meta object literal for the '{@link org.eclipse.emf.facet.custom.metamodel.v0_2_0.internal.treeproxy.impl.TreeElementImpl <em>Tree Element</em>}' class. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see org.eclipse.emf.facet.custom.metamodel.v0_2_0.internal.treeproxy.impl.TreeElementImpl - * @see org.eclipse.emf.facet.custom.metamodel.v0_2_0.internal.treeproxy.impl.TreeproxyPackageImpl#getTreeElement() - * @generated - */ - EClass TREE_ELEMENT = eINSTANCE.getTreeElement(); - - /** - * The meta object literal for the '<em><b>Parent</b></em>' container reference feature. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - EReference TREE_ELEMENT__PARENT = eINSTANCE.getTreeElement_Parent(); - - /** - * The meta object literal for the '<em><b>Children</b></em>' containment reference list feature. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - EReference TREE_ELEMENT__CHILDREN = eINSTANCE.getTreeElement_Children(); - - /** - * The meta object literal for the '{@link org.eclipse.emf.facet.custom.metamodel.v0_2_0.internal.treeproxy.impl.EObjectTreeElementImpl <em>EObject Tree Element</em>}' class. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see org.eclipse.emf.facet.custom.metamodel.v0_2_0.internal.treeproxy.impl.EObjectTreeElementImpl - * @see org.eclipse.emf.facet.custom.metamodel.v0_2_0.internal.treeproxy.impl.TreeproxyPackageImpl#getEObjectTreeElement() - * @generated - */ - EClass EOBJECT_TREE_ELEMENT = eINSTANCE.getEObjectTreeElement(); - - /** - * The meta object literal for the '<em><b>EObject</b></em>' reference feature. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - EReference EOBJECT_TREE_ELEMENT__EOBJECT = eINSTANCE.getEObjectTreeElement_EObject(); - - /** - * The meta object literal for the '{@link org.eclipse.emf.facet.custom.metamodel.v0_2_0.internal.treeproxy.impl.EReferenceTreeElementImpl <em>EReference Tree Element</em>}' class. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see org.eclipse.emf.facet.custom.metamodel.v0_2_0.internal.treeproxy.impl.EReferenceTreeElementImpl - * @see org.eclipse.emf.facet.custom.metamodel.v0_2_0.internal.treeproxy.impl.TreeproxyPackageImpl#getEReferenceTreeElement() - * @generated - */ - EClass EREFERENCE_TREE_ELEMENT = eINSTANCE.getEReferenceTreeElement(); - - /** - * The meta object literal for the '<em><b>EReference</b></em>' reference feature. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - EReference EREFERENCE_TREE_ELEMENT__EREFERENCE = eINSTANCE.getEReferenceTreeElement_EReference(); - - /** - * The meta object literal for the '{@link org.eclipse.emf.facet.custom.metamodel.v0_2_0.internal.treeproxy.impl.EAttributeTreeElementImpl <em>EAttribute Tree Element</em>}' class. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see org.eclipse.emf.facet.custom.metamodel.v0_2_0.internal.treeproxy.impl.EAttributeTreeElementImpl - * @see org.eclipse.emf.facet.custom.metamodel.v0_2_0.internal.treeproxy.impl.TreeproxyPackageImpl#getEAttributeTreeElement() - * @generated - */ - EClass EATTRIBUTE_TREE_ELEMENT = eINSTANCE.getEAttributeTreeElement(); - - /** - * The meta object literal for the '<em><b>EAttribute</b></em>' reference feature. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - EReference EATTRIBUTE_TREE_ELEMENT__EATTRIBUTE = eINSTANCE.getEAttributeTreeElement_EAttribute(); - - /** - * The meta object literal for the '{@link org.eclipse.emf.facet.custom.metamodel.v0_2_0.internal.treeproxy.impl.EStructuralFeatureTreeElementImpl <em>EStructural Feature Tree Element</em>}' class. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see org.eclipse.emf.facet.custom.metamodel.v0_2_0.internal.treeproxy.impl.EStructuralFeatureTreeElementImpl - * @see org.eclipse.emf.facet.custom.metamodel.v0_2_0.internal.treeproxy.impl.TreeproxyPackageImpl#getEStructuralFeatureTreeElement() - * @generated - */ - EClass ESTRUCTURAL_FEATURE_TREE_ELEMENT = eINSTANCE.getEStructuralFeatureTreeElement(); - - /** - * The meta object literal for the '<em><b>EStructural Feature</b></em>' reference feature. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - EReference ESTRUCTURAL_FEATURE_TREE_ELEMENT__ESTRUCTURAL_FEATURE = eINSTANCE.getEStructuralFeatureTreeElement_EStructuralFeature(); - - } - -} //TreeproxyPackage
diff --git a/org.eclipse.modisco.facet.custom.metamodel/src/org/eclipse/emf/facet/custom/metamodel/v0_2_0/internal/treeproxy/impl/EAttributeTreeElementImpl.java b/org.eclipse.modisco.facet.custom.metamodel/src/org/eclipse/emf/facet/custom/metamodel/v0_2_0/internal/treeproxy/impl/EAttributeTreeElementImpl.java deleted file mode 100644 index 2dac350..0000000 --- a/org.eclipse.modisco.facet.custom.metamodel/src/org/eclipse/emf/facet/custom/metamodel/v0_2_0/internal/treeproxy/impl/EAttributeTreeElementImpl.java +++ /dev/null
@@ -1,112 +0,0 @@ -/** - * Copyright (c) 2012,2014 Mia-Software. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Nicolas Bros (Mia-Software) - Bug 379683 - customizable Tree content provider - * Gregoire Dupe (Mia-Software) - Bug 386387 - [CustomizedTreeContentProvider] The TreeElements are not preserved between two calls to getElements() - * Thomas Cicognani (Soft-Maint) - Bug 441321 - isVisible customisation doesn't work after refreshing a tree - */ -package org.eclipse.emf.facet.custom.metamodel.v0_2_0.internal.treeproxy.impl; - -import org.eclipse.emf.ecore.EAttribute; -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.ecore.EStructuralFeature; - -import org.eclipse.emf.facet.custom.metamodel.v0_2_0.internal.treeproxy.EAttributeTreeElement; -import org.eclipse.emf.facet.custom.metamodel.v0_2_0.internal.treeproxy.TreeproxyPackage; - -/** - * <!-- begin-user-doc --> - * An implementation of the model object '<em><b>EAttribute Tree Element</b></em>'. - * <!-- end-user-doc --> - * <p> - * The following features are implemented: - * <ul> - * <li>{@link org.eclipse.emf.facet.custom.metamodel.v0_2_0.internal.treeproxy.impl.EAttributeTreeElementImpl#getEAttribute <em>EAttribute</em>}</li> - * </ul> - * </p> - * - * @generated - */ -public class EAttributeTreeElementImpl extends EStructuralFeatureTreeElementImpl implements EAttributeTreeElement { - /** - * The cached setting delegate for the '{@link #getEAttribute() <em>EAttribute</em>}' reference. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #getEAttribute() - * @generated - * @ordered - */ - protected EStructuralFeature.Internal.SettingDelegate EATTRIBUTE__ESETTING_DELEGATE = ((EStructuralFeature.Internal)TreeproxyPackage.Literals.EATTRIBUTE_TREE_ELEMENT__EATTRIBUTE).getSettingDelegate(); - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected EAttributeTreeElementImpl() { - super(); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - protected EClass eStaticClass() { - return TreeproxyPackage.Literals.EATTRIBUTE_TREE_ELEMENT; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EAttribute getEAttribute() { - return (EAttribute)EATTRIBUTE__ESETTING_DELEGATE.dynamicGet(this, null, 0, true, false); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EAttribute basicGetEAttribute() { - return (EAttribute)EATTRIBUTE__ESETTING_DELEGATE.dynamicGet(this, null, 0, false, false); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public Object eGet(int featureID, boolean resolve, boolean coreType) { - switch (featureID) { - case TreeproxyPackage.EATTRIBUTE_TREE_ELEMENT__EATTRIBUTE: - if (resolve) return getEAttribute(); - return basicGetEAttribute(); - } - return super.eGet(featureID, resolve, coreType); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public boolean eIsSet(int featureID) { - switch (featureID) { - case TreeproxyPackage.EATTRIBUTE_TREE_ELEMENT__EATTRIBUTE: - return EATTRIBUTE__ESETTING_DELEGATE.dynamicIsSet(this, null, 0); - } - return super.eIsSet(featureID); - } - -} //EAttributeTreeElementImpl
diff --git a/org.eclipse.modisco.facet.custom.metamodel/src/org/eclipse/emf/facet/custom/metamodel/v0_2_0/internal/treeproxy/impl/EObjectTreeElementImpl.java b/org.eclipse.modisco.facet.custom.metamodel/src/org/eclipse/emf/facet/custom/metamodel/v0_2_0/internal/treeproxy/impl/EObjectTreeElementImpl.java deleted file mode 100644 index 742a2e0..0000000 --- a/org.eclipse.modisco.facet.custom.metamodel/src/org/eclipse/emf/facet/custom/metamodel/v0_2_0/internal/treeproxy/impl/EObjectTreeElementImpl.java +++ /dev/null
@@ -1,167 +0,0 @@ -/** - * Copyright (c) 2012,2014 Mia-Software. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Nicolas Bros (Mia-Software) - Bug 379683 - customizable Tree content provider - * Gregoire Dupe (Mia-Software) - Bug 386387 - [CustomizedTreeContentProvider] The TreeElements are not preserved between two calls to getElements() - * Thomas Cicognani (Soft-Maint) - Bug 441321 - isVisible customisation doesn't work after refreshing a tree - */ -package org.eclipse.emf.facet.custom.metamodel.v0_2_0.internal.treeproxy.impl; - -import org.eclipse.emf.common.notify.Notification; - -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.InternalEObject; - -import org.eclipse.emf.ecore.impl.ENotificationImpl; - -import org.eclipse.emf.facet.custom.metamodel.v0_2_0.internal.treeproxy.EObjectTreeElement; -import org.eclipse.emf.facet.custom.metamodel.v0_2_0.internal.treeproxy.TreeproxyPackage; - -/** - * <!-- begin-user-doc --> - * An implementation of the model object '<em><b>EObject Tree Element</b></em>'. - * <!-- end-user-doc --> - * <p> - * The following features are implemented: - * <ul> - * <li>{@link org.eclipse.emf.facet.custom.metamodel.v0_2_0.internal.treeproxy.impl.EObjectTreeElementImpl#getEObject <em>EObject</em>}</li> - * </ul> - * </p> - * - * @generated - * @since 0.5 - */ -public class EObjectTreeElementImpl extends TreeElementImpl implements EObjectTreeElement { - /** - * The cached value of the '{@link #getEObject() <em>EObject</em>}' reference. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #getEObject() - * @generated - * @ordered - */ - protected EObject eObject; - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected EObjectTreeElementImpl() { - super(); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - protected EClass eStaticClass() { - return TreeproxyPackage.Literals.EOBJECT_TREE_ELEMENT; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EObject getEObject() { - if (eObject != null && eObject.eIsProxy()) { - InternalEObject oldEObject = (InternalEObject)eObject; - eObject = eResolveProxy(oldEObject); - if (eObject != oldEObject) { - if (eNotificationRequired()) - eNotify(new ENotificationImpl(this, Notification.RESOLVE, TreeproxyPackage.EOBJECT_TREE_ELEMENT__EOBJECT, oldEObject, eObject)); - } - } - return eObject; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EObject basicGetEObject() { - return eObject; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public void setEObject(EObject newEObject) { - EObject oldEObject = eObject; - eObject = newEObject; - if (eNotificationRequired()) - eNotify(new ENotificationImpl(this, Notification.SET, TreeproxyPackage.EOBJECT_TREE_ELEMENT__EOBJECT, oldEObject, eObject)); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public Object eGet(int featureID, boolean resolve, boolean coreType) { - switch (featureID) { - case TreeproxyPackage.EOBJECT_TREE_ELEMENT__EOBJECT: - if (resolve) return getEObject(); - return basicGetEObject(); - } - return super.eGet(featureID, resolve, coreType); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public void eSet(int featureID, Object newValue) { - switch (featureID) { - case TreeproxyPackage.EOBJECT_TREE_ELEMENT__EOBJECT: - setEObject((EObject)newValue); - return; - } - super.eSet(featureID, newValue); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public void eUnset(int featureID) { - switch (featureID) { - case TreeproxyPackage.EOBJECT_TREE_ELEMENT__EOBJECT: - setEObject((EObject)null); - return; - } - super.eUnset(featureID); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public boolean eIsSet(int featureID) { - switch (featureID) { - case TreeproxyPackage.EOBJECT_TREE_ELEMENT__EOBJECT: - return eObject != null; - } - return super.eIsSet(featureID); - } - -} //EObjectTreeElementImpl
diff --git a/org.eclipse.modisco.facet.custom.metamodel/src/org/eclipse/emf/facet/custom/metamodel/v0_2_0/internal/treeproxy/impl/EReferenceTreeElementImpl.java b/org.eclipse.modisco.facet.custom.metamodel/src/org/eclipse/emf/facet/custom/metamodel/v0_2_0/internal/treeproxy/impl/EReferenceTreeElementImpl.java deleted file mode 100644 index e6ce28b..0000000 --- a/org.eclipse.modisco.facet.custom.metamodel/src/org/eclipse/emf/facet/custom/metamodel/v0_2_0/internal/treeproxy/impl/EReferenceTreeElementImpl.java +++ /dev/null
@@ -1,112 +0,0 @@ -/** - * Copyright (c) 2012,2014 Mia-Software. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Nicolas Bros (Mia-Software) - Bug 379683 - customizable Tree content provider - * Gregoire Dupe (Mia-Software) - Bug 386387 - [CustomizedTreeContentProvider] The TreeElements are not preserved between two calls to getElements() - * Thomas Cicognani (Soft-Maint) - Bug 441321 - isVisible customisation doesn't work after refreshing a tree - */ -package org.eclipse.emf.facet.custom.metamodel.v0_2_0.internal.treeproxy.impl; - -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.ecore.EReference; -import org.eclipse.emf.ecore.EStructuralFeature; - -import org.eclipse.emf.facet.custom.metamodel.v0_2_0.internal.treeproxy.EReferenceTreeElement; -import org.eclipse.emf.facet.custom.metamodel.v0_2_0.internal.treeproxy.TreeproxyPackage; - -/** - * <!-- begin-user-doc --> - * An implementation of the model object '<em><b>EReference Tree Element</b></em>'. - * <!-- end-user-doc --> - * <p> - * The following features are implemented: - * <ul> - * <li>{@link org.eclipse.emf.facet.custom.metamodel.v0_2_0.internal.treeproxy.impl.EReferenceTreeElementImpl#getEReference <em>EReference</em>}</li> - * </ul> - * </p> - * - * @generated - */ -public class EReferenceTreeElementImpl extends EStructuralFeatureTreeElementImpl implements EReferenceTreeElement { - /** - * The cached setting delegate for the '{@link #getEReference() <em>EReference</em>}' reference. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #getEReference() - * @generated - * @ordered - */ - protected EStructuralFeature.Internal.SettingDelegate EREFERENCE__ESETTING_DELEGATE = ((EStructuralFeature.Internal)TreeproxyPackage.Literals.EREFERENCE_TREE_ELEMENT__EREFERENCE).getSettingDelegate(); - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected EReferenceTreeElementImpl() { - super(); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - protected EClass eStaticClass() { - return TreeproxyPackage.Literals.EREFERENCE_TREE_ELEMENT; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EReference getEReference() { - return (EReference)EREFERENCE__ESETTING_DELEGATE.dynamicGet(this, null, 0, true, false); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EReference basicGetEReference() { - return (EReference)EREFERENCE__ESETTING_DELEGATE.dynamicGet(this, null, 0, false, false); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public Object eGet(int featureID, boolean resolve, boolean coreType) { - switch (featureID) { - case TreeproxyPackage.EREFERENCE_TREE_ELEMENT__EREFERENCE: - if (resolve) return getEReference(); - return basicGetEReference(); - } - return super.eGet(featureID, resolve, coreType); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public boolean eIsSet(int featureID) { - switch (featureID) { - case TreeproxyPackage.EREFERENCE_TREE_ELEMENT__EREFERENCE: - return EREFERENCE__ESETTING_DELEGATE.dynamicIsSet(this, null, 0); - } - return super.eIsSet(featureID); - } - -} //EReferenceTreeElementImpl
diff --git a/org.eclipse.modisco.facet.custom.metamodel/src/org/eclipse/emf/facet/custom/metamodel/v0_2_0/internal/treeproxy/impl/EStructuralFeatureTreeElementImpl.java b/org.eclipse.modisco.facet.custom.metamodel/src/org/eclipse/emf/facet/custom/metamodel/v0_2_0/internal/treeproxy/impl/EStructuralFeatureTreeElementImpl.java deleted file mode 100644 index 0ffb2f2..0000000 --- a/org.eclipse.modisco.facet.custom.metamodel/src/org/eclipse/emf/facet/custom/metamodel/v0_2_0/internal/treeproxy/impl/EStructuralFeatureTreeElementImpl.java +++ /dev/null
@@ -1,167 +0,0 @@ -/** - * Copyright (c) 2012,2014 Mia-Software. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Nicolas Bros (Mia-Software) - Bug 379683 - customizable Tree content provider - * Gregoire Dupe (Mia-Software) - Bug 386387 - [CustomizedTreeContentProvider] The TreeElements are not preserved between two calls to getElements() - * Thomas Cicognani (Soft-Maint) - Bug 441321 - isVisible customisation doesn't work after refreshing a tree - */ -package org.eclipse.emf.facet.custom.metamodel.v0_2_0.internal.treeproxy.impl; - -import org.eclipse.emf.common.notify.Notification; - -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.ecore.EStructuralFeature; -import org.eclipse.emf.ecore.InternalEObject; - -import org.eclipse.emf.ecore.impl.ENotificationImpl; - -import org.eclipse.emf.facet.custom.metamodel.v0_2_0.internal.treeproxy.EStructuralFeatureTreeElement; -import org.eclipse.emf.facet.custom.metamodel.v0_2_0.internal.treeproxy.TreeproxyPackage; - -/** - * <!-- begin-user-doc --> - * An implementation of the model object '<em><b>EStructural Feature Tree Element</b></em>'. - * <!-- end-user-doc --> - * <p> - * The following features are implemented: - * <ul> - * <li>{@link org.eclipse.emf.facet.custom.metamodel.v0_2_0.internal.treeproxy.impl.EStructuralFeatureTreeElementImpl#getEStructuralFeature <em>EStructural Feature</em>}</li> - * </ul> - * </p> - * - * @generated - * @since 0.5 - */ -public abstract class EStructuralFeatureTreeElementImpl extends TreeElementImpl implements EStructuralFeatureTreeElement { - /** - * The cached value of the '{@link #getEStructuralFeature() <em>EStructural Feature</em>}' reference. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #getEStructuralFeature() - * @generated - * @ordered - */ - protected EStructuralFeature eStructuralFeature; - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected EStructuralFeatureTreeElementImpl() { - super(); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - protected EClass eStaticClass() { - return TreeproxyPackage.Literals.ESTRUCTURAL_FEATURE_TREE_ELEMENT; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EStructuralFeature getEStructuralFeature() { - if (eStructuralFeature != null && eStructuralFeature.eIsProxy()) { - InternalEObject oldEStructuralFeature = (InternalEObject)eStructuralFeature; - eStructuralFeature = (EStructuralFeature)eResolveProxy(oldEStructuralFeature); - if (eStructuralFeature != oldEStructuralFeature) { - if (eNotificationRequired()) - eNotify(new ENotificationImpl(this, Notification.RESOLVE, TreeproxyPackage.ESTRUCTURAL_FEATURE_TREE_ELEMENT__ESTRUCTURAL_FEATURE, oldEStructuralFeature, eStructuralFeature)); - } - } - return eStructuralFeature; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EStructuralFeature basicGetEStructuralFeature() { - return eStructuralFeature; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public void setEStructuralFeature(EStructuralFeature newEStructuralFeature) { - EStructuralFeature oldEStructuralFeature = eStructuralFeature; - eStructuralFeature = newEStructuralFeature; - if (eNotificationRequired()) - eNotify(new ENotificationImpl(this, Notification.SET, TreeproxyPackage.ESTRUCTURAL_FEATURE_TREE_ELEMENT__ESTRUCTURAL_FEATURE, oldEStructuralFeature, eStructuralFeature)); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public Object eGet(int featureID, boolean resolve, boolean coreType) { - switch (featureID) { - case TreeproxyPackage.ESTRUCTURAL_FEATURE_TREE_ELEMENT__ESTRUCTURAL_FEATURE: - if (resolve) return getEStructuralFeature(); - return basicGetEStructuralFeature(); - } - return super.eGet(featureID, resolve, coreType); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public void eSet(int featureID, Object newValue) { - switch (featureID) { - case TreeproxyPackage.ESTRUCTURAL_FEATURE_TREE_ELEMENT__ESTRUCTURAL_FEATURE: - setEStructuralFeature((EStructuralFeature)newValue); - return; - } - super.eSet(featureID, newValue); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public void eUnset(int featureID) { - switch (featureID) { - case TreeproxyPackage.ESTRUCTURAL_FEATURE_TREE_ELEMENT__ESTRUCTURAL_FEATURE: - setEStructuralFeature((EStructuralFeature)null); - return; - } - super.eUnset(featureID); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public boolean eIsSet(int featureID) { - switch (featureID) { - case TreeproxyPackage.ESTRUCTURAL_FEATURE_TREE_ELEMENT__ESTRUCTURAL_FEATURE: - return eStructuralFeature != null; - } - return super.eIsSet(featureID); - } - -} //EStructuralFeatureTreeElementImpl
diff --git a/org.eclipse.modisco.facet.custom.metamodel/src/org/eclipse/emf/facet/custom/metamodel/v0_2_0/internal/treeproxy/impl/TreeElementImpl.java b/org.eclipse.modisco.facet.custom.metamodel/src/org/eclipse/emf/facet/custom/metamodel/v0_2_0/internal/treeproxy/impl/TreeElementImpl.java deleted file mode 100644 index 6231b20..0000000 --- a/org.eclipse.modisco.facet.custom.metamodel/src/org/eclipse/emf/facet/custom/metamodel/v0_2_0/internal/treeproxy/impl/TreeElementImpl.java +++ /dev/null
@@ -1,251 +0,0 @@ -/** - * Copyright (c) 2012,2014 Mia-Software. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Nicolas Bros (Mia-Software) - Bug 379683 - customizable Tree content provider - * Gregoire Dupe (Mia-Software) - Bug 386387 - [CustomizedTreeContentProvider] The TreeElements are not preserved between two calls to getElements() - * Thomas Cicognani (Soft-Maint) - Bug 441321 - isVisible customisation doesn't work after refreshing a tree - */ -package org.eclipse.emf.facet.custom.metamodel.v0_2_0.internal.treeproxy.impl; - -import java.util.Collection; - -import org.eclipse.emf.common.notify.Notification; -import org.eclipse.emf.common.notify.NotificationChain; - -import org.eclipse.emf.common.util.EList; - -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.ecore.InternalEObject; - -import org.eclipse.emf.ecore.impl.ENotificationImpl; -import org.eclipse.emf.ecore.impl.EObjectImpl; - -import org.eclipse.emf.ecore.util.EObjectContainmentWithInverseEList; -import org.eclipse.emf.ecore.util.EcoreUtil; -import org.eclipse.emf.ecore.util.InternalEList; - -import org.eclipse.emf.facet.custom.metamodel.v0_2_0.internal.treeproxy.TreeElement; -import org.eclipse.emf.facet.custom.metamodel.v0_2_0.internal.treeproxy.TreeproxyPackage; - -/** - * <!-- begin-user-doc --> - * An implementation of the model object '<em><b>Tree Element</b></em>'. - * <!-- end-user-doc --> - * <p> - * The following features are implemented: - * <ul> - * <li>{@link org.eclipse.emf.facet.custom.metamodel.v0_2_0.internal.treeproxy.impl.TreeElementImpl#getParent <em>Parent</em>}</li> - * <li>{@link org.eclipse.emf.facet.custom.metamodel.v0_2_0.internal.treeproxy.impl.TreeElementImpl#getChildren <em>Children</em>}</li> - * </ul> - * </p> - * - * @generated - */ -public abstract class TreeElementImpl extends EObjectImpl implements TreeElement { - /** - * The cached value of the '{@link #getChildren() <em>Children</em>}' containment reference list. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #getChildren() - * @generated - * @ordered - */ - protected EList<TreeElement> children; - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected TreeElementImpl() { - super(); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - protected EClass eStaticClass() { - return TreeproxyPackage.Literals.TREE_ELEMENT; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public TreeElement getParent() { - if (eContainerFeatureID() != TreeproxyPackage.TREE_ELEMENT__PARENT) return null; - return (TreeElement)eInternalContainer(); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public NotificationChain basicSetParent(TreeElement newParent, NotificationChain msgs) { - msgs = eBasicSetContainer((InternalEObject)newParent, TreeproxyPackage.TREE_ELEMENT__PARENT, msgs); - return msgs; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public void setParent(TreeElement newParent) { - if (newParent != eInternalContainer() || (eContainerFeatureID() != TreeproxyPackage.TREE_ELEMENT__PARENT && newParent != null)) { - if (EcoreUtil.isAncestor(this, newParent)) - throw new IllegalArgumentException("Recursive containment not allowed for " + toString()); - NotificationChain msgs = null; - if (eInternalContainer() != null) - msgs = eBasicRemoveFromContainer(msgs); - if (newParent != null) - msgs = ((InternalEObject)newParent).eInverseAdd(this, TreeproxyPackage.TREE_ELEMENT__CHILDREN, TreeElement.class, msgs); - msgs = basicSetParent(newParent, msgs); - if (msgs != null) msgs.dispatch(); - } - else if (eNotificationRequired()) - eNotify(new ENotificationImpl(this, Notification.SET, TreeproxyPackage.TREE_ELEMENT__PARENT, newParent, newParent)); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EList<TreeElement> getChildren() { - if (children == null) { - children = new EObjectContainmentWithInverseEList<TreeElement>(TreeElement.class, this, TreeproxyPackage.TREE_ELEMENT__CHILDREN, TreeproxyPackage.TREE_ELEMENT__PARENT); - } - return children; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @SuppressWarnings("unchecked") - @Override - public NotificationChain eInverseAdd(InternalEObject otherEnd, int featureID, NotificationChain msgs) { - switch (featureID) { - case TreeproxyPackage.TREE_ELEMENT__PARENT: - if (eInternalContainer() != null) - msgs = eBasicRemoveFromContainer(msgs); - return basicSetParent((TreeElement)otherEnd, msgs); - case TreeproxyPackage.TREE_ELEMENT__CHILDREN: - return ((InternalEList<InternalEObject>)(InternalEList<?>)getChildren()).basicAdd(otherEnd, msgs); - } - return super.eInverseAdd(otherEnd, featureID, msgs); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { - switch (featureID) { - case TreeproxyPackage.TREE_ELEMENT__PARENT: - return basicSetParent(null, msgs); - case TreeproxyPackage.TREE_ELEMENT__CHILDREN: - return ((InternalEList<?>)getChildren()).basicRemove(otherEnd, msgs); - } - return super.eInverseRemove(otherEnd, featureID, msgs); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public NotificationChain eBasicRemoveFromContainerFeature(NotificationChain msgs) { - switch (eContainerFeatureID()) { - case TreeproxyPackage.TREE_ELEMENT__PARENT: - return eInternalContainer().eInverseRemove(this, TreeproxyPackage.TREE_ELEMENT__CHILDREN, TreeElement.class, msgs); - } - return super.eBasicRemoveFromContainerFeature(msgs); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public Object eGet(int featureID, boolean resolve, boolean coreType) { - switch (featureID) { - case TreeproxyPackage.TREE_ELEMENT__PARENT: - return getParent(); - case TreeproxyPackage.TREE_ELEMENT__CHILDREN: - return getChildren(); - } - return super.eGet(featureID, resolve, coreType); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @SuppressWarnings("unchecked") - @Override - public void eSet(int featureID, Object newValue) { - switch (featureID) { - case TreeproxyPackage.TREE_ELEMENT__PARENT: - setParent((TreeElement)newValue); - return; - case TreeproxyPackage.TREE_ELEMENT__CHILDREN: - getChildren().clear(); - getChildren().addAll((Collection<? extends TreeElement>)newValue); - return; - } - super.eSet(featureID, newValue); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public void eUnset(int featureID) { - switch (featureID) { - case TreeproxyPackage.TREE_ELEMENT__PARENT: - setParent((TreeElement)null); - return; - case TreeproxyPackage.TREE_ELEMENT__CHILDREN: - getChildren().clear(); - return; - } - super.eUnset(featureID); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public boolean eIsSet(int featureID) { - switch (featureID) { - case TreeproxyPackage.TREE_ELEMENT__PARENT: - return getParent() != null; - case TreeproxyPackage.TREE_ELEMENT__CHILDREN: - return children != null && !children.isEmpty(); - } - return super.eIsSet(featureID); - } - -} //TreeElementImpl
diff --git a/org.eclipse.modisco.facet.custom.metamodel/src/org/eclipse/emf/facet/custom/metamodel/v0_2_0/internal/treeproxy/impl/TreeproxyFactoryImpl.java b/org.eclipse.modisco.facet.custom.metamodel/src/org/eclipse/emf/facet/custom/metamodel/v0_2_0/internal/treeproxy/impl/TreeproxyFactoryImpl.java deleted file mode 100644 index ef3c9a2..0000000 --- a/org.eclipse.modisco.facet.custom.metamodel/src/org/eclipse/emf/facet/custom/metamodel/v0_2_0/internal/treeproxy/impl/TreeproxyFactoryImpl.java +++ /dev/null
@@ -1,127 +0,0 @@ -/** - * Copyright (c) 2012,2014 Mia-Software. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Nicolas Bros (Mia-Software) - Bug 379683 - customizable Tree content provider - * Gregoire Dupe (Mia-Software) - Bug 386387 - [CustomizedTreeContentProvider] The TreeElements are not preserved between two calls to getElements() - * Thomas Cicognani (Soft-Maint) - Bug 441321 - isVisible customisation doesn't work after refreshing a tree - */ -package org.eclipse.emf.facet.custom.metamodel.v0_2_0.internal.treeproxy.impl; - -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.EPackage; - -import org.eclipse.emf.ecore.impl.EFactoryImpl; - -import org.eclipse.emf.ecore.plugin.EcorePlugin; - -import org.eclipse.emf.facet.custom.metamodel.v0_2_0.internal.treeproxy.*; - -/** - * <!-- begin-user-doc --> - * An implementation of the model <b>Factory</b>. - * <!-- end-user-doc --> - * @generated - */ -public class TreeproxyFactoryImpl extends EFactoryImpl implements TreeproxyFactory { - /** - * Creates the default factory implementation. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public static TreeproxyFactory init() { - try { - TreeproxyFactory theTreeproxyFactory = (TreeproxyFactory)EPackage.Registry.INSTANCE.getEFactory(TreeproxyPackage.eNS_URI); - if (theTreeproxyFactory != null) { - return theTreeproxyFactory; - } - } - catch (Exception exception) { - EcorePlugin.INSTANCE.log(exception); - } - return new TreeproxyFactoryImpl(); - } - - /** - * Creates an instance of the factory. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public TreeproxyFactoryImpl() { - super(); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public EObject create(EClass eClass) { - switch (eClass.getClassifierID()) { - case TreeproxyPackage.EOBJECT_TREE_ELEMENT: return createEObjectTreeElement(); - case TreeproxyPackage.EREFERENCE_TREE_ELEMENT: return createEReferenceTreeElement(); - case TreeproxyPackage.EATTRIBUTE_TREE_ELEMENT: return createEAttributeTreeElement(); - default: - throw new IllegalArgumentException("The class '" + eClass.getName() + "' is not a valid classifier"); - } - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EObjectTreeElement createEObjectTreeElement() { - EObjectTreeElementImpl eObjectTreeElement = new EObjectTreeElementImpl(); - return eObjectTreeElement; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EReferenceTreeElement createEReferenceTreeElement() { - EReferenceTreeElementImpl eReferenceTreeElement = new EReferenceTreeElementImpl(); - return eReferenceTreeElement; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EAttributeTreeElement createEAttributeTreeElement() { - EAttributeTreeElementImpl eAttributeTreeElement = new EAttributeTreeElementImpl(); - return eAttributeTreeElement; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public TreeproxyPackage getTreeproxyPackage() { - return (TreeproxyPackage)getEPackage(); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @deprecated - * @generated - */ - @Deprecated - public static TreeproxyPackage getPackage() { - return TreeproxyPackage.eINSTANCE; - } - -} //TreeproxyFactoryImpl
diff --git a/org.eclipse.modisco.facet.custom.metamodel/src/org/eclipse/emf/facet/custom/metamodel/v0_2_0/internal/treeproxy/impl/TreeproxyPackageImpl.java b/org.eclipse.modisco.facet.custom.metamodel/src/org/eclipse/emf/facet/custom/metamodel/v0_2_0/internal/treeproxy/impl/TreeproxyPackageImpl.java deleted file mode 100644 index f3279bd..0000000 --- a/org.eclipse.modisco.facet.custom.metamodel/src/org/eclipse/emf/facet/custom/metamodel/v0_2_0/internal/treeproxy/impl/TreeproxyPackageImpl.java +++ /dev/null
@@ -1,381 +0,0 @@ -/** - * Copyright (c) 2012,2014 Mia-Software. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Nicolas Bros (Mia-Software) - Bug 379683 - customizable Tree content provider - * Gregoire Dupe (Mia-Software) - Bug 386387 - [CustomizedTreeContentProvider] The TreeElements are not preserved between two calls to getElements() - * Thomas Cicognani (Soft-Maint) - Bug 441321 - isVisible customisation doesn't work after refreshing a tree - */ -package org.eclipse.emf.facet.custom.metamodel.v0_2_0.internal.treeproxy.impl; - -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.ecore.EPackage; -import org.eclipse.emf.ecore.EReference; -import org.eclipse.emf.ecore.EcorePackage; - -import org.eclipse.emf.ecore.impl.EPackageImpl; - -import org.eclipse.emf.facet.custom.metamodel.v0_2_0.internal.treeproxy.EAttributeTreeElement; -import org.eclipse.emf.facet.custom.metamodel.v0_2_0.internal.treeproxy.EObjectTreeElement; -import org.eclipse.emf.facet.custom.metamodel.v0_2_0.internal.treeproxy.EReferenceTreeElement; -import org.eclipse.emf.facet.custom.metamodel.v0_2_0.internal.treeproxy.EStructuralFeatureTreeElement; -import org.eclipse.emf.facet.custom.metamodel.v0_2_0.internal.treeproxy.TreeElement; -import org.eclipse.emf.facet.custom.metamodel.v0_2_0.internal.treeproxy.TreeproxyFactory; -import org.eclipse.emf.facet.custom.metamodel.v0_2_0.internal.treeproxy.TreeproxyPackage; - -/** - * <!-- begin-user-doc --> - * An implementation of the model <b>Package</b>. - * <!-- end-user-doc --> - * @generated - */ -public class TreeproxyPackageImpl extends EPackageImpl implements TreeproxyPackage { - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - private EClass treeElementEClass = null; - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - private EClass eObjectTreeElementEClass = null; - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - private EClass eReferenceTreeElementEClass = null; - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - private EClass eAttributeTreeElementEClass = null; - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - private EClass eStructuralFeatureTreeElementEClass = null; - - /** - * Creates an instance of the model <b>Package</b>, registered with - * {@link org.eclipse.emf.ecore.EPackage.Registry EPackage.Registry} by the package - * package URI value. - * <p>Note: the correct way to create the package is via the static - * factory method {@link #init init()}, which also performs - * initialization of the package, or returns the registered package, - * if one already exists. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see org.eclipse.emf.ecore.EPackage.Registry - * @see org.eclipse.emf.facet.custom.metamodel.v0_2_0.internal.treeproxy.TreeproxyPackage#eNS_URI - * @see #init() - * @generated - */ - private TreeproxyPackageImpl() { - super(eNS_URI, TreeproxyFactory.eINSTANCE); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - private static boolean isInited = false; - - /** - * Creates, registers, and initializes the <b>Package</b> for this model, and for any others upon which it depends. - * - * <p>This method is used to initialize {@link TreeproxyPackage#eINSTANCE} when that field is accessed. - * Clients should not invoke it directly. Instead, they should simply access that field to obtain the package. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #eNS_URI - * @see #createPackageContents() - * @see #initializePackageContents() - * @generated - */ - public static TreeproxyPackage init() { - if (isInited) return (TreeproxyPackage)EPackage.Registry.INSTANCE.getEPackage(TreeproxyPackage.eNS_URI); - - // Obtain or create and register package - TreeproxyPackageImpl theTreeproxyPackage = (TreeproxyPackageImpl)(EPackage.Registry.INSTANCE.get(eNS_URI) instanceof TreeproxyPackageImpl ? EPackage.Registry.INSTANCE.get(eNS_URI) : new TreeproxyPackageImpl()); - - isInited = true; - - // Initialize simple dependencies - EcorePackage.eINSTANCE.eClass(); - - // Create package meta-data objects - theTreeproxyPackage.createPackageContents(); - - // Initialize created meta-data - theTreeproxyPackage.initializePackageContents(); - - // Mark meta-data to indicate it can't be changed - theTreeproxyPackage.freeze(); - - - // Update the registry and return the package - EPackage.Registry.INSTANCE.put(TreeproxyPackage.eNS_URI, theTreeproxyPackage); - return theTreeproxyPackage; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EClass getTreeElement() { - return treeElementEClass; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EReference getTreeElement_Parent() { - return (EReference)treeElementEClass.getEStructuralFeatures().get(0); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EReference getTreeElement_Children() { - return (EReference)treeElementEClass.getEStructuralFeatures().get(1); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EClass getEObjectTreeElement() { - return eObjectTreeElementEClass; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EReference getEObjectTreeElement_EObject() { - return (EReference)eObjectTreeElementEClass.getEStructuralFeatures().get(0); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EClass getEReferenceTreeElement() { - return eReferenceTreeElementEClass; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EReference getEReferenceTreeElement_EReference() { - return (EReference)eReferenceTreeElementEClass.getEStructuralFeatures().get(0); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EClass getEAttributeTreeElement() { - return eAttributeTreeElementEClass; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EReference getEAttributeTreeElement_EAttribute() { - return (EReference)eAttributeTreeElementEClass.getEStructuralFeatures().get(0); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EClass getEStructuralFeatureTreeElement() { - return eStructuralFeatureTreeElementEClass; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EReference getEStructuralFeatureTreeElement_EStructuralFeature() { - return (EReference)eStructuralFeatureTreeElementEClass.getEStructuralFeatures().get(0); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public TreeproxyFactory getTreeproxyFactory() { - return (TreeproxyFactory)getEFactoryInstance(); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - private boolean isCreated = false; - - /** - * Creates the meta-model objects for the package. This method is - * guarded to have no affect on any invocation but its first. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public void createPackageContents() { - if (isCreated) return; - isCreated = true; - - // Create classes and their features - treeElementEClass = createEClass(TREE_ELEMENT); - createEReference(treeElementEClass, TREE_ELEMENT__PARENT); - createEReference(treeElementEClass, TREE_ELEMENT__CHILDREN); - - eObjectTreeElementEClass = createEClass(EOBJECT_TREE_ELEMENT); - createEReference(eObjectTreeElementEClass, EOBJECT_TREE_ELEMENT__EOBJECT); - - eReferenceTreeElementEClass = createEClass(EREFERENCE_TREE_ELEMENT); - createEReference(eReferenceTreeElementEClass, EREFERENCE_TREE_ELEMENT__EREFERENCE); - - eAttributeTreeElementEClass = createEClass(EATTRIBUTE_TREE_ELEMENT); - createEReference(eAttributeTreeElementEClass, EATTRIBUTE_TREE_ELEMENT__EATTRIBUTE); - - eStructuralFeatureTreeElementEClass = createEClass(ESTRUCTURAL_FEATURE_TREE_ELEMENT); - createEReference(eStructuralFeatureTreeElementEClass, ESTRUCTURAL_FEATURE_TREE_ELEMENT__ESTRUCTURAL_FEATURE); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - private boolean isInitialized = false; - - /** - * Complete the initialization of the package and its meta-model. This - * method is guarded to have no affect on any invocation but its first. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public void initializePackageContents() { - if (isInitialized) return; - isInitialized = true; - - // Initialize package - setName(eNAME); - setNsPrefix(eNS_PREFIX); - setNsURI(eNS_URI); - - // Obtain other dependent packages - EcorePackage theEcorePackage = (EcorePackage)EPackage.Registry.INSTANCE.getEPackage(EcorePackage.eNS_URI); - - // Create type parameters - - // Set bounds for type parameters - - // Add supertypes to classes - eObjectTreeElementEClass.getESuperTypes().add(this.getTreeElement()); - eReferenceTreeElementEClass.getESuperTypes().add(this.getEStructuralFeatureTreeElement()); - eAttributeTreeElementEClass.getESuperTypes().add(this.getEStructuralFeatureTreeElement()); - eStructuralFeatureTreeElementEClass.getESuperTypes().add(this.getTreeElement()); - - // Initialize classes and features; add operations and parameters - initEClass(treeElementEClass, TreeElement.class, "TreeElement", IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); - initEReference(getTreeElement_Parent(), this.getTreeElement(), this.getTreeElement_Children(), "parent", null, 0, 1, TreeElement.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); - initEReference(getTreeElement_Children(), this.getTreeElement(), this.getTreeElement_Parent(), "children", null, 0, -1, TreeElement.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); - - initEClass(eObjectTreeElementEClass, EObjectTreeElement.class, "EObjectTreeElement", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); - initEReference(getEObjectTreeElement_EObject(), ecorePackage.getEObject(), null, "eObject", null, 0, 1, EObjectTreeElement.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); - - initEClass(eReferenceTreeElementEClass, EReferenceTreeElement.class, "EReferenceTreeElement", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); - initEReference(getEReferenceTreeElement_EReference(), theEcorePackage.getEReference(), null, "eReference", null, 0, 1, EReferenceTreeElement.class, IS_TRANSIENT, IS_VOLATILE, !IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, IS_DERIVED, IS_ORDERED); - - initEClass(eAttributeTreeElementEClass, EAttributeTreeElement.class, "EAttributeTreeElement", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); - initEReference(getEAttributeTreeElement_EAttribute(), theEcorePackage.getEAttribute(), null, "eAttribute", null, 0, 1, EAttributeTreeElement.class, IS_TRANSIENT, IS_VOLATILE, !IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, IS_DERIVED, IS_ORDERED); - - initEClass(eStructuralFeatureTreeElementEClass, EStructuralFeatureTreeElement.class, "EStructuralFeatureTreeElement", IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); - initEReference(getEStructuralFeatureTreeElement_EStructuralFeature(), theEcorePackage.getEStructuralFeature(), null, "eStructuralFeature", null, 0, 1, EStructuralFeatureTreeElement.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, IS_DERIVED, IS_ORDERED); - - // Create resource - createResource(eNS_URI); - - // Create annotations - // http://www.eclipse.org/emf/2002/Ecore - createEcoreAnnotations(); - // http://www.eclipse.org/emf/2002/Ecore/OCL - createOCLAnnotations(); - } - - /** - * Initializes the annotations for <b>http://www.eclipse.org/emf/2002/Ecore</b>. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected void createEcoreAnnotations() { - String source = "http://www.eclipse.org/emf/2002/Ecore"; - addAnnotation - (this, - source, - new String[] { - "settingDelegates", "http://www.eclipse.org/emf/2002/Ecore/OCL" - }); - } - - /** - * Initializes the annotations for <b>http://www.eclipse.org/emf/2002/Ecore/OCL</b>. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected void createOCLAnnotations() { - String source = "http://www.eclipse.org/emf/2002/Ecore/OCL"; - addAnnotation - (getEReferenceTreeElement_EReference(), - source, - new String[] { - "derivation", "self.eStructuralFeature.oclAsType(ecore::EReference)" - }); - addAnnotation - (getEAttributeTreeElement_EAttribute(), - source, - new String[] { - "derivation", "self.eStructuralFeature.oclAsType(ecore::EAttribute)" - }); - } - -} //TreeproxyPackageImpl
diff --git a/org.eclipse.modisco.facet.custom.metamodel/src/org/eclipse/emf/facet/custom/metamodel/v0_2_0/internal/treeproxy/util/TreeproxyAdapterFactory.java b/org.eclipse.modisco.facet.custom.metamodel/src/org/eclipse/emf/facet/custom/metamodel/v0_2_0/internal/treeproxy/util/TreeproxyAdapterFactory.java deleted file mode 100644 index c84f80f..0000000 --- a/org.eclipse.modisco.facet.custom.metamodel/src/org/eclipse/emf/facet/custom/metamodel/v0_2_0/internal/treeproxy/util/TreeproxyAdapterFactory.java +++ /dev/null
@@ -1,202 +0,0 @@ -/** - * Copyright (c) 2012,2014 Mia-Software. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Nicolas Bros (Mia-Software) - Bug 379683 - customizable Tree content provider - * Gregoire Dupe (Mia-Software) - Bug 386387 - [CustomizedTreeContentProvider] The TreeElements are not preserved between two calls to getElements() - * Thomas Cicognani (Soft-Maint) - Bug 441321 - isVisible customisation doesn't work after refreshing a tree - */ -package org.eclipse.emf.facet.custom.metamodel.v0_2_0.internal.treeproxy.util; - -import org.eclipse.emf.common.notify.Adapter; -import org.eclipse.emf.common.notify.Notifier; - -import org.eclipse.emf.common.notify.impl.AdapterFactoryImpl; - -import org.eclipse.emf.ecore.EObject; - -import org.eclipse.emf.facet.custom.metamodel.v0_2_0.internal.treeproxy.*; - -/** - * <!-- begin-user-doc --> - * The <b>Adapter Factory</b> for the model. - * It provides an adapter <code>createXXX</code> method for each class of the model. - * <!-- end-user-doc --> - * @see org.eclipse.emf.facet.custom.metamodel.v0_2_0.internal.treeproxy.TreeproxyPackage - * @generated - */ -public class TreeproxyAdapterFactory extends AdapterFactoryImpl { - /** - * The cached model package. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected static TreeproxyPackage modelPackage; - - /** - * Creates an instance of the adapter factory. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public TreeproxyAdapterFactory() { - if (modelPackage == null) { - modelPackage = TreeproxyPackage.eINSTANCE; - } - } - - /** - * Returns whether this factory is applicable for the type of the object. - * <!-- begin-user-doc --> - * This implementation returns <code>true</code> if the object is either the model's package or is an instance object of the model. - * <!-- end-user-doc --> - * @return whether this factory is applicable for the type of the object. - * @generated - */ - @Override - public boolean isFactoryForType(Object object) { - if (object == modelPackage) { - return true; - } - if (object instanceof EObject) { - return ((EObject)object).eClass().getEPackage() == modelPackage; - } - return false; - } - - /** - * The switch that delegates to the <code>createXXX</code> methods. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected TreeproxySwitch<Adapter> modelSwitch = - new TreeproxySwitch<Adapter>() { - @Override - public Adapter caseTreeElement(TreeElement object) { - return createTreeElementAdapter(); - } - @Override - public Adapter caseEObjectTreeElement(EObjectTreeElement object) { - return createEObjectTreeElementAdapter(); - } - @Override - public Adapter caseEReferenceTreeElement(EReferenceTreeElement object) { - return createEReferenceTreeElementAdapter(); - } - @Override - public Adapter caseEAttributeTreeElement(EAttributeTreeElement object) { - return createEAttributeTreeElementAdapter(); - } - @Override - public Adapter caseEStructuralFeatureTreeElement(EStructuralFeatureTreeElement object) { - return createEStructuralFeatureTreeElementAdapter(); - } - @Override - public Adapter defaultCase(EObject object) { - return createEObjectAdapter(); - } - }; - - /** - * Creates an adapter for the <code>target</code>. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @param target the object to adapt. - * @return the adapter for the <code>target</code>. - * @generated - */ - @Override - public Adapter createAdapter(Notifier target) { - return modelSwitch.doSwitch((EObject)target); - } - - - /** - * Creates a new adapter for an object of class '{@link org.eclipse.emf.facet.custom.metamodel.v0_2_0.internal.treeproxy.TreeElement <em>Tree Element</em>}'. - * <!-- begin-user-doc --> - * This default implementation returns null so that we can easily ignore cases; - * it's useful to ignore a case when inheritance will catch all the cases anyway. - * <!-- end-user-doc --> - * @return the new adapter. - * @see org.eclipse.emf.facet.custom.metamodel.v0_2_0.internal.treeproxy.TreeElement - * @generated - */ - public Adapter createTreeElementAdapter() { - return null; - } - - /** - * Creates a new adapter for an object of class '{@link org.eclipse.emf.facet.custom.metamodel.v0_2_0.internal.treeproxy.EObjectTreeElement <em>EObject Tree Element</em>}'. - * <!-- begin-user-doc --> - * This default implementation returns null so that we can easily ignore cases; - * it's useful to ignore a case when inheritance will catch all the cases anyway. - * <!-- end-user-doc --> - * @return the new adapter. - * @see org.eclipse.emf.facet.custom.metamodel.v0_2_0.internal.treeproxy.EObjectTreeElement - * @generated - */ - public Adapter createEObjectTreeElementAdapter() { - return null; - } - - /** - * Creates a new adapter for an object of class '{@link org.eclipse.emf.facet.custom.metamodel.v0_2_0.internal.treeproxy.EReferenceTreeElement <em>EReference Tree Element</em>}'. - * <!-- begin-user-doc --> - * This default implementation returns null so that we can easily ignore cases; - * it's useful to ignore a case when inheritance will catch all the cases anyway. - * <!-- end-user-doc --> - * @return the new adapter. - * @see org.eclipse.emf.facet.custom.metamodel.v0_2_0.internal.treeproxy.EReferenceTreeElement - * @generated - */ - public Adapter createEReferenceTreeElementAdapter() { - return null; - } - - /** - * Creates a new adapter for an object of class '{@link org.eclipse.emf.facet.custom.metamodel.v0_2_0.internal.treeproxy.EAttributeTreeElement <em>EAttribute Tree Element</em>}'. - * <!-- begin-user-doc --> - * This default implementation returns null so that we can easily ignore cases; - * it's useful to ignore a case when inheritance will catch all the cases anyway. - * <!-- end-user-doc --> - * @return the new adapter. - * @see org.eclipse.emf.facet.custom.metamodel.v0_2_0.internal.treeproxy.EAttributeTreeElement - * @generated - */ - public Adapter createEAttributeTreeElementAdapter() { - return null; - } - - /** - * Creates a new adapter for an object of class '{@link org.eclipse.emf.facet.custom.metamodel.v0_2_0.internal.treeproxy.EStructuralFeatureTreeElement <em>EStructural Feature Tree Element</em>}'. - * <!-- begin-user-doc --> - * This default implementation returns null so that we can easily ignore cases; - * it's useful to ignore a case when inheritance will catch all the cases anyway. - * <!-- end-user-doc --> - * @return the new adapter. - * @see org.eclipse.emf.facet.custom.metamodel.v0_2_0.internal.treeproxy.EStructuralFeatureTreeElement - * @generated - */ - public Adapter createEStructuralFeatureTreeElementAdapter() { - return null; - } - - /** - * Creates a new adapter for the default case. - * <!-- begin-user-doc --> - * This default implementation returns null. - * <!-- end-user-doc --> - * @return the new adapter. - * @generated - */ - public Adapter createEObjectAdapter() { - return null; - } - -} //TreeproxyAdapterFactory
diff --git a/org.eclipse.modisco.facet.custom.metamodel/src/org/eclipse/emf/facet/custom/metamodel/v0_2_0/internal/treeproxy/util/TreeproxySwitch.java b/org.eclipse.modisco.facet.custom.metamodel/src/org/eclipse/emf/facet/custom/metamodel/v0_2_0/internal/treeproxy/util/TreeproxySwitch.java deleted file mode 100644 index 68ea98b..0000000 --- a/org.eclipse.modisco.facet.custom.metamodel/src/org/eclipse/emf/facet/custom/metamodel/v0_2_0/internal/treeproxy/util/TreeproxySwitch.java +++ /dev/null
@@ -1,226 +0,0 @@ -/** - * Copyright (c) 2012,2014 Mia-Software. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Nicolas Bros (Mia-Software) - Bug 379683 - customizable Tree content provider - * Gregoire Dupe (Mia-Software) - Bug 386387 - [CustomizedTreeContentProvider] The TreeElements are not preserved between two calls to getElements() - * Thomas Cicognani (Soft-Maint) - Bug 441321 - isVisible customisation doesn't work after refreshing a tree - */ -package org.eclipse.emf.facet.custom.metamodel.v0_2_0.internal.treeproxy.util; - -import java.util.List; - -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.ecore.EObject; - -import org.eclipse.emf.facet.custom.metamodel.v0_2_0.internal.treeproxy.*; - -/** - * <!-- begin-user-doc --> - * The <b>Switch</b> for the model's inheritance hierarchy. - * It supports the call {@link #doSwitch(EObject) doSwitch(object)} - * to invoke the <code>caseXXX</code> method for each class of the model, - * starting with the actual class of the object - * and proceeding up the inheritance hierarchy - * until a non-null result is returned, - * which is the result of the switch. - * <!-- end-user-doc --> - * @see org.eclipse.emf.facet.custom.metamodel.v0_2_0.internal.treeproxy.TreeproxyPackage - * @generated - */ -public class TreeproxySwitch<T> { - /** - * The cached model package - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected static TreeproxyPackage modelPackage; - - /** - * Creates an instance of the switch. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public TreeproxySwitch() { - if (modelPackage == null) { - modelPackage = TreeproxyPackage.eINSTANCE; - } - } - - /** - * Calls <code>caseXXX</code> for each class of the model until one returns a non null result; it yields that result. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the first non-null result returned by a <code>caseXXX</code> call. - * @generated - */ - public T doSwitch(EObject theEObject) { - return doSwitch(theEObject.eClass(), theEObject); - } - - /** - * Calls <code>caseXXX</code> for each class of the model until one returns a non null result; it yields that result. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the first non-null result returned by a <code>caseXXX</code> call. - * @generated - */ - protected T doSwitch(EClass theEClass, EObject theEObject) { - if (theEClass.eContainer() == modelPackage) { - return doSwitch(theEClass.getClassifierID(), theEObject); - } - else { - List<EClass> eSuperTypes = theEClass.getESuperTypes(); - return - eSuperTypes.isEmpty() ? - defaultCase(theEObject) : - doSwitch(eSuperTypes.get(0), theEObject); - } - } - - /** - * Calls <code>caseXXX</code> for each class of the model until one returns a non null result; it yields that result. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the first non-null result returned by a <code>caseXXX</code> call. - * @generated - */ - protected T doSwitch(int classifierID, EObject theEObject) { - switch (classifierID) { - case TreeproxyPackage.TREE_ELEMENT: { - TreeElement treeElement = (TreeElement)theEObject; - T result = caseTreeElement(treeElement); - if (result == null) result = defaultCase(theEObject); - return result; - } - case TreeproxyPackage.EOBJECT_TREE_ELEMENT: { - EObjectTreeElement eObjectTreeElement = (EObjectTreeElement)theEObject; - T result = caseEObjectTreeElement(eObjectTreeElement); - if (result == null) result = caseTreeElement(eObjectTreeElement); - if (result == null) result = defaultCase(theEObject); - return result; - } - case TreeproxyPackage.EREFERENCE_TREE_ELEMENT: { - EReferenceTreeElement eReferenceTreeElement = (EReferenceTreeElement)theEObject; - T result = caseEReferenceTreeElement(eReferenceTreeElement); - if (result == null) result = caseEStructuralFeatureTreeElement(eReferenceTreeElement); - if (result == null) result = caseTreeElement(eReferenceTreeElement); - if (result == null) result = defaultCase(theEObject); - return result; - } - case TreeproxyPackage.EATTRIBUTE_TREE_ELEMENT: { - EAttributeTreeElement eAttributeTreeElement = (EAttributeTreeElement)theEObject; - T result = caseEAttributeTreeElement(eAttributeTreeElement); - if (result == null) result = caseEStructuralFeatureTreeElement(eAttributeTreeElement); - if (result == null) result = caseTreeElement(eAttributeTreeElement); - if (result == null) result = defaultCase(theEObject); - return result; - } - case TreeproxyPackage.ESTRUCTURAL_FEATURE_TREE_ELEMENT: { - EStructuralFeatureTreeElement eStructuralFeatureTreeElement = (EStructuralFeatureTreeElement)theEObject; - T result = caseEStructuralFeatureTreeElement(eStructuralFeatureTreeElement); - if (result == null) result = caseTreeElement(eStructuralFeatureTreeElement); - if (result == null) result = defaultCase(theEObject); - return result; - } - default: return defaultCase(theEObject); - } - } - - /** - * Returns the result of interpreting the object as an instance of '<em>Tree Element</em>'. - * <!-- begin-user-doc --> - * This implementation returns null; - * returning a non-null result will terminate the switch. - * <!-- end-user-doc --> - * @param object the target of the switch. - * @return the result of interpreting the object as an instance of '<em>Tree Element</em>'. - * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) - * @generated - */ - public T caseTreeElement(TreeElement object) { - return null; - } - - /** - * Returns the result of interpreting the object as an instance of '<em>EObject Tree Element</em>'. - * <!-- begin-user-doc --> - * This implementation returns null; - * returning a non-null result will terminate the switch. - * <!-- end-user-doc --> - * @param object the target of the switch. - * @return the result of interpreting the object as an instance of '<em>EObject Tree Element</em>'. - * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) - * @generated - */ - public T caseEObjectTreeElement(EObjectTreeElement object) { - return null; - } - - /** - * Returns the result of interpreting the object as an instance of '<em>EReference Tree Element</em>'. - * <!-- begin-user-doc --> - * This implementation returns null; - * returning a non-null result will terminate the switch. - * <!-- end-user-doc --> - * @param object the target of the switch. - * @return the result of interpreting the object as an instance of '<em>EReference Tree Element</em>'. - * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) - * @generated - */ - public T caseEReferenceTreeElement(EReferenceTreeElement object) { - return null; - } - - /** - * Returns the result of interpreting the object as an instance of '<em>EAttribute Tree Element</em>'. - * <!-- begin-user-doc --> - * This implementation returns null; - * returning a non-null result will terminate the switch. - * <!-- end-user-doc --> - * @param object the target of the switch. - * @return the result of interpreting the object as an instance of '<em>EAttribute Tree Element</em>'. - * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) - * @generated - */ - public T caseEAttributeTreeElement(EAttributeTreeElement object) { - return null; - } - - /** - * Returns the result of interpreting the object as an instance of '<em>EStructural Feature Tree Element</em>'. - * <!-- begin-user-doc --> - * This implementation returns null; - * returning a non-null result will terminate the switch. - * <!-- end-user-doc --> - * @param object the target of the switch. - * @return the result of interpreting the object as an instance of '<em>EStructural Feature Tree Element</em>'. - * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) - * @generated - */ - public T caseEStructuralFeatureTreeElement(EStructuralFeatureTreeElement object) { - return null; - } - - /** - * Returns the result of interpreting the object as an instance of '<em>EObject</em>'. - * <!-- begin-user-doc --> - * This implementation returns null; - * returning a non-null result will terminate the switch, but this is the last case anyway. - * <!-- end-user-doc --> - * @param object the target of the switch. - * @return the result of interpreting the object as an instance of '<em>EObject</em>'. - * @see #doSwitch(org.eclipse.emf.ecore.EObject) - * @generated - */ - public T defaultCase(EObject object) { - return null; - } - -} //TreeproxySwitch
diff --git a/org.eclipse.modisco.facet.custom.metamodel/src/org/eclipse/emf/facet/custom/metamodel/v0_3_0/query/QueryFactory.java b/org.eclipse.modisco.facet.custom.metamodel/src/org/eclipse/emf/facet/custom/metamodel/v0_3_0/query/QueryFactory.java deleted file mode 100644 index cae541a..0000000 --- a/org.eclipse.modisco.facet.custom.metamodel/src/org/eclipse/emf/facet/custom/metamodel/v0_3_0/query/QueryFactory.java +++ /dev/null
@@ -1,52 +0,0 @@ -/** - * Copyright (c) 2013 Soft-Maint. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * David Couvrand (Soft-Maint) - Bug 402725 - Need a query to get an image from an URI - * Nicolas Rault (Soft-Maint) - Bug 402725 - Need a query to get an image from an URI - */ -package org.eclipse.emf.facet.custom.metamodel.v0_3_0.query; - -import org.eclipse.emf.ecore.EFactory; - -/** - * <!-- begin-user-doc --> The <b>Factory</b> for the model. It provides a - * create method for each non-abstract class of the model. <!-- end-user-doc --> - * - * @see org.eclipse.emf.facet.custom.metamodel.v0_3_0.query.QueryPackage - * @generated - * @since 0.3 - */ -public interface QueryFactory extends EFactory { - /** - * The singleton instance of the factory. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - QueryFactory eINSTANCE = org.eclipse.emf.facet.custom.metamodel.v0_3_0.query.impl.QueryFactoryImpl.init(); - - /** - * Returns a new object of class '<em>URI Image Query</em>'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return a new object of class '<em>URI Image Query</em>'. - * @generated - */ - URIImageQuery createURIImageQuery(); - - /** - * Returns the package supported by this factory. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the package supported by this factory. - * @generated - */ - QueryPackage getQueryPackage(); - -} //QueryFactory
diff --git a/org.eclipse.modisco.facet.custom.metamodel/src/org/eclipse/emf/facet/custom/metamodel/v0_3_0/query/QueryPackage.java b/org.eclipse.modisco.facet.custom.metamodel/src/org/eclipse/emf/facet/custom/metamodel/v0_3_0/query/QueryPackage.java deleted file mode 100644 index dfd95a6..0000000 --- a/org.eclipse.modisco.facet.custom.metamodel/src/org/eclipse/emf/facet/custom/metamodel/v0_3_0/query/QueryPackage.java +++ /dev/null
@@ -1,179 +0,0 @@ -/** - * Copyright (c) 2013 Soft-Maint. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * David Couvrand (Soft-Maint) - Bug 402725 - Need a query to get an image from an URI - * Nicolas Rault (Soft-Maint) - Bug 402725 - Need a query to get an image from an URI - */ -package org.eclipse.emf.facet.custom.metamodel.v0_3_0.query; - -import org.eclipse.emf.ecore.EAttribute; -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.ecore.EPackage; - -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.extensible.ExtensiblePackage; - -/** - * <!-- begin-user-doc --> - * The <b>Package</b> for the model. - * It contains accessors for the meta objects to represent - * <ul> - * <li>each class,</li> - * <li>each feature of each class,</li> - * <li>each enum,</li> - * <li>and each data type</li> - * </ul> - * <!-- end-user-doc --> - * @see org.eclipse.emf.facet.custom.metamodel.v0_3_0.query.QueryFactory - * @model kind="package" - * @generated - */ -public interface QueryPackage extends EPackage { - /** - * The package name. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - String eNAME = "query"; - - /** - * The package namespace URI. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - String eNS_URI = "http://www.eclipse.org/emf/facet/custom/0.3.incubation/query"; - - /** - * The package namespace name. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - String eNS_PREFIX = "customQuery"; - - /** - * The singleton instance of the package. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - QueryPackage eINSTANCE = org.eclipse.emf.facet.custom.metamodel.v0_3_0.query.impl.QueryPackageImpl.init(); - - /** - * The meta object id for the '{@link org.eclipse.emf.facet.custom.metamodel.v0_3_0.query.impl.URIImageQueryImpl <em>URI Image Query</em>}' class. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see org.eclipse.emf.facet.custom.metamodel.v0_3_0.query.impl.URIImageQueryImpl - * @see org.eclipse.emf.facet.custom.metamodel.v0_3_0.query.impl.QueryPackageImpl#getURIImageQuery() - * @generated - */ - int URI_IMAGE_QUERY = 0; - - /** - * The feature id for the '<em><b>Can Have Side Effects</b></em>' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int URI_IMAGE_QUERY__CAN_HAVE_SIDE_EFFECTS = ExtensiblePackage.QUERY__CAN_HAVE_SIDE_EFFECTS; - - /** - * The feature id for the '<em><b>Can Be Cached</b></em>' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int URI_IMAGE_QUERY__CAN_BE_CACHED = ExtensiblePackage.QUERY__CAN_BE_CACHED; - - /** - * The feature id for the '<em><b>Uri</b></em>' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int URI_IMAGE_QUERY__URI = ExtensiblePackage.QUERY_FEATURE_COUNT + 0; - - /** - * The number of structural features of the '<em>URI Image Query</em>' class. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int URI_IMAGE_QUERY_FEATURE_COUNT = ExtensiblePackage.QUERY_FEATURE_COUNT + 1; - - - /** - * Returns the meta object for class '{@link org.eclipse.emf.facet.custom.metamodel.v0_3_0.query.URIImageQuery <em>URI Image Query</em>}'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the meta object for class '<em>URI Image Query</em>'. - * @see org.eclipse.emf.facet.custom.metamodel.v0_3_0.query.URIImageQuery - * @generated - */ - EClass getURIImageQuery(); - - /** - * Returns the meta object for the attribute '{@link org.eclipse.emf.facet.custom.metamodel.v0_3_0.query.URIImageQuery#getUri <em>Uri</em>}'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the meta object for the attribute '<em>Uri</em>'. - * @see org.eclipse.emf.facet.custom.metamodel.v0_3_0.query.URIImageQuery#getUri() - * @see #getURIImageQuery() - * @generated - */ - EAttribute getURIImageQuery_Uri(); - - /** - * Returns the factory that creates the instances of the model. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the factory that creates the instances of the model. - * @generated - */ - QueryFactory getQueryFactory(); - - /** - * <!-- begin-user-doc --> - * Defines literals for the meta objects that represent - * <ul> - * <li>each class,</li> - * <li>each feature of each class,</li> - * <li>each enum,</li> - * <li>and each data type</li> - * </ul> - * <!-- end-user-doc --> - * @generated - */ - interface Literals { - /** - * The meta object literal for the '{@link org.eclipse.emf.facet.custom.metamodel.v0_3_0.query.impl.URIImageQueryImpl <em>URI Image Query</em>}' class. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see org.eclipse.emf.facet.custom.metamodel.v0_3_0.query.impl.URIImageQueryImpl - * @see org.eclipse.emf.facet.custom.metamodel.v0_3_0.query.impl.QueryPackageImpl#getURIImageQuery() - * @generated - */ - EClass URI_IMAGE_QUERY = eINSTANCE.getURIImageQuery(); - - /** - * The meta object literal for the '<em><b>Uri</b></em>' attribute feature. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - EAttribute URI_IMAGE_QUERY__URI = eINSTANCE.getURIImageQuery_Uri(); - - } - -} //QueryPackage
diff --git a/org.eclipse.modisco.facet.custom.metamodel/src/org/eclipse/emf/facet/custom/metamodel/v0_3_0/query/URIImageQuery.java b/org.eclipse.modisco.facet.custom.metamodel/src/org/eclipse/emf/facet/custom/metamodel/v0_3_0/query/URIImageQuery.java deleted file mode 100644 index 583dbda..0000000 --- a/org.eclipse.modisco.facet.custom.metamodel/src/org/eclipse/emf/facet/custom/metamodel/v0_3_0/query/URIImageQuery.java +++ /dev/null
@@ -1,62 +0,0 @@ -/** - * Copyright (c) 2013 Soft-Maint. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * David Couvrand (Soft-Maint) - Bug 402725 - Need a query to get an image from an URI - * Nicolas Rault (Soft-Maint) - Bug 402725 - Need a query to get an image from an URI - */ -package org.eclipse.emf.facet.custom.metamodel.v0_3_0.query; - -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.extensible.Query; - -/** - * <!-- begin-user-doc --> A representation of the model object ' - * <em><b>URI Image Query</b></em>'. <!-- end-user-doc --> - * - * <p> - * The following features are supported: - * <ul> - * <li> - * {@link org.eclipse.emf.facet.custom.metamodel.v0_3_0.query.URIImageQuery#getUri - * <em>Uri</em>}</li> - * </ul> - * </p> - * - * @see org.eclipse.emf.facet.custom.metamodel.v0_3_0.query.QueryPackage#getURIImageQuery() - * @model - * @generated - * @since 0.3 - */ -public interface URIImageQuery extends Query { - /** - * Returns the value of the '<em><b>Uri</b></em>' attribute. - * <!-- begin-user-doc --> - * <p> - * If the meaning of the '<em>Uri</em>' attribute isn't clear, - * there really should be more of a description here... - * </p> - * <!-- end-user-doc --> - * @return the value of the '<em>Uri</em>' attribute. - * @see #setUri(String) - * @see org.eclipse.emf.facet.custom.metamodel.v0_3_0.query.QueryPackage#getURIImageQuery_Uri() - * @model - * @generated - */ - String getUri(); - - /** - * Sets the value of the '{@link org.eclipse.emf.facet.custom.metamodel.v0_3_0.query.URIImageQuery#getUri <em>Uri</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @param value the new value of the '<em>Uri</em>' attribute. - * @see #getUri() - * @generated - */ - void setUri(String value); - -} // URIImageQuery
diff --git a/org.eclipse.modisco.facet.custom.metamodel/src/org/eclipse/emf/facet/custom/metamodel/v0_3_0/query/impl/QueryFactoryImpl.java b/org.eclipse.modisco.facet.custom.metamodel/src/org/eclipse/emf/facet/custom/metamodel/v0_3_0/query/impl/QueryFactoryImpl.java deleted file mode 100644 index ac14f77..0000000 --- a/org.eclipse.modisco.facet.custom.metamodel/src/org/eclipse/emf/facet/custom/metamodel/v0_3_0/query/impl/QueryFactoryImpl.java +++ /dev/null
@@ -1,105 +0,0 @@ -/** - * Copyright (c) 2013 Soft-Maint. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * David Couvrand (Soft-Maint) - Bug 402725 - Need a query to get an image from an URI - * Nicolas Rault (Soft-Maint) - Bug 402725 - Need a query to get an image from an URI - */ -package org.eclipse.emf.facet.custom.metamodel.v0_3_0.query.impl; - -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.EPackage; - -import org.eclipse.emf.ecore.impl.EFactoryImpl; - -import org.eclipse.emf.ecore.plugin.EcorePlugin; - -import org.eclipse.emf.facet.custom.metamodel.v0_3_0.query.*; - -/** - * <!-- begin-user-doc --> - * An implementation of the model <b>Factory</b>. - * <!-- end-user-doc --> - * @generated - */ -public class QueryFactoryImpl extends EFactoryImpl implements QueryFactory { - /** - * Creates the default factory implementation. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public static QueryFactory init() { - try { - QueryFactory theQueryFactory = (QueryFactory)EPackage.Registry.INSTANCE.getEFactory("http://www.eclipse.org/emf/facet/custom/0.3.incubation/query"); - if (theQueryFactory != null) { - return theQueryFactory; - } - } - catch (Exception exception) { - EcorePlugin.INSTANCE.log(exception); - } - return new QueryFactoryImpl(); - } - - /** - * Creates an instance of the factory. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public QueryFactoryImpl() { - super(); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public EObject create(EClass eClass) { - switch (eClass.getClassifierID()) { - case QueryPackage.URI_IMAGE_QUERY: return createURIImageQuery(); - default: - throw new IllegalArgumentException("The class '" + eClass.getName() + "' is not a valid classifier"); - } - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public URIImageQuery createURIImageQuery() { - URIImageQueryImpl uriImageQuery = new URIImageQueryImpl(); - return uriImageQuery; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public QueryPackage getQueryPackage() { - return (QueryPackage)getEPackage(); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @deprecated - * @generated - */ - @Deprecated - public static QueryPackage getPackage() { - return QueryPackage.eINSTANCE; - } - -} //QueryFactoryImpl
diff --git a/org.eclipse.modisco.facet.custom.metamodel/src/org/eclipse/emf/facet/custom/metamodel/v0_3_0/query/impl/QueryPackageImpl.java b/org.eclipse.modisco.facet.custom.metamodel/src/org/eclipse/emf/facet/custom/metamodel/v0_3_0/query/impl/QueryPackageImpl.java deleted file mode 100644 index dbb7c82..0000000 --- a/org.eclipse.modisco.facet.custom.metamodel/src/org/eclipse/emf/facet/custom/metamodel/v0_3_0/query/impl/QueryPackageImpl.java +++ /dev/null
@@ -1,198 +0,0 @@ -/** - * Copyright (c) 2013 Soft-Maint. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * David Couvrand (Soft-Maint) - Bug 402725 - Need a query to get an image from an URI - * Nicolas Rault (Soft-Maint) - Bug 402725 - Need a query to get an image from an URI - */ -package org.eclipse.emf.facet.custom.metamodel.v0_3_0.query.impl; - -import org.eclipse.emf.ecore.EAttribute; -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.ecore.EPackage; - -import org.eclipse.emf.ecore.impl.EPackageImpl; - -import org.eclipse.emf.facet.custom.metamodel.v0_3_0.query.QueryFactory; -import org.eclipse.emf.facet.custom.metamodel.v0_3_0.query.QueryPackage; -import org.eclipse.emf.facet.custom.metamodel.v0_3_0.query.URIImageQuery; - -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.EFacetPackage; - -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.extensible.ExtensiblePackage; - -/** - * <!-- begin-user-doc --> - * An implementation of the model <b>Package</b>. - * <!-- end-user-doc --> - * @generated - */ -public class QueryPackageImpl extends EPackageImpl implements QueryPackage { - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - private EClass uriImageQueryEClass = null; - - /** - * Creates an instance of the model <b>Package</b>, registered with - * {@link org.eclipse.emf.ecore.EPackage.Registry EPackage.Registry} by the package - * package URI value. - * <p>Note: the correct way to create the package is via the static - * factory method {@link #init init()}, which also performs - * initialization of the package, or returns the registered package, - * if one already exists. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see org.eclipse.emf.ecore.EPackage.Registry - * @see org.eclipse.emf.facet.custom.metamodel.v0_3_0.query.QueryPackage#eNS_URI - * @see #init() - * @generated - */ - private QueryPackageImpl() { - super(eNS_URI, QueryFactory.eINSTANCE); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - private static boolean isInited = false; - - /** - * Creates, registers, and initializes the <b>Package</b> for this model, and for any others upon which it depends. - * - * <p>This method is used to initialize {@link QueryPackage#eINSTANCE} when that field is accessed. - * Clients should not invoke it directly. Instead, they should simply access that field to obtain the package. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #eNS_URI - * @see #createPackageContents() - * @see #initializePackageContents() - * @generated - */ - public static QueryPackage init() { - if (isInited) return (QueryPackage)EPackage.Registry.INSTANCE.getEPackage(QueryPackage.eNS_URI); - - // Obtain or create and register package - QueryPackageImpl theQueryPackage = (QueryPackageImpl)(EPackage.Registry.INSTANCE.get(eNS_URI) instanceof QueryPackageImpl ? EPackage.Registry.INSTANCE.get(eNS_URI) : new QueryPackageImpl()); - - isInited = true; - - // Initialize simple dependencies - EFacetPackage.eINSTANCE.eClass(); - - // Create package meta-data objects - theQueryPackage.createPackageContents(); - - // Initialize created meta-data - theQueryPackage.initializePackageContents(); - - // Mark meta-data to indicate it can't be changed - theQueryPackage.freeze(); - - - // Update the registry and return the package - EPackage.Registry.INSTANCE.put(QueryPackage.eNS_URI, theQueryPackage); - return theQueryPackage; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EClass getURIImageQuery() { - return uriImageQueryEClass; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EAttribute getURIImageQuery_Uri() { - return (EAttribute)uriImageQueryEClass.getEStructuralFeatures().get(0); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public QueryFactory getQueryFactory() { - return (QueryFactory)getEFactoryInstance(); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - private boolean isCreated = false; - - /** - * Creates the meta-model objects for the package. This method is - * guarded to have no affect on any invocation but its first. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public void createPackageContents() { - if (isCreated) return; - isCreated = true; - - // Create classes and their features - uriImageQueryEClass = createEClass(URI_IMAGE_QUERY); - createEAttribute(uriImageQueryEClass, URI_IMAGE_QUERY__URI); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - private boolean isInitialized = false; - - /** - * Complete the initialization of the package and its meta-model. This - * method is guarded to have no affect on any invocation but its first. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public void initializePackageContents() { - if (isInitialized) return; - isInitialized = true; - - // Initialize package - setName(eNAME); - setNsPrefix(eNS_PREFIX); - setNsURI(eNS_URI); - - // Obtain other dependent packages - ExtensiblePackage theExtensiblePackage = (ExtensiblePackage)EPackage.Registry.INSTANCE.getEPackage(ExtensiblePackage.eNS_URI); - - // Create type parameters - - // Set bounds for type parameters - - // Add supertypes to classes - uriImageQueryEClass.getESuperTypes().add(theExtensiblePackage.getQuery()); - - // Initialize classes and features; add operations and parameters - initEClass(uriImageQueryEClass, URIImageQuery.class, "URIImageQuery", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); - initEAttribute(getURIImageQuery_Uri(), ecorePackage.getEString(), "uri", null, 0, 1, URIImageQuery.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); - - // Create resource - createResource(eNS_URI); - } - -} //QueryPackageImpl
diff --git a/org.eclipse.modisco.facet.custom.metamodel/src/org/eclipse/emf/facet/custom/metamodel/v0_3_0/query/impl/URIImageQueryImpl.java b/org.eclipse.modisco.facet.custom.metamodel/src/org/eclipse/emf/facet/custom/metamodel/v0_3_0/query/impl/URIImageQueryImpl.java deleted file mode 100644 index a42a231..0000000 --- a/org.eclipse.modisco.facet.custom.metamodel/src/org/eclipse/emf/facet/custom/metamodel/v0_3_0/query/impl/URIImageQueryImpl.java +++ /dev/null
@@ -1,174 +0,0 @@ -/** - * Copyright (c) 2013 Soft-Maint. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * David Couvrand (Soft-Maint) - Bug 402725 - Need a query to get an image from an URI - * Nicolas Rault (Soft-Maint) - Bug 402725 - Need a query to get an image from an URI - */ -package org.eclipse.emf.facet.custom.metamodel.v0_3_0.query.impl; - -import org.eclipse.emf.common.notify.Notification; - -import org.eclipse.emf.ecore.EClass; - -import org.eclipse.emf.ecore.impl.ENotificationImpl; - -import org.eclipse.emf.facet.custom.metamodel.v0_3_0.query.QueryPackage; -import org.eclipse.emf.facet.custom.metamodel.v0_3_0.query.URIImageQuery; - -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.extensible.impl.QueryImpl; - -/** - * <!-- begin-user-doc --> - * An implementation of the model object '<em><b>URI Image Query</b></em>'. - * <!-- end-user-doc --> - * <p> - * The following features are implemented: - * <ul> - * <li>{@link org.eclipse.emf.facet.custom.metamodel.v0_3_0.query.impl.URIImageQueryImpl#getUri <em>Uri</em>}</li> - * </ul> - * </p> - * - * @generated - */ -public class URIImageQueryImpl extends QueryImpl implements URIImageQuery { - /** - * The default value of the '{@link #getUri() <em>Uri</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #getUri() - * @generated - * @ordered - */ - protected static final String URI_EDEFAULT = null; - - /** - * The cached value of the '{@link #getUri() <em>Uri</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #getUri() - * @generated - * @ordered - */ - protected String uri = URI_EDEFAULT; - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected URIImageQueryImpl() { - super(); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - protected EClass eStaticClass() { - return QueryPackage.Literals.URI_IMAGE_QUERY; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public String getUri() { - return uri; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public void setUri(String newUri) { - String oldUri = uri; - uri = newUri; - if (eNotificationRequired()) - eNotify(new ENotificationImpl(this, Notification.SET, QueryPackage.URI_IMAGE_QUERY__URI, oldUri, uri)); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public Object eGet(int featureID, boolean resolve, boolean coreType) { - switch (featureID) { - case QueryPackage.URI_IMAGE_QUERY__URI: - return getUri(); - } - return super.eGet(featureID, resolve, coreType); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public void eSet(int featureID, Object newValue) { - switch (featureID) { - case QueryPackage.URI_IMAGE_QUERY__URI: - setUri((String)newValue); - return; - } - super.eSet(featureID, newValue); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public void eUnset(int featureID) { - switch (featureID) { - case QueryPackage.URI_IMAGE_QUERY__URI: - setUri(URI_EDEFAULT); - return; - } - super.eUnset(featureID); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public boolean eIsSet(int featureID) { - switch (featureID) { - case QueryPackage.URI_IMAGE_QUERY__URI: - return URI_EDEFAULT == null ? uri != null : !URI_EDEFAULT.equals(uri); - } - return super.eIsSet(featureID); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public String toString() { - if (eIsProxy()) return super.toString(); - - StringBuffer result = new StringBuffer(super.toString()); - result.append(" (uri: "); - result.append(uri); - result.append(')'); - return result.toString(); - } - -} //URIImageQueryImpl
diff --git a/org.eclipse.modisco.facet.custom.metamodel/src/org/eclipse/emf/facet/custom/metamodel/v0_3_0/query/util/QueryAdapterFactory.java b/org.eclipse.modisco.facet.custom.metamodel/src/org/eclipse/emf/facet/custom/metamodel/v0_3_0/query/util/QueryAdapterFactory.java deleted file mode 100644 index 058cdd7..0000000 --- a/org.eclipse.modisco.facet.custom.metamodel/src/org/eclipse/emf/facet/custom/metamodel/v0_3_0/query/util/QueryAdapterFactory.java +++ /dev/null
@@ -1,150 +0,0 @@ -/** - * Copyright (c) 2013 Soft-Maint. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * David Couvrand (Soft-Maint) - Bug 402725 - Need a query to get an image from an URI - * Nicolas Rault (Soft-Maint) - Bug 402725 - Need a query to get an image from an URI - */ -package org.eclipse.emf.facet.custom.metamodel.v0_3_0.query.util; - -import org.eclipse.emf.common.notify.Adapter; -import org.eclipse.emf.common.notify.Notifier; - -import org.eclipse.emf.common.notify.impl.AdapterFactoryImpl; - -import org.eclipse.emf.ecore.EObject; - -import org.eclipse.emf.facet.custom.metamodel.v0_3_0.query.*; - -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.extensible.Query; - -/** - * <!-- begin-user-doc --> - * The <b>Adapter Factory</b> for the model. - * It provides an adapter <code>createXXX</code> method for each class of the model. - * <!-- end-user-doc --> - * @see org.eclipse.emf.facet.custom.metamodel.v0_3_0.query.QueryPackage - * @generated - */ -public class QueryAdapterFactory extends AdapterFactoryImpl { - /** - * The cached model package. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected static QueryPackage modelPackage; - - /** - * Creates an instance of the adapter factory. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public QueryAdapterFactory() { - if (modelPackage == null) { - modelPackage = QueryPackage.eINSTANCE; - } - } - - /** - * Returns whether this factory is applicable for the type of the object. - * <!-- begin-user-doc --> - * This implementation returns <code>true</code> if the object is either the model's package or is an instance object of the model. - * <!-- end-user-doc --> - * @return whether this factory is applicable for the type of the object. - * @generated - */ - @Override - public boolean isFactoryForType(Object object) { - if (object == modelPackage) { - return true; - } - if (object instanceof EObject) { - return ((EObject)object).eClass().getEPackage() == modelPackage; - } - return false; - } - - /** - * The switch that delegates to the <code>createXXX</code> methods. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected QuerySwitch<Adapter> modelSwitch = - new QuerySwitch<Adapter>() { - @Override - public Adapter caseURIImageQuery(URIImageQuery object) { - return createURIImageQueryAdapter(); - } - @Override - public Adapter caseQuery(Query object) { - return createQueryAdapter(); - } - @Override - public Adapter defaultCase(EObject object) { - return createEObjectAdapter(); - } - }; - - /** - * Creates an adapter for the <code>target</code>. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @param target the object to adapt. - * @return the adapter for the <code>target</code>. - * @generated - */ - @Override - public Adapter createAdapter(Notifier target) { - return modelSwitch.doSwitch((EObject)target); - } - - - /** - * Creates a new adapter for an object of class '{@link query.URIImageQuery <em>URI Image Query</em>}'. - * <!-- begin-user-doc --> - * This default implementation returns null so that we can easily ignore cases; - * it's useful to ignore a case when inheritance will catch all the cases anyway. - * <!-- end-user-doc --> - * @return the new adapter. - * @see query.URIImageQuery - * @generated - */ - public Adapter createURIImageQueryAdapter() { - return null; - } - - /** - * Creates a new adapter for an object of class '{@link org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.extensible.Query <em>Query</em>}'. - * <!-- begin-user-doc --> - * This default implementation returns null so that we can easily ignore cases; - * it's useful to ignore a case when inheritance will catch all the cases anyway. - * <!-- end-user-doc --> - * @return the new adapter. - * @see org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.extensible.Query - * @generated - */ - public Adapter createQueryAdapter() { - return null; - } - - /** - * Creates a new adapter for the default case. - * <!-- begin-user-doc --> - * This default implementation returns null. - * <!-- end-user-doc --> - * @return the new adapter. - * @generated - */ - public Adapter createEObjectAdapter() { - return null; - } - -} //QueryAdapterFactory
diff --git a/org.eclipse.modisco.facet.custom.metamodel/src/org/eclipse/emf/facet/custom/metamodel/v0_3_0/query/util/QuerySwitch.java b/org.eclipse.modisco.facet.custom.metamodel/src/org/eclipse/emf/facet/custom/metamodel/v0_3_0/query/util/QuerySwitch.java deleted file mode 100644 index d00426d..0000000 --- a/org.eclipse.modisco.facet.custom.metamodel/src/org/eclipse/emf/facet/custom/metamodel/v0_3_0/query/util/QuerySwitch.java +++ /dev/null
@@ -1,153 +0,0 @@ -/** - * Copyright (c) 2013 Soft-Maint. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * David Couvrand (Soft-Maint) - Bug 402725 - Need a query to get an image from an URI - * Nicolas Rault (Soft-Maint) - Bug 402725 - Need a query to get an image from an URI - */ -package org.eclipse.emf.facet.custom.metamodel.v0_3_0.query.util; - -import java.util.List; - -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.facet.custom.metamodel.v0_3_0.query.QueryPackage; -import org.eclipse.emf.facet.custom.metamodel.v0_3_0.query.URIImageQuery; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.extensible.Query; - -/** - * <!-- begin-user-doc --> - * The <b>Switch</b> for the model's inheritance hierarchy. - * It supports the call {@link #doSwitch(EObject) doSwitch(object)} - * to invoke the <code>caseXXX</code> method for each class of the model, - * starting with the actual class of the object - * and proceeding up the inheritance hierarchy - * until a non-null result is returned, - * which is the result of the switch. - * <!-- end-user-doc --> - * @see org.eclipse.emf.facet.custom.metamodel.v0_3_0.query.QueryPackage - * @generated - */ -public class QuerySwitch<T> { - /** - * The cached model package - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected static QueryPackage modelPackage; - - /** - * Creates an instance of the switch. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public QuerySwitch() { - if (modelPackage == null) { - modelPackage = QueryPackage.eINSTANCE; - } - } - - /** - * Calls <code>caseXXX</code> for each class of the model until one returns a non null result; it yields that result. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the first non-null result returned by a <code>caseXXX</code> call. - * @generated - */ - public T doSwitch(EObject theEObject) { - return doSwitch(theEObject.eClass(), theEObject); - } - - /** - * Calls <code>caseXXX</code> for each class of the model until one returns a non null result; it yields that result. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the first non-null result returned by a <code>caseXXX</code> call. - * @generated - */ - protected T doSwitch(EClass theEClass, EObject theEObject) { - if (theEClass.eContainer() == modelPackage) { - return doSwitch(theEClass.getClassifierID(), theEObject); - } - else { - List<EClass> eSuperTypes = theEClass.getESuperTypes(); - return - eSuperTypes.isEmpty() ? - defaultCase(theEObject) : - doSwitch(eSuperTypes.get(0), theEObject); - } - } - - /** - * Calls <code>caseXXX</code> for each class of the model until one returns a non null result; it yields that result. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the first non-null result returned by a <code>caseXXX</code> call. - * @generated - */ - protected T doSwitch(int classifierID, EObject theEObject) { - switch (classifierID) { - case QueryPackage.URI_IMAGE_QUERY: { - URIImageQuery uriImageQuery = (URIImageQuery)theEObject; - T result = caseURIImageQuery(uriImageQuery); - if (result == null) result = caseQuery(uriImageQuery); - if (result == null) result = defaultCase(theEObject); - return result; - } - default: return defaultCase(theEObject); - } - } - - /** - * Returns the result of interpreting the object as an instance of '<em>URI Image Query</em>'. - * <!-- begin-user-doc --> - * This implementation returns null; - * returning a non-null result will terminate the switch. - * <!-- end-user-doc --> - * @param object the target of the switch. - * @return the result of interpreting the object as an instance of '<em>URI Image Query</em>'. - * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) - * @generated - */ - public T caseURIImageQuery(URIImageQuery object) { - return null; - } - - /** - * Returns the result of interpreting the object as an instance of '<em>Query</em>'. - * <!-- begin-user-doc --> - * This implementation returns null; - * returning a non-null result will terminate the switch. - * <!-- end-user-doc --> - * @param object the target of the switch. - * @return the result of interpreting the object as an instance of '<em>Query</em>'. - * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) - * @generated - */ - public T caseQuery(Query object) { - return null; - } - - /** - * Returns the result of interpreting the object as an instance of '<em>EObject</em>'. - * <!-- begin-user-doc --> - * This implementation returns null; - * returning a non-null result will terminate the switch, but this is the last case anyway. - * <!-- end-user-doc --> - * @param object the target of the switch. - * @return the result of interpreting the object as an instance of '<em>EObject</em>'. - * @see #doSwitch(org.eclipse.emf.ecore.EObject) - * @generated - */ - public T defaultCase(EObject object) { - return null; - } - -} //QuerySwitch
diff --git a/org.eclipse.modisco.facet.custom.metamodel/src/org/eclipse/modisco/facet/custom/metamodel/custompt/IColor.java b/org.eclipse.modisco.facet.custom.metamodel/src/org/eclipse/modisco/facet/custom/metamodel/custompt/IColor.java new file mode 100644 index 0000000..ea69892 --- /dev/null +++ b/org.eclipse.modisco.facet.custom.metamodel/src/org/eclipse/modisco/facet/custom/metamodel/custompt/IColor.java
@@ -0,0 +1,23 @@ +/** + * Copyright (c) 2012 Mia-Software. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Gregoire Dupe (Mia-Software) - Bug 361794 - [Restructuring] New customization meta-model + */ +package org.eclipse.modisco.facet.custom.metamodel.custompt; + +import java.io.Serializable; + +/** + * @noextend This interface is not intended to be extended by clients. + */ +public interface IColor extends Serializable { + int getRed(); + int getGreen(); + int getBlue(); +}
diff --git a/org.eclipse.modisco.facet.custom.metamodel/src/org/eclipse/modisco/facet/custom/metamodel/custompt/IImage.java b/org.eclipse.modisco.facet.custom.metamodel/src/org/eclipse/modisco/facet/custom/metamodel/custompt/IImage.java new file mode 100644 index 0000000..bd4c236 --- /dev/null +++ b/org.eclipse.modisco.facet.custom.metamodel/src/org/eclipse/modisco/facet/custom/metamodel/custompt/IImage.java
@@ -0,0 +1,22 @@ +/** + * Copyright (c) 2012 Mia-Software. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Gregoire Dupe (Mia-Software) - Bug 361794 - [Restructuring] New customization meta-model + */ +package org.eclipse.modisco.facet.custom.metamodel.custompt; + +import java.io.InputStream; +import java.io.Serializable; + +/** + * @noextend This interface is not intended to be extended by clients. + */ +public interface IImage extends Serializable { + InputStream getInputStream(); +}
diff --git a/org.eclipse.modisco.facet.custom.metamodel/src/org/eclipse/modisco/facet/custom/metamodel/v0_2_0/custom/CustomFactory.java b/org.eclipse.modisco.facet.custom.metamodel/src/org/eclipse/modisco/facet/custom/metamodel/v0_2_0/custom/CustomFactory.java new file mode 100644 index 0000000..66e5a20 --- /dev/null +++ b/org.eclipse.modisco.facet.custom.metamodel/src/org/eclipse/modisco/facet/custom/metamodel/v0_2_0/custom/CustomFactory.java
@@ -0,0 +1,87 @@ +/** + * Copyright (c) 2011 Mia-Software. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Gregoire Dupe (Mia-Software) - Bug 361794 - [Restructuring] New customization meta-model + * Gregoire Dupe (Mia-Software) - Bug 369987 - [Restructuring][Table] Switch to the new customization and facet framework + * Gregoire Dupe (Mia-Software) - Bug 373078 - API Cleaning + */ +package org.eclipse.modisco.facet.custom.metamodel.v0_2_0.custom; + +import org.eclipse.emf.ecore.EFactory; + +/** + * <!-- begin-user-doc --> The <b>Factory</b> for the model. It provides a + * create method for each non-abstract class of the model. <!-- end-user-doc --> + * @see org.eclipse.modisco.facet.custom.metamodel.v0_2_0.custom.CustomPackage + * @generated + */ +public interface CustomFactory extends EFactory { + /** + * The singleton instance of the factory. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + CustomFactory eINSTANCE = org.eclipse.modisco.facet.custom.metamodel.v0_2_0.custom.impl.CustomFactoryImpl.init(); + + /** + * Returns a new object of class '<em>Customization</em>'. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @return a new object of class '<em>Customization</em>'. + * @generated + */ + Customization createCustomization(); + + /** + * Returns a new object of class '<em>EClass Customization</em>'. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @return a new object of class '<em>EClass Customization</em>'. + * @generated + */ + EClassCustomization createEClassCustomization(); + + /** + * Returns a new object of class '<em>Facet Customization</em>'. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @return a new object of class '<em>Facet Customization</em>'. + * @generated + */ + FacetCustomization createFacetCustomization(); + + /** + * Returns a new object of class '<em>ETyped Element Switch Query</em>'. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @return a new object of class '<em>ETyped Element Switch Query</em>'. + * @generated + */ + ETypedElementSwitchQuery createETypedElementSwitchQuery(); + + /** + * Returns a new object of class '<em>ETyped Element Case</em>'. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @return a new object of class '<em>ETyped Element Case</em>'. + * @generated + */ + ETypedElementCase createETypedElementCase(); + + /** + * Returns the package supported by this factory. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @return the package supported by this factory. + * @generated + */ + CustomPackage getCustomPackage(); + +} //CustomFactory
diff --git a/org.eclipse.modisco.facet.custom.metamodel/src/org/eclipse/modisco/facet/custom/metamodel/v0_2_0/custom/CustomPackage.java b/org.eclipse.modisco.facet.custom.metamodel/src/org/eclipse/modisco/facet/custom/metamodel/v0_2_0/custom/CustomPackage.java new file mode 100644 index 0000000..8389889 --- /dev/null +++ b/org.eclipse.modisco.facet.custom.metamodel/src/org/eclipse/modisco/facet/custom/metamodel/v0_2_0/custom/CustomPackage.java
@@ -0,0 +1,793 @@ +/** + * Copyright (c) 2011 Mia-Software. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Gregoire Dupe (Mia-Software) - Bug 361794 - [Restructuring] New customization meta-model + * Gregoire Dupe (Mia-Software) - Bug 369987 - [Restructuring][Table] Switch to the new customization and facet framework + * Gregoire Dupe (Mia-Software) - Bug 373078 - API Cleaning + * Gregoire Dupe (Mia-Software) - Bug 376576 - [EFacet] Change the multiplicity of Facet::extendedFacet + */ +package org.eclipse.modisco.facet.custom.metamodel.v0_2_0.custom; + +import org.eclipse.emf.ecore.EAttribute; +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.EPackage; +import org.eclipse.emf.ecore.EReference; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.EFacetPackage; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.extensible.ExtensiblePackage; + +/** + * <!-- begin-user-doc --> The <b>Package</b> for the model. It contains + * accessors for the meta objects to represent + * <ul> + * <li>each class,</li> + * <li>each feature of each class,</li> + * <li>each enum,</li> + * <li>and each data type</li> + * </ul> + * <!-- end-user-doc --> + * @see org.eclipse.modisco.facet.custom.metamodel.v0_2_0.custom.CustomFactory + * @model kind="package" + * @generated + */ +public interface CustomPackage extends EPackage { + /** + * The package name. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + String eNAME = "custom"; + + /** + * The package namespace URI. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + String eNS_URI = "http://www.eclipse.org/emf/facet/custom/0.2.incubation/custom"; + + /** + * The package namespace name. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + String eNS_PREFIX = "custom"; + + /** + * The singleton instance of the package. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + CustomPackage eINSTANCE = org.eclipse.modisco.facet.custom.metamodel.v0_2_0.custom.impl.CustomPackageImpl.init(); + + /** + * The meta object id for the '{@link org.eclipse.modisco.facet.custom.metamodel.v0_2_0.custom.impl.CustomizationImpl <em>Customization</em>}' class. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @see org.eclipse.modisco.facet.custom.metamodel.v0_2_0.custom.impl.CustomizationImpl + * @see org.eclipse.modisco.facet.custom.metamodel.v0_2_0.custom.impl.CustomPackageImpl#getCustomization() + * @generated + */ + int CUSTOMIZATION = 0; + + /** + * The feature id for the '<em><b>EAnnotations</b></em>' containment reference list. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + */ + int CUSTOMIZATION__EANNOTATIONS = EFacetPackage.FACET_SET__EANNOTATIONS; + + /** + * The feature id for the '<em><b>Name</b></em>' attribute. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + */ + int CUSTOMIZATION__NAME = EFacetPackage.FACET_SET__NAME; + + /** + * The feature id for the '<em><b>Ns URI</b></em>' attribute. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + */ + int CUSTOMIZATION__NS_URI = EFacetPackage.FACET_SET__NS_URI; + + /** + * The feature id for the '<em><b>Ns Prefix</b></em>' attribute. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + */ + int CUSTOMIZATION__NS_PREFIX = EFacetPackage.FACET_SET__NS_PREFIX; + + /** + * The feature id for the '<em><b>EFactory Instance</b></em>' reference. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + */ + int CUSTOMIZATION__EFACTORY_INSTANCE = EFacetPackage.FACET_SET__EFACTORY_INSTANCE; + + /** + * The feature id for the '<em><b>EClassifiers</b></em>' containment reference list. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + */ + int CUSTOMIZATION__ECLASSIFIERS = EFacetPackage.FACET_SET__ECLASSIFIERS; + + /** + * The feature id for the '<em><b>ESubpackages</b></em>' containment reference list. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + */ + int CUSTOMIZATION__ESUBPACKAGES = EFacetPackage.FACET_SET__ESUBPACKAGES; + + /** + * The feature id for the '<em><b>ESuper Package</b></em>' container reference. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + */ + int CUSTOMIZATION__ESUPER_PACKAGE = EFacetPackage.FACET_SET__ESUPER_PACKAGE; + + /** + * The feature id for the '<em><b>Documentation</b></em>' attribute. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + */ + int CUSTOMIZATION__DOCUMENTATION = EFacetPackage.FACET_SET__DOCUMENTATION; + + /** + * The feature id for the '<em><b>Categories</b></em>' containment reference list. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + */ + int CUSTOMIZATION__CATEGORIES = EFacetPackage.FACET_SET__CATEGORIES; + + /** + * The feature id for the '<em><b>Must Be Loaded By Default</b></em>' attribute. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + */ + int CUSTOMIZATION__MUST_BE_LOADED_BY_DEFAULT = EFacetPackage.FACET_SET_FEATURE_COUNT + 0; + + /** + * The number of structural features of the '<em>Customization</em>' class. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + */ + int CUSTOMIZATION_FEATURE_COUNT = EFacetPackage.FACET_SET_FEATURE_COUNT + 1; + + /** + * The meta object id for the '{@link org.eclipse.modisco.facet.custom.metamodel.v0_2_0.custom.impl.EClassCustomizationImpl <em>EClass Customization</em>}' class. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @see org.eclipse.modisco.facet.custom.metamodel.v0_2_0.custom.impl.EClassCustomizationImpl + * @see org.eclipse.modisco.facet.custom.metamodel.v0_2_0.custom.impl.CustomPackageImpl#getEClassCustomization() + * @generated + */ + int ECLASS_CUSTOMIZATION = 1; + + /** + * The feature id for the '<em><b>EAnnotations</b></em>' containment reference list. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + */ + int ECLASS_CUSTOMIZATION__EANNOTATIONS = EFacetPackage.FACET__EANNOTATIONS; + + /** + * The feature id for the '<em><b>Name</b></em>' attribute. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + */ + int ECLASS_CUSTOMIZATION__NAME = EFacetPackage.FACET__NAME; + + /** + * The feature id for the '<em><b>Instance Class Name</b></em>' attribute. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + */ + int ECLASS_CUSTOMIZATION__INSTANCE_CLASS_NAME = EFacetPackage.FACET__INSTANCE_CLASS_NAME; + + /** + * The feature id for the '<em><b>Instance Class</b></em>' attribute. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + */ + int ECLASS_CUSTOMIZATION__INSTANCE_CLASS = EFacetPackage.FACET__INSTANCE_CLASS; + + /** + * The feature id for the '<em><b>Default Value</b></em>' attribute. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + */ + int ECLASS_CUSTOMIZATION__DEFAULT_VALUE = EFacetPackage.FACET__DEFAULT_VALUE; + + /** + * The feature id for the '<em><b>Instance Type Name</b></em>' attribute. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + */ + int ECLASS_CUSTOMIZATION__INSTANCE_TYPE_NAME = EFacetPackage.FACET__INSTANCE_TYPE_NAME; + + /** + * The feature id for the '<em><b>EPackage</b></em>' container reference. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + */ + int ECLASS_CUSTOMIZATION__EPACKAGE = EFacetPackage.FACET__EPACKAGE; + + /** + * The feature id for the '<em><b>EType Parameters</b></em>' containment reference list. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + */ + int ECLASS_CUSTOMIZATION__ETYPE_PARAMETERS = EFacetPackage.FACET__ETYPE_PARAMETERS; + + /** + * The feature id for the '<em><b>Documentation</b></em>' attribute. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + */ + int ECLASS_CUSTOMIZATION__DOCUMENTATION = EFacetPackage.FACET__DOCUMENTATION; + + /** + * The feature id for the '<em><b>Extended Metaclass</b></em>' reference. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + */ + int ECLASS_CUSTOMIZATION__EXTENDED_METACLASS = EFacetPackage.FACET__EXTENDED_METACLASS; + + /** + * The feature id for the '<em><b>Facet Elements</b></em>' containment reference list. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + */ + int ECLASS_CUSTOMIZATION__FACET_ELEMENTS = EFacetPackage.FACET__FACET_ELEMENTS; + + /** + * The feature id for the '<em><b>Facet Operations</b></em>' containment reference list. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + */ + int ECLASS_CUSTOMIZATION__FACET_OPERATIONS = EFacetPackage.FACET__FACET_OPERATIONS; + + /** + * The feature id for the '<em><b>Conformance Typed Element</b></em>' reference. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + */ + int ECLASS_CUSTOMIZATION__CONFORMANCE_TYPED_ELEMENT = EFacetPackage.FACET__CONFORMANCE_TYPED_ELEMENT; + + /** + * The feature id for the '<em><b>Extended Facets</b></em>' reference list. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + * @since 0.2 + */ + int ECLASS_CUSTOMIZATION__EXTENDED_FACETS = EFacetPackage.FACET__EXTENDED_FACETS; + + /** + * The number of structural features of the '<em>EClass Customization</em>' class. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + */ + int ECLASS_CUSTOMIZATION_FEATURE_COUNT = EFacetPackage.FACET_FEATURE_COUNT + 0; + + /** + * The meta object id for the '{@link org.eclipse.modisco.facet.custom.metamodel.v0_2_0.custom.impl.FacetCustomizationImpl <em>Facet Customization</em>}' class. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @see org.eclipse.modisco.facet.custom.metamodel.v0_2_0.custom.impl.FacetCustomizationImpl + * @see org.eclipse.modisco.facet.custom.metamodel.v0_2_0.custom.impl.CustomPackageImpl#getFacetCustomization() + * @generated + */ + int FACET_CUSTOMIZATION = 2; + + /** + * The feature id for the '<em><b>EAnnotations</b></em>' containment reference list. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + */ + int FACET_CUSTOMIZATION__EANNOTATIONS = EFacetPackage.FACET__EANNOTATIONS; + + /** + * The feature id for the '<em><b>Name</b></em>' attribute. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + */ + int FACET_CUSTOMIZATION__NAME = EFacetPackage.FACET__NAME; + + /** + * The feature id for the '<em><b>Instance Class Name</b></em>' attribute. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + */ + int FACET_CUSTOMIZATION__INSTANCE_CLASS_NAME = EFacetPackage.FACET__INSTANCE_CLASS_NAME; + + /** + * The feature id for the '<em><b>Instance Class</b></em>' attribute. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + */ + int FACET_CUSTOMIZATION__INSTANCE_CLASS = EFacetPackage.FACET__INSTANCE_CLASS; + + /** + * The feature id for the '<em><b>Default Value</b></em>' attribute. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + */ + int FACET_CUSTOMIZATION__DEFAULT_VALUE = EFacetPackage.FACET__DEFAULT_VALUE; + + /** + * The feature id for the '<em><b>Instance Type Name</b></em>' attribute. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + */ + int FACET_CUSTOMIZATION__INSTANCE_TYPE_NAME = EFacetPackage.FACET__INSTANCE_TYPE_NAME; + + /** + * The feature id for the '<em><b>EPackage</b></em>' container reference. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + */ + int FACET_CUSTOMIZATION__EPACKAGE = EFacetPackage.FACET__EPACKAGE; + + /** + * The feature id for the '<em><b>EType Parameters</b></em>' containment reference list. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + */ + int FACET_CUSTOMIZATION__ETYPE_PARAMETERS = EFacetPackage.FACET__ETYPE_PARAMETERS; + + /** + * The feature id for the '<em><b>Documentation</b></em>' attribute. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + */ + int FACET_CUSTOMIZATION__DOCUMENTATION = EFacetPackage.FACET__DOCUMENTATION; + + /** + * The feature id for the '<em><b>Extended Metaclass</b></em>' reference. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + */ + int FACET_CUSTOMIZATION__EXTENDED_METACLASS = EFacetPackage.FACET__EXTENDED_METACLASS; + + /** + * The feature id for the '<em><b>Facet Elements</b></em>' containment reference list. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + */ + int FACET_CUSTOMIZATION__FACET_ELEMENTS = EFacetPackage.FACET__FACET_ELEMENTS; + + /** + * The feature id for the '<em><b>Facet Operations</b></em>' containment reference list. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + */ + int FACET_CUSTOMIZATION__FACET_OPERATIONS = EFacetPackage.FACET__FACET_OPERATIONS; + + /** + * The feature id for the '<em><b>Conformance Typed Element</b></em>' reference. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + */ + int FACET_CUSTOMIZATION__CONFORMANCE_TYPED_ELEMENT = EFacetPackage.FACET__CONFORMANCE_TYPED_ELEMENT; + + /** + * The feature id for the '<em><b>Extended Facets</b></em>' reference list. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + * @since 0.2 + */ + int FACET_CUSTOMIZATION__EXTENDED_FACETS = EFacetPackage.FACET__EXTENDED_FACETS; + + /** + * The feature id for the '<em><b>Customized Facet</b></em>' reference. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + */ + int FACET_CUSTOMIZATION__CUSTOMIZED_FACET = EFacetPackage.FACET_FEATURE_COUNT + 0; + + /** + * The number of structural features of the '<em>Facet Customization</em>' class. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + */ + int FACET_CUSTOMIZATION_FEATURE_COUNT = EFacetPackage.FACET_FEATURE_COUNT + 1; + + /** + * The meta object id for the '{@link org.eclipse.modisco.facet.custom.metamodel.v0_2_0.custom.impl.ETypedElementSwitchQueryImpl <em>ETyped Element Switch Query</em>}' class. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @see org.eclipse.modisco.facet.custom.metamodel.v0_2_0.custom.impl.ETypedElementSwitchQueryImpl + * @see org.eclipse.modisco.facet.custom.metamodel.v0_2_0.custom.impl.CustomPackageImpl#getETypedElementSwitchQuery() + * @generated + */ + int ETYPED_ELEMENT_SWITCH_QUERY = 3; + + /** + * The feature id for the '<em><b>Can Have Side Effects</b></em>' attribute. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + */ + int ETYPED_ELEMENT_SWITCH_QUERY__CAN_HAVE_SIDE_EFFECTS = ExtensiblePackage.QUERY__CAN_HAVE_SIDE_EFFECTS; + + /** + * The feature id for the '<em><b>Can Be Cached</b></em>' attribute. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + */ + int ETYPED_ELEMENT_SWITCH_QUERY__CAN_BE_CACHED = ExtensiblePackage.QUERY__CAN_BE_CACHED; + + /** + * The feature id for the '<em><b>Cases</b></em>' containment reference list. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + */ + int ETYPED_ELEMENT_SWITCH_QUERY__CASES = ExtensiblePackage.QUERY_FEATURE_COUNT + 0; + + /** + * The number of structural features of the '<em>ETyped Element Switch Query</em>' class. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + */ + int ETYPED_ELEMENT_SWITCH_QUERY_FEATURE_COUNT = ExtensiblePackage.QUERY_FEATURE_COUNT + 1; + + /** + * The meta object id for the '{@link org.eclipse.modisco.facet.custom.metamodel.v0_2_0.custom.impl.ETypedElementCaseImpl <em>ETyped Element Case</em>}' class. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @see org.eclipse.modisco.facet.custom.metamodel.v0_2_0.custom.impl.ETypedElementCaseImpl + * @see org.eclipse.modisco.facet.custom.metamodel.v0_2_0.custom.impl.CustomPackageImpl#getETypedElementCase() + * @generated + */ + int ETYPED_ELEMENT_CASE = 4; + + /** + * The feature id for the '<em><b>Case</b></em>' reference. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + */ + int ETYPED_ELEMENT_CASE__CASE = 0; + + /** + * The feature id for the '<em><b>Value</b></em>' containment reference. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + */ + int ETYPED_ELEMENT_CASE__VALUE = 1; + + /** + * The number of structural features of the '<em>ETyped Element Case</em>' class. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + */ + int ETYPED_ELEMENT_CASE_FEATURE_COUNT = 2; + + + /** + * Returns the meta object for class '{@link org.eclipse.modisco.facet.custom.metamodel.v0_2_0.custom.Customization <em>Customization</em>}'. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @return the meta object for class '<em>Customization</em>'. + * @see org.eclipse.modisco.facet.custom.metamodel.v0_2_0.custom.Customization + * @generated + */ + EClass getCustomization(); + + /** + * Returns the meta object for the attribute '{@link org.eclipse.modisco.facet.custom.metamodel.v0_2_0.custom.Customization#isMustBeLoadedByDefault <em>Must Be Loaded By Default</em>}'. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @return the meta object for the attribute '<em>Must Be Loaded By Default</em>'. + * @see org.eclipse.modisco.facet.custom.metamodel.v0_2_0.custom.Customization#isMustBeLoadedByDefault() + * @see #getCustomization() + * @generated + */ + EAttribute getCustomization_MustBeLoadedByDefault(); + + /** + * Returns the meta object for class '{@link org.eclipse.modisco.facet.custom.metamodel.v0_2_0.custom.EClassCustomization <em>EClass Customization</em>}'. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @return the meta object for class '<em>EClass Customization</em>'. + * @see org.eclipse.modisco.facet.custom.metamodel.v0_2_0.custom.EClassCustomization + * @generated + */ + EClass getEClassCustomization(); + + /** + * Returns the meta object for class '{@link org.eclipse.modisco.facet.custom.metamodel.v0_2_0.custom.FacetCustomization <em>Facet Customization</em>}'. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @return the meta object for class '<em>Facet Customization</em>'. + * @see org.eclipse.modisco.facet.custom.metamodel.v0_2_0.custom.FacetCustomization + * @generated + */ + EClass getFacetCustomization(); + + /** + * Returns the meta object for the reference '{@link org.eclipse.modisco.facet.custom.metamodel.v0_2_0.custom.FacetCustomization#getCustomizedFacet <em>Customized Facet</em>}'. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @return the meta object for the reference '<em>Customized Facet</em>'. + * @see org.eclipse.modisco.facet.custom.metamodel.v0_2_0.custom.FacetCustomization#getCustomizedFacet() + * @see #getFacetCustomization() + * @generated + */ + EReference getFacetCustomization_CustomizedFacet(); + + /** + * Returns the meta object for class '{@link org.eclipse.modisco.facet.custom.metamodel.v0_2_0.custom.ETypedElementSwitchQuery <em>ETyped Element Switch Query</em>}'. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @return the meta object for class '<em>ETyped Element Switch Query</em>'. + * @see org.eclipse.modisco.facet.custom.metamodel.v0_2_0.custom.ETypedElementSwitchQuery + * @generated + */ + EClass getETypedElementSwitchQuery(); + + /** + * Returns the meta object for the containment reference list '{@link org.eclipse.modisco.facet.custom.metamodel.v0_2_0.custom.ETypedElementSwitchQuery#getCases <em>Cases</em>}'. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @return the meta object for the containment reference list '<em>Cases</em>'. + * @see org.eclipse.modisco.facet.custom.metamodel.v0_2_0.custom.ETypedElementSwitchQuery#getCases() + * @see #getETypedElementSwitchQuery() + * @generated + */ + EReference getETypedElementSwitchQuery_Cases(); + + /** + * Returns the meta object for class '{@link org.eclipse.modisco.facet.custom.metamodel.v0_2_0.custom.ETypedElementCase <em>ETyped Element Case</em>}'. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @return the meta object for class '<em>ETyped Element Case</em>'. + * @see org.eclipse.modisco.facet.custom.metamodel.v0_2_0.custom.ETypedElementCase + * @generated + */ + EClass getETypedElementCase(); + + /** + * Returns the meta object for the reference '{@link org.eclipse.modisco.facet.custom.metamodel.v0_2_0.custom.ETypedElementCase#getCase <em>Case</em>}'. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @return the meta object for the reference '<em>Case</em>'. + * @see org.eclipse.modisco.facet.custom.metamodel.v0_2_0.custom.ETypedElementCase#getCase() + * @see #getETypedElementCase() + * @generated + */ + EReference getETypedElementCase_Case(); + + /** + * Returns the meta object for the containment reference '{@link org.eclipse.modisco.facet.custom.metamodel.v0_2_0.custom.ETypedElementCase#getValue <em>Value</em>}'. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @return the meta object for the containment reference '<em>Value</em>'. + * @see org.eclipse.modisco.facet.custom.metamodel.v0_2_0.custom.ETypedElementCase#getValue() + * @see #getETypedElementCase() + * @generated + */ + EReference getETypedElementCase_Value(); + + /** + * Returns the factory that creates the instances of the model. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @return the factory that creates the instances of the model. + * @generated + */ + CustomFactory getCustomFactory(); + + /** + * <!-- begin-user-doc --> + * Defines literals for the meta objects that represent + * <ul> + * <li>each class,</li> + * <li>each feature of each class,</li> + * <li>each enum,</li> + * <li>and each data type</li> + * </ul> + * <!-- end-user-doc --> + * @generated + */ + interface Literals { + /** + * The meta object literal for the '{@link org.eclipse.modisco.facet.custom.metamodel.v0_2_0.custom.impl.CustomizationImpl <em>Customization</em>}' class. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @see org.eclipse.modisco.facet.custom.metamodel.v0_2_0.custom.impl.CustomizationImpl + * @see org.eclipse.modisco.facet.custom.metamodel.v0_2_0.custom.impl.CustomPackageImpl#getCustomization() + * @generated + */ + EClass CUSTOMIZATION = eINSTANCE.getCustomization(); + + /** + * The meta object literal for the '<em><b>Must Be Loaded By Default</b></em>' attribute feature. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + EAttribute CUSTOMIZATION__MUST_BE_LOADED_BY_DEFAULT = eINSTANCE.getCustomization_MustBeLoadedByDefault(); + + /** + * The meta object literal for the '{@link org.eclipse.modisco.facet.custom.metamodel.v0_2_0.custom.impl.EClassCustomizationImpl <em>EClass Customization</em>}' class. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @see org.eclipse.modisco.facet.custom.metamodel.v0_2_0.custom.impl.EClassCustomizationImpl + * @see org.eclipse.modisco.facet.custom.metamodel.v0_2_0.custom.impl.CustomPackageImpl#getEClassCustomization() + * @generated + */ + EClass ECLASS_CUSTOMIZATION = eINSTANCE.getEClassCustomization(); + + /** + * The meta object literal for the '{@link org.eclipse.modisco.facet.custom.metamodel.v0_2_0.custom.impl.FacetCustomizationImpl <em>Facet Customization</em>}' class. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @see org.eclipse.modisco.facet.custom.metamodel.v0_2_0.custom.impl.FacetCustomizationImpl + * @see org.eclipse.modisco.facet.custom.metamodel.v0_2_0.custom.impl.CustomPackageImpl#getFacetCustomization() + * @generated + */ + EClass FACET_CUSTOMIZATION = eINSTANCE.getFacetCustomization(); + + /** + * The meta object literal for the '<em><b>Customized Facet</b></em>' reference feature. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + EReference FACET_CUSTOMIZATION__CUSTOMIZED_FACET = eINSTANCE.getFacetCustomization_CustomizedFacet(); + + /** + * The meta object literal for the '{@link org.eclipse.modisco.facet.custom.metamodel.v0_2_0.custom.impl.ETypedElementSwitchQueryImpl <em>ETyped Element Switch Query</em>}' class. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @see org.eclipse.modisco.facet.custom.metamodel.v0_2_0.custom.impl.ETypedElementSwitchQueryImpl + * @see org.eclipse.modisco.facet.custom.metamodel.v0_2_0.custom.impl.CustomPackageImpl#getETypedElementSwitchQuery() + * @generated + */ + EClass ETYPED_ELEMENT_SWITCH_QUERY = eINSTANCE.getETypedElementSwitchQuery(); + + /** + * The meta object literal for the '<em><b>Cases</b></em>' containment reference list feature. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + EReference ETYPED_ELEMENT_SWITCH_QUERY__CASES = eINSTANCE.getETypedElementSwitchQuery_Cases(); + + /** + * The meta object literal for the '{@link org.eclipse.modisco.facet.custom.metamodel.v0_2_0.custom.impl.ETypedElementCaseImpl <em>ETyped Element Case</em>}' class. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @see org.eclipse.modisco.facet.custom.metamodel.v0_2_0.custom.impl.ETypedElementCaseImpl + * @see org.eclipse.modisco.facet.custom.metamodel.v0_2_0.custom.impl.CustomPackageImpl#getETypedElementCase() + * @generated + */ + EClass ETYPED_ELEMENT_CASE = eINSTANCE.getETypedElementCase(); + + /** + * The meta object literal for the '<em><b>Case</b></em>' reference feature. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + EReference ETYPED_ELEMENT_CASE__CASE = eINSTANCE.getETypedElementCase_Case(); + + /** + * The meta object literal for the '<em><b>Value</b></em>' containment reference feature. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + EReference ETYPED_ELEMENT_CASE__VALUE = eINSTANCE.getETypedElementCase_Value(); + + } + +} //CustomPackage
diff --git a/org.eclipse.modisco.facet.custom.metamodel/src/org/eclipse/modisco/facet/custom/metamodel/v0_2_0/custom/Customization.java b/org.eclipse.modisco.facet.custom.metamodel/src/org/eclipse/modisco/facet/custom/metamodel/v0_2_0/custom/Customization.java new file mode 100644 index 0000000..264bf38 --- /dev/null +++ b/org.eclipse.modisco.facet.custom.metamodel/src/org/eclipse/modisco/facet/custom/metamodel/v0_2_0/custom/Customization.java
@@ -0,0 +1,65 @@ +/** + * Copyright (c) 2011 Mia-Software. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Gregoire Dupe (Mia-Software) - Bug 361794 - [Restructuring] New customization meta-model + * Gregoire Dupe (Mia-Software) - Bug 369987 - [Restructuring][Table] Switch to the new customization and facet framework + * Gregoire Dupe (Mia-Software) - Bug 373078 - API Cleaning + */ +package org.eclipse.modisco.facet.custom.metamodel.v0_2_0.custom; + +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.FacetSet; + +/** + * <!-- begin-user-doc --> + * A representation of the model object '<em><b>Customization</b></em>'. + * <!-- end-user-doc --> + * + * <!-- begin-model-doc --> + * The customization model element is the root of a customization model. A customization is applied to only one ePackage and contains EClassCustomizations. + * <!-- end-model-doc --> + * + * <p> + * The following features are supported: + * <ul> + * <li>{@link org.eclipse.modisco.facet.custom.metamodel.v0_2_0.custom.Customization#isMustBeLoadedByDefault <em>Must Be Loaded By Default</em>}</li> + * </ul> + * </p> + * + * @see org.eclipse.modisco.facet.custom.metamodel.v0_2_0.custom.CustomPackage#getCustomization() + * @model + * @generated + */ +public interface Customization extends FacetSet { + /** + * Returns the value of the '<em><b>Must Be Loaded By Default</b></em>' attribute. + * The default value is <code>"false"</code>. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * <!-- begin-model-doc --> + * When Customization::mustBeloadedByDefault is true, the customization will be automatically loaded in the customizable model browsers. + * <!-- end-model-doc --> + * @return the value of the '<em>Must Be Loaded By Default</em>' attribute. + * @see #setMustBeLoadedByDefault(boolean) + * @see org.eclipse.modisco.facet.custom.metamodel.v0_2_0.custom.CustomPackage#getCustomization_MustBeLoadedByDefault() + * @model default="false" required="true" + * @generated + */ + boolean isMustBeLoadedByDefault(); + + /** + * Sets the value of the '{@link org.eclipse.modisco.facet.custom.metamodel.v0_2_0.custom.Customization#isMustBeLoadedByDefault <em>Must Be Loaded By Default</em>}' attribute. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @param value the new value of the '<em>Must Be Loaded By Default</em>' attribute. + * @see #isMustBeLoadedByDefault() + * @generated + */ + void setMustBeLoadedByDefault(boolean value); + +} // Customization
diff --git a/org.eclipse.modisco.facet.custom.metamodel/src/org/eclipse/modisco/facet/custom/metamodel/v0_2_0/custom/EClassCustomization.java b/org.eclipse.modisco.facet.custom.metamodel/src/org/eclipse/modisco/facet/custom/metamodel/v0_2_0/custom/EClassCustomization.java new file mode 100644 index 0000000..a45bf19 --- /dev/null +++ b/org.eclipse.modisco.facet.custom.metamodel/src/org/eclipse/modisco/facet/custom/metamodel/v0_2_0/custom/EClassCustomization.java
@@ -0,0 +1,34 @@ +/** + * Copyright (c) 2011 Mia-Software. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Gregoire Dupe (Mia-Software) - Bug 361794 - [Restructuring] New customization meta-model + * Gregoire Dupe (Mia-Software) - Bug 369987 - [Restructuring][Table] Switch to the new customization and facet framework + * Gregoire Dupe (Mia-Software) - Bug 373078 - API Cleaning + */ +package org.eclipse.modisco.facet.custom.metamodel.v0_2_0.custom; + +import org.eclipse.emf.ecore.EObject; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.Facet; + +/** + * <!-- begin-user-doc --> + * A representation of the model object '<em><b>EClass Customization</b></em>'. + * <!-- end-user-doc --> + * + * <!-- begin-model-doc --> + * An EClassCustomization contains the customization for an EClass. There must not exist two EClassCustomizations customizing the same EClass in the same customization. + * <!-- end-model-doc --> + * + * + * @see org.eclipse.modisco.facet.custom.metamodel.v0_2_0.custom.CustomPackage#getEClassCustomization() + * @model + * @generated + */ +public interface EClassCustomization extends Facet { +} // EClassCustomization
diff --git a/org.eclipse.modisco.facet.custom.metamodel/src/org/eclipse/modisco/facet/custom/metamodel/v0_2_0/custom/ETypedElementCase.java b/org.eclipse.modisco.facet.custom.metamodel/src/org/eclipse/modisco/facet/custom/metamodel/v0_2_0/custom/ETypedElementCase.java new file mode 100644 index 0000000..ac69e3d --- /dev/null +++ b/org.eclipse.modisco.facet.custom.metamodel/src/org/eclipse/modisco/facet/custom/metamodel/v0_2_0/custom/ETypedElementCase.java
@@ -0,0 +1,94 @@ +/** + * Copyright (c) 2011 Mia-Software. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Gregoire Dupe (Mia-Software) - Bug 361794 - [Restructuring] New customization meta-model + * Gregoire Dupe (Mia-Software) - Bug 369987 - [Restructuring][Table] Switch to the new customization and facet framework + * Gregoire Dupe (Mia-Software) - Bug 373078 - API Cleaning + */ +package org.eclipse.modisco.facet.custom.metamodel.v0_2_0.custom; + +import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.ecore.ETypedElement; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.extensible.Query; + +/** + * <!-- begin-user-doc --> + * A representation of the model object '<em><b>ETyped Element Case</b></em>'. + * <!-- end-user-doc --> + * + * <!-- begin-model-doc --> + * Case part of the ETypedElementSwitchQuery. + * <!-- end-model-doc --> + * + * <p> + * The following features are supported: + * <ul> + * <li>{@link org.eclipse.modisco.facet.custom.metamodel.v0_2_0.custom.ETypedElementCase#getCase <em>Case</em>}</li> + * <li>{@link org.eclipse.modisco.facet.custom.metamodel.v0_2_0.custom.ETypedElementCase#getValue <em>Value</em>}</li> + * </ul> + * </p> + * + * @see org.eclipse.modisco.facet.custom.metamodel.v0_2_0.custom.CustomPackage#getETypedElementCase() + * @model + * @generated + */ +public interface ETypedElementCase extends EObject { + /** + * Returns the value of the '<em><b>Case</b></em>' reference. + * <!-- begin-user-doc --> + * <p> + * If the meaning of the '<em>Case</em>' reference isn't clear, + * there really should be more of a description here... + * </p> + * <!-- end-user-doc --> + * @return the value of the '<em>Case</em>' reference. + * @see #setCase(ETypedElement) + * @see org.eclipse.modisco.facet.custom.metamodel.v0_2_0.custom.CustomPackage#getETypedElementCase_Case() + * @model required="true" + * @generated + */ + ETypedElement getCase(); + + /** + * Sets the value of the '{@link org.eclipse.modisco.facet.custom.metamodel.v0_2_0.custom.ETypedElementCase#getCase <em>Case</em>}' reference. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @param value the new value of the '<em>Case</em>' reference. + * @see #getCase() + * @generated + */ + void setCase(ETypedElement value); + + /** + * Returns the value of the '<em><b>Value</b></em>' containment reference. + * <!-- begin-user-doc --> + * <p> + * If the meaning of the '<em>Value</em>' containment reference isn't clear, + * there really should be more of a description here... + * </p> + * <!-- end-user-doc --> + * @return the value of the '<em>Value</em>' containment reference. + * @see #setValue(Query) + * @see org.eclipse.modisco.facet.custom.metamodel.v0_2_0.custom.CustomPackage#getETypedElementCase_Value() + * @model containment="true" + * @generated + */ + Query getValue(); + + /** + * Sets the value of the '{@link org.eclipse.modisco.facet.custom.metamodel.v0_2_0.custom.ETypedElementCase#getValue <em>Value</em>}' containment reference. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @param value the new value of the '<em>Value</em>' containment reference. + * @see #getValue() + * @generated + */ + void setValue(Query value); + +} // ETypedElementCase
diff --git a/org.eclipse.modisco.facet.custom.metamodel/src/org/eclipse/modisco/facet/custom/metamodel/v0_2_0/custom/ETypedElementSwitchQuery.java b/org.eclipse.modisco.facet.custom.metamodel/src/org/eclipse/modisco/facet/custom/metamodel/v0_2_0/custom/ETypedElementSwitchQuery.java new file mode 100644 index 0000000..cfce58a --- /dev/null +++ b/org.eclipse.modisco.facet.custom.metamodel/src/org/eclipse/modisco/facet/custom/metamodel/v0_2_0/custom/ETypedElementSwitchQuery.java
@@ -0,0 +1,56 @@ +/** + * Copyright (c) 2011 Mia-Software. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Gregoire Dupe (Mia-Software) - Bug 361794 - [Restructuring] New customization meta-model + * Gregoire Dupe (Mia-Software) - Bug 369987 - [Restructuring][Table] Switch to the new customization and facet framework + * Gregoire Dupe (Mia-Software) - Bug 373078 - API Cleaning + */ +package org.eclipse.modisco.facet.custom.metamodel.v0_2_0.custom; + +import org.eclipse.emf.common.util.EList; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.extensible.Query; + +/** + * <!-- begin-user-doc --> + * A representation of the model object '<em><b>ETyped Element Switch Query</b></em>'. + * <!-- end-user-doc --> + * + * <!-- begin-model-doc --> + * This query can return a value depending of an instance of ETypedElement. This query is dedicated to the definition of customizations. + * <!-- end-model-doc --> + * + * <p> + * The following features are supported: + * <ul> + * <li>{@link org.eclipse.modisco.facet.custom.metamodel.v0_2_0.custom.ETypedElementSwitchQuery#getCases <em>Cases</em>}</li> + * </ul> + * </p> + * + * @see org.eclipse.modisco.facet.custom.metamodel.v0_2_0.custom.CustomPackage#getETypedElementSwitchQuery() + * @model + * @generated + */ +public interface ETypedElementSwitchQuery extends Query { + /** + * Returns the value of the '<em><b>Cases</b></em>' containment reference list. + * The list contents are of type {@link org.eclipse.modisco.facet.custom.metamodel.v0_2_0.custom.ETypedElementCase}. + * <!-- begin-user-doc --> + * <p> + * If the meaning of the '<em>Cases</em>' containment reference list isn't clear, + * there really should be more of a description here... + * </p> + * <!-- end-user-doc --> + * @return the value of the '<em>Cases</em>' containment reference list. + * @see org.eclipse.modisco.facet.custom.metamodel.v0_2_0.custom.CustomPackage#getETypedElementSwitchQuery_Cases() + * @model containment="true" + * @generated + */ + EList<ETypedElementCase> getCases(); + +} // ETypedElementSwitchQuery
diff --git a/org.eclipse.modisco.facet.custom.metamodel/src/org/eclipse/modisco/facet/custom/metamodel/v0_2_0/custom/FacetCustomization.java b/org.eclipse.modisco.facet.custom.metamodel/src/org/eclipse/modisco/facet/custom/metamodel/v0_2_0/custom/FacetCustomization.java new file mode 100644 index 0000000..c372921 --- /dev/null +++ b/org.eclipse.modisco.facet.custom.metamodel/src/org/eclipse/modisco/facet/custom/metamodel/v0_2_0/custom/FacetCustomization.java
@@ -0,0 +1,66 @@ +/** + * Copyright (c) 2011 Mia-Software. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Gregoire Dupe (Mia-Software) - Bug 361794 - [Restructuring] New customization meta-model + * Gregoire Dupe (Mia-Software) - Bug 369987 - [Restructuring][Table] Switch to the new customization and facet framework + * Gregoire Dupe (Mia-Software) - Bug 373078 - API Cleaning + */ +package org.eclipse.modisco.facet.custom.metamodel.v0_2_0.custom; + +import org.eclipse.emf.ecore.EObject; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.Facet; + +/** + * <!-- begin-user-doc --> + * A representation of the model object '<em><b>Facet Customization</b></em>'. + * <!-- end-user-doc --> + * + * <!-- begin-model-doc --> + * A FacetCustomization contains the customization for a Facet. There must not exist two FacetCustomizations customizing the same facet in the same customization. + * <!-- end-model-doc --> + * + * <p> + * The following features are supported: + * <ul> + * <li>{@link org.eclipse.modisco.facet.custom.metamodel.v0_2_0.custom.FacetCustomization#getCustomizedFacet <em>Customized Facet</em>}</li> + * </ul> + * </p> + * + * @see org.eclipse.modisco.facet.custom.metamodel.v0_2_0.custom.CustomPackage#getFacetCustomization() + * @model + * @generated + */ +public interface FacetCustomization extends Facet { + /** + * Returns the value of the '<em><b>Customized Facet</b></em>' reference. + * <!-- begin-user-doc --> + * <p> + * If the meaning of the '<em>Customized Facet</em>' reference isn't clear, + * there really should be more of a description here... + * </p> + * <!-- end-user-doc --> + * @return the value of the '<em>Customized Facet</em>' reference. + * @see #setCustomizedFacet(Facet) + * @see org.eclipse.modisco.facet.custom.metamodel.v0_2_0.custom.CustomPackage#getFacetCustomization_CustomizedFacet() + * @model required="true" + * @generated + */ + Facet getCustomizedFacet(); + + /** + * Sets the value of the '{@link org.eclipse.modisco.facet.custom.metamodel.v0_2_0.custom.FacetCustomization#getCustomizedFacet <em>Customized Facet</em>}' reference. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @param value the new value of the '<em>Customized Facet</em>' reference. + * @see #getCustomizedFacet() + * @generated + */ + void setCustomizedFacet(Facet value); + +} // FacetCustomization
diff --git a/org.eclipse.modisco.facet.custom.metamodel/src/org/eclipse/modisco/facet/custom/metamodel/v0_2_0/custom/impl/CustomFactoryImpl.java b/org.eclipse.modisco.facet.custom.metamodel/src/org/eclipse/modisco/facet/custom/metamodel/v0_2_0/custom/impl/CustomFactoryImpl.java new file mode 100644 index 0000000..8de94c6 --- /dev/null +++ b/org.eclipse.modisco.facet.custom.metamodel/src/org/eclipse/modisco/facet/custom/metamodel/v0_2_0/custom/impl/CustomFactoryImpl.java
@@ -0,0 +1,149 @@ +/** + * Copyright (c) 2011 Mia-Software. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Gregoire Dupe (Mia-Software) - Bug 361794 - [Restructuring] New customization meta-model + * Gregoire Dupe (Mia-Software) - Bug 369987 - [Restructuring][Table] Switch to the new customization and facet framework + * Gregoire Dupe (Mia-Software) - Bug 373078 - API Cleaning + */ +package org.eclipse.modisco.facet.custom.metamodel.v0_2_0.custom.impl; + +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.ecore.EPackage; + +import org.eclipse.emf.ecore.impl.EFactoryImpl; + +import org.eclipse.emf.ecore.plugin.EcorePlugin; +import org.eclipse.modisco.facet.custom.metamodel.v0_2_0.custom.*; + +/** + * <!-- begin-user-doc --> + * An implementation of the model <b>Factory</b>. + * <!-- end-user-doc --> + * @generated + */ +public class CustomFactoryImpl extends EFactoryImpl implements CustomFactory { + /** + * Creates the default factory implementation. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public static CustomFactory init() { + try { + CustomFactory theCustomFactory = (CustomFactory)EPackage.Registry.INSTANCE.getEFactory("http://www.eclipse.org/emf/facet/custom/0.2.incubation/custom"); + if (theCustomFactory != null) { + return theCustomFactory; + } + } + catch (Exception exception) { + EcorePlugin.INSTANCE.log(exception); + } + return new CustomFactoryImpl(); + } + + /** + * Creates an instance of the factory. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public CustomFactoryImpl() { + super(); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + public EObject create(EClass eClass) { + switch (eClass.getClassifierID()) { + case CustomPackage.CUSTOMIZATION: return createCustomization(); + case CustomPackage.ECLASS_CUSTOMIZATION: return createEClassCustomization(); + case CustomPackage.FACET_CUSTOMIZATION: return createFacetCustomization(); + case CustomPackage.ETYPED_ELEMENT_SWITCH_QUERY: return createETypedElementSwitchQuery(); + case CustomPackage.ETYPED_ELEMENT_CASE: return createETypedElementCase(); + default: + throw new IllegalArgumentException("The class '" + eClass.getName() + "' is not a valid classifier"); + } + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public Customization createCustomization() { + CustomizationImpl customization = new CustomizationImpl(); + return customization; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public EClassCustomization createEClassCustomization() { + EClassCustomizationImpl eClassCustomization = new EClassCustomizationImpl(); + return eClassCustomization; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public FacetCustomization createFacetCustomization() { + FacetCustomizationImpl facetCustomization = new FacetCustomizationImpl(); + return facetCustomization; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public ETypedElementSwitchQuery createETypedElementSwitchQuery() { + ETypedElementSwitchQueryImpl eTypedElementSwitchQuery = new ETypedElementSwitchQueryImpl(); + return eTypedElementSwitchQuery; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public ETypedElementCase createETypedElementCase() { + ETypedElementCaseImpl eTypedElementCase = new ETypedElementCaseImpl(); + return eTypedElementCase; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public CustomPackage getCustomPackage() { + return (CustomPackage)getEPackage(); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @deprecated + * @generated + */ + @Deprecated + public static CustomPackage getPackage() { + return CustomPackage.eINSTANCE; + } + +} //CustomFactoryImpl
diff --git a/org.eclipse.modisco.facet.custom.metamodel/src/org/eclipse/modisco/facet/custom/metamodel/v0_2_0/custom/impl/CustomPackageImpl.java b/org.eclipse.modisco.facet.custom.metamodel/src/org/eclipse/modisco/facet/custom/metamodel/v0_2_0/custom/impl/CustomPackageImpl.java new file mode 100644 index 0000000..c5ed26a --- /dev/null +++ b/org.eclipse.modisco.facet.custom.metamodel/src/org/eclipse/modisco/facet/custom/metamodel/v0_2_0/custom/impl/CustomPackageImpl.java
@@ -0,0 +1,329 @@ +/** + * Copyright (c) 2011 Mia-Software. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Gregoire Dupe (Mia-Software) - Bug 361794 - [Restructuring] New customization meta-model + * Gregoire Dupe (Mia-Software) - Bug 369987 - [Restructuring][Table] Switch to the new customization and facet framework + * Gregoire Dupe (Mia-Software) - Bug 373078 - API Cleaning + */ +package org.eclipse.modisco.facet.custom.metamodel.v0_2_0.custom.impl; + +import org.eclipse.emf.ecore.EAttribute; +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.EPackage; +import org.eclipse.emf.ecore.EReference; + +import org.eclipse.emf.ecore.impl.EPackageImpl; +import org.eclipse.modisco.facet.custom.metamodel.v0_2_0.custom.CustomFactory; +import org.eclipse.modisco.facet.custom.metamodel.v0_2_0.custom.CustomPackage; +import org.eclipse.modisco.facet.custom.metamodel.v0_2_0.custom.Customization; +import org.eclipse.modisco.facet.custom.metamodel.v0_2_0.custom.EClassCustomization; +import org.eclipse.modisco.facet.custom.metamodel.v0_2_0.custom.ETypedElementCase; +import org.eclipse.modisco.facet.custom.metamodel.v0_2_0.custom.ETypedElementSwitchQuery; +import org.eclipse.modisco.facet.custom.metamodel.v0_2_0.custom.FacetCustomization; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.EFacetPackage; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.extensible.ExtensiblePackage; + +/** + * <!-- begin-user-doc --> + * An implementation of the model <b>Package</b>. + * <!-- end-user-doc --> + * @generated + */ +public class CustomPackageImpl extends EPackageImpl implements CustomPackage { + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + private EClass customizationEClass = null; + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + private EClass eClassCustomizationEClass = null; + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + private EClass facetCustomizationEClass = null; + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + private EClass eTypedElementSwitchQueryEClass = null; + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + private EClass eTypedElementCaseEClass = null; + + /** + * Creates an instance of the model <b>Package</b>, registered with + * {@link org.eclipse.emf.ecore.EPackage.Registry EPackage.Registry} by the package + * package URI value. + * <p>Note: the correct way to create the package is via the static + * factory method {@link #init init()}, which also performs + * initialization of the package, or returns the registered package, + * if one already exists. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @see org.eclipse.emf.ecore.EPackage.Registry + * @see org.eclipse.modisco.facet.custom.metamodel.v0_2_0.custom.CustomPackage#eNS_URI + * @see #init() + * @generated + */ + private CustomPackageImpl() { + super(eNS_URI, CustomFactory.eINSTANCE); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + private static boolean isInited = false; + + /** + * Creates, registers, and initializes the <b>Package</b> for this model, and for any others upon which it depends. + * + * <p>This method is used to initialize {@link CustomPackage#eINSTANCE} when that field is accessed. + * Clients should not invoke it directly. Instead, they should simply access that field to obtain the package. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @see #eNS_URI + * @see #createPackageContents() + * @see #initializePackageContents() + * @generated + */ + public static CustomPackage init() { + if (isInited) return (CustomPackage)EPackage.Registry.INSTANCE.getEPackage(CustomPackage.eNS_URI); + + // Obtain or create and register package + CustomPackageImpl theCustomPackage = (CustomPackageImpl)(EPackage.Registry.INSTANCE.get(eNS_URI) instanceof CustomPackageImpl ? EPackage.Registry.INSTANCE.get(eNS_URI) : new CustomPackageImpl()); + + isInited = true; + + // Initialize simple dependencies + EFacetPackage.eINSTANCE.eClass(); + + // Create package meta-data objects + theCustomPackage.createPackageContents(); + + // Initialize created meta-data + theCustomPackage.initializePackageContents(); + + // Mark meta-data to indicate it can't be changed + theCustomPackage.freeze(); + + + // Update the registry and return the package + EPackage.Registry.INSTANCE.put(CustomPackage.eNS_URI, theCustomPackage); + return theCustomPackage; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public EClass getCustomization() { + return customizationEClass; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public EAttribute getCustomization_MustBeLoadedByDefault() { + return (EAttribute)customizationEClass.getEStructuralFeatures().get(0); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public EClass getEClassCustomization() { + return eClassCustomizationEClass; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public EClass getFacetCustomization() { + return facetCustomizationEClass; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public EReference getFacetCustomization_CustomizedFacet() { + return (EReference)facetCustomizationEClass.getEStructuralFeatures().get(0); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public EClass getETypedElementSwitchQuery() { + return eTypedElementSwitchQueryEClass; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public EReference getETypedElementSwitchQuery_Cases() { + return (EReference)eTypedElementSwitchQueryEClass.getEStructuralFeatures().get(0); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public EClass getETypedElementCase() { + return eTypedElementCaseEClass; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public EReference getETypedElementCase_Case() { + return (EReference)eTypedElementCaseEClass.getEStructuralFeatures().get(0); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public EReference getETypedElementCase_Value() { + return (EReference)eTypedElementCaseEClass.getEStructuralFeatures().get(1); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public CustomFactory getCustomFactory() { + return (CustomFactory)getEFactoryInstance(); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + private boolean isCreated = false; + + /** + * Creates the meta-model objects for the package. This method is + * guarded to have no affect on any invocation but its first. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public void createPackageContents() { + if (isCreated) return; + isCreated = true; + + // Create classes and their features + customizationEClass = createEClass(CUSTOMIZATION); + createEAttribute(customizationEClass, CUSTOMIZATION__MUST_BE_LOADED_BY_DEFAULT); + + eClassCustomizationEClass = createEClass(ECLASS_CUSTOMIZATION); + + facetCustomizationEClass = createEClass(FACET_CUSTOMIZATION); + createEReference(facetCustomizationEClass, FACET_CUSTOMIZATION__CUSTOMIZED_FACET); + + eTypedElementSwitchQueryEClass = createEClass(ETYPED_ELEMENT_SWITCH_QUERY); + createEReference(eTypedElementSwitchQueryEClass, ETYPED_ELEMENT_SWITCH_QUERY__CASES); + + eTypedElementCaseEClass = createEClass(ETYPED_ELEMENT_CASE); + createEReference(eTypedElementCaseEClass, ETYPED_ELEMENT_CASE__CASE); + createEReference(eTypedElementCaseEClass, ETYPED_ELEMENT_CASE__VALUE); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + private boolean isInitialized = false; + + /** + * Complete the initialization of the package and its meta-model. This + * method is guarded to have no affect on any invocation but its first. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public void initializePackageContents() { + if (isInitialized) return; + isInitialized = true; + + // Initialize package + setName(eNAME); + setNsPrefix(eNS_PREFIX); + setNsURI(eNS_URI); + + // Obtain other dependent packages + EFacetPackage theEFacetPackage = (EFacetPackage)EPackage.Registry.INSTANCE.getEPackage(EFacetPackage.eNS_URI); + ExtensiblePackage theExtensiblePackage = (ExtensiblePackage)EPackage.Registry.INSTANCE.getEPackage(ExtensiblePackage.eNS_URI); + + // Create type parameters + + // Set bounds for type parameters + + // Add supertypes to classes + customizationEClass.getESuperTypes().add(theEFacetPackage.getFacetSet()); + eClassCustomizationEClass.getESuperTypes().add(theEFacetPackage.getFacet()); + facetCustomizationEClass.getESuperTypes().add(theEFacetPackage.getFacet()); + eTypedElementSwitchQueryEClass.getESuperTypes().add(theExtensiblePackage.getQuery()); + + // Initialize classes and features; add operations and parameters + initEClass(customizationEClass, Customization.class, "Customization", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); + initEAttribute(getCustomization_MustBeLoadedByDefault(), ecorePackage.getEBoolean(), "mustBeLoadedByDefault", "false", 1, 1, Customization.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + + initEClass(eClassCustomizationEClass, EClassCustomization.class, "EClassCustomization", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); + + initEClass(facetCustomizationEClass, FacetCustomization.class, "FacetCustomization", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); + initEReference(getFacetCustomization_CustomizedFacet(), theEFacetPackage.getFacet(), null, "customizedFacet", null, 1, 1, FacetCustomization.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + + initEClass(eTypedElementSwitchQueryEClass, ETypedElementSwitchQuery.class, "ETypedElementSwitchQuery", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); + initEReference(getETypedElementSwitchQuery_Cases(), this.getETypedElementCase(), null, "cases", null, 0, -1, ETypedElementSwitchQuery.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + + initEClass(eTypedElementCaseEClass, ETypedElementCase.class, "ETypedElementCase", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); + initEReference(getETypedElementCase_Case(), ecorePackage.getETypedElement(), null, "case", null, 1, 1, ETypedElementCase.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + initEReference(getETypedElementCase_Value(), theExtensiblePackage.getQuery(), null, "value", null, 0, 1, ETypedElementCase.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + + // Create resource + createResource(eNS_URI); + } + +} //CustomPackageImpl
diff --git a/org.eclipse.modisco.facet.custom.metamodel/src/org/eclipse/modisco/facet/custom/metamodel/v0_2_0/custom/impl/CustomizationImpl.java b/org.eclipse.modisco.facet.custom.metamodel/src/org/eclipse/modisco/facet/custom/metamodel/v0_2_0/custom/impl/CustomizationImpl.java new file mode 100644 index 0000000..d829aab --- /dev/null +++ b/org.eclipse.modisco.facet.custom.metamodel/src/org/eclipse/modisco/facet/custom/metamodel/v0_2_0/custom/impl/CustomizationImpl.java
@@ -0,0 +1,173 @@ +/** + * Copyright (c) 2011 Mia-Software. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Gregoire Dupe (Mia-Software) - Bug 361794 - [Restructuring] New customization meta-model + * Gregoire Dupe (Mia-Software) - Bug 369987 - [Restructuring][Table] Switch to the new customization and facet framework + * Gregoire Dupe (Mia-Software) - Bug 373078 - API Cleaning + */ +package org.eclipse.modisco.facet.custom.metamodel.v0_2_0.custom.impl; + +import org.eclipse.emf.common.notify.Notification; + +import org.eclipse.emf.ecore.EClass; + +import org.eclipse.emf.ecore.impl.ENotificationImpl; +import org.eclipse.modisco.facet.custom.metamodel.v0_2_0.custom.CustomPackage; +import org.eclipse.modisco.facet.custom.metamodel.v0_2_0.custom.Customization; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.impl.FacetSetImpl; + +/** + * <!-- begin-user-doc --> + * An implementation of the model object '<em><b>Customization</b></em>'. + * <!-- end-user-doc --> + * <p> + * The following features are implemented: + * <ul> + * <li>{@link org.eclipse.modisco.facet.custom.metamodel.v0_2_0.custom.impl.CustomizationImpl#isMustBeLoadedByDefault <em>Must Be Loaded By Default</em>}</li> + * </ul> + * </p> + * + * @generated + */ +public class CustomizationImpl extends FacetSetImpl implements Customization { + /** + * The default value of the '{@link #isMustBeLoadedByDefault() <em>Must Be Loaded By Default</em>}' attribute. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @see #isMustBeLoadedByDefault() + * @generated + * @ordered + */ + protected static final boolean MUST_BE_LOADED_BY_DEFAULT_EDEFAULT = false; + + /** + * The cached value of the '{@link #isMustBeLoadedByDefault() <em>Must Be Loaded By Default</em>}' attribute. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @see #isMustBeLoadedByDefault() + * @generated + * @ordered + */ + protected boolean mustBeLoadedByDefault = MUST_BE_LOADED_BY_DEFAULT_EDEFAULT; + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + protected CustomizationImpl() { + super(); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + protected EClass eStaticClass() { + return CustomPackage.Literals.CUSTOMIZATION; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public boolean isMustBeLoadedByDefault() { + return mustBeLoadedByDefault; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public void setMustBeLoadedByDefault(boolean newMustBeLoadedByDefault) { + boolean oldMustBeLoadedByDefault = mustBeLoadedByDefault; + mustBeLoadedByDefault = newMustBeLoadedByDefault; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.SET, CustomPackage.CUSTOMIZATION__MUST_BE_LOADED_BY_DEFAULT, oldMustBeLoadedByDefault, mustBeLoadedByDefault)); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + public Object eGet(int featureID, boolean resolve, boolean coreType) { + switch (featureID) { + case CustomPackage.CUSTOMIZATION__MUST_BE_LOADED_BY_DEFAULT: + return isMustBeLoadedByDefault(); + } + return super.eGet(featureID, resolve, coreType); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + public void eSet(int featureID, Object newValue) { + switch (featureID) { + case CustomPackage.CUSTOMIZATION__MUST_BE_LOADED_BY_DEFAULT: + setMustBeLoadedByDefault((Boolean)newValue); + return; + } + super.eSet(featureID, newValue); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + public void eUnset(int featureID) { + switch (featureID) { + case CustomPackage.CUSTOMIZATION__MUST_BE_LOADED_BY_DEFAULT: + setMustBeLoadedByDefault(MUST_BE_LOADED_BY_DEFAULT_EDEFAULT); + return; + } + super.eUnset(featureID); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + public boolean eIsSet(int featureID) { + switch (featureID) { + case CustomPackage.CUSTOMIZATION__MUST_BE_LOADED_BY_DEFAULT: + return mustBeLoadedByDefault != MUST_BE_LOADED_BY_DEFAULT_EDEFAULT; + } + return super.eIsSet(featureID); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + public String toString() { + if (eIsProxy()) return super.toString(); + + StringBuffer result = new StringBuffer(super.toString()); + result.append(" (mustBeLoadedByDefault: "); + result.append(mustBeLoadedByDefault); + result.append(')'); + return result.toString(); + } + +} //CustomizationImpl
diff --git a/org.eclipse.modisco.facet.custom.metamodel/src/org/eclipse/modisco/facet/custom/metamodel/v0_2_0/custom/impl/EClassCustomizationImpl.java b/org.eclipse.modisco.facet.custom.metamodel/src/org/eclipse/modisco/facet/custom/metamodel/v0_2_0/custom/impl/EClassCustomizationImpl.java new file mode 100644 index 0000000..f5f33e9 --- /dev/null +++ b/org.eclipse.modisco.facet.custom.metamodel/src/org/eclipse/modisco/facet/custom/metamodel/v0_2_0/custom/impl/EClassCustomizationImpl.java
@@ -0,0 +1,52 @@ +/** + * Copyright (c) 2011 Mia-Software. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Gregoire Dupe (Mia-Software) - Bug 361794 - [Restructuring] New customization meta-model + * Gregoire Dupe (Mia-Software) - Bug 369987 - [Restructuring][Table] Switch to the new customization and facet framework + * Gregoire Dupe (Mia-Software) - Bug 373078 - API Cleaning + */ +package org.eclipse.modisco.facet.custom.metamodel.v0_2_0.custom.impl; + +import org.eclipse.emf.ecore.EClass; + +import org.eclipse.emf.ecore.impl.EObjectImpl; +import org.eclipse.modisco.facet.custom.metamodel.v0_2_0.custom.CustomPackage; +import org.eclipse.modisco.facet.custom.metamodel.v0_2_0.custom.EClassCustomization; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.impl.FacetImpl; + +/** + * <!-- begin-user-doc --> + * An implementation of the model object '<em><b>EClass Customization</b></em>'. + * <!-- end-user-doc --> + * <p> + * </p> + * + * @generated + */ +public class EClassCustomizationImpl extends FacetImpl implements EClassCustomization { + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + protected EClassCustomizationImpl() { + super(); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + protected EClass eStaticClass() { + return CustomPackage.Literals.ECLASS_CUSTOMIZATION; + } + +} //EClassCustomizationImpl
diff --git a/org.eclipse.modisco.facet.custom.metamodel/src/org/eclipse/modisco/facet/custom/metamodel/v0_2_0/custom/impl/ETypedElementCaseImpl.java b/org.eclipse.modisco.facet.custom.metamodel/src/org/eclipse/modisco/facet/custom/metamodel/v0_2_0/custom/impl/ETypedElementCaseImpl.java new file mode 100644 index 0000000..7704f5c --- /dev/null +++ b/org.eclipse.modisco.facet.custom.metamodel/src/org/eclipse/modisco/facet/custom/metamodel/v0_2_0/custom/impl/ETypedElementCaseImpl.java
@@ -0,0 +1,247 @@ +/** + * Copyright (c) 2011 Mia-Software. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Gregoire Dupe (Mia-Software) - Bug 361794 - [Restructuring] New customization meta-model + * Gregoire Dupe (Mia-Software) - Bug 369987 - [Restructuring][Table] Switch to the new customization and facet framework + * Gregoire Dupe (Mia-Software) - Bug 373078 - API Cleaning + */ +package org.eclipse.modisco.facet.custom.metamodel.v0_2_0.custom.impl; + +import org.eclipse.emf.common.notify.Notification; +import org.eclipse.emf.common.notify.NotificationChain; + +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.ETypedElement; +import org.eclipse.emf.ecore.InternalEObject; + +import org.eclipse.emf.ecore.impl.ENotificationImpl; +import org.eclipse.emf.ecore.impl.EObjectImpl; +import org.eclipse.modisco.facet.custom.metamodel.v0_2_0.custom.CustomPackage; +import org.eclipse.modisco.facet.custom.metamodel.v0_2_0.custom.ETypedElementCase; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.extensible.Query; + +/** + * <!-- begin-user-doc --> + * An implementation of the model object '<em><b>ETyped Element Case</b></em>'. + * <!-- end-user-doc --> + * <p> + * The following features are implemented: + * <ul> + * <li>{@link org.eclipse.modisco.facet.custom.metamodel.v0_2_0.custom.impl.ETypedElementCaseImpl#getCase <em>Case</em>}</li> + * <li>{@link org.eclipse.modisco.facet.custom.metamodel.v0_2_0.custom.impl.ETypedElementCaseImpl#getValue <em>Value</em>}</li> + * </ul> + * </p> + * + * @generated + */ +public class ETypedElementCaseImpl extends EObjectImpl implements ETypedElementCase { + /** + * The cached value of the '{@link #getCase() <em>Case</em>}' reference. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @see #getCase() + * @generated + * @ordered + */ + protected ETypedElement case_; + + /** + * The cached value of the '{@link #getValue() <em>Value</em>}' containment reference. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @see #getValue() + * @generated + * @ordered + */ + protected Query value; + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + protected ETypedElementCaseImpl() { + super(); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + protected EClass eStaticClass() { + return CustomPackage.Literals.ETYPED_ELEMENT_CASE; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public ETypedElement getCase() { + if (case_ != null && case_.eIsProxy()) { + InternalEObject oldCase = (InternalEObject)case_; + case_ = (ETypedElement)eResolveProxy(oldCase); + if (case_ != oldCase) { + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.RESOLVE, CustomPackage.ETYPED_ELEMENT_CASE__CASE, oldCase, case_)); + } + } + return case_; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public ETypedElement basicGetCase() { + return case_; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public void setCase(ETypedElement newCase) { + ETypedElement oldCase = case_; + case_ = newCase; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.SET, CustomPackage.ETYPED_ELEMENT_CASE__CASE, oldCase, case_)); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public Query getValue() { + return value; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public NotificationChain basicSetValue(Query newValue, NotificationChain msgs) { + Query oldValue = value; + value = newValue; + if (eNotificationRequired()) { + ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, CustomPackage.ETYPED_ELEMENT_CASE__VALUE, oldValue, newValue); + if (msgs == null) msgs = notification; else msgs.add(notification); + } + return msgs; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public void setValue(Query newValue) { + if (newValue != value) { + NotificationChain msgs = null; + if (value != null) + msgs = ((InternalEObject)value).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - CustomPackage.ETYPED_ELEMENT_CASE__VALUE, null, msgs); + if (newValue != null) + msgs = ((InternalEObject)newValue).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - CustomPackage.ETYPED_ELEMENT_CASE__VALUE, null, msgs); + msgs = basicSetValue(newValue, msgs); + if (msgs != null) msgs.dispatch(); + } + else if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.SET, CustomPackage.ETYPED_ELEMENT_CASE__VALUE, newValue, newValue)); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { + switch (featureID) { + case CustomPackage.ETYPED_ELEMENT_CASE__VALUE: + return basicSetValue(null, msgs); + } + return super.eInverseRemove(otherEnd, featureID, msgs); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + public Object eGet(int featureID, boolean resolve, boolean coreType) { + switch (featureID) { + case CustomPackage.ETYPED_ELEMENT_CASE__CASE: + if (resolve) return getCase(); + return basicGetCase(); + case CustomPackage.ETYPED_ELEMENT_CASE__VALUE: + return getValue(); + } + return super.eGet(featureID, resolve, coreType); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + public void eSet(int featureID, Object newValue) { + switch (featureID) { + case CustomPackage.ETYPED_ELEMENT_CASE__CASE: + setCase((ETypedElement)newValue); + return; + case CustomPackage.ETYPED_ELEMENT_CASE__VALUE: + setValue((Query)newValue); + return; + } + super.eSet(featureID, newValue); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + public void eUnset(int featureID) { + switch (featureID) { + case CustomPackage.ETYPED_ELEMENT_CASE__CASE: + setCase((ETypedElement)null); + return; + case CustomPackage.ETYPED_ELEMENT_CASE__VALUE: + setValue((Query)null); + return; + } + super.eUnset(featureID); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + public boolean eIsSet(int featureID) { + switch (featureID) { + case CustomPackage.ETYPED_ELEMENT_CASE__CASE: + return case_ != null; + case CustomPackage.ETYPED_ELEMENT_CASE__VALUE: + return value != null; + } + return super.eIsSet(featureID); + } + +} //ETypedElementCaseImpl
diff --git a/org.eclipse.modisco.facet.custom.metamodel/src/org/eclipse/modisco/facet/custom/metamodel/v0_2_0/custom/impl/ETypedElementSwitchQueryImpl.java b/org.eclipse.modisco.facet.custom.metamodel/src/org/eclipse/modisco/facet/custom/metamodel/v0_2_0/custom/impl/ETypedElementSwitchQueryImpl.java new file mode 100644 index 0000000..2cb9aa0 --- /dev/null +++ b/org.eclipse.modisco.facet.custom.metamodel/src/org/eclipse/modisco/facet/custom/metamodel/v0_2_0/custom/impl/ETypedElementSwitchQueryImpl.java
@@ -0,0 +1,161 @@ +/** + * Copyright (c) 2011 Mia-Software. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Gregoire Dupe (Mia-Software) - Bug 361794 - [Restructuring] New customization meta-model + * Gregoire Dupe (Mia-Software) - Bug 369987 - [Restructuring][Table] Switch to the new customization and facet framework + * Gregoire Dupe (Mia-Software) - Bug 373078 - API Cleaning + */ +package org.eclipse.modisco.facet.custom.metamodel.v0_2_0.custom.impl; + +import java.util.Collection; + +import org.eclipse.emf.common.notify.NotificationChain; + +import org.eclipse.emf.common.util.EList; + +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.InternalEObject; + +import org.eclipse.emf.ecore.util.EObjectContainmentEList; +import org.eclipse.emf.ecore.util.InternalEList; +import org.eclipse.modisco.facet.custom.metamodel.v0_2_0.custom.CustomPackage; +import org.eclipse.modisco.facet.custom.metamodel.v0_2_0.custom.ETypedElementCase; +import org.eclipse.modisco.facet.custom.metamodel.v0_2_0.custom.ETypedElementSwitchQuery; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.extensible.impl.QueryImpl; + +/** + * <!-- begin-user-doc --> + * An implementation of the model object '<em><b>ETyped Element Switch Query</b></em>'. + * <!-- end-user-doc --> + * <p> + * The following features are implemented: + * <ul> + * <li>{@link org.eclipse.modisco.facet.custom.metamodel.v0_2_0.custom.impl.ETypedElementSwitchQueryImpl#getCases <em>Cases</em>}</li> + * </ul> + * </p> + * + * @generated + */ +public class ETypedElementSwitchQueryImpl extends QueryImpl implements ETypedElementSwitchQuery { + /** + * The cached value of the '{@link #getCases() <em>Cases</em>}' containment reference list. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @see #getCases() + * @generated + * @ordered + */ + protected EList<ETypedElementCase> cases; + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + protected ETypedElementSwitchQueryImpl() { + super(); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + protected EClass eStaticClass() { + return CustomPackage.Literals.ETYPED_ELEMENT_SWITCH_QUERY; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public EList<ETypedElementCase> getCases() { + if (cases == null) { + cases = new EObjectContainmentEList<ETypedElementCase>(ETypedElementCase.class, this, CustomPackage.ETYPED_ELEMENT_SWITCH_QUERY__CASES); + } + return cases; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { + switch (featureID) { + case CustomPackage.ETYPED_ELEMENT_SWITCH_QUERY__CASES: + return ((InternalEList<?>)getCases()).basicRemove(otherEnd, msgs); + } + return super.eInverseRemove(otherEnd, featureID, msgs); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + public Object eGet(int featureID, boolean resolve, boolean coreType) { + switch (featureID) { + case CustomPackage.ETYPED_ELEMENT_SWITCH_QUERY__CASES: + return getCases(); + } + return super.eGet(featureID, resolve, coreType); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @SuppressWarnings("unchecked") + @Override + public void eSet(int featureID, Object newValue) { + switch (featureID) { + case CustomPackage.ETYPED_ELEMENT_SWITCH_QUERY__CASES: + getCases().clear(); + getCases().addAll((Collection<? extends ETypedElementCase>)newValue); + return; + } + super.eSet(featureID, newValue); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + public void eUnset(int featureID) { + switch (featureID) { + case CustomPackage.ETYPED_ELEMENT_SWITCH_QUERY__CASES: + getCases().clear(); + return; + } + super.eUnset(featureID); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + public boolean eIsSet(int featureID) { + switch (featureID) { + case CustomPackage.ETYPED_ELEMENT_SWITCH_QUERY__CASES: + return cases != null && !cases.isEmpty(); + } + return super.eIsSet(featureID); + } + +} //ETypedElementSwitchQueryImpl
diff --git a/org.eclipse.modisco.facet.custom.metamodel/src/org/eclipse/modisco/facet/custom/metamodel/v0_2_0/custom/impl/FacetCustomizationImpl.java b/org.eclipse.modisco.facet.custom.metamodel/src/org/eclipse/modisco/facet/custom/metamodel/v0_2_0/custom/impl/FacetCustomizationImpl.java new file mode 100644 index 0000000..bdb0361 --- /dev/null +++ b/org.eclipse.modisco.facet.custom.metamodel/src/org/eclipse/modisco/facet/custom/metamodel/v0_2_0/custom/impl/FacetCustomizationImpl.java
@@ -0,0 +1,168 @@ +/** + * Copyright (c) 2011 Mia-Software. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Gregoire Dupe (Mia-Software) - Bug 361794 - [Restructuring] New customization meta-model + * Gregoire Dupe (Mia-Software) - Bug 369987 - [Restructuring][Table] Switch to the new customization and facet framework + * Gregoire Dupe (Mia-Software) - Bug 373078 - API Cleaning + */ +package org.eclipse.modisco.facet.custom.metamodel.v0_2_0.custom.impl; + +import org.eclipse.emf.common.notify.Notification; + +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.InternalEObject; + +import org.eclipse.emf.ecore.impl.ENotificationImpl; +import org.eclipse.emf.ecore.impl.EObjectImpl; +import org.eclipse.modisco.facet.custom.metamodel.v0_2_0.custom.CustomPackage; +import org.eclipse.modisco.facet.custom.metamodel.v0_2_0.custom.FacetCustomization; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.Facet; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.impl.FacetImpl; + +/** + * <!-- begin-user-doc --> + * An implementation of the model object '<em><b>Facet Customization</b></em>'. + * <!-- end-user-doc --> + * <p> + * The following features are implemented: + * <ul> + * <li>{@link org.eclipse.modisco.facet.custom.metamodel.v0_2_0.custom.impl.FacetCustomizationImpl#getCustomizedFacet <em>Customized Facet</em>}</li> + * </ul> + * </p> + * + * @generated + */ +public class FacetCustomizationImpl extends FacetImpl implements FacetCustomization { + /** + * The cached value of the '{@link #getCustomizedFacet() <em>Customized Facet</em>}' reference. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @see #getCustomizedFacet() + * @generated + * @ordered + */ + protected Facet customizedFacet; + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + protected FacetCustomizationImpl() { + super(); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + protected EClass eStaticClass() { + return CustomPackage.Literals.FACET_CUSTOMIZATION; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public Facet getCustomizedFacet() { + if (customizedFacet != null && customizedFacet.eIsProxy()) { + InternalEObject oldCustomizedFacet = (InternalEObject)customizedFacet; + customizedFacet = (Facet)eResolveProxy(oldCustomizedFacet); + if (customizedFacet != oldCustomizedFacet) { + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.RESOLVE, CustomPackage.FACET_CUSTOMIZATION__CUSTOMIZED_FACET, oldCustomizedFacet, customizedFacet)); + } + } + return customizedFacet; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public Facet basicGetCustomizedFacet() { + return customizedFacet; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public void setCustomizedFacet(Facet newCustomizedFacet) { + Facet oldCustomizedFacet = customizedFacet; + customizedFacet = newCustomizedFacet; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.SET, CustomPackage.FACET_CUSTOMIZATION__CUSTOMIZED_FACET, oldCustomizedFacet, customizedFacet)); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + public Object eGet(int featureID, boolean resolve, boolean coreType) { + switch (featureID) { + case CustomPackage.FACET_CUSTOMIZATION__CUSTOMIZED_FACET: + if (resolve) return getCustomizedFacet(); + return basicGetCustomizedFacet(); + } + return super.eGet(featureID, resolve, coreType); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + public void eSet(int featureID, Object newValue) { + switch (featureID) { + case CustomPackage.FACET_CUSTOMIZATION__CUSTOMIZED_FACET: + setCustomizedFacet((Facet)newValue); + return; + } + super.eSet(featureID, newValue); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + public void eUnset(int featureID) { + switch (featureID) { + case CustomPackage.FACET_CUSTOMIZATION__CUSTOMIZED_FACET: + setCustomizedFacet((Facet)null); + return; + } + super.eUnset(featureID); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + public boolean eIsSet(int featureID) { + switch (featureID) { + case CustomPackage.FACET_CUSTOMIZATION__CUSTOMIZED_FACET: + return customizedFacet != null; + } + return super.eIsSet(featureID); + } + +} //FacetCustomizationImpl
diff --git a/org.eclipse.modisco.facet.custom.metamodel/src/org/eclipse/modisco/facet/custom/metamodel/v0_2_0/custom/util/CustomAdapterFactory.java b/org.eclipse.modisco.facet.custom.metamodel/src/org/eclipse/modisco/facet/custom/metamodel/v0_2_0/custom/util/CustomAdapterFactory.java new file mode 100644 index 0000000..1a7a02e --- /dev/null +++ b/org.eclipse.modisco.facet.custom.metamodel/src/org/eclipse/modisco/facet/custom/metamodel/v0_2_0/custom/util/CustomAdapterFactory.java
@@ -0,0 +1,354 @@ +/** + * Copyright (c) 2011 Mia-Software. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Gregoire Dupe (Mia-Software) - Bug 361794 - [Restructuring] New customization meta-model + * Gregoire Dupe (Mia-Software) - Bug 369987 - [Restructuring][Table] Switch to the new customization and facet framework + * Gregoire Dupe (Mia-Software) - Bug 373078 - API Cleaning + */ +package org.eclipse.modisco.facet.custom.metamodel.v0_2_0.custom.util; + +import org.eclipse.emf.common.notify.Adapter; +import org.eclipse.emf.common.notify.Notifier; + +import org.eclipse.emf.common.notify.impl.AdapterFactoryImpl; + +import org.eclipse.emf.ecore.EClassifier; +import org.eclipse.emf.ecore.EModelElement; +import org.eclipse.emf.ecore.ENamedElement; +import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.ecore.EPackage; +import org.eclipse.modisco.facet.custom.metamodel.v0_2_0.custom.*; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.DocumentedElement; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.Facet; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.FacetSet; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.extensible.Query; + +/** + * <!-- begin-user-doc --> + * The <b>Adapter Factory</b> for the model. + * It provides an adapter <code>createXXX</code> method for each class of the model. + * <!-- end-user-doc --> + * @see org.eclipse.modisco.facet.custom.metamodel.v0_2_0.custom.CustomPackage + * @generated + */ +public class CustomAdapterFactory extends AdapterFactoryImpl { + /** + * The cached model package. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + protected static CustomPackage modelPackage; + + /** + * Creates an instance of the adapter factory. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public CustomAdapterFactory() { + if (modelPackage == null) { + modelPackage = CustomPackage.eINSTANCE; + } + } + + /** + * Returns whether this factory is applicable for the type of the object. + * <!-- begin-user-doc --> + * This implementation returns <code>true</code> if the object is either the model's package or is an instance object of the model. + * <!-- end-user-doc --> + * @return whether this factory is applicable for the type of the object. + * @generated + */ + @Override + public boolean isFactoryForType(Object object) { + if (object == modelPackage) { + return true; + } + if (object instanceof EObject) { + return ((EObject)object).eClass().getEPackage() == modelPackage; + } + return false; + } + + /** + * The switch that delegates to the <code>createXXX</code> methods. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + protected CustomSwitch<Adapter> modelSwitch = + new CustomSwitch<Adapter>() { + @Override + public Adapter caseCustomization(Customization object) { + return createCustomizationAdapter(); + } + @Override + public Adapter caseEClassCustomization(EClassCustomization object) { + return createEClassCustomizationAdapter(); + } + @Override + public Adapter caseFacetCustomization(FacetCustomization object) { + return createFacetCustomizationAdapter(); + } + @Override + public Adapter caseETypedElementSwitchQuery(ETypedElementSwitchQuery object) { + return createETypedElementSwitchQueryAdapter(); + } + @Override + public Adapter caseETypedElementCase(ETypedElementCase object) { + return createETypedElementCaseAdapter(); + } + @Override + public Adapter caseEModelElement(EModelElement object) { + return createEModelElementAdapter(); + } + @Override + public Adapter caseENamedElement(ENamedElement object) { + return createENamedElementAdapter(); + } + @Override + public Adapter caseEPackage(EPackage object) { + return createEPackageAdapter(); + } + @Override + public Adapter caseDocumentedElement(DocumentedElement object) { + return createDocumentedElementAdapter(); + } + @Override + public Adapter caseFacetSet(FacetSet object) { + return createFacetSetAdapter(); + } + @Override + public Adapter caseEClassifier(EClassifier object) { + return createEClassifierAdapter(); + } + @Override + public Adapter caseFacet(Facet object) { + return createFacetAdapter(); + } + @Override + public Adapter caseQuery(Query object) { + return createQueryAdapter(); + } + @Override + public Adapter defaultCase(EObject object) { + return createEObjectAdapter(); + } + }; + + /** + * Creates an adapter for the <code>target</code>. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @param target the object to adapt. + * @return the adapter for the <code>target</code>. + * @generated + */ + @Override + public Adapter createAdapter(Notifier target) { + return modelSwitch.doSwitch((EObject)target); + } + + + /** + * Creates a new adapter for an object of class '{@link org.eclipse.modisco.facet.custom.metamodel.v0_2_0.custom.Customization <em>Customization</em>}'. + * <!-- begin-user-doc --> + * This default implementation returns null so that we can easily ignore cases; + * it's useful to ignore a case when inheritance will catch all the cases anyway. + * <!-- end-user-doc --> + * @return the new adapter. + * @see org.eclipse.modisco.facet.custom.metamodel.v0_2_0.custom.Customization + * @generated + */ + public Adapter createCustomizationAdapter() { + return null; + } + + /** + * Creates a new adapter for an object of class '{@link org.eclipse.modisco.facet.custom.metamodel.v0_2_0.custom.EClassCustomization <em>EClass Customization</em>}'. + * <!-- begin-user-doc --> + * This default implementation returns null so that we can easily ignore cases; + * it's useful to ignore a case when inheritance will catch all the cases anyway. + * <!-- end-user-doc --> + * @return the new adapter. + * @see org.eclipse.modisco.facet.custom.metamodel.v0_2_0.custom.EClassCustomization + * @generated + */ + public Adapter createEClassCustomizationAdapter() { + return null; + } + + /** + * Creates a new adapter for an object of class '{@link org.eclipse.modisco.facet.custom.metamodel.v0_2_0.custom.FacetCustomization <em>Facet Customization</em>}'. + * <!-- begin-user-doc --> + * This default implementation returns null so that we can easily ignore cases; + * it's useful to ignore a case when inheritance will catch all the cases anyway. + * <!-- end-user-doc --> + * @return the new adapter. + * @see org.eclipse.modisco.facet.custom.metamodel.v0_2_0.custom.FacetCustomization + * @generated + */ + public Adapter createFacetCustomizationAdapter() { + return null; + } + + /** + * Creates a new adapter for an object of class '{@link org.eclipse.modisco.facet.custom.metamodel.v0_2_0.custom.ETypedElementSwitchQuery <em>ETyped Element Switch Query</em>}'. + * <!-- begin-user-doc --> + * This default implementation returns null so that we can easily ignore cases; + * it's useful to ignore a case when inheritance will catch all the cases anyway. + * <!-- end-user-doc --> + * @return the new adapter. + * @see org.eclipse.modisco.facet.custom.metamodel.v0_2_0.custom.ETypedElementSwitchQuery + * @generated + */ + public Adapter createETypedElementSwitchQueryAdapter() { + return null; + } + + /** + * Creates a new adapter for an object of class '{@link org.eclipse.modisco.facet.custom.metamodel.v0_2_0.custom.ETypedElementCase <em>ETyped Element Case</em>}'. + * <!-- begin-user-doc --> + * This default implementation returns null so that we can easily ignore cases; + * it's useful to ignore a case when inheritance will catch all the cases anyway. + * <!-- end-user-doc --> + * @return the new adapter. + * @see org.eclipse.modisco.facet.custom.metamodel.v0_2_0.custom.ETypedElementCase + * @generated + */ + public Adapter createETypedElementCaseAdapter() { + return null; + } + + /** + * Creates a new adapter for an object of class '{@link org.eclipse.emf.ecore.EModelElement <em>EModel Element</em>}'. + * <!-- begin-user-doc --> + * This default implementation returns null so that we can easily ignore cases; + * it's useful to ignore a case when inheritance will catch all the cases anyway. + * <!-- end-user-doc --> + * @return the new adapter. + * @see org.eclipse.emf.ecore.EModelElement + * @generated + */ + public Adapter createEModelElementAdapter() { + return null; + } + + /** + * Creates a new adapter for an object of class '{@link org.eclipse.emf.ecore.ENamedElement <em>ENamed Element</em>}'. + * <!-- begin-user-doc --> + * This default implementation returns null so that we can easily ignore cases; + * it's useful to ignore a case when inheritance will catch all the cases anyway. + * <!-- end-user-doc --> + * @return the new adapter. + * @see org.eclipse.emf.ecore.ENamedElement + * @generated + */ + public Adapter createENamedElementAdapter() { + return null; + } + + /** + * Creates a new adapter for an object of class '{@link org.eclipse.emf.ecore.EPackage <em>EPackage</em>}'. + * <!-- begin-user-doc --> + * This default implementation returns null so that we can easily ignore cases; + * it's useful to ignore a case when inheritance will catch all the cases anyway. + * <!-- end-user-doc --> + * @return the new adapter. + * @see org.eclipse.emf.ecore.EPackage + * @generated + */ + public Adapter createEPackageAdapter() { + return null; + } + + /** + * Creates a new adapter for an object of class '{@link org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.DocumentedElement <em>Documented Element</em>}'. + * <!-- begin-user-doc --> + * This default implementation returns null so that we can easily ignore cases; + * it's useful to ignore a case when inheritance will catch all the cases anyway. + * <!-- end-user-doc --> + * @return the new adapter. + * @see org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.DocumentedElement + * @generated + */ + public Adapter createDocumentedElementAdapter() { + return null; + } + + /** + * Creates a new adapter for an object of class '{@link org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.FacetSet <em>Facet Set</em>}'. + * <!-- begin-user-doc --> + * This default implementation returns null so that we can easily ignore cases; + * it's useful to ignore a case when inheritance will catch all the cases anyway. + * <!-- end-user-doc --> + * @return the new adapter. + * @see org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.FacetSet + * @generated + */ + public Adapter createFacetSetAdapter() { + return null; + } + + /** + * Creates a new adapter for an object of class '{@link org.eclipse.emf.ecore.EClassifier <em>EClassifier</em>}'. + * <!-- begin-user-doc --> + * This default implementation returns null so that we can easily ignore cases; + * it's useful to ignore a case when inheritance will catch all the cases anyway. + * <!-- end-user-doc --> + * @return the new adapter. + * @see org.eclipse.emf.ecore.EClassifier + * @generated + */ + public Adapter createEClassifierAdapter() { + return null; + } + + /** + * Creates a new adapter for an object of class '{@link org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.Facet <em>Facet</em>}'. + * <!-- begin-user-doc --> + * This default implementation returns null so that we can easily ignore cases; + * it's useful to ignore a case when inheritance will catch all the cases anyway. + * <!-- end-user-doc --> + * @return the new adapter. + * @see org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.Facet + * @generated + */ + public Adapter createFacetAdapter() { + return null; + } + + /** + * Creates a new adapter for an object of class '{@link org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.extensible.Query <em>Query</em>}'. + * <!-- begin-user-doc --> + * This default implementation returns null so that we can easily ignore cases; + * it's useful to ignore a case when inheritance will catch all the cases anyway. + * <!-- end-user-doc --> + * @return the new adapter. + * @see org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.extensible.Query + * @generated + */ + public Adapter createQueryAdapter() { + return null; + } + + /** + * Creates a new adapter for the default case. + * <!-- begin-user-doc --> + * This default implementation returns null. + * <!-- end-user-doc --> + * @return the new adapter. + * @generated + */ + public Adapter createEObjectAdapter() { + return null; + } + +} //CustomAdapterFactory
diff --git a/org.eclipse.modisco.facet.custom.metamodel/src/org/eclipse/modisco/facet/custom/metamodel/v0_2_0/custom/util/CustomSwitch.java b/org.eclipse.modisco.facet.custom.metamodel/src/org/eclipse/modisco/facet/custom/metamodel/v0_2_0/custom/util/CustomSwitch.java new file mode 100644 index 0000000..5049e01 --- /dev/null +++ b/org.eclipse.modisco.facet.custom.metamodel/src/org/eclipse/modisco/facet/custom/metamodel/v0_2_0/custom/util/CustomSwitch.java
@@ -0,0 +1,364 @@ +/** + * Copyright (c) 2011 Mia-Software. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Gregoire Dupe (Mia-Software) - Bug 361794 - [Restructuring] New customization meta-model + * Gregoire Dupe (Mia-Software) - Bug 369987 - [Restructuring][Table] Switch to the new customization and facet framework + * Gregoire Dupe (Mia-Software) - Bug 373078 - API Cleaning + */ +package org.eclipse.modisco.facet.custom.metamodel.v0_2_0.custom.util; + +import java.util.List; + +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.EClassifier; +import org.eclipse.emf.ecore.EModelElement; +import org.eclipse.emf.ecore.ENamedElement; +import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.ecore.EPackage; +import org.eclipse.modisco.facet.custom.metamodel.v0_2_0.custom.*; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.DocumentedElement; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.Facet; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.FacetSet; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.extensible.Query; + +/** + * <!-- begin-user-doc --> + * The <b>Switch</b> for the model's inheritance hierarchy. + * It supports the call {@link #doSwitch(EObject) doSwitch(object)} + * to invoke the <code>caseXXX</code> method for each class of the model, + * starting with the actual class of the object + * and proceeding up the inheritance hierarchy + * until a non-null result is returned, + * which is the result of the switch. + * <!-- end-user-doc --> + * @see org.eclipse.modisco.facet.custom.metamodel.v0_2_0.custom.CustomPackage + * @generated + */ +public class CustomSwitch<T> { + /** + * The cached model package + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + protected static CustomPackage modelPackage; + + /** + * Creates an instance of the switch. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public CustomSwitch() { + if (modelPackage == null) { + modelPackage = CustomPackage.eINSTANCE; + } + } + + /** + * Calls <code>caseXXX</code> for each class of the model until one returns a non null result; it yields that result. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @return the first non-null result returned by a <code>caseXXX</code> call. + * @generated + */ + public T doSwitch(EObject theEObject) { + return doSwitch(theEObject.eClass(), theEObject); + } + + /** + * Calls <code>caseXXX</code> for each class of the model until one returns a non null result; it yields that result. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @return the first non-null result returned by a <code>caseXXX</code> call. + * @generated + */ + protected T doSwitch(EClass theEClass, EObject theEObject) { + if (theEClass.eContainer() == modelPackage) { + return doSwitch(theEClass.getClassifierID(), theEObject); + } + else { + List<EClass> eSuperTypes = theEClass.getESuperTypes(); + return + eSuperTypes.isEmpty() ? + defaultCase(theEObject) : + doSwitch(eSuperTypes.get(0), theEObject); + } + } + + /** + * Calls <code>caseXXX</code> for each class of the model until one returns a non null result; it yields that result. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @return the first non-null result returned by a <code>caseXXX</code> call. + * @generated + */ + protected T doSwitch(int classifierID, EObject theEObject) { + switch (classifierID) { + case CustomPackage.CUSTOMIZATION: { + Customization customization = (Customization)theEObject; + T result = caseCustomization(customization); + if (result == null) result = caseFacetSet(customization); + if (result == null) result = caseEPackage(customization); + if (result == null) result = caseDocumentedElement(customization); + if (result == null) result = caseENamedElement(customization); + if (result == null) result = caseEModelElement(customization); + if (result == null) result = defaultCase(theEObject); + return result; + } + case CustomPackage.ECLASS_CUSTOMIZATION: { + EClassCustomization eClassCustomization = (EClassCustomization)theEObject; + T result = caseEClassCustomization(eClassCustomization); + if (result == null) result = caseFacet(eClassCustomization); + if (result == null) result = caseEClassifier(eClassCustomization); + if (result == null) result = caseDocumentedElement(eClassCustomization); + if (result == null) result = caseENamedElement(eClassCustomization); + if (result == null) result = caseEModelElement(eClassCustomization); + if (result == null) result = defaultCase(theEObject); + return result; + } + case CustomPackage.FACET_CUSTOMIZATION: { + FacetCustomization facetCustomization = (FacetCustomization)theEObject; + T result = caseFacetCustomization(facetCustomization); + if (result == null) result = caseFacet(facetCustomization); + if (result == null) result = caseEClassifier(facetCustomization); + if (result == null) result = caseDocumentedElement(facetCustomization); + if (result == null) result = caseENamedElement(facetCustomization); + if (result == null) result = caseEModelElement(facetCustomization); + if (result == null) result = defaultCase(theEObject); + return result; + } + case CustomPackage.ETYPED_ELEMENT_SWITCH_QUERY: { + ETypedElementSwitchQuery eTypedElementSwitchQuery = (ETypedElementSwitchQuery)theEObject; + T result = caseETypedElementSwitchQuery(eTypedElementSwitchQuery); + if (result == null) result = caseQuery(eTypedElementSwitchQuery); + if (result == null) result = defaultCase(theEObject); + return result; + } + case CustomPackage.ETYPED_ELEMENT_CASE: { + ETypedElementCase eTypedElementCase = (ETypedElementCase)theEObject; + T result = caseETypedElementCase(eTypedElementCase); + if (result == null) result = defaultCase(theEObject); + return result; + } + default: return defaultCase(theEObject); + } + } + + /** + * Returns the result of interpreting the object as an instance of '<em>Customization</em>'. + * <!-- begin-user-doc --> + * This implementation returns null; + * returning a non-null result will terminate the switch. + * <!-- end-user-doc --> + * @param object the target of the switch. + * @return the result of interpreting the object as an instance of '<em>Customization</em>'. + * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) + * @generated + */ + public T caseCustomization(Customization object) { + return null; + } + + /** + * Returns the result of interpreting the object as an instance of '<em>EClass Customization</em>'. + * <!-- begin-user-doc --> + * This implementation returns null; + * returning a non-null result will terminate the switch. + * <!-- end-user-doc --> + * @param object the target of the switch. + * @return the result of interpreting the object as an instance of '<em>EClass Customization</em>'. + * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) + * @generated + */ + public T caseEClassCustomization(EClassCustomization object) { + return null; + } + + /** + * Returns the result of interpreting the object as an instance of '<em>Facet Customization</em>'. + * <!-- begin-user-doc --> + * This implementation returns null; + * returning a non-null result will terminate the switch. + * <!-- end-user-doc --> + * @param object the target of the switch. + * @return the result of interpreting the object as an instance of '<em>Facet Customization</em>'. + * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) + * @generated + */ + public T caseFacetCustomization(FacetCustomization object) { + return null; + } + + /** + * Returns the result of interpreting the object as an instance of '<em>ETyped Element Switch Query</em>'. + * <!-- begin-user-doc --> + * This implementation returns null; + * returning a non-null result will terminate the switch. + * <!-- end-user-doc --> + * @param object the target of the switch. + * @return the result of interpreting the object as an instance of '<em>ETyped Element Switch Query</em>'. + * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) + * @generated + */ + public T caseETypedElementSwitchQuery(ETypedElementSwitchQuery object) { + return null; + } + + /** + * Returns the result of interpreting the object as an instance of '<em>ETyped Element Case</em>'. + * <!-- begin-user-doc --> + * This implementation returns null; + * returning a non-null result will terminate the switch. + * <!-- end-user-doc --> + * @param object the target of the switch. + * @return the result of interpreting the object as an instance of '<em>ETyped Element Case</em>'. + * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) + * @generated + */ + public T caseETypedElementCase(ETypedElementCase object) { + return null; + } + + /** + * Returns the result of interpreting the object as an instance of '<em>EModel Element</em>'. + * <!-- begin-user-doc --> + * This implementation returns null; + * returning a non-null result will terminate the switch. + * <!-- end-user-doc --> + * @param object the target of the switch. + * @return the result of interpreting the object as an instance of '<em>EModel Element</em>'. + * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) + * @generated + */ + public T caseEModelElement(EModelElement object) { + return null; + } + + /** + * Returns the result of interpreting the object as an instance of '<em>ENamed Element</em>'. + * <!-- begin-user-doc --> + * This implementation returns null; + * returning a non-null result will terminate the switch. + * <!-- end-user-doc --> + * @param object the target of the switch. + * @return the result of interpreting the object as an instance of '<em>ENamed Element</em>'. + * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) + * @generated + */ + public T caseENamedElement(ENamedElement object) { + return null; + } + + /** + * Returns the result of interpreting the object as an instance of '<em>EPackage</em>'. + * <!-- begin-user-doc --> + * This implementation returns null; + * returning a non-null result will terminate the switch. + * <!-- end-user-doc --> + * @param object the target of the switch. + * @return the result of interpreting the object as an instance of '<em>EPackage</em>'. + * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) + * @generated + */ + public T caseEPackage(EPackage object) { + return null; + } + + /** + * Returns the result of interpreting the object as an instance of '<em>Documented Element</em>'. + * <!-- begin-user-doc --> + * This implementation returns null; + * returning a non-null result will terminate the switch. + * <!-- end-user-doc --> + * @param object the target of the switch. + * @return the result of interpreting the object as an instance of '<em>Documented Element</em>'. + * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) + * @generated + */ + public T caseDocumentedElement(DocumentedElement object) { + return null; + } + + /** + * Returns the result of interpreting the object as an instance of '<em>Facet Set</em>'. + * <!-- begin-user-doc --> + * This implementation returns null; + * returning a non-null result will terminate the switch. + * <!-- end-user-doc --> + * @param object the target of the switch. + * @return the result of interpreting the object as an instance of '<em>Facet Set</em>'. + * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) + * @generated + */ + public T caseFacetSet(FacetSet object) { + return null; + } + + /** + * Returns the result of interpreting the object as an instance of '<em>EClassifier</em>'. + * <!-- begin-user-doc --> + * This implementation returns null; + * returning a non-null result will terminate the switch. + * <!-- end-user-doc --> + * @param object the target of the switch. + * @return the result of interpreting the object as an instance of '<em>EClassifier</em>'. + * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) + * @generated + */ + public T caseEClassifier(EClassifier object) { + return null; + } + + /** + * Returns the result of interpreting the object as an instance of '<em>Facet</em>'. + * <!-- begin-user-doc --> + * This implementation returns null; + * returning a non-null result will terminate the switch. + * <!-- end-user-doc --> + * @param object the target of the switch. + * @return the result of interpreting the object as an instance of '<em>Facet</em>'. + * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) + * @generated + */ + public T caseFacet(Facet object) { + return null; + } + + /** + * Returns the result of interpreting the object as an instance of '<em>Query</em>'. + * <!-- begin-user-doc --> + * This implementation returns null; + * returning a non-null result will terminate the switch. + * <!-- end-user-doc --> + * @param object the target of the switch. + * @return the result of interpreting the object as an instance of '<em>Query</em>'. + * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) + * @generated + */ + public T caseQuery(Query object) { + return null; + } + + /** + * Returns the result of interpreting the object as an instance of '<em>EObject</em>'. + * <!-- begin-user-doc --> + * This implementation returns null; + * returning a non-null result will terminate the switch, but this is the last case anyway. + * <!-- end-user-doc --> + * @param object the target of the switch. + * @return the result of interpreting the object as an instance of '<em>EObject</em>'. + * @see #doSwitch(org.eclipse.emf.ecore.EObject) + * @generated + */ + public T defaultCase(EObject object) { + return null; + } + +} //CustomSwitch
diff --git a/org.eclipse.modisco.facet.custom.metamodel/src/org/eclipse/modisco/facet/custom/metamodel/v0_2_0/customizationcatalog/CustomizationCatalog.java b/org.eclipse.modisco.facet.custom.metamodel/src/org/eclipse/modisco/facet/custom/metamodel/v0_2_0/customizationcatalog/CustomizationCatalog.java new file mode 100644 index 0000000..476ad72 --- /dev/null +++ b/org.eclipse.modisco.facet.custom.metamodel/src/org/eclipse/modisco/facet/custom/metamodel/v0_2_0/customizationcatalog/CustomizationCatalog.java
@@ -0,0 +1,30 @@ +/** + * Copyright (c) 2011, 2015 Mia-Software. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Grégoire Dupé (Mia-Software) - Bug 361794 - [Restructuring] New customization meta-model + * Grégoire Dupé (Mia-Software) - Bug 373078 - API Cleaning + * Grégoire Dupé (Mia-Software) - Bug 477657 - The catalog manager should be able to manage workspace model + */ +package org.eclipse.modisco.facet.custom.metamodel.v0_2_0.customizationcatalog; + +import org.eclipse.modisco.facet.util.emf.catalog.Catalog; + +/** + * <!-- begin-user-doc --> + * A representation of the model object '<em><b>Customization Catalog</b></em>'. + * <!-- end-user-doc --> + * + * + * @see org.eclipse.modisco.facet.custom.metamodel.v0_2_0.customizationcatalog.CustomizationcatalogPackage#getCustomizationCatalog() + * @model + * @generated + */ +@Deprecated +public interface CustomizationCatalog extends Catalog { +} // CustomizationCatalog
diff --git a/org.eclipse.modisco.facet.custom.metamodel/src/org/eclipse/modisco/facet/custom/metamodel/v0_2_0/customizationcatalog/CustomizationPropertiesCatalog.java b/org.eclipse.modisco.facet.custom.metamodel/src/org/eclipse/modisco/facet/custom/metamodel/v0_2_0/customizationcatalog/CustomizationPropertiesCatalog.java new file mode 100644 index 0000000..fc37eed --- /dev/null +++ b/org.eclipse.modisco.facet.custom.metamodel/src/org/eclipse/modisco/facet/custom/metamodel/v0_2_0/customizationcatalog/CustomizationPropertiesCatalog.java
@@ -0,0 +1,30 @@ +/** + * Copyright (c) 2011, 2015 Mia-Software. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Grégoire Dupé (Mia-Software) - Bug 361794 - [Restructuring] New customization meta-model + * Grégoire Dupé (Mia-Software) - Bug 373078 - API Cleaning + * Grégoire Dupé (Mia-Software) - Bug 477657 - The catalog manager should be able to manage workspace model + */ +package org.eclipse.modisco.facet.custom.metamodel.v0_2_0.customizationcatalog; + +import org.eclipse.modisco.facet.util.emf.catalog.Catalog; + +/** + * <!-- begin-user-doc --> + * A representation of the model object '<em><b>Customization Properties Catalog</b></em>'. + * <!-- end-user-doc --> + * + * + * @see org.eclipse.modisco.facet.custom.metamodel.v0_2_0.customizationcatalog.CustomizationcatalogPackage#getCustomizationPropertiesCatalog() + * @model + * @generated + */ +@Deprecated +public interface CustomizationPropertiesCatalog extends Catalog { +} // CustomizationPropertiesCatalog
diff --git a/org.eclipse.modisco.facet.custom.metamodel/src/org/eclipse/modisco/facet/custom/metamodel/v0_2_0/customizationcatalog/CustomizationcatalogFactory.java b/org.eclipse.modisco.facet.custom.metamodel/src/org/eclipse/modisco/facet/custom/metamodel/v0_2_0/customizationcatalog/CustomizationcatalogFactory.java new file mode 100644 index 0000000..d41504a --- /dev/null +++ b/org.eclipse.modisco.facet.custom.metamodel/src/org/eclipse/modisco/facet/custom/metamodel/v0_2_0/customizationcatalog/CustomizationcatalogFactory.java
@@ -0,0 +1,64 @@ +/** + * Copyright (c) 2011, 2015 Mia-Software. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Grégoire Dupé (Mia-Software) - Bug 361794 - [Restructuring] New customization meta-model + * Grégoire Dupé (Mia-Software) - Bug 373078 - API Cleaning + * Grégoire Dupé (Mia-Software) - Bug 477657 - The catalog manager should be able to manage workspace model + */ +package org.eclipse.modisco.facet.custom.metamodel.v0_2_0.customizationcatalog; + +import org.eclipse.emf.ecore.EFactory; + +/** + * <!-- begin-user-doc --> The <b>Factory</b> for the model. It provides a + * create method for each non-abstract class of the model. <!-- end-user-doc --> + * + * @see org.eclipse.modisco.facet.custom.metamodel.v0_2_0.customizationcatalog.CustomizationcatalogPackage + * @generated + * @noextend This interface is not intended to be extended by clients. + * @noimplement This interface is not intended to be implemented by clients. + */ +@Deprecated +public interface CustomizationcatalogFactory extends EFactory { + /** + * The singleton instance of the factory. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + CustomizationcatalogFactory eINSTANCE = org.eclipse.modisco.facet.custom.metamodel.v0_2_0.customizationcatalog.impl.CustomizationcatalogFactoryImpl.init(); + + /** + * Returns a new object of class '<em>Customization Catalog</em>'. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @return a new object of class '<em>Customization Catalog</em>'. + * @generated + */ + CustomizationCatalog createCustomizationCatalog(); + + /** + * Returns a new object of class '<em>Customization Properties Catalog</em>'. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @return a new object of class '<em>Customization Properties Catalog</em>'. + * @generated + */ + CustomizationPropertiesCatalog createCustomizationPropertiesCatalog(); + + /** + * Returns the package supported by this factory. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @return the package supported by this factory. + * @generated + */ + CustomizationcatalogPackage getCustomizationcatalogPackage(); + +} //CustomizationcatalogFactory
diff --git a/org.eclipse.modisco.facet.custom.metamodel/src/org/eclipse/modisco/facet/custom/metamodel/v0_2_0/customizationcatalog/CustomizationcatalogPackage.java b/org.eclipse.modisco.facet.custom.metamodel/src/org/eclipse/modisco/facet/custom/metamodel/v0_2_0/customizationcatalog/CustomizationcatalogPackage.java new file mode 100644 index 0000000..5e58340 --- /dev/null +++ b/org.eclipse.modisco.facet.custom.metamodel/src/org/eclipse/modisco/facet/custom/metamodel/v0_2_0/customizationcatalog/CustomizationcatalogPackage.java
@@ -0,0 +1,210 @@ +/** + * Copyright (c) 2011, 2015 Mia-Software. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Grégoire Dupé (Mia-Software) - Bug 361794 - [Restructuring] New customization meta-model + * Grégoire Dupé (Mia-Software) - Bug 373078 - API Cleaning + * Grégoire Dupé (Mia-Software) - Bug 477657 - The catalog manager should be able to manage workspace model + */ +package org.eclipse.modisco.facet.custom.metamodel.v0_2_0.customizationcatalog; + +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.EPackage; +import org.eclipse.modisco.facet.util.emf.catalog.CatalogPackage; + +/** + * <!-- begin-user-doc --> The <b>Package</b> for the model. It contains + * accessors for the meta objects to represent + * <ul> + * <li>each class,</li> + * <li>each feature of each class,</li> + * <li>each enum,</li> + * <li>and each data type</li> + * </ul> + * <!-- end-user-doc --> + * + * @see org.eclipse.modisco.facet.custom.metamodel.v0_2_0.customizationcatalog.CustomizationcatalogFactory + * @model kind="package" + * @generated + * @noextend This interface is not intended to be extended by clients. + * @noimplement This interface is not intended to be implemented by clients. + */ +@Deprecated +public interface CustomizationcatalogPackage extends EPackage { + /** + * The package name. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + String eNAME = "customizationcatalog"; + + /** + * The package namespace URI. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + String eNS_URI = "http://www.eclipse.org/emf/facet/custom/0.2.internal/customizationcatalog"; + + /** + * The package namespace name. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + String eNS_PREFIX = "customizationcatalog"; + + /** + * The singleton instance of the package. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + CustomizationcatalogPackage eINSTANCE = org.eclipse.modisco.facet.custom.metamodel.v0_2_0.customizationcatalog.impl.CustomizationcatalogPackageImpl.init(); + + /** + * The meta object id for the '{@link org.eclipse.modisco.facet.custom.metamodel.v0_2_0.customizationcatalog.impl.CustomizationCatalogImpl <em>Customization Catalog</em>}' class. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @see org.eclipse.modisco.facet.custom.metamodel.v0_2_0.customizationcatalog.impl.CustomizationCatalogImpl + * @see org.eclipse.modisco.facet.custom.metamodel.v0_2_0.customizationcatalog.impl.CustomizationcatalogPackageImpl#getCustomizationCatalog() + * @generated + */ + int CUSTOMIZATION_CATALOG = 0; + + /** + * The feature id for the '<em><b>Installed Entries</b></em>' reference list. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + */ + int CUSTOMIZATION_CATALOG__INSTALLED_ENTRIES = CatalogPackage.CATALOG__INSTALLED_ENTRIES; + + /** + * The feature id for the '<em><b>Name</b></em>' attribute. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + */ + int CUSTOMIZATION_CATALOG__NAME = CatalogPackage.CATALOG__NAME; + + /** + * The number of structural features of the '<em>Customization Catalog</em>' class. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + */ + int CUSTOMIZATION_CATALOG_FEATURE_COUNT = CatalogPackage.CATALOG_FEATURE_COUNT + 0; + + /** + * The meta object id for the '{@link org.eclipse.modisco.facet.custom.metamodel.v0_2_0.customizationcatalog.impl.CustomizationPropertiesCatalogImpl <em>Customization Properties Catalog</em>}' class. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @see org.eclipse.modisco.facet.custom.metamodel.v0_2_0.customizationcatalog.impl.CustomizationPropertiesCatalogImpl + * @see org.eclipse.modisco.facet.custom.metamodel.v0_2_0.customizationcatalog.impl.CustomizationcatalogPackageImpl#getCustomizationPropertiesCatalog() + * @generated + */ + int CUSTOMIZATION_PROPERTIES_CATALOG = 1; + + /** + * The feature id for the '<em><b>Installed Entries</b></em>' reference list. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + */ + int CUSTOMIZATION_PROPERTIES_CATALOG__INSTALLED_ENTRIES = CatalogPackage.CATALOG__INSTALLED_ENTRIES; + + /** + * The feature id for the '<em><b>Name</b></em>' attribute. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + */ + int CUSTOMIZATION_PROPERTIES_CATALOG__NAME = CatalogPackage.CATALOG__NAME; + + /** + * The number of structural features of the '<em>Customization Properties Catalog</em>' class. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + */ + int CUSTOMIZATION_PROPERTIES_CATALOG_FEATURE_COUNT = CatalogPackage.CATALOG_FEATURE_COUNT + 0; + + + /** + * Returns the meta object for class '{@link org.eclipse.modisco.facet.custom.metamodel.v0_2_0.customizationcatalog.CustomizationCatalog <em>Customization Catalog</em>}'. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @return the meta object for class '<em>Customization Catalog</em>'. + * @see org.eclipse.modisco.facet.custom.metamodel.v0_2_0.customizationcatalog.CustomizationCatalog + * @generated + */ + EClass getCustomizationCatalog(); + + /** + * Returns the meta object for class '{@link org.eclipse.modisco.facet.custom.metamodel.v0_2_0.customizationcatalog.CustomizationPropertiesCatalog <em>Customization Properties Catalog</em>}'. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @return the meta object for class '<em>Customization Properties Catalog</em>'. + * @see org.eclipse.modisco.facet.custom.metamodel.v0_2_0.customizationcatalog.CustomizationPropertiesCatalog + * @generated + */ + EClass getCustomizationPropertiesCatalog(); + + /** + * Returns the factory that creates the instances of the model. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @return the factory that creates the instances of the model. + * @generated + */ + CustomizationcatalogFactory getCustomizationcatalogFactory(); + + /** + * <!-- begin-user-doc --> + * Defines literals for the meta objects that represent + * <ul> + * <li>each class,</li> + * <li>each feature of each class,</li> + * <li>each enum,</li> + * <li>and each data type</li> + * </ul> + * <!-- end-user-doc --> + * @generated + */ + interface Literals { + /** + * The meta object literal for the '{@link org.eclipse.modisco.facet.custom.metamodel.v0_2_0.customizationcatalog.impl.CustomizationCatalogImpl <em>Customization Catalog</em>}' class. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @see org.eclipse.modisco.facet.custom.metamodel.v0_2_0.customizationcatalog.impl.CustomizationCatalogImpl + * @see org.eclipse.modisco.facet.custom.metamodel.v0_2_0.customizationcatalog.impl.CustomizationcatalogPackageImpl#getCustomizationCatalog() + * @generated + */ + EClass CUSTOMIZATION_CATALOG = eINSTANCE.getCustomizationCatalog(); + + /** + * The meta object literal for the '{@link org.eclipse.modisco.facet.custom.metamodel.v0_2_0.customizationcatalog.impl.CustomizationPropertiesCatalogImpl <em>Customization Properties Catalog</em>}' class. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @see org.eclipse.modisco.facet.custom.metamodel.v0_2_0.customizationcatalog.impl.CustomizationPropertiesCatalogImpl + * @see org.eclipse.modisco.facet.custom.metamodel.v0_2_0.customizationcatalog.impl.CustomizationcatalogPackageImpl#getCustomizationPropertiesCatalog() + * @generated + */ + EClass CUSTOMIZATION_PROPERTIES_CATALOG = eINSTANCE.getCustomizationPropertiesCatalog(); + + } + +} //CustomizationcatalogPackage
diff --git a/org.eclipse.modisco.facet.custom.metamodel/src/org/eclipse/modisco/facet/custom/metamodel/v0_2_0/customizationcatalog/impl/CustomizationCatalogImpl.java b/org.eclipse.modisco.facet.custom.metamodel/src/org/eclipse/modisco/facet/custom/metamodel/v0_2_0/customizationcatalog/impl/CustomizationCatalogImpl.java new file mode 100644 index 0000000..045b926 --- /dev/null +++ b/org.eclipse.modisco.facet.custom.metamodel/src/org/eclipse/modisco/facet/custom/metamodel/v0_2_0/customizationcatalog/impl/CustomizationCatalogImpl.java
@@ -0,0 +1,216 @@ +/** + * Copyright (c) 2011, 2015 Mia-Software. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Grégoire Dupé (Mia-Software) - Bug 361794 - [Restructuring] New customization meta-model + * Grégoire Dupé (Mia-Software) - Bug 373078 - API Cleaning + * Grégoire Dupé (Mia-Software) - Bug 477657 - The catalog manager should be able to manage workspace model + */ +package org.eclipse.modisco.facet.custom.metamodel.v0_2_0.customizationcatalog.impl; + +import java.util.Collection; + +import org.eclipse.emf.common.notify.Notification; + +import org.eclipse.emf.common.util.EList; + +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.EObject; + +import org.eclipse.emf.ecore.impl.ENotificationImpl; +import org.eclipse.emf.ecore.impl.EObjectImpl; + +import org.eclipse.emf.ecore.util.EObjectResolvingEList; +import org.eclipse.modisco.facet.custom.metamodel.v0_2_0.customizationcatalog.CustomizationCatalog; +import org.eclipse.modisco.facet.custom.metamodel.v0_2_0.customizationcatalog.CustomizationcatalogPackage; + +/** + * <!-- begin-user-doc --> + * An implementation of the model object '<em><b>Customization Catalog</b></em>'. + * <!-- end-user-doc --> + * <p> + * The following features are implemented: + * <ul> + * <li>{@link org.eclipse.modisco.facet.custom.metamodel.v0_2_0.customizationcatalog.impl.CustomizationCatalogImpl#getInstalledEntries <em>Installed Entries</em>}</li> + * <li>{@link org.eclipse.modisco.facet.custom.metamodel.v0_2_0.customizationcatalog.impl.CustomizationCatalogImpl#getName <em>Name</em>}</li> + * </ul> + * </p> + * + * @generated + */ +@Deprecated +public class CustomizationCatalogImpl extends EObjectImpl implements CustomizationCatalog { + /** + * The cached value of the '{@link #getInstalledEntries() <em>Installed Entries</em>}' reference list. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @see #getInstalledEntries() + * @generated + * @ordered + */ + protected EList<EObject> installedEntries; + + /** + * The default value of the '{@link #getName() <em>Name</em>}' attribute. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @see #getName() + * @generated + * @ordered + */ + protected static final String NAME_EDEFAULT = null; + + /** + * The cached value of the '{@link #getName() <em>Name</em>}' attribute. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @see #getName() + * @generated + * @ordered + */ + protected String name = NAME_EDEFAULT; + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + protected CustomizationCatalogImpl() { + super(); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + protected EClass eStaticClass() { + return CustomizationcatalogPackage.Literals.CUSTOMIZATION_CATALOG; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public EList<EObject> getInstalledEntries() { + if (installedEntries == null) { + installedEntries = new EObjectResolvingEList<EObject>(EObject.class, this, CustomizationcatalogPackage.CUSTOMIZATION_CATALOG__INSTALLED_ENTRIES); + } + return installedEntries; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public String getName() { + return name; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public void setName(String newName) { + String oldName = name; + name = newName; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.SET, CustomizationcatalogPackage.CUSTOMIZATION_CATALOG__NAME, oldName, name)); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + public Object eGet(int featureID, boolean resolve, boolean coreType) { + switch (featureID) { + case CustomizationcatalogPackage.CUSTOMIZATION_CATALOG__INSTALLED_ENTRIES: + return getInstalledEntries(); + case CustomizationcatalogPackage.CUSTOMIZATION_CATALOG__NAME: + return getName(); + } + return super.eGet(featureID, resolve, coreType); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @SuppressWarnings("unchecked") + @Override + public void eSet(int featureID, Object newValue) { + switch (featureID) { + case CustomizationcatalogPackage.CUSTOMIZATION_CATALOG__INSTALLED_ENTRIES: + getInstalledEntries().clear(); + getInstalledEntries().addAll((Collection<? extends EObject>)newValue); + return; + case CustomizationcatalogPackage.CUSTOMIZATION_CATALOG__NAME: + setName((String)newValue); + return; + } + super.eSet(featureID, newValue); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + public void eUnset(int featureID) { + switch (featureID) { + case CustomizationcatalogPackage.CUSTOMIZATION_CATALOG__INSTALLED_ENTRIES: + getInstalledEntries().clear(); + return; + case CustomizationcatalogPackage.CUSTOMIZATION_CATALOG__NAME: + setName(NAME_EDEFAULT); + return; + } + super.eUnset(featureID); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + public boolean eIsSet(int featureID) { + switch (featureID) { + case CustomizationcatalogPackage.CUSTOMIZATION_CATALOG__INSTALLED_ENTRIES: + return installedEntries != null && !installedEntries.isEmpty(); + case CustomizationcatalogPackage.CUSTOMIZATION_CATALOG__NAME: + return NAME_EDEFAULT == null ? name != null : !NAME_EDEFAULT.equals(name); + } + return super.eIsSet(featureID); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + public String toString() { + if (eIsProxy()) return super.toString(); + + StringBuffer result = new StringBuffer(super.toString()); + result.append(" (name: "); + result.append(name); + result.append(')'); + return result.toString(); + } + +} //CustomizationCatalogImpl
diff --git a/org.eclipse.modisco.facet.custom.metamodel/src/org/eclipse/modisco/facet/custom/metamodel/v0_2_0/customizationcatalog/impl/CustomizationPropertiesCatalogImpl.java b/org.eclipse.modisco.facet.custom.metamodel/src/org/eclipse/modisco/facet/custom/metamodel/v0_2_0/customizationcatalog/impl/CustomizationPropertiesCatalogImpl.java new file mode 100644 index 0000000..c2f5445 --- /dev/null +++ b/org.eclipse.modisco.facet.custom.metamodel/src/org/eclipse/modisco/facet/custom/metamodel/v0_2_0/customizationcatalog/impl/CustomizationPropertiesCatalogImpl.java
@@ -0,0 +1,216 @@ +/** + * Copyright (c) 2011, 2015 Mia-Software. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Grégoire Dupé (Mia-Software) - Bug 361794 - [Restructuring] New customization meta-model + * Grégoire Dupé (Mia-Software) - Bug 373078 - API Cleaning + * Grégoire Dupé (Mia-Software) - Bug 477657 - The catalog manager should be able to manage workspace model + */ +package org.eclipse.modisco.facet.custom.metamodel.v0_2_0.customizationcatalog.impl; + +import java.util.Collection; + +import org.eclipse.emf.common.notify.Notification; + +import org.eclipse.emf.common.util.EList; + +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.EObject; + +import org.eclipse.emf.ecore.impl.ENotificationImpl; +import org.eclipse.emf.ecore.impl.EObjectImpl; + +import org.eclipse.emf.ecore.util.EObjectResolvingEList; +import org.eclipse.modisco.facet.custom.metamodel.v0_2_0.customizationcatalog.CustomizationPropertiesCatalog; +import org.eclipse.modisco.facet.custom.metamodel.v0_2_0.customizationcatalog.CustomizationcatalogPackage; + +/** + * <!-- begin-user-doc --> + * An implementation of the model object '<em><b>Customization Properties Catalog</b></em>'. + * <!-- end-user-doc --> + * <p> + * The following features are implemented: + * <ul> + * <li>{@link org.eclipse.modisco.facet.custom.metamodel.v0_2_0.customizationcatalog.impl.CustomizationPropertiesCatalogImpl#getInstalledEntries <em>Installed Entries</em>}</li> + * <li>{@link org.eclipse.modisco.facet.custom.metamodel.v0_2_0.customizationcatalog.impl.CustomizationPropertiesCatalogImpl#getName <em>Name</em>}</li> + * </ul> + * </p> + * + * @generated + */ +@Deprecated +public class CustomizationPropertiesCatalogImpl extends EObjectImpl implements CustomizationPropertiesCatalog { + /** + * The cached value of the '{@link #getInstalledEntries() <em>Installed Entries</em>}' reference list. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @see #getInstalledEntries() + * @generated + * @ordered + */ + protected EList<EObject> installedEntries; + + /** + * The default value of the '{@link #getName() <em>Name</em>}' attribute. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @see #getName() + * @generated + * @ordered + */ + protected static final String NAME_EDEFAULT = null; + + /** + * The cached value of the '{@link #getName() <em>Name</em>}' attribute. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @see #getName() + * @generated + * @ordered + */ + protected String name = NAME_EDEFAULT; + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + protected CustomizationPropertiesCatalogImpl() { + super(); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + protected EClass eStaticClass() { + return CustomizationcatalogPackage.Literals.CUSTOMIZATION_PROPERTIES_CATALOG; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public EList<EObject> getInstalledEntries() { + if (installedEntries == null) { + installedEntries = new EObjectResolvingEList<EObject>(EObject.class, this, CustomizationcatalogPackage.CUSTOMIZATION_PROPERTIES_CATALOG__INSTALLED_ENTRIES); + } + return installedEntries; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public String getName() { + return name; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public void setName(String newName) { + String oldName = name; + name = newName; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.SET, CustomizationcatalogPackage.CUSTOMIZATION_PROPERTIES_CATALOG__NAME, oldName, name)); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + public Object eGet(int featureID, boolean resolve, boolean coreType) { + switch (featureID) { + case CustomizationcatalogPackage.CUSTOMIZATION_PROPERTIES_CATALOG__INSTALLED_ENTRIES: + return getInstalledEntries(); + case CustomizationcatalogPackage.CUSTOMIZATION_PROPERTIES_CATALOG__NAME: + return getName(); + } + return super.eGet(featureID, resolve, coreType); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @SuppressWarnings("unchecked") + @Override + public void eSet(int featureID, Object newValue) { + switch (featureID) { + case CustomizationcatalogPackage.CUSTOMIZATION_PROPERTIES_CATALOG__INSTALLED_ENTRIES: + getInstalledEntries().clear(); + getInstalledEntries().addAll((Collection<? extends EObject>)newValue); + return; + case CustomizationcatalogPackage.CUSTOMIZATION_PROPERTIES_CATALOG__NAME: + setName((String)newValue); + return; + } + super.eSet(featureID, newValue); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + public void eUnset(int featureID) { + switch (featureID) { + case CustomizationcatalogPackage.CUSTOMIZATION_PROPERTIES_CATALOG__INSTALLED_ENTRIES: + getInstalledEntries().clear(); + return; + case CustomizationcatalogPackage.CUSTOMIZATION_PROPERTIES_CATALOG__NAME: + setName(NAME_EDEFAULT); + return; + } + super.eUnset(featureID); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + public boolean eIsSet(int featureID) { + switch (featureID) { + case CustomizationcatalogPackage.CUSTOMIZATION_PROPERTIES_CATALOG__INSTALLED_ENTRIES: + return installedEntries != null && !installedEntries.isEmpty(); + case CustomizationcatalogPackage.CUSTOMIZATION_PROPERTIES_CATALOG__NAME: + return NAME_EDEFAULT == null ? name != null : !NAME_EDEFAULT.equals(name); + } + return super.eIsSet(featureID); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + public String toString() { + if (eIsProxy()) return super.toString(); + + StringBuffer result = new StringBuffer(super.toString()); + result.append(" (name: "); + result.append(name); + result.append(')'); + return result.toString(); + } + +} //CustomizationPropertiesCatalogImpl
diff --git a/org.eclipse.modisco.facet.custom.metamodel/src/org/eclipse/modisco/facet/custom/metamodel/v0_2_0/customizationcatalog/impl/CustomizationcatalogFactoryImpl.java b/org.eclipse.modisco.facet.custom.metamodel/src/org/eclipse/modisco/facet/custom/metamodel/v0_2_0/customizationcatalog/impl/CustomizationcatalogFactoryImpl.java new file mode 100644 index 0000000..d2bc46d --- /dev/null +++ b/org.eclipse.modisco.facet.custom.metamodel/src/org/eclipse/modisco/facet/custom/metamodel/v0_2_0/customizationcatalog/impl/CustomizationcatalogFactoryImpl.java
@@ -0,0 +1,117 @@ +/** + * Copyright (c) 2011, 2015 Mia-Software. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Grégoire Dupé (Mia-Software) - Bug 361794 - [Restructuring] New customization meta-model + * Grégoire Dupé (Mia-Software) - Bug 373078 - API Cleaning + * Grégoire Dupé (Mia-Software) - Bug 477657 - The catalog manager should be able to manage workspace model + */ +package org.eclipse.modisco.facet.custom.metamodel.v0_2_0.customizationcatalog.impl; + +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.ecore.EPackage; + +import org.eclipse.emf.ecore.impl.EFactoryImpl; + +import org.eclipse.emf.ecore.plugin.EcorePlugin; +import org.eclipse.modisco.facet.custom.metamodel.v0_2_0.customizationcatalog.*; + +/** + * <!-- begin-user-doc --> + * An implementation of the model <b>Factory</b>. + * <!-- end-user-doc --> + * @generated + */ +@Deprecated +public class CustomizationcatalogFactoryImpl extends EFactoryImpl implements CustomizationcatalogFactory { + /** + * Creates the default factory implementation. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public static CustomizationcatalogFactory init() { + try { + CustomizationcatalogFactory theCustomizationcatalogFactory = (CustomizationcatalogFactory)EPackage.Registry.INSTANCE.getEFactory("http://www.eclipse.org/emf/facet/custom/0.2.internal/customizationcatalog"); + if (theCustomizationcatalogFactory != null) { + return theCustomizationcatalogFactory; + } + } + catch (Exception exception) { + EcorePlugin.INSTANCE.log(exception); + } + return new CustomizationcatalogFactoryImpl(); + } + + /** + * Creates an instance of the factory. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public CustomizationcatalogFactoryImpl() { + super(); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + public EObject create(EClass eClass) { + switch (eClass.getClassifierID()) { + case CustomizationcatalogPackage.CUSTOMIZATION_CATALOG: return createCustomizationCatalog(); + case CustomizationcatalogPackage.CUSTOMIZATION_PROPERTIES_CATALOG: return createCustomizationPropertiesCatalog(); + default: + throw new IllegalArgumentException("The class '" + eClass.getName() + "' is not a valid classifier"); + } + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public CustomizationCatalog createCustomizationCatalog() { + CustomizationCatalogImpl customizationCatalog = new CustomizationCatalogImpl(); + return customizationCatalog; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public CustomizationPropertiesCatalog createCustomizationPropertiesCatalog() { + CustomizationPropertiesCatalogImpl customizationPropertiesCatalog = new CustomizationPropertiesCatalogImpl(); + return customizationPropertiesCatalog; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public CustomizationcatalogPackage getCustomizationcatalogPackage() { + return (CustomizationcatalogPackage)getEPackage(); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @deprecated + * @generated + */ + @Deprecated + public static CustomizationcatalogPackage getPackage() { + return CustomizationcatalogPackage.eINSTANCE; + } + +} //CustomizationcatalogFactoryImpl
diff --git a/org.eclipse.modisco.facet.custom.metamodel/src/org/eclipse/modisco/facet/custom/metamodel/v0_2_0/customizationcatalog/impl/CustomizationcatalogPackageImpl.java b/org.eclipse.modisco.facet.custom.metamodel/src/org/eclipse/modisco/facet/custom/metamodel/v0_2_0/customizationcatalog/impl/CustomizationcatalogPackageImpl.java new file mode 100644 index 0000000..81dc3d9 --- /dev/null +++ b/org.eclipse.modisco.facet.custom.metamodel/src/org/eclipse/modisco/facet/custom/metamodel/v0_2_0/customizationcatalog/impl/CustomizationcatalogPackageImpl.java
@@ -0,0 +1,206 @@ +/** + * Copyright (c) 2011, 2015 Mia-Software. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Grégoire Dupé (Mia-Software) - Bug 361794 - [Restructuring] New customization meta-model + * Grégoire Dupé (Mia-Software) - Bug 373078 - API Cleaning + * Grégoire Dupé (Mia-Software) - Bug 477657 - The catalog manager should be able to manage workspace model + */ +package org.eclipse.modisco.facet.custom.metamodel.v0_2_0.customizationcatalog.impl; + +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.EPackage; + +import org.eclipse.emf.ecore.impl.EPackageImpl; +import org.eclipse.modisco.facet.custom.metamodel.v0_2_0.customizationcatalog.CustomizationCatalog; +import org.eclipse.modisco.facet.custom.metamodel.v0_2_0.customizationcatalog.CustomizationPropertiesCatalog; +import org.eclipse.modisco.facet.custom.metamodel.v0_2_0.customizationcatalog.CustomizationcatalogFactory; +import org.eclipse.modisco.facet.custom.metamodel.v0_2_0.customizationcatalog.CustomizationcatalogPackage; +import org.eclipse.modisco.facet.util.emf.catalog.CatalogPackage; + +/** + * <!-- begin-user-doc --> + * An implementation of the model <b>Package</b>. + * <!-- end-user-doc --> + * @generated + */ +@Deprecated +public class CustomizationcatalogPackageImpl extends EPackageImpl implements CustomizationcatalogPackage { + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + private EClass customizationCatalogEClass = null; + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + private EClass customizationPropertiesCatalogEClass = null; + + /** + * Creates an instance of the model <b>Package</b>, registered with + * {@link org.eclipse.emf.ecore.EPackage.Registry EPackage.Registry} by the package + * package URI value. + * <p>Note: the correct way to create the package is via the static + * factory method {@link #init init()}, which also performs + * initialization of the package, or returns the registered package, + * if one already exists. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @see org.eclipse.emf.ecore.EPackage.Registry + * @see org.eclipse.modisco.facet.custom.metamodel.v0_2_0.customizationcatalog.CustomizationcatalogPackage#eNS_URI + * @see #init() + * @generated + */ + private CustomizationcatalogPackageImpl() { + super(eNS_URI, CustomizationcatalogFactory.eINSTANCE); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + private static boolean isInited = false; + + /** + * Creates, registers, and initializes the <b>Package</b> for this model, and for any others upon which it depends. + * + * <p>This method is used to initialize {@link CustomizationcatalogPackage#eINSTANCE} when that field is accessed. + * Clients should not invoke it directly. Instead, they should simply access that field to obtain the package. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @see #eNS_URI + * @see #createPackageContents() + * @see #initializePackageContents() + * @generated + */ + public static CustomizationcatalogPackage init() { + if (isInited) return (CustomizationcatalogPackage)EPackage.Registry.INSTANCE.getEPackage(CustomizationcatalogPackage.eNS_URI); + + // Obtain or create and register package + CustomizationcatalogPackageImpl theCustomizationcatalogPackage = (CustomizationcatalogPackageImpl)(EPackage.Registry.INSTANCE.get(eNS_URI) instanceof CustomizationcatalogPackageImpl ? EPackage.Registry.INSTANCE.get(eNS_URI) : new CustomizationcatalogPackageImpl()); + + isInited = true; + + // Initialize simple dependencies + CatalogPackage.eINSTANCE.eClass(); + + // Create package meta-data objects + theCustomizationcatalogPackage.createPackageContents(); + + // Initialize created meta-data + theCustomizationcatalogPackage.initializePackageContents(); + + // Mark meta-data to indicate it can't be changed + theCustomizationcatalogPackage.freeze(); + + + // Update the registry and return the package + EPackage.Registry.INSTANCE.put(CustomizationcatalogPackage.eNS_URI, theCustomizationcatalogPackage); + return theCustomizationcatalogPackage; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public EClass getCustomizationCatalog() { + return customizationCatalogEClass; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public EClass getCustomizationPropertiesCatalog() { + return customizationPropertiesCatalogEClass; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public CustomizationcatalogFactory getCustomizationcatalogFactory() { + return (CustomizationcatalogFactory)getEFactoryInstance(); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + private boolean isCreated = false; + + /** + * Creates the meta-model objects for the package. This method is + * guarded to have no affect on any invocation but its first. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public void createPackageContents() { + if (isCreated) return; + isCreated = true; + + // Create classes and their features + customizationCatalogEClass = createEClass(CUSTOMIZATION_CATALOG); + + customizationPropertiesCatalogEClass = createEClass(CUSTOMIZATION_PROPERTIES_CATALOG); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + private boolean isInitialized = false; + + /** + * Complete the initialization of the package and its meta-model. This + * method is guarded to have no affect on any invocation but its first. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public void initializePackageContents() { + if (isInitialized) return; + isInitialized = true; + + // Initialize package + setName(eNAME); + setNsPrefix(eNS_PREFIX); + setNsURI(eNS_URI); + + // Obtain other dependent packages + CatalogPackage theCatalogPackage = (CatalogPackage)EPackage.Registry.INSTANCE.getEPackage(CatalogPackage.eNS_URI); + + // Create type parameters + + // Set bounds for type parameters + + // Add supertypes to classes + customizationCatalogEClass.getESuperTypes().add(theCatalogPackage.getCatalog()); + customizationPropertiesCatalogEClass.getESuperTypes().add(theCatalogPackage.getCatalog()); + + // Initialize classes and features; add operations and parameters + initEClass(customizationCatalogEClass, CustomizationCatalog.class, "CustomizationCatalog", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); + + initEClass(customizationPropertiesCatalogEClass, CustomizationPropertiesCatalog.class, "CustomizationPropertiesCatalog", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); + + // Create resource + createResource(eNS_URI); + } + +} //CustomizationcatalogPackageImpl
diff --git a/org.eclipse.modisco.facet.custom.metamodel/src/org/eclipse/modisco/facet/custom/metamodel/v0_2_0/customizationcatalog/util/CustomizationcatalogAdapterFactory.java b/org.eclipse.modisco.facet.custom.metamodel/src/org/eclipse/modisco/facet/custom/metamodel/v0_2_0/customizationcatalog/util/CustomizationcatalogAdapterFactory.java new file mode 100644 index 0000000..b6db37c --- /dev/null +++ b/org.eclipse.modisco.facet.custom.metamodel/src/org/eclipse/modisco/facet/custom/metamodel/v0_2_0/customizationcatalog/util/CustomizationcatalogAdapterFactory.java
@@ -0,0 +1,168 @@ +/** + * Copyright (c) 2011, 2015 Mia-Software. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Grégoire Dupé (Mia-Software) - Bug 361794 - [Restructuring] New customization meta-model + * Grégoire Dupé (Mia-Software) - Bug 373078 - API Cleaning + * Grégoire Dupé (Mia-Software) - Bug 477657 - The catalog manager should be able to manage workspace model + */ +package org.eclipse.modisco.facet.custom.metamodel.v0_2_0.customizationcatalog.util; + +import org.eclipse.emf.common.notify.Adapter; +import org.eclipse.emf.common.notify.Notifier; + +import org.eclipse.emf.common.notify.impl.AdapterFactoryImpl; + +import org.eclipse.emf.ecore.EObject; +import org.eclipse.modisco.facet.custom.metamodel.v0_2_0.customizationcatalog.*; +import org.eclipse.modisco.facet.util.emf.catalog.Catalog; + +/** + * <!-- begin-user-doc --> + * The <b>Adapter Factory</b> for the model. + * It provides an adapter <code>createXXX</code> method for each class of the model. + * <!-- end-user-doc --> + * @see org.eclipse.modisco.facet.custom.metamodel.v0_2_0.customizationcatalog.CustomizationcatalogPackage + * @generated + */ +@Deprecated +public class CustomizationcatalogAdapterFactory extends AdapterFactoryImpl { + /** + * The cached model package. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + protected static CustomizationcatalogPackage modelPackage; + + /** + * Creates an instance of the adapter factory. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public CustomizationcatalogAdapterFactory() { + if (modelPackage == null) { + modelPackage = CustomizationcatalogPackage.eINSTANCE; + } + } + + /** + * Returns whether this factory is applicable for the type of the object. + * <!-- begin-user-doc --> + * This implementation returns <code>true</code> if the object is either the model's package or is an instance object of the model. + * <!-- end-user-doc --> + * @return whether this factory is applicable for the type of the object. + * @generated + */ + @Override + public boolean isFactoryForType(Object object) { + if (object == modelPackage) { + return true; + } + if (object instanceof EObject) { + return ((EObject)object).eClass().getEPackage() == modelPackage; + } + return false; + } + + /** + * The switch that delegates to the <code>createXXX</code> methods. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + protected CustomizationcatalogSwitch<Adapter> modelSwitch = + new CustomizationcatalogSwitch<Adapter>() { + @Override + public Adapter caseCustomizationCatalog(CustomizationCatalog object) { + return createCustomizationCatalogAdapter(); + } + @Override + public Adapter caseCustomizationPropertiesCatalog(CustomizationPropertiesCatalog object) { + return createCustomizationPropertiesCatalogAdapter(); + } + @Override + public Adapter caseCatalog(Catalog object) { + return createCatalogAdapter(); + } + @Override + public Adapter defaultCase(EObject object) { + return createEObjectAdapter(); + } + }; + + /** + * Creates an adapter for the <code>target</code>. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @param target the object to adapt. + * @return the adapter for the <code>target</code>. + * @generated + */ + @Override + public Adapter createAdapter(Notifier target) { + return modelSwitch.doSwitch((EObject)target); + } + + + /** + * Creates a new adapter for an object of class '{@link org.eclipse.modisco.facet.custom.metamodel.v0_2_0.customizationcatalog.CustomizationCatalog <em>Customization Catalog</em>}'. + * <!-- begin-user-doc --> + * This default implementation returns null so that we can easily ignore cases; + * it's useful to ignore a case when inheritance will catch all the cases anyway. + * <!-- end-user-doc --> + * @return the new adapter. + * @see org.eclipse.modisco.facet.custom.metamodel.v0_2_0.customizationcatalog.CustomizationCatalog + * @generated + */ + public Adapter createCustomizationCatalogAdapter() { + return null; + } + + /** + * Creates a new adapter for an object of class '{@link org.eclipse.modisco.facet.custom.metamodel.v0_2_0.customizationcatalog.CustomizationPropertiesCatalog <em>Customization Properties Catalog</em>}'. + * <!-- begin-user-doc --> + * This default implementation returns null so that we can easily ignore cases; + * it's useful to ignore a case when inheritance will catch all the cases anyway. + * <!-- end-user-doc --> + * @return the new adapter. + * @see org.eclipse.modisco.facet.custom.metamodel.v0_2_0.customizationcatalog.CustomizationPropertiesCatalog + * @generated + */ + public Adapter createCustomizationPropertiesCatalogAdapter() { + return null; + } + + /** + * Creates a new adapter for an object of class '{@link org.eclipse.modisco.facet.util.emf.catalog.Catalog <em>Catalog</em>}'. + * <!-- begin-user-doc --> + * This default implementation returns null so that we can easily ignore cases; + * it's useful to ignore a case when inheritance will catch all the cases anyway. + * <!-- end-user-doc --> + * @return the new adapter. + * @see org.eclipse.modisco.facet.util.emf.catalog.Catalog + * @generated + */ + public Adapter createCatalogAdapter() { + return null; + } + + /** + * Creates a new adapter for the default case. + * <!-- begin-user-doc --> + * This default implementation returns null. + * <!-- end-user-doc --> + * @return the new adapter. + * @generated + */ + public Adapter createEObjectAdapter() { + return null; + } + +} //CustomizationcatalogAdapterFactory
diff --git a/org.eclipse.modisco.facet.custom.metamodel/src/org/eclipse/modisco/facet/custom/metamodel/v0_2_0/customizationcatalog/util/CustomizationcatalogSwitch.java b/org.eclipse.modisco.facet.custom.metamodel/src/org/eclipse/modisco/facet/custom/metamodel/v0_2_0/customizationcatalog/util/CustomizationcatalogSwitch.java new file mode 100644 index 0000000..769e5ca --- /dev/null +++ b/org.eclipse.modisco.facet.custom.metamodel/src/org/eclipse/modisco/facet/custom/metamodel/v0_2_0/customizationcatalog/util/CustomizationcatalogSwitch.java
@@ -0,0 +1,176 @@ +/** + * Copyright (c) 2011, 2015 Mia-Software. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Grégoire Dupé (Mia-Software) - Bug 361794 - [Restructuring] New customization meta-model + * Grégoire Dupé (Mia-Software) - Bug 373078 - API Cleaning + * Grégoire Dupé (Mia-Software) - Bug 477657 - The catalog manager should be able to manage workspace model + */ +package org.eclipse.modisco.facet.custom.metamodel.v0_2_0.customizationcatalog.util; + +import java.util.List; + +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.EObject; +import org.eclipse.modisco.facet.custom.metamodel.v0_2_0.customizationcatalog.*; +import org.eclipse.modisco.facet.util.emf.catalog.Catalog; + +/** + * <!-- begin-user-doc --> + * The <b>Switch</b> for the model's inheritance hierarchy. + * It supports the call {@link #doSwitch(EObject) doSwitch(object)} + * to invoke the <code>caseXXX</code> method for each class of the model, + * starting with the actual class of the object + * and proceeding up the inheritance hierarchy + * until a non-null result is returned, + * which is the result of the switch. + * <!-- end-user-doc --> + * @see org.eclipse.modisco.facet.custom.metamodel.v0_2_0.customizationcatalog.CustomizationcatalogPackage + * @generated + */ +@Deprecated +public class CustomizationcatalogSwitch<T> { + /** + * The cached model package + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + protected static CustomizationcatalogPackage modelPackage; + + /** + * Creates an instance of the switch. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public CustomizationcatalogSwitch() { + if (modelPackage == null) { + modelPackage = CustomizationcatalogPackage.eINSTANCE; + } + } + + /** + * Calls <code>caseXXX</code> for each class of the model until one returns a non null result; it yields that result. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @return the first non-null result returned by a <code>caseXXX</code> call. + * @generated + */ + public T doSwitch(EObject theEObject) { + return doSwitch(theEObject.eClass(), theEObject); + } + + /** + * Calls <code>caseXXX</code> for each class of the model until one returns a non null result; it yields that result. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @return the first non-null result returned by a <code>caseXXX</code> call. + * @generated + */ + protected T doSwitch(EClass theEClass, EObject theEObject) { + if (theEClass.eContainer() == modelPackage) { + return doSwitch(theEClass.getClassifierID(), theEObject); + } + else { + List<EClass> eSuperTypes = theEClass.getESuperTypes(); + return + eSuperTypes.isEmpty() ? + defaultCase(theEObject) : + doSwitch(eSuperTypes.get(0), theEObject); + } + } + + /** + * Calls <code>caseXXX</code> for each class of the model until one returns a non null result; it yields that result. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @return the first non-null result returned by a <code>caseXXX</code> call. + * @generated + */ + protected T doSwitch(int classifierID, EObject theEObject) { + switch (classifierID) { + case CustomizationcatalogPackage.CUSTOMIZATION_CATALOG: { + CustomizationCatalog customizationCatalog = (CustomizationCatalog)theEObject; + T result = caseCustomizationCatalog(customizationCatalog); + if (result == null) result = caseCatalog(customizationCatalog); + if (result == null) result = defaultCase(theEObject); + return result; + } + case CustomizationcatalogPackage.CUSTOMIZATION_PROPERTIES_CATALOG: { + CustomizationPropertiesCatalog customizationPropertiesCatalog = (CustomizationPropertiesCatalog)theEObject; + T result = caseCustomizationPropertiesCatalog(customizationPropertiesCatalog); + if (result == null) result = caseCatalog(customizationPropertiesCatalog); + if (result == null) result = defaultCase(theEObject); + return result; + } + default: return defaultCase(theEObject); + } + } + + /** + * Returns the result of interpreting the object as an instance of '<em>Customization Catalog</em>'. + * <!-- begin-user-doc --> + * This implementation returns null; + * returning a non-null result will terminate the switch. + * <!-- end-user-doc --> + * @param object the target of the switch. + * @return the result of interpreting the object as an instance of '<em>Customization Catalog</em>'. + * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) + * @generated + */ + public T caseCustomizationCatalog(CustomizationCatalog object) { + return null; + } + + /** + * Returns the result of interpreting the object as an instance of '<em>Customization Properties Catalog</em>'. + * <!-- begin-user-doc --> + * This implementation returns null; + * returning a non-null result will terminate the switch. + * <!-- end-user-doc --> + * @param object the target of the switch. + * @return the result of interpreting the object as an instance of '<em>Customization Properties Catalog</em>'. + * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) + * @generated + */ + public T caseCustomizationPropertiesCatalog(CustomizationPropertiesCatalog object) { + return null; + } + + /** + * Returns the result of interpreting the object as an instance of '<em>Catalog</em>'. + * <!-- begin-user-doc --> + * This implementation returns null; + * returning a non-null result will terminate the switch. + * <!-- end-user-doc --> + * @param object the target of the switch. + * @return the result of interpreting the object as an instance of '<em>Catalog</em>'. + * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) + * @generated + */ + public T caseCatalog(Catalog object) { + return null; + } + + /** + * Returns the result of interpreting the object as an instance of '<em>EObject</em>'. + * <!-- begin-user-doc --> + * This implementation returns null; + * returning a non-null result will terminate the switch, but this is the last case anyway. + * <!-- end-user-doc --> + * @param object the target of the switch. + * @return the result of interpreting the object as an instance of '<em>EObject</em>'. + * @see #doSwitch(org.eclipse.emf.ecore.EObject) + * @generated + */ + public T defaultCase(EObject object) { + return null; + } + +} //CustomizationcatalogSwitch
diff --git a/org.eclipse.modisco.facet.custom.metamodel/src/org/eclipse/modisco/facet/custom/metamodel/v0_2_0/custompt/Alignment.java b/org.eclipse.modisco.facet.custom.metamodel/src/org/eclipse/modisco/facet/custom/metamodel/v0_2_0/custompt/Alignment.java new file mode 100644 index 0000000..044ce38 --- /dev/null +++ b/org.eclipse.modisco.facet.custom.metamodel/src/org/eclipse/modisco/facet/custom/metamodel/v0_2_0/custompt/Alignment.java
@@ -0,0 +1,246 @@ +/** + * Copyright (c) 2012 Mia-Software. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Gregoire Dupe (Mia-Software) - Bug 361794 - [Restructuring] New customization meta-model + * Vincent Lorenzo (CEA-LIST) - Bug 372644 - Create Customizable tooltips for the TreeViewer using a CustomizableLabelProvider + * + */ +package org.eclipse.modisco.facet.custom.metamodel.v0_2_0.custompt; + +import java.util.Arrays; +import java.util.Collections; +import java.util.List; + +import org.eclipse.emf.common.util.Enumerator; + +/** + * <!-- begin-user-doc --> + * A representation of the literals of the enumeration '<em><b>Alignment</b></em>', + * and utility methods for working with them. + * <!-- end-user-doc --> + * @see org.eclipse.modisco.facet.custom.metamodel.v0_2_0.custompt.CustomptPackage#getAlignment() + * @model + * @generated + */ +public enum Alignment implements Enumerator { + /** + * The '<em><b>LEFT</b></em>' literal object. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @see #LEFT_VALUE + * @generated + * @ordered + */ + LEFT(0, "LEFT", "LEFT"), + + /** + * The '<em><b>CENTER</b></em>' literal object. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @see #CENTER_VALUE + * @generated + * @ordered + */ + CENTER(1, "CENTER", "CENTER"), + + /** + * The '<em><b>RIGHT</b></em>' literal object. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @see #RIGHT_VALUE + * @generated + * @ordered + */ + RIGHT(2, "RIGHT", "RIGHT"); + + /** + * The '<em><b>LEFT</b></em>' literal value. + * <!-- begin-user-doc --> + * <p> + * If the meaning of '<em><b>LEFT</b></em>' literal object isn't clear, + * there really should be more of a description here... + * </p> + * <!-- end-user-doc --> + * @see #LEFT + * @model + * @generated + * @ordered + */ + public static final int LEFT_VALUE = 0; + + /** + * The '<em><b>CENTER</b></em>' literal value. + * <!-- begin-user-doc --> + * <p> + * If the meaning of '<em><b>CENTER</b></em>' literal object isn't clear, + * there really should be more of a description here... + * </p> + * <!-- end-user-doc --> + * @see #CENTER + * @model + * @generated + * @ordered + */ + public static final int CENTER_VALUE = 1; + + /** + * The '<em><b>RIGHT</b></em>' literal value. + * <!-- begin-user-doc --> + * <p> + * If the meaning of '<em><b>RIGHT</b></em>' literal object isn't clear, + * there really should be more of a description here... + * </p> + * <!-- end-user-doc --> + * @see #RIGHT + * @model + * @generated + * @ordered + */ + public static final int RIGHT_VALUE = 2; + + /** + * An array of all the '<em><b>Alignment</b></em>' enumerators. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + private static final Alignment[] VALUES_ARRAY = + new Alignment[] { + LEFT, + CENTER, + RIGHT, + }; + + /** + * A public read-only list of all the '<em><b>Alignment</b></em>' enumerators. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public static final List<Alignment> VALUES = Collections.unmodifiableList(Arrays.asList(VALUES_ARRAY)); + + /** + * Returns the '<em><b>Alignment</b></em>' literal with the specified literal value. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public static Alignment get(String literal) { + for (int i = 0; i < VALUES_ARRAY.length; ++i) { + Alignment result = VALUES_ARRAY[i]; + if (result.toString().equals(literal)) { + return result; + } + } + return null; + } + + /** + * Returns the '<em><b>Alignment</b></em>' literal with the specified name. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public static Alignment getByName(String name) { + for (int i = 0; i < VALUES_ARRAY.length; ++i) { + Alignment result = VALUES_ARRAY[i]; + if (result.getName().equals(name)) { + return result; + } + } + return null; + } + + /** + * Returns the '<em><b>Alignment</b></em>' literal with the specified integer value. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public static Alignment get(int value) { + switch (value) { + case LEFT_VALUE: return LEFT; + case CENTER_VALUE: return CENTER; + case RIGHT_VALUE: return RIGHT; + } + return null; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + private final int value; + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + private final String name; + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + private final String literal; + + /** + * Only this class can construct instances. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + private Alignment(int value, String name, String literal) { + this.value = value; + this.name = name; + this.literal = literal; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public int getValue() { + return value; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public String getName() { + return name; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public String getLiteral() { + return literal; + } + + /** + * Returns the literal value of the enumerator, which is its string representation. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + public String toString() { + return literal; + } + +} //Alignment
diff --git a/org.eclipse.modisco.facet.custom.metamodel/src/org/eclipse/modisco/facet/custom/metamodel/v0_2_0/custompt/CustomptFactory.java b/org.eclipse.modisco.facet.custom.metamodel/src/org/eclipse/modisco/facet/custom/metamodel/v0_2_0/custompt/CustomptFactory.java new file mode 100644 index 0000000..5342b1c --- /dev/null +++ b/org.eclipse.modisco.facet.custom.metamodel/src/org/eclipse/modisco/facet/custom/metamodel/v0_2_0/custompt/CustomptFactory.java
@@ -0,0 +1,45 @@ +/** + * Copyright (c) 2012 Mia-Software. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Gregoire Dupe (Mia-Software) - Bug 361794 - [Restructuring] New customization meta-model + * + * + */ +package org.eclipse.modisco.facet.custom.metamodel.v0_2_0.custompt; + +import org.eclipse.emf.ecore.EFactory; + +/** + * <!-- begin-user-doc --> The <b>Factory</b> for the model. It provides a + * create method for each non-abstract class of the model. <!-- end-user-doc --> + * + * @see org.eclipse.modisco.facet.custom.metamodel.v0_2_0.custompt.CustomptPackage + * @generated + * @noextend This interface is not intended to be extended by clients. + * @noimplement This interface is not intended to be implemented by clients. + */ +public interface CustomptFactory extends EFactory { + /** + * The singleton instance of the factory. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + CustomptFactory eINSTANCE = org.eclipse.modisco.facet.custom.metamodel.v0_2_0.custompt.impl.CustomptFactoryImpl.init(); + + /** + * Returns the package supported by this factory. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @return the package supported by this factory. + * @generated + */ + CustomptPackage getCustomptPackage(); + +} //CustomptFactory
diff --git a/org.eclipse.modisco.facet.custom.metamodel/src/org/eclipse/modisco/facet/custom/metamodel/v0_2_0/custompt/CustomptPackage.java b/org.eclipse.modisco.facet.custom.metamodel/src/org/eclipse/modisco/facet/custom/metamodel/v0_2_0/custompt/CustomptPackage.java new file mode 100644 index 0000000..f1fe6b3 --- /dev/null +++ b/org.eclipse.modisco.facet.custom.metamodel/src/org/eclipse/modisco/facet/custom/metamodel/v0_2_0/custompt/CustomptPackage.java
@@ -0,0 +1,214 @@ +/** + * Copyright (c) 2012 Mia-Software. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Gregoire Dupe (Mia-Software) - Bug 361794 - [Restructuring] New customization meta-model + * + * + */ +package org.eclipse.modisco.facet.custom.metamodel.v0_2_0.custompt; + +import org.eclipse.emf.ecore.EDataType; +import org.eclipse.emf.ecore.EEnum; +import org.eclipse.emf.ecore.EPackage; + +/** + * <!-- begin-user-doc --> + * The <b>Package</b> for the model. + * It contains accessors for the meta objects to represent + * <ul> + * <li>each class,</li> + * <li>each feature of each class,</li> + * <li>each enum,</li> + * <li>and each data type</li> + * </ul> + * <!-- end-user-doc --> + * @see org.eclipse.modisco.facet.custom.metamodel.v0_2_0.custompt.CustomptFactory + * @model kind="package" + * @generated + */ +public interface CustomptPackage extends EPackage { + /** + * The package name. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + String eNAME = "custompt"; + + /** + * The package namespace URI. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + String eNS_URI = "http://www.eclipse.org/emf/facet/custom/0.2.incubation/custom_primitive_types"; + + /** + * The package namespace name. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + String eNS_PREFIX = "custompt"; + + /** + * The singleton instance of the package. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + CustomptPackage eINSTANCE = org.eclipse.modisco.facet.custom.metamodel.v0_2_0.custompt.impl.CustomptPackageImpl.init(); + + /** + * The meta object id for the '{@link org.eclipse.modisco.facet.custom.metamodel.v0_2_0.custompt.Shadow <em>Shadow</em>}' enum. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @see org.eclipse.modisco.facet.custom.metamodel.v0_2_0.custompt.Shadow + * @see org.eclipse.modisco.facet.custom.metamodel.v0_2_0.custompt.impl.CustomptPackageImpl#getShadow() + * @generated + */ + int SHADOW = 0; + + /** + * The meta object id for the '{@link org.eclipse.modisco.facet.custom.metamodel.v0_2_0.custompt.Alignment <em>Alignment</em>}' enum. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @see org.eclipse.modisco.facet.custom.metamodel.v0_2_0.custompt.Alignment + * @see org.eclipse.modisco.facet.custom.metamodel.v0_2_0.custompt.impl.CustomptPackageImpl#getAlignment() + * @generated + */ + int ALIGNMENT = 1; + + /** + * The meta object id for the '<em>Image</em>' data type. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @see org.eclipse.modisco.facet.custom.metamodel.custompt.IImage + * @see org.eclipse.modisco.facet.custom.metamodel.v0_2_0.custompt.impl.CustomptPackageImpl#getImage() + * @generated + */ + int IMAGE = 2; + + /** + * The meta object id for the '<em>Color</em>' data type. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @see org.eclipse.modisco.facet.custom.metamodel.custompt.IColor + * @see org.eclipse.modisco.facet.custom.metamodel.v0_2_0.custompt.impl.CustomptPackageImpl#getColor() + * @generated + */ + int COLOR = 3; + + /** + * Returns the meta object for enum '{@link org.eclipse.modisco.facet.custom.metamodel.v0_2_0.custompt.Shadow <em>Shadow</em>}'. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @return the meta object for enum '<em>Shadow</em>'. + * @see org.eclipse.modisco.facet.custom.metamodel.v0_2_0.custompt.Shadow + * @generated + */ + EEnum getShadow(); + + /** + * Returns the meta object for enum '{@link org.eclipse.modisco.facet.custom.metamodel.v0_2_0.custompt.Alignment <em>Alignment</em>}'. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @return the meta object for enum '<em>Alignment</em>'. + * @see org.eclipse.modisco.facet.custom.metamodel.v0_2_0.custompt.Alignment + * @generated + */ + EEnum getAlignment(); + + /** + * Returns the meta object for data type '{@link org.eclipse.modisco.facet.custom.metamodel.custompt.IImage <em>Image</em>}'. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @return the meta object for data type '<em>Image</em>'. + * @see org.eclipse.modisco.facet.custom.metamodel.custompt.IImage + * @model instanceClass="org.eclipse.emf.facet.custom.metamodel.custompt.IImage" + * @generated + */ + EDataType getImage(); + + /** + * Returns the meta object for data type '{@link org.eclipse.modisco.facet.custom.metamodel.custompt.IColor <em>Color</em>}'. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @return the meta object for data type '<em>Color</em>'. + * @see org.eclipse.modisco.facet.custom.metamodel.custompt.IColor + * @model instanceClass="org.eclipse.emf.facet.custom.metamodel.custompt.IColor" + * @generated + */ + EDataType getColor(); + + /** + * Returns the factory that creates the instances of the model. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @return the factory that creates the instances of the model. + * @generated + */ + CustomptFactory getCustomptFactory(); + + /** + * <!-- begin-user-doc --> + * Defines literals for the meta objects that represent + * <ul> + * <li>each class,</li> + * <li>each feature of each class,</li> + * <li>each enum,</li> + * <li>and each data type</li> + * </ul> + * <!-- end-user-doc --> + * @generated + */ + interface Literals { + /** + * The meta object literal for the '{@link org.eclipse.modisco.facet.custom.metamodel.v0_2_0.custompt.Shadow <em>Shadow</em>}' enum. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @see org.eclipse.modisco.facet.custom.metamodel.v0_2_0.custompt.Shadow + * @see org.eclipse.modisco.facet.custom.metamodel.v0_2_0.custompt.impl.CustomptPackageImpl#getShadow() + * @generated + */ + EEnum SHADOW = eINSTANCE.getShadow(); + + /** + * The meta object literal for the '{@link org.eclipse.modisco.facet.custom.metamodel.v0_2_0.custompt.Alignment <em>Alignment</em>}' enum. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @see org.eclipse.modisco.facet.custom.metamodel.v0_2_0.custompt.Alignment + * @see org.eclipse.modisco.facet.custom.metamodel.v0_2_0.custompt.impl.CustomptPackageImpl#getAlignment() + * @generated + */ + EEnum ALIGNMENT = eINSTANCE.getAlignment(); + + /** + * The meta object literal for the '<em>Image</em>' data type. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @see org.eclipse.modisco.facet.custom.metamodel.custompt.IImage + * @see org.eclipse.modisco.facet.custom.metamodel.v0_2_0.custompt.impl.CustomptPackageImpl#getImage() + * @generated + */ + EDataType IMAGE = eINSTANCE.getImage(); + + /** + * The meta object literal for the '<em>Color</em>' data type. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @see org.eclipse.modisco.facet.custom.metamodel.custompt.IColor + * @see org.eclipse.modisco.facet.custom.metamodel.v0_2_0.custompt.impl.CustomptPackageImpl#getColor() + * @generated + */ + EDataType COLOR = eINSTANCE.getColor(); + + } + +} //CustomptPackage
diff --git a/org.eclipse.modisco.facet.custom.metamodel/src/org/eclipse/modisco/facet/custom/metamodel/v0_2_0/custompt/Shadow.java b/org.eclipse.modisco.facet.custom.metamodel/src/org/eclipse/modisco/facet/custom/metamodel/v0_2_0/custompt/Shadow.java new file mode 100644 index 0000000..a88b93f --- /dev/null +++ b/org.eclipse.modisco.facet.custom.metamodel/src/org/eclipse/modisco/facet/custom/metamodel/v0_2_0/custompt/Shadow.java
@@ -0,0 +1,246 @@ +/** + * Copyright (c) 2012 Mia-Software. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Gregoire Dupe (Mia-Software) - Bug 361794 - [Restructuring] New customization meta-model + * Vincent Lorenzo (CEA-LIST) - Bug 372644 - Create Customizable tooltips for the TreeViewer using a CustomizableLabelProvider + * + */ +package org.eclipse.modisco.facet.custom.metamodel.v0_2_0.custompt; + +import java.util.Arrays; +import java.util.Collections; +import java.util.List; + +import org.eclipse.emf.common.util.Enumerator; + +/** + * <!-- begin-user-doc --> + * A representation of the literals of the enumeration '<em><b>Shadow</b></em>', + * and utility methods for working with them. + * <!-- end-user-doc --> + * @see org.eclipse.modisco.facet.custom.metamodel.v0_2_0.custompt.CustomptPackage#getShadow() + * @model + * @generated + */ +public enum Shadow implements Enumerator { + /** + * The '<em><b>NONE</b></em>' literal object. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @see #NONE_VALUE + * @generated + * @ordered + */ + NONE(0, "NONE", "NONE"), + + /** + * The '<em><b>IN</b></em>' literal object. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @see #IN_VALUE + * @generated + * @ordered + */ + IN(1, "IN", "IN"), + + /** + * The '<em><b>OUT</b></em>' literal object. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @see #OUT_VALUE + * @generated + * @ordered + */ + OUT(2, "OUT", "OUT"); + + /** + * The '<em><b>NONE</b></em>' literal value. + * <!-- begin-user-doc --> + * <p> + * If the meaning of '<em><b>NONE</b></em>' literal object isn't clear, + * there really should be more of a description here... + * </p> + * <!-- end-user-doc --> + * @see #NONE + * @model + * @generated + * @ordered + */ + public static final int NONE_VALUE = 0; + + /** + * The '<em><b>IN</b></em>' literal value. + * <!-- begin-user-doc --> + * <p> + * If the meaning of '<em><b>IN</b></em>' literal object isn't clear, + * there really should be more of a description here... + * </p> + * <!-- end-user-doc --> + * @see #IN + * @model + * @generated + * @ordered + */ + public static final int IN_VALUE = 1; + + /** + * The '<em><b>OUT</b></em>' literal value. + * <!-- begin-user-doc --> + * <p> + * If the meaning of '<em><b>OUT</b></em>' literal object isn't clear, + * there really should be more of a description here... + * </p> + * <!-- end-user-doc --> + * @see #OUT + * @model + * @generated + * @ordered + */ + public static final int OUT_VALUE = 2; + + /** + * An array of all the '<em><b>Shadow</b></em>' enumerators. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + private static final Shadow[] VALUES_ARRAY = + new Shadow[] { + NONE, + IN, + OUT, + }; + + /** + * A public read-only list of all the '<em><b>Shadow</b></em>' enumerators. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public static final List<Shadow> VALUES = Collections.unmodifiableList(Arrays.asList(VALUES_ARRAY)); + + /** + * Returns the '<em><b>Shadow</b></em>' literal with the specified literal value. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public static Shadow get(String literal) { + for (int i = 0; i < VALUES_ARRAY.length; ++i) { + Shadow result = VALUES_ARRAY[i]; + if (result.toString().equals(literal)) { + return result; + } + } + return null; + } + + /** + * Returns the '<em><b>Shadow</b></em>' literal with the specified name. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public static Shadow getByName(String name) { + for (int i = 0; i < VALUES_ARRAY.length; ++i) { + Shadow result = VALUES_ARRAY[i]; + if (result.getName().equals(name)) { + return result; + } + } + return null; + } + + /** + * Returns the '<em><b>Shadow</b></em>' literal with the specified integer value. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public static Shadow get(int value) { + switch (value) { + case NONE_VALUE: return NONE; + case IN_VALUE: return IN; + case OUT_VALUE: return OUT; + } + return null; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + private final int value; + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + private final String name; + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + private final String literal; + + /** + * Only this class can construct instances. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + private Shadow(int value, String name, String literal) { + this.value = value; + this.name = name; + this.literal = literal; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public int getValue() { + return value; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public String getName() { + return name; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public String getLiteral() { + return literal; + } + + /** + * Returns the literal value of the enumerator, which is its string representation. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + public String toString() { + return literal; + } + +} //Shadow
diff --git a/org.eclipse.modisco.facet.custom.metamodel/src/org/eclipse/modisco/facet/custom/metamodel/v0_2_0/custompt/impl/CustomptFactoryImpl.java b/org.eclipse.modisco.facet.custom.metamodel/src/org/eclipse/modisco/facet/custom/metamodel/v0_2_0/custompt/impl/CustomptFactoryImpl.java new file mode 100644 index 0000000..44f60a3 --- /dev/null +++ b/org.eclipse.modisco.facet.custom.metamodel/src/org/eclipse/modisco/facet/custom/metamodel/v0_2_0/custompt/impl/CustomptFactoryImpl.java
@@ -0,0 +1,213 @@ +/** + * Copyright (c) 2012 Mia-Software. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Gregoire Dupe (Mia-Software) - Bug 361794 - [Restructuring] New customization meta-model + * + * + */ +package org.eclipse.modisco.facet.custom.metamodel.v0_2_0.custompt.impl; + +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.EDataType; +import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.ecore.EPackage; +import org.eclipse.emf.ecore.impl.EFactoryImpl; +import org.eclipse.emf.ecore.plugin.EcorePlugin; +import org.eclipse.modisco.facet.custom.metamodel.custompt.IColor; +import org.eclipse.modisco.facet.custom.metamodel.custompt.IImage; +import org.eclipse.modisco.facet.custom.metamodel.v0_2_0.custompt.*; + +/** + * <!-- begin-user-doc --> + * An implementation of the model <b>Factory</b>. + * <!-- end-user-doc --> + * @generated + */ +public class CustomptFactoryImpl extends EFactoryImpl implements CustomptFactory { + /** + * Creates the default factory implementation. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public static CustomptFactory init() { + try { + CustomptFactory theCustomptFactory = (CustomptFactory)EPackage.Registry.INSTANCE.getEFactory("http://www.eclipse.org/emf/facet/custom/0.2.incubation/custom_primitive_types"); + if (theCustomptFactory != null) { + return theCustomptFactory; + } + } + catch (Exception exception) { + EcorePlugin.INSTANCE.log(exception); + } + return new CustomptFactoryImpl(); + } + + /** + * Creates an instance of the factory. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public CustomptFactoryImpl() { + super(); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + public EObject create(EClass eClass) { + switch (eClass.getClassifierID()) { + default: + throw new IllegalArgumentException("The class '" + eClass.getName() + "' is not a valid classifier"); + } + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + public Object createFromString(EDataType eDataType, String initialValue) { + switch (eDataType.getClassifierID()) { + case CustomptPackage.SHADOW: + return createShadowFromString(eDataType, initialValue); + case CustomptPackage.ALIGNMENT: + return createAlignmentFromString(eDataType, initialValue); + case CustomptPackage.IMAGE: + return createImageFromString(eDataType, initialValue); + case CustomptPackage.COLOR: + return createColorFromString(eDataType, initialValue); + default: + throw new IllegalArgumentException("The datatype '" + eDataType.getName() + "' is not a valid classifier"); + } + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + public String convertToString(EDataType eDataType, Object instanceValue) { + switch (eDataType.getClassifierID()) { + case CustomptPackage.SHADOW: + return convertShadowToString(eDataType, instanceValue); + case CustomptPackage.ALIGNMENT: + return convertAlignmentToString(eDataType, instanceValue); + case CustomptPackage.IMAGE: + return convertImageToString(eDataType, instanceValue); + case CustomptPackage.COLOR: + return convertColorToString(eDataType, instanceValue); + default: + throw new IllegalArgumentException("The datatype '" + eDataType.getName() + "' is not a valid classifier"); + } + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public Shadow createShadowFromString(EDataType eDataType, String initialValue) { + Shadow result = Shadow.get(initialValue); + if (result == null) throw new IllegalArgumentException("The value '" + initialValue + "' is not a valid enumerator of '" + eDataType.getName() + "'"); + return result; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public String convertShadowToString(EDataType eDataType, Object instanceValue) { + return instanceValue == null ? null : instanceValue.toString(); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public Alignment createAlignmentFromString(EDataType eDataType, String initialValue) { + Alignment result = Alignment.get(initialValue); + if (result == null) throw new IllegalArgumentException("The value '" + initialValue + "' is not a valid enumerator of '" + eDataType.getName() + "'"); + return result; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public String convertAlignmentToString(EDataType eDataType, Object instanceValue) { + return instanceValue == null ? null : instanceValue.toString(); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public IImage createImageFromString(EDataType eDataType, String initialValue) { + return (IImage)super.createFromString(eDataType, initialValue); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public String convertImageToString(EDataType eDataType, Object instanceValue) { + return super.convertToString(eDataType, instanceValue); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public IColor createColorFromString(EDataType eDataType, String initialValue) { + return (IColor)super.createFromString(eDataType, initialValue); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public String convertColorToString(EDataType eDataType, Object instanceValue) { + return super.convertToString(eDataType, instanceValue); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public CustomptPackage getCustomptPackage() { + return (CustomptPackage)getEPackage(); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @deprecated + * @generated + */ + @Deprecated + public static CustomptPackage getPackage() { + return CustomptPackage.eINSTANCE; + } + +} //CustomptFactoryImpl
diff --git a/org.eclipse.modisco.facet.custom.metamodel/src/org/eclipse/modisco/facet/custom/metamodel/v0_2_0/custompt/impl/CustomptPackageImpl.java b/org.eclipse.modisco.facet.custom.metamodel/src/org/eclipse/modisco/facet/custom/metamodel/v0_2_0/custompt/impl/CustomptPackageImpl.java new file mode 100644 index 0000000..956158a --- /dev/null +++ b/org.eclipse.modisco.facet.custom.metamodel/src/org/eclipse/modisco/facet/custom/metamodel/v0_2_0/custompt/impl/CustomptPackageImpl.java
@@ -0,0 +1,237 @@ +/** + * Copyright (c) 2012 Mia-Software. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Gregoire Dupe (Mia-Software) - Bug 361794 - [Restructuring] New customization meta-model + * + * + */ +package org.eclipse.modisco.facet.custom.metamodel.v0_2_0.custompt.impl; + +import org.eclipse.emf.ecore.EDataType; +import org.eclipse.emf.ecore.EEnum; +import org.eclipse.emf.ecore.EPackage; +import org.eclipse.emf.ecore.impl.EPackageImpl; +import org.eclipse.modisco.facet.custom.metamodel.custompt.IColor; +import org.eclipse.modisco.facet.custom.metamodel.custompt.IImage; +import org.eclipse.modisco.facet.custom.metamodel.v0_2_0.custompt.Alignment; +import org.eclipse.modisco.facet.custom.metamodel.v0_2_0.custompt.CustomptFactory; +import org.eclipse.modisco.facet.custom.metamodel.v0_2_0.custompt.CustomptPackage; +import org.eclipse.modisco.facet.custom.metamodel.v0_2_0.custompt.Shadow; + +/** + * <!-- begin-user-doc --> + * An implementation of the model <b>Package</b>. + * <!-- end-user-doc --> + * @generated + */ +public class CustomptPackageImpl extends EPackageImpl implements CustomptPackage { + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + private EEnum shadowEEnum = null; + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + private EEnum alignmentEEnum = null; + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + private EDataType imageEDataType = null; + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + private EDataType colorEDataType = null; + + /** + * Creates an instance of the model <b>Package</b>, registered with + * {@link org.eclipse.emf.ecore.EPackage.Registry EPackage.Registry} by the package + * package URI value. + * <p>Note: the correct way to create the package is via the static + * factory method {@link #init init()}, which also performs + * initialization of the package, or returns the registered package, + * if one already exists. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @see org.eclipse.emf.ecore.EPackage.Registry + * @see org.eclipse.modisco.facet.custom.metamodel.v0_2_0.custompt.CustomptPackage#eNS_URI + * @see #init() + * @generated + */ + private CustomptPackageImpl() { + super(eNS_URI, CustomptFactory.eINSTANCE); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + private static boolean isInited = false; + + /** + * Creates, registers, and initializes the <b>Package</b> for this model, and for any others upon which it depends. + * + * <p>This method is used to initialize {@link CustomptPackage#eINSTANCE} when that field is accessed. + * Clients should not invoke it directly. Instead, they should simply access that field to obtain the package. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @see #eNS_URI + * @see #createPackageContents() + * @see #initializePackageContents() + * @generated + */ + public static CustomptPackage init() { + if (isInited) return (CustomptPackage)EPackage.Registry.INSTANCE.getEPackage(CustomptPackage.eNS_URI); + + // Obtain or create and register package + CustomptPackageImpl theCustomptPackage = (CustomptPackageImpl)(EPackage.Registry.INSTANCE.get(eNS_URI) instanceof CustomptPackageImpl ? EPackage.Registry.INSTANCE.get(eNS_URI) : new CustomptPackageImpl()); + + isInited = true; + + // Create package meta-data objects + theCustomptPackage.createPackageContents(); + + // Initialize created meta-data + theCustomptPackage.initializePackageContents(); + + // Mark meta-data to indicate it can't be changed + theCustomptPackage.freeze(); + + + // Update the registry and return the package + EPackage.Registry.INSTANCE.put(CustomptPackage.eNS_URI, theCustomptPackage); + return theCustomptPackage; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public EEnum getShadow() { + return shadowEEnum; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public EEnum getAlignment() { + return alignmentEEnum; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public EDataType getImage() { + return imageEDataType; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public EDataType getColor() { + return colorEDataType; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public CustomptFactory getCustomptFactory() { + return (CustomptFactory)getEFactoryInstance(); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + private boolean isCreated = false; + + /** + * Creates the meta-model objects for the package. This method is + * guarded to have no affect on any invocation but its first. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public void createPackageContents() { + if (isCreated) return; + isCreated = true; + + // Create enums + shadowEEnum = createEEnum(SHADOW); + alignmentEEnum = createEEnum(ALIGNMENT); + + // Create data types + imageEDataType = createEDataType(IMAGE); + colorEDataType = createEDataType(COLOR); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + private boolean isInitialized = false; + + /** + * Complete the initialization of the package and its meta-model. This + * method is guarded to have no affect on any invocation but its first. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public void initializePackageContents() { + if (isInitialized) return; + isInitialized = true; + + // Initialize package + setName(eNAME); + setNsPrefix(eNS_PREFIX); + setNsURI(eNS_URI); + + // Initialize enums and add enum literals + initEEnum(shadowEEnum, Shadow.class, "Shadow"); + addEEnumLiteral(shadowEEnum, Shadow.NONE); + addEEnumLiteral(shadowEEnum, Shadow.IN); + addEEnumLiteral(shadowEEnum, Shadow.OUT); + + initEEnum(alignmentEEnum, Alignment.class, "Alignment"); + addEEnumLiteral(alignmentEEnum, Alignment.LEFT); + addEEnumLiteral(alignmentEEnum, Alignment.CENTER); + addEEnumLiteral(alignmentEEnum, Alignment.RIGHT); + + // Initialize data types + initEDataType(imageEDataType, IImage.class, "Image", IS_SERIALIZABLE, !IS_GENERATED_INSTANCE_CLASS); + initEDataType(colorEDataType, IColor.class, "Color", IS_SERIALIZABLE, !IS_GENERATED_INSTANCE_CLASS); + + // Create resource + createResource(eNS_URI); + } + +} //CustomptPackageImpl
diff --git a/org.eclipse.modisco.facet.custom.metamodel/src/org/eclipse/modisco/facet/custom/metamodel/v0_2_0/internal/treeproxy/EAttributeTreeElement.java b/org.eclipse.modisco.facet.custom.metamodel/src/org/eclipse/modisco/facet/custom/metamodel/v0_2_0/internal/treeproxy/EAttributeTreeElement.java new file mode 100644 index 0000000..24e08a1 --- /dev/null +++ b/org.eclipse.modisco.facet.custom.metamodel/src/org/eclipse/modisco/facet/custom/metamodel/v0_2_0/internal/treeproxy/EAttributeTreeElement.java
@@ -0,0 +1,53 @@ +/** + * Copyright (c) 2012,2014 Mia-Software. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Nicolas Bros (Mia-Software) - Bug 379683 - customizable Tree content provider + * Gregoire Dupe (Mia-Software) - Bug 386387 - [CustomizedTreeContentProvider] The TreeElements are not preserved between two calls to getElements() + * Thomas Cicognani (Soft-Maint) - Bug 441321 - isVisible customisation doesn't work after refreshing a tree + */ +package org.eclipse.modisco.facet.custom.metamodel.v0_2_0.internal.treeproxy; + +import org.eclipse.emf.ecore.EAttribute; + +/** + * <!-- begin-user-doc --> + * A representation of the model object '<em><b>EAttribute Tree Element</b></em>'. + * <!-- end-user-doc --> + * + * <!-- begin-model-doc --> + * Represents an EAttribute in a tree view + * <!-- end-model-doc --> + * + * <p> + * The following features are supported: + * <ul> + * <li>{@link org.eclipse.modisco.facet.custom.metamodel.v0_2_0.internal.treeproxy.EAttributeTreeElement#getEAttribute <em>EAttribute</em>}</li> + * </ul> + * </p> + * + * @see org.eclipse.modisco.facet.custom.metamodel.v0_2_0.internal.treeproxy.TreeproxyPackage#getEAttributeTreeElement() + * @model + * @generated + */ +public interface EAttributeTreeElement extends EStructuralFeatureTreeElement { + /** + * Returns the value of the '<em><b>EAttribute</b></em>' reference. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * <!-- begin-model-doc --> + * The EAttribute represented by this tree element + * <!-- end-model-doc --> + * @return the value of the '<em>EAttribute</em>' reference. + * @see org.eclipse.modisco.facet.custom.metamodel.v0_2_0.internal.treeproxy.TreeproxyPackage#getEAttributeTreeElement_EAttribute() + * @model transient="true" changeable="false" volatile="true" derived="true" + * annotation="http://www.eclipse.org/emf/2002/Ecore/OCL derivation='self.eStructuralFeature.oclAsType(ecore::EAttribute)'" + * @generated + */ + EAttribute getEAttribute(); + +} // EAttributeTreeElement
diff --git a/org.eclipse.modisco.facet.custom.metamodel/src/org/eclipse/modisco/facet/custom/metamodel/v0_2_0/internal/treeproxy/EObjectTreeElement.java b/org.eclipse.modisco.facet.custom.metamodel/src/org/eclipse/modisco/facet/custom/metamodel/v0_2_0/internal/treeproxy/EObjectTreeElement.java new file mode 100644 index 0000000..ad7b9e4 --- /dev/null +++ b/org.eclipse.modisco.facet.custom.metamodel/src/org/eclipse/modisco/facet/custom/metamodel/v0_2_0/internal/treeproxy/EObjectTreeElement.java
@@ -0,0 +1,63 @@ +/** + * Copyright (c) 2012,2014 Mia-Software. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Nicolas Bros (Mia-Software) - Bug 379683 - customizable Tree content provider + * Gregoire Dupe (Mia-Software) - Bug 386387 - [CustomizedTreeContentProvider] The TreeElements are not preserved between two calls to getElements() + * Thomas Cicognani (Soft-Maint) - Bug 441321 - isVisible customisation doesn't work after refreshing a tree + */ +package org.eclipse.modisco.facet.custom.metamodel.v0_2_0.internal.treeproxy; + +import org.eclipse.emf.ecore.EObject; + +/** + * <!-- begin-user-doc --> + * A representation of the model object '<em><b>EObject Tree Element</b></em>'. + * <!-- end-user-doc --> + * + * <!-- begin-model-doc --> + * Represents a model element in a tree view + * <!-- end-model-doc --> + * + * <p> + * The following features are supported: + * <ul> + * <li>{@link org.eclipse.modisco.facet.custom.metamodel.v0_2_0.internal.treeproxy.EObjectTreeElement#getEObject <em>EObject</em>}</li> + * </ul> + * </p> + * + * @see org.eclipse.modisco.facet.custom.metamodel.v0_2_0.internal.treeproxy.TreeproxyPackage#getEObjectTreeElement() + * @model + * @generated + */ +public interface EObjectTreeElement extends TreeElement { + /** + * Returns the value of the '<em><b>EObject</b></em>' reference. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * <!-- begin-model-doc --> + * The model element represented by this tree element + * <!-- end-model-doc --> + * @return the value of the '<em>EObject</em>' reference. + * @see #setEObject(EObject) + * @see org.eclipse.modisco.facet.custom.metamodel.v0_2_0.internal.treeproxy.TreeproxyPackage#getEObjectTreeElement_EObject() + * @model + * @generated + */ + EObject getEObject(); + + /** + * Sets the value of the '{@link org.eclipse.modisco.facet.custom.metamodel.v0_2_0.internal.treeproxy.EObjectTreeElement#getEObject <em>EObject</em>}' reference. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @param value the new value of the '<em>EObject</em>' reference. + * @see #getEObject() + * @generated + */ + void setEObject(EObject value); + +} // EObjectTreeElement
diff --git a/org.eclipse.modisco.facet.custom.metamodel/src/org/eclipse/modisco/facet/custom/metamodel/v0_2_0/internal/treeproxy/EReferenceTreeElement.java b/org.eclipse.modisco.facet.custom.metamodel/src/org/eclipse/modisco/facet/custom/metamodel/v0_2_0/internal/treeproxy/EReferenceTreeElement.java new file mode 100644 index 0000000..b465b1e --- /dev/null +++ b/org.eclipse.modisco.facet.custom.metamodel/src/org/eclipse/modisco/facet/custom/metamodel/v0_2_0/internal/treeproxy/EReferenceTreeElement.java
@@ -0,0 +1,53 @@ +/** + * Copyright (c) 2012,2014 Mia-Software. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Nicolas Bros (Mia-Software) - Bug 379683 - customizable Tree content provider + * Gregoire Dupe (Mia-Software) - Bug 386387 - [CustomizedTreeContentProvider] The TreeElements are not preserved between two calls to getElements() + * Thomas Cicognani (Soft-Maint) - Bug 441321 - isVisible customisation doesn't work after refreshing a tree + */ +package org.eclipse.modisco.facet.custom.metamodel.v0_2_0.internal.treeproxy; + +import org.eclipse.emf.ecore.EReference; + +/** + * <!-- begin-user-doc --> + * A representation of the model object '<em><b>EReference Tree Element</b></em>'. + * <!-- end-user-doc --> + * + * <!-- begin-model-doc --> + * Represents an EReference as a link between two model elements in a tree view + * <!-- end-model-doc --> + * + * <p> + * The following features are supported: + * <ul> + * <li>{@link org.eclipse.modisco.facet.custom.metamodel.v0_2_0.internal.treeproxy.EReferenceTreeElement#getEReference <em>EReference</em>}</li> + * </ul> + * </p> + * + * @see org.eclipse.modisco.facet.custom.metamodel.v0_2_0.internal.treeproxy.TreeproxyPackage#getEReferenceTreeElement() + * @model + * @generated + */ +public interface EReferenceTreeElement extends EStructuralFeatureTreeElement { + /** + * Returns the value of the '<em><b>EReference</b></em>' reference. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * <!-- begin-model-doc --> + * The EReference represented by this tree element + * <!-- end-model-doc --> + * @return the value of the '<em>EReference</em>' reference. + * @see org.eclipse.modisco.facet.custom.metamodel.v0_2_0.internal.treeproxy.TreeproxyPackage#getEReferenceTreeElement_EReference() + * @model transient="true" changeable="false" volatile="true" derived="true" + * annotation="http://www.eclipse.org/emf/2002/Ecore/OCL derivation='self.eStructuralFeature.oclAsType(ecore::EReference)'" + * @generated + */ + EReference getEReference(); + +} // EReferenceTreeElement
diff --git a/org.eclipse.modisco.facet.custom.metamodel/src/org/eclipse/modisco/facet/custom/metamodel/v0_2_0/internal/treeproxy/EStructuralFeatureTreeElement.java b/org.eclipse.modisco.facet.custom.metamodel/src/org/eclipse/modisco/facet/custom/metamodel/v0_2_0/internal/treeproxy/EStructuralFeatureTreeElement.java new file mode 100644 index 0000000..cd6fce3 --- /dev/null +++ b/org.eclipse.modisco.facet.custom.metamodel/src/org/eclipse/modisco/facet/custom/metamodel/v0_2_0/internal/treeproxy/EStructuralFeatureTreeElement.java
@@ -0,0 +1,60 @@ +/** + * Copyright (c) 2012,2014 Mia-Software. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Nicolas Bros (Mia-Software) - Bug 379683 - customizable Tree content provider + * Gregoire Dupe (Mia-Software) - Bug 386387 - [CustomizedTreeContentProvider] The TreeElements are not preserved between two calls to getElements() + * Thomas Cicognani (Soft-Maint) - Bug 441321 - isVisible customisation doesn't work after refreshing a tree + */ +package org.eclipse.modisco.facet.custom.metamodel.v0_2_0.internal.treeproxy; + +import org.eclipse.emf.ecore.EStructuralFeature; + +/** + * <!-- begin-user-doc --> + * A representation of the model object '<em><b>EStructural Feature Tree Element</b></em>'. + * <!-- end-user-doc --> + * + * <p> + * The following features are supported: + * <ul> + * <li>{@link org.eclipse.modisco.facet.custom.metamodel.v0_2_0.internal.treeproxy.EStructuralFeatureTreeElement#getEStructuralFeature <em>EStructural Feature</em>}</li> + * </ul> + * </p> + * + * @see org.eclipse.modisco.facet.custom.metamodel.v0_2_0.internal.treeproxy.TreeproxyPackage#getEStructuralFeatureTreeElement() + * @model abstract="true" + * @generated + */ +public interface EStructuralFeatureTreeElement extends TreeElement { + /** + * Returns the value of the '<em><b>EStructural Feature</b></em>' reference. + * <!-- begin-user-doc --> + * <p> + * If the meaning of the '<em>EStructural Feature</em>' reference isn't clear, + * there really should be more of a description here... + * </p> + * <!-- end-user-doc --> + * @return the value of the '<em>EStructural Feature</em>' reference. + * @see #setEStructuralFeature(EStructuralFeature) + * @see org.eclipse.modisco.facet.custom.metamodel.v0_2_0.internal.treeproxy.TreeproxyPackage#getEStructuralFeatureTreeElement_EStructuralFeature() + * @model derived="true" + * @generated + */ + EStructuralFeature getEStructuralFeature(); + + /** + * Sets the value of the '{@link org.eclipse.modisco.facet.custom.metamodel.v0_2_0.internal.treeproxy.EStructuralFeatureTreeElement#getEStructuralFeature <em>EStructural Feature</em>}' reference. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @param value the new value of the '<em>EStructural Feature</em>' reference. + * @see #getEStructuralFeature() + * @generated + */ + void setEStructuralFeature(EStructuralFeature value); + +} // EStructuralFeatureTreeElement
diff --git a/org.eclipse.modisco.facet.custom.metamodel/src/org/eclipse/modisco/facet/custom/metamodel/v0_2_0/internal/treeproxy/TreeElement.java b/org.eclipse.modisco.facet.custom.metamodel/src/org/eclipse/modisco/facet/custom/metamodel/v0_2_0/internal/treeproxy/TreeElement.java new file mode 100644 index 0000000..9a51478 --- /dev/null +++ b/org.eclipse.modisco.facet.custom.metamodel/src/org/eclipse/modisco/facet/custom/metamodel/v0_2_0/internal/treeproxy/TreeElement.java
@@ -0,0 +1,87 @@ +/** + * Copyright (c) 2012,2014 Mia-Software. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Nicolas Bros (Mia-Software) - Bug 379683 - customizable Tree content provider + * Gregoire Dupe (Mia-Software) - Bug 386387 - [CustomizedTreeContentProvider] The TreeElements are not preserved between two calls to getElements() + * Thomas Cicognani (Soft-Maint) - Bug 441321 - isVisible customisation doesn't work after refreshing a tree + */ +package org.eclipse.modisco.facet.custom.metamodel.v0_2_0.internal.treeproxy; + +import org.eclipse.emf.common.util.EList; + +import org.eclipse.emf.ecore.EObject; + +/** + * <!-- begin-user-doc --> + * A representation of the model object '<em><b>Tree Element</b></em>'. + * <!-- end-user-doc --> + * + * <!-- begin-model-doc --> + * Represents a proxy element in a tree view + * <!-- end-model-doc --> + * + * <p> + * The following features are supported: + * <ul> + * <li>{@link org.eclipse.modisco.facet.custom.metamodel.v0_2_0.internal.treeproxy.TreeElement#getParent <em>Parent</em>}</li> + * <li>{@link org.eclipse.modisco.facet.custom.metamodel.v0_2_0.internal.treeproxy.TreeElement#getChildren <em>Children</em>}</li> + * </ul> + * </p> + * + * @see org.eclipse.modisco.facet.custom.metamodel.v0_2_0.internal.treeproxy.TreeproxyPackage#getTreeElement() + * @model abstract="true" + * @generated + */ +public interface TreeElement extends EObject { + /** + * Returns the value of the '<em><b>Parent</b></em>' container reference. + * It is bidirectional and its opposite is '{@link org.eclipse.modisco.facet.custom.metamodel.v0_2_0.internal.treeproxy.TreeElement#getChildren <em>Children</em>}'. + * <!-- begin-user-doc --> + * <p> + * If the meaning of the '<em>Parent</em>' container reference isn't clear, + * there really should be more of a description here... + * </p> + * <!-- end-user-doc --> + * @return the value of the '<em>Parent</em>' container reference. + * @see #setParent(TreeElement) + * @see org.eclipse.modisco.facet.custom.metamodel.v0_2_0.internal.treeproxy.TreeproxyPackage#getTreeElement_Parent() + * @see org.eclipse.modisco.facet.custom.metamodel.v0_2_0.internal.treeproxy.TreeElement#getChildren + * @model opposite="children" transient="false" + * @generated + */ + TreeElement getParent(); + + /** + * Sets the value of the '{@link org.eclipse.modisco.facet.custom.metamodel.v0_2_0.internal.treeproxy.TreeElement#getParent <em>Parent</em>}' container reference. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @param value the new value of the '<em>Parent</em>' container reference. + * @see #getParent() + * @generated + */ + void setParent(TreeElement value); + + /** + * Returns the value of the '<em><b>Children</b></em>' containment reference list. + * The list contents are of type {@link org.eclipse.modisco.facet.custom.metamodel.v0_2_0.internal.treeproxy.TreeElement}. + * It is bidirectional and its opposite is '{@link org.eclipse.modisco.facet.custom.metamodel.v0_2_0.internal.treeproxy.TreeElement#getParent <em>Parent</em>}'. + * <!-- begin-user-doc --> + * <p> + * If the meaning of the '<em>Children</em>' containment reference list isn't clear, + * there really should be more of a description here... + * </p> + * <!-- end-user-doc --> + * @return the value of the '<em>Children</em>' containment reference list. + * @see org.eclipse.modisco.facet.custom.metamodel.v0_2_0.internal.treeproxy.TreeproxyPackage#getTreeElement_Children() + * @see org.eclipse.modisco.facet.custom.metamodel.v0_2_0.internal.treeproxy.TreeElement#getParent + * @model opposite="parent" containment="true" + * @generated + */ + EList<TreeElement> getChildren(); + +} // TreeElement
diff --git a/org.eclipse.modisco.facet.custom.metamodel/src/org/eclipse/modisco/facet/custom/metamodel/v0_2_0/internal/treeproxy/TreeproxyFactory.java b/org.eclipse.modisco.facet.custom.metamodel/src/org/eclipse/modisco/facet/custom/metamodel/v0_2_0/internal/treeproxy/TreeproxyFactory.java new file mode 100644 index 0000000..47db7c0 --- /dev/null +++ b/org.eclipse.modisco.facet.custom.metamodel/src/org/eclipse/modisco/facet/custom/metamodel/v0_2_0/internal/treeproxy/TreeproxyFactory.java
@@ -0,0 +1,70 @@ +/** + * Copyright (c) 2012,2014 Mia-Software. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Nicolas Bros (Mia-Software) - Bug 379683 - customizable Tree content provider + * Gregoire Dupe (Mia-Software) - Bug 386387 - [CustomizedTreeContentProvider] The TreeElements are not preserved between two calls to getElements() + * Thomas Cicognani (Soft-Maint) - Bug 441321 - isVisible customisation doesn't work after refreshing a tree + */ +package org.eclipse.modisco.facet.custom.metamodel.v0_2_0.internal.treeproxy; + +import org.eclipse.emf.ecore.EFactory; + +/** + * <!-- begin-user-doc --> + * The <b>Factory</b> for the model. + * It provides a create method for each non-abstract class of the model. + * <!-- end-user-doc --> + * @see org.eclipse.modisco.facet.custom.metamodel.v0_2_0.internal.treeproxy.TreeproxyPackage + * @generated + */ +public interface TreeproxyFactory extends EFactory { + /** + * The singleton instance of the factory. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + TreeproxyFactory eINSTANCE = org.eclipse.modisco.facet.custom.metamodel.v0_2_0.internal.treeproxy.impl.TreeproxyFactoryImpl.init(); + + /** + * Returns a new object of class '<em>EObject Tree Element</em>'. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @return a new object of class '<em>EObject Tree Element</em>'. + * @generated + */ + EObjectTreeElement createEObjectTreeElement(); + + /** + * Returns a new object of class '<em>EReference Tree Element</em>'. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @return a new object of class '<em>EReference Tree Element</em>'. + * @generated + */ + EReferenceTreeElement createEReferenceTreeElement(); + + /** + * Returns a new object of class '<em>EAttribute Tree Element</em>'. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @return a new object of class '<em>EAttribute Tree Element</em>'. + * @generated + */ + EAttributeTreeElement createEAttributeTreeElement(); + + /** + * Returns the package supported by this factory. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @return the package supported by this factory. + * @generated + */ + TreeproxyPackage getTreeproxyPackage(); + +} //TreeproxyFactory
diff --git a/org.eclipse.modisco.facet.custom.metamodel/src/org/eclipse/modisco/facet/custom/metamodel/v0_2_0/internal/treeproxy/TreeproxyPackage.java b/org.eclipse.modisco.facet.custom.metamodel/src/org/eclipse/modisco/facet/custom/metamodel/v0_2_0/internal/treeproxy/TreeproxyPackage.java new file mode 100644 index 0000000..146426a --- /dev/null +++ b/org.eclipse.modisco.facet.custom.metamodel/src/org/eclipse/modisco/facet/custom/metamodel/v0_2_0/internal/treeproxy/TreeproxyPackage.java
@@ -0,0 +1,546 @@ +/** + * Copyright (c) 2012,2014 Mia-Software. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Nicolas Bros (Mia-Software) - Bug 379683 - customizable Tree content provider + * Gregoire Dupe (Mia-Software) - Bug 386387 - [CustomizedTreeContentProvider] The TreeElements are not preserved between two calls to getElements() + * Thomas Cicognani (Soft-Maint) - Bug 441321 - isVisible customisation doesn't work after refreshing a tree + */ +package org.eclipse.modisco.facet.custom.metamodel.v0_2_0.internal.treeproxy; + +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.EPackage; +import org.eclipse.emf.ecore.EReference; + +/** + * <!-- begin-user-doc --> + * The <b>Package</b> for the model. + * It contains accessors for the meta objects to represent + * <ul> + * <li>each class,</li> + * <li>each feature of each class,</li> + * <li>each enum,</li> + * <li>and each data type</li> + * </ul> + * <!-- end-user-doc --> + * @see org.eclipse.modisco.facet.custom.metamodel.v0_2_0.internal.treeproxy.TreeproxyFactory + * @model kind="package" + * annotation="http://www.eclipse.org/emf/2002/Ecore settingDelegates='http://www.eclipse.org/emf/2002/Ecore/OCL'" + * @generated + */ +public interface TreeproxyPackage extends EPackage { + /** + * The package name. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + String eNAME = "treeproxy"; + + /** + * The package namespace URI. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + String eNS_URI = "http://www.eclipse.org/emf/facet/custom/0.2.incubation/internal/treeproxy"; + + /** + * The package namespace name. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + String eNS_PREFIX = "treeproxy"; + + /** + * The singleton instance of the package. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + TreeproxyPackage eINSTANCE = org.eclipse.modisco.facet.custom.metamodel.v0_2_0.internal.treeproxy.impl.TreeproxyPackageImpl.init(); + + /** + * The meta object id for the '{@link org.eclipse.modisco.facet.custom.metamodel.v0_2_0.internal.treeproxy.impl.TreeElementImpl <em>Tree Element</em>}' class. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @see org.eclipse.modisco.facet.custom.metamodel.v0_2_0.internal.treeproxy.impl.TreeElementImpl + * @see org.eclipse.modisco.facet.custom.metamodel.v0_2_0.internal.treeproxy.impl.TreeproxyPackageImpl#getTreeElement() + * @generated + */ + int TREE_ELEMENT = 0; + + /** + * The feature id for the '<em><b>Parent</b></em>' container reference. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + */ + int TREE_ELEMENT__PARENT = 0; + + /** + * The feature id for the '<em><b>Children</b></em>' containment reference list. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + */ + int TREE_ELEMENT__CHILDREN = 1; + + /** + * The number of structural features of the '<em>Tree Element</em>' class. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + */ + int TREE_ELEMENT_FEATURE_COUNT = 2; + + /** + * The meta object id for the '{@link org.eclipse.modisco.facet.custom.metamodel.v0_2_0.internal.treeproxy.impl.EObjectTreeElementImpl <em>EObject Tree Element</em>}' class. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @see org.eclipse.modisco.facet.custom.metamodel.v0_2_0.internal.treeproxy.impl.EObjectTreeElementImpl + * @see org.eclipse.modisco.facet.custom.metamodel.v0_2_0.internal.treeproxy.impl.TreeproxyPackageImpl#getEObjectTreeElement() + * @generated + */ + int EOBJECT_TREE_ELEMENT = 1; + + /** + * The feature id for the '<em><b>Parent</b></em>' container reference. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + */ + int EOBJECT_TREE_ELEMENT__PARENT = TREE_ELEMENT__PARENT; + + /** + * The feature id for the '<em><b>Children</b></em>' containment reference list. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + */ + int EOBJECT_TREE_ELEMENT__CHILDREN = TREE_ELEMENT__CHILDREN; + + /** + * The feature id for the '<em><b>EObject</b></em>' reference. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + */ + int EOBJECT_TREE_ELEMENT__EOBJECT = TREE_ELEMENT_FEATURE_COUNT + 0; + + /** + * The number of structural features of the '<em>EObject Tree Element</em>' class. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + */ + int EOBJECT_TREE_ELEMENT_FEATURE_COUNT = TREE_ELEMENT_FEATURE_COUNT + 1; + + /** + * The meta object id for the '{@link org.eclipse.modisco.facet.custom.metamodel.v0_2_0.internal.treeproxy.impl.EStructuralFeatureTreeElementImpl <em>EStructural Feature Tree Element</em>}' class. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @see org.eclipse.modisco.facet.custom.metamodel.v0_2_0.internal.treeproxy.impl.EStructuralFeatureTreeElementImpl + * @see org.eclipse.modisco.facet.custom.metamodel.v0_2_0.internal.treeproxy.impl.TreeproxyPackageImpl#getEStructuralFeatureTreeElement() + * @generated + */ + int ESTRUCTURAL_FEATURE_TREE_ELEMENT = 4; + + /** + * The feature id for the '<em><b>Parent</b></em>' container reference. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + */ + int ESTRUCTURAL_FEATURE_TREE_ELEMENT__PARENT = TREE_ELEMENT__PARENT; + + /** + * The feature id for the '<em><b>Children</b></em>' containment reference list. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + */ + int ESTRUCTURAL_FEATURE_TREE_ELEMENT__CHILDREN = TREE_ELEMENT__CHILDREN; + + /** + * The feature id for the '<em><b>EStructural Feature</b></em>' reference. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + */ + int ESTRUCTURAL_FEATURE_TREE_ELEMENT__ESTRUCTURAL_FEATURE = TREE_ELEMENT_FEATURE_COUNT + 0; + + /** + * The number of structural features of the '<em>EStructural Feature Tree Element</em>' class. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + */ + int ESTRUCTURAL_FEATURE_TREE_ELEMENT_FEATURE_COUNT = TREE_ELEMENT_FEATURE_COUNT + 1; + + /** + * The meta object id for the '{@link org.eclipse.modisco.facet.custom.metamodel.v0_2_0.internal.treeproxy.impl.EReferenceTreeElementImpl <em>EReference Tree Element</em>}' class. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @see org.eclipse.modisco.facet.custom.metamodel.v0_2_0.internal.treeproxy.impl.EReferenceTreeElementImpl + * @see org.eclipse.modisco.facet.custom.metamodel.v0_2_0.internal.treeproxy.impl.TreeproxyPackageImpl#getEReferenceTreeElement() + * @generated + */ + int EREFERENCE_TREE_ELEMENT = 2; + + /** + * The feature id for the '<em><b>Parent</b></em>' container reference. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + */ + int EREFERENCE_TREE_ELEMENT__PARENT = ESTRUCTURAL_FEATURE_TREE_ELEMENT__PARENT; + + /** + * The feature id for the '<em><b>Children</b></em>' containment reference list. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + */ + int EREFERENCE_TREE_ELEMENT__CHILDREN = ESTRUCTURAL_FEATURE_TREE_ELEMENT__CHILDREN; + + /** + * The feature id for the '<em><b>EStructural Feature</b></em>' reference. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + */ + int EREFERENCE_TREE_ELEMENT__ESTRUCTURAL_FEATURE = ESTRUCTURAL_FEATURE_TREE_ELEMENT__ESTRUCTURAL_FEATURE; + + /** + * The feature id for the '<em><b>EReference</b></em>' reference. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + */ + int EREFERENCE_TREE_ELEMENT__EREFERENCE = ESTRUCTURAL_FEATURE_TREE_ELEMENT_FEATURE_COUNT + 0; + + /** + * The number of structural features of the '<em>EReference Tree Element</em>' class. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + */ + int EREFERENCE_TREE_ELEMENT_FEATURE_COUNT = ESTRUCTURAL_FEATURE_TREE_ELEMENT_FEATURE_COUNT + 1; + + /** + * The meta object id for the '{@link org.eclipse.modisco.facet.custom.metamodel.v0_2_0.internal.treeproxy.impl.EAttributeTreeElementImpl <em>EAttribute Tree Element</em>}' class. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @see org.eclipse.modisco.facet.custom.metamodel.v0_2_0.internal.treeproxy.impl.EAttributeTreeElementImpl + * @see org.eclipse.modisco.facet.custom.metamodel.v0_2_0.internal.treeproxy.impl.TreeproxyPackageImpl#getEAttributeTreeElement() + * @generated + */ + int EATTRIBUTE_TREE_ELEMENT = 3; + + /** + * The feature id for the '<em><b>Parent</b></em>' container reference. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + */ + int EATTRIBUTE_TREE_ELEMENT__PARENT = ESTRUCTURAL_FEATURE_TREE_ELEMENT__PARENT; + + /** + * The feature id for the '<em><b>Children</b></em>' containment reference list. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + */ + int EATTRIBUTE_TREE_ELEMENT__CHILDREN = ESTRUCTURAL_FEATURE_TREE_ELEMENT__CHILDREN; + + /** + * The feature id for the '<em><b>EStructural Feature</b></em>' reference. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + */ + int EATTRIBUTE_TREE_ELEMENT__ESTRUCTURAL_FEATURE = ESTRUCTURAL_FEATURE_TREE_ELEMENT__ESTRUCTURAL_FEATURE; + + /** + * The feature id for the '<em><b>EAttribute</b></em>' reference. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + */ + int EATTRIBUTE_TREE_ELEMENT__EATTRIBUTE = ESTRUCTURAL_FEATURE_TREE_ELEMENT_FEATURE_COUNT + 0; + + /** + * The number of structural features of the '<em>EAttribute Tree Element</em>' class. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + */ + int EATTRIBUTE_TREE_ELEMENT_FEATURE_COUNT = ESTRUCTURAL_FEATURE_TREE_ELEMENT_FEATURE_COUNT + 1; + + + /** + * Returns the meta object for class '{@link org.eclipse.modisco.facet.custom.metamodel.v0_2_0.internal.treeproxy.TreeElement <em>Tree Element</em>}'. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @return the meta object for class '<em>Tree Element</em>'. + * @see org.eclipse.modisco.facet.custom.metamodel.v0_2_0.internal.treeproxy.TreeElement + * @generated + */ + EClass getTreeElement(); + + /** + * Returns the meta object for the container reference '{@link org.eclipse.modisco.facet.custom.metamodel.v0_2_0.internal.treeproxy.TreeElement#getParent <em>Parent</em>}'. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @return the meta object for the container reference '<em>Parent</em>'. + * @see org.eclipse.modisco.facet.custom.metamodel.v0_2_0.internal.treeproxy.TreeElement#getParent() + * @see #getTreeElement() + * @generated + */ + EReference getTreeElement_Parent(); + + /** + * Returns the meta object for the containment reference list '{@link org.eclipse.modisco.facet.custom.metamodel.v0_2_0.internal.treeproxy.TreeElement#getChildren <em>Children</em>}'. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @return the meta object for the containment reference list '<em>Children</em>'. + * @see org.eclipse.modisco.facet.custom.metamodel.v0_2_0.internal.treeproxy.TreeElement#getChildren() + * @see #getTreeElement() + * @generated + */ + EReference getTreeElement_Children(); + + /** + * Returns the meta object for class '{@link org.eclipse.modisco.facet.custom.metamodel.v0_2_0.internal.treeproxy.EObjectTreeElement <em>EObject Tree Element</em>}'. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @return the meta object for class '<em>EObject Tree Element</em>'. + * @see org.eclipse.modisco.facet.custom.metamodel.v0_2_0.internal.treeproxy.EObjectTreeElement + * @generated + */ + EClass getEObjectTreeElement(); + + /** + * Returns the meta object for the reference '{@link org.eclipse.modisco.facet.custom.metamodel.v0_2_0.internal.treeproxy.EObjectTreeElement#getEObject <em>EObject</em>}'. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @return the meta object for the reference '<em>EObject</em>'. + * @see org.eclipse.modisco.facet.custom.metamodel.v0_2_0.internal.treeproxy.EObjectTreeElement#getEObject() + * @see #getEObjectTreeElement() + * @generated + */ + EReference getEObjectTreeElement_EObject(); + + /** + * Returns the meta object for class '{@link org.eclipse.modisco.facet.custom.metamodel.v0_2_0.internal.treeproxy.EReferenceTreeElement <em>EReference Tree Element</em>}'. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @return the meta object for class '<em>EReference Tree Element</em>'. + * @see org.eclipse.modisco.facet.custom.metamodel.v0_2_0.internal.treeproxy.EReferenceTreeElement + * @generated + */ + EClass getEReferenceTreeElement(); + + /** + * Returns the meta object for the reference '{@link org.eclipse.modisco.facet.custom.metamodel.v0_2_0.internal.treeproxy.EReferenceTreeElement#getEReference <em>EReference</em>}'. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @return the meta object for the reference '<em>EReference</em>'. + * @see org.eclipse.modisco.facet.custom.metamodel.v0_2_0.internal.treeproxy.EReferenceTreeElement#getEReference() + * @see #getEReferenceTreeElement() + * @generated + */ + EReference getEReferenceTreeElement_EReference(); + + /** + * Returns the meta object for class '{@link org.eclipse.modisco.facet.custom.metamodel.v0_2_0.internal.treeproxy.EAttributeTreeElement <em>EAttribute Tree Element</em>}'. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @return the meta object for class '<em>EAttribute Tree Element</em>'. + * @see org.eclipse.modisco.facet.custom.metamodel.v0_2_0.internal.treeproxy.EAttributeTreeElement + * @generated + */ + EClass getEAttributeTreeElement(); + + /** + * Returns the meta object for the reference '{@link org.eclipse.modisco.facet.custom.metamodel.v0_2_0.internal.treeproxy.EAttributeTreeElement#getEAttribute <em>EAttribute</em>}'. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @return the meta object for the reference '<em>EAttribute</em>'. + * @see org.eclipse.modisco.facet.custom.metamodel.v0_2_0.internal.treeproxy.EAttributeTreeElement#getEAttribute() + * @see #getEAttributeTreeElement() + * @generated + */ + EReference getEAttributeTreeElement_EAttribute(); + + /** + * Returns the meta object for class '{@link org.eclipse.modisco.facet.custom.metamodel.v0_2_0.internal.treeproxy.EStructuralFeatureTreeElement <em>EStructural Feature Tree Element</em>}'. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @return the meta object for class '<em>EStructural Feature Tree Element</em>'. + * @see org.eclipse.modisco.facet.custom.metamodel.v0_2_0.internal.treeproxy.EStructuralFeatureTreeElement + * @generated + */ + EClass getEStructuralFeatureTreeElement(); + + /** + * Returns the meta object for the reference '{@link org.eclipse.modisco.facet.custom.metamodel.v0_2_0.internal.treeproxy.EStructuralFeatureTreeElement#getEStructuralFeature <em>EStructural Feature</em>}'. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @return the meta object for the reference '<em>EStructural Feature</em>'. + * @see org.eclipse.modisco.facet.custom.metamodel.v0_2_0.internal.treeproxy.EStructuralFeatureTreeElement#getEStructuralFeature() + * @see #getEStructuralFeatureTreeElement() + * @generated + */ + EReference getEStructuralFeatureTreeElement_EStructuralFeature(); + + /** + * Returns the factory that creates the instances of the model. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @return the factory that creates the instances of the model. + * @generated + */ + TreeproxyFactory getTreeproxyFactory(); + + /** + * <!-- begin-user-doc --> + * Defines literals for the meta objects that represent + * <ul> + * <li>each class,</li> + * <li>each feature of each class,</li> + * <li>each enum,</li> + * <li>and each data type</li> + * </ul> + * <!-- end-user-doc --> + * @generated + */ + interface Literals { + /** + * The meta object literal for the '{@link org.eclipse.modisco.facet.custom.metamodel.v0_2_0.internal.treeproxy.impl.TreeElementImpl <em>Tree Element</em>}' class. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @see org.eclipse.modisco.facet.custom.metamodel.v0_2_0.internal.treeproxy.impl.TreeElementImpl + * @see org.eclipse.modisco.facet.custom.metamodel.v0_2_0.internal.treeproxy.impl.TreeproxyPackageImpl#getTreeElement() + * @generated + */ + EClass TREE_ELEMENT = eINSTANCE.getTreeElement(); + + /** + * The meta object literal for the '<em><b>Parent</b></em>' container reference feature. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + EReference TREE_ELEMENT__PARENT = eINSTANCE.getTreeElement_Parent(); + + /** + * The meta object literal for the '<em><b>Children</b></em>' containment reference list feature. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + EReference TREE_ELEMENT__CHILDREN = eINSTANCE.getTreeElement_Children(); + + /** + * The meta object literal for the '{@link org.eclipse.modisco.facet.custom.metamodel.v0_2_0.internal.treeproxy.impl.EObjectTreeElementImpl <em>EObject Tree Element</em>}' class. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @see org.eclipse.modisco.facet.custom.metamodel.v0_2_0.internal.treeproxy.impl.EObjectTreeElementImpl + * @see org.eclipse.modisco.facet.custom.metamodel.v0_2_0.internal.treeproxy.impl.TreeproxyPackageImpl#getEObjectTreeElement() + * @generated + */ + EClass EOBJECT_TREE_ELEMENT = eINSTANCE.getEObjectTreeElement(); + + /** + * The meta object literal for the '<em><b>EObject</b></em>' reference feature. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + EReference EOBJECT_TREE_ELEMENT__EOBJECT = eINSTANCE.getEObjectTreeElement_EObject(); + + /** + * The meta object literal for the '{@link org.eclipse.modisco.facet.custom.metamodel.v0_2_0.internal.treeproxy.impl.EReferenceTreeElementImpl <em>EReference Tree Element</em>}' class. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @see org.eclipse.modisco.facet.custom.metamodel.v0_2_0.internal.treeproxy.impl.EReferenceTreeElementImpl + * @see org.eclipse.modisco.facet.custom.metamodel.v0_2_0.internal.treeproxy.impl.TreeproxyPackageImpl#getEReferenceTreeElement() + * @generated + */ + EClass EREFERENCE_TREE_ELEMENT = eINSTANCE.getEReferenceTreeElement(); + + /** + * The meta object literal for the '<em><b>EReference</b></em>' reference feature. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + EReference EREFERENCE_TREE_ELEMENT__EREFERENCE = eINSTANCE.getEReferenceTreeElement_EReference(); + + /** + * The meta object literal for the '{@link org.eclipse.modisco.facet.custom.metamodel.v0_2_0.internal.treeproxy.impl.EAttributeTreeElementImpl <em>EAttribute Tree Element</em>}' class. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @see org.eclipse.modisco.facet.custom.metamodel.v0_2_0.internal.treeproxy.impl.EAttributeTreeElementImpl + * @see org.eclipse.modisco.facet.custom.metamodel.v0_2_0.internal.treeproxy.impl.TreeproxyPackageImpl#getEAttributeTreeElement() + * @generated + */ + EClass EATTRIBUTE_TREE_ELEMENT = eINSTANCE.getEAttributeTreeElement(); + + /** + * The meta object literal for the '<em><b>EAttribute</b></em>' reference feature. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + EReference EATTRIBUTE_TREE_ELEMENT__EATTRIBUTE = eINSTANCE.getEAttributeTreeElement_EAttribute(); + + /** + * The meta object literal for the '{@link org.eclipse.modisco.facet.custom.metamodel.v0_2_0.internal.treeproxy.impl.EStructuralFeatureTreeElementImpl <em>EStructural Feature Tree Element</em>}' class. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @see org.eclipse.modisco.facet.custom.metamodel.v0_2_0.internal.treeproxy.impl.EStructuralFeatureTreeElementImpl + * @see org.eclipse.modisco.facet.custom.metamodel.v0_2_0.internal.treeproxy.impl.TreeproxyPackageImpl#getEStructuralFeatureTreeElement() + * @generated + */ + EClass ESTRUCTURAL_FEATURE_TREE_ELEMENT = eINSTANCE.getEStructuralFeatureTreeElement(); + + /** + * The meta object literal for the '<em><b>EStructural Feature</b></em>' reference feature. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + EReference ESTRUCTURAL_FEATURE_TREE_ELEMENT__ESTRUCTURAL_FEATURE = eINSTANCE.getEStructuralFeatureTreeElement_EStructuralFeature(); + + } + +} //TreeproxyPackage
diff --git a/org.eclipse.modisco.facet.custom.metamodel/src/org/eclipse/modisco/facet/custom/metamodel/v0_2_0/internal/treeproxy/impl/EAttributeTreeElementImpl.java b/org.eclipse.modisco.facet.custom.metamodel/src/org/eclipse/modisco/facet/custom/metamodel/v0_2_0/internal/treeproxy/impl/EAttributeTreeElementImpl.java new file mode 100644 index 0000000..eafec1a --- /dev/null +++ b/org.eclipse.modisco.facet.custom.metamodel/src/org/eclipse/modisco/facet/custom/metamodel/v0_2_0/internal/treeproxy/impl/EAttributeTreeElementImpl.java
@@ -0,0 +1,111 @@ +/** + * Copyright (c) 2012,2014 Mia-Software. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Nicolas Bros (Mia-Software) - Bug 379683 - customizable Tree content provider + * Gregoire Dupe (Mia-Software) - Bug 386387 - [CustomizedTreeContentProvider] The TreeElements are not preserved between two calls to getElements() + * Thomas Cicognani (Soft-Maint) - Bug 441321 - isVisible customisation doesn't work after refreshing a tree + */ +package org.eclipse.modisco.facet.custom.metamodel.v0_2_0.internal.treeproxy.impl; + +import org.eclipse.emf.ecore.EAttribute; +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.EStructuralFeature; +import org.eclipse.modisco.facet.custom.metamodel.v0_2_0.internal.treeproxy.EAttributeTreeElement; +import org.eclipse.modisco.facet.custom.metamodel.v0_2_0.internal.treeproxy.TreeproxyPackage; + +/** + * <!-- begin-user-doc --> + * An implementation of the model object '<em><b>EAttribute Tree Element</b></em>'. + * <!-- end-user-doc --> + * <p> + * The following features are implemented: + * <ul> + * <li>{@link org.eclipse.modisco.facet.custom.metamodel.v0_2_0.internal.treeproxy.impl.EAttributeTreeElementImpl#getEAttribute <em>EAttribute</em>}</li> + * </ul> + * </p> + * + * @generated + */ +public class EAttributeTreeElementImpl extends EStructuralFeatureTreeElementImpl implements EAttributeTreeElement { + /** + * The cached setting delegate for the '{@link #getEAttribute() <em>EAttribute</em>}' reference. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @see #getEAttribute() + * @generated + * @ordered + */ + protected EStructuralFeature.Internal.SettingDelegate EATTRIBUTE__ESETTING_DELEGATE = ((EStructuralFeature.Internal)TreeproxyPackage.Literals.EATTRIBUTE_TREE_ELEMENT__EATTRIBUTE).getSettingDelegate(); + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + protected EAttributeTreeElementImpl() { + super(); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + protected EClass eStaticClass() { + return TreeproxyPackage.Literals.EATTRIBUTE_TREE_ELEMENT; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public EAttribute getEAttribute() { + return (EAttribute)EATTRIBUTE__ESETTING_DELEGATE.dynamicGet(this, null, 0, true, false); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public EAttribute basicGetEAttribute() { + return (EAttribute)EATTRIBUTE__ESETTING_DELEGATE.dynamicGet(this, null, 0, false, false); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + public Object eGet(int featureID, boolean resolve, boolean coreType) { + switch (featureID) { + case TreeproxyPackage.EATTRIBUTE_TREE_ELEMENT__EATTRIBUTE: + if (resolve) return getEAttribute(); + return basicGetEAttribute(); + } + return super.eGet(featureID, resolve, coreType); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + public boolean eIsSet(int featureID) { + switch (featureID) { + case TreeproxyPackage.EATTRIBUTE_TREE_ELEMENT__EATTRIBUTE: + return EATTRIBUTE__ESETTING_DELEGATE.dynamicIsSet(this, null, 0); + } + return super.eIsSet(featureID); + } + +} //EAttributeTreeElementImpl
diff --git a/org.eclipse.modisco.facet.custom.metamodel/src/org/eclipse/modisco/facet/custom/metamodel/v0_2_0/internal/treeproxy/impl/EObjectTreeElementImpl.java b/org.eclipse.modisco.facet.custom.metamodel/src/org/eclipse/modisco/facet/custom/metamodel/v0_2_0/internal/treeproxy/impl/EObjectTreeElementImpl.java new file mode 100644 index 0000000..d56a8df --- /dev/null +++ b/org.eclipse.modisco.facet.custom.metamodel/src/org/eclipse/modisco/facet/custom/metamodel/v0_2_0/internal/treeproxy/impl/EObjectTreeElementImpl.java
@@ -0,0 +1,166 @@ +/** + * Copyright (c) 2012,2014 Mia-Software. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Nicolas Bros (Mia-Software) - Bug 379683 - customizable Tree content provider + * Gregoire Dupe (Mia-Software) - Bug 386387 - [CustomizedTreeContentProvider] The TreeElements are not preserved between two calls to getElements() + * Thomas Cicognani (Soft-Maint) - Bug 441321 - isVisible customisation doesn't work after refreshing a tree + */ +package org.eclipse.modisco.facet.custom.metamodel.v0_2_0.internal.treeproxy.impl; + +import org.eclipse.emf.common.notify.Notification; + +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.ecore.InternalEObject; + +import org.eclipse.emf.ecore.impl.ENotificationImpl; +import org.eclipse.modisco.facet.custom.metamodel.v0_2_0.internal.treeproxy.EObjectTreeElement; +import org.eclipse.modisco.facet.custom.metamodel.v0_2_0.internal.treeproxy.TreeproxyPackage; + +/** + * <!-- begin-user-doc --> + * An implementation of the model object '<em><b>EObject Tree Element</b></em>'. + * <!-- end-user-doc --> + * <p> + * The following features are implemented: + * <ul> + * <li>{@link org.eclipse.modisco.facet.custom.metamodel.v0_2_0.internal.treeproxy.impl.EObjectTreeElementImpl#getEObject <em>EObject</em>}</li> + * </ul> + * </p> + * + * @generated + * @since 0.5 + */ +public class EObjectTreeElementImpl extends TreeElementImpl implements EObjectTreeElement { + /** + * The cached value of the '{@link #getEObject() <em>EObject</em>}' reference. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @see #getEObject() + * @generated + * @ordered + */ + protected EObject eObject; + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + protected EObjectTreeElementImpl() { + super(); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + protected EClass eStaticClass() { + return TreeproxyPackage.Literals.EOBJECT_TREE_ELEMENT; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public EObject getEObject() { + if (eObject != null && eObject.eIsProxy()) { + InternalEObject oldEObject = (InternalEObject)eObject; + eObject = eResolveProxy(oldEObject); + if (eObject != oldEObject) { + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.RESOLVE, TreeproxyPackage.EOBJECT_TREE_ELEMENT__EOBJECT, oldEObject, eObject)); + } + } + return eObject; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public EObject basicGetEObject() { + return eObject; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public void setEObject(EObject newEObject) { + EObject oldEObject = eObject; + eObject = newEObject; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.SET, TreeproxyPackage.EOBJECT_TREE_ELEMENT__EOBJECT, oldEObject, eObject)); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + public Object eGet(int featureID, boolean resolve, boolean coreType) { + switch (featureID) { + case TreeproxyPackage.EOBJECT_TREE_ELEMENT__EOBJECT: + if (resolve) return getEObject(); + return basicGetEObject(); + } + return super.eGet(featureID, resolve, coreType); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + public void eSet(int featureID, Object newValue) { + switch (featureID) { + case TreeproxyPackage.EOBJECT_TREE_ELEMENT__EOBJECT: + setEObject((EObject)newValue); + return; + } + super.eSet(featureID, newValue); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + public void eUnset(int featureID) { + switch (featureID) { + case TreeproxyPackage.EOBJECT_TREE_ELEMENT__EOBJECT: + setEObject((EObject)null); + return; + } + super.eUnset(featureID); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + public boolean eIsSet(int featureID) { + switch (featureID) { + case TreeproxyPackage.EOBJECT_TREE_ELEMENT__EOBJECT: + return eObject != null; + } + return super.eIsSet(featureID); + } + +} //EObjectTreeElementImpl
diff --git a/org.eclipse.modisco.facet.custom.metamodel/src/org/eclipse/modisco/facet/custom/metamodel/v0_2_0/internal/treeproxy/impl/EReferenceTreeElementImpl.java b/org.eclipse.modisco.facet.custom.metamodel/src/org/eclipse/modisco/facet/custom/metamodel/v0_2_0/internal/treeproxy/impl/EReferenceTreeElementImpl.java new file mode 100644 index 0000000..e78a923 --- /dev/null +++ b/org.eclipse.modisco.facet.custom.metamodel/src/org/eclipse/modisco/facet/custom/metamodel/v0_2_0/internal/treeproxy/impl/EReferenceTreeElementImpl.java
@@ -0,0 +1,111 @@ +/** + * Copyright (c) 2012,2014 Mia-Software. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Nicolas Bros (Mia-Software) - Bug 379683 - customizable Tree content provider + * Gregoire Dupe (Mia-Software) - Bug 386387 - [CustomizedTreeContentProvider] The TreeElements are not preserved between two calls to getElements() + * Thomas Cicognani (Soft-Maint) - Bug 441321 - isVisible customisation doesn't work after refreshing a tree + */ +package org.eclipse.modisco.facet.custom.metamodel.v0_2_0.internal.treeproxy.impl; + +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.EReference; +import org.eclipse.emf.ecore.EStructuralFeature; +import org.eclipse.modisco.facet.custom.metamodel.v0_2_0.internal.treeproxy.EReferenceTreeElement; +import org.eclipse.modisco.facet.custom.metamodel.v0_2_0.internal.treeproxy.TreeproxyPackage; + +/** + * <!-- begin-user-doc --> + * An implementation of the model object '<em><b>EReference Tree Element</b></em>'. + * <!-- end-user-doc --> + * <p> + * The following features are implemented: + * <ul> + * <li>{@link org.eclipse.modisco.facet.custom.metamodel.v0_2_0.internal.treeproxy.impl.EReferenceTreeElementImpl#getEReference <em>EReference</em>}</li> + * </ul> + * </p> + * + * @generated + */ +public class EReferenceTreeElementImpl extends EStructuralFeatureTreeElementImpl implements EReferenceTreeElement { + /** + * The cached setting delegate for the '{@link #getEReference() <em>EReference</em>}' reference. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @see #getEReference() + * @generated + * @ordered + */ + protected EStructuralFeature.Internal.SettingDelegate EREFERENCE__ESETTING_DELEGATE = ((EStructuralFeature.Internal)TreeproxyPackage.Literals.EREFERENCE_TREE_ELEMENT__EREFERENCE).getSettingDelegate(); + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + protected EReferenceTreeElementImpl() { + super(); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + protected EClass eStaticClass() { + return TreeproxyPackage.Literals.EREFERENCE_TREE_ELEMENT; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public EReference getEReference() { + return (EReference)EREFERENCE__ESETTING_DELEGATE.dynamicGet(this, null, 0, true, false); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public EReference basicGetEReference() { + return (EReference)EREFERENCE__ESETTING_DELEGATE.dynamicGet(this, null, 0, false, false); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + public Object eGet(int featureID, boolean resolve, boolean coreType) { + switch (featureID) { + case TreeproxyPackage.EREFERENCE_TREE_ELEMENT__EREFERENCE: + if (resolve) return getEReference(); + return basicGetEReference(); + } + return super.eGet(featureID, resolve, coreType); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + public boolean eIsSet(int featureID) { + switch (featureID) { + case TreeproxyPackage.EREFERENCE_TREE_ELEMENT__EREFERENCE: + return EREFERENCE__ESETTING_DELEGATE.dynamicIsSet(this, null, 0); + } + return super.eIsSet(featureID); + } + +} //EReferenceTreeElementImpl
diff --git a/org.eclipse.modisco.facet.custom.metamodel/src/org/eclipse/modisco/facet/custom/metamodel/v0_2_0/internal/treeproxy/impl/EStructuralFeatureTreeElementImpl.java b/org.eclipse.modisco.facet.custom.metamodel/src/org/eclipse/modisco/facet/custom/metamodel/v0_2_0/internal/treeproxy/impl/EStructuralFeatureTreeElementImpl.java new file mode 100644 index 0000000..edb46d0 --- /dev/null +++ b/org.eclipse.modisco.facet.custom.metamodel/src/org/eclipse/modisco/facet/custom/metamodel/v0_2_0/internal/treeproxy/impl/EStructuralFeatureTreeElementImpl.java
@@ -0,0 +1,166 @@ +/** + * Copyright (c) 2012,2014 Mia-Software. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Nicolas Bros (Mia-Software) - Bug 379683 - customizable Tree content provider + * Gregoire Dupe (Mia-Software) - Bug 386387 - [CustomizedTreeContentProvider] The TreeElements are not preserved between two calls to getElements() + * Thomas Cicognani (Soft-Maint) - Bug 441321 - isVisible customisation doesn't work after refreshing a tree + */ +package org.eclipse.modisco.facet.custom.metamodel.v0_2_0.internal.treeproxy.impl; + +import org.eclipse.emf.common.notify.Notification; + +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.EStructuralFeature; +import org.eclipse.emf.ecore.InternalEObject; + +import org.eclipse.emf.ecore.impl.ENotificationImpl; +import org.eclipse.modisco.facet.custom.metamodel.v0_2_0.internal.treeproxy.EStructuralFeatureTreeElement; +import org.eclipse.modisco.facet.custom.metamodel.v0_2_0.internal.treeproxy.TreeproxyPackage; + +/** + * <!-- begin-user-doc --> + * An implementation of the model object '<em><b>EStructural Feature Tree Element</b></em>'. + * <!-- end-user-doc --> + * <p> + * The following features are implemented: + * <ul> + * <li>{@link org.eclipse.modisco.facet.custom.metamodel.v0_2_0.internal.treeproxy.impl.EStructuralFeatureTreeElementImpl#getEStructuralFeature <em>EStructural Feature</em>}</li> + * </ul> + * </p> + * + * @generated + * @since 0.5 + */ +public abstract class EStructuralFeatureTreeElementImpl extends TreeElementImpl implements EStructuralFeatureTreeElement { + /** + * The cached value of the '{@link #getEStructuralFeature() <em>EStructural Feature</em>}' reference. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @see #getEStructuralFeature() + * @generated + * @ordered + */ + protected EStructuralFeature eStructuralFeature; + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + protected EStructuralFeatureTreeElementImpl() { + super(); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + protected EClass eStaticClass() { + return TreeproxyPackage.Literals.ESTRUCTURAL_FEATURE_TREE_ELEMENT; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public EStructuralFeature getEStructuralFeature() { + if (eStructuralFeature != null && eStructuralFeature.eIsProxy()) { + InternalEObject oldEStructuralFeature = (InternalEObject)eStructuralFeature; + eStructuralFeature = (EStructuralFeature)eResolveProxy(oldEStructuralFeature); + if (eStructuralFeature != oldEStructuralFeature) { + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.RESOLVE, TreeproxyPackage.ESTRUCTURAL_FEATURE_TREE_ELEMENT__ESTRUCTURAL_FEATURE, oldEStructuralFeature, eStructuralFeature)); + } + } + return eStructuralFeature; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public EStructuralFeature basicGetEStructuralFeature() { + return eStructuralFeature; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public void setEStructuralFeature(EStructuralFeature newEStructuralFeature) { + EStructuralFeature oldEStructuralFeature = eStructuralFeature; + eStructuralFeature = newEStructuralFeature; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.SET, TreeproxyPackage.ESTRUCTURAL_FEATURE_TREE_ELEMENT__ESTRUCTURAL_FEATURE, oldEStructuralFeature, eStructuralFeature)); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + public Object eGet(int featureID, boolean resolve, boolean coreType) { + switch (featureID) { + case TreeproxyPackage.ESTRUCTURAL_FEATURE_TREE_ELEMENT__ESTRUCTURAL_FEATURE: + if (resolve) return getEStructuralFeature(); + return basicGetEStructuralFeature(); + } + return super.eGet(featureID, resolve, coreType); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + public void eSet(int featureID, Object newValue) { + switch (featureID) { + case TreeproxyPackage.ESTRUCTURAL_FEATURE_TREE_ELEMENT__ESTRUCTURAL_FEATURE: + setEStructuralFeature((EStructuralFeature)newValue); + return; + } + super.eSet(featureID, newValue); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + public void eUnset(int featureID) { + switch (featureID) { + case TreeproxyPackage.ESTRUCTURAL_FEATURE_TREE_ELEMENT__ESTRUCTURAL_FEATURE: + setEStructuralFeature((EStructuralFeature)null); + return; + } + super.eUnset(featureID); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + public boolean eIsSet(int featureID) { + switch (featureID) { + case TreeproxyPackage.ESTRUCTURAL_FEATURE_TREE_ELEMENT__ESTRUCTURAL_FEATURE: + return eStructuralFeature != null; + } + return super.eIsSet(featureID); + } + +} //EStructuralFeatureTreeElementImpl
diff --git a/org.eclipse.modisco.facet.custom.metamodel/src/org/eclipse/modisco/facet/custom/metamodel/v0_2_0/internal/treeproxy/impl/TreeElementImpl.java b/org.eclipse.modisco.facet.custom.metamodel/src/org/eclipse/modisco/facet/custom/metamodel/v0_2_0/internal/treeproxy/impl/TreeElementImpl.java new file mode 100644 index 0000000..8fa23f7 --- /dev/null +++ b/org.eclipse.modisco.facet.custom.metamodel/src/org/eclipse/modisco/facet/custom/metamodel/v0_2_0/internal/treeproxy/impl/TreeElementImpl.java
@@ -0,0 +1,250 @@ +/** + * Copyright (c) 2012,2014 Mia-Software. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Nicolas Bros (Mia-Software) - Bug 379683 - customizable Tree content provider + * Gregoire Dupe (Mia-Software) - Bug 386387 - [CustomizedTreeContentProvider] The TreeElements are not preserved between two calls to getElements() + * Thomas Cicognani (Soft-Maint) - Bug 441321 - isVisible customisation doesn't work after refreshing a tree + */ +package org.eclipse.modisco.facet.custom.metamodel.v0_2_0.internal.treeproxy.impl; + +import java.util.Collection; + +import org.eclipse.emf.common.notify.Notification; +import org.eclipse.emf.common.notify.NotificationChain; + +import org.eclipse.emf.common.util.EList; + +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.InternalEObject; + +import org.eclipse.emf.ecore.impl.ENotificationImpl; +import org.eclipse.emf.ecore.impl.EObjectImpl; + +import org.eclipse.emf.ecore.util.EObjectContainmentWithInverseEList; +import org.eclipse.emf.ecore.util.EcoreUtil; +import org.eclipse.emf.ecore.util.InternalEList; +import org.eclipse.modisco.facet.custom.metamodel.v0_2_0.internal.treeproxy.TreeElement; +import org.eclipse.modisco.facet.custom.metamodel.v0_2_0.internal.treeproxy.TreeproxyPackage; + +/** + * <!-- begin-user-doc --> + * An implementation of the model object '<em><b>Tree Element</b></em>'. + * <!-- end-user-doc --> + * <p> + * The following features are implemented: + * <ul> + * <li>{@link org.eclipse.modisco.facet.custom.metamodel.v0_2_0.internal.treeproxy.impl.TreeElementImpl#getParent <em>Parent</em>}</li> + * <li>{@link org.eclipse.modisco.facet.custom.metamodel.v0_2_0.internal.treeproxy.impl.TreeElementImpl#getChildren <em>Children</em>}</li> + * </ul> + * </p> + * + * @generated + */ +public abstract class TreeElementImpl extends EObjectImpl implements TreeElement { + /** + * The cached value of the '{@link #getChildren() <em>Children</em>}' containment reference list. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @see #getChildren() + * @generated + * @ordered + */ + protected EList<TreeElement> children; + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + protected TreeElementImpl() { + super(); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + protected EClass eStaticClass() { + return TreeproxyPackage.Literals.TREE_ELEMENT; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public TreeElement getParent() { + if (eContainerFeatureID() != TreeproxyPackage.TREE_ELEMENT__PARENT) return null; + return (TreeElement)eInternalContainer(); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public NotificationChain basicSetParent(TreeElement newParent, NotificationChain msgs) { + msgs = eBasicSetContainer((InternalEObject)newParent, TreeproxyPackage.TREE_ELEMENT__PARENT, msgs); + return msgs; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public void setParent(TreeElement newParent) { + if (newParent != eInternalContainer() || (eContainerFeatureID() != TreeproxyPackage.TREE_ELEMENT__PARENT && newParent != null)) { + if (EcoreUtil.isAncestor(this, newParent)) + throw new IllegalArgumentException("Recursive containment not allowed for " + toString()); + NotificationChain msgs = null; + if (eInternalContainer() != null) + msgs = eBasicRemoveFromContainer(msgs); + if (newParent != null) + msgs = ((InternalEObject)newParent).eInverseAdd(this, TreeproxyPackage.TREE_ELEMENT__CHILDREN, TreeElement.class, msgs); + msgs = basicSetParent(newParent, msgs); + if (msgs != null) msgs.dispatch(); + } + else if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.SET, TreeproxyPackage.TREE_ELEMENT__PARENT, newParent, newParent)); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public EList<TreeElement> getChildren() { + if (children == null) { + children = new EObjectContainmentWithInverseEList<TreeElement>(TreeElement.class, this, TreeproxyPackage.TREE_ELEMENT__CHILDREN, TreeproxyPackage.TREE_ELEMENT__PARENT); + } + return children; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @SuppressWarnings("unchecked") + @Override + public NotificationChain eInverseAdd(InternalEObject otherEnd, int featureID, NotificationChain msgs) { + switch (featureID) { + case TreeproxyPackage.TREE_ELEMENT__PARENT: + if (eInternalContainer() != null) + msgs = eBasicRemoveFromContainer(msgs); + return basicSetParent((TreeElement)otherEnd, msgs); + case TreeproxyPackage.TREE_ELEMENT__CHILDREN: + return ((InternalEList<InternalEObject>)(InternalEList<?>)getChildren()).basicAdd(otherEnd, msgs); + } + return super.eInverseAdd(otherEnd, featureID, msgs); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { + switch (featureID) { + case TreeproxyPackage.TREE_ELEMENT__PARENT: + return basicSetParent(null, msgs); + case TreeproxyPackage.TREE_ELEMENT__CHILDREN: + return ((InternalEList<?>)getChildren()).basicRemove(otherEnd, msgs); + } + return super.eInverseRemove(otherEnd, featureID, msgs); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + public NotificationChain eBasicRemoveFromContainerFeature(NotificationChain msgs) { + switch (eContainerFeatureID()) { + case TreeproxyPackage.TREE_ELEMENT__PARENT: + return eInternalContainer().eInverseRemove(this, TreeproxyPackage.TREE_ELEMENT__CHILDREN, TreeElement.class, msgs); + } + return super.eBasicRemoveFromContainerFeature(msgs); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + public Object eGet(int featureID, boolean resolve, boolean coreType) { + switch (featureID) { + case TreeproxyPackage.TREE_ELEMENT__PARENT: + return getParent(); + case TreeproxyPackage.TREE_ELEMENT__CHILDREN: + return getChildren(); + } + return super.eGet(featureID, resolve, coreType); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @SuppressWarnings("unchecked") + @Override + public void eSet(int featureID, Object newValue) { + switch (featureID) { + case TreeproxyPackage.TREE_ELEMENT__PARENT: + setParent((TreeElement)newValue); + return; + case TreeproxyPackage.TREE_ELEMENT__CHILDREN: + getChildren().clear(); + getChildren().addAll((Collection<? extends TreeElement>)newValue); + return; + } + super.eSet(featureID, newValue); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + public void eUnset(int featureID) { + switch (featureID) { + case TreeproxyPackage.TREE_ELEMENT__PARENT: + setParent((TreeElement)null); + return; + case TreeproxyPackage.TREE_ELEMENT__CHILDREN: + getChildren().clear(); + return; + } + super.eUnset(featureID); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + public boolean eIsSet(int featureID) { + switch (featureID) { + case TreeproxyPackage.TREE_ELEMENT__PARENT: + return getParent() != null; + case TreeproxyPackage.TREE_ELEMENT__CHILDREN: + return children != null && !children.isEmpty(); + } + return super.eIsSet(featureID); + } + +} //TreeElementImpl
diff --git a/org.eclipse.modisco.facet.custom.metamodel/src/org/eclipse/modisco/facet/custom/metamodel/v0_2_0/internal/treeproxy/impl/TreeproxyFactoryImpl.java b/org.eclipse.modisco.facet.custom.metamodel/src/org/eclipse/modisco/facet/custom/metamodel/v0_2_0/internal/treeproxy/impl/TreeproxyFactoryImpl.java new file mode 100644 index 0000000..1dae3d3 --- /dev/null +++ b/org.eclipse.modisco.facet.custom.metamodel/src/org/eclipse/modisco/facet/custom/metamodel/v0_2_0/internal/treeproxy/impl/TreeproxyFactoryImpl.java
@@ -0,0 +1,126 @@ +/** + * Copyright (c) 2012,2014 Mia-Software. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Nicolas Bros (Mia-Software) - Bug 379683 - customizable Tree content provider + * Gregoire Dupe (Mia-Software) - Bug 386387 - [CustomizedTreeContentProvider] The TreeElements are not preserved between two calls to getElements() + * Thomas Cicognani (Soft-Maint) - Bug 441321 - isVisible customisation doesn't work after refreshing a tree + */ +package org.eclipse.modisco.facet.custom.metamodel.v0_2_0.internal.treeproxy.impl; + +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.ecore.EPackage; + +import org.eclipse.emf.ecore.impl.EFactoryImpl; + +import org.eclipse.emf.ecore.plugin.EcorePlugin; +import org.eclipse.modisco.facet.custom.metamodel.v0_2_0.internal.treeproxy.*; + +/** + * <!-- begin-user-doc --> + * An implementation of the model <b>Factory</b>. + * <!-- end-user-doc --> + * @generated + */ +public class TreeproxyFactoryImpl extends EFactoryImpl implements TreeproxyFactory { + /** + * Creates the default factory implementation. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public static TreeproxyFactory init() { + try { + TreeproxyFactory theTreeproxyFactory = (TreeproxyFactory)EPackage.Registry.INSTANCE.getEFactory(TreeproxyPackage.eNS_URI); + if (theTreeproxyFactory != null) { + return theTreeproxyFactory; + } + } + catch (Exception exception) { + EcorePlugin.INSTANCE.log(exception); + } + return new TreeproxyFactoryImpl(); + } + + /** + * Creates an instance of the factory. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public TreeproxyFactoryImpl() { + super(); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + public EObject create(EClass eClass) { + switch (eClass.getClassifierID()) { + case TreeproxyPackage.EOBJECT_TREE_ELEMENT: return createEObjectTreeElement(); + case TreeproxyPackage.EREFERENCE_TREE_ELEMENT: return createEReferenceTreeElement(); + case TreeproxyPackage.EATTRIBUTE_TREE_ELEMENT: return createEAttributeTreeElement(); + default: + throw new IllegalArgumentException("The class '" + eClass.getName() + "' is not a valid classifier"); + } + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public EObjectTreeElement createEObjectTreeElement() { + EObjectTreeElementImpl eObjectTreeElement = new EObjectTreeElementImpl(); + return eObjectTreeElement; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public EReferenceTreeElement createEReferenceTreeElement() { + EReferenceTreeElementImpl eReferenceTreeElement = new EReferenceTreeElementImpl(); + return eReferenceTreeElement; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public EAttributeTreeElement createEAttributeTreeElement() { + EAttributeTreeElementImpl eAttributeTreeElement = new EAttributeTreeElementImpl(); + return eAttributeTreeElement; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public TreeproxyPackage getTreeproxyPackage() { + return (TreeproxyPackage)getEPackage(); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @deprecated + * @generated + */ + @Deprecated + public static TreeproxyPackage getPackage() { + return TreeproxyPackage.eINSTANCE; + } + +} //TreeproxyFactoryImpl
diff --git a/org.eclipse.modisco.facet.custom.metamodel/src/org/eclipse/modisco/facet/custom/metamodel/v0_2_0/internal/treeproxy/impl/TreeproxyPackageImpl.java b/org.eclipse.modisco.facet.custom.metamodel/src/org/eclipse/modisco/facet/custom/metamodel/v0_2_0/internal/treeproxy/impl/TreeproxyPackageImpl.java new file mode 100644 index 0000000..6ac2eeb --- /dev/null +++ b/org.eclipse.modisco.facet.custom.metamodel/src/org/eclipse/modisco/facet/custom/metamodel/v0_2_0/internal/treeproxy/impl/TreeproxyPackageImpl.java
@@ -0,0 +1,380 @@ +/** + * Copyright (c) 2012,2014 Mia-Software. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Nicolas Bros (Mia-Software) - Bug 379683 - customizable Tree content provider + * Gregoire Dupe (Mia-Software) - Bug 386387 - [CustomizedTreeContentProvider] The TreeElements are not preserved between two calls to getElements() + * Thomas Cicognani (Soft-Maint) - Bug 441321 - isVisible customisation doesn't work after refreshing a tree + */ +package org.eclipse.modisco.facet.custom.metamodel.v0_2_0.internal.treeproxy.impl; + +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.EPackage; +import org.eclipse.emf.ecore.EReference; +import org.eclipse.emf.ecore.EcorePackage; + +import org.eclipse.emf.ecore.impl.EPackageImpl; +import org.eclipse.modisco.facet.custom.metamodel.v0_2_0.internal.treeproxy.EAttributeTreeElement; +import org.eclipse.modisco.facet.custom.metamodel.v0_2_0.internal.treeproxy.EObjectTreeElement; +import org.eclipse.modisco.facet.custom.metamodel.v0_2_0.internal.treeproxy.EReferenceTreeElement; +import org.eclipse.modisco.facet.custom.metamodel.v0_2_0.internal.treeproxy.EStructuralFeatureTreeElement; +import org.eclipse.modisco.facet.custom.metamodel.v0_2_0.internal.treeproxy.TreeElement; +import org.eclipse.modisco.facet.custom.metamodel.v0_2_0.internal.treeproxy.TreeproxyFactory; +import org.eclipse.modisco.facet.custom.metamodel.v0_2_0.internal.treeproxy.TreeproxyPackage; + +/** + * <!-- begin-user-doc --> + * An implementation of the model <b>Package</b>. + * <!-- end-user-doc --> + * @generated + */ +public class TreeproxyPackageImpl extends EPackageImpl implements TreeproxyPackage { + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + private EClass treeElementEClass = null; + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + private EClass eObjectTreeElementEClass = null; + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + private EClass eReferenceTreeElementEClass = null; + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + private EClass eAttributeTreeElementEClass = null; + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + private EClass eStructuralFeatureTreeElementEClass = null; + + /** + * Creates an instance of the model <b>Package</b>, registered with + * {@link org.eclipse.emf.ecore.EPackage.Registry EPackage.Registry} by the package + * package URI value. + * <p>Note: the correct way to create the package is via the static + * factory method {@link #init init()}, which also performs + * initialization of the package, or returns the registered package, + * if one already exists. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @see org.eclipse.emf.ecore.EPackage.Registry + * @see org.eclipse.modisco.facet.custom.metamodel.v0_2_0.internal.treeproxy.TreeproxyPackage#eNS_URI + * @see #init() + * @generated + */ + private TreeproxyPackageImpl() { + super(eNS_URI, TreeproxyFactory.eINSTANCE); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + private static boolean isInited = false; + + /** + * Creates, registers, and initializes the <b>Package</b> for this model, and for any others upon which it depends. + * + * <p>This method is used to initialize {@link TreeproxyPackage#eINSTANCE} when that field is accessed. + * Clients should not invoke it directly. Instead, they should simply access that field to obtain the package. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @see #eNS_URI + * @see #createPackageContents() + * @see #initializePackageContents() + * @generated + */ + public static TreeproxyPackage init() { + if (isInited) return (TreeproxyPackage)EPackage.Registry.INSTANCE.getEPackage(TreeproxyPackage.eNS_URI); + + // Obtain or create and register package + TreeproxyPackageImpl theTreeproxyPackage = (TreeproxyPackageImpl)(EPackage.Registry.INSTANCE.get(eNS_URI) instanceof TreeproxyPackageImpl ? EPackage.Registry.INSTANCE.get(eNS_URI) : new TreeproxyPackageImpl()); + + isInited = true; + + // Initialize simple dependencies + EcorePackage.eINSTANCE.eClass(); + + // Create package meta-data objects + theTreeproxyPackage.createPackageContents(); + + // Initialize created meta-data + theTreeproxyPackage.initializePackageContents(); + + // Mark meta-data to indicate it can't be changed + theTreeproxyPackage.freeze(); + + + // Update the registry and return the package + EPackage.Registry.INSTANCE.put(TreeproxyPackage.eNS_URI, theTreeproxyPackage); + return theTreeproxyPackage; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public EClass getTreeElement() { + return treeElementEClass; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public EReference getTreeElement_Parent() { + return (EReference)treeElementEClass.getEStructuralFeatures().get(0); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public EReference getTreeElement_Children() { + return (EReference)treeElementEClass.getEStructuralFeatures().get(1); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public EClass getEObjectTreeElement() { + return eObjectTreeElementEClass; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public EReference getEObjectTreeElement_EObject() { + return (EReference)eObjectTreeElementEClass.getEStructuralFeatures().get(0); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public EClass getEReferenceTreeElement() { + return eReferenceTreeElementEClass; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public EReference getEReferenceTreeElement_EReference() { + return (EReference)eReferenceTreeElementEClass.getEStructuralFeatures().get(0); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public EClass getEAttributeTreeElement() { + return eAttributeTreeElementEClass; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public EReference getEAttributeTreeElement_EAttribute() { + return (EReference)eAttributeTreeElementEClass.getEStructuralFeatures().get(0); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public EClass getEStructuralFeatureTreeElement() { + return eStructuralFeatureTreeElementEClass; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public EReference getEStructuralFeatureTreeElement_EStructuralFeature() { + return (EReference)eStructuralFeatureTreeElementEClass.getEStructuralFeatures().get(0); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public TreeproxyFactory getTreeproxyFactory() { + return (TreeproxyFactory)getEFactoryInstance(); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + private boolean isCreated = false; + + /** + * Creates the meta-model objects for the package. This method is + * guarded to have no affect on any invocation but its first. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public void createPackageContents() { + if (isCreated) return; + isCreated = true; + + // Create classes and their features + treeElementEClass = createEClass(TREE_ELEMENT); + createEReference(treeElementEClass, TREE_ELEMENT__PARENT); + createEReference(treeElementEClass, TREE_ELEMENT__CHILDREN); + + eObjectTreeElementEClass = createEClass(EOBJECT_TREE_ELEMENT); + createEReference(eObjectTreeElementEClass, EOBJECT_TREE_ELEMENT__EOBJECT); + + eReferenceTreeElementEClass = createEClass(EREFERENCE_TREE_ELEMENT); + createEReference(eReferenceTreeElementEClass, EREFERENCE_TREE_ELEMENT__EREFERENCE); + + eAttributeTreeElementEClass = createEClass(EATTRIBUTE_TREE_ELEMENT); + createEReference(eAttributeTreeElementEClass, EATTRIBUTE_TREE_ELEMENT__EATTRIBUTE); + + eStructuralFeatureTreeElementEClass = createEClass(ESTRUCTURAL_FEATURE_TREE_ELEMENT); + createEReference(eStructuralFeatureTreeElementEClass, ESTRUCTURAL_FEATURE_TREE_ELEMENT__ESTRUCTURAL_FEATURE); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + private boolean isInitialized = false; + + /** + * Complete the initialization of the package and its meta-model. This + * method is guarded to have no affect on any invocation but its first. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public void initializePackageContents() { + if (isInitialized) return; + isInitialized = true; + + // Initialize package + setName(eNAME); + setNsPrefix(eNS_PREFIX); + setNsURI(eNS_URI); + + // Obtain other dependent packages + EcorePackage theEcorePackage = (EcorePackage)EPackage.Registry.INSTANCE.getEPackage(EcorePackage.eNS_URI); + + // Create type parameters + + // Set bounds for type parameters + + // Add supertypes to classes + eObjectTreeElementEClass.getESuperTypes().add(this.getTreeElement()); + eReferenceTreeElementEClass.getESuperTypes().add(this.getEStructuralFeatureTreeElement()); + eAttributeTreeElementEClass.getESuperTypes().add(this.getEStructuralFeatureTreeElement()); + eStructuralFeatureTreeElementEClass.getESuperTypes().add(this.getTreeElement()); + + // Initialize classes and features; add operations and parameters + initEClass(treeElementEClass, TreeElement.class, "TreeElement", IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); + initEReference(getTreeElement_Parent(), this.getTreeElement(), this.getTreeElement_Children(), "parent", null, 0, 1, TreeElement.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + initEReference(getTreeElement_Children(), this.getTreeElement(), this.getTreeElement_Parent(), "children", null, 0, -1, TreeElement.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + + initEClass(eObjectTreeElementEClass, EObjectTreeElement.class, "EObjectTreeElement", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); + initEReference(getEObjectTreeElement_EObject(), ecorePackage.getEObject(), null, "eObject", null, 0, 1, EObjectTreeElement.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + + initEClass(eReferenceTreeElementEClass, EReferenceTreeElement.class, "EReferenceTreeElement", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); + initEReference(getEReferenceTreeElement_EReference(), theEcorePackage.getEReference(), null, "eReference", null, 0, 1, EReferenceTreeElement.class, IS_TRANSIENT, IS_VOLATILE, !IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, IS_DERIVED, IS_ORDERED); + + initEClass(eAttributeTreeElementEClass, EAttributeTreeElement.class, "EAttributeTreeElement", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); + initEReference(getEAttributeTreeElement_EAttribute(), theEcorePackage.getEAttribute(), null, "eAttribute", null, 0, 1, EAttributeTreeElement.class, IS_TRANSIENT, IS_VOLATILE, !IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, IS_DERIVED, IS_ORDERED); + + initEClass(eStructuralFeatureTreeElementEClass, EStructuralFeatureTreeElement.class, "EStructuralFeatureTreeElement", IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); + initEReference(getEStructuralFeatureTreeElement_EStructuralFeature(), theEcorePackage.getEStructuralFeature(), null, "eStructuralFeature", null, 0, 1, EStructuralFeatureTreeElement.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, IS_DERIVED, IS_ORDERED); + + // Create resource + createResource(eNS_URI); + + // Create annotations + // http://www.eclipse.org/emf/2002/Ecore + createEcoreAnnotations(); + // http://www.eclipse.org/emf/2002/Ecore/OCL + createOCLAnnotations(); + } + + /** + * Initializes the annotations for <b>http://www.eclipse.org/emf/2002/Ecore</b>. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + protected void createEcoreAnnotations() { + String source = "http://www.eclipse.org/emf/2002/Ecore"; + addAnnotation + (this, + source, + new String[] { + "settingDelegates", "http://www.eclipse.org/emf/2002/Ecore/OCL" + }); + } + + /** + * Initializes the annotations for <b>http://www.eclipse.org/emf/2002/Ecore/OCL</b>. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + protected void createOCLAnnotations() { + String source = "http://www.eclipse.org/emf/2002/Ecore/OCL"; + addAnnotation + (getEReferenceTreeElement_EReference(), + source, + new String[] { + "derivation", "self.eStructuralFeature.oclAsType(ecore::EReference)" + }); + addAnnotation + (getEAttributeTreeElement_EAttribute(), + source, + new String[] { + "derivation", "self.eStructuralFeature.oclAsType(ecore::EAttribute)" + }); + } + +} //TreeproxyPackageImpl
diff --git a/org.eclipse.modisco.facet.custom.metamodel/src/org/eclipse/modisco/facet/custom/metamodel/v0_2_0/internal/treeproxy/util/TreeproxyAdapterFactory.java b/org.eclipse.modisco.facet.custom.metamodel/src/org/eclipse/modisco/facet/custom/metamodel/v0_2_0/internal/treeproxy/util/TreeproxyAdapterFactory.java new file mode 100644 index 0000000..4c03344 --- /dev/null +++ b/org.eclipse.modisco.facet.custom.metamodel/src/org/eclipse/modisco/facet/custom/metamodel/v0_2_0/internal/treeproxy/util/TreeproxyAdapterFactory.java
@@ -0,0 +1,201 @@ +/** + * Copyright (c) 2012,2014 Mia-Software. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Nicolas Bros (Mia-Software) - Bug 379683 - customizable Tree content provider + * Gregoire Dupe (Mia-Software) - Bug 386387 - [CustomizedTreeContentProvider] The TreeElements are not preserved between two calls to getElements() + * Thomas Cicognani (Soft-Maint) - Bug 441321 - isVisible customisation doesn't work after refreshing a tree + */ +package org.eclipse.modisco.facet.custom.metamodel.v0_2_0.internal.treeproxy.util; + +import org.eclipse.emf.common.notify.Adapter; +import org.eclipse.emf.common.notify.Notifier; + +import org.eclipse.emf.common.notify.impl.AdapterFactoryImpl; + +import org.eclipse.emf.ecore.EObject; +import org.eclipse.modisco.facet.custom.metamodel.v0_2_0.internal.treeproxy.*; + +/** + * <!-- begin-user-doc --> + * The <b>Adapter Factory</b> for the model. + * It provides an adapter <code>createXXX</code> method for each class of the model. + * <!-- end-user-doc --> + * @see org.eclipse.modisco.facet.custom.metamodel.v0_2_0.internal.treeproxy.TreeproxyPackage + * @generated + */ +public class TreeproxyAdapterFactory extends AdapterFactoryImpl { + /** + * The cached model package. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + protected static TreeproxyPackage modelPackage; + + /** + * Creates an instance of the adapter factory. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public TreeproxyAdapterFactory() { + if (modelPackage == null) { + modelPackage = TreeproxyPackage.eINSTANCE; + } + } + + /** + * Returns whether this factory is applicable for the type of the object. + * <!-- begin-user-doc --> + * This implementation returns <code>true</code> if the object is either the model's package or is an instance object of the model. + * <!-- end-user-doc --> + * @return whether this factory is applicable for the type of the object. + * @generated + */ + @Override + public boolean isFactoryForType(Object object) { + if (object == modelPackage) { + return true; + } + if (object instanceof EObject) { + return ((EObject)object).eClass().getEPackage() == modelPackage; + } + return false; + } + + /** + * The switch that delegates to the <code>createXXX</code> methods. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + protected TreeproxySwitch<Adapter> modelSwitch = + new TreeproxySwitch<Adapter>() { + @Override + public Adapter caseTreeElement(TreeElement object) { + return createTreeElementAdapter(); + } + @Override + public Adapter caseEObjectTreeElement(EObjectTreeElement object) { + return createEObjectTreeElementAdapter(); + } + @Override + public Adapter caseEReferenceTreeElement(EReferenceTreeElement object) { + return createEReferenceTreeElementAdapter(); + } + @Override + public Adapter caseEAttributeTreeElement(EAttributeTreeElement object) { + return createEAttributeTreeElementAdapter(); + } + @Override + public Adapter caseEStructuralFeatureTreeElement(EStructuralFeatureTreeElement object) { + return createEStructuralFeatureTreeElementAdapter(); + } + @Override + public Adapter defaultCase(EObject object) { + return createEObjectAdapter(); + } + }; + + /** + * Creates an adapter for the <code>target</code>. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @param target the object to adapt. + * @return the adapter for the <code>target</code>. + * @generated + */ + @Override + public Adapter createAdapter(Notifier target) { + return modelSwitch.doSwitch((EObject)target); + } + + + /** + * Creates a new adapter for an object of class '{@link org.eclipse.modisco.facet.custom.metamodel.v0_2_0.internal.treeproxy.TreeElement <em>Tree Element</em>}'. + * <!-- begin-user-doc --> + * This default implementation returns null so that we can easily ignore cases; + * it's useful to ignore a case when inheritance will catch all the cases anyway. + * <!-- end-user-doc --> + * @return the new adapter. + * @see org.eclipse.modisco.facet.custom.metamodel.v0_2_0.internal.treeproxy.TreeElement + * @generated + */ + public Adapter createTreeElementAdapter() { + return null; + } + + /** + * Creates a new adapter for an object of class '{@link org.eclipse.modisco.facet.custom.metamodel.v0_2_0.internal.treeproxy.EObjectTreeElement <em>EObject Tree Element</em>}'. + * <!-- begin-user-doc --> + * This default implementation returns null so that we can easily ignore cases; + * it's useful to ignore a case when inheritance will catch all the cases anyway. + * <!-- end-user-doc --> + * @return the new adapter. + * @see org.eclipse.modisco.facet.custom.metamodel.v0_2_0.internal.treeproxy.EObjectTreeElement + * @generated + */ + public Adapter createEObjectTreeElementAdapter() { + return null; + } + + /** + * Creates a new adapter for an object of class '{@link org.eclipse.modisco.facet.custom.metamodel.v0_2_0.internal.treeproxy.EReferenceTreeElement <em>EReference Tree Element</em>}'. + * <!-- begin-user-doc --> + * This default implementation returns null so that we can easily ignore cases; + * it's useful to ignore a case when inheritance will catch all the cases anyway. + * <!-- end-user-doc --> + * @return the new adapter. + * @see org.eclipse.modisco.facet.custom.metamodel.v0_2_0.internal.treeproxy.EReferenceTreeElement + * @generated + */ + public Adapter createEReferenceTreeElementAdapter() { + return null; + } + + /** + * Creates a new adapter for an object of class '{@link org.eclipse.modisco.facet.custom.metamodel.v0_2_0.internal.treeproxy.EAttributeTreeElement <em>EAttribute Tree Element</em>}'. + * <!-- begin-user-doc --> + * This default implementation returns null so that we can easily ignore cases; + * it's useful to ignore a case when inheritance will catch all the cases anyway. + * <!-- end-user-doc --> + * @return the new adapter. + * @see org.eclipse.modisco.facet.custom.metamodel.v0_2_0.internal.treeproxy.EAttributeTreeElement + * @generated + */ + public Adapter createEAttributeTreeElementAdapter() { + return null; + } + + /** + * Creates a new adapter for an object of class '{@link org.eclipse.modisco.facet.custom.metamodel.v0_2_0.internal.treeproxy.EStructuralFeatureTreeElement <em>EStructural Feature Tree Element</em>}'. + * <!-- begin-user-doc --> + * This default implementation returns null so that we can easily ignore cases; + * it's useful to ignore a case when inheritance will catch all the cases anyway. + * <!-- end-user-doc --> + * @return the new adapter. + * @see org.eclipse.modisco.facet.custom.metamodel.v0_2_0.internal.treeproxy.EStructuralFeatureTreeElement + * @generated + */ + public Adapter createEStructuralFeatureTreeElementAdapter() { + return null; + } + + /** + * Creates a new adapter for the default case. + * <!-- begin-user-doc --> + * This default implementation returns null. + * <!-- end-user-doc --> + * @return the new adapter. + * @generated + */ + public Adapter createEObjectAdapter() { + return null; + } + +} //TreeproxyAdapterFactory
diff --git a/org.eclipse.modisco.facet.custom.metamodel/src/org/eclipse/modisco/facet/custom/metamodel/v0_2_0/internal/treeproxy/util/TreeproxySwitch.java b/org.eclipse.modisco.facet.custom.metamodel/src/org/eclipse/modisco/facet/custom/metamodel/v0_2_0/internal/treeproxy/util/TreeproxySwitch.java new file mode 100644 index 0000000..1c7d4aa --- /dev/null +++ b/org.eclipse.modisco.facet.custom.metamodel/src/org/eclipse/modisco/facet/custom/metamodel/v0_2_0/internal/treeproxy/util/TreeproxySwitch.java
@@ -0,0 +1,225 @@ +/** + * Copyright (c) 2012,2014 Mia-Software. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Nicolas Bros (Mia-Software) - Bug 379683 - customizable Tree content provider + * Gregoire Dupe (Mia-Software) - Bug 386387 - [CustomizedTreeContentProvider] The TreeElements are not preserved between two calls to getElements() + * Thomas Cicognani (Soft-Maint) - Bug 441321 - isVisible customisation doesn't work after refreshing a tree + */ +package org.eclipse.modisco.facet.custom.metamodel.v0_2_0.internal.treeproxy.util; + +import java.util.List; + +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.EObject; +import org.eclipse.modisco.facet.custom.metamodel.v0_2_0.internal.treeproxy.*; + +/** + * <!-- begin-user-doc --> + * The <b>Switch</b> for the model's inheritance hierarchy. + * It supports the call {@link #doSwitch(EObject) doSwitch(object)} + * to invoke the <code>caseXXX</code> method for each class of the model, + * starting with the actual class of the object + * and proceeding up the inheritance hierarchy + * until a non-null result is returned, + * which is the result of the switch. + * <!-- end-user-doc --> + * @see org.eclipse.modisco.facet.custom.metamodel.v0_2_0.internal.treeproxy.TreeproxyPackage + * @generated + */ +public class TreeproxySwitch<T> { + /** + * The cached model package + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + protected static TreeproxyPackage modelPackage; + + /** + * Creates an instance of the switch. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public TreeproxySwitch() { + if (modelPackage == null) { + modelPackage = TreeproxyPackage.eINSTANCE; + } + } + + /** + * Calls <code>caseXXX</code> for each class of the model until one returns a non null result; it yields that result. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @return the first non-null result returned by a <code>caseXXX</code> call. + * @generated + */ + public T doSwitch(EObject theEObject) { + return doSwitch(theEObject.eClass(), theEObject); + } + + /** + * Calls <code>caseXXX</code> for each class of the model until one returns a non null result; it yields that result. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @return the first non-null result returned by a <code>caseXXX</code> call. + * @generated + */ + protected T doSwitch(EClass theEClass, EObject theEObject) { + if (theEClass.eContainer() == modelPackage) { + return doSwitch(theEClass.getClassifierID(), theEObject); + } + else { + List<EClass> eSuperTypes = theEClass.getESuperTypes(); + return + eSuperTypes.isEmpty() ? + defaultCase(theEObject) : + doSwitch(eSuperTypes.get(0), theEObject); + } + } + + /** + * Calls <code>caseXXX</code> for each class of the model until one returns a non null result; it yields that result. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @return the first non-null result returned by a <code>caseXXX</code> call. + * @generated + */ + protected T doSwitch(int classifierID, EObject theEObject) { + switch (classifierID) { + case TreeproxyPackage.TREE_ELEMENT: { + TreeElement treeElement = (TreeElement)theEObject; + T result = caseTreeElement(treeElement); + if (result == null) result = defaultCase(theEObject); + return result; + } + case TreeproxyPackage.EOBJECT_TREE_ELEMENT: { + EObjectTreeElement eObjectTreeElement = (EObjectTreeElement)theEObject; + T result = caseEObjectTreeElement(eObjectTreeElement); + if (result == null) result = caseTreeElement(eObjectTreeElement); + if (result == null) result = defaultCase(theEObject); + return result; + } + case TreeproxyPackage.EREFERENCE_TREE_ELEMENT: { + EReferenceTreeElement eReferenceTreeElement = (EReferenceTreeElement)theEObject; + T result = caseEReferenceTreeElement(eReferenceTreeElement); + if (result == null) result = caseEStructuralFeatureTreeElement(eReferenceTreeElement); + if (result == null) result = caseTreeElement(eReferenceTreeElement); + if (result == null) result = defaultCase(theEObject); + return result; + } + case TreeproxyPackage.EATTRIBUTE_TREE_ELEMENT: { + EAttributeTreeElement eAttributeTreeElement = (EAttributeTreeElement)theEObject; + T result = caseEAttributeTreeElement(eAttributeTreeElement); + if (result == null) result = caseEStructuralFeatureTreeElement(eAttributeTreeElement); + if (result == null) result = caseTreeElement(eAttributeTreeElement); + if (result == null) result = defaultCase(theEObject); + return result; + } + case TreeproxyPackage.ESTRUCTURAL_FEATURE_TREE_ELEMENT: { + EStructuralFeatureTreeElement eStructuralFeatureTreeElement = (EStructuralFeatureTreeElement)theEObject; + T result = caseEStructuralFeatureTreeElement(eStructuralFeatureTreeElement); + if (result == null) result = caseTreeElement(eStructuralFeatureTreeElement); + if (result == null) result = defaultCase(theEObject); + return result; + } + default: return defaultCase(theEObject); + } + } + + /** + * Returns the result of interpreting the object as an instance of '<em>Tree Element</em>'. + * <!-- begin-user-doc --> + * This implementation returns null; + * returning a non-null result will terminate the switch. + * <!-- end-user-doc --> + * @param object the target of the switch. + * @return the result of interpreting the object as an instance of '<em>Tree Element</em>'. + * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) + * @generated + */ + public T caseTreeElement(TreeElement object) { + return null; + } + + /** + * Returns the result of interpreting the object as an instance of '<em>EObject Tree Element</em>'. + * <!-- begin-user-doc --> + * This implementation returns null; + * returning a non-null result will terminate the switch. + * <!-- end-user-doc --> + * @param object the target of the switch. + * @return the result of interpreting the object as an instance of '<em>EObject Tree Element</em>'. + * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) + * @generated + */ + public T caseEObjectTreeElement(EObjectTreeElement object) { + return null; + } + + /** + * Returns the result of interpreting the object as an instance of '<em>EReference Tree Element</em>'. + * <!-- begin-user-doc --> + * This implementation returns null; + * returning a non-null result will terminate the switch. + * <!-- end-user-doc --> + * @param object the target of the switch. + * @return the result of interpreting the object as an instance of '<em>EReference Tree Element</em>'. + * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) + * @generated + */ + public T caseEReferenceTreeElement(EReferenceTreeElement object) { + return null; + } + + /** + * Returns the result of interpreting the object as an instance of '<em>EAttribute Tree Element</em>'. + * <!-- begin-user-doc --> + * This implementation returns null; + * returning a non-null result will terminate the switch. + * <!-- end-user-doc --> + * @param object the target of the switch. + * @return the result of interpreting the object as an instance of '<em>EAttribute Tree Element</em>'. + * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) + * @generated + */ + public T caseEAttributeTreeElement(EAttributeTreeElement object) { + return null; + } + + /** + * Returns the result of interpreting the object as an instance of '<em>EStructural Feature Tree Element</em>'. + * <!-- begin-user-doc --> + * This implementation returns null; + * returning a non-null result will terminate the switch. + * <!-- end-user-doc --> + * @param object the target of the switch. + * @return the result of interpreting the object as an instance of '<em>EStructural Feature Tree Element</em>'. + * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) + * @generated + */ + public T caseEStructuralFeatureTreeElement(EStructuralFeatureTreeElement object) { + return null; + } + + /** + * Returns the result of interpreting the object as an instance of '<em>EObject</em>'. + * <!-- begin-user-doc --> + * This implementation returns null; + * returning a non-null result will terminate the switch, but this is the last case anyway. + * <!-- end-user-doc --> + * @param object the target of the switch. + * @return the result of interpreting the object as an instance of '<em>EObject</em>'. + * @see #doSwitch(org.eclipse.emf.ecore.EObject) + * @generated + */ + public T defaultCase(EObject object) { + return null; + } + +} //TreeproxySwitch
diff --git a/org.eclipse.modisco.facet.custom.metamodel/src/org/eclipse/modisco/facet/custom/metamodel/v0_3_0/query/QueryFactory.java b/org.eclipse.modisco.facet.custom.metamodel/src/org/eclipse/modisco/facet/custom/metamodel/v0_3_0/query/QueryFactory.java new file mode 100644 index 0000000..96340c1 --- /dev/null +++ b/org.eclipse.modisco.facet.custom.metamodel/src/org/eclipse/modisco/facet/custom/metamodel/v0_3_0/query/QueryFactory.java
@@ -0,0 +1,52 @@ +/** + * Copyright (c) 2013 Soft-Maint. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * David Couvrand (Soft-Maint) - Bug 402725 - Need a query to get an image from an URI + * Nicolas Rault (Soft-Maint) - Bug 402725 - Need a query to get an image from an URI + */ +package org.eclipse.modisco.facet.custom.metamodel.v0_3_0.query; + +import org.eclipse.emf.ecore.EFactory; + +/** + * <!-- begin-user-doc --> The <b>Factory</b> for the model. It provides a + * create method for each non-abstract class of the model. <!-- end-user-doc --> + * + * @see org.eclipse.modisco.facet.custom.metamodel.v0_3_0.query.QueryPackage + * @generated + * @since 0.3 + */ +public interface QueryFactory extends EFactory { + /** + * The singleton instance of the factory. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + QueryFactory eINSTANCE = org.eclipse.modisco.facet.custom.metamodel.v0_3_0.query.impl.QueryFactoryImpl.init(); + + /** + * Returns a new object of class '<em>URI Image Query</em>'. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @return a new object of class '<em>URI Image Query</em>'. + * @generated + */ + URIImageQuery createURIImageQuery(); + + /** + * Returns the package supported by this factory. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @return the package supported by this factory. + * @generated + */ + QueryPackage getQueryPackage(); + +} //QueryFactory
diff --git a/org.eclipse.modisco.facet.custom.metamodel/src/org/eclipse/modisco/facet/custom/metamodel/v0_3_0/query/QueryPackage.java b/org.eclipse.modisco.facet.custom.metamodel/src/org/eclipse/modisco/facet/custom/metamodel/v0_3_0/query/QueryPackage.java new file mode 100644 index 0000000..73786e0 --- /dev/null +++ b/org.eclipse.modisco.facet.custom.metamodel/src/org/eclipse/modisco/facet/custom/metamodel/v0_3_0/query/QueryPackage.java
@@ -0,0 +1,178 @@ +/** + * Copyright (c) 2013 Soft-Maint. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * David Couvrand (Soft-Maint) - Bug 402725 - Need a query to get an image from an URI + * Nicolas Rault (Soft-Maint) - Bug 402725 - Need a query to get an image from an URI + */ +package org.eclipse.modisco.facet.custom.metamodel.v0_3_0.query; + +import org.eclipse.emf.ecore.EAttribute; +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.EPackage; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.extensible.ExtensiblePackage; + +/** + * <!-- begin-user-doc --> + * The <b>Package</b> for the model. + * It contains accessors for the meta objects to represent + * <ul> + * <li>each class,</li> + * <li>each feature of each class,</li> + * <li>each enum,</li> + * <li>and each data type</li> + * </ul> + * <!-- end-user-doc --> + * @see org.eclipse.modisco.facet.custom.metamodel.v0_3_0.query.QueryFactory + * @model kind="package" + * @generated + */ +public interface QueryPackage extends EPackage { + /** + * The package name. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + String eNAME = "query"; + + /** + * The package namespace URI. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + String eNS_URI = "http://www.eclipse.org/emf/facet/custom/0.3.incubation/query"; + + /** + * The package namespace name. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + String eNS_PREFIX = "customQuery"; + + /** + * The singleton instance of the package. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + QueryPackage eINSTANCE = org.eclipse.modisco.facet.custom.metamodel.v0_3_0.query.impl.QueryPackageImpl.init(); + + /** + * The meta object id for the '{@link org.eclipse.modisco.facet.custom.metamodel.v0_3_0.query.impl.URIImageQueryImpl <em>URI Image Query</em>}' class. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @see org.eclipse.modisco.facet.custom.metamodel.v0_3_0.query.impl.URIImageQueryImpl + * @see org.eclipse.modisco.facet.custom.metamodel.v0_3_0.query.impl.QueryPackageImpl#getURIImageQuery() + * @generated + */ + int URI_IMAGE_QUERY = 0; + + /** + * The feature id for the '<em><b>Can Have Side Effects</b></em>' attribute. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + */ + int URI_IMAGE_QUERY__CAN_HAVE_SIDE_EFFECTS = ExtensiblePackage.QUERY__CAN_HAVE_SIDE_EFFECTS; + + /** + * The feature id for the '<em><b>Can Be Cached</b></em>' attribute. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + */ + int URI_IMAGE_QUERY__CAN_BE_CACHED = ExtensiblePackage.QUERY__CAN_BE_CACHED; + + /** + * The feature id for the '<em><b>Uri</b></em>' attribute. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + */ + int URI_IMAGE_QUERY__URI = ExtensiblePackage.QUERY_FEATURE_COUNT + 0; + + /** + * The number of structural features of the '<em>URI Image Query</em>' class. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + */ + int URI_IMAGE_QUERY_FEATURE_COUNT = ExtensiblePackage.QUERY_FEATURE_COUNT + 1; + + + /** + * Returns the meta object for class '{@link org.eclipse.modisco.facet.custom.metamodel.v0_3_0.query.URIImageQuery <em>URI Image Query</em>}'. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @return the meta object for class '<em>URI Image Query</em>'. + * @see org.eclipse.modisco.facet.custom.metamodel.v0_3_0.query.URIImageQuery + * @generated + */ + EClass getURIImageQuery(); + + /** + * Returns the meta object for the attribute '{@link org.eclipse.modisco.facet.custom.metamodel.v0_3_0.query.URIImageQuery#getUri <em>Uri</em>}'. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @return the meta object for the attribute '<em>Uri</em>'. + * @see org.eclipse.modisco.facet.custom.metamodel.v0_3_0.query.URIImageQuery#getUri() + * @see #getURIImageQuery() + * @generated + */ + EAttribute getURIImageQuery_Uri(); + + /** + * Returns the factory that creates the instances of the model. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @return the factory that creates the instances of the model. + * @generated + */ + QueryFactory getQueryFactory(); + + /** + * <!-- begin-user-doc --> + * Defines literals for the meta objects that represent + * <ul> + * <li>each class,</li> + * <li>each feature of each class,</li> + * <li>each enum,</li> + * <li>and each data type</li> + * </ul> + * <!-- end-user-doc --> + * @generated + */ + interface Literals { + /** + * The meta object literal for the '{@link org.eclipse.modisco.facet.custom.metamodel.v0_3_0.query.impl.URIImageQueryImpl <em>URI Image Query</em>}' class. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @see org.eclipse.modisco.facet.custom.metamodel.v0_3_0.query.impl.URIImageQueryImpl + * @see org.eclipse.modisco.facet.custom.metamodel.v0_3_0.query.impl.QueryPackageImpl#getURIImageQuery() + * @generated + */ + EClass URI_IMAGE_QUERY = eINSTANCE.getURIImageQuery(); + + /** + * The meta object literal for the '<em><b>Uri</b></em>' attribute feature. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + EAttribute URI_IMAGE_QUERY__URI = eINSTANCE.getURIImageQuery_Uri(); + + } + +} //QueryPackage
diff --git a/org.eclipse.modisco.facet.custom.metamodel/src/org/eclipse/modisco/facet/custom/metamodel/v0_3_0/query/URIImageQuery.java b/org.eclipse.modisco.facet.custom.metamodel/src/org/eclipse/modisco/facet/custom/metamodel/v0_3_0/query/URIImageQuery.java new file mode 100644 index 0000000..5383aa9 --- /dev/null +++ b/org.eclipse.modisco.facet.custom.metamodel/src/org/eclipse/modisco/facet/custom/metamodel/v0_3_0/query/URIImageQuery.java
@@ -0,0 +1,62 @@ +/** + * Copyright (c) 2013 Soft-Maint. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * David Couvrand (Soft-Maint) - Bug 402725 - Need a query to get an image from an URI + * Nicolas Rault (Soft-Maint) - Bug 402725 - Need a query to get an image from an URI + */ +package org.eclipse.modisco.facet.custom.metamodel.v0_3_0.query; + +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.extensible.Query; + +/** + * <!-- begin-user-doc --> A representation of the model object ' + * <em><b>URI Image Query</b></em>'. <!-- end-user-doc --> + * + * <p> + * The following features are supported: + * <ul> + * <li> + * {@link org.eclipse.modisco.facet.custom.metamodel.v0_3_0.query.URIImageQuery#getUri + * <em>Uri</em>}</li> + * </ul> + * </p> + * + * @see org.eclipse.modisco.facet.custom.metamodel.v0_3_0.query.QueryPackage#getURIImageQuery() + * @model + * @generated + * @since 0.3 + */ +public interface URIImageQuery extends Query { + /** + * Returns the value of the '<em><b>Uri</b></em>' attribute. + * <!-- begin-user-doc --> + * <p> + * If the meaning of the '<em>Uri</em>' attribute isn't clear, + * there really should be more of a description here... + * </p> + * <!-- end-user-doc --> + * @return the value of the '<em>Uri</em>' attribute. + * @see #setUri(String) + * @see org.eclipse.modisco.facet.custom.metamodel.v0_3_0.query.QueryPackage#getURIImageQuery_Uri() + * @model + * @generated + */ + String getUri(); + + /** + * Sets the value of the '{@link org.eclipse.modisco.facet.custom.metamodel.v0_3_0.query.URIImageQuery#getUri <em>Uri</em>}' attribute. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @param value the new value of the '<em>Uri</em>' attribute. + * @see #getUri() + * @generated + */ + void setUri(String value); + +} // URIImageQuery
diff --git a/org.eclipse.modisco.facet.custom.metamodel/src/org/eclipse/modisco/facet/custom/metamodel/v0_3_0/query/impl/QueryFactoryImpl.java b/org.eclipse.modisco.facet.custom.metamodel/src/org/eclipse/modisco/facet/custom/metamodel/v0_3_0/query/impl/QueryFactoryImpl.java new file mode 100644 index 0000000..61dcdb3 --- /dev/null +++ b/org.eclipse.modisco.facet.custom.metamodel/src/org/eclipse/modisco/facet/custom/metamodel/v0_3_0/query/impl/QueryFactoryImpl.java
@@ -0,0 +1,104 @@ +/** + * Copyright (c) 2013 Soft-Maint. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * David Couvrand (Soft-Maint) - Bug 402725 - Need a query to get an image from an URI + * Nicolas Rault (Soft-Maint) - Bug 402725 - Need a query to get an image from an URI + */ +package org.eclipse.modisco.facet.custom.metamodel.v0_3_0.query.impl; + +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.ecore.EPackage; + +import org.eclipse.emf.ecore.impl.EFactoryImpl; + +import org.eclipse.emf.ecore.plugin.EcorePlugin; +import org.eclipse.modisco.facet.custom.metamodel.v0_3_0.query.*; + +/** + * <!-- begin-user-doc --> + * An implementation of the model <b>Factory</b>. + * <!-- end-user-doc --> + * @generated + */ +public class QueryFactoryImpl extends EFactoryImpl implements QueryFactory { + /** + * Creates the default factory implementation. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public static QueryFactory init() { + try { + QueryFactory theQueryFactory = (QueryFactory)EPackage.Registry.INSTANCE.getEFactory("http://www.eclipse.org/emf/facet/custom/0.3.incubation/query"); + if (theQueryFactory != null) { + return theQueryFactory; + } + } + catch (Exception exception) { + EcorePlugin.INSTANCE.log(exception); + } + return new QueryFactoryImpl(); + } + + /** + * Creates an instance of the factory. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public QueryFactoryImpl() { + super(); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + public EObject create(EClass eClass) { + switch (eClass.getClassifierID()) { + case QueryPackage.URI_IMAGE_QUERY: return createURIImageQuery(); + default: + throw new IllegalArgumentException("The class '" + eClass.getName() + "' is not a valid classifier"); + } + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public URIImageQuery createURIImageQuery() { + URIImageQueryImpl uriImageQuery = new URIImageQueryImpl(); + return uriImageQuery; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public QueryPackage getQueryPackage() { + return (QueryPackage)getEPackage(); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @deprecated + * @generated + */ + @Deprecated + public static QueryPackage getPackage() { + return QueryPackage.eINSTANCE; + } + +} //QueryFactoryImpl
diff --git a/org.eclipse.modisco.facet.custom.metamodel/src/org/eclipse/modisco/facet/custom/metamodel/v0_3_0/query/impl/QueryPackageImpl.java b/org.eclipse.modisco.facet.custom.metamodel/src/org/eclipse/modisco/facet/custom/metamodel/v0_3_0/query/impl/QueryPackageImpl.java new file mode 100644 index 0000000..17979ea --- /dev/null +++ b/org.eclipse.modisco.facet.custom.metamodel/src/org/eclipse/modisco/facet/custom/metamodel/v0_3_0/query/impl/QueryPackageImpl.java
@@ -0,0 +1,195 @@ +/** + * Copyright (c) 2013 Soft-Maint. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * David Couvrand (Soft-Maint) - Bug 402725 - Need a query to get an image from an URI + * Nicolas Rault (Soft-Maint) - Bug 402725 - Need a query to get an image from an URI + */ +package org.eclipse.modisco.facet.custom.metamodel.v0_3_0.query.impl; + +import org.eclipse.emf.ecore.EAttribute; +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.EPackage; + +import org.eclipse.emf.ecore.impl.EPackageImpl; +import org.eclipse.modisco.facet.custom.metamodel.v0_3_0.query.QueryFactory; +import org.eclipse.modisco.facet.custom.metamodel.v0_3_0.query.QueryPackage; +import org.eclipse.modisco.facet.custom.metamodel.v0_3_0.query.URIImageQuery; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.EFacetPackage; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.extensible.ExtensiblePackage; + +/** + * <!-- begin-user-doc --> + * An implementation of the model <b>Package</b>. + * <!-- end-user-doc --> + * @generated + */ +public class QueryPackageImpl extends EPackageImpl implements QueryPackage { + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + private EClass uriImageQueryEClass = null; + + /** + * Creates an instance of the model <b>Package</b>, registered with + * {@link org.eclipse.emf.ecore.EPackage.Registry EPackage.Registry} by the package + * package URI value. + * <p>Note: the correct way to create the package is via the static + * factory method {@link #init init()}, which also performs + * initialization of the package, or returns the registered package, + * if one already exists. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @see org.eclipse.emf.ecore.EPackage.Registry + * @see org.eclipse.modisco.facet.custom.metamodel.v0_3_0.query.QueryPackage#eNS_URI + * @see #init() + * @generated + */ + private QueryPackageImpl() { + super(eNS_URI, QueryFactory.eINSTANCE); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + private static boolean isInited = false; + + /** + * Creates, registers, and initializes the <b>Package</b> for this model, and for any others upon which it depends. + * + * <p>This method is used to initialize {@link QueryPackage#eINSTANCE} when that field is accessed. + * Clients should not invoke it directly. Instead, they should simply access that field to obtain the package. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @see #eNS_URI + * @see #createPackageContents() + * @see #initializePackageContents() + * @generated + */ + public static QueryPackage init() { + if (isInited) return (QueryPackage)EPackage.Registry.INSTANCE.getEPackage(QueryPackage.eNS_URI); + + // Obtain or create and register package + QueryPackageImpl theQueryPackage = (QueryPackageImpl)(EPackage.Registry.INSTANCE.get(eNS_URI) instanceof QueryPackageImpl ? EPackage.Registry.INSTANCE.get(eNS_URI) : new QueryPackageImpl()); + + isInited = true; + + // Initialize simple dependencies + EFacetPackage.eINSTANCE.eClass(); + + // Create package meta-data objects + theQueryPackage.createPackageContents(); + + // Initialize created meta-data + theQueryPackage.initializePackageContents(); + + // Mark meta-data to indicate it can't be changed + theQueryPackage.freeze(); + + + // Update the registry and return the package + EPackage.Registry.INSTANCE.put(QueryPackage.eNS_URI, theQueryPackage); + return theQueryPackage; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public EClass getURIImageQuery() { + return uriImageQueryEClass; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public EAttribute getURIImageQuery_Uri() { + return (EAttribute)uriImageQueryEClass.getEStructuralFeatures().get(0); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public QueryFactory getQueryFactory() { + return (QueryFactory)getEFactoryInstance(); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + private boolean isCreated = false; + + /** + * Creates the meta-model objects for the package. This method is + * guarded to have no affect on any invocation but its first. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public void createPackageContents() { + if (isCreated) return; + isCreated = true; + + // Create classes and their features + uriImageQueryEClass = createEClass(URI_IMAGE_QUERY); + createEAttribute(uriImageQueryEClass, URI_IMAGE_QUERY__URI); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + private boolean isInitialized = false; + + /** + * Complete the initialization of the package and its meta-model. This + * method is guarded to have no affect on any invocation but its first. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public void initializePackageContents() { + if (isInitialized) return; + isInitialized = true; + + // Initialize package + setName(eNAME); + setNsPrefix(eNS_PREFIX); + setNsURI(eNS_URI); + + // Obtain other dependent packages + ExtensiblePackage theExtensiblePackage = (ExtensiblePackage)EPackage.Registry.INSTANCE.getEPackage(ExtensiblePackage.eNS_URI); + + // Create type parameters + + // Set bounds for type parameters + + // Add supertypes to classes + uriImageQueryEClass.getESuperTypes().add(theExtensiblePackage.getQuery()); + + // Initialize classes and features; add operations and parameters + initEClass(uriImageQueryEClass, URIImageQuery.class, "URIImageQuery", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); + initEAttribute(getURIImageQuery_Uri(), ecorePackage.getEString(), "uri", null, 0, 1, URIImageQuery.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + + // Create resource + createResource(eNS_URI); + } + +} //QueryPackageImpl
diff --git a/org.eclipse.modisco.facet.custom.metamodel/src/org/eclipse/modisco/facet/custom/metamodel/v0_3_0/query/impl/URIImageQueryImpl.java b/org.eclipse.modisco.facet.custom.metamodel/src/org/eclipse/modisco/facet/custom/metamodel/v0_3_0/query/impl/URIImageQueryImpl.java new file mode 100644 index 0000000..9b0d8fb --- /dev/null +++ b/org.eclipse.modisco.facet.custom.metamodel/src/org/eclipse/modisco/facet/custom/metamodel/v0_3_0/query/impl/URIImageQueryImpl.java
@@ -0,0 +1,172 @@ +/** + * Copyright (c) 2013 Soft-Maint. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * David Couvrand (Soft-Maint) - Bug 402725 - Need a query to get an image from an URI + * Nicolas Rault (Soft-Maint) - Bug 402725 - Need a query to get an image from an URI + */ +package org.eclipse.modisco.facet.custom.metamodel.v0_3_0.query.impl; + +import org.eclipse.emf.common.notify.Notification; + +import org.eclipse.emf.ecore.EClass; + +import org.eclipse.emf.ecore.impl.ENotificationImpl; +import org.eclipse.modisco.facet.custom.metamodel.v0_3_0.query.QueryPackage; +import org.eclipse.modisco.facet.custom.metamodel.v0_3_0.query.URIImageQuery; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.extensible.impl.QueryImpl; + +/** + * <!-- begin-user-doc --> + * An implementation of the model object '<em><b>URI Image Query</b></em>'. + * <!-- end-user-doc --> + * <p> + * The following features are implemented: + * <ul> + * <li>{@link org.eclipse.modisco.facet.custom.metamodel.v0_3_0.query.impl.URIImageQueryImpl#getUri <em>Uri</em>}</li> + * </ul> + * </p> + * + * @generated + */ +public class URIImageQueryImpl extends QueryImpl implements URIImageQuery { + /** + * The default value of the '{@link #getUri() <em>Uri</em>}' attribute. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @see #getUri() + * @generated + * @ordered + */ + protected static final String URI_EDEFAULT = null; + + /** + * The cached value of the '{@link #getUri() <em>Uri</em>}' attribute. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @see #getUri() + * @generated + * @ordered + */ + protected String uri = URI_EDEFAULT; + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + protected URIImageQueryImpl() { + super(); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + protected EClass eStaticClass() { + return QueryPackage.Literals.URI_IMAGE_QUERY; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public String getUri() { + return uri; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public void setUri(String newUri) { + String oldUri = uri; + uri = newUri; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.SET, QueryPackage.URI_IMAGE_QUERY__URI, oldUri, uri)); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + public Object eGet(int featureID, boolean resolve, boolean coreType) { + switch (featureID) { + case QueryPackage.URI_IMAGE_QUERY__URI: + return getUri(); + } + return super.eGet(featureID, resolve, coreType); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + public void eSet(int featureID, Object newValue) { + switch (featureID) { + case QueryPackage.URI_IMAGE_QUERY__URI: + setUri((String)newValue); + return; + } + super.eSet(featureID, newValue); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + public void eUnset(int featureID) { + switch (featureID) { + case QueryPackage.URI_IMAGE_QUERY__URI: + setUri(URI_EDEFAULT); + return; + } + super.eUnset(featureID); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + public boolean eIsSet(int featureID) { + switch (featureID) { + case QueryPackage.URI_IMAGE_QUERY__URI: + return URI_EDEFAULT == null ? uri != null : !URI_EDEFAULT.equals(uri); + } + return super.eIsSet(featureID); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + public String toString() { + if (eIsProxy()) return super.toString(); + + StringBuffer result = new StringBuffer(super.toString()); + result.append(" (uri: "); + result.append(uri); + result.append(')'); + return result.toString(); + } + +} //URIImageQueryImpl
diff --git a/org.eclipse.modisco.facet.custom.metamodel/src/org/eclipse/modisco/facet/custom/metamodel/v0_3_0/query/util/QueryAdapterFactory.java b/org.eclipse.modisco.facet.custom.metamodel/src/org/eclipse/modisco/facet/custom/metamodel/v0_3_0/query/util/QueryAdapterFactory.java new file mode 100644 index 0000000..73e6b45 --- /dev/null +++ b/org.eclipse.modisco.facet.custom.metamodel/src/org/eclipse/modisco/facet/custom/metamodel/v0_3_0/query/util/QueryAdapterFactory.java
@@ -0,0 +1,148 @@ +/** + * Copyright (c) 2013 Soft-Maint. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * David Couvrand (Soft-Maint) - Bug 402725 - Need a query to get an image from an URI + * Nicolas Rault (Soft-Maint) - Bug 402725 - Need a query to get an image from an URI + */ +package org.eclipse.modisco.facet.custom.metamodel.v0_3_0.query.util; + +import org.eclipse.emf.common.notify.Adapter; +import org.eclipse.emf.common.notify.Notifier; + +import org.eclipse.emf.common.notify.impl.AdapterFactoryImpl; + +import org.eclipse.emf.ecore.EObject; +import org.eclipse.modisco.facet.custom.metamodel.v0_3_0.query.*; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.extensible.Query; + +/** + * <!-- begin-user-doc --> + * The <b>Adapter Factory</b> for the model. + * It provides an adapter <code>createXXX</code> method for each class of the model. + * <!-- end-user-doc --> + * @see org.eclipse.modisco.facet.custom.metamodel.v0_3_0.query.QueryPackage + * @generated + */ +public class QueryAdapterFactory extends AdapterFactoryImpl { + /** + * The cached model package. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + protected static QueryPackage modelPackage; + + /** + * Creates an instance of the adapter factory. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public QueryAdapterFactory() { + if (modelPackage == null) { + modelPackage = QueryPackage.eINSTANCE; + } + } + + /** + * Returns whether this factory is applicable for the type of the object. + * <!-- begin-user-doc --> + * This implementation returns <code>true</code> if the object is either the model's package or is an instance object of the model. + * <!-- end-user-doc --> + * @return whether this factory is applicable for the type of the object. + * @generated + */ + @Override + public boolean isFactoryForType(Object object) { + if (object == modelPackage) { + return true; + } + if (object instanceof EObject) { + return ((EObject)object).eClass().getEPackage() == modelPackage; + } + return false; + } + + /** + * The switch that delegates to the <code>createXXX</code> methods. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + protected QuerySwitch<Adapter> modelSwitch = + new QuerySwitch<Adapter>() { + @Override + public Adapter caseURIImageQuery(URIImageQuery object) { + return createURIImageQueryAdapter(); + } + @Override + public Adapter caseQuery(Query object) { + return createQueryAdapter(); + } + @Override + public Adapter defaultCase(EObject object) { + return createEObjectAdapter(); + } + }; + + /** + * Creates an adapter for the <code>target</code>. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @param target the object to adapt. + * @return the adapter for the <code>target</code>. + * @generated + */ + @Override + public Adapter createAdapter(Notifier target) { + return modelSwitch.doSwitch((EObject)target); + } + + + /** + * Creates a new adapter for an object of class '{@link query.URIImageQuery <em>URI Image Query</em>}'. + * <!-- begin-user-doc --> + * This default implementation returns null so that we can easily ignore cases; + * it's useful to ignore a case when inheritance will catch all the cases anyway. + * <!-- end-user-doc --> + * @return the new adapter. + * @see query.URIImageQuery + * @generated + */ + public Adapter createURIImageQueryAdapter() { + return null; + } + + /** + * Creates a new adapter for an object of class '{@link org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.extensible.Query <em>Query</em>}'. + * <!-- begin-user-doc --> + * This default implementation returns null so that we can easily ignore cases; + * it's useful to ignore a case when inheritance will catch all the cases anyway. + * <!-- end-user-doc --> + * @return the new adapter. + * @see org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.extensible.Query + * @generated + */ + public Adapter createQueryAdapter() { + return null; + } + + /** + * Creates a new adapter for the default case. + * <!-- begin-user-doc --> + * This default implementation returns null. + * <!-- end-user-doc --> + * @return the new adapter. + * @generated + */ + public Adapter createEObjectAdapter() { + return null; + } + +} //QueryAdapterFactory
diff --git a/org.eclipse.modisco.facet.custom.metamodel/src/org/eclipse/modisco/facet/custom/metamodel/v0_3_0/query/util/QuerySwitch.java b/org.eclipse.modisco.facet.custom.metamodel/src/org/eclipse/modisco/facet/custom/metamodel/v0_3_0/query/util/QuerySwitch.java new file mode 100644 index 0000000..dfb30f7 --- /dev/null +++ b/org.eclipse.modisco.facet.custom.metamodel/src/org/eclipse/modisco/facet/custom/metamodel/v0_3_0/query/util/QuerySwitch.java
@@ -0,0 +1,153 @@ +/** + * Copyright (c) 2013 Soft-Maint. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * David Couvrand (Soft-Maint) - Bug 402725 - Need a query to get an image from an URI + * Nicolas Rault (Soft-Maint) - Bug 402725 - Need a query to get an image from an URI + */ +package org.eclipse.modisco.facet.custom.metamodel.v0_3_0.query.util; + +import java.util.List; + +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.EObject; +import org.eclipse.modisco.facet.custom.metamodel.v0_3_0.query.QueryPackage; +import org.eclipse.modisco.facet.custom.metamodel.v0_3_0.query.URIImageQuery; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.extensible.Query; + +/** + * <!-- begin-user-doc --> + * The <b>Switch</b> for the model's inheritance hierarchy. + * It supports the call {@link #doSwitch(EObject) doSwitch(object)} + * to invoke the <code>caseXXX</code> method for each class of the model, + * starting with the actual class of the object + * and proceeding up the inheritance hierarchy + * until a non-null result is returned, + * which is the result of the switch. + * <!-- end-user-doc --> + * @see org.eclipse.modisco.facet.custom.metamodel.v0_3_0.query.QueryPackage + * @generated + */ +public class QuerySwitch<T> { + /** + * The cached model package + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + protected static QueryPackage modelPackage; + + /** + * Creates an instance of the switch. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public QuerySwitch() { + if (modelPackage == null) { + modelPackage = QueryPackage.eINSTANCE; + } + } + + /** + * Calls <code>caseXXX</code> for each class of the model until one returns a non null result; it yields that result. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @return the first non-null result returned by a <code>caseXXX</code> call. + * @generated + */ + public T doSwitch(EObject theEObject) { + return doSwitch(theEObject.eClass(), theEObject); + } + + /** + * Calls <code>caseXXX</code> for each class of the model until one returns a non null result; it yields that result. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @return the first non-null result returned by a <code>caseXXX</code> call. + * @generated + */ + protected T doSwitch(EClass theEClass, EObject theEObject) { + if (theEClass.eContainer() == modelPackage) { + return doSwitch(theEClass.getClassifierID(), theEObject); + } + else { + List<EClass> eSuperTypes = theEClass.getESuperTypes(); + return + eSuperTypes.isEmpty() ? + defaultCase(theEObject) : + doSwitch(eSuperTypes.get(0), theEObject); + } + } + + /** + * Calls <code>caseXXX</code> for each class of the model until one returns a non null result; it yields that result. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @return the first non-null result returned by a <code>caseXXX</code> call. + * @generated + */ + protected T doSwitch(int classifierID, EObject theEObject) { + switch (classifierID) { + case QueryPackage.URI_IMAGE_QUERY: { + URIImageQuery uriImageQuery = (URIImageQuery)theEObject; + T result = caseURIImageQuery(uriImageQuery); + if (result == null) result = caseQuery(uriImageQuery); + if (result == null) result = defaultCase(theEObject); + return result; + } + default: return defaultCase(theEObject); + } + } + + /** + * Returns the result of interpreting the object as an instance of '<em>URI Image Query</em>'. + * <!-- begin-user-doc --> + * This implementation returns null; + * returning a non-null result will terminate the switch. + * <!-- end-user-doc --> + * @param object the target of the switch. + * @return the result of interpreting the object as an instance of '<em>URI Image Query</em>'. + * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) + * @generated + */ + public T caseURIImageQuery(URIImageQuery object) { + return null; + } + + /** + * Returns the result of interpreting the object as an instance of '<em>Query</em>'. + * <!-- begin-user-doc --> + * This implementation returns null; + * returning a non-null result will terminate the switch. + * <!-- end-user-doc --> + * @param object the target of the switch. + * @return the result of interpreting the object as an instance of '<em>Query</em>'. + * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) + * @generated + */ + public T caseQuery(Query object) { + return null; + } + + /** + * Returns the result of interpreting the object as an instance of '<em>EObject</em>'. + * <!-- begin-user-doc --> + * This implementation returns null; + * returning a non-null result will terminate the switch, but this is the last case anyway. + * <!-- end-user-doc --> + * @param object the target of the switch. + * @return the result of interpreting the object as an instance of '<em>EObject</em>'. + * @see #doSwitch(org.eclipse.emf.ecore.EObject) + * @generated + */ + public T defaultCase(EObject object) { + return null; + } + +} //QuerySwitch
diff --git a/org.eclipse.modisco.facet.custom.ui/META-INF/MANIFEST.MF b/org.eclipse.modisco.facet.custom.ui/META-INF/MANIFEST.MF index c92d84b..3afec0f 100644 --- a/org.eclipse.modisco.facet.custom.ui/META-INF/MANIFEST.MF +++ b/org.eclipse.modisco.facet.custom.ui/META-INF/MANIFEST.MF
@@ -3,7 +3,7 @@ Bundle-Name: %Bundle-Name Bundle-SymbolicName: org.eclipse.emf.facet.custom.ui;singleton:=true Bundle-Version: 1.3.0.qualifier -Bundle-Activator: org.eclipse.emf.facet.custom.ui.internal.Activator +Bundle-Activator: org.eclipse.modisco.facet.custom.ui.internal.Activator Bundle-Vendor: %Bundle-Vendor Require-Bundle: org.eclipse.ui, org.eclipse.core.runtime, @@ -19,9 +19,9 @@ org.eclipse.emf.facet.efacet.ui;bundle-version="1.1.0" Bundle-RequiredExecutionEnvironment: JavaSE-1.8 Bundle-ActivationPolicy: lazy -Export-Package: org.eclipse.emf.facet.custom.ui, - org.eclipse.emf.facet.custom.ui.internal.exported, - org.eclipse.emf.facet.custom.ui.internal.exported.dialog, - org.eclipse.emf.facet.custom.ui.internal.exported.exception +Export-Package: org.eclipse.modisco.facet.custom.ui, + org.eclipse.modisco.facet.custom.ui.internal.exported, + org.eclipse.modisco.facet.custom.ui.internal.exported.dialog, + org.eclipse.modisco.facet.custom.ui.internal.exported.exception Service-Component: OSGI-INF/component.xml Automatic-Module-Name: org.eclipse.emf.facet.custom.ui
diff --git a/org.eclipse.modisco.facet.custom.ui/plugin.xml b/org.eclipse.modisco.facet.custom.ui/plugin.xml index 7d675ae..79a70ca 100644 --- a/org.eclipse.modisco.facet.custom.ui/plugin.xml +++ b/org.eclipse.modisco.facet.custom.ui/plugin.xml
@@ -23,7 +23,7 @@ <extension point="org.eclipse.ui.views"> <view category="org.eclipse.emf.facet.common.ui.views" - class="org.eclipse.emf.facet.custom.ui.internal.view.CustomizationsCatalogView" + class="org.eclipse.modisco.facet.custom.ui.internal.view.CustomizationsCatalogView" icon="icons/uiCustom.gif" id="org.eclipse.emf.facet.custom.ui.view.catalog" name="%view.customizations" @@ -46,7 +46,7 @@ <extension point="org.eclipse.ui.handlers"> <handler - class="org.eclipse.emf.facet.custom.ui.internal.handler.LoadCustomizationsHandler" + class="org.eclipse.modisco.facet.custom.ui.internal.handler.LoadCustomizationsHandler" commandId="org.eclipse.emf.facet.ui.loadCustomization"> <enabledWhen> <with
diff --git a/org.eclipse.modisco.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/CustomizedContentProviderUtils.java b/org.eclipse.modisco.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/CustomizedContentProviderUtils.java deleted file mode 100644 index 6c8166b..0000000 --- a/org.eclipse.modisco.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/CustomizedContentProviderUtils.java +++ /dev/null
@@ -1,120 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2012, 2016 Mia-Software. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Nicolas Bros (Mia-Software) - Bug 379683 - customizable Tree content provider - * Nicolas Bros (Mia-Software) - Bug 380407 - Missing since tag on CustomizedContentProviderUtils - * Grégoire Dupé (Mia-Software) - Bug 506334 - Need to know which TreeElement has been updated - *******************************************************************************/ -package org.eclipse.emf.facet.custom.ui; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; - -import org.eclipse.core.runtime.Assert; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.EStructuralFeature; -import org.eclipse.emf.facet.custom.metamodel.v0_2_0.internal.treeproxy.EAttributeTreeElement; -import org.eclipse.emf.facet.custom.metamodel.v0_2_0.internal.treeproxy.EObjectTreeElement; -import org.eclipse.emf.facet.custom.metamodel.v0_2_0.internal.treeproxy.EReferenceTreeElement; -import org.eclipse.emf.facet.custom.metamodel.v0_2_0.internal.treeproxy.TreeElement; -import org.eclipse.jface.viewers.ISelection; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.jface.viewers.StructuredSelection; - -/** - * A companion utility class for {@link ICustomizedTreeContentProvider} - * - * @since 0.2 - */ -public final class CustomizedContentProviderUtils { - private CustomizedContentProviderUtils() { - // utility class - } - - /** - * Replace proxy objects by their underlying model elements in the given selection - * - * @return the unwrapped version of the selection - */ - public static ISelection resolveSelection(final ISelection selection) { - Assert.isNotNull(selection); - ISelection result; - if (selection instanceof IStructuredSelection) { - final IStructuredSelection strSelection = (IStructuredSelection) selection; - final List<Object> resolvedElements = new ArrayList<Object>(); - final Iterator<?> iterator = strSelection.iterator(); - while (iterator.hasNext()) { - final Object element = iterator.next(); - resolvedElements.add(resolve(element)); - } - result = new StructuredSelection(resolvedElements); - } else { - throw new IllegalArgumentException("Unhandled selection type: " + selection.getClass().getName()); //$NON-NLS-1$ - } - return result; - } - - /** - * Resolve the given UI element into the underlying model element. - * - * @param element - * a UI element, that may be a proxy for a model element - * @return the corresponding model element, or the given element if it is not a proxy - */ - public static Object resolve(final Object element) { - Object resolved = element; - if (element instanceof EObjectTreeElement) { - resolved = ((EObjectTreeElement) element).getEObject(); - } else if (element instanceof EAttributeTreeElement) { - resolved = ((EAttributeTreeElement) element).getEAttribute(); - } else if (element instanceof EReferenceTreeElement) { - resolved = ((EReferenceTreeElement) element).getEReference(); - } - return resolved; - } - - /** - * @since 1.2 - */ - public static EStructuralFeature getEStructuralFeature(final Object treeElt) { - EStructuralFeature result = null; - if (treeElt instanceof EReferenceTreeElement) { - final EReferenceTreeElement refTreeElt = (EReferenceTreeElement) treeElt; - result = refTreeElt.getEReference(); - } - return result; - } - - /** - * @since 1.2 - */ - public static EObject getParentEObject(final Object object) { - Object supposedTreeElt = null; - if (!(object instanceof EObjectTreeElement) - && (object instanceof TreeElement)) { - final TreeElement treeElt = (TreeElement) object; - supposedTreeElt = treeElt.getParent(); - } else { - supposedTreeElt = object; - } - return getEObject(supposedTreeElt); - } - - /** - * @since 1.2 - */ - public static EObject getEObject(final Object object) { - EObject result = null; - if (object instanceof EObjectTreeElement) { - final EObjectTreeElement eObjTreeElt = (EObjectTreeElement) object; - result = eObjTreeElt.getEObject(); - } - return result; - } -}
diff --git a/org.eclipse.modisco.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/IContentPropertiesHandler.java b/org.eclipse.modisco.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/IContentPropertiesHandler.java deleted file mode 100644 index db254e2..0000000 --- a/org.eclipse.modisco.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/IContentPropertiesHandler.java +++ /dev/null
@@ -1,30 +0,0 @@ -/** - * Copyright (c) 2012, 2014 Mia-Software. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Gregoire Dupe (Mia-Software) - Bug 369987 - [Restructuring][Table] Switch to the new customization and facet framework - * Gregoire Dupe (Mia-Software) - Bug 373078 - API Cleaning - * Gregoire Dupe (Mia-Software) - Bug 441570 - Children custom property - */ -package org.eclipse.emf.facet.custom.ui; - -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.FacetOperation; - -/** - * - * @since 0.2 - * @noextend This interface is not intended to be extended by clients. - * @noimplement This interface is not intended to be implemented by clients. - */ -public interface IContentPropertiesHandler { - FacetOperation getIsVisible(); - /** - * @since 1.0 - */ - FacetOperation getChildren(); -}
diff --git a/org.eclipse.modisco.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/IContentPropertiesHandlerFactory.java b/org.eclipse.modisco.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/IContentPropertiesHandlerFactory.java deleted file mode 100644 index 6ba0241..0000000 --- a/org.eclipse.modisco.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/IContentPropertiesHandlerFactory.java +++ /dev/null
@@ -1,30 +0,0 @@ -/** - * Copyright (c) 2012 Mia-Software. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Gregoire Dupe (Mia-Software) - Bug 369987 - [Restructuring][Table] Switch to the new customization and facet framework - * Gregoire Dupe (Mia-Software) - Bug 373078 - API Cleaning - */ -package org.eclipse.emf.facet.custom.ui; - -import org.eclipse.emf.facet.custom.core.ICustomizationManager; -import org.eclipse.emf.facet.custom.ui.internal.PropertiesHandlerFactory; - -/** - * - * @since 0.2 - * @noextend This interface is not intended to be extended by clients. - * @noimplement This interface is not intended to be implemented by clients. - */ -public interface IContentPropertiesHandlerFactory { - - IContentPropertiesHandlerFactory DEFAULT = new PropertiesHandlerFactory(); - - IContentPropertiesHandler createIContentPropertiesHandler( - ICustomizationManager customizationMgr); -}
diff --git a/org.eclipse.modisco.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/ICustomOverride.java b/org.eclipse.modisco.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/ICustomOverride.java deleted file mode 100644 index f0eccfe..0000000 --- a/org.eclipse.modisco.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/ICustomOverride.java +++ /dev/null
@@ -1,31 +0,0 @@ -/** - * Copyright (c) 2013 Soft-Maint. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * David Couvrand (Soft-Maint) - Bug 422058 - Implementation of strikethrough and underline in the CustomizedLabelProvider - */ -package org.eclipse.emf.facet.custom.ui; - -import org.eclipse.emf.facet.custom.core.ICustomizationManager; -import org.eclipse.emf.facet.custom.core.exception.CustomizationException; -import org.eclipse.swt.graphics.FontData; - -/** - * @since 0.4 - */ -public interface ICustomOverride { - - String getText(String result, Object object, - ICustomizationManager customManager, - IFontPropertiesHandler propertiesHandler) throws CustomizationException; - - FontData getFont(FontData fontData, Object object, - ICustomizationManager customManager, - IFontPropertiesHandler propertiesHandler) throws CustomizationException; - -}
diff --git a/org.eclipse.modisco.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/ICustomizationManagerProvider2.java b/org.eclipse.modisco.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/ICustomizationManagerProvider2.java deleted file mode 100644 index 2a2c1ae..0000000 --- a/org.eclipse.modisco.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/ICustomizationManagerProvider2.java +++ /dev/null
@@ -1,35 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2015 Mia-Software - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Thomas Cicognani (Mia-Software) - Bug 472075 - Update API to create UI shortcuts to activate FacetSets - *******************************************************************************/ -package org.eclipse.emf.facet.custom.ui; - -import java.util.List; - -import org.eclipse.emf.facet.custom.core.ICustomizationManagerProvider; -import org.eclipse.emf.facet.custom.metamodel.v0_2_0.custom.Customization; -import org.eclipse.jface.resource.ImageDescriptor; - -/** - * @since 1.1 - */ -public interface ICustomizationManagerProvider2 extends - ICustomizationManagerProvider { - - interface ICustomShortcut { - Customization getCustom(); - - String getLabel(); - - ImageDescriptor getIcon(); - } - - List<ICustomShortcut> getCustomShortcuts(); - -}
diff --git a/org.eclipse.modisco.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/ICustomizedContentProviderFactory.java b/org.eclipse.modisco.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/ICustomizedContentProviderFactory.java deleted file mode 100644 index 4712fad..0000000 --- a/org.eclipse.modisco.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/ICustomizedContentProviderFactory.java +++ /dev/null
@@ -1,59 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2011, 2016 Mia-Software. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Gregoire Dupe (Mia-Software) - Bug 361794 - [Restructuring] New customization meta-model - * Gregoire Dupe (Mia-Software) - Bug 373078 - API Cleaning - * Nicolas Bros (Mia-Software) - Bug 379683 - customizable Tree content provider - * Grégoire Dupé (Mia-Software) - Bug 506334 - Need to know which TreeElement has been updated - *******************************************************************************/ - -package org.eclipse.emf.facet.custom.ui; - -import org.eclipse.emf.facet.custom.core.ICustomizationManager; -import org.eclipse.emf.facet.custom.ui.internal.CustomizedContentProviderFactory; -import org.eclipse.jface.viewers.IContentProvider; - -/** - * This is a factory for {@link ICustomizedContentProvider} and {@link ICustomizedTreeContentProvider}. - * - * @author Gregoire Dupe - * @noextend This interface is not intended to be extended by clients. - * @noimplement This interface is not intended to be implemented by clients. - * - */ -public interface ICustomizedContentProviderFactory { - /** - * The default factory instance - */ - ICustomizedContentProviderFactory DEFAULT = new CustomizedContentProviderFactory(); - - /** - * Instantiate an {@link ICustomizedTreeContentProvider}. With this content provider, your viewer's input has to be - * an EObject or an array or collection of EObjects.F - * - * @param customManager - * the customization manager used by the content provider - * @return a tree content provider - * @since 0.2 - */ - ICustomizedTreeContentProvider createCustomizedTreeContentProvider(ICustomizationManager customManager); - - /** - * @since 1.2 - */ - IContentProvider createCustomizedTreeContentProvider( - ICustomizationManager customManager, IContentListener iContentUpdate); - - /** - * @since 1.2 - * @noextend This interface is not intended to be extended by clients. - */ - interface IContentListener { - void onUpdate(Object object); - } -}
diff --git a/org.eclipse.modisco.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/ICustomizedLabelProvider.java b/org.eclipse.modisco.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/ICustomizedLabelProvider.java deleted file mode 100644 index bf76dbc..0000000 --- a/org.eclipse.modisco.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/ICustomizedLabelProvider.java +++ /dev/null
@@ -1,72 +0,0 @@ -/** - * Copyright (c) 2011, 2017 Mia-Software. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Gregoire Dupe (Mia-Software) - Bug 361794 - [Restructuring] New customization meta-model - * Gregoire Dupe (Mia-Software) - Bug 369987 - [Restructuring][Table] Switch to the new customization and facet framework - * Vincent Lorenzo (CEA-LIST) - Bug 372644 - Create Customizable tooltips for the TreeViewer using a CustomizableLabelProvider - * Gregoire Dupe (Mia-Software) - Bug 373078 - API Cleaning - * Thomas Cicognani (Mia-Software) - Bug 513070 - NatTable and customization: cannot change background from columns - */ -package org.eclipse.emf.facet.custom.ui; - -import org.eclipse.emf.ecore.ETypedElement; -import org.eclipse.emf.facet.custom.core.ICustomizationManager; -import org.eclipse.jface.viewers.IColorProvider; -import org.eclipse.jface.viewers.IFontProvider; -import org.eclipse.jface.viewers.ILabelProvider; -import org.eclipse.swt.graphics.Color; -import org.eclipse.swt.graphics.Image; - -/** - * This interface allows to use a {@link ILabelProvider}, an - * {@link IColorProvider} and an {@link IFontProvider} which is implemented and - * customizable using the EMF Facet customization mechanism. - * - * @author Gregoire Dupe - * @noextend This interface is not intended to be extended by clients. - * @noimplement This interface is not intended to be implemented by clients. - */ -public interface ICustomizedLabelProvider extends ILabelProvider, - IColorProvider, IFontProvider , ICustomizedToolTipLabelProvider { - /** - * This method returns the customization manager used by the label provider. The - * customization stack updates have to be done using this - * {@link ICustomizationManager}. - * - * @return the customization manager used by the content provider. - */ - ICustomizationManager getCustomizationManager(); - - boolean isUnderlined(Object element, ETypedElement eTypedElement); - - boolean isStruckthrough(Object element, ETypedElement eTypedElement); - - Image getTopLeftOverlay(Object element, ETypedElement eTypedElement); - Image getTopMiddleOverlay(Object element, ETypedElement eTypedElement); - Image getTopRightOverlay(Object element, ETypedElement eTypedElement); - - Image getBottomLeftOverlay(Object element, ETypedElement eTypedElement); - Image getBottomMiddleOverlay(Object element, ETypedElement eTypedElement); - Image getBottomRightOverlay(Object element, ETypedElement eTypedElement); - - String getText(Object element, ETypedElement eTypedElement); - - Image getImage(Object element, ETypedElement eTypedElement); - - /** - * @since 0.2 - */ - ICustomizedLabelProvider cloneLabelProvider(); - - /** - * @since 1.2 - */ - Color getBackground(Object element, ETypedElement eTypedElement); - -}
diff --git a/org.eclipse.modisco.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/ICustomizedLabelProviderFactory.java b/org.eclipse.modisco.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/ICustomizedLabelProviderFactory.java deleted file mode 100644 index 0889357..0000000 --- a/org.eclipse.modisco.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/ICustomizedLabelProviderFactory.java +++ /dev/null
@@ -1,39 +0,0 @@ -/** - * Copyright (c) 2011 Mia-Software. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Gregoire Dupe (Mia-Software) - Bug 361794 - [Restructuring] New customization meta-model - * Gregoire Dupe (Mia-Software) - Bug 373078 - API Cleaning - */ -package org.eclipse.emf.facet.custom.ui; - -import org.eclipse.emf.facet.custom.core.ICustomizationManager; -import org.eclipse.emf.facet.custom.ui.internal.CustomizedLabelProviderFactory; - -/** - * This class is the factory allowing to get a instance of - * {@link ICustomizedLabelProvider}. - * - * @author Gregoire Dupe - * @noextend This interface is not intended to be extended by clients. - * @noimplement This interface is not intended to be implemented by clients. - */ -public interface ICustomizedLabelProviderFactory { - ICustomizedLabelProviderFactory DEFAULT = new CustomizedLabelProviderFactory(); - - /** - * This method is used to instantiate a {@link ICustomizedLabelProvider}. - * - * @param customizationManager - * the customization manager which has to used by the content - * provider. - * @return a label provider - */ - ICustomizedLabelProvider createCustomizedLabelProvider( - ICustomizationManager customizationMgr); -}
diff --git a/org.eclipse.modisco.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/ICustomizedToolTipLabelProvider.java b/org.eclipse.modisco.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/ICustomizedToolTipLabelProvider.java deleted file mode 100644 index 4b82620..0000000 --- a/org.eclipse.modisco.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/ICustomizedToolTipLabelProvider.java +++ /dev/null
@@ -1,68 +0,0 @@ -/** - * Copyright (c) 2012 CEA LIST. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Vincent Lorenzo (CEA-LIST) - Bug 372644 - Create Customizable tooltips for the TreeViewer using a CustomizableLabelProvider - * Gregoire Dupe (Mia-Software) - Bug 373078 - API Cleaning - */ -package org.eclipse.emf.facet.custom.ui; - -import org.eclipse.emf.ecore.ETypedElement; -import org.eclipse.jface.viewers.ViewerCell; -import org.eclipse.swt.graphics.Color; -import org.eclipse.swt.graphics.Font; -import org.eclipse.swt.graphics.Image; - -/** - * - * This interface provides methods to customize tooltips - * - * @noextend This interface is not intended to be extended by clients. - * @noimplement This interface is not intended to be implemented by clients. - */ -public interface ICustomizedToolTipLabelProvider { - - void update(ViewerCell cell); - - String getToolTipText(Object element, ETypedElement eTypedElement); - - Image getToolTipImage(Object element, ETypedElement eTypedElement); - - Font getToolTipFont(Object element, ETypedElement eTypedElement); - - Color getToolTipBackgroundColor(Object element, ETypedElement eTypedElement); - - Color getToolTipForegroundColor(Object element, ETypedElement eTypedElement); - - Image getToolTipTopLeftOverlay(Object element, ETypedElement eTypedElement); - - Image getToolTipTopMiddleOverlay(Object element, ETypedElement eTypedElement); - - Image getToolTipTopRightOverlay(Object element, ETypedElement eTypedElement); - - Image getToolTipBottomLeftOverlay(Object element, - ETypedElement eTypedElement); - - Image getToolTipBottomMiddleOverlay(Object element, - ETypedElement eTypedElement); - - Image getToolTipBottomRightOverlay(Object element, - ETypedElement eTypedElement); - - int getToolTipTimeDisplayed(Object element, ETypedElement eTypedElement); - - int getToolTipDisplayDelayTime(Object element, ETypedElement eTypedElement); - - /** - * The style can be : SWT.LEFT, SWT.CENTER, SWT.RIGHT, SWT.SHADOW_IN, SWT.SHADOW_OUT, SWT.SHADOW_NONE. - * - * @param element - * @return - */ - int getToolTipStyle(Object element, ETypedElement eTypedElement); -}
diff --git a/org.eclipse.modisco.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/ICustomizedTreeContentProvider.java b/org.eclipse.modisco.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/ICustomizedTreeContentProvider.java deleted file mode 100644 index 753c29f..0000000 --- a/org.eclipse.modisco.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/ICustomizedTreeContentProvider.java +++ /dev/null
@@ -1,31 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2012 Mia-Software. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Nicolas Bros (Mia-Software) - Bug 379683 - customizable Tree content provider - *******************************************************************************/ -package org.eclipse.emf.facet.custom.ui; - -import org.eclipse.emf.facet.custom.core.ICustomizationManager; -import org.eclipse.jface.viewers.ITreeContentProvider; - -/** - * An {@link ITreeContentProvider} which is implemented and customizable using the EMF Facet customization mechanisms. - * - * @noextend This interface is not intended to be extended by clients. - * @noimplement This interface is not intended to be implemented by clients. - * @since 0.2 - */ -public interface ICustomizedTreeContentProvider extends ITreeContentProvider { - /** - * This method returns the customization manager used by the content provider. Updates to the list of loaded - * customizations have to be done using the {@link ICustomizationManager} returned by this method. - * - * @return the customization manager used by this content provider. - */ - ICustomizationManager getCustomizationManager(); -}
diff --git a/org.eclipse.modisco.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/IFontPropertiesHandler.java b/org.eclipse.modisco.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/IFontPropertiesHandler.java deleted file mode 100644 index 4fc6edc..0000000 --- a/org.eclipse.modisco.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/IFontPropertiesHandler.java +++ /dev/null
@@ -1,40 +0,0 @@ -/** - * Copyright (c) 2013 Soft-Maint. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * David Couvrand (Soft-Maint) - Bug 422058 - Implementation of strikethrough and underline in the CustomizedLabelProvider - */ -package org.eclipse.emf.facet.custom.ui; - -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.FacetOperation; - -/** - * @since 0.4 - * @noimplement This interface is not intended to be implemented by clients. - * @noextend This interface is not intended to be extended by clients. - */ -public interface IFontPropertiesHandler { - - FacetOperation getBackgroundProperty(); - - FacetOperation getForegroundProperty(); - - FacetOperation getFontNameProperty(); - - FacetOperation getFontSizeProperty(); - - FacetOperation getIsBoldProperty(); - - FacetOperation getIsItalicProperty(); - - FacetOperation getIsVisible(); - - FacetOperation getIsUnderlinedProperty(); - - FacetOperation getIsStruckthroughProperty(); -}
diff --git a/org.eclipse.modisco.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/IResolvingCustomizedLabelProviderFactory.java b/org.eclipse.modisco.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/IResolvingCustomizedLabelProviderFactory.java deleted file mode 100644 index c6982ac..0000000 --- a/org.eclipse.modisco.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/IResolvingCustomizedLabelProviderFactory.java +++ /dev/null
@@ -1,35 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2012 Mia-Software. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Nicolas Bros (Mia-Software) - Bug 379683 - customizable Tree content provider - *******************************************************************************/ -package org.eclipse.emf.facet.custom.ui; - -import org.eclipse.emf.facet.custom.core.ICustomizationManager; -import org.eclipse.emf.facet.custom.ui.internal.ResolvingCustomizedLabelProviderFactory; - -/** - * A factory to create instances of {@link ICustomizedLabelProvider} that work on proxy UI elements, by customizing the - * resolved elements. - * - * @noextend This interface is not intended to be extended by clients. - * @noimplement This interface is not intended to be implemented by clients. - * @since 0.2 - */ -public interface IResolvingCustomizedLabelProviderFactory { - IResolvingCustomizedLabelProviderFactory DEFAULT = new ResolvingCustomizedLabelProviderFactory(); - - /** - * This method is used to instantiate a {@link ICustomizedLabelProvider}. - * - * @param customizationManager - * the customization manager which has to used by the content provider. - * @return a label provider - */ - ICustomizedLabelProvider createCustomizedLabelProvider(ICustomizationManager customizationMgr); -}
diff --git a/org.eclipse.modisco.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/ISelectionPropertiesHandler.java b/org.eclipse.modisco.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/ISelectionPropertiesHandler.java deleted file mode 100644 index 746db07..0000000 --- a/org.eclipse.modisco.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/ISelectionPropertiesHandler.java +++ /dev/null
@@ -1,24 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2012 Mia-Software. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Nicolas Bros (Mia-Software) - Bug 377866 - selection customization - *******************************************************************************/ -package org.eclipse.emf.facet.custom.ui; - -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.FacetOperation; - -/** - * - * @since 0.2 - * @noextend This interface is not intended to be extended by clients. - * @noimplement This interface is not intended to be implemented by clients. - */ -public interface ISelectionPropertiesHandler { - /** This customization property returns the selection for a given source EObject and a given ETypedElement parameter */ - FacetOperation getSelectionProperty(); -}
diff --git a/org.eclipse.modisco.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/ISelectionPropertiesHandlerFactory.java b/org.eclipse.modisco.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/ISelectionPropertiesHandlerFactory.java deleted file mode 100644 index 704c14f..0000000 --- a/org.eclipse.modisco.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/ISelectionPropertiesHandlerFactory.java +++ /dev/null
@@ -1,29 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2012 Mia-Software. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Nicolas Bros (Mia-Software) - Bug 377866 - selection customization - *******************************************************************************/ -package org.eclipse.emf.facet.custom.ui; - -import org.eclipse.emf.facet.custom.core.ICustomizationManager; -import org.eclipse.emf.facet.custom.ui.internal.PropertiesHandlerFactory; - -/** - * Factory for {@link ISelectionPropertiesHandler} - * - * @since 0.2 - * @noextend This interface is not intended to be extended by clients. - * @noimplement This interface is not intended to be implemented by clients. - */ -public interface ISelectionPropertiesHandlerFactory { - - ISelectionPropertiesHandlerFactory DEFAULT = new PropertiesHandlerFactory(); - - ISelectionPropertiesHandler createSelectionPropertiesHandler( - ICustomizationManager customManager); -}
diff --git a/org.eclipse.modisco.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/ImageUtils.java b/org.eclipse.modisco.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/ImageUtils.java deleted file mode 100644 index 23886e8..0000000 --- a/org.eclipse.modisco.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/ImageUtils.java +++ /dev/null
@@ -1,57 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2012 CEA LIST. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Gregoire Dupe (Mia-Software) - Bug 374941 - To be able to customize overlay icons on EClass - * Nicolas Bros (Mia-Software) - Bug 375388 - Cell editor for IImage - * Nicolas Rault (Soft-Maint) - Bug 412565 - Need an URIImage Constructor - *******************************************************************************/ -package org.eclipse.emf.facet.custom.ui; - -import org.eclipse.emf.facet.custom.metamodel.custompt.IImage; -import org.eclipse.emf.facet.custom.ui.internal.custompt.ImageWrapper; -import org.eclipse.emf.facet.custom.ui.internal.custompt.URIImage; -import org.eclipse.swt.graphics.Image; - -/** - * @since 0.2 - */ -public final class ImageUtils { - - private ImageUtils() { - // Must not be used - } - - /** Creates an {@link IImage} that wraps the given SWT {@link Image} */ - public static IImage wrap(final Image image) { - return new ImageWrapper(image); - } - - /** - * Returns the SWT {@link Image} represented by this {@link IImage} - * - * @param image - * the image to unwrap - * @return the SWT image, or <code>null</code> if the {@link IImage} doesn't wrap a SWT image - */ - public static Image unwrap(final IImage image) { - Image result = null; - if (image instanceof ImageWrapper) { - final ImageWrapper imageWrapper = (ImageWrapper) image; - result = imageWrapper.getImage(); - } - return result; - } - - /** - * Creates an {@link IImage} that wraps the given uri - * @since 0.4 - */ - public static IImage wrap(final String uri) { - return new URIImage(uri); - } -}
diff --git a/org.eclipse.modisco.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/LoadCustomShortcutsMenuUtils.java b/org.eclipse.modisco.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/LoadCustomShortcutsMenuUtils.java deleted file mode 100644 index 485b5b5..0000000 --- a/org.eclipse.modisco.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/LoadCustomShortcutsMenuUtils.java +++ /dev/null
@@ -1,78 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2015 Mia-Software - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Thomas Cicognani (Mia-Software) - Bug 472075 - Update API to create UI shortcuts to activate FacetSets - * Grégoire Dupé (Mia-Software) - Bug 472075 - Update API to create UI shortcuts to activate FacetSets - *******************************************************************************/ -package org.eclipse.emf.facet.custom.ui; - -import java.util.ArrayList; -import java.util.List; - -import org.eclipse.emf.facet.custom.core.ICustomizationManager; -import org.eclipse.emf.facet.custom.metamodel.v0_2_0.custom.Customization; -import org.eclipse.emf.facet.custom.ui.ICustomizationManagerProvider2.ICustomShortcut; -import org.eclipse.emf.facet.custom.ui.internal.action.ShortcutCustomAction; -import org.eclipse.emf.facet.efacet.ui.LoadFacetSetShortcutsMenuUtils; -import org.eclipse.jface.action.Action; -import org.eclipse.jface.action.ActionContributionItem; -import org.eclipse.jface.action.IContributionItem; - -/** - * @since 1.1 - * @noinstantiate This class is not intended to be instantiated by clients. - */ -public final class LoadCustomShortcutsMenuUtils { - - private LoadCustomShortcutsMenuUtils() { - // NOT TO BE USED - } - - public static IContributionItem[] getCustomItemsFromCurrentPart() { - final ICustomizationManagerProvider2 customMgrPrv = LoadFacetSetShortcutsMenuUtils - .getProviderFromCurrentPart(ICustomizationManagerProvider2.class); - return getCustomItems(customMgrPrv); - } - - public static IContributionItem[] getCustomItemsFromCurrentEditor() { - final ICustomizationManagerProvider2 customMgrPrv = LoadFacetSetShortcutsMenuUtils - .getProviderFromCurrentEditor(ICustomizationManagerProvider2.class); - return getCustomItems(customMgrPrv); - } - - private static IContributionItem[] getCustomItems( - final ICustomizationManagerProvider2 customMgrPrv) { - final List<IContributionItem> menuList = new ArrayList<IContributionItem>(); - if (customMgrPrv != null) { - final List<ICustomShortcut> shortcuts = customMgrPrv - .getCustomShortcuts(); - final ICustomizationManager customManager = customMgrPrv - .getCustomizationManager(); - for (ICustomShortcut shortcut : shortcuts) { - final ActionContributionItem action = createCustomMenuItem( - shortcut, customManager); - menuList.add(action); - } - } - return menuList.toArray(new IContributionItem[menuList.size()]); - } - - private static ActionContributionItem createCustomMenuItem( - final ICustomShortcut shortcut, - final ICustomizationManager customManager) { - final Customization custom = shortcut.getCustom(); - final String customId = custom.getName(); - final Action action = new ShortcutCustomAction(customId, - shortcut.getLabel(), shortcut.getIcon(), customManager); - final List<Customization> activeCustoms = customManager - .getManagedCustomizations(); - return LoadFacetSetShortcutsMenuUtils.createMenuItem(customId, - activeCustoms, action); - } - -}
diff --git a/org.eclipse.modisco.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/internal/Activator.java b/org.eclipse.modisco.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/internal/Activator.java deleted file mode 100644 index 5d631fd..0000000 --- a/org.eclipse.modisco.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/internal/Activator.java +++ /dev/null
@@ -1,63 +0,0 @@ -/** - * Copyright (c) 2011 Mia-Software. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Gregoire Dupe (Mia-Software) - Bug 361794 - [Restructuring] New customization meta-model - */ -package org.eclipse.emf.facet.custom.ui.internal; - -import org.eclipse.ui.plugin.AbstractUIPlugin; -import org.osgi.framework.BundleContext; - -/** - * The activator class controls the plug-in life cycle - */ -public class Activator extends AbstractUIPlugin { - - // The plug-in ID - public static final String PLUGIN_ID = "org.eclipse.emf.facet.custom.ui"; //$NON-NLS-1$ - - // The shared instance - private static Activator plugin; - - /** - * The constructor - */ - public Activator() { - } - - /* - * (non-Javadoc) - * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext) - */ - @Override - public void start(final BundleContext context) throws Exception { - super.start(context); - Activator.plugin = this; - } - - /* - * (non-Javadoc) - * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext) - */ - @Override - public void stop(final BundleContext context) throws Exception { - Activator.plugin = null; - super.stop(context); - } - - /** - * Returns the shared instance - * - * @return the shared instance - */ - public static Activator getDefault() { - return Activator.plugin; - } - -}
diff --git a/org.eclipse.modisco.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/internal/CustomizationCommandFactory.java b/org.eclipse.modisco.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/internal/CustomizationCommandFactory.java deleted file mode 100644 index 87922a6..0000000 --- a/org.eclipse.modisco.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/internal/CustomizationCommandFactory.java +++ /dev/null
@@ -1,247 +0,0 @@ -/** - * Copyright (c) 2012 Mia-Software. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Gregoire Dupe (Mia-Software) - Bug 369987 - [Restructuring][Table] Switch to the new customization and facet framework - * Gregoire Dupe (Mia-Software) - Bug 373078 - API Cleaning - * Nicolas Bros (Mia-Software) - Bug 378271 - [Table] Select Columns To Hide is broken - */ -package org.eclipse.emf.facet.custom.ui.internal; - -import org.eclipse.emf.common.command.Command; -import org.eclipse.emf.common.command.CompoundCommand; -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.ecore.EParameter; -import org.eclipse.emf.ecore.ETypedElement; -import org.eclipse.emf.ecore.EcoreFactory; -import org.eclipse.emf.ecore.EcorePackage; -import org.eclipse.emf.edit.domain.EditingDomain; -import org.eclipse.emf.facet.custom.metamodel.v0_2_0.custom.CustomFactory; -import org.eclipse.emf.facet.custom.metamodel.v0_2_0.custom.CustomPackage; -import org.eclipse.emf.facet.custom.metamodel.v0_2_0.custom.Customization; -import org.eclipse.emf.facet.custom.metamodel.v0_2_0.custom.EClassCustomization; -import org.eclipse.emf.facet.custom.metamodel.v0_2_0.custom.ETypedElementCase; -import org.eclipse.emf.facet.custom.metamodel.v0_2_0.custom.ETypedElementSwitchQuery; -import org.eclipse.emf.facet.custom.metamodel.v0_2_0.custom.FacetCustomization; -import org.eclipse.emf.facet.custom.ui.internal.exception.CustomizationEditRuntimeException; -import org.eclipse.emf.facet.custom.ui.internal.exported.ICustomizationCommandFactory; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.EFacetFactory; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.EFacetPackage; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.Facet; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.FacetAttribute; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.FacetOperation; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.extensible.Query; -import org.eclipse.emf.facet.util.emf.core.command.ICommandFactoryResult; -import org.eclipse.emf.facet.util.emf.core.command.ICommandFactoryResultFactory; -import org.eclipse.emf.facet.util.emf.core.internal.exported.ICommandFactory; - -public class CustomizationCommandFactory implements ICustomizationCommandFactory { - - private static final String CONFORM_ATT_NAME = "isConforming"; //$NON-NLS-1$ - private final EditingDomain editingDomain; - private final ICommandFactory commandFactory; - - public CustomizationCommandFactory(final EditingDomain editingDomain, final ICommandFactory commandFactory) { - this.editingDomain = editingDomain; - this.commandFactory = commandFactory; - } - - public ICommandFactoryResult<EClassCustomization> createEClassCustomization( - final Customization customization, final EClass customedEClass, - final Query conformanceQuery) { - final EClassCustomization eClassCustom = CustomFactory.eINSTANCE.createEClassCustomization(); - final CompoundCommand resultCmd = new CompoundCommand( - "Create one instance of EClassCustomization for " + customedEClass.getName()); //$NON-NLS-1$ - final Command linkToContainer = this.commandFactory - .createAddCommand( - this.editingDomain, - customization, - EcorePackage.eINSTANCE - .getEPackage_EClassifiers(), - eClassCustom); - resultCmd.append(linkToContainer); - final Command linkToEClass = this.commandFactory - .createSetCommand( - this.editingDomain, - eClassCustom, - EFacetPackage.eINSTANCE - .getFacet_ExtendedMetaclass(), - customedEClass); - resultCmd.append(linkToEClass); - if (conformanceQuery != null) { - final ICommandFactoryResult<FacetAttribute> attResult = createConformanceOperation(eClassCustom, conformanceQuery); - resultCmd.append(attResult.getCommand()); - } - - return ICommandFactoryResultFactory.DEFAULT.createCommandFactoryResult(resultCmd, eClassCustom); - } - - //TODO Move to FacetCommandFactory - private ICommandFactoryResult<FacetAttribute> createConformanceOperation(final Facet facet, final Query query) { - final CompoundCommand resultCmd = new CompoundCommand("Creates a facet conformance attribute"); //$NON-NLS-1$ - final FacetAttribute conformanceAtt = EFacetFactory.eINSTANCE.createFacetAttribute(); - conformanceAtt.setName(CustomizationCommandFactory.CONFORM_ATT_NAME); - conformanceAtt.setEType(EcorePackage.eINSTANCE.getEBoolean()); - conformanceAtt.setQuery(query); - conformanceAtt.setDerived(true); - - final Command conformance = this.commandFactory.createSetCommand(this.editingDomain, facet, EFacetPackage.eINSTANCE.getFacet_ConformanceTypedElement(), conformanceAtt); - resultCmd.append(conformance); - final Command addToFacet = this.commandFactory.createAddCommand(this.editingDomain, facet, EFacetPackage.eINSTANCE.getFacet_FacetElements(), conformanceAtt); - resultCmd.append(addToFacet); - return ICommandFactoryResultFactory.DEFAULT.createCommandFactoryResult(resultCmd, conformanceAtt); - } - - public ICommandFactoryResult<FacetCustomization> createFacetCustomization( - final Customization customization, final Facet customizedFacet) { - final FacetCustomization eFacetCustom = CustomFactory.eINSTANCE.createFacetCustomization(); - final CompoundCommand resultCmd = new CompoundCommand( - "Create one instance of FacetCustomization for " + customizedFacet.getName()); //$NON-NLS-1$ - final Command linkToContainer = this.commandFactory - .createAddCommand(this.editingDomain, customization, - EcorePackage.eINSTANCE.getEPackage_EClassifiers(), - eFacetCustom); - resultCmd.append(linkToContainer); - final Command linkToFacet = this.commandFactory - .createAddCommand( - this.editingDomain, - customization, - CustomPackage.eINSTANCE - .getFacetCustomization_CustomizedFacet(), - customizedFacet); - resultCmd.append(linkToFacet); - return ICommandFactoryResultFactory.DEFAULT.createCommandFactoryResult(resultCmd, eFacetCustom); - } - - public ICommandFactoryResult<Facet> setPropertyConfig( - final Facet typeCustomization, - final ETypedElement customizedTElt, // customized typed element - final FacetOperation customProperty, final Query query) { - final CompoundCommand resultCmd = new CompoundCommand( - "Set the value of the customization property '" + customProperty.getName() + "'"); //$NON-NLS-1$ //$NON-NLS-2$ - FacetOperation fOpToModifiy = null; // Facet operation to modify - for (FacetOperation facetOperation : typeCustomization - .getFacetOperations()) { - if (facetOperation.getOverride().equals(customProperty)) { - fOpToModifiy = facetOperation; - } - } - if (fOpToModifiy == null) { - createPropertySetting(typeCustomization, customizedTElt, - customProperty, query, resultCmd); - } else { - final Query fOpQuery = fOpToModifiy.getQuery(); - if (fOpQuery instanceof ETypedElementSwitchQuery) { - final ETypedElementSwitchQuery switchQuery = (ETypedElementSwitchQuery) fOpQuery; - final Command setCase = setOrCreateETypedElementCase(switchQuery, customizedTElt, query); - resultCmd.append(setCase); - } else { - throw new CustomizationEditRuntimeException(); - } - } - return ICommandFactoryResultFactory.DEFAULT.createCommandFactoryResult(resultCmd, typeCustomization); - } - - private void createPropertySetting( - final Facet typeCustomization, - final ETypedElement customizedTElt, - final FacetOperation customProperty, final Query query, - final CompoundCommand resultCmd) { - FacetOperation facetOperation = EFacetFactory.eINSTANCE.createFacetOperation(); - // link the instance of FacetOperation to its parent - final Command linkFOpToParent = this.commandFactory.createAddCommand( - this.editingDomain, typeCustomization, - EFacetPackage.eINSTANCE.getFacet_FacetOperations(), - facetOperation); - resultCmd.append(linkFOpToParent); - // Link the instance of FacetOperation to the overridden custom property operation. - final Command linkToOverride = this.commandFactory.createSetCommand( - this.editingDomain, facetOperation, - EFacetPackage.eINSTANCE.getDerivedTypedElement_Override(), - customProperty); - resultCmd.append(linkToOverride); - facetOperation.setName(customProperty.getName()); - facetOperation.setEType(customProperty.getEType()); - facetOperation.setLowerBound(customProperty.getLowerBound()); - facetOperation.setUpperBound(customProperty.getUpperBound()); - - // add the "eStructuralFeature" EParameter that every customization operation must have - final EParameter eParameter = EcoreFactory.eINSTANCE.createEParameter(); - eParameter.setName("eStructuralFeature"); //$NON-NLS-1$ - eParameter.setEType(EcorePackage.eINSTANCE.getETypedElement()); - facetOperation.getEParameters().add(eParameter); - - final ETypedElementSwitchQuery switchQuery = CustomFactory.eINSTANCE.createETypedElementSwitchQuery(); - // Link the instance of ETypedElementSwitchQuery to its parent - final Command switchToParent = this.commandFactory - .createSetCommand(this.editingDomain, facetOperation, - EFacetPackage.eINSTANCE - .getDerivedTypedElement_Query(), - switchQuery); - resultCmd.append(switchToParent); - final Command setCase = setOrCreateETypedElementCase(switchQuery, customizedTElt, query); - resultCmd.append(setCase); - } - - private Command setOrCreateETypedElementCase( - final ETypedElementSwitchQuery switchQuery, - final ETypedElement customizedTElt, final Query query) { - final CompoundCommand resultCmd = new CompoundCommand("Set or create an instance of ETypedElementCase"); //$NON-NLS-1$ - ETypedElementCase caseToModify = getCaseByETypedElement(switchQuery, customizedTElt); - if (caseToModify == null) { - caseToModify = CustomFactory.eINSTANCE.createETypedElementCase(); - final Command linkToParent = this.commandFactory.createAddCommand( - this.editingDomain, switchQuery, - CustomPackage.eINSTANCE.getETypedElementSwitchQuery_Cases(), - caseToModify); - resultCmd.append(linkToParent); - } - final Command setCase = this.commandFactory.createSetCommand( - this.editingDomain, caseToModify, - CustomPackage.eINSTANCE.getETypedElementCase_Case(), - customizedTElt); - resultCmd.append(setCase); - final Command setQuery = this.commandFactory.createSetCommand( - this.editingDomain, caseToModify, - CustomPackage.eINSTANCE.getETypedElementCase_Value(), - query); - resultCmd.append(setQuery); - return resultCmd; - } - - private static ETypedElementCase getCaseByETypedElement( - final ETypedElementSwitchQuery switchQuery, - final ETypedElement customizedTElt) { - ETypedElementCase caseToModify = null; - for (ETypedElementCase casee : switchQuery.getCases()) { - //casee has to be null if we want to customize the EObject itself. - if (casee.getCase() == null) { - if (customizedTElt == null) { - caseToModify = casee; - } - } else { - if (casee.getCase().equals(customizedTElt)) { - caseToModify = casee; - break; - } - } - } - return caseToModify; - } - - public ICommandFactoryResult<Customization> createCustomization( - final String name) { - final Customization customization = CustomFactory.eINSTANCE - .createCustomization(); - final Command setName = this.commandFactory.createSetCommand( - this.editingDomain, customization, - EcorePackage.eINSTANCE.getENamedElement_Name(), name); - return ICommandFactoryResultFactory.DEFAULT.createCommandFactoryResult(setName, customization); - } - -}
diff --git a/org.eclipse.modisco.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/internal/CustomizationCommandFactoryFactory.java b/org.eclipse.modisco.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/internal/CustomizationCommandFactoryFactory.java deleted file mode 100644 index 6bb53aa..0000000 --- a/org.eclipse.modisco.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/internal/CustomizationCommandFactoryFactory.java +++ /dev/null
@@ -1,29 +0,0 @@ -/** - * Copyright (c) 2012 Mia-Software. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Gregoire Dupe (Mia-Software) - Bug 369987 - [Restructuring][Table] Switch to the new customization and facet framework - * Gregoire Dupe (Mia-Software) - Bug 373078 - API Cleaning - */ -package org.eclipse.emf.facet.custom.ui.internal; - -import org.eclipse.emf.edit.domain.EditingDomain; -import org.eclipse.emf.facet.custom.ui.internal.exported.ICustomizationCommandFactory; -import org.eclipse.emf.facet.custom.ui.internal.exported.ICustomizationCommandFactoryFactory; -import org.eclipse.emf.facet.util.emf.core.internal.exported.ICommandFactory; - -public class CustomizationCommandFactoryFactory implements - ICustomizationCommandFactoryFactory { - - public ICustomizationCommandFactory createCustomizationCommandFactory( - final EditingDomain editingDomain, - final ICommandFactory commandFactory) { - return new CustomizationCommandFactory(editingDomain, commandFactory); - } - -}
diff --git a/org.eclipse.modisco.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/internal/CustomizedContentProviderFactory.java b/org.eclipse.modisco.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/internal/CustomizedContentProviderFactory.java deleted file mode 100644 index f14586f..0000000 --- a/org.eclipse.modisco.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/internal/CustomizedContentProviderFactory.java +++ /dev/null
@@ -1,36 +0,0 @@ -/** - * Copyright (c) 2011, 2016 Mia-Software. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Gregoire Dupe (Mia-Software) - Bug 361794 - [Restructuring] New customization meta-model - * Nicolas Bros (Mia-Software) - Bug 379683 - customizable Tree content provider - * Grégoire Dupé (Mia-Software) - Bug 506334 - Need to know which TreeElement has been updated - */ -package org.eclipse.emf.facet.custom.ui.internal; - -import org.eclipse.emf.facet.custom.core.ICustomizationManager; -import org.eclipse.emf.facet.custom.ui.ICustomizedContentProviderFactory; -import org.eclipse.emf.facet.custom.ui.ICustomizedTreeContentProvider; -import org.eclipse.jface.viewers.IContentProvider; - -public class CustomizedContentProviderFactory implements ICustomizedContentProviderFactory { - - public ICustomizedTreeContentProvider createCustomizedTreeContentProvider(final ICustomizationManager customManager) { - return new CustomizedTreeContentProvider(customManager, new IContentListener() { - public void onUpdate(final Object object) { - // Nothing to do - } - }); - } - - public IContentProvider createCustomizedTreeContentProvider(final ICustomizationManager customManager, - final IContentListener contentListener) { - return new CustomizedTreeContentProvider(customManager, contentListener); - } - -}
diff --git a/org.eclipse.modisco.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/internal/CustomizedLabelDecorator.java b/org.eclipse.modisco.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/internal/CustomizedLabelDecorator.java deleted file mode 100644 index c8028d3..0000000 --- a/org.eclipse.modisco.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/internal/CustomizedLabelDecorator.java +++ /dev/null
@@ -1,124 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2013 Soft-Maint. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * David Couvrand (Soft-Maint) - Bug 418418 - [Customization] Overlay icons not implemented - * David Couvrand (Soft-Maint) - [Customization] NPE for CustomizableLabelProvider when no image found for image customization - * Thomas Cicognani (Soft-Maint) - Bug 424414 - ImageManager doesn't cache images - * Thomas Cicognani (Soft-Maint) - Bug 424416 - Plug-in for JFace Utilities - *******************************************************************************/ -package org.eclipse.emf.facet.custom.ui.internal; - -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.ETypedElement; -import org.eclipse.emf.facet.custom.core.ICustomizationManager; -import org.eclipse.emf.facet.custom.core.internal.exported.CustomizationUtils; -import org.eclipse.emf.facet.custom.metamodel.custompt.IImage; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.FacetOperation; -import org.eclipse.emf.facet.util.swt.imageprovider.IImageProvider; -import org.eclipse.emf.facet.util.swt.imageprovider.IImageProviderFactory; -import org.eclipse.jface.resource.ImageDescriptor; -import org.eclipse.jface.viewers.DecorationOverlayIcon; -import org.eclipse.jface.viewers.IDecorationContext; -import org.eclipse.jface.viewers.ILabelProviderListener; -import org.eclipse.jface.viewers.LabelDecorator; -import org.eclipse.swt.graphics.Image; - -public class CustomizedLabelDecorator extends LabelDecorator { - - private final ICustomizationManager customizationMgr; - private final PropertiesHandler propertiesHandler; - private final ImageManager imageManager; - - public CustomizedLabelDecorator(final ICustomizationManager customizationMgr) { - super(); - this.customizationMgr = customizationMgr; - this.propertiesHandler = new PropertiesHandler(customizationMgr); - this.imageManager = new ImageManager(); - } - - public Image decorateImage(final Image image, final Object element) { - return null; - } - - public String decorateText(final String text, final Object element) { - return null; - } - - public void addListener(final ILabelProviderListener listener) { - // Nothing to do - } - - public void dispose() { - // Nothing to do - } - - public boolean isLabelProperty(final Object element, final String property) { - return false; - } - - public void removeListener(final ILabelProviderListener listener) { - // Nothing to do - } - - @Override - public Image decorateImage(final Image image, final Object element, - final IDecorationContext context) { - Image result = null; - if ((image != null) && (element instanceof EObject)) { - final IImage bLeftIImage = getPropertyValue(element, - this.propertiesHandler.getBottomLeftOverlayProperty(), - null, IImage.class); - final ImageDescriptor bottomLeftImDesc = this.imageManager - .getImageDescriptor(bLeftIImage); - final IImage tLeftIImage = getPropertyValue(element, - this.propertiesHandler.getTopLeftOverlayProperty(), null, - IImage.class); - final ImageDescriptor topLeftImDesc = this.imageManager - .getImageDescriptor(tLeftIImage); - final IImage bRightIImage = getPropertyValue(element, - this.propertiesHandler.getBottomRightOverlayProperty(), - null, IImage.class); - final ImageDescriptor bottomRightImDesc = this.imageManager - .getImageDescriptor(bRightIImage); - final IImage tRightIImage = getPropertyValue(element, - this.propertiesHandler.getTopRightOverlayProperty(), null, - IImage.class); - final ImageDescriptor topRightImDesc = this.imageManager - .getImageDescriptor(tRightIImage); - final ImageDescriptor[] overlaysArray = new ImageDescriptor[] { - topLeftImDesc, topRightImDesc, bottomLeftImDesc, - bottomRightImDesc, null }; - final DecorationOverlayIcon overlayIcon = new DecorationOverlayIcon( - image, overlaysArray); - final IImageProvider imageProvider = IImageProviderFactory.DEFAULT - .createIImageProvider(Activator.getDefault()); - result = imageProvider.getImage(overlayIcon); - } - return result; - } - - @Override - public String decorateText(final String text, final Object element, - final IDecorationContext context) { - return null; - } - - @Override - public boolean prepareDecoration(final Object element, - final String originalText, final IDecorationContext context) { - return false; - } - - private <T> T getPropertyValue(final Object element, - final FacetOperation property, final ETypedElement eTypedElement, - final Class<T> classs) { - return CustomizationUtils.getPropertyValue(this.customizationMgr, - element, property, eTypedElement, classs); - } - -}
diff --git a/org.eclipse.modisco.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/internal/CustomizedLabelProvider.java b/org.eclipse.modisco.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/internal/CustomizedLabelProvider.java deleted file mode 100644 index 6d6aa9c..0000000 --- a/org.eclipse.modisco.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/internal/CustomizedLabelProvider.java +++ /dev/null
@@ -1,601 +0,0 @@ -/** - * Copyright (c) 2011, 2017 Mia-Software. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Gregoire Dupe (Mia-Software) - Bug 361794 - [Restructuring] New customization meta-model - * Gregoire Dupe (Mia-Software) - Bug 369987 - [Restructuring][Table] Switch to the new customization and facet framework - * Nicolas Bros (Mia-Software) - Bug 372198 - resource leak in org.eclipse.emf.facet.custom.ui.internal.CustomizedLabelProvider - * Vincent Lorenzo (CEA-LIST) - Bug 372644 - Create Customizable tooltips for the TreeViewer using a CustomizableLabelProvider - * Gregoire Dupe (Mia-Software) - Bug 373078 - API Cleaning - * Nicolas Bros (Mia-Software) - Bug 374941 - To be able to customize overlay icons on EClass - * Gregoire Dupe (Mia-Software) - Bug 374941 - To be able to customize overlay icons on EClass - * Gregoire Dupe (Mia-Software) - Bug 364325 - [Restructuring] The user must be able to navigate into a model using the Facet. - * Vincent Lorenzo (CEA-LIST) - Bug 352603 - [Table] A tooltip which displays the full label of a String cell editor - * Grégoire Dupé(Mia-Software) - Bug 352603 - [Table] A tooltip which displays the full label of a String cell editor - * David Couvrand (Soft-Maint) - Bug 402725 - Need a query to get an image from an URI - * Nicolas Rault (Soft-Maint) - Bug 402725 - Need a query to get an image from an URI - * David Couvrand (Soft-Maint) - Bug 418418 - [Customization] Overlay icons not implemented - * David Couvrand (Soft-Maint) - Bug 422058 - Implementation of strikethrough and underline in the CustomizedLabelProvider - * Grégoire Dupé (Mia-Software) - Bug 424122 - [Table] Images, fonts and colors are not shared between the instances of table - * Thomas Cicognani (Soft-Maint) - Bug 424414 - ImageManager doesn't cache images - * Thomas Cicognani (Mia-Software) - Bug 513070 - NatTable and customization: cannot change background from columns - */ -package org.eclipse.emf.facet.custom.ui.internal; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; - -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.ETypedElement; -import org.eclipse.emf.ecore.resource.ResourceSet; -import org.eclipse.emf.facet.custom.core.ICustomizationManager; -import org.eclipse.emf.facet.custom.core.ICustomizationManagerFactory; -import org.eclipse.emf.facet.custom.core.exception.CustomizationException; -import org.eclipse.emf.facet.custom.core.internal.exported.CustomizationUtils; -import org.eclipse.emf.facet.custom.metamodel.custompt.IColor; -import org.eclipse.emf.facet.custom.metamodel.custompt.IImage; -import org.eclipse.emf.facet.custom.metamodel.v0_2_0.custompt.Alignment; -import org.eclipse.emf.facet.custom.metamodel.v0_2_0.custompt.Shadow; -import org.eclipse.emf.facet.custom.ui.ICustomOverride; -import org.eclipse.emf.facet.custom.ui.ICustomizedLabelProvider; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.FacetOperation; -import org.eclipse.emf.facet.util.core.DebugUtils; -import org.eclipse.emf.facet.util.core.Logger; -import org.eclipse.emf.facet.util.swt.colorprovider.IColorProvider; -import org.eclipse.emf.facet.util.swt.colorprovider.IColorProviderFactory; -import org.eclipse.emf.facet.util.swt.fontprovider.IFontProvider; -import org.eclipse.emf.facet.util.swt.fontprovider.IFontProviderFactory; -import org.eclipse.jface.viewers.CellLabelProvider; -import org.eclipse.jface.viewers.DelegatingStyledCellLabelProvider.IStyledLabelProvider; -import org.eclipse.jface.viewers.ILabelProviderListener; -import org.eclipse.jface.viewers.StyledString; -import org.eclipse.jface.viewers.ViewerCell; -import org.eclipse.swt.SWT; -import org.eclipse.swt.graphics.Color; -import org.eclipse.swt.graphics.Font; -import org.eclipse.swt.graphics.FontData; -import org.eclipse.swt.graphics.Image; -import org.eclipse.swt.graphics.RGB; -import org.eclipse.swt.widgets.Display; -import org.osgi.framework.Bundle; -import org.osgi.framework.BundleContext; -import org.osgi.framework.ServiceReference; - -public class CustomizedLabelProvider extends CellLabelProvider implements - ICustomizedLabelProvider, IStyledLabelProvider { - - private static final boolean DEBUG_FONT = DebugUtils.getDebugStatus(Activator.getDefault(), "font"); //$NON-NLS-1$ - private static final boolean DEBUG_COLOR = DebugUtils.getDebugStatus(Activator.getDefault(), "color"); //$NON-NLS-1$ - private static final int RGB_MAX = 255; - private static final RGB DEFAULT_BCKGND = new RGB( - CustomizedLabelProvider.RGB_MAX, CustomizedLabelProvider.RGB_MAX, - CustomizedLabelProvider.RGB_MAX); - private static final RGB DEFAULT_FOREGND = new RGB(0, 0, 0); - private final ICustomizationManager customManager; - private final PropertiesHandler propertiesHandler; - private final List<ILabelProviderListener> listeners = new ArrayList<ILabelProviderListener>(); - private final ImageManager imageManager; - private final ICustomOverride customOverride; - - @Deprecated - public CustomizedLabelProvider(final ResourceSet resourceSet) { - this(ICustomizationManagerFactory.DEFAULT - .getOrCreateICustomizationManager(resourceSet)); - } - - public CustomizedLabelProvider(final ICustomizationManager customManager) { - super(); - this.customManager = customManager; - this.propertiesHandler = new PropertiesHandler(customManager); - this.imageManager = new ImageManager(); - this.customOverride = getICustomOverride(); - } - - private <T> T getPropertyValue(final Object element, - final FacetOperation property, final ETypedElement eTypedElement, final Class<T> classs) { - return CustomizationUtils.getPropertyValue(this.customManager, element, - property, eTypedElement, classs); - } - - public String getText(final Object element) { - String result; - if (element instanceof EObject) { - result = getPropertyValue(element, - this.propertiesHandler.getLabelProperty(), null, String.class); - } else if (element == null) { - result = Messages.CustomizedLabelProvider_null; - } else if (element instanceof List<?>) { - // Here we do not add any square brackets because the square - // brackets are useful to emphases the sublists and here we will non - // meet any sublists. - final StringBuffer strBuffer = new StringBuffer(); - final List<?> list = (List<?>) element; - final Iterator<?> iter = list.iterator(); - while (iter.hasNext()) { - final Object current = iter.next(); - strBuffer.append(getText(current)); - if (iter.hasNext()) { - strBuffer.append(", "); //$NON-NLS-1$ - } - } - result = strBuffer.toString(); - } else { - result = element.toString(); - } - if (this.customOverride != null) { - try { - result = this.customOverride.getText(result, element, - this.customManager, this.propertiesHandler); - } catch (final CustomizationException e) { - result = "ERROR, cf. log"; //$NON-NLS-1$ - Logger.logError(e, Activator.getDefault()); - } - } - return result; - } - - private static ICustomOverride getICustomOverride() { - final Bundle bundle = Activator.getDefault().getBundle(); - final BundleContext bundleContext = bundle.getBundleContext(); - final ServiceReference serviceReference = bundleContext - .getServiceReference(ICustomOverride.class.getName()); - final ICustomOverride customOverride = (ICustomOverride) bundleContext - .getService(serviceReference); - return customOverride; - } - - public String getText(final Object object, final ETypedElement eTypedElement) { - String result; - if (object == null) { - result = Messages.CustomizedLabelProvider_null; - } else { - if (object instanceof EObject) { - final EObject eObject = (EObject) object; - try { - result = this.customManager.getCustomValueOf(eObject, - eTypedElement, - this.propertiesHandler.getLabelProperty(), - String.class); - } catch (CustomizationException e) { - Logger.logError(e, Activator.getDefault()); - result = "!!! Error, cf log !!!"; - } - } else { - result = object.toString(); - } - - } - return result; - -//TODO Remove before to commit -// if (structuralFeature.getUpperBound() == 1) { -// final Object object = this.customManager.getFacetManager().get(eObject, -// structuralFeature, Object.class); -// result = getText(object); -// } else { -// final StringBuffer stringBuffer = new StringBuffer(); -// final List<Object> objects = this.customManager.getFacetManager() -// .getMultiValued(eObject, structuralFeature, Object.class); -// final Iterator<Object> objectsIter = objects.iterator(); -// while (objectsIter.hasNext()) { -// final Object object = objectsIter.next(); -// stringBuffer.append(this.getText(object)); -// if (objectsIter.hasNext()) { -// stringBuffer.append(", "); -// } -// } -// result = stringBuffer.toString(); -// } -//TODO (end) - } - - @Override - public void addListener(final ILabelProviderListener listener) { - this.listeners.add(listener); - } - - @Override - public void dispose() { - this.listeners.clear(); - } - - @Override - public boolean isLabelProperty(final Object element, final String property) { - return false; - } - - @Override - public void removeListener(final ILabelProviderListener listener) { - this.listeners.remove(listener); - } - - private static Color getColor(final RGB rgb) { - final Display display = Display.getDefault(); - final IColorProvider colorProvider = IColorProviderFactory.DEFAULT - .getOrCreateIColorProvider(display); - return colorProvider.getColor(rgb); - } - - public Color getForeground(final Object element) { - final IColor color = getPropertyValue(element, - this.propertiesHandler.getForegroundProperty(), - null, IColor.class); - Color result; - if (color == null) { - result = getColor(CustomizedLabelProvider.DEFAULT_FOREGND); - } else { - result = getColor(new RGB(color.getRed(), color.getGreen(), - color.getBlue())); - } - return result; - } - - public Color getBackground(final Object element, - final ETypedElement eTypedElement) { - final IColor color = getPropertyValue(element, - this.propertiesHandler.getBackgroundProperty(), eTypedElement, - IColor.class); - Color result; - if (color == null) { - result = getColor(CustomizedLabelProvider.DEFAULT_BCKGND); - } else { - result = getColor(new RGB(color.getRed(), color.getGreen(), - color.getBlue())); - } - return result; - } - - public Color getBackground(final Object element) { - return getBackground(element, null); - } - - private Font getFont(final FontData fontData) { - final IFontProvider fontProvider = IFontProviderFactory.DEFAULT - .getOrCreateIFontProvider(Display.getDefault()); - return fontProvider.getFont(fontData); - } - - public Font getFont(final Object element) { - - String fontName = getPropertyValue(element, - this.propertiesHandler.getFontNameProperty(), null, String.class); - if (fontName == null) { - final FontData[] fontData = Display.getDefault().getSystemFont() - .getFontData(); - fontName = fontData[0].getName(); - } - - Integer fontSize = getPropertyValue(element, - this.propertiesHandler.getFontSizeProperty(), null, Integer.class); - if (fontSize == null) { - final FontData[] fontData = Display.getDefault().getSystemFont() - .getFontData(); - fontSize = Integer.valueOf(fontData[0].getHeight()); - } - - Boolean isBold = getPropertyValue(element, - this.propertiesHandler.getIsBoldProperty(), null, Boolean.class); - if (isBold == null) { - isBold = Boolean.FALSE; - } - - Boolean isItalic = getPropertyValue(element, - this.propertiesHandler.getIsItalicProperty(), null, Boolean.class); - if (isItalic == null) { - isItalic = Boolean.FALSE; - } - - int fontStyle = 0; - if (isBold.booleanValue()) { - fontStyle = fontStyle | SWT.BOLD; - } - if (isItalic.booleanValue()) { - fontStyle = fontStyle | SWT.ITALIC; - } - FontData fontData = new FontData(fontName, fontSize.intValue(), - fontStyle); - try { - fontData = this.customOverride.getFont(fontData, element, - this.customManager, this.propertiesHandler); - } catch (final CustomizationException e) { - Logger.logError(e, Activator.getDefault()); - } - return getFont(fontData); - } - - public Image getImage(final Object element) { - final IImage image = getPropertyValue(element, - this.propertiesHandler.getImageProperty(), null, IImage.class); - return this.imageManager.getImage(image); - } - - public Image getImage(final Object element, final ETypedElement featureColumn) { - return getImage(element, this.propertiesHandler.getImageProperty(), featureColumn); - } - - public ICustomizationManager getCustomizationManager() { - return this.customManager; - } - - public boolean isUnderlined(final Object element, - final ETypedElement eTypedElement) { - return getPropertyValue(element, - this.propertiesHandler.getIsUnderlinedProperty(), null, Boolean.class).booleanValue(); - } - - public boolean isStruckthrough(final Object element, - final ETypedElement eTypedElement) { - final Boolean propertyValue = getPropertyValue(element, - this.propertiesHandler.getIsStruckthroughProperty(), - eTypedElement, Boolean.class); - boolean result = false; - if (propertyValue != null) { - result = propertyValue.booleanValue(); - } - return result; - } - - private Image getImage(final Object element, final FacetOperation operation, final ETypedElement feature) { - final IImage iimage = getPropertyValue(element, operation, feature, - IImage.class); - return this.imageManager.getImage(iimage); - } - - public Image getTopLeftOverlay(final Object element, - final ETypedElement eTypedElement) { - return getImage(element, this.propertiesHandler.getTopLeftOverlayProperty(), eTypedElement); - } - - public Image getTopMiddleOverlay(final Object element, - final ETypedElement eTypedElement) { - return getImage(element, this.propertiesHandler.getTopMiddleOverlayProperty(), eTypedElement); - } - - public Image getTopRightOverlay(final Object element, - final ETypedElement eTypedElement) { - return getImage(element, this.propertiesHandler.getTopRightOverlayProperty(), eTypedElement); - } - - public Image getBottomLeftOverlay(final Object element, - final ETypedElement eTypedElement) { - return getImage(element, this.propertiesHandler.getBottomLeftOverlayProperty(), eTypedElement); - } - - public Image getBottomMiddleOverlay(final Object element, - final ETypedElement eTypedElement) { - return getImage(element, this.propertiesHandler.getBottomMiddleOverlayProperty(), eTypedElement); - } - - public Image getBottomRightOverlay(final Object element, - final ETypedElement eTypedElement) { - return getImage(element, this.propertiesHandler.getBottomRightOverlayProperty(), eTypedElement); - } - - - @Override - public String getToolTipText(final Object element) { - return getPropertyValue(element, - this.propertiesHandler.getToolTipTextProperty(), null, String.class); - } - - @Override - public int getToolTipStyle(final Object element) { - int style = 0; - final Shadow shadow = getPropertyValue(element, - this.propertiesHandler.getToolTipShadowProperty(), null, - Shadow.class); - switch (shadow) { - case NONE : - style = SWT.SHADOW_NONE; - break; - case IN : - style = SWT.SHADOW_IN; - break; - case OUT: - style = SWT.SHADOW_OUT; - break; - default: - throw new IllegalStateException("Un expected value"); //$NON-NLS-1$ - } - - final Alignment alignment = getPropertyValue(element, - this.propertiesHandler.getToolTipAlignmentProperty(), null, - Alignment.class); - switch (alignment) { - case LEFT: - style |= SWT.LEFT; - break; - case CENTER: - style |= SWT.CENTER; - break; - case RIGHT: - style |= SWT.RIGHT; - break; - default: - throw new IllegalStateException("Un expected value"); //$NON-NLS-1$ - } - - return style; - } - - @Override - public Image getToolTipImage(final Object element) { - return getPropertyValue(element, - this.propertiesHandler.getToolTipImageProperty(), null, Image.class); - } - - @Override - public Color getToolTipBackgroundColor(final Object element) { - final IColor color = getPropertyValue(element, - this.propertiesHandler.getToolTipBackgroundProperty(), - null, IColor.class); - return getColor(new RGB(color.getRed(), color.getGreen(), color.getBlue())); - } - - @Override - public Color getToolTipForegroundColor(final Object element) { - final IColor color = getPropertyValue(element, - this.propertiesHandler.getToolTipForegroundProperty(), - null, IColor.class); - return getColor(new RGB(color.getRed(), color.getGreen(), color.getBlue())); - } - - public Image getToolTipTopLeftOverlay(final Object element, - final ETypedElement eTypedElement) { - return getPropertyValue(element, - this.propertiesHandler.getToolTipTopLeftOverlayProperty(), - null, Image.class); - } - - public Image getToolTipTopMiddleOverlay(final Object element, - final ETypedElement eTypedElement) { - return getPropertyValue(element, - this.propertiesHandler.getToolTipTopMiddleOverlayProperty(), - null, Image.class); - } - - public Image getToolTipTopRightOverlay(final Object element, - final ETypedElement eTypedElement) { - return getPropertyValue(element, - this.propertiesHandler.getToolTipTopRightOverlayProperty(), - null, Image.class); - } - - public Image getToolTipBottomLeftOverlay(final Object element, - final ETypedElement eTypedElement) { - return getPropertyValue(element, - this.propertiesHandler.getToolTipBottomLeftOverlayProperty(), - null, Image.class); - } - - public Image getToolTipBottomMiddleOverlay(final Object element, - final ETypedElement eTypedElement) { - return getPropertyValue(element, - this.propertiesHandler.getToolTipBottomMiddleOverlayProperty(), - null, Image.class); - } - - public Image getToolTipBottomRightOverlay(final Object element, - final ETypedElement eTypedElement) { - return getPropertyValue(element, - this.propertiesHandler.getToolTipBottomRightOverlayProperty(), - null, Image.class); - } - - @Override - public int getToolTipDisplayDelayTime(final Object element) { - return getPropertyValue(element, - this.propertiesHandler.getToolTipDisplayDelayTimeProperty(), - null, Integer.class).intValue(); - } - - @Override - public int getToolTipTimeDisplayed(final Object element) { - return getPropertyValue(element, - this.propertiesHandler.getToolTipTimeDisplayedProperty(), null, - Integer.class).intValue(); - - } - - @Override - public Font getToolTipFont(final Object element) { - - final String fontName = getPropertyValue(element, - this.propertiesHandler.getToolTipFontNameProperty(), null, - String.class); - final Integer fontSize = getPropertyValue(element, - this.propertiesHandler.getToolTipFontSizeProperty(), null, - Integer.class); - final Boolean isBold = getPropertyValue(element, - this.propertiesHandler.getToolTipIsBoldProperty(), null, - Boolean.class); - final Boolean isItalic = getPropertyValue(element, - this.propertiesHandler.getToolTipIsItalicProperty(), null, - Boolean.class); - int fontStyle = 0; - if (isBold.booleanValue()) { - fontStyle = fontStyle | SWT.BOLD; - } - if (isItalic.booleanValue()) { - fontStyle = fontStyle | SWT.ITALIC; - } - final FontData fontData = new FontData(fontName, fontSize.intValue(), - fontStyle); - final IFontProvider fontProvider = IFontProviderFactory.DEFAULT - .getOrCreateIFontProvider(Display.getDefault()); - return fontProvider.getFont(fontData); - } - - @Override - public void update(final ViewerCell cell) { - final Object element = cell.getElement(); - cell.setText(getText(element)); - cell.setBackground(getBackground(element)); - cell.setFont(getFont(element)); - cell.setForeground(getForeground(element)); - cell.setImage(getImage(element)); - } - - public String getToolTipText(final Object element, - final ETypedElement eTypedElement) { - // TODO Auto-generated method stub - return null; - } - - public Image getToolTipImage(final Object element, - final ETypedElement eTypedElement) { - // TODO Auto-generated method stub - return null; - } - - public Font getToolTipFont(final Object element, - final ETypedElement eTypedElement) { - // TODO Auto-generated method stub - return null; - } - - public Color getToolTipBackgroundColor(final Object element, - final ETypedElement eTypedElement) { - // TODO Auto-generated method stub - return null; - } - - public Color getToolTipForegroundColor(final Object element, - final ETypedElement eTypedElement) { - // TODO Auto-generated method stub - return null; - } - - public int getToolTipTimeDisplayed(final Object element, - final ETypedElement eTypedElement) { - // TODO Auto-generated method stub - return 0; - } - - public int getToolTipDisplayDelayTime(final Object element, - final ETypedElement eTypedElement) { - // TODO Auto-generated method stub - return 0; - } - - public int getToolTipStyle(final Object element, - final ETypedElement eTypedElement) { - // TODO Auto-generated method stub - return 0; - } - - public ICustomizedLabelProvider cloneLabelProvider() { - return new CustomizedLabelProvider(this.customManager); - } - - public StyledString getStyledText(final Object element) { - return new StyledString(getText(element)); - } - -}
diff --git a/org.eclipse.modisco.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/internal/CustomizedLabelProviderFactory.java b/org.eclipse.modisco.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/internal/CustomizedLabelProviderFactory.java deleted file mode 100644 index f0a3cec..0000000 --- a/org.eclipse.modisco.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/internal/CustomizedLabelProviderFactory.java +++ /dev/null
@@ -1,28 +0,0 @@ -/** - * Copyright (c) 2012 Mia-Software. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Gregoire Dupe (Mia-Software) - Bug 361794 - [Restructuring] New customization meta-model - * David Couvrand (Soft-Maint) - Bug 418418 - [Customization] Overlay icons not implemented - */ -package org.eclipse.emf.facet.custom.ui.internal; - -import org.eclipse.emf.facet.custom.core.ICustomizationManager; -import org.eclipse.emf.facet.custom.ui.ICustomizedLabelProvider; -import org.eclipse.emf.facet.custom.ui.ICustomizedLabelProviderFactory; - -public class CustomizedLabelProviderFactory implements - ICustomizedLabelProviderFactory { - - public ICustomizedLabelProvider createCustomizedLabelProvider( - final ICustomizationManager customizationMgr) { - return new DecoratingCustomizedLabelProvider( - customizationMgr); - } - -}
diff --git a/org.eclipse.modisco.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/internal/CustomizedTreeContentProvider.java b/org.eclipse.modisco.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/internal/CustomizedTreeContentProvider.java deleted file mode 100644 index 4ab1eda..0000000 --- a/org.eclipse.modisco.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/internal/CustomizedTreeContentProvider.java +++ /dev/null
@@ -1,452 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2012, 2016 Mia-Software. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Nicolas Bros (Mia-Software) - Bug 379683 - customizable Tree content provider - * Grégoire Dupé (Mia-Software) - Bug 385292 - [CustomizedTreeContentProvider] StackOverFlow when refreshing a TreeViewer with ICustomizedTreeContentProvider - * Grégoire Dupé (Mia-Software) - Bug 386387 - [CustomizedTreeContentProvider] The TreeElements are not preserved between two calls to getElements() - * Thomas Cicognani (Soft-Maint) - Bug 441321 - isVisible customization doesn't work after refreshing a tree - * Grégoire Dupé (Mia-Software) - Bug 441570 - Children custom property - * Grégoire Dupé (Mia-Software) - Bug 506334 - Need to know which TreeElement has been updated - * Grégoire Dupé (Mia-Software) - Bug 506929 - Refresh problems after CustomizedTreeContentProvider.dispose() - *******************************************************************************/ -package org.eclipse.emf.facet.custom.ui.internal; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collection; -import java.util.Collections; -import java.util.List; -import java.util.Set; - -import org.eclipse.emf.common.notify.Adapter; -import org.eclipse.emf.common.notify.Notifier; -import org.eclipse.emf.common.util.EList; -import org.eclipse.emf.ecore.EAttribute; -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.EReference; -import org.eclipse.emf.ecore.EStructuralFeature; -import org.eclipse.emf.ecore.ETypedElement; -import org.eclipse.emf.facet.custom.core.ICustomizationManager; -import org.eclipse.emf.facet.custom.core.exception.CustomizationException; -import org.eclipse.emf.facet.custom.metamodel.v0_2_0.internal.treeproxy.EAttributeTreeElement; -import org.eclipse.emf.facet.custom.metamodel.v0_2_0.internal.treeproxy.EObjectTreeElement; -import org.eclipse.emf.facet.custom.metamodel.v0_2_0.internal.treeproxy.EReferenceTreeElement; -import org.eclipse.emf.facet.custom.metamodel.v0_2_0.internal.treeproxy.EStructuralFeatureTreeElement; -import org.eclipse.emf.facet.custom.metamodel.v0_2_0.internal.treeproxy.TreeElement; -import org.eclipse.emf.facet.custom.metamodel.v0_2_0.internal.treeproxy.TreeproxyFactory; -import org.eclipse.emf.facet.custom.ui.IContentPropertiesHandler; -import org.eclipse.emf.facet.custom.ui.IContentPropertiesHandlerFactory; -import org.eclipse.emf.facet.custom.ui.ICustomizedContentProviderFactory.IContentListener; -import org.eclipse.emf.facet.custom.ui.ICustomizedTreeContentProvider; -import org.eclipse.emf.facet.efacet.core.FacetUtils; -import org.eclipse.emf.facet.efacet.core.IFacetManager; -import org.eclipse.emf.facet.efacet.core.IFacetManagerListener; -import org.eclipse.emf.facet.efacet.core.exception.FacetManagerException; -import org.eclipse.emf.facet.util.core.Logger; -import org.eclipse.jface.viewers.Viewer; - -@SuppressWarnings("deprecation") -// @SuppressWarnings("deprecation") : Bug 380229 - [deprecated] ICustomizedContentProvider -public class CustomizedTreeContentProvider implements ICustomizedTreeContentProvider { - - private final ICustomizationManager customManager; - private final IContentPropertiesHandler contentHandler; - private Object previousInput; - private Object[] rootElements = new Object[0]; - private final List<TreeElementAdapter> adapters; - private IContentListener contentListener; - - public CustomizedTreeContentProvider(final ICustomizationManager customManager, - final IContentListener contentListener) { - this.adapters = new ArrayList<TreeElementAdapter>(); - this.customManager = customManager; - this.customManager.getFacetManager().addListener(new IFacetManagerListener() { - public void facetManagerChanged() { - CustomizedTreeContentProvider.this.dispose(); - } - }); - this.contentHandler = IContentPropertiesHandlerFactory.DEFAULT.createIContentPropertiesHandler(customManager); - this.contentListener = contentListener; - } - - private static Object[] getRootElements(final Object inputElement) { - Object[] result; - if (inputElement == null) { - result = new Object[0]; - } else if (inputElement instanceof EObject) { - result = new EObject[] { (EObject) inputElement }; - } else if (inputElement instanceof Collection<?>) { - result = ((Collection<?>) inputElement).toArray(); - } else if (inputElement instanceof EObject[]) { - result = (EObject[]) inputElement; - } else { - throw new IllegalArgumentException("Unhandled input element type: " + inputElement.getClass().getSimpleName()); //$NON-NLS-1$ - } - return result; - } - - public Object[] getElements(final Object inputElement) { - Object[] result; - if (this.previousInput == inputElement) { - result = this.rootElements; - } else { - this.previousInput = inputElement; - final Object[] elements = getRootElements(inputElement); - final List<Object> elementList = new ArrayList<Object>(); - for (final Object element : elements) { - if (!isVisible(element, null)) { - continue; - } - if (element instanceof EObject) { - final EObjectTreeElement eObjectProxy = createEObjectProxy(element, null); - elementList.add(eObjectProxy); - } else { - elementList.add(element); - } - } - result = elementList.toArray(); - this.rootElements = result; - } - return result; - } - - protected EObjectTreeElement createEObjectProxy(final Object element, - final TreeElement parent) { - final EObject eObject = (EObject) element; - final EObjectTreeElement eObjectProxy = TreeproxyFactory.eINSTANCE.createEObjectTreeElement(); - eObjectProxy.setEObject(eObject); - eObjectProxy.setParent(parent); - /* - * The TreeElementAdapter is used to clear the content of - * eObjectProxy.setParent() when the eObject is updated. - */ - final TreeElementAdapter adapter = new TreeElementAdapter(eObjectProxy, - this.contentListener); - eObject.eAdapters().add(adapter); - this.adapters.add(adapter); - return eObjectProxy; - } - - public Object[] getChildren(final Object parentElement) { - Object[] result = null; - if (parentElement == null) { - result = new Object[0]; - } else if (parentElement instanceof TreeElement) { - final TreeElement treeElt = (TreeElement) parentElement; - if (parentElement instanceof EAttributeTreeElement) { - final EAttributeTreeElement attributeProxy = (EAttributeTreeElement) parentElement; - result = getChildren(attributeProxy); - } else { - /* - * treeElt.getChildren() is cleared by the TreeElementAdapter - * instances when the eObject is updated. - */ - final List<? extends TreeElement> cachedChildren = treeElt.getChildren(); - if (cachedChildren == null || cachedChildren.isEmpty()) { - if (parentElement instanceof EObjectTreeElement) { - final EObjectTreeElement eObjectProxy = (EObjectTreeElement) parentElement; - result = filter(getChildren(eObjectProxy)); - } else if (parentElement instanceof EReferenceTreeElement) { - final EReferenceTreeElement referenceProxy = (EReferenceTreeElement) parentElement; - result = filter(getChildren(referenceProxy)); - } - } else { - result = filter(cachedChildren); - } - } - } - if (result == null) { - @SuppressWarnings("null") - /* - * @SuppressWarnings("null"): gdupe> parentElement cannot be null, - * this is tested by the first if of this method - */ - final Class<? extends Object> unexpectedClass = parentElement.getClass(); - Logger.logError("Unknown element in tree: " + unexpectedClass, //$NON-NLS-1$ - Activator.getDefault()); - result = new Object[0]; - } - return result; - } - - private Object[] filter(final List<? extends TreeElement> notFilteredResult) { - final List<TreeElement> filteredChildren = new ArrayList<TreeElement>(); - for (TreeElement child : notFilteredResult) { - EObject eObject = null; - EStructuralFeature eStructFeature = null; - if (child instanceof EStructuralFeatureTreeElement) { - final EStructuralFeatureTreeElement sfTreeElt = (EStructuralFeatureTreeElement) child; - eObject = ((EObjectTreeElement) sfTreeElt.getParent()).getEObject(); - eStructFeature = sfTreeElt.getEStructuralFeature(); - } else if (child instanceof EObjectTreeElement) { - final EObjectTreeElement eObjTreeElt = (EObjectTreeElement) child; - eObject = eObjTreeElt.getEObject(); - } - if (isVisible(eObject, eStructFeature)) { - filteredChildren.add(child); - } - } - return filteredChildren.toArray(); - } - - private List<TreeElement> getChildren(final EObjectTreeElement treeElement) { - List<TreeElement> children = treeElement.getChildren(); - children.clear(); - final List<ETypedElement> customChildren = getCustomChildren(treeElement.getEObject(), null); - if (customChildren == null) { - children = new ArrayList<TreeElement>(); - children.addAll(createAttributes(treeElement)); - children.addAll(createReferences(treeElement)); - } else { - for (ETypedElement customChild : customChildren) { - if (customChild instanceof EAttribute) { - final EAttribute eAttribute = (EAttribute) customChild; - children.add(createAttributeProxy(eAttribute, treeElement)); - } else if (customChild instanceof EReference) { - final EReference eReference = (EReference) customChild; - children.addAll(getReferenceChildren(treeElement, eReference, treeElement.getEObject())); - } - } - } - return children; - } - - public Object[] getChildren(final EAttributeTreeElement attributeProxy) { - final List<Object> children = new ArrayList<Object>(); - final EAttribute eAttribute = attributeProxy.getEAttribute(); - if (eAttribute.isMany()) { - final TreeElement parent = attributeProxy.getParent(); - if (!(parent instanceof EObjectTreeElement)) { - throw new IllegalStateException("An attribute should appear only under a model element"); //$NON-NLS-1$ - } - final EObjectTreeElement parentProxy = (EObjectTreeElement) parent; - final EObject eObject = parentProxy.getEObject(); - try { - final IFacetManager facetManager = this.customManager.getFacetManager(); - final List<Object> result = facetManager.getOrInvokeMultiValued(eObject, eAttribute, null); - for (final Object object : result) { - if (object instanceof EObject) { - final EObject childEObject = (EObject) object; - children.add(createEObjectProxy(childEObject, attributeProxy)); - } - children.add(object); - } - } catch (final FacetManagerException e) { - Logger.logError(e, Activator.getDefault()); - } - } - return children.toArray(); - } - - public List<? extends TreeElement> getChildren(final EReferenceTreeElement referenceProxy) { - List<? extends TreeElement> result; - final EReference eReference = referenceProxy.getEReference(); - final TreeElement parent = referenceProxy.getParent(); - if (!(parent instanceof EObjectTreeElement)) { - throw new IllegalStateException("A reference should appear only under a model element"); //$NON-NLS-1$ - } - final EObjectTreeElement parentProxy = (EObjectTreeElement) parent; - final EObject eObject = parentProxy.getEObject(); - result = getReferenceChildren(referenceProxy, eReference, eObject); - return result; - } - - private List<? extends TreeElement> getReferenceChildren( - final TreeElement parent, - final EReference eReference, final EObject eObject) { - List<? extends TreeElement> result; - if (eReference.isMany()) { - result = getMultiValuedReferenceChildren(eReference, eObject, parent); - } else { - final EObjectTreeElement child = getSingleValuedReferenceChild(eReference, eObject, parent); - if (child == null) { - result = Collections.emptyList(); - } else { - result = Collections.singletonList(child); - } - } - return result; - } - - private EObjectTreeElement getSingleValuedReferenceChild(final EReference eReference, - final EObject eObject, final TreeElement parent) { - EObjectTreeElement child = null; - try { - final IFacetManager facetManager = this.customManager - .getFacetManager(); - final EObject referedEObject = facetManager.getOrInvoke( - eObject, eReference, EObject.class); - if (referedEObject != null) { - child = createEObjectProxy(referedEObject, parent); - } - } catch (final FacetManagerException e) { - Logger.logError(e, Activator.getDefault()); - } - return child; - } - - private List<EObjectTreeElement> getMultiValuedReferenceChildren( - final EReference eReference, final EObject eObject, - final TreeElement parent) { - final List<EObjectTreeElement> children = new ArrayList<EObjectTreeElement>(); - try { - final IFacetManager facetManager = this.customManager - .getFacetManager(); - final List<Object> result = facetManager - .getOrInvokeMultiValued(eObject, eReference, null); - for (final Object object : result) { - if (object instanceof EObject) { - final EObject childEObject = (EObject) object; - children.add(createEObjectProxy(childEObject, parent)); - } - } - } catch (final FacetManagerException e) { - Logger.logError(e, Activator.getDefault()); - } - return children; - } - - private Collection<EAttributeTreeElement> createAttributes(final EObjectTreeElement treeElement) { - final EObject eObject = treeElement.getEObject(); - final EClass eClass = eObject.eClass(); - final IFacetManager facetManager = this.customManager.getFacetManager(); - final List<EAttribute> allAttributes = new ArrayList<EAttribute>(); - allAttributes.addAll(eClass.getEAllAttributes()); - try { - final Set<EAttribute> facetAttributes = FacetUtils.getETypedElements(eObject, EAttribute.class, facetManager); - allAttributes.addAll(facetAttributes); - } catch (final FacetManagerException e) { - Logger.logError(e, Activator.getDefault()); - } - return createAttributeProxies(allAttributes, treeElement); - } - - private static Collection<EAttributeTreeElement> createAttributeProxies( - final List<EAttribute> allAttributes, - final EObjectTreeElement parent) { - final List<EAttributeTreeElement> result = new ArrayList<EAttributeTreeElement>(); - for (final EAttribute eAttribute : allAttributes) { - result.add(createAttributeProxy(eAttribute, parent)); - } - return result; - } - - private static EAttributeTreeElement createAttributeProxy( - final EAttribute eAttribute, final EObjectTreeElement parent) { - final EAttributeTreeElement attributeProxy = TreeproxyFactory.eINSTANCE - .createEAttributeTreeElement(); - attributeProxy.setEStructuralFeature(eAttribute); - attributeProxy.setParent(parent); - return attributeProxy; - } - - private Collection<EReferenceTreeElement> createReferences(final EObjectTreeElement treeElement) { - final EObject eObject = treeElement.getEObject(); - final EClass eClass = eObject.eClass(); - final IFacetManager facetManager = this.customManager.getFacetManager(); - final List<EReference> allReferences = new ArrayList<EReference>(); - allReferences.addAll(eClass.getEAllReferences()); - try { - final Set<EReference> facetReferences = FacetUtils.getETypedElements(eObject, EReference.class, facetManager); - allReferences.addAll(facetReferences); - } catch (final FacetManagerException e) { - Logger.logError(e, Activator.getDefault()); - } - return createReferenceProxies(allReferences, treeElement); - } - - private static Collection<EReferenceTreeElement> createReferenceProxies(final List<EReference> allReferences, final EObjectTreeElement parent) { - final List<EReferenceTreeElement> result = new ArrayList<EReferenceTreeElement>(); - for (final EReference eReference : allReferences) { - final EReferenceTreeElement referenceProxy = TreeproxyFactory.eINSTANCE - .createEReferenceTreeElement(); - referenceProxy.setEStructuralFeature(eReference); - referenceProxy.setParent(parent); - result.add(referenceProxy); - } - return result; - } - - public Object getParent(final Object element) { - Object result = null; - if (element instanceof TreeElement) { - final TreeElement treeElement = (TreeElement) element; - result = treeElement.eContainer(); - } - return result; - } - - public boolean hasChildren(final Object element) { - return getChildren(element).length > 0; - } - - public void dispose() { - final List<Object> rootList = Arrays.asList(this.rootElements); - /* gdupe> I copy the list to avoid ConcurrentModificationException */ - final Collection<TreeElementAdapter> adaptersCopy = Collections - .unmodifiableCollection(this.adapters); - for (TreeElementAdapter adapter : adaptersCopy) { - final EObjectTreeElement treeElement = adapter.getTreeElement(); - if (!rootList.contains(treeElement)) { - final Notifier target = adapter.getTarget(); - final EList<Adapter> eAdapters = target.eAdapters(); - eAdapters.remove(adapter); - } - treeElement.getChildren().clear(); - } - for (Object rootElt : this.rootElements) { - this.contentListener.onUpdate(rootElt); - } - } - - public void inputChanged(final Viewer viewer, final Object oldInput, final Object newInput) { - if (newInput == null || !newInput.equals(newInput)) { - dispose(); - } - } - - public ICustomizationManager getCustomizationManager() { - return this.customManager; - } - - public boolean isVisible(final Object object, final ETypedElement eTypedElement) { - Boolean result = Boolean.TRUE; - if (object instanceof EObject) { - final EObject eObject = (EObject) object; - try { - result = this.customManager.getCustomValueOf(eObject, eTypedElement, this.contentHandler.getIsVisible(), Boolean.class); - } catch (final CustomizationException e) { - Logger.logError(e, Activator.getDefault()); - } - } - return result.booleanValue(); - } - - public List<ETypedElement> getCustomChildren(final Object object, final ETypedElement eTypedElement) { - List<ETypedElement> result = null; - if (object instanceof EObject) { - final EObject eObject = (EObject) object; - try { - final List<?> tmpresult = this.customManager.getCustomValueOf(eObject, eTypedElement, this.contentHandler.getChildren(), List.class); - if (tmpresult != null && !tmpresult.isEmpty()) { - result = new ArrayList<ETypedElement>(); - for (Object tmpObject :tmpresult) { - if (tmpObject instanceof ETypedElement) { - final ETypedElement resultElt = (ETypedElement) tmpObject; - result.add(resultElt); - } - } - } - } catch (final CustomizationException e) { - Logger.logError(e, Activator.getDefault()); - } - } - return result; - } -}
diff --git a/org.eclipse.modisco.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/internal/DecoratingCustomizedLabelProvider.java b/org.eclipse.modisco.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/internal/DecoratingCustomizedLabelProvider.java deleted file mode 100644 index 868cf6b..0000000 --- a/org.eclipse.modisco.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/internal/DecoratingCustomizedLabelProvider.java +++ /dev/null
@@ -1,189 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2013, 2017 Soft-Maint, and Mia-Software. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * David Couvrand (Soft-Maint) - Bug 418418 - [Customization] Overlay icons not implemented - * Thomas Cicognani (Mia-Software) - Bug 513070 - NatTable and customization: cannot change background from columns - *******************************************************************************/ -package org.eclipse.emf.facet.custom.ui.internal; - -import org.eclipse.emf.ecore.ETypedElement; -import org.eclipse.emf.facet.custom.core.ICustomizationManager; -import org.eclipse.emf.facet.custom.ui.ICustomizedLabelProvider; -import org.eclipse.jface.viewers.DecoratingStyledCellLabelProvider; -import org.eclipse.jface.viewers.IDecorationContext; -import org.eclipse.jface.viewers.ILabelDecorator; -import org.eclipse.swt.graphics.Color; -import org.eclipse.swt.graphics.Font; -import org.eclipse.swt.graphics.Image; - -public class DecoratingCustomizedLabelProvider extends - DecoratingStyledCellLabelProvider implements ICustomizedLabelProvider { - - private ICustomizedLabelProvider lblProvider; - - private DecoratingCustomizedLabelProvider( - final IStyledLabelProvider labelProvider, - final ILabelDecorator decorator, - final IDecorationContext decorationContext) { - super(labelProvider, decorator, decorationContext); - } - - public DecoratingCustomizedLabelProvider( - final ICustomizationManager customizationMgr) { - this(new CustomizedLabelProvider(customizationMgr), - new CustomizedLabelDecorator(customizationMgr), null); - this.lblProvider = (ICustomizedLabelProvider) getStyledStringProvider(); - } - - public String getText(final Object element) { - return this.lblProvider.getText(element); - } - - public String getToolTipText(final Object element, - final ETypedElement eTypedElement) { - return this.lblProvider.getToolTipText(element, eTypedElement); - } - - public Image getToolTipImage(final Object element, - final ETypedElement eTypedElement) { - return this.lblProvider.getToolTipImage(element, eTypedElement); - } - - public Font getToolTipFont(final Object element, - final ETypedElement eTypedElement) { - return this.lblProvider.getToolTipFont(element, eTypedElement); - } - - public Color getToolTipBackgroundColor(final Object element, - final ETypedElement eTypedElement) { - return this.lblProvider.getToolTipBackgroundColor(element, - eTypedElement); - } - - public Color getToolTipForegroundColor(final Object element, - final ETypedElement eTypedElement) { - return this.lblProvider.getToolTipForegroundColor(element, - eTypedElement); - } - - public Image getToolTipTopLeftOverlay(final Object element, - final ETypedElement eTypedElement) { - return this.lblProvider - .getToolTipTopLeftOverlay(element, eTypedElement); - } - - public Image getToolTipTopMiddleOverlay(final Object element, - final ETypedElement eTypedElement) { - return this.lblProvider.getToolTipTopMiddleOverlay(element, - eTypedElement); - } - - public Image getToolTipTopRightOverlay(final Object element, - final ETypedElement eTypedElement) { - return this.lblProvider.getToolTipTopRightOverlay(element, - eTypedElement); - } - - public Image getToolTipBottomLeftOverlay(final Object element, - final ETypedElement eTypedElement) { - return this.lblProvider.getToolTipBottomLeftOverlay(element, - eTypedElement); - } - - public Image getToolTipBottomMiddleOverlay(final Object element, - final ETypedElement eTypedElement) { - return this.lblProvider.getToolTipBottomMiddleOverlay(element, - eTypedElement); - } - - public Image getToolTipBottomRightOverlay(final Object element, - final ETypedElement eTypedElement) { - return this.lblProvider.getToolTipBottomRightOverlay(element, - eTypedElement); - } - - public int getToolTipTimeDisplayed(final Object element, - final ETypedElement eTypedElement) { - return this.lblProvider.getToolTipTimeDisplayed(element, eTypedElement); - } - - public int getToolTipDisplayDelayTime(final Object element, - final ETypedElement eTypedElement) { - return this.lblProvider.getToolTipDisplayDelayTime(element, - eTypedElement); - } - - public int getToolTipStyle(final Object element, - final ETypedElement eTypedElement) { - return this.lblProvider.getToolTipStyle(element, eTypedElement); - } - - public ICustomizationManager getCustomizationManager() { - return this.lblProvider.getCustomizationManager(); - } - - public boolean isUnderlined(final Object element, - final ETypedElement eTypedElement) { - return this.lblProvider.isUnderlined(element, eTypedElement); - } - - public boolean isStruckthrough(final Object element, - final ETypedElement eTypedElement) { - return this.lblProvider.isStruckthrough(element, eTypedElement); - } - - public Image getTopLeftOverlay(final Object element, - final ETypedElement eTypedElement) { - return this.lblProvider.getTopLeftOverlay(element, eTypedElement); - } - - public Image getTopMiddleOverlay(final Object element, - final ETypedElement eTypedElement) { - return this.lblProvider.getTopMiddleOverlay(element, eTypedElement); - } - - public Image getTopRightOverlay(final Object element, - final ETypedElement eTypedElement) { - return this.lblProvider.getTopRightOverlay(element, eTypedElement); - } - - public Image getBottomLeftOverlay(final Object element, - final ETypedElement eTypedElement) { - return this.lblProvider.getBottomLeftOverlay(element, eTypedElement); - } - - public Image getBottomMiddleOverlay(final Object element, - final ETypedElement eTypedElement) { - return this.lblProvider.getBottomMiddleOverlay(element, eTypedElement); - } - - public Image getBottomRightOverlay(final Object element, - final ETypedElement eTypedElement) { - return this.lblProvider.getBottomRightOverlay(element, eTypedElement); - } - - public String getText(final Object element, - final ETypedElement eTypedElement) { - return this.lblProvider.getText(element, eTypedElement); - } - - public Image getImage(final Object element, - final ETypedElement eTypedElement) { - return this.lblProvider.getImage(element, eTypedElement); - } - - public ICustomizedLabelProvider cloneLabelProvider() { - return this.lblProvider.cloneLabelProvider(); - } - - public Color getBackground(final Object element, - final ETypedElement eTypedElement) { - return this.lblProvider.getBackground(element, eTypedElement); - } - -}
diff --git a/org.eclipse.modisco.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/internal/DefaultCustomOverride.java b/org.eclipse.modisco.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/internal/DefaultCustomOverride.java deleted file mode 100644 index 56c7bef..0000000 --- a/org.eclipse.modisco.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/internal/DefaultCustomOverride.java +++ /dev/null
@@ -1,55 +0,0 @@ -/** - * Copyright (c) 2013 Soft-Maint. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * David Couvrand (Soft-Maint) - Bug 422058 - Implementation of strikethrough and underline in the CustomizedLabelProvider - */ -package org.eclipse.emf.facet.custom.ui.internal; - -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.facet.custom.core.ICustomizationManager; -import org.eclipse.emf.facet.custom.core.exception.CustomizationException; -import org.eclipse.emf.facet.custom.ui.ICustomOverride; -import org.eclipse.emf.facet.custom.ui.IFontPropertiesHandler; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.FacetOperation; -import org.eclipse.swt.graphics.FontData; - -public class DefaultCustomOverride implements ICustomOverride { - - public String getText(final String result, final Object object, - final ICustomizationManager customManager, - final IFontPropertiesHandler propertiesHandler) - throws CustomizationException { - String newResult = result; - if (object instanceof EObject) { - final EObject eObject = (EObject) object; - final FacetOperation isStruckProp = propertiesHandler - .getIsStruckthroughProperty(); - final boolean isStruckthrough = customManager.getCustomValueOf( - eObject, isStruckProp, Boolean.class).booleanValue(); - if (isStruckthrough) { - newResult = String.format("--%s--", newResult); //$NON-NLS-1$ - } - final FacetOperation isUnderlinedProp = propertiesHandler - .getIsUnderlinedProperty(); - final boolean isUnderlined = customManager.getCustomValueOf( - eObject, isUnderlinedProp, Boolean.class).booleanValue(); - if (isUnderlined) { - newResult = String.format("__%s__", newResult); //$NON-NLS-1$ - } - } - return newResult; - } - - public FontData getFont(final FontData fontData, final Object object, - final ICustomizationManager customManager, - final IFontPropertiesHandler propertiesHandler) { - return fontData; - } - -}
diff --git a/org.eclipse.modisco.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/internal/ImageManager.java b/org.eclipse.modisco.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/internal/ImageManager.java deleted file mode 100644 index 256a26f..0000000 --- a/org.eclipse.modisco.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/internal/ImageManager.java +++ /dev/null
@@ -1,98 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2013 Soft-Maint. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * David Couvrand (Soft-Maint) - Bug 418418 - [Customization] Overlay icons not implemented - * Thomas Cicognani (Soft-Maint) - Bug 424414 - ImageManager doesn't cache images - *******************************************************************************/ -package org.eclipse.emf.facet.custom.ui.internal; - -import java.net.URL; -import java.util.HashMap; -import java.util.Map; - -import org.eclipse.core.runtime.Platform; -import org.eclipse.emf.common.util.URI; -import org.eclipse.emf.facet.custom.metamodel.custompt.IImage; -import org.eclipse.emf.facet.custom.ui.internal.custompt.ImageWrapper; -import org.eclipse.emf.facet.custom.ui.internal.custompt.URIImage; -import org.eclipse.emf.facet.util.core.Logger; -import org.eclipse.emf.facet.util.swt.imageprovider.IImageProvider; -import org.eclipse.emf.facet.util.swt.imageprovider.IImageProviderFactory; -import org.eclipse.jface.resource.ImageDescriptor; -import org.eclipse.osgi.util.NLS; -import org.eclipse.swt.graphics.Device; -import org.eclipse.swt.graphics.Image; -import org.eclipse.ui.PlatformUI; -import org.osgi.framework.Bundle; - -public class ImageManager { - - private final Map<String, ImageDescriptor> uriImageCache = new HashMap<String, ImageDescriptor>(); - - private Image getImage(final URIImage uriImage) { - Image result; - final String uriStr = uriImage.getUri(); - ImageDescriptor imageDescriptor; - if (this.uriImageCache.keySet().contains(uriStr)) { - imageDescriptor = this.uriImageCache.get(uriStr); - } else { - imageDescriptor = createImageDescriptor(uriStr); - this.uriImageCache.put(uriStr, imageDescriptor); - } - final IImageProvider imageProvider = IImageProviderFactory.DEFAULT - .createIImageProvider(Activator.getDefault()); - result = imageProvider.getImage(imageDescriptor); - return result; - } - - - private ImageDescriptor createImageDescriptor(final String uriStr) { - ImageDescriptor imgDecriptor; - final URI uri = URI.createURI(uriStr); - final String bundleId = uri.segment(1); - final Bundle bundle = Platform.getBundle(bundleId); - final URI baseURI = URI.createPlatformPluginURI(bundleId + '/', - false); - final String resourcePath = uri.deresolve(baseURI).toString(); - final URL url = bundle.getResource(resourcePath); - - if (url == null) { - Logger.logError(NLS.bind("Resource not found: {0}", //$NON-NLS-1$ - resourcePath), Activator.getDefault()); - imgDecriptor = ImageDescriptor.getMissingImageDescriptor(); - } else { - imgDecriptor = ImageDescriptor.createFromURL(url); - } - return imgDecriptor; - } - - - public Image getImage(final IImage image) { - Image result = null; - final Device device = PlatformUI.getWorkbench().getDisplay(); - if (image instanceof ImageWrapper) { - final ImageWrapper wrapper = (ImageWrapper) image; - result = wrapper.getImage(); - } else if (image instanceof URIImage) { - final URIImage uriImage = (URIImage) image; - result = getImage(uriImage); - } else if (image != null) { - result = new Image(device, image.getInputStream()); - } - return result; - } - - public ImageDescriptor getImageDescriptor(final IImage image) { - ImageDescriptor result = null; - if (image instanceof URIImage) { - final URIImage uriImage = (URIImage) image; - result = createImageDescriptor(uriImage.getUri()); - } - return result; - } -}
diff --git a/org.eclipse.modisco.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/internal/ImageProvider.java b/org.eclipse.modisco.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/internal/ImageProvider.java deleted file mode 100644 index b70b63d..0000000 --- a/org.eclipse.modisco.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/internal/ImageProvider.java +++ /dev/null
@@ -1,182 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 2010, 2014 Mia-Software. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Nicolas Bros (Mia-Software) - initial API and implementation - * Vincent Lorenzo (CEA-LIST) - bug 341238 - We need to be able to specify which column have to be hidden/visible using the customization mechanism - * Gregoire Dupe (Mia-Software) - Bug 369987 - [Restructuring][Table] Switch to the new customization and facet framework - * Nicolas Bros (Mia-Software) - Bug 379683 - customizable Tree content provider - * Thomas Cicognani (Soft-Maint) - Bug 442711 - Missing icon for URI FacetSet - *******************************************************************************/ - -package org.eclipse.emf.facet.custom.ui.internal; - -import java.net.URL; - -import org.eclipse.emf.facet.util.core.Logger; -import org.eclipse.jface.resource.ImageDescriptor; -import org.eclipse.osgi.util.NLS; -import org.eclipse.swt.SWT; -import org.eclipse.swt.graphics.Image; -import org.eclipse.swt.widgets.Display; - -/** A singleton image provider, which caches image descriptors */ -public final class ImageProvider { - - private ImageProvider() { - // This class must only be instantiated by getInstance(). - } - - private static ImageProvider instance; - - public static ImageProvider getInstance() { - if (ImageProvider.instance == null) { - ImageProvider.instance = new ImageProvider(); - } - return ImageProvider.instance; - } - - private Image uiCustomIcon = null; - private Image grayedUiCustomIcon; - - private Image linkIcon = null; - private Image linkUniDirIcon = null; - private Image linkFacetIcon = null; - private Image aggregIcon = null; - private Image aggregUniDirIcon = null; - private Image invAggregIcon = null; - - private Image attributeIcon = null; - private Image attribFacetIcon = null; - private Image featureIcon = null; - - private static final String UI_CUSTOM = "icons/uiCustom.gif"; //$NON-NLS-1$ - - private static final String AGGREG_UNIDIR = "icons/aggreg_unidir.gif"; //$NON-NLS-1$ - private static final String AGGREG_ICON_PATH = "icons/aggreg.gif"; //$NON-NLS-1$ - private static final String ATTRIBUTE_FACET = "icons/attribute_facet.gif"; //$NON-NLS-1$ - private static final String ATTRIBUTE = "icons/attributes.gif"; //$NON-NLS-1$ - private static final String INV_AGGREG = "icons/inv_aggreg.gif"; //$NON-NLS-1$ - private static final String LINK_FACET = "icons/link_unidir_facet.gif"; //$NON-NLS-1$ - private static final String LINK_UNIDIR = "icons/link_unidir.gif"; //$NON-NLS-1$ - private static final String LINK_ICON_PATH = "icons/link.gif"; //$NON-NLS-1$ - private static final String FEATURE_ICON_PATH = "icons/feature.gif"; //$NON-NLS-1$ - - /** - * Create an image descriptor from a resource - * - * @param resourcePath - * the path of the resource (in the bundle) - * @return the image descriptor - */ - private static ImageDescriptor createImageDescriptor(final String resourcePath) { - final URL url = Activator.getDefault().getBundle().getResource(resourcePath); - ImageDescriptor result; - if (url == null) { - Logger.logError(NLS.bind("Resource not found: {0}", //$NON-NLS-1$ - resourcePath), Activator.getDefault()); - result = ImageDescriptor.getMissingImageDescriptor(); - } else { - result = ImageDescriptor.createFromURL(url); - } - return result; - } - - /** Return an icon for "uiCustom" */ - public Image getUiCustomIcon() { - if (this.uiCustomIcon == null) { - this.uiCustomIcon = createImageDescriptor(ImageProvider.UI_CUSTOM) - .createImage(); - } - return this.uiCustomIcon; - } - - public Image getGrayedUiCustomIcon() { - if (this.grayedUiCustomIcon == null) { - this.grayedUiCustomIcon = new Image(Display.getCurrent(), getUiCustomIcon(), SWT.IMAGE_GRAY); - } - return this.grayedUiCustomIcon; - } - - /** Return the icon representing a bidirectional link */ - public Image getLinkIcon() { - if (this.linkIcon == null) { - this.linkIcon = createImageDescriptor(ImageProvider.LINK_ICON_PATH).createImage(); - } - return this.linkIcon; - } - - /** Return the icon representing an unidirectional link */ - public Image getUnidirectionalLinkIcon() { - if (this.linkUniDirIcon == null) { - this.linkUniDirIcon = createImageDescriptor(ImageProvider.LINK_UNIDIR) - .createImage(); - } - return this.linkUniDirIcon; - } - - /** Return the icon representing a facet reference */ - public Image getFacetLinkIcon() { - if (this.linkFacetIcon == null) { - this.linkFacetIcon = createImageDescriptor(ImageProvider.LINK_FACET) - .createImage(); - } - return this.linkFacetIcon; - } - - /** Return the icon representing a composition link */ - public Image getAggregIcon() { - if (this.aggregIcon == null) { - this.aggregIcon = createImageDescriptor(ImageProvider.AGGREG_ICON_PATH).createImage(); - } - return this.aggregIcon; - } - - /** Return the icon representing an unidirectional composition link */ - public Image getUnidirectionalAggregIcon() { - if (this.aggregUniDirIcon == null) { - this.aggregUniDirIcon = createImageDescriptor(ImageProvider.AGGREG_UNIDIR) - .createImage(); - } - return this.aggregUniDirIcon; - } - - /** Return the icon representing a reverse composition link */ - public Image getInvAggregIcon() { - if (this.invAggregIcon == null) { - this.invAggregIcon = createImageDescriptor(ImageProvider.INV_AGGREG) - .createImage(); - } - return this.invAggregIcon; - } - - /** Return the "attribute" icon */ - public Image getAttributeIcon() { - if (this.attributeIcon == null) { - this.attributeIcon = createImageDescriptor(ImageProvider.ATTRIBUTE) - .createImage(); - } - return this.attributeIcon; - } - - /** Return the "facet attribute" icon */ - public Image getFacetAttributeIcon() { - if (this.attribFacetIcon == null) { - this.attribFacetIcon = createImageDescriptor(ImageProvider.ATTRIBUTE_FACET) - .createImage(); - } - return this.attribFacetIcon; - } - - /** Return the "feature" icon */ - public Image getFeatureIcon() { - if (this.featureIcon == null) { - this.featureIcon = createImageDescriptor(ImageProvider.FEATURE_ICON_PATH).createImage(); - } - return this.featureIcon; - } -}
diff --git a/org.eclipse.modisco.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/internal/Messages.java b/org.eclipse.modisco.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/internal/Messages.java deleted file mode 100644 index 7ec996a..0000000 --- a/org.eclipse.modisco.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/internal/Messages.java +++ /dev/null
@@ -1,70 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009 Mia-Software. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Nicolas Bros (Mia-Software) - initial API and implementation - * Gregoire Dupe (Mia-Software) - Bug 369987 - [Restructuring][Table] Switch to the new customization and facet framework - * Nicolas Bros (Mia-Software) - Bug 372732 - [Facet] Rewrite the catalog views for 0.2 - * Gregoire Dupe (Mia-Software) - Bug 373078 - API Cleaning - * Vincent Lorenzo (CEA-LIST) - Bug 373255 - Add tooltips providing a documentation for the selected elements in the Select ETypedElement Dialog - *******************************************************************************/ -package org.eclipse.emf.facet.custom.ui.internal; - -import org.eclipse.osgi.util.NLS; - -public final class Messages extends NLS { - private static final String BUNDLE_NAME = "org.eclipse.emf.facet.custom.ui.internal.messages"; //$NON-NLS-1$ - public static String CustomizationsCatalogView_title; - public static String CustomizationsView_allQuerySets; - public static String CustomizationsView_jobName_RefreshCustomizationsView; - public static String CustomizationsView_extendsColumn; - public static String CustomizationsView_nameColumn; - public static String CustomizationsView_documentationColumn; - public static String CustomizedLabelProvider_null; - public static String NewCustomizationFilePage_browserCustomization; - public static String NewCustomizationFilePage_createsBrowserCustomization; - public static String NewCustomizationFilePage_customizationInNonEmfFacetProject; - public static String NewCustomizationWizard_newBrowserCustomization; - public static String QuerySetsSelectionControl_allExistingQuerySets; - public static String QuerySetsSelectionControl_availableQuerySets; - public static String QuerySetsSelectionControl_deselectAll; - public static String QuerySetsSelectionControl_querySetsSelectedBelowOnly; - public static String QuerySetsSelectionControl_selectAll; - public static String SelectMetamodelsPage_selectMetamodel; - public static String SelectMetamodelsPage_selectMetamodelToCustomize; - public static String SelectQuerySetsPage_selectAvailableQuerySets; - public static String SelectQuerySetsPage_selectAvailableQuerySetsInCustomization; - public static String LoadCustomizationsDialog_Add; - public static String LoadCustomizationsDialog_Add2; - public static String LoadCustomizationsDialog_AddAll; - public static String LoadCustomizationsDialog_AddAll2; - public static String LoadCustomizationsDialog_AvailiableCustom; - public static String LoadCustomizationsDialog_Can_not_be_unload; - public static String LoadCustomizationsDialog_Down; - public static String LoadCustomizationsDialog_LoadedCustomizations; - public static String LoadCustomizationsDialog_LoadCustomizationWarning; - public static String LoadCustomizationsDialog_Loading; - public static String LoadCustomizationsDialog_loadReferencedFacetsCheckbox; - public static String LoadCustomizationsDialog_OK; - public static String LoadCustomizationsDialog_Remove; - public static String LoadCustomizationsDialog_Remove2; - public static String LoadCustomizationsDialog_RemoveAll; - public static String LoadCustomizationsDialog_RemoveAll2; - public static String LoadCustomizationsDialog_title_LoadCustomizations; - public static String LoadCustomizationsDialog_type_filter_test; - public static String LoadCustomizationsDialog_Up; - public static String ToolTipTextQuery_Documentation; - public static String ToolTipTextQuery_NoDocumentation; - static { - // initialize resource bundle - NLS.initializeMessages(Messages.BUNDLE_NAME, Messages.class); - } - - private Messages() { - // cannot be instantiated - } -}
diff --git a/org.eclipse.modisco.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/internal/PropertiesHandler.java b/org.eclipse.modisco.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/internal/PropertiesHandler.java deleted file mode 100644 index bb34c94..0000000 --- a/org.eclipse.modisco.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/internal/PropertiesHandler.java +++ /dev/null
@@ -1,313 +0,0 @@ -/** - * Copyright (c) 2012, 2014 Mia-Software. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Gregoire Dupe (Mia-Software) - Bug 361794 - [Restructuring] New customization meta-model - * Gregoire Dupe (Mia-Software) - Bug 369987 - [Restructuring][Table] Switch to the new customization and facet framework - * Vincent Lorenzo (CEA-LIST) - Bug 372644 - Create Customizable tooltips for the TreeViewer using a CustomizableLabelProvider - * Gregoire Dupe (Mia-Software) - Bug 372644 - Create Customizable tooltips for the TreeViewer using a CustomizableLabelProvider - * Gregoire Dupe (Mia-Software) - Bug 373078 - API Cleaning - * Nicolas Bros (Mia-Software) - Bug 377866 - selection customization - * David Couvrand (Soft-Maint) - Bug 422058 - Implementation of strikethrough and underline in the CustomizedLabelProvider - * Gregoire Dupe (Mia-Software) - Bug 441570 - Children custom property - * Gregoire Dupe (Mia-Software) - Bug 443682 - Access to the super facet - */ -package org.eclipse.emf.facet.custom.ui.internal; - -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import org.eclipse.emf.common.util.URI; -import org.eclipse.emf.ecore.ETypedElement; -import org.eclipse.emf.ecore.resource.Resource; -import org.eclipse.emf.ecore.resource.ResourceSet; -import org.eclipse.emf.facet.custom.core.ICustomizationManager; -import org.eclipse.emf.facet.custom.ui.IContentPropertiesHandler; -import org.eclipse.emf.facet.custom.ui.IFontPropertiesHandler; -import org.eclipse.emf.facet.custom.ui.ISelectionPropertiesHandler; -import org.eclipse.emf.facet.custom.ui.internal.exported.ILabelPropertiesHandler; -import org.eclipse.emf.facet.efacet.core.FacetUtils; -import org.eclipse.emf.facet.efacet.core.IFacetManager; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.Facet; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.FacetOperation; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.FacetSet; - -public class PropertiesHandler implements IContentPropertiesHandler, - ILabelPropertiesHandler, ISelectionPropertiesHandler, IFontPropertiesHandler { - private static final String SEPARATOR = "::"; //$NON-NLS-1$ - private static final String CUSTOM_PROPERTIES = "resources/customproperties.efacet"; //$NON-NLS-1$ - - private static final String CUSTOM = "CustomizedEObject"; //$NON-NLS-1$ - private static final String TT_CUSTOM = "CustomizedToolTipEObject"; //$NON-NLS-1$ - - private static final String IMAGE = "image"; //$NON-NLS-1$ - private static final String LABEL = "label"; //$NON-NLS-1$ - private static final String BACKGROUND = "background"; //$NON-NLS-1$ - private static final String FOREGROUND = "foreground"; //$NON-NLS-1$ - private static final String FONT = "fontName"; //$NON-NLS-1$ - private static final String FONT_SIZE = "fontSize"; //$NON-NLS-1$ - private static final String IS_BOLD = "isBold"; //$NON-NLS-1$ - private static final String IS_ITALIC = "isItalic"; //$NON-NLS-1$ - private static final String IS_VISIBLE = "isVisible"; //$NON-NLS-1$ - private static final String IS_UNDERLINED = "isUnderlined"; //$NON-NLS-1$ - private static final String IS_STRUCKTHROUGH = "isStruckthrough"; //$NON-NLS-1$ - private static final String TOP_L_OVERLAY = "topLeftOverlay"; //$NON-NLS-1$ - private static final String TOP_M_OVERLAY = "topMiddleOverlay"; //$NON-NLS-1$ - private static final String TOP_R_OVERLAY = "topRightOverlay"; //$NON-NLS-1$ - private static final String BOTTOM_L_OVERLAY = "bottomLeftOverlay"; //$NON-NLS-1$ - private static final String BOTTOM_M_OVERLAY = "bottomMiddleOverlay"; //$NON-NLS-1$ - private static final String BOTTOM_R_OVERLAY = "bottomRightOverlay"; //$NON-NLS-1$ - private static final String SELECTION = "selection"; //$NON-NLS-1$ - private static final String CHILDREN = "children"; //$NON-NLS-1$ - - //for tooltips - private static final String TEXT = "text"; //$NON-NLS-1$ - private static final String TIME_DISPLAYED = "timeDisplayed"; //$NON-NLS-1$ - private static final String DISPLAY_DELAY = "displayDelayTime"; //$NON-NLS-1$ - private static final String SHADOW = "shadow"; //$NON-NLS-1$ - private static final String ALIGNMENT = "alignment"; //$NON-NLS-1$ - - private final Resource resource; - private final Map<String, FacetOperation> map = new HashMap<String, FacetOperation>(); - - /** - * - * @deprecated Must be replaced by - * org.eclipse.emf.facet.custom.ui.internal.PropertiesHandler - * .PropertiesHandler(ICustomizationManager) - */ - @Deprecated - public PropertiesHandler(final ResourceSet resourceSet) { - final String bundleName = Activator.getDefault().getBundle().getSymbolicName(); - URI propertiesUri = URI.createPlatformPluginURI(bundleName, true); - propertiesUri = propertiesUri - .appendSegments(PropertiesHandler.CUSTOM_PROPERTIES.split("/")); //$NON-NLS-1$ - this.resource = resourceSet.getResource(propertiesUri, true); - } - - public PropertiesHandler(final ICustomizationManager customizationMgr) { - final String bundleName = Activator.getDefault().getBundle().getSymbolicName(); - URI propertiesUri = URI.createPlatformPluginURI(bundleName, true); - propertiesUri = propertiesUri - .appendSegments(PropertiesHandler.CUSTOM_PROPERTIES.split("/")); //$NON-NLS-1$ - final ResourceSet resourceSet = customizationMgr.getResourceSet(); - this.resource = resourceSet.getResource(propertiesUri, true); - final FacetSet facetSet = (FacetSet) this.resource.getContents().get(0); - final IFacetManager facetManager = customizationMgr.getFacetManager(); - final List<FacetSet> facetSets = facetManager.getManagedFacetSets(); - facetSets.add(facetSet); - } - - private FacetOperation getPropertyByName(final String facetName, - final String propertyName) { - final String key = facetName + PropertiesHandler.SEPARATOR + propertyName; - FacetOperation result = this.map.get(key); - if (result == null) { - final FacetSet facetSet = (FacetSet) this.resource.getContents() - .get(0); - final Facet facet = FacetUtils.getFacet( - FacetUtils.getFacets(facetSet), - facetName); - final ETypedElement eTypedElement = FacetUtils - .getETypedElement(facet, propertyName, - ETypedElement.class); - if (eTypedElement instanceof FacetOperation) { - result = (FacetOperation) eTypedElement; - this.map.put(key, result); - } - } - return result; - } - - public FacetOperation getImageProperty() { - return getPropertyByName(PropertiesHandler.CUSTOM, - PropertiesHandler.IMAGE); - } - - public FacetOperation getLabelProperty() { - return getPropertyByName(PropertiesHandler.CUSTOM, - PropertiesHandler.LABEL); - } - - public FacetOperation getBackgroundProperty() { - return getPropertyByName(PropertiesHandler.CUSTOM, - PropertiesHandler.BACKGROUND); - } - - public FacetOperation getForegroundProperty() { - return getPropertyByName(PropertiesHandler.CUSTOM, - PropertiesHandler.FOREGROUND); - } - - public FacetOperation getFontNameProperty() { - return getPropertyByName(PropertiesHandler.CUSTOM, - PropertiesHandler.FONT); - } - - public FacetOperation getFontSizeProperty() { - return getPropertyByName(PropertiesHandler.CUSTOM, - PropertiesHandler.FONT_SIZE); - } - - public FacetOperation getIsBoldProperty() { - return getPropertyByName(PropertiesHandler.CUSTOM, - PropertiesHandler.IS_BOLD); - } - - public FacetOperation getIsItalicProperty() { - return getPropertyByName(PropertiesHandler.CUSTOM, - PropertiesHandler.IS_ITALIC); - } - - public FacetOperation getIsVisible() { - return getPropertyByName(PropertiesHandler.CUSTOM, - PropertiesHandler.IS_VISIBLE); - } - - public FacetOperation getIsUnderlinedProperty() { - return getPropertyByName(PropertiesHandler.CUSTOM, - PropertiesHandler.IS_UNDERLINED); - } - - public FacetOperation getIsStruckthroughProperty() { - return getPropertyByName(PropertiesHandler.CUSTOM, - PropertiesHandler.IS_STRUCKTHROUGH); - } - - public FacetOperation getTopLeftOverlayProperty() { - return getPropertyByName(PropertiesHandler.CUSTOM, - PropertiesHandler.TOP_L_OVERLAY); - } - - public FacetOperation getTopMiddleOverlayProperty() { - return getPropertyByName(PropertiesHandler.CUSTOM, - PropertiesHandler.TOP_M_OVERLAY); - } - - public FacetOperation getTopRightOverlayProperty() { - return getPropertyByName(PropertiesHandler.CUSTOM, - PropertiesHandler.TOP_R_OVERLAY); - } - - public FacetOperation getBottomLeftOverlayProperty() { - return getPropertyByName(PropertiesHandler.CUSTOM, - PropertiesHandler.BOTTOM_L_OVERLAY); - } - - public FacetOperation getBottomMiddleOverlayProperty() { - return getPropertyByName(PropertiesHandler.CUSTOM, - PropertiesHandler.BOTTOM_M_OVERLAY); - } - - public FacetOperation getBottomRightOverlayProperty() { - return getPropertyByName(PropertiesHandler.CUSTOM, - PropertiesHandler.BOTTOM_R_OVERLAY); - } - - public FacetOperation getSelectionProperty() { - return getPropertyByName(PropertiesHandler.CUSTOM, - PropertiesHandler.SELECTION); - } - - // methods for tooltips - public FacetOperation getToolTipTextProperty() { - return getPropertyByName(PropertiesHandler.TT_CUSTOM, - PropertiesHandler.TEXT); - } - - public FacetOperation getToolTipImageProperty() { - return getPropertyByName(PropertiesHandler.TT_CUSTOM, - PropertiesHandler.IMAGE); - } - - public FacetOperation getToolTipFontNameProperty() { - return getPropertyByName(PropertiesHandler.TT_CUSTOM, - PropertiesHandler.FONT); - } - - public FacetOperation getToolTipFontSizeProperty() { - return getPropertyByName(PropertiesHandler.TT_CUSTOM, - PropertiesHandler.FONT_SIZE); - } - - public FacetOperation getToolTipIsBoldProperty() { - return getPropertyByName(PropertiesHandler.TT_CUSTOM, - PropertiesHandler.IS_BOLD); - } - - public FacetOperation getToolTipIsItalicProperty() { - return getPropertyByName(PropertiesHandler.TT_CUSTOM, - PropertiesHandler.IS_ITALIC); - } - - public FacetOperation getToolTipBackgroundProperty() { - return getPropertyByName(PropertiesHandler.TT_CUSTOM, - PropertiesHandler.BACKGROUND); - } - - public FacetOperation getToolTipForegroundProperty() { - return getPropertyByName(PropertiesHandler.TT_CUSTOM, - PropertiesHandler.FOREGROUND); - } - - public FacetOperation getToolTipTopLeftOverlayProperty() { - return getPropertyByName(PropertiesHandler.TT_CUSTOM, - PropertiesHandler.TOP_L_OVERLAY); - } - - public FacetOperation getToolTipTopMiddleOverlayProperty() { - return getPropertyByName(PropertiesHandler.TT_CUSTOM, - PropertiesHandler.TOP_M_OVERLAY); - } - - public FacetOperation getToolTipTopRightOverlayProperty() { - return getPropertyByName(PropertiesHandler.TT_CUSTOM, - PropertiesHandler.TOP_R_OVERLAY); - } - - public FacetOperation getToolTipBottomLeftOverlayProperty() { - return getPropertyByName(PropertiesHandler.TT_CUSTOM, - PropertiesHandler.BOTTOM_L_OVERLAY); - } - - public FacetOperation getToolTipBottomMiddleOverlayProperty() { - return getPropertyByName(PropertiesHandler.TT_CUSTOM, - PropertiesHandler.BOTTOM_M_OVERLAY); - } - - public FacetOperation getToolTipBottomRightOverlayProperty() { - return getPropertyByName(PropertiesHandler.TT_CUSTOM, - PropertiesHandler.BOTTOM_R_OVERLAY); - } - - public FacetOperation getToolTipTimeDisplayedProperty() { - return getPropertyByName(PropertiesHandler.TT_CUSTOM, - PropertiesHandler.TIME_DISPLAYED); - } - - public FacetOperation getToolTipDisplayDelayTimeProperty() { - return getPropertyByName(PropertiesHandler.TT_CUSTOM, - PropertiesHandler.DISPLAY_DELAY); - } - - public FacetOperation getToolTipAlignmentProperty() { - return getPropertyByName(PropertiesHandler.TT_CUSTOM, - PropertiesHandler.ALIGNMENT); - } - - public FacetOperation getToolTipShadowProperty() { - return getPropertyByName(PropertiesHandler.TT_CUSTOM, - PropertiesHandler.SHADOW); - } - - public FacetOperation getChildren() { - return getPropertyByName(PropertiesHandler.CUSTOM, - PropertiesHandler.CHILDREN); - } -} \ No newline at end of file
diff --git a/org.eclipse.modisco.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/internal/PropertiesHandlerFactory.java b/org.eclipse.modisco.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/internal/PropertiesHandlerFactory.java deleted file mode 100644 index cc545fc..0000000 --- a/org.eclipse.modisco.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/internal/PropertiesHandlerFactory.java +++ /dev/null
@@ -1,53 +0,0 @@ -/** - * Copyright (c) 2012 Mia-Software. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Gregoire Dupe (Mia-Software) - Bug 369987 - [Restructuring][Table] Switch to the new customization and facet framework - * Gregoire Dupe (Mia-Software) - Bug 373078 - API Cleaning - * Nicolas Bros (Mia-Software) - Bug 377866 - selection customization - */ -package org.eclipse.emf.facet.custom.ui.internal; - -import org.eclipse.emf.ecore.resource.ResourceSet; -import org.eclipse.emf.facet.custom.core.ICustomizationManager; -import org.eclipse.emf.facet.custom.ui.IContentPropertiesHandler; -import org.eclipse.emf.facet.custom.ui.IContentPropertiesHandlerFactory; -import org.eclipse.emf.facet.custom.ui.ISelectionPropertiesHandler; -import org.eclipse.emf.facet.custom.ui.ISelectionPropertiesHandlerFactory; -import org.eclipse.emf.facet.custom.ui.internal.exported.ILabelPropertiesHandler; -import org.eclipse.emf.facet.custom.ui.internal.exported.ILabelPropertiesHandlerFactory; - -public class PropertiesHandlerFactory implements - IContentPropertiesHandlerFactory, ILabelPropertiesHandlerFactory, ISelectionPropertiesHandlerFactory { - - /** - * @deprecated must be replaced by - * org.eclipse.emf.facet.custom.ui.internal.PropertiesHandlerFactory - * .createIContentPropertiesHandler(ICustomizationManager) - */ - @Deprecated - public IContentPropertiesHandler createIContentPropertiesHandler( - final ResourceSet resourceSet) { - return new PropertiesHandler(resourceSet); - } - - public IContentPropertiesHandler createIContentPropertiesHandler( - final ICustomizationManager customizationMgr) { - return new PropertiesHandler(customizationMgr); - } - - public ILabelPropertiesHandler createLabelPropertiesHandler( - final ICustomizationManager customizationMgr) { - return new PropertiesHandler(customizationMgr); - } - - public ISelectionPropertiesHandler createSelectionPropertiesHandler(final ICustomizationManager customManager) { - return new PropertiesHandler(customManager); - } - -}
diff --git a/org.eclipse.modisco.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/internal/ResolvingCustomizedLabelProvider.java b/org.eclipse.modisco.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/internal/ResolvingCustomizedLabelProvider.java deleted file mode 100644 index c4018ef..0000000 --- a/org.eclipse.modisco.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/internal/ResolvingCustomizedLabelProvider.java +++ /dev/null
@@ -1,498 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2012, 2017 Mia-Software. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Nicolas Bros (Mia-Software) - Bug 379683 - customizable Tree content provider - * Thomas Cicognani (Mia-Software) - Bug 513070 - NatTable and customization: cannot change background from columns - *******************************************************************************/ -package org.eclipse.emf.facet.custom.ui.internal; - -import org.eclipse.emf.ecore.ETypedElement; -import org.eclipse.emf.facet.custom.core.ICustomizationManager; -import org.eclipse.emf.facet.custom.metamodel.v0_2_0.internal.treeproxy.EAttributeTreeElement; -import org.eclipse.emf.facet.custom.metamodel.v0_2_0.internal.treeproxy.EObjectTreeElement; -import org.eclipse.emf.facet.custom.metamodel.v0_2_0.internal.treeproxy.EReferenceTreeElement; -import org.eclipse.emf.facet.custom.ui.CustomizedContentProviderUtils; -import org.eclipse.emf.facet.custom.ui.ICustomizedLabelProvider; -import org.eclipse.jface.viewers.ILabelProviderListener; -import org.eclipse.jface.viewers.ViewerCell; -import org.eclipse.swt.graphics.Color; -import org.eclipse.swt.graphics.Font; -import org.eclipse.swt.graphics.Image; - -public class ResolvingCustomizedLabelProvider implements ICustomizedLabelProvider { - - private final ICustomizedLabelProvider delegate; - - public ResolvingCustomizedLabelProvider(final ICustomizedLabelProvider delegate) { - super(); - this.delegate = delegate; - } - - public Image getImage(final Object element) { - Image image; - if (element instanceof EReferenceTreeElement) { - final EReferenceTreeElement treeElement = (EReferenceTreeElement) element; - final EObjectTreeElement parent = (EObjectTreeElement) treeElement.getParent(); - image = this.delegate.getImage(parent.getEObject(), treeElement.getEReference()); - } else if (element instanceof EAttributeTreeElement) { - final EAttributeTreeElement treeElement = (EAttributeTreeElement) element; - final EObjectTreeElement parent = (EObjectTreeElement) treeElement.getParent(); - image = this.delegate.getImage(parent.getEObject(), treeElement.getEAttribute()); - } else { - image = this.delegate.getImage(CustomizedContentProviderUtils.resolve(element)); - } - return image; - } - - public String getText(final Object element) { - String result; - if (element instanceof EReferenceTreeElement) { - final EReferenceTreeElement treeElement = (EReferenceTreeElement) element; - final EObjectTreeElement parent = (EObjectTreeElement) treeElement.getParent(); - result = this.delegate.getText(parent.getEObject(), treeElement.getEReference()); - } else if (element instanceof EAttributeTreeElement) { - final EAttributeTreeElement treeElement = (EAttributeTreeElement) element; - final EObjectTreeElement parent = (EObjectTreeElement) treeElement.getParent(); - result = this.delegate.getText(parent.getEObject(), treeElement.getEAttribute()); - } else { - result = this.delegate.getText(CustomizedContentProviderUtils.resolve(element)); - } - return result; - } - - public void addListener(final ILabelProviderListener listener) { - this.delegate.addListener(listener); - } - - public void dispose() { - this.delegate.dispose(); - } - - public boolean isLabelProperty(final Object element, final String property) { - return this.delegate.isLabelProperty(CustomizedContentProviderUtils.resolve(element), property); - } - - public void removeListener(final ILabelProviderListener listener) { - this.delegate.removeListener(listener); - } - - public Color getForeground(final Object element) { - return this.delegate.getForeground(CustomizedContentProviderUtils.resolve(element)); - } - - public Color getBackground(final Object element) { - return this.delegate.getBackground(CustomizedContentProviderUtils.resolve(element)); - } - - public Font getFont(final Object element) { - return this.delegate.getFont(CustomizedContentProviderUtils.resolve(element)); - } - - public void update(final ViewerCell cell) { - this.delegate.update(cell); - } - - public String getToolTipText(final Object element, final ETypedElement eTypedElement) { - String result; - if (element instanceof EReferenceTreeElement) { - final EReferenceTreeElement treeElement = (EReferenceTreeElement) element; - final EObjectTreeElement parent = (EObjectTreeElement) treeElement.getParent(); - result = this.delegate.getToolTipText(parent.getEObject(), treeElement.getEReference()); - } else if (element instanceof EAttributeTreeElement) { - final EAttributeTreeElement treeElement = (EAttributeTreeElement) element; - final EObjectTreeElement parent = (EObjectTreeElement) treeElement.getParent(); - result = this.delegate.getToolTipText(parent.getEObject(), treeElement.getEAttribute()); - } else { - result = this.delegate.getToolTipText(CustomizedContentProviderUtils.resolve(element), eTypedElement); - } - return result; - } - - public Image getToolTipImage(final Object element, final ETypedElement eTypedElement) { - Image result; - if (element instanceof EReferenceTreeElement) { - final EReferenceTreeElement treeElement = (EReferenceTreeElement) element; - final EObjectTreeElement parent = (EObjectTreeElement) treeElement.getParent(); - result = this.delegate.getToolTipImage(parent.getEObject(), treeElement.getEReference()); - } else if (element instanceof EAttributeTreeElement) { - final EAttributeTreeElement treeElement = (EAttributeTreeElement) element; - final EObjectTreeElement parent = (EObjectTreeElement) treeElement.getParent(); - result = this.delegate.getToolTipImage(parent.getEObject(), treeElement.getEAttribute()); - } else { - result = this.delegate.getToolTipImage(CustomizedContentProviderUtils.resolve(element), eTypedElement); - } - return result; - } - - public Font getToolTipFont(final Object element, final ETypedElement eTypedElement) { - Font result; - if (element instanceof EReferenceTreeElement) { - final EReferenceTreeElement treeElement = (EReferenceTreeElement) element; - final EObjectTreeElement parent = (EObjectTreeElement) treeElement.getParent(); - result = this.delegate.getToolTipFont(parent.getEObject(), treeElement.getEReference()); - } else if (element instanceof EAttributeTreeElement) { - final EAttributeTreeElement treeElement = (EAttributeTreeElement) element; - final EObjectTreeElement parent = (EObjectTreeElement) treeElement.getParent(); - result = this.delegate.getToolTipFont(parent.getEObject(), treeElement.getEAttribute()); - } else { - result = this.delegate.getToolTipFont(CustomizedContentProviderUtils.resolve(element), eTypedElement); - } - return result; - } - - public Color getToolTipBackgroundColor(final Object element, final ETypedElement eTypedElement) { - Color result; - if (element instanceof EReferenceTreeElement) { - final EReferenceTreeElement treeElement = (EReferenceTreeElement) element; - final EObjectTreeElement parent = (EObjectTreeElement) treeElement.getParent(); - result = this.delegate.getToolTipBackgroundColor(parent.getEObject(), treeElement.getEReference()); - } else if (element instanceof EAttributeTreeElement) { - final EAttributeTreeElement treeElement = (EAttributeTreeElement) element; - final EObjectTreeElement parent = (EObjectTreeElement) treeElement.getParent(); - result = this.delegate.getToolTipBackgroundColor(parent.getEObject(), treeElement.getEAttribute()); - } else { - result = this.delegate.getToolTipBackgroundColor(CustomizedContentProviderUtils.resolve(element), eTypedElement); - } - return result; - } - - public Color getToolTipForegroundColor(final Object element, final ETypedElement eTypedElement) { - Color result; - if (element instanceof EReferenceTreeElement) { - final EReferenceTreeElement treeElement = (EReferenceTreeElement) element; - final EObjectTreeElement parent = (EObjectTreeElement) treeElement.getParent(); - result = this.delegate.getToolTipForegroundColor(parent.getEObject(), treeElement.getEReference()); - } else if (element instanceof EAttributeTreeElement) { - final EAttributeTreeElement treeElement = (EAttributeTreeElement) element; - final EObjectTreeElement parent = (EObjectTreeElement) treeElement.getParent(); - result = this.delegate.getToolTipForegroundColor(parent.getEObject(), treeElement.getEAttribute()); - } else { - result = this.delegate.getToolTipForegroundColor(CustomizedContentProviderUtils.resolve(element), eTypedElement); - } - return result; - } - - public Image getToolTipTopLeftOverlay(final Object element, final ETypedElement eTypedElement) { - Image result; - if (element instanceof EReferenceTreeElement) { - final EReferenceTreeElement treeElement = (EReferenceTreeElement) element; - final EObjectTreeElement parent = (EObjectTreeElement) treeElement.getParent(); - result = this.delegate.getToolTipTopLeftOverlay(parent.getEObject(), treeElement.getEReference()); - } else if (element instanceof EAttributeTreeElement) { - final EAttributeTreeElement treeElement = (EAttributeTreeElement) element; - final EObjectTreeElement parent = (EObjectTreeElement) treeElement.getParent(); - result = this.delegate.getToolTipTopLeftOverlay(parent.getEObject(), treeElement.getEAttribute()); - } else { - result = this.delegate.getToolTipTopLeftOverlay(CustomizedContentProviderUtils.resolve(element), eTypedElement); - } - return result; - } - - public Image getToolTipTopMiddleOverlay(final Object element, final ETypedElement eTypedElement) { - Image result; - if (element instanceof EReferenceTreeElement) { - final EReferenceTreeElement treeElement = (EReferenceTreeElement) element; - final EObjectTreeElement parent = (EObjectTreeElement) treeElement.getParent(); - result = this.delegate.getToolTipTopMiddleOverlay(parent.getEObject(), treeElement.getEReference()); - } else if (element instanceof EAttributeTreeElement) { - final EAttributeTreeElement treeElement = (EAttributeTreeElement) element; - final EObjectTreeElement parent = (EObjectTreeElement) treeElement.getParent(); - result = this.delegate.getToolTipTopMiddleOverlay(parent.getEObject(), treeElement.getEAttribute()); - } else { - result = this.delegate.getToolTipTopMiddleOverlay(CustomizedContentProviderUtils.resolve(element), eTypedElement); - } - return result; - } - - public Image getToolTipTopRightOverlay(final Object element, final ETypedElement eTypedElement) { - Image result; - if (element instanceof EReferenceTreeElement) { - final EReferenceTreeElement treeElement = (EReferenceTreeElement) element; - final EObjectTreeElement parent = (EObjectTreeElement) treeElement.getParent(); - result = this.delegate.getToolTipTopRightOverlay(parent.getEObject(), treeElement.getEReference()); - } else if (element instanceof EAttributeTreeElement) { - final EAttributeTreeElement treeElement = (EAttributeTreeElement) element; - final EObjectTreeElement parent = (EObjectTreeElement) treeElement.getParent(); - result = this.delegate.getToolTipTopRightOverlay(parent.getEObject(), treeElement.getEAttribute()); - } else { - result = this.delegate.getToolTipTopRightOverlay(CustomizedContentProviderUtils.resolve(element), eTypedElement); - } - return result; - } - - public Image getToolTipBottomLeftOverlay(final Object element, final ETypedElement eTypedElement) { - Image result; - if (element instanceof EReferenceTreeElement) { - final EReferenceTreeElement treeElement = (EReferenceTreeElement) element; - final EObjectTreeElement parent = (EObjectTreeElement) treeElement.getParent(); - result = this.delegate.getToolTipBottomLeftOverlay(parent.getEObject(), treeElement.getEReference()); - } else if (element instanceof EAttributeTreeElement) { - final EAttributeTreeElement treeElement = (EAttributeTreeElement) element; - final EObjectTreeElement parent = (EObjectTreeElement) treeElement.getParent(); - result = this.delegate.getToolTipBottomLeftOverlay(parent.getEObject(), treeElement.getEAttribute()); - } else { - result = this.delegate.getToolTipBottomLeftOverlay(CustomizedContentProviderUtils.resolve(element), eTypedElement); - } - return result; - } - - public Image getToolTipBottomMiddleOverlay(final Object element, final ETypedElement eTypedElement) { - Image result; - if (element instanceof EReferenceTreeElement) { - final EReferenceTreeElement treeElement = (EReferenceTreeElement) element; - final EObjectTreeElement parent = (EObjectTreeElement) treeElement.getParent(); - result = this.delegate.getToolTipBottomMiddleOverlay(parent.getEObject(), treeElement.getEReference()); - } else if (element instanceof EAttributeTreeElement) { - final EAttributeTreeElement treeElement = (EAttributeTreeElement) element; - final EObjectTreeElement parent = (EObjectTreeElement) treeElement.getParent(); - result = this.delegate.getToolTipBottomMiddleOverlay(parent.getEObject(), treeElement.getEAttribute()); - } else { - result = this.delegate.getToolTipBottomMiddleOverlay(CustomizedContentProviderUtils.resolve(element), eTypedElement); - } - return result; - } - - public Image getToolTipBottomRightOverlay(final Object element, final ETypedElement eTypedElement) { - Image result; - if (element instanceof EReferenceTreeElement) { - final EReferenceTreeElement treeElement = (EReferenceTreeElement) element; - final EObjectTreeElement parent = (EObjectTreeElement) treeElement.getParent(); - result = this.delegate.getToolTipBottomRightOverlay(parent.getEObject(), treeElement.getEReference()); - } else if (element instanceof EAttributeTreeElement) { - final EAttributeTreeElement treeElement = (EAttributeTreeElement) element; - final EObjectTreeElement parent = (EObjectTreeElement) treeElement.getParent(); - result = this.delegate.getToolTipBottomRightOverlay(parent.getEObject(), treeElement.getEAttribute()); - } else { - result = this.delegate.getToolTipBottomRightOverlay(CustomizedContentProviderUtils.resolve(element), eTypedElement); - } - return result; - } - - public int getToolTipTimeDisplayed(final Object element, final ETypedElement eTypedElement) { - int result; - if (element instanceof EReferenceTreeElement) { - final EReferenceTreeElement treeElement = (EReferenceTreeElement) element; - final EObjectTreeElement parent = (EObjectTreeElement) treeElement.getParent(); - result = this.delegate.getToolTipTimeDisplayed(parent.getEObject(), treeElement.getEReference()); - } else if (element instanceof EAttributeTreeElement) { - final EAttributeTreeElement treeElement = (EAttributeTreeElement) element; - final EObjectTreeElement parent = (EObjectTreeElement) treeElement.getParent(); - result = this.delegate.getToolTipTimeDisplayed(parent.getEObject(), treeElement.getEAttribute()); - } else { - result = this.delegate.getToolTipTimeDisplayed(CustomizedContentProviderUtils.resolve(element), eTypedElement); - } - return result; - } - - public int getToolTipDisplayDelayTime(final Object element, final ETypedElement eTypedElement) { - int result; - if (element instanceof EReferenceTreeElement) { - final EReferenceTreeElement treeElement = (EReferenceTreeElement) element; - final EObjectTreeElement parent = (EObjectTreeElement) treeElement.getParent(); - result = this.delegate.getToolTipDisplayDelayTime(parent.getEObject(), treeElement.getEReference()); - } else if (element instanceof EAttributeTreeElement) { - final EAttributeTreeElement treeElement = (EAttributeTreeElement) element; - final EObjectTreeElement parent = (EObjectTreeElement) treeElement.getParent(); - result = this.delegate.getToolTipDisplayDelayTime(parent.getEObject(), treeElement.getEAttribute()); - } else { - result = this.delegate.getToolTipDisplayDelayTime(CustomizedContentProviderUtils.resolve(element), eTypedElement); - } - return result; - } - - public int getToolTipStyle(final Object element, final ETypedElement eTypedElement) { - int result; - if (element instanceof EReferenceTreeElement) { - final EReferenceTreeElement treeElement = (EReferenceTreeElement) element; - final EObjectTreeElement parent = (EObjectTreeElement) treeElement.getParent(); - result = this.delegate.getToolTipStyle(parent.getEObject(), treeElement.getEReference()); - } else if (element instanceof EAttributeTreeElement) { - final EAttributeTreeElement treeElement = (EAttributeTreeElement) element; - final EObjectTreeElement parent = (EObjectTreeElement) treeElement.getParent(); - result = this.delegate.getToolTipStyle(parent.getEObject(), treeElement.getEAttribute()); - } else { - result = this.delegate.getToolTipStyle(CustomizedContentProviderUtils.resolve(element), eTypedElement); - } - return result; - } - - public ICustomizationManager getCustomizationManager() { - return this.delegate.getCustomizationManager(); - } - - public boolean isUnderlined(final Object element, final ETypedElement eTypedElement) { - boolean result; - if (element instanceof EReferenceTreeElement) { - final EReferenceTreeElement treeElement = (EReferenceTreeElement) element; - final EObjectTreeElement parent = (EObjectTreeElement) treeElement.getParent(); - result = this.delegate.isUnderlined(parent.getEObject(), treeElement.getEReference()); - } else if (element instanceof EAttributeTreeElement) { - final EAttributeTreeElement treeElement = (EAttributeTreeElement) element; - final EObjectTreeElement parent = (EObjectTreeElement) treeElement.getParent(); - result = this.delegate.isUnderlined(parent.getEObject(), treeElement.getEAttribute()); - } else { - result = this.delegate.isUnderlined(CustomizedContentProviderUtils.resolve(element), eTypedElement); - } - return result; - } - - public boolean isStruckthrough(final Object element, final ETypedElement eTypedElement) { - boolean result; - if (element instanceof EReferenceTreeElement) { - final EReferenceTreeElement treeElement = (EReferenceTreeElement) element; - final EObjectTreeElement parent = (EObjectTreeElement) treeElement.getParent(); - result = this.delegate.isStruckthrough(parent.getEObject(), treeElement.getEReference()); - } else if (element instanceof EAttributeTreeElement) { - final EAttributeTreeElement treeElement = (EAttributeTreeElement) element; - final EObjectTreeElement parent = (EObjectTreeElement) treeElement.getParent(); - result = this.delegate.isStruckthrough(parent.getEObject(), treeElement.getEAttribute()); - } else { - result = this.delegate.isStruckthrough(CustomizedContentProviderUtils.resolve(element), eTypedElement); - } - return result; - } - - public Image getTopLeftOverlay(final Object element, final ETypedElement eTypedElement) { - Image result; - if (element instanceof EReferenceTreeElement) { - final EReferenceTreeElement treeElement = (EReferenceTreeElement) element; - final EObjectTreeElement parent = (EObjectTreeElement) treeElement.getParent(); - result = this.delegate.getTopLeftOverlay(parent.getEObject(), treeElement.getEReference()); - } else if (element instanceof EAttributeTreeElement) { - final EAttributeTreeElement treeElement = (EAttributeTreeElement) element; - final EObjectTreeElement parent = (EObjectTreeElement) treeElement.getParent(); - result = this.delegate.getTopLeftOverlay(parent.getEObject(), treeElement.getEAttribute()); - } else { - result = this.delegate.getTopLeftOverlay(CustomizedContentProviderUtils.resolve(element), eTypedElement); - } - return result; - } - - public Image getTopMiddleOverlay(final Object element, final ETypedElement eTypedElement) { - Image result; - if (element instanceof EReferenceTreeElement) { - final EReferenceTreeElement treeElement = (EReferenceTreeElement) element; - final EObjectTreeElement parent = (EObjectTreeElement) treeElement.getParent(); - result = this.delegate.getTopMiddleOverlay(parent.getEObject(), treeElement.getEReference()); - } else if (element instanceof EAttributeTreeElement) { - final EAttributeTreeElement treeElement = (EAttributeTreeElement) element; - final EObjectTreeElement parent = (EObjectTreeElement) treeElement.getParent(); - result = this.delegate.getTopMiddleOverlay(parent.getEObject(), treeElement.getEAttribute()); - } else { - result = this.delegate.getTopMiddleOverlay(CustomizedContentProviderUtils.resolve(element), eTypedElement); - } - return result; - } - - public Image getTopRightOverlay(final Object element, final ETypedElement eTypedElement) { - Image result; - if (element instanceof EReferenceTreeElement) { - final EReferenceTreeElement treeElement = (EReferenceTreeElement) element; - final EObjectTreeElement parent = (EObjectTreeElement) treeElement.getParent(); - result = this.delegate.getTopRightOverlay(parent.getEObject(), treeElement.getEReference()); - } else if (element instanceof EAttributeTreeElement) { - final EAttributeTreeElement treeElement = (EAttributeTreeElement) element; - final EObjectTreeElement parent = (EObjectTreeElement) treeElement.getParent(); - result = this.delegate.getTopRightOverlay(parent.getEObject(), treeElement.getEAttribute()); - } else { - result = this.delegate.getTopRightOverlay(CustomizedContentProviderUtils.resolve(element), eTypedElement); - } - return result; - } - - public Image getBottomLeftOverlay(final Object element, final ETypedElement eTypedElement) { - Image result; - if (element instanceof EReferenceTreeElement) { - final EReferenceTreeElement treeElement = (EReferenceTreeElement) element; - final EObjectTreeElement parent = (EObjectTreeElement) treeElement.getParent(); - result = this.delegate.getBottomLeftOverlay(parent.getEObject(), treeElement.getEReference()); - } else if (element instanceof EAttributeTreeElement) { - final EAttributeTreeElement treeElement = (EAttributeTreeElement) element; - final EObjectTreeElement parent = (EObjectTreeElement) treeElement.getParent(); - result = this.delegate.getBottomLeftOverlay(parent.getEObject(), treeElement.getEAttribute()); - } else { - result = this.delegate.getBottomLeftOverlay(CustomizedContentProviderUtils.resolve(element), eTypedElement); - } - return result; - } - - public Image getBottomMiddleOverlay(final Object element, final ETypedElement eTypedElement) { - Image result; - if (element instanceof EReferenceTreeElement) { - final EReferenceTreeElement treeElement = (EReferenceTreeElement) element; - final EObjectTreeElement parent = (EObjectTreeElement) treeElement.getParent(); - result = this.delegate.getBottomMiddleOverlay(parent.getEObject(), treeElement.getEReference()); - } else if (element instanceof EAttributeTreeElement) { - final EAttributeTreeElement treeElement = (EAttributeTreeElement) element; - final EObjectTreeElement parent = (EObjectTreeElement) treeElement.getParent(); - result = this.delegate.getBottomMiddleOverlay(parent.getEObject(), treeElement.getEAttribute()); - } else { - result = this.delegate.getBottomMiddleOverlay(CustomizedContentProviderUtils.resolve(element), eTypedElement); - } - return result; - } - - public Image getBottomRightOverlay(final Object element, final ETypedElement eTypedElement) { - Image result; - if (element instanceof EReferenceTreeElement) { - final EReferenceTreeElement treeElement = (EReferenceTreeElement) element; - final EObjectTreeElement parent = (EObjectTreeElement) treeElement.getParent(); - result = this.delegate.getBottomRightOverlay(parent.getEObject(), treeElement.getEReference()); - } else if (element instanceof EAttributeTreeElement) { - final EAttributeTreeElement treeElement = (EAttributeTreeElement) element; - final EObjectTreeElement parent = (EObjectTreeElement) treeElement.getParent(); - result = this.delegate.getBottomRightOverlay(parent.getEObject(), treeElement.getEAttribute()); - } else { - result = this.delegate.getBottomRightOverlay(CustomizedContentProviderUtils.resolve(element), eTypedElement); - } - return result; - } - - public String getText(final Object element, final ETypedElement eTypedElement) { - String result; - if (element instanceof EReferenceTreeElement) { - final EReferenceTreeElement treeElement = (EReferenceTreeElement) element; - final EObjectTreeElement parent = (EObjectTreeElement) treeElement.getParent(); - result = this.delegate.getText(parent.getEObject(), treeElement.getEReference()); - } else if (element instanceof EAttributeTreeElement) { - final EAttributeTreeElement treeElement = (EAttributeTreeElement) element; - final EObjectTreeElement parent = (EObjectTreeElement) treeElement.getParent(); - result = this.delegate.getText(parent.getEObject(), treeElement.getEAttribute()); - } else { - result = this.delegate.getText(CustomizedContentProviderUtils.resolve(element), eTypedElement); - } - return result; - } - - public Image getImage(final Object element, final ETypedElement eTypedElement) { - Image result; - if (element instanceof EReferenceTreeElement) { - final EReferenceTreeElement treeElement = (EReferenceTreeElement) element; - final EObjectTreeElement parent = (EObjectTreeElement) treeElement.getParent(); - result = this.delegate.getImage(parent.getEObject(), treeElement.getEReference()); - } else if (element instanceof EAttributeTreeElement) { - final EAttributeTreeElement treeElement = (EAttributeTreeElement) element; - final EObjectTreeElement parent = (EObjectTreeElement) treeElement.getParent(); - result = this.delegate.getImage(parent.getEObject(), treeElement.getEAttribute()); - } else { - result = this.delegate.getImage(CustomizedContentProviderUtils.resolve(element), eTypedElement); - } - return result; - } - - public ICustomizedLabelProvider cloneLabelProvider() { - return new ResolvingCustomizedLabelProvider(this.delegate.cloneLabelProvider()); - } - - public Color getBackground(final Object element, - final ETypedElement eTypedElement) { - return this.delegate.getBackground( - CustomizedContentProviderUtils.resolve(element), eTypedElement); - } - -}
diff --git a/org.eclipse.modisco.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/internal/ResolvingCustomizedLabelProviderFactory.java b/org.eclipse.modisco.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/internal/ResolvingCustomizedLabelProviderFactory.java deleted file mode 100644 index 3fc33a3..0000000 --- a/org.eclipse.modisco.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/internal/ResolvingCustomizedLabelProviderFactory.java +++ /dev/null
@@ -1,26 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2012 Mia-Software. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Nicolas Bros (Mia-Software) - Bug 379683 - customizable Tree content provider - * David Couvrand (Soft-Maint) - Bug 418418 - [Customization] Overlay icons not implemented - *******************************************************************************/ -package org.eclipse.emf.facet.custom.ui.internal; - -import org.eclipse.emf.facet.custom.core.ICustomizationManager; -import org.eclipse.emf.facet.custom.ui.ICustomizedLabelProvider; -import org.eclipse.emf.facet.custom.ui.IResolvingCustomizedLabelProviderFactory; - -public class ResolvingCustomizedLabelProviderFactory implements IResolvingCustomizedLabelProviderFactory { - - public ICustomizedLabelProvider createCustomizedLabelProvider(final ICustomizationManager customManager) { - return new ResolvingCustomizedLabelProvider( - new DecoratingCustomizedLabelProvider( - customManager)); - } - -}
diff --git a/org.eclipse.modisco.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/internal/TreeElementAdapter.java b/org.eclipse.modisco.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/internal/TreeElementAdapter.java deleted file mode 100644 index 204c98c..0000000 --- a/org.eclipse.modisco.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/internal/TreeElementAdapter.java +++ /dev/null
@@ -1,124 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2012, 2016 Mia-Software. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Gregoire Dupe (Mia-Software) - Bug 386387 - [CustomizedTreeContentProvider] The TreeElements are not preserved between two calls to getElements() - * Gregoire Dupe (Mia-Software) - Bug 441570 - Children custom property - * Grégoire Dupé (Mia-Software) - Bug 506334 - Need to know which TreeElement has been updated - * Grégoire Dupé (Mia-Software) - Bug 506930 - Proxy resolution break the CustomizedTreeContentProvider - *******************************************************************************/ -package org.eclipse.emf.facet.custom.ui.internal; - -import org.eclipse.emf.common.notify.Adapter; -import org.eclipse.emf.common.notify.Notification; -import org.eclipse.emf.common.notify.Notifier; -import org.eclipse.emf.common.util.EList; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.EStructuralFeature; -import org.eclipse.emf.facet.custom.metamodel.v0_2_0.internal.treeproxy.EAttributeTreeElement; -import org.eclipse.emf.facet.custom.metamodel.v0_2_0.internal.treeproxy.EObjectTreeElement; -import org.eclipse.emf.facet.custom.metamodel.v0_2_0.internal.treeproxy.EReferenceTreeElement; -import org.eclipse.emf.facet.custom.metamodel.v0_2_0.internal.treeproxy.TreeElement; -import org.eclipse.emf.facet.custom.ui.ICustomizedContentProviderFactory.IContentListener; -import org.eclipse.emf.facet.custom.ui.internal.exception.CustomizedContentProviderRuntimeException; -import org.eclipse.emf.facet.util.core.DebugUtils; -import org.eclipse.osgi.util.NLS; - -public class TreeElementAdapter implements Adapter { - - private static final boolean DEBUG = DebugUtils.getDebugStatus(Activator - .getDefault()); - - private final EObjectTreeElement treeElement; - private final IContentListener contentListener; - private Notifier target; - - public TreeElementAdapter(final EObjectTreeElement treeElement, - final IContentListener contentListener) { - this.treeElement = treeElement; - this.contentListener = contentListener; - } - - public void notifyChanged(final Notification notification) { - DebugUtils.debug(DEBUG, - "Modified element=" + this.treeElement.getEObject()); //$NON-NLS-1$ - DebugUtils.debug(DEBUG, - "Notification feature=" + notification.getFeature()); //$NON-NLS-1$ - for (TreeElement subElement : this.treeElement.getChildren()) { - final EStructuralFeature feature = getSF(subElement); - if (feature.equals(notification.getFeature())) { - if (notification.getEventType() == Notification.RESOLVE) { - final EObjectTreeElement toBeChanged = findWrapperOf( - subElement.getChildren(), - notification.getOldValue()); - if (toBeChanged != null) { - toBeChanged.setEObject( - (EObject) notification.getNewValue()); - } - } else { - subElement.getChildren().clear(); - } - DebugUtils.debug( - DEBUG, - NLS.bind( - "Cleanning= {0}::{1}", //$NON-NLS-1$ - feature.getContainerClass().getName(), - feature.getName())); - this.contentListener.onUpdate(this.treeElement); - } - } - } - - private static EObjectTreeElement findWrapperOf(final EList<TreeElement> children, - final Object oldValue) { - EObjectTreeElement result = null; - for (TreeElement child : children) { - if (child instanceof EObjectTreeElement) { - EObjectTreeElement eObjChild = (EObjectTreeElement) child; - if (eObjChild.getEObject() == oldValue) { - result = eObjChild; - break; - } - } - } - return result; - } - - private static EStructuralFeature getSF(final TreeElement structFeatuteTE) { - EStructuralFeature result; - if (structFeatuteTE instanceof EAttributeTreeElement) { - final EAttributeTreeElement eAttributeTE = (EAttributeTreeElement) structFeatuteTE; - result = eAttributeTE.getEAttribute(); - } else if (structFeatuteTE instanceof EReferenceTreeElement) { - final EReferenceTreeElement eReferenceTE = (EReferenceTreeElement) structFeatuteTE; - result = eReferenceTE.getEReference(); - } else { - throw new CustomizedContentProviderRuntimeException( - "Illegal agrument: " + structFeatuteTE); //$NON-NLS-1$ - } - return result; - } - - public Notifier getTarget() { - return this.target; - } - - public void setTarget(final Notifier newTarget) { - if (newTarget != null) { - this.target = newTarget; - } - } - - public boolean isAdapterForType(final Object type) { - return false; - } - - public EObjectTreeElement getTreeElement() { - return this.treeElement; - } - -}
diff --git a/org.eclipse.modisco.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/internal/action/ShortcutCustomAction.java b/org.eclipse.modisco.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/internal/action/ShortcutCustomAction.java deleted file mode 100644 index 1049c03..0000000 --- a/org.eclipse.modisco.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/internal/action/ShortcutCustomAction.java +++ /dev/null
@@ -1,60 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2015 Mia-Software - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Thomas Cicognani (Mia-Software) - Bug 472075 - Update API to create UI shortcuts to activate FacetSets - *******************************************************************************/ -package org.eclipse.emf.facet.custom.ui.internal.action; - -import java.util.HashSet; -import java.util.List; -import java.util.Set; - -import org.eclipse.emf.ecore.resource.ResourceSet; -import org.eclipse.emf.facet.custom.core.ICustomizationCatalogManager; -import org.eclipse.emf.facet.custom.core.ICustomizationCatalogManagerFactory; -import org.eclipse.emf.facet.custom.core.ICustomizationManager; -import org.eclipse.emf.facet.custom.metamodel.v0_2_0.custom.Customization; -import org.eclipse.emf.facet.efacet.ui.FacetSetShortcutActionUtils; -import org.eclipse.jface.action.Action; -import org.eclipse.jface.resource.ImageDescriptor; - -public class ShortcutCustomAction extends Action { - - private final String actionId; - private final ICustomizationManager customManager; - - public ShortcutCustomAction(final String actionId, final String label, - final ImageDescriptor imageDescriptor, - final ICustomizationManager customManager) { - super(label, AS_CHECK_BOX); - this.actionId = actionId; - this.customManager = customManager; - FacetSetShortcutActionUtils.setImageDescriptor(this, imageDescriptor); - } - - @Override - public void run() { - FacetSetShortcutActionUtils.runAction(this, this.actionId, - getAvailableFacetSets(), getAppliedFacetSets()); - } - - private Set<Customization> getAvailableFacetSets() { - final ResourceSet resourceSet = this.customManager.getResourceSet(); - final ICustomizationCatalogManager catalog = ICustomizationCatalogManagerFactory.DEFAULT - .getOrCreateCustomizationCatalogManager(resourceSet); - final Set<Customization> availableCustoms = new HashSet<Customization>(); - availableCustoms.addAll(catalog.getRegisteredCustomizations()); - availableCustoms.addAll(this.customManager.getManagedCustomizations()); - return availableCustoms; - } - - private List<Customization> getAppliedFacetSets() { - return this.customManager.getManagedCustomizations(); - } - -}
diff --git a/org.eclipse.modisco.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/internal/custompt/Color.java b/org.eclipse.modisco.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/internal/custompt/Color.java deleted file mode 100644 index fb8208b..0000000 --- a/org.eclipse.modisco.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/internal/custompt/Color.java +++ /dev/null
@@ -1,67 +0,0 @@ -/** - * Copyright (c) 2012 Mia-Software. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Gregoire Dupe (Mia-Software) - Bug 361794 - [Restructuring] New customization meta-model - */ -package org.eclipse.emf.facet.custom.ui.internal.custompt; - -import org.eclipse.emf.facet.custom.metamodel.custompt.IColor; - -public class Color implements IColor { - - private static final long serialVersionUID = 240076770346261769L; - private static final int BYTE_SIZE = Byte.SIZE; - private static final int TWO_BYTE_SIZE = Byte.SIZE * 2; - public static final int MAX_VALUE = 255; - - private final int red; - private final int green; - private final int blue; - - public Color(final int red, final int green, final int blue) { - this.red = red; - this.green = green; - this.blue = blue; - } - - public Color getColor() { - return this.getColor(); - } - - public int getRed() { - return this.red; - } - - public int getGreen() { - return this.green; - } - - public int getBlue() { - return this.blue; - } - - @Override - public boolean equals(final Object obj) { - boolean result = false; - if (obj instanceof Color) { - final Color color = (Color) obj; - result = (color.getRed() == this.red) - && (color.getGreen() == this.green) - && (color.getBlue() == this.blue); - } - return result; - } - - @Override - public int hashCode() { - return this.red & (this.green << Color.BYTE_SIZE) - & (this.blue << Color.TWO_BYTE_SIZE); - } - -}
diff --git a/org.eclipse.modisco.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/internal/custompt/ImageWrapper.java b/org.eclipse.modisco.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/internal/custompt/ImageWrapper.java deleted file mode 100644 index d625315..0000000 --- a/org.eclipse.modisco.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/internal/custompt/ImageWrapper.java +++ /dev/null
@@ -1,48 +0,0 @@ -/** - * Copyright (c) 2012 Mia-Software. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Gregoire Dupe (Mia-Software) - Bug 361794 - [Restructuring] New customization meta-model - * Nicolas Bros (Mia-Software) - Bug 374941 - To be able to customize overlay icons on EClass - */ -package org.eclipse.emf.facet.custom.ui.internal.custompt; - -import java.io.ByteArrayInputStream; -import java.io.ByteArrayOutputStream; -import java.io.InputStream; - -import org.eclipse.emf.facet.custom.metamodel.custompt.IImage; -import org.eclipse.swt.SWT; -import org.eclipse.swt.graphics.Image; -import org.eclipse.swt.graphics.ImageData; -import org.eclipse.swt.graphics.ImageLoader; - -public class ImageWrapper implements IImage { - - private static final long serialVersionUID = -2538802017710069448L; - private final Image wrappedImage; - - public ImageWrapper(final Image image) { - this.wrappedImage = image; - } - - public InputStream getInputStream() { - // note: this is an inefficient way to get an inputStream from the wrapped Image - final ByteArrayOutputStream stream = new ByteArrayOutputStream(); - final ImageLoader loader = new ImageLoader(); - loader.data = new ImageData[] { this.wrappedImage.getImageData() }; - loader.save(stream, SWT.IMAGE_PNG); - final byte[] byteArray = stream.toByteArray(); - return new ByteArrayInputStream(byteArray); - } - - public Image getImage() { - return this.wrappedImage; - } - -}
diff --git a/org.eclipse.modisco.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/internal/custompt/URIImage.java b/org.eclipse.modisco.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/internal/custompt/URIImage.java deleted file mode 100644 index 281d234..0000000 --- a/org.eclipse.modisco.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/internal/custompt/URIImage.java +++ /dev/null
@@ -1,40 +0,0 @@ -/** - * Copyright (c) 2013 Soft-Maint. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * David Couvrand (Soft-Maint) - Bug 402725 - Need a query to get an image from an URI - * Nicolas Rault (Soft-Maint) - Bug 402725 - Need a query to get an image from an URI - */ -package org.eclipse.emf.facet.custom.ui.internal.custompt; - -import java.io.InputStream; - -import org.eclipse.emf.facet.custom.metamodel.custompt.IImage; - -public class URIImage implements IImage { - - private static final long serialVersionUID = 6801140731857137834L; - private String uri; - - public URIImage(final String uri) { - this.uri = uri; - } - - public InputStream getInputStream() { - return null; - } - - public String getUri() { - return this.uri; - } - - public void setUri(final String uri) { - this.uri = uri; - } - -}
diff --git a/org.eclipse.modisco.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/internal/dialog/ColorLabelProvider.java b/org.eclipse.modisco.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/internal/dialog/ColorLabelProvider.java deleted file mode 100644 index fb245a2..0000000 --- a/org.eclipse.modisco.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/internal/dialog/ColorLabelProvider.java +++ /dev/null
@@ -1,66 +0,0 @@ -/** - * Copyright (c) 2012, 2015 Mia-Software. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Grégoire Dupé (Mia-Software) - Bug 369987 - [Restructuring][Table] Switch to the new customization and facet framework - * Grégoire Dupé (Mia-Software) - Bug 472747 - The customization loading dialog is not easily readable - */ -package org.eclipse.emf.facet.custom.ui.internal.dialog; - -import org.eclipse.emf.facet.custom.metamodel.v0_2_0.custom.Customization; -import org.eclipse.emf.facet.custom.ui.internal.ImageProvider; -import org.eclipse.jface.viewers.IColorProvider; -import org.eclipse.jface.viewers.LabelProvider; -import org.eclipse.swt.SWT; -import org.eclipse.swt.graphics.Color; -import org.eclipse.swt.graphics.Image; -import org.eclipse.swt.widgets.Display; - -public class ColorLabelProvider extends LabelProvider implements IColorProvider { - - private final LoadCustomizationsDialog<?> loadCustomDialog; - - public ColorLabelProvider(final LoadCustomizationsDialog<?> loadCustomDialog) { - super(); - this.loadCustomDialog = loadCustomDialog; - } - - @Override - public String getText(final Object element) { - final Customization customization = (Customization) element; - String name = customization.getName(); - if (name == null) { - name = ""; //$NON-NLS-1$ - } - return name.replaceAll("(.*)\\.(.*)", "$2 ($1)"); //$NON-NLS-1$//$NON-NLS-2$ - } - - @Override - public Image getImage(final Object element) { - Image result; - if (this.loadCustomDialog.getLockedCustoms().contains(element)) { - result = ImageProvider.getInstance().getGrayedUiCustomIcon(); - } else { - result = ImageProvider.getInstance().getUiCustomIcon(); - } - return result; - } - - public Color getForeground(final Object element) { - Color result = null; - if (this.loadCustomDialog.getLockedCustoms().contains(element)) { - result = Display.getDefault().getSystemColor(SWT.COLOR_DARK_GRAY); - } - return result; - } - - public Color getBackground(final Object element) { - return null; - } - -} \ No newline at end of file
diff --git a/org.eclipse.modisco.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/internal/dialog/LoadCustomizationsDialog.java b/org.eclipse.modisco.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/internal/dialog/LoadCustomizationsDialog.java deleted file mode 100644 index e45cd31..0000000 --- a/org.eclipse.modisco.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/internal/dialog/LoadCustomizationsDialog.java +++ /dev/null
@@ -1,649 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2015 Mia-Software, CEA-LIST, and Soft-Maint. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Nicolas Bros (Mia-Software) - initial API and implementation - * Vincent Lorenzo (CEA-LIST) - Bug 341328 - We need to be able to specify which column have to be hidden/visible using the customization mechanism - * Grégoire Dupé (Mia-Software) - Bug 369987 - [Restructuring][Table] Switch to the new customization and facet framework - * Grégoire Dupé (Mia-Software) - Bug 373078 - API Cleaning - * Thomas Cicognani (Soft-Maint) - Bug 441422 - LoadCustomizationsDialog UI bugs - * Grégoire Dupé (Mia-Software) - Bug 472747 - The customization loading dialog is not easily readable - *******************************************************************************/ -package org.eclipse.emf.facet.custom.ui.internal.dialog; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.Comparator; -import java.util.List; -import java.util.ListIterator; - -import org.eclipse.emf.common.util.BasicEList; -import org.eclipse.emf.common.util.EList; -import org.eclipse.emf.common.util.URI; -import org.eclipse.emf.ecore.util.EcoreUtil; -import org.eclipse.emf.facet.custom.metamodel.v0_2_0.custom.Customization; -import org.eclipse.emf.facet.custom.ui.internal.Messages; -import org.eclipse.emf.facet.custom.ui.internal.exported.dialog.ILoadCustomizationsDialog; -import org.eclipse.emf.facet.custom.ui.internal.exported.exception.IllegalParameterException; -import org.eclipse.emf.facet.util.ui.internal.exported.dialog.IDialogCallback; -import org.eclipse.emf.facet.util.ui.internal.exported.dialog.IDialogCallbackWithPreCommit; -import org.eclipse.jface.dialogs.Dialog; -import org.eclipse.jface.dialogs.MessageDialog; -import org.eclipse.jface.viewers.DoubleClickEvent; -import org.eclipse.jface.viewers.IContentProvider; -import org.eclipse.jface.viewers.IDoubleClickListener; -import org.eclipse.jface.viewers.ISelection; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.jface.viewers.ITreeContentProvider; -import org.eclipse.jface.viewers.LabelProvider; -import org.eclipse.jface.viewers.StructuredSelection; -import org.eclipse.jface.viewers.TreeViewer; -import org.eclipse.jface.viewers.Viewer; -import org.eclipse.swt.SWT; -import org.eclipse.swt.events.ModifyEvent; -import org.eclipse.swt.events.ModifyListener; -import org.eclipse.swt.events.SelectionAdapter; -import org.eclipse.swt.events.SelectionEvent; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.layout.GridLayout; -import org.eclipse.swt.widgets.Button; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Control; -import org.eclipse.swt.widgets.Display; -import org.eclipse.swt.widgets.Label; -import org.eclipse.swt.widgets.Shell; -import org.eclipse.swt.widgets.Text; -import org.eclipse.swt.widgets.Tree; -import org.eclipse.ui.dialogs.PatternFilter; - -public class LoadCustomizationsDialog<D> extends Dialog implements - ILoadCustomizationsDialog<D> { - - private static final int TREE_WIDTH = 300; - private static final int TREE_HEIGHT = 250; - private static final int NUM_COLUMNS = 4; - private final List<Customization> availableCustoms; - private final LabelProvider labelProvider; - private final IContentProvider contentProvider = new ITreeContentProvider() { - private final Comparator<Customization> comparator = new Comparator<Customization>() { - public int compare(final Customization custom1, final Customization custom2) { - String name1 = custom1.getName(); - String name2 = custom2.getName(); - if (name1 == null) { - name1 = ""; //$NON-NLS-1$ - } - if (name2 == null) { - name2 = ""; //$NON-NLS-1$ - } - return name1.compareTo(name2); - } - }; - - public Object[] getElements(final Object inputElement) { - @SuppressWarnings("unchecked") - final List<Customization> customizations = (List<Customization>) inputElement; - Collections.sort(customizations, this.comparator); - return customizations.toArray(); - } - - public void inputChanged(final Viewer viewer, final Object oldInput, - final Object newInput) { - // nothing - } - - public void dispose() { - // nothing - } - - public Object[] getChildren(final Object parentElement) { - return new Object[]{}; - } - - public Object getParent(final Object element) { - return null; - } - - public boolean hasChildren(final Object element) { - return false; - } - }; - private final EList<Customization> selectedCustoms; - private TreeViewer availableCustomTV; - private TreeViewer selectedCustomTV; - private Button addButton; - private Button removeButton; - private Button addAllButton; - private Button removeAllButton; - private Button upButton; - private Button downButton; - private Button loadRequiredFacetsCheckbox; - private boolean loadRequiredFacetsSelected = false; - private final IDialogCallbackWithPreCommit<List<Customization>, Boolean, D> callback; - private final List<Customization> lockedCustoms; - private final String lockMsg; - - public LoadCustomizationsDialog(final Shell parent, - final List<Customization> availableCustoms, - final List<Customization> selectedCustoms, - final List<Customization> lockedCustoms, - final IDialogCallbackWithPreCommit<List<Customization>, Boolean, D> callback, - final String lockMsg) { - super(parent); - this.labelProvider = new ColorLabelProvider(this); - this.callback = callback; - this.selectedCustoms = new BasicEList<Customization>(); - this.availableCustoms = new ArrayList<Customization>(availableCustoms); - this.lockedCustoms = lockedCustoms; - this.lockMsg = lockMsg; - setShellStyle(getShellStyle() | SWT.RESIZE | SWT.MAX); - // initial selection - for (final Customization iniSelectedCustom : selectedCustoms) { - final URI selectedCustomURI = EcoreUtil - .getURI(iniSelectedCustom); - final ListIterator<Customization> availableCustIter = this.availableCustoms - .listIterator(); - while (availableCustIter.hasNext()) { - final Customization availableCustom = availableCustIter - .next(); - final URI availableCustURI = EcoreUtil - .getURI(availableCustom); - if (availableCustURI - .equals(selectedCustomURI)) { - availableCustIter.remove(); - LoadCustomizationsDialog.this.selectedCustoms - .add(iniSelectedCustom); - } - } - } - for (Customization lockedCustom : this.lockedCustoms) { - if (!this.selectedCustoms.contains(lockedCustom)) { - this.selectedCustoms.add(lockedCustom); - } - } - } - - @Override - protected void configureShell(final Shell shell) { - super.configureShell(shell); - shell.setText(Messages.LoadCustomizationsDialog_title_LoadCustomizations); - } - - @Override - protected Control createDialogArea(final Composite parent) { - final Composite contents = (Composite) super.createDialogArea(parent); - - final GridLayout contentsGLayout = (GridLayout) contents.getLayout(); - contentsGLayout.numColumns = LoadCustomizationsDialog.NUM_COLUMNS; - - final GridData contentsGridData = (GridData) contents.getLayoutData(); - contentsGridData.horizontalAlignment = SWT.FILL; - contentsGridData.verticalAlignment = SWT.FILL; - - createLeftPane(contents); - createMiddleButtonsPane(contents); - createRightPane(contents); - createRightButtonsPane(contents); - createLoadRequiredFacetsCheckbox(contents); - - this.availableCustomTV.addDoubleClickListener(new IDoubleClickListener() { - - public void doubleClick(final DoubleClickEvent event) { - loadSelectedCustoms(); - } - }); - - this.selectedCustomTV.addDoubleClickListener(new IDoubleClickListener() { - public void doubleClick(final DoubleClickEvent event) { - unloadSelectedCustoms(); - } - }); - - this.upButton.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(final SelectionEvent event) { - upButtonClicked(); - } - }); - - this.downButton.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(final SelectionEvent event) { - downButtonClicked(); - } - }); - - this.addButton.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(final SelectionEvent event) { - loadSelectedCustoms(); - } - }); - - this.addAllButton.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(final SelectionEvent event) { - addAllButtonClicked(); - } - }); - - this.removeButton.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(final SelectionEvent event) { - unloadSelectedCustoms(); - } - }); - - this.removeAllButton.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(final SelectionEvent event) { - removeAllButtonClicked(); - } - }); - - return contents; - } - - public final void upButtonClicked() { - final IStructuredSelection selection = (IStructuredSelection) LoadCustomizationsDialog.this.selectedCustomTV - .getSelection(); - int minIndex = 0; - for (Object selectedObject : selection.toList()) { - if (selectedObject instanceof Customization) { - final Customization customization = (Customization) selectedObject; - final int index = this.selectedCustoms - .indexOf(customization); - this.selectedCustoms.move( - Math.max(index - 1, minIndex++), customization); - } - } - LoadCustomizationsDialog.this.selectedCustomTV.refresh(); - } - - public final void downButtonClicked() { - final IStructuredSelection selection = (IStructuredSelection) LoadCustomizationsDialog.this.selectedCustomTV - .getSelection(); - final ArrayList<Object> selectedObjects = new ArrayList<Object>(); - for (final Object selectedObject : selection.toArray()) { - selectedObjects.add(selectedObject); - } - - // prevent the last two elements from swapping - boolean canMove = !selectedObjects - .contains(LoadCustomizationsDialog.this.selectedCustoms - .get(LoadCustomizationsDialog.this.selectedCustoms.size() - 1)); - for (int i = LoadCustomizationsDialog.this.selectedCustoms.size() - 2; i >= 0; i--) { - final Customization selectedCustom = LoadCustomizationsDialog.this.selectedCustoms - .get(i); - if (selectedObjects.contains(selectedCustom)) { - if (canMove) { - LoadCustomizationsDialog.this.selectedCustoms.move(i + 1, - selectedCustom); - } - } else { - canMove = true; - } - - } - - LoadCustomizationsDialog.this.selectedCustomTV.refresh(); - } - - public final void loadSelectedCustoms() { - final IStructuredSelection selection = (IStructuredSelection) LoadCustomizationsDialog.this.availableCustomTV - .getSelection(); - for (Object object : selection.toList()) { - if (object instanceof Customization) { - final Customization custom = (Customization) object; - if (!this.selectedCustoms.contains(custom)) { - this.selectedCustoms.add(custom); - this.availableCustoms.remove(custom); - } - } - } - refresh(); - this.selectedCustomTV.setSelection(selection); - } - - public final void addAllButtonClicked() { - final ListIterator<Customization> listIterator = this.availableCustoms - .listIterator(); - while (listIterator.hasNext()) { - final Customization element = listIterator.next(); - this.selectedCustoms.add(element); - listIterator.remove(); - } - refresh(); - } - - public final void unloadSelectedCustoms() { - final IStructuredSelection selection = (IStructuredSelection) LoadCustomizationsDialog.this.selectedCustomTV - .getSelection(); - final List<Customization> toBeRemoved = new ArrayList<Customization>(); - boolean lockedCustomFound = false; - for (Object object : selection.toList()) { - if (this.lockedCustoms.contains(object)) { - lockedCustomFound = true; - } else if (object instanceof Customization) { - final Customization element = (Customization) object; - toBeRemoved.add(element); - } - } - if (lockedCustomFound) { - final MessageDialog dialog = new MessageDialog( - null, - Messages.LoadCustomizationsDialog_LoadCustomizationWarning, - null, - Messages.LoadCustomizationsDialog_Can_not_be_unload + this.lockMsg, - MessageDialog.WARNING, new String[] { Messages.LoadCustomizationsDialog_OK }, 1); - dialog.open(); - } - removeFromSelection(toBeRemoved); - refresh(); - } - - protected void removeFromSelection(final List<Customization> toBeRemoved) { - this.availableCustoms.addAll(toBeRemoved); - this.selectedCustoms.removeAll(toBeRemoved); - if (LoadCustomizationsDialog.this.selectedCustoms.size() > 0) { - LoadCustomizationsDialog.this.selectedCustomTV - .setSelection(new StructuredSelection( - LoadCustomizationsDialog.this.selectedCustoms.get(0))); - } - } - - public final void removeAllButtonClicked() { - removeFromSelection(this.selectedCustoms); - refresh(); - } - - private void createLeftPane(final Composite contents) { - final Composite choiceComposite = new Composite(contents, SWT.NONE); - final GridData data = new GridData(SWT.FILL, SWT.FILL, true, true); - data.horizontalAlignment = SWT.END; - choiceComposite.setLayoutData(data); - - final GridLayout layout = new GridLayout(); - data.horizontalAlignment = SWT.FILL; - layout.marginHeight = 0; - layout.marginWidth = 0; - layout.numColumns = 1; - choiceComposite.setLayout(layout); - - final Label choiceLabel = new Label(choiceComposite, SWT.NONE); - choiceLabel.setText(Messages.LoadCustomizationsDialog_AvailiableCustom); - - final GridData choiceLabelGD = new GridData(); - choiceLabelGD.verticalAlignment = SWT.FILL; - choiceLabelGD.horizontalAlignment = SWT.FILL; - choiceLabel.setLayoutData(choiceLabelGD); - - final Text patternText = createFilterText(choiceComposite); - - final Tree availableCustomsT = new Tree(choiceComposite, SWT.MULTI | SWT.BORDER); - final GridData availableCustsGD = new GridData(); - availableCustsGD.widthHint = LoadCustomizationsDialog.TREE_WIDTH; - availableCustsGD.heightHint = LoadCustomizationsDialog.TREE_HEIGHT; - availableCustsGD.horizontalAlignment = SWT.FILL; - availableCustsGD.verticalAlignment = SWT.FILL; - availableCustsGD.grabExcessHorizontalSpace = true; - availableCustsGD.grabExcessVerticalSpace = true; - availableCustomsT.setLayoutData(availableCustsGD); - - this.availableCustomTV = new TreeViewer(availableCustomsT); - this.availableCustomTV.setContentProvider(this.contentProvider); - this.availableCustomTV.setLabelProvider(this.labelProvider); - final PatternFilter filter = new PatternFilter(); - this.availableCustomTV.addFilter(filter); - - this.availableCustomTV.setInput(this.availableCustoms); - - patternText.addModifyListener(new ModifyListener() { - public void modifyText(final ModifyEvent event) { - filter.setPattern(patternText.getText()); - LoadCustomizationsDialog.this.availableCustomTV.refresh(); - } - }); - } - - private void createMiddleButtonsPane(final Composite contents) { - final Composite buttonsComposite = new Composite(contents, SWT.NONE); - final GridData buttonsCompositeGridData = new GridData(); - buttonsCompositeGridData.verticalAlignment = SWT.CENTER; - buttonsCompositeGridData.horizontalAlignment = SWT.FILL; - buttonsComposite.setLayoutData(buttonsCompositeGridData); - buttonsComposite.setLayout(new GridLayout()); - - // new Label(buttonsComposite, SWT.NONE); - - this.addButton = new Button(buttonsComposite, SWT.PUSH); - this.addButton.setText(Messages.LoadCustomizationsDialog_Add); - this.addButton.setToolTipText(Messages.LoadCustomizationsDialog_Add2); - final GridData addButtonGridData = new GridData(); - addButtonGridData.verticalAlignment = SWT.FILL; - addButtonGridData.horizontalAlignment = SWT.FILL; - this.addButton.setLayoutData(addButtonGridData); - - this.removeButton = new Button(buttonsComposite, SWT.PUSH); - this.removeButton.setText(Messages.LoadCustomizationsDialog_Remove); - this.removeButton.setToolTipText(Messages.LoadCustomizationsDialog_Remove2); - final GridData removeButtonGridData = new GridData(); - removeButtonGridData.verticalAlignment = SWT.FILL; - removeButtonGridData.horizontalAlignment = SWT.FILL; - this.removeButton.setLayoutData(removeButtonGridData); - - spacer(buttonsComposite); - - this.addAllButton = new Button(buttonsComposite, SWT.PUSH); - this.addAllButton.setText(Messages.LoadCustomizationsDialog_AddAll); - this.addAllButton.setToolTipText(Messages.LoadCustomizationsDialog_AddAll2); - - this.removeAllButton = new Button(buttonsComposite, SWT.PUSH); - this.removeAllButton.setText(Messages.LoadCustomizationsDialog_RemoveAll); - this.removeAllButton.setToolTipText(Messages.LoadCustomizationsDialog_RemoveAll2); - } - - private static void spacer(final Composite parent) { - Label label = new Label(parent, SWT.NONE); - } - - private void createRightButtonsPane(final Composite contents) { - final Composite buttonsComposite = new Composite(contents, SWT.NONE); - final GridData buttonsCompositeGridData = new GridData(); - buttonsCompositeGridData.verticalAlignment = SWT.FILL; - buttonsCompositeGridData.horizontalAlignment = SWT.FILL; - buttonsComposite.setLayoutData(buttonsCompositeGridData); - buttonsComposite.setLayout(new GridLayout()); - - // spacer - spacer(buttonsComposite); - - this.upButton = new Button(buttonsComposite, SWT.PUSH); - this.upButton.setText(Messages.LoadCustomizationsDialog_Up); - final GridData upButtonGridData = new GridData(); - upButtonGridData.verticalAlignment = SWT.FILL; - upButtonGridData.horizontalAlignment = SWT.FILL; - this.upButton.setLayoutData(upButtonGridData); - - this.downButton = new Button(buttonsComposite, SWT.PUSH); - this.downButton.setText(Messages.LoadCustomizationsDialog_Down); - final GridData downButtonGridData = new GridData(); - downButtonGridData.verticalAlignment = SWT.FILL; - downButtonGridData.horizontalAlignment = SWT.FILL; - this.downButton.setLayoutData(downButtonGridData); - } - - private void createRightPane(final Composite contents) { - final Composite featureComposite = new Composite(contents, SWT.NONE); - final GridData featureCompositeData = new GridData(SWT.FILL, SWT.FILL, true, true); - featureCompositeData.horizontalAlignment = SWT.END; - featureComposite.setLayoutData(featureCompositeData); - - final GridLayout featureCompositeLayout = new GridLayout(); - featureCompositeData.horizontalAlignment = SWT.FILL; - featureCompositeLayout.marginHeight = 0; - featureCompositeLayout.marginWidth = 0; - featureCompositeLayout.numColumns = 1; - featureComposite.setLayout(featureCompositeLayout); - - final Label featureLabel = new Label(featureComposite, SWT.NONE); - featureLabel.setText(Messages.LoadCustomizationsDialog_LoadedCustomizations); - final GridData featureLabelGridData = new GridData(); - featureLabelGridData.horizontalSpan = 2; - featureLabelGridData.horizontalAlignment = SWT.FILL; - featureLabelGridData.verticalAlignment = SWT.FILL; - featureLabel.setLayoutData(featureLabelGridData); - - final Tree loadedCustomizationsTree = new Tree(featureComposite, SWT.MULTI | SWT.BORDER); - final GridData loadedCustomizationsGridData = new GridData(); - loadedCustomizationsGridData.widthHint = LoadCustomizationsDialog.TREE_WIDTH; - loadedCustomizationsGridData.heightHint = LoadCustomizationsDialog.TREE_HEIGHT; - loadedCustomizationsGridData.verticalAlignment = SWT.FILL; - loadedCustomizationsGridData.horizontalAlignment = SWT.FILL; - loadedCustomizationsGridData.grabExcessHorizontalSpace = true; - loadedCustomizationsGridData.grabExcessVerticalSpace = true; - loadedCustomizationsTree.setLayoutData(loadedCustomizationsGridData); - - this.selectedCustomTV = new TreeViewer(loadedCustomizationsTree); - this.selectedCustomTV.setContentProvider(this.contentProvider); - this.selectedCustomTV.setLabelProvider(this.labelProvider); - this.selectedCustomTV.setInput(this.selectedCustoms); - } - - private void createLoadRequiredFacetsCheckbox(final Composite contents) { - spacer(contents); - spacer(contents); - this.loadRequiredFacetsCheckbox = new Button(contents, SWT.CHECK); - this.loadRequiredFacetsCheckbox - .setText(Messages.LoadCustomizationsDialog_loadReferencedFacetsCheckbox); - this.loadRequiredFacetsCheckbox.setSelection(true); - this.loadRequiredFacetsCheckbox - .setLayoutData(new GridData(SWT.END, SWT.FILL, false, false)); - - } - - private static Text createFilterText(final Composite contents) { - final Text patternText = new Text(contents, SWT.BORDER | SWT.SEARCH); - patternText.setMessage(Messages.LoadCustomizationsDialog_type_filter_test); - patternText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); - return patternText; - } - - @Override - protected void okPressed() { - pressOk(); - } - - public void commit(final Boolean result) { - this.callback.committed(this.selectedCustoms, result); - super.okPressed(); - } - - public boolean isLoadRequiredFacetsSelected() { - return this.loadRequiredFacetsSelected; - } - - public List<Customization> getSelectedCustomizations() { - return this.selectedCustoms; - } - - private void refresh() { - LoadCustomizationsDialog.this.availableCustomTV.refresh(); - LoadCustomizationsDialog.this.selectedCustomTV.refresh(); - } - - public void asyncOpen() { - Display display; - if (this.getShell() == null) { - display = Display.getDefault(); - } else { - display = this.getShell().getDisplay(); - } - display.asyncExec(new Runnable() { - public void run() { - LoadCustomizationsDialog.this.open(); - } - }); - } - - public D pressOk() { - this.loadRequiredFacetsSelected = this.loadRequiredFacetsCheckbox - .getSelection(); - final D preCommitDialog = this.callback - .openPrecommitDialog(this.selectedCustoms, - new IDialogCallback<Boolean>() { - public void committed(final Boolean result) { - if (result.booleanValue()) { - LoadCustomizationsDialog.this - .commit(result); - } - } - }); - if (preCommitDialog == null) { - this.callback.committed(this.selectedCustoms, Boolean.TRUE); - super.okPressed(); - } - return preCommitDialog; - } - - public void selectAvailableCustom(final Customization customization) { - final ISelection selection = new StructuredSelection(customization); - this.availableCustomTV.setSelection(selection); - } - - public void selectSelectedCustom(final Customization customization) { - final ISelection selection = new StructuredSelection(customization); - this.selectedCustomTV.setSelection(selection); - - } - - public List<Customization> getLockedCustoms() { - return this.lockedCustoms; - } - - public void addCustomization(final Customization customization) - throws IllegalParameterException { - // TODO Auto-generated method stub - } - - public void addCustomizations(final List<Customization> customizations) - throws IllegalParameterException { - // TODO Auto-generated method stub - } - - public void removeCustomization(final Customization customization) - throws IllegalParameterException { - // TODO Auto-generated method stub - } - - public void removeCustomizations(final List<Customization> customizations) - throws IllegalParameterException { - // TODO Auto-generated method stub - } - - public void cancel() { - // TODO Auto-generated method stub - } - - public void validate() { - // TODO Auto-generated method stub - } - - public List<Customization> getAvailableCustomizations() { - // TODO Auto-generated method stub - return null; - } - - public void pushUp(final Customization customization) - throws IllegalParameterException { - // TODO Auto-generated method stub - } - - public void pushDown(final Customization customization) - throws IllegalParameterException { - // TODO Auto-generated method stub - } -}
diff --git a/org.eclipse.modisco.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/internal/dialog/LoadCustomizationsDialogFactory.java b/org.eclipse.modisco.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/internal/dialog/LoadCustomizationsDialogFactory.java deleted file mode 100644 index 63173a9..0000000 --- a/org.eclipse.modisco.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/internal/dialog/LoadCustomizationsDialogFactory.java +++ /dev/null
@@ -1,46 +0,0 @@ -/** - * Copyright (c) 2012 Mia-Software. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Gregoire Dupe (Mia-Software) - Bug 369987 - [Restructuring][Table] Switch to the new customization and facet framework - */ -package org.eclipse.emf.facet.custom.ui.internal.dialog; - -import java.util.Collections; -import java.util.List; - -import org.eclipse.emf.facet.custom.metamodel.v0_2_0.custom.Customization; -import org.eclipse.emf.facet.custom.ui.internal.exported.dialog.ILoadCustomizationsDialog; -import org.eclipse.emf.facet.custom.ui.internal.exported.dialog.ILoadCustomizationsDialogFactory; -import org.eclipse.emf.facet.util.ui.internal.exported.dialog.IDialogCallbackWithPreCommit; -import org.eclipse.swt.widgets.Shell; - -public class LoadCustomizationsDialogFactory implements ILoadCustomizationsDialogFactory { - - public <D> ILoadCustomizationsDialog<D> createLoadCustomizationDialog( - final Shell parent, - final List<Customization> availableCustoms, - final List<Customization> selectedCustoms, - final IDialogCallbackWithPreCommit<List<Customization>, Boolean, D> callback) { - return new SynchronizedLoadCustomizationsDialog(parent, - availableCustoms, selectedCustoms, - Collections.<Customization> emptyList(), callback, ""); //$NON-NLS-1$ - } - - public <D> ILoadCustomizationsDialog<D> createLoadCustomizationDialog( - final Shell parent, - final List<Customization> availableCustoms, - final List<Customization> selectedCustoms, - final List<Customization> lockedCustoms, - final IDialogCallbackWithPreCommit<List<Customization>, Boolean, D> callback, - final String lockMsg) { - return new SynchronizedLoadCustomizationsDialog(parent, - availableCustoms, selectedCustoms, lockedCustoms, callback, - lockMsg); - } -}
diff --git a/org.eclipse.modisco.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/internal/dialog/SynchronizedLoadCustomizationsDialog.java b/org.eclipse.modisco.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/internal/dialog/SynchronizedLoadCustomizationsDialog.java deleted file mode 100644 index 0090c63..0000000 --- a/org.eclipse.modisco.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/internal/dialog/SynchronizedLoadCustomizationsDialog.java +++ /dev/null
@@ -1,222 +0,0 @@ -/** - * Copyright (c) 2012 Mia-Software. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Gregoire Dupe (Mia-Software) - Bug 369987 - [Restructuring][Table] Switch to the new customization and facet framework - * Gregoire Dupe (Mia-Software) - Bug 373078 - API Cleaning - * Nicolas Bros (Mia-Software) - Bug 372626 - Aggregates - */ -package org.eclipse.emf.facet.custom.ui.internal.dialog; - -import java.util.List; - -import org.eclipse.emf.facet.custom.metamodel.v0_2_0.custom.Customization; -import org.eclipse.emf.facet.custom.ui.internal.exported.dialog.ILoadCustomizationsDialog; -import org.eclipse.emf.facet.custom.ui.internal.exported.exception.IllegalParameterException; -import org.eclipse.emf.facet.util.ui.internal.exported.dialog.IDialogCallbackWithPreCommit; -import org.eclipse.emf.facet.util.ui.internal.exported.displaysync.AbstractExceptionFreeRunnable; -import org.eclipse.emf.facet.util.ui.internal.exported.displaysync.AbstractVoidExceptionFreeRunnable; -import org.eclipse.emf.facet.util.ui.internal.exported.displaysync.AbstractVoidRunnable; -import org.eclipse.emf.facet.util.ui.internal.exported.displaysync.SynchronizedObject; -import org.eclipse.swt.widgets.Display; -import org.eclipse.swt.widgets.Shell; - -public class SynchronizedLoadCustomizationsDialog<D> extends - SynchronizedObject<LoadCustomizationsDialog<D>> implements - ILoadCustomizationsDialog<D> { // NOPMD by gdupe on 03/02/12 12:13 - We cannot do more. This class is a facade/wrapper of an other class. - - public SynchronizedLoadCustomizationsDialog(final Shell parent, - final List<Customization> availableCustoms, - final List<Customization> selectedCustoms, - final List<Customization> lockedCustoms, - final IDialogCallbackWithPreCommit<List<Customization>, Boolean, D> callback, - final String lockMsg) { - super(new LoadCustomizationsDialog(parent, availableCustoms, - selectedCustoms, lockedCustoms, callback, lockMsg), - initDisplay(parent)); - } - - private static Display initDisplay(final Shell parent) { - Display display; - if (parent == null) { - display = Display.getDefault(); - } else { - display = parent.getDisplay(); - } - return display; - } - - public int open() { - return this.safeSyncExec(new AbstractExceptionFreeRunnable<Integer>() { - @Override - public Integer safeRun() { - return Integer.valueOf(SynchronizedLoadCustomizationsDialog.this - .getSynchronizedObject().open()); - } - }).intValue(); - } - - public void asyncOpen() { - this.voidExceptionFreeRunnable(new AbstractVoidExceptionFreeRunnable() { - @Override - public void voidSafeRun() { - SynchronizedLoadCustomizationsDialog.this - .getSynchronizedObject().asyncOpen(); - } - }); - } - - public D pressOk() { - return this.safeSyncExec(new AbstractExceptionFreeRunnable<D>() { - @Override - public D safeRun() { - return SynchronizedLoadCustomizationsDialog.this - .getSynchronizedObject().pressOk(); - } - }); - } - - public void selectAvailableCustom(final Customization customization) { - this.voidExceptionFreeRunnable(new AbstractVoidExceptionFreeRunnable() { - @Override - public void voidSafeRun() { - SynchronizedLoadCustomizationsDialog.this - .getSynchronizedObject().selectAvailableCustom( - customization); - } - }); - } - - public void loadSelectedCustoms() { - this.voidExceptionFreeRunnable(new AbstractVoidExceptionFreeRunnable() { - @Override - public void voidSafeRun() { - SynchronizedLoadCustomizationsDialog.this - .getSynchronizedObject().loadSelectedCustoms(); - } - }); - } - - public void selectSelectedCustom(final Customization customization) { - this.voidExceptionFreeRunnable(new AbstractVoidExceptionFreeRunnable() { - @Override - public void voidSafeRun() { - SynchronizedLoadCustomizationsDialog.this - .getSynchronizedObject().selectSelectedCustom( - customization); - } - }); - } - - public void unloadSelectedCustoms() { - this.voidExceptionFreeRunnable(new AbstractVoidExceptionFreeRunnable() { - @Override - public void voidSafeRun() { - SynchronizedLoadCustomizationsDialog.this - .getSynchronizedObject().unloadSelectedCustoms(); - } - }); - } - - public void addCustomization(final Customization customization) - throws IllegalParameterException { - voidSyncExec(new AbstractVoidRunnable<IllegalParameterException>() { - @Override - public void voidRun() throws IllegalParameterException { - getSynchronizedObject().addCustomization(customization); - } - }); - } - - public void addCustomizations(final List<Customization> customizations) - throws IllegalParameterException { - voidSyncExec(new AbstractVoidRunnable<IllegalParameterException>() { - @Override - public void voidRun() throws IllegalParameterException { - getSynchronizedObject().addCustomizations(customizations); - } - }); - } - - public void removeCustomization(final Customization customization) - throws IllegalParameterException { - voidSyncExec(new AbstractVoidRunnable<IllegalParameterException>() { - @Override - public void voidRun() throws IllegalParameterException { - getSynchronizedObject().removeCustomization(customization); - } - }); - } - - public void removeCustomizations(final List<Customization> customizations) - throws IllegalParameterException { - voidSyncExec(new AbstractVoidRunnable<IllegalParameterException>() { - @Override - public void voidRun() throws IllegalParameterException { - getSynchronizedObject().removeCustomizations(customizations); - } - }); - } - - public void cancel() { - voidExceptionFreeRunnable(new AbstractVoidExceptionFreeRunnable() { - @Override - public void voidSafeRun() { - getSynchronizedObject().cancel(); - } - }); - } - - public void validate() { - voidExceptionFreeRunnable(new AbstractVoidExceptionFreeRunnable() { - @Override - public void voidSafeRun() { - getSynchronizedObject().validate(); - } - }); - } - - public List<Customization> getSelectedCustomizations() { - return safeSyncExec(new AbstractExceptionFreeRunnable<List<Customization>>() { - @Override - public List<Customization> safeRun() { - return getSynchronizedObject().getSelectedCustomizations(); - } - }); - } - - public List<Customization> getAvailableCustomizations() { - return safeSyncExec(new AbstractExceptionFreeRunnable<List<Customization>>() { - @Override - public List<Customization> safeRun() { - return getSynchronizedObject().getAvailableCustomizations(); - } - }); - } - - public void pushUp(final Customization customization) - throws IllegalParameterException { - voidSyncExec(new AbstractVoidRunnable<IllegalParameterException>() { - @Override - public void voidRun() throws IllegalParameterException { - getSynchronizedObject().pushUp(customization); - } - }); - } - - public void pushDown(final Customization customization) - throws IllegalParameterException { - voidSyncExec(new AbstractVoidRunnable<IllegalParameterException>() { - @Override - public void voidRun() throws IllegalParameterException { - getSynchronizedObject().pushDown(customization); - } - }); - } - -}
diff --git a/org.eclipse.modisco.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/internal/exception/CustomizationEditRuntimeException.java b/org.eclipse.modisco.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/internal/exception/CustomizationEditRuntimeException.java deleted file mode 100644 index 611c705..0000000 --- a/org.eclipse.modisco.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/internal/exception/CustomizationEditRuntimeException.java +++ /dev/null
@@ -1,35 +0,0 @@ - -/** - * Copyright (c) 2012 Mia-Software. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Gregoire Dupe (Mia-Software) - Bug 369987 - [Restructuring][Table] Switch to the new customization and facet framework - */ -package org.eclipse.emf.facet.custom.ui.internal.exception; - -public class CustomizationEditRuntimeException extends RuntimeException { - - private static final long serialVersionUID = -632229513667261515L; - - public CustomizationEditRuntimeException() { - super(); - } - - public CustomizationEditRuntimeException(final String message) { - super(message); - } - - public CustomizationEditRuntimeException(final Throwable cause) { - super(cause); - } - - public CustomizationEditRuntimeException(final String message, final Throwable cause) { - super(message, cause); - } - -}
diff --git a/org.eclipse.modisco.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/internal/exception/CustomizedContentProviderRuntimeException.java b/org.eclipse.modisco.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/internal/exception/CustomizedContentProviderRuntimeException.java deleted file mode 100644 index 6aa3a9e..0000000 --- a/org.eclipse.modisco.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/internal/exception/CustomizedContentProviderRuntimeException.java +++ /dev/null
@@ -1,34 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2012 Mia-Software. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Gregoire Dupe (Mia-Software) - Bug 386387 - [CustomizedTreeContentProvider] The TreeElements are not preserved between two calls to getElements() - *******************************************************************************/ -package org.eclipse.emf.facet.custom.ui.internal.exception; - -public class CustomizedContentProviderRuntimeException extends RuntimeException { - - private static final long serialVersionUID = 6962461313131533003L; - - public CustomizedContentProviderRuntimeException() { - super(); - } - - public CustomizedContentProviderRuntimeException(final String message) { - super(message); - } - - public CustomizedContentProviderRuntimeException(final Throwable cause) { - super(cause); - } - - public CustomizedContentProviderRuntimeException(final String message, - final Throwable cause) { - super(message, cause); - } - -}
diff --git a/org.eclipse.modisco.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/internal/exported/CustomizationUIConstants.java b/org.eclipse.modisco.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/internal/exported/CustomizationUIConstants.java deleted file mode 100644 index 91e19a3..0000000 --- a/org.eclipse.modisco.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/internal/exported/CustomizationUIConstants.java +++ /dev/null
@@ -1,27 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2012 CEA LIST. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Nicolas Bros (Mia-Software) - Bug 372626 - Aggregates - *******************************************************************************/ -package org.eclipse.emf.facet.custom.ui.internal.exported; - -/** - * @since 0.2 - */ -public final class CustomizationUIConstants { - - private static final String CATALOG_VIEW_ID = "org.eclipse.emf.facet.custom.ui.view.catalog"; //$NON-NLS-1$ - - private CustomizationUIConstants() { - // utility class - } - - public static String getCustomizationCatalogViewId() { - return CustomizationUIConstants.CATALOG_VIEW_ID; - } -}
diff --git a/org.eclipse.modisco.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/internal/exported/ICustomizationCommandFactory.java b/org.eclipse.modisco.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/internal/exported/ICustomizationCommandFactory.java deleted file mode 100644 index bf65605..0000000 --- a/org.eclipse.modisco.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/internal/exported/ICustomizationCommandFactory.java +++ /dev/null
@@ -1,39 +0,0 @@ -/** - * Copyright (c) 2012 Mia-Software. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Gregoire Dupe (Mia-Software) - Bug 369987 - [Restructuring][Table] Switch to the new customization and facet framework - */ -package org.eclipse.emf.facet.custom.ui.internal.exported; - -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.ecore.ETypedElement; -import org.eclipse.emf.facet.custom.metamodel.v0_2_0.custom.Customization; -import org.eclipse.emf.facet.custom.metamodel.v0_2_0.custom.EClassCustomization; -import org.eclipse.emf.facet.custom.metamodel.v0_2_0.custom.FacetCustomization; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.Facet; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.FacetOperation; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.extensible.Query; -import org.eclipse.emf.facet.util.emf.core.command.ICommandFactoryResult; - -public interface ICustomizationCommandFactory { - - ICommandFactoryResult<Customization> createCustomization( - String name); - - ICommandFactoryResult<EClassCustomization> createEClassCustomization( - Customization customization, EClass customedEClass, Query conformanceQuery); - - ICommandFactoryResult<FacetCustomization> createFacetCustomization( - Customization customization, Facet customizedFacet); - - ICommandFactoryResult<Facet> setPropertyConfig(Facet typeCustomization, - ETypedElement customizedTElt, // customized typed element - FacetOperation customProperty, - Query query); -}
diff --git a/org.eclipse.modisco.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/internal/exported/ICustomizationCommandFactoryFactory.java b/org.eclipse.modisco.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/internal/exported/ICustomizationCommandFactoryFactory.java deleted file mode 100644 index 0f01063..0000000 --- a/org.eclipse.modisco.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/internal/exported/ICustomizationCommandFactoryFactory.java +++ /dev/null
@@ -1,24 +0,0 @@ -/** - * Copyright (c) 2012 Mia-Software. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Gregoire Dupe (Mia-Software) - Bug 369987 - [Restructuring][Table] Switch to the new customization and facet framework - */ -package org.eclipse.emf.facet.custom.ui.internal.exported; - -import org.eclipse.emf.edit.domain.EditingDomain; -import org.eclipse.emf.facet.custom.ui.internal.CustomizationCommandFactoryFactory; -import org.eclipse.emf.facet.util.emf.core.internal.exported.ICommandFactory; - -public interface ICustomizationCommandFactoryFactory { - - ICustomizationCommandFactoryFactory DEFAULT = new CustomizationCommandFactoryFactory(); - - ICustomizationCommandFactory createCustomizationCommandFactory( - EditingDomain editingDomain, ICommandFactory commandFactory); -}
diff --git a/org.eclipse.modisco.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/internal/exported/ILabelPropertiesHandler.java b/org.eclipse.modisco.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/internal/exported/ILabelPropertiesHandler.java deleted file mode 100644 index 9cab557..0000000 --- a/org.eclipse.modisco.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/internal/exported/ILabelPropertiesHandler.java +++ /dev/null
@@ -1,24 +0,0 @@ -/** - * Copyright (c) 2012 Mia-Software. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Gregoire Dupe (Mia-Software) - Bug 369987 - [Restructuring][Table] Switch to the new customization and facet framework - * Gregoire Dupe (Mia-Software) - Bug 373078 - API Cleaning - */ -package org.eclipse.emf.facet.custom.ui.internal.exported; - -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.FacetOperation; - -/** - * - * @since 0.2 - * - */ -public interface ILabelPropertiesHandler { - FacetOperation getLabelProperty(); -}
diff --git a/org.eclipse.modisco.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/internal/exported/ILabelPropertiesHandlerFactory.java b/org.eclipse.modisco.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/internal/exported/ILabelPropertiesHandlerFactory.java deleted file mode 100644 index 9d06847..0000000 --- a/org.eclipse.modisco.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/internal/exported/ILabelPropertiesHandlerFactory.java +++ /dev/null
@@ -1,29 +0,0 @@ -/** - * Copyright (c) 2012 Mia-Software. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Gregoire Dupe (Mia-Software) - Bug 369987 - [Restructuring][Table] Switch to the new customization and facet framework - * Gregoire Dupe (Mia-Software) - Bug 373078 - API Cleaning - */ -package org.eclipse.emf.facet.custom.ui.internal.exported; - -import org.eclipse.emf.facet.custom.core.ICustomizationManager; -import org.eclipse.emf.facet.custom.ui.internal.PropertiesHandlerFactory; - -/** - * - * @since 0.2 - * - */ -public interface ILabelPropertiesHandlerFactory { - - ILabelPropertiesHandlerFactory DEFAULT = new PropertiesHandlerFactory(); - - ILabelPropertiesHandler createLabelPropertiesHandler( - ICustomizationManager customizationMgr); -}
diff --git a/org.eclipse.modisco.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/internal/exported/dialog/ILoadCustomizationsDialog.java b/org.eclipse.modisco.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/internal/exported/dialog/ILoadCustomizationsDialog.java deleted file mode 100644 index e6303ae..0000000 --- a/org.eclipse.modisco.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/internal/exported/dialog/ILoadCustomizationsDialog.java +++ /dev/null
@@ -1,168 +0,0 @@ -/** - * Copyright (c) 2011 Mia-Software. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Gregoire Dupe (Mia-Software) - Bug 369987 - [Restructuring][Table] Switch to the new customization and facet framework - * Gregoire Dupe (Mia-Software) - Bug 373078 - API Cleaning - */ -package org.eclipse.emf.facet.custom.ui.internal.exported.dialog; - -import java.util.List; - -import org.eclipse.emf.facet.custom.metamodel.v0_2_0.custom.Customization; -import org.eclipse.emf.facet.custom.ui.internal.exported.exception.IllegalParameterException; - -/** - * A dialog to load {@link Customization}s. - * - * @noextend This interface is not intended to be extended by clients. - * @noimplement This interface is not intended to be implemented by clients. - * @since 0.2.0 - */ -public interface ILoadCustomizationsDialog<D> { - - /** - * Opens the dialog and blocks until it closes. - * - * @return the dialog's return code - */ - int open(); - - /** Opens the dialog asynchronously */ - void asyncOpen(); - - /** - * Emulate a press on the OK button - * - * @since 0.2 - */ - D pressOk(); - - /** Selects the given customization in the left "available customizations" pane */ - void selectAvailableCustom(Customization customization); - - /** - * Moves the customizations selected in the left "available customizations" pane to the right - * "loaded customizations" pane. - */ - void loadSelectedCustoms(); - - /** Selects the given customization in the right "loaded customizations" pane */ - void selectSelectedCustom(Customization customization); - - /** - * Moves the customizations selected in the right "loaded customizations" pane to the left - * "available customizations" pane. - */ - void unloadSelectedCustoms(); - - /** - * This method is used to add a customization on the top of the - * customization stack. - * - * @param customization - * must be one element of the list returned by {@link - * ICustomizationLoaderDialo.getAvailableCustomizations()} - * @throws IllegalParameterException - * when the parameter is not one element of the list returned by - * {@link - * ICustomizationLoaderDialo.getAvailableCustomizations()} - */ - void addCustomization(Customization customization) - throws IllegalParameterException; - - /** - * This method is used to add customizations on the top of the customization - * stack. - * - * @param customizations - * must be one element of the list returned by {@link - * ICustomizationLoaderDialo.getAvailableCustomizations()} - * @throws IllegalParameterException - * when one of the element of the parameter list in not one - * element of the list returned by {@link - * ICustomizationLoaderDialo.getAvailableCustomizations()} - */ - void addCustomizations(List<Customization> customizations) - throws IllegalParameterException; - - /** - * This method is used to remove a customization from the list. - * - * @param customization - * must be one element of the list returned by {@link - * ICustomizationLoaderDialo.getSelectedCustomizations()} - * @throws IllegalParameterException - * when the parameter is not one element of the list returned by - * {@link ICustomizationLoaderDialo.getSelectedCustomizations()} - */ - void removeCustomization(Customization customization) - throws IllegalParameterException; - - /** - * This method is used to remove a list of customization from the list. - * - * @param customizations - * must be one element of the list returned by {@link - * ICustomizationLoaderDialo.getSelectedCustomizations()} - * @throws IllegalParameterException - * when one of the element of the parameter list in not one - * element of the list returned by {@link - * ICustomizationLoaderDialo.getSelectedCustomizations()} - */ - void removeCustomizations(List<Customization> customizations) - throws IllegalParameterException; - - /** - * Cancel the dialog - */ - void cancel(); - - /** - * Validate the dialog - */ - void validate(); - - /** - * The intersection between getSelectedCustomizations() and - * getAvailableCustomizations') has to be empty. - * - * @return the customizations selected using the dialog. - */ - List<Customization> getSelectedCustomizations(); - - /** - * The intersection between getSelectedCustomizations() and - * getAvailableCustomizations') has to be empty. - * - * @return the available and not yet selected customizations - */ - List<Customization> getAvailableCustomizations(); - - /** - * This method is used to push up a customization. - * - * @param customization - * a selected customization. - * @throws IllegalParameterException - * when the parameter in not on element of the list returned by - * getSelectedCustomizations(). - */ - void pushUp(Customization customization) throws IllegalParameterException; - - /** - * This method is used to push down a customization. - * - * @param customization - * a selected customization. - * @throws IllegalParameterException - * when the parameter in not on element of the list returned by - * getSelectedCustomizations(). - */ - void pushDown(Customization customization) throws IllegalParameterException; -}
diff --git a/org.eclipse.modisco.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/internal/exported/dialog/ILoadCustomizationsDialogFactory.java b/org.eclipse.modisco.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/internal/exported/dialog/ILoadCustomizationsDialogFactory.java deleted file mode 100644 index 126ce51..0000000 --- a/org.eclipse.modisco.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/internal/exported/dialog/ILoadCustomizationsDialogFactory.java +++ /dev/null
@@ -1,72 +0,0 @@ -/** - * Copyright (c) 2011 Mia-Software. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Gregoire Dupe (Mia-Software) - Bug 369987 - [Restructuring][Table] Switch to the new customization and facet framework - */ -package org.eclipse.emf.facet.custom.ui.internal.exported.dialog; - -import java.util.List; - -import org.eclipse.emf.facet.custom.metamodel.v0_2_0.custom.Customization; -import org.eclipse.emf.facet.custom.ui.internal.dialog.LoadCustomizationsDialogFactory; -import org.eclipse.emf.facet.util.ui.internal.exported.dialog.IDialogCallbackWithPreCommit; -import org.eclipse.swt.widgets.Shell; - -/** - * Factory for {@link ILoadCustomizationsDialog}. - * - * @noextend This interface is not intended to be extended by clients. - * @noimplement This interface is not intended to be implemented by clients. - * @since 0.2.0 - */ -public interface ILoadCustomizationsDialogFactory { - /** The default implementation */ - ILoadCustomizationsDialogFactory DEFAULT = new LoadCustomizationsDialogFactory(); - - /** - * @param parent - * the parent shell - * @param availableCustoms - * the customizations that the user will be able to select - * @param selectedCustoms - * the customizations that will be selected when the dialog opens - * @param listener - * called when the dialog closes - * @return the dialog - * @since 0.2 - */ - <D> ILoadCustomizationsDialog<D> createLoadCustomizationDialog(final Shell parent, - final List<Customization> availableCustoms, - final List<Customization> selectedCustoms, - IDialogCallbackWithPreCommit<List<Customization>, Boolean, D> callback); - - /** - * @param parent - * the parent shell - * @param availableCustoms - * the customizations that the user will be able to select - * @param selectedCustoms - * the customizations that will be selected when the dialog opens - * @param lockedCustoms - * a list of customizations that the user will not be able to unload - * @param listener - * called when the dialog closes - * @param lockMsg - * a message indicating why certain customizations cannot be unloaded - * @return the dialog - * @since 0.2 - */ - <D> ILoadCustomizationsDialog<D> createLoadCustomizationDialog(final Shell parent, - final List<Customization> availableCustoms, - final List<Customization> selectedCustoms, - final List<Customization> lockedCustoms, - IDialogCallbackWithPreCommit<List<Customization>, Boolean, D> callback, - String lockMsg); - -}
diff --git a/org.eclipse.modisco.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/internal/exported/exception/IllegalParameterException.java b/org.eclipse.modisco.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/internal/exported/exception/IllegalParameterException.java deleted file mode 100644 index dbf51a2..0000000 --- a/org.eclipse.modisco.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/internal/exported/exception/IllegalParameterException.java +++ /dev/null
@@ -1,53 +0,0 @@ -/** - * Copyright (c) 2011 Mia-Software. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Gregoire Dupe (Mia-Software) - Bug 361794 - [Restructuring] New customization meta-model - */ -package org.eclipse.emf.facet.custom.ui.internal.exported.exception; - -import java.util.List; - -public class IllegalParameterException extends Exception { - - private static final long serialVersionUID = 2470355059500176931L; - private final List<? extends Object> illegalParameters; - - public IllegalParameterException( - final List<? extends Object> illegalParameters) { - super(); - this.illegalParameters = illegalParameters; - } - - public IllegalParameterException(final String message, - final List<? extends Object> illegalParameters) { - super(message); - this.illegalParameters = illegalParameters; - } - - public IllegalParameterException(final Throwable cause, - final List<? extends Object> illegalParameters) { - super(cause); - this.illegalParameters = illegalParameters; - } - - public IllegalParameterException(final String message, - final Throwable cause, - final List<? extends Object> illegalParameters) { - super(message, cause); - this.illegalParameters = illegalParameters; - } - - /** - * @return the illegalParameters - */ - public List<? extends Object> getIllegalParameters() { - return this.illegalParameters; - } - -}
diff --git a/org.eclipse.modisco.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/internal/handler/LoadCustomizationsHandler.java b/org.eclipse.modisco.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/internal/handler/LoadCustomizationsHandler.java deleted file mode 100644 index 9aed960..0000000 --- a/org.eclipse.modisco.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/internal/handler/LoadCustomizationsHandler.java +++ /dev/null
@@ -1,91 +0,0 @@ -/** - * Copyright (c) 2014 Mia-Software. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Gregoire Dupe (Mia-Software) - Bug 441051 - Reusable customization and facet loading dialogs - * Gregoire Dupe (Mia-Software) - Bug 443682 - Access to the super facet - */ -package org.eclipse.emf.facet.custom.ui.internal.handler; - -import java.util.ArrayList; -import java.util.HashSet; -import java.util.List; -import java.util.Set; - -import org.eclipse.core.commands.AbstractHandler; -import org.eclipse.core.commands.ExecutionEvent; -import org.eclipse.core.commands.ExecutionException; -import org.eclipse.emf.facet.custom.core.ICustomizationCatalogManager; -import org.eclipse.emf.facet.custom.core.ICustomizationCatalogManagerFactory; -import org.eclipse.emf.facet.custom.core.ICustomizationManager; -import org.eclipse.emf.facet.custom.core.ICustomizationManagerProvider; -import org.eclipse.emf.facet.custom.metamodel.v0_2_0.custom.Customization; -import org.eclipse.emf.facet.custom.ui.internal.exported.dialog.ILoadCustomizationsDialog; -import org.eclipse.emf.facet.custom.ui.internal.exported.dialog.ILoadCustomizationsDialogFactory; -import org.eclipse.emf.facet.efacet.core.IFacetManager; -import org.eclipse.emf.facet.util.ui.internal.exported.dialog.IDialogCallback; -import org.eclipse.emf.facet.util.ui.internal.exported.dialog.IDialogCallbackWithPreCommit; -import org.eclipse.emf.facet.util.ui.internal.exported.dialog.IQuestionDialog; -import org.eclipse.ui.IWorkbenchPart; -import org.eclipse.ui.handlers.HandlerUtil; - -public class LoadCustomizationsHandler extends AbstractHandler { - - public Object execute(final ExecutionEvent event) throws ExecutionException { - final IWorkbenchPart activePart = HandlerUtil.getActivePart(event); - if (activePart != null) { - final ICustomizationManagerProvider customMgrProvider = (ICustomizationManagerProvider) activePart - .getAdapter(ICustomizationManagerProvider.class); - if (customMgrProvider != null) { - final ICustomizationManager manager = customMgrProvider - .getCustomizationManager(); - final Set<Customization> availableCustoms = new HashSet<Customization>(); - final ICustomizationCatalogManager catalog = ICustomizationCatalogManagerFactory.DEFAULT - .getOrCreateCustomizationCatalogManager(manager.getResourceSet()); - availableCustoms.addAll(catalog.getRegisteredCustomizations()); - availableCustoms.addAll(manager.getManagedCustomizations()); - final IDialogCallbackWithPreCommit<List<Customization>, Boolean, IQuestionDialog> callback = new DialogCallbackWithPreCommit(manager); - final List<Customization> availableCustomsL = new ArrayList<Customization>( - availableCustoms); - final ILoadCustomizationsDialog<IQuestionDialog> dialog = ILoadCustomizationsDialogFactory.DEFAULT - .createLoadCustomizationDialog(null, - availableCustomsL, - manager.getManagedCustomizations(), - new ArrayList<Customization>(), - callback, - ""); //$NON-NLS-1$ - dialog.asyncOpen(); - } - } - return null; - } - - private class DialogCallbackWithPreCommit implements IDialogCallbackWithPreCommit<List<Customization>, Boolean, IQuestionDialog> { - - private final ICustomizationManager manager; - - public DialogCallbackWithPreCommit(final ICustomizationManager manager) { - this.manager = manager; - } - - public void committed(final List<Customization> result, - final Boolean precommitResult) { - if (precommitResult.booleanValue()) { - this.manager.getManagedCustomizations().clear(); - final IFacetManager facetManager = this.manager.getFacetManager(); - facetManager.getManagedFacetSets().addAll(0, result); - } - } - - public IQuestionDialog openPrecommitDialog( - final List<Customization> result, - final IDialogCallback<Boolean> precommitCallback) { - return null; - } - } -}
diff --git a/org.eclipse.modisco.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/internal/query/BackgroundQuery.java b/org.eclipse.modisco.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/internal/query/BackgroundQuery.java deleted file mode 100644 index b759212..0000000 --- a/org.eclipse.modisco.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/internal/query/BackgroundQuery.java +++ /dev/null
@@ -1,32 +0,0 @@ -/** - * Copyright (c) 2012 Mia-Software. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Gregoire Dupe (Mia-Software) - Bug 361794 - [Restructuring] EMF Facet customization meta-model - * Gregoire Dupe (Mia-Software) - Bug 369987 - [Restructuring][Table] Switch to the new customization and facet framework - */ -package org.eclipse.emf.facet.custom.ui.internal.query; - -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.facet.custom.metamodel.custompt.IColor; -import org.eclipse.emf.facet.custom.ui.internal.custompt.Color; -import org.eclipse.emf.facet.efacet.core.IFacetManager; -import org.eclipse.emf.facet.efacet.core.exception.DerivedTypedElementException; -import org.eclipse.emf.facet.query.java.core.IJavaQuery2; -import org.eclipse.emf.facet.query.java.core.IParameterValueList2; - -public class BackgroundQuery implements IJavaQuery2<EObject, IColor> { - - public IColor evaluate(final EObject source, - final IParameterValueList2 parameterValues, - final IFacetManager facetManager) - throws DerivedTypedElementException { - return new Color(Color.MAX_VALUE, Color.MAX_VALUE, Color.MAX_VALUE); - } - -}
diff --git a/org.eclipse.modisco.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/internal/query/ChildrenQuery.java b/org.eclipse.modisco.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/internal/query/ChildrenQuery.java deleted file mode 100644 index e005c93..0000000 --- a/org.eclipse.modisco.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/internal/query/ChildrenQuery.java +++ /dev/null
@@ -1,30 +0,0 @@ -/** - * Copyright (c) 2014 Mia-Software. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Gregoire Dupe (Mia-Software) - Bug 441570 - Children custom property - */ -package org.eclipse.emf.facet.custom.ui.internal.query; - -import java.util.List; - -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.EStructuralFeature; -import org.eclipse.emf.facet.efacet.core.IFacetManager; -import org.eclipse.emf.facet.efacet.core.exception.DerivedTypedElementException; -import org.eclipse.emf.facet.query.java.core.IJavaQuery2; -import org.eclipse.emf.facet.query.java.core.IParameterValueList2; - -public class ChildrenQuery implements IJavaQuery2<EObject, List<EStructuralFeature>> { - public List<EStructuralFeature> evaluate(final EObject context, - final IParameterValueList2 parameterValues, - final IFacetManager facetManager) - throws DerivedTypedElementException { - return null; - } -}
diff --git a/org.eclipse.modisco.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/internal/query/FontNameQuery.java b/org.eclipse.modisco.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/internal/query/FontNameQuery.java deleted file mode 100644 index e338177..0000000 --- a/org.eclipse.modisco.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/internal/query/FontNameQuery.java +++ /dev/null
@@ -1,31 +0,0 @@ -/** - * Copyright (c) 2012 Mia-Software. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Gregoire Dupe (Mia-Software) - Bug 361794 - [Restructuring] EMF Facet customization meta-model - * Gregoire Dupe (Mia-Software) - Bug 369987 - [Restructuring][Table] Switch to the new customization and facet framework - */ -package org.eclipse.emf.facet.custom.ui.internal.query; - -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.facet.efacet.core.IFacetManager; -import org.eclipse.emf.facet.efacet.core.exception.DerivedTypedElementException; -import org.eclipse.emf.facet.query.java.core.IJavaQuery2; -import org.eclipse.emf.facet.query.java.core.IParameterValueList2; -import org.eclipse.swt.widgets.Display; - -public class FontNameQuery implements IJavaQuery2<EObject, String> { - - public String evaluate(final EObject source, - final IParameterValueList2 parameterValues, - final IFacetManager facetManager) - throws DerivedTypedElementException { - return Display.getDefault().getSystemFont().getFontData()[0].getName(); - } - -}
diff --git a/org.eclipse.modisco.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/internal/query/FontSizeQuery.java b/org.eclipse.modisco.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/internal/query/FontSizeQuery.java deleted file mode 100644 index 0429f5c..0000000 --- a/org.eclipse.modisco.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/internal/query/FontSizeQuery.java +++ /dev/null
@@ -1,31 +0,0 @@ -/** - * Copyright (c) 2012 Mia-Software. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Gregoire Dupe (Mia-Software) - Bug 361794 - [Restructuring] EMF Facet customization meta-model - * Gregoire Dupe (Mia-Software) - Bug 369987 - [Restructuring][Table] Switch to the new customization and facet framework - */ -package org.eclipse.emf.facet.custom.ui.internal.query; - -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.facet.efacet.core.IFacetManager; -import org.eclipse.emf.facet.efacet.core.exception.DerivedTypedElementException; -import org.eclipse.emf.facet.query.java.core.IJavaQuery2; -import org.eclipse.emf.facet.query.java.core.IParameterValueList2; -import org.eclipse.swt.widgets.Display; - -public class FontSizeQuery implements IJavaQuery2<EObject, Integer> { - - public Integer evaluate(final EObject source, - final IParameterValueList2 parameterValues, - final IFacetManager facetManager) - throws DerivedTypedElementException { - return Integer.valueOf(Display.getDefault().getSystemFont().getFontData()[0].getHeight()); - } - -}
diff --git a/org.eclipse.modisco.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/internal/query/ForegroundQuery.java b/org.eclipse.modisco.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/internal/query/ForegroundQuery.java deleted file mode 100644 index a4ecb4d..0000000 --- a/org.eclipse.modisco.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/internal/query/ForegroundQuery.java +++ /dev/null
@@ -1,32 +0,0 @@ -/** - * Copyright (c) 2012 Mia-Software. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Gregoire Dupe (Mia-Software) - Bug 361794 - [Restructuring] EMF Facet customization meta-model - * Gregoire Dupe (Mia-Software) - Bug 369987 - [Restructuring][Table] Switch to the new customization and facet framework - */ -package org.eclipse.emf.facet.custom.ui.internal.query; - -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.facet.custom.metamodel.custompt.IColor; -import org.eclipse.emf.facet.custom.ui.internal.custompt.Color; -import org.eclipse.emf.facet.efacet.core.IFacetManager; -import org.eclipse.emf.facet.efacet.core.exception.DerivedTypedElementException; -import org.eclipse.emf.facet.query.java.core.IJavaQuery2; -import org.eclipse.emf.facet.query.java.core.IParameterValueList2; - -public class ForegroundQuery implements IJavaQuery2<EObject, IColor> { - - public IColor evaluate(final EObject source, - final IParameterValueList2 parameterValues, - final IFacetManager facetManager) - throws DerivedTypedElementException { - return new Color(0, 0, 0); - } - -}
diff --git a/org.eclipse.modisco.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/internal/query/ImageQuery.java b/org.eclipse.modisco.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/internal/query/ImageQuery.java deleted file mode 100644 index ff43234..0000000 --- a/org.eclipse.modisco.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/internal/query/ImageQuery.java +++ /dev/null
@@ -1,130 +0,0 @@ -/** - * Copyright (c) 2011, 2015 Mia-Software, and Soft-Maint. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Gregoire Dupe (Mia-Software) - Bug 361794 - [Restructuring] EMF Facet customization meta-model - * Gregoire Dupe (Mia-Software) - Bug 369987 - [Restructuring][Table] Switch to the new customization and facet framework - * Nicolas Bros (Mia-Software) - Bug 379683 - customizable Tree content provider - * Gregoire Dupe (Mia-Software) - Bug 424122 - [Table] Images, fonts and colors are not shared between the instances of table - * Jonathan Pepin (Soft-Maint) - Bug 469177 - IResolvingCustomizedLabelProviderFactory display no default Image - * Grégoire Dupé (Mia-Software) - Bug 469177 - IResolvingCustomizedLabelProviderFactory display no default Image - */ -package org.eclipse.emf.facet.custom.ui.internal.query; - -import org.eclipse.emf.ecore.EAttribute; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.EReference; -import org.eclipse.emf.ecore.ETypedElement; -import org.eclipse.emf.edit.provider.ComposedAdapterFactory; -import org.eclipse.emf.edit.provider.IItemLabelProvider; -import org.eclipse.emf.edit.ui.provider.ExtendedImageRegistry; -import org.eclipse.emf.facet.custom.metamodel.custompt.IImage; -import org.eclipse.emf.facet.custom.ui.internal.Activator; -import org.eclipse.emf.facet.custom.ui.internal.ImageProvider; -import org.eclipse.emf.facet.custom.ui.internal.custompt.ImageWrapper; -import org.eclipse.emf.facet.efacet.core.IFacetManager; -import org.eclipse.emf.facet.efacet.core.exception.DerivedTypedElementException; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.FacetAttribute; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.FacetReference; -import org.eclipse.emf.facet.query.java.core.IJavaQuery2; -import org.eclipse.emf.facet.query.java.core.IParameterValueList2; -import org.eclipse.emf.facet.util.swt.imageprovider.IImageProvider; -import org.eclipse.emf.facet.util.swt.imageprovider.IImageProviderFactory; -import org.eclipse.jface.resource.ImageDescriptor; -import org.eclipse.swt.graphics.Image; - -public class ImageQuery implements IJavaQuery2<EObject, IImage> { - - public IImage evaluate(final EObject source, - final IParameterValueList2 parameterValues, - final IFacetManager facetManager) - throws DerivedTypedElementException { - IImage result = null; - ETypedElement sfParam = null; - if (parameterValues != null) { - sfParam = (ETypedElement) parameterValues - .getParameterValueByName("eStructuralFeature").getValue(); //$NON-NLS-1$ - } - if (sfParam == null) { - result = getEObjectImage(source); - } else { - result = getLinkImage(sfParam); - } - return result; - } - - protected static IImage getEObjectImage(final EObject source) { - IImage result = null; - final ComposedAdapterFactory adapterFactory = new ComposedAdapterFactory( - ComposedAdapterFactory.Descriptor.Registry.INSTANCE); - final IItemLabelProvider itemLabelProvider = (IItemLabelProvider) adapterFactory - .adapt(source, IItemLabelProvider.class); - if (itemLabelProvider != null) { - final Object imageObj = itemLabelProvider.getImage(source); - final ImageDescriptor imgDescriptor = ExtendedImageRegistry - .getInstance().getImageDescriptor(imageObj); - final IImageProvider imgProvider = IImageProviderFactory.DEFAULT - .createIImageProvider(Activator.getDefault()); - if (imgDescriptor != null) { - final Image image = imgProvider.getImage(imgDescriptor); - result = new ImageWrapper(image); - } - } - return result; - } - - /** - * Returns the image for an attribute or reference link. - * - * @param sfParam - * the attribute or reference - * @param source - * the EObject under which the attribute or reference appears - * @return the image - */ - private static IImage getLinkImage(final ETypedElement sfParam) { - Image image = null; - if (sfParam instanceof FacetReference) { - image = ImageProvider.getInstance().getFacetLinkIcon(); - } else if (sfParam instanceof EReference) { - image = getReferenceImage((EReference) sfParam); - } else if (sfParam instanceof FacetAttribute) { - image = ImageProvider.getInstance().getFacetAttributeIcon(); - } else if (sfParam instanceof EAttribute) { - image = getAttributeImage(); - } else { - image = ImageProvider.getInstance().getFeatureIcon(); - } - return new ImageWrapper(image); - } - - private static Image getReferenceImage(final EReference reference) { - Image result; - final EReference opposite = reference.getEOpposite(); - if (reference.isContainment()) { - if (opposite == null) { - result = ImageProvider.getInstance().getUnidirectionalAggregIcon(); - } else { - result = ImageProvider.getInstance().getAggregIcon(); - } - } else { - if (opposite != null && opposite.isContainment()) { - result = ImageProvider.getInstance().getInvAggregIcon(); - } else if (opposite == null) { - result = ImageProvider.getInstance().getUnidirectionalLinkIcon(); - } else { - result = ImageProvider.getInstance().getLinkIcon(); - } - } - return result; - } - - private static Image getAttributeImage() { - return ImageProvider.getInstance().getAttributeIcon(); - } -}
diff --git a/org.eclipse.modisco.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/internal/query/LabelQuery.java b/org.eclipse.modisco.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/internal/query/LabelQuery.java deleted file mode 100644 index e68597d..0000000 --- a/org.eclipse.modisco.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/internal/query/LabelQuery.java +++ /dev/null
@@ -1,136 +0,0 @@ -/** - * Copyright (c) 2011 Mia-Software. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Gregoire Dupe (Mia-Software) - Bug 361794 - [Restructuring] EMF Facet customization meta-model - * Gregoire Dupe (Mia-Software) - Bug 369987 - [Restructuring][Table] Switch to the new customization and facet framework - * Gregoire Dupe (Mia-Software) - Bug 373078 - API Cleaning - * Gregoire Dupe (Mia-Software) - Bug 375087 - [Table] ITableWidget.addColumn(List<ETypedElement>, List<FacetSet>) - * Nicolas Bros (Mia-Software) - Bug 379683 - customizable Tree content provider - */ -package org.eclipse.emf.facet.custom.ui.internal.query; - -import org.eclipse.emf.ecore.EAttribute; -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.EStructuralFeature; -import org.eclipse.emf.ecore.ETypedElement; -import org.eclipse.emf.ecore.util.FeatureMap; -import org.eclipse.emf.edit.provider.ComposedAdapterFactory; -import org.eclipse.emf.edit.provider.IItemLabelProvider; -import org.eclipse.emf.edit.provider.ReflectiveItemProvider; -import org.eclipse.emf.facet.efacet.core.IFacetManager; -import org.eclipse.emf.facet.efacet.core.exception.DerivedTypedElementException; -import org.eclipse.emf.facet.query.java.core.IJavaQuery2; -import org.eclipse.emf.facet.query.java.core.IParameterValueList2; -import org.eclipse.emf.facet.util.emf.core.ModelUtils; - -public class LabelQuery implements IJavaQuery2<EObject, String> { - - private static final String NAME = "name"; //$NON-NLS-1$ - - public String evaluate(final EObject source, - final IParameterValueList2 parameterValues, - final IFacetManager facetManager) - throws DerivedTypedElementException { - ETypedElement sfParam = null; - if (parameterValues != null) { - sfParam = (ETypedElement) parameterValues - .getParameterValueByName("eStructuralFeature").getValue(); //$NON-NLS-1$ - } - String result = null; - if (sfParam == null) { - final ComposedAdapterFactory adapterFactory = new ComposedAdapterFactory( - ComposedAdapterFactory.Descriptor.Registry.INSTANCE); - final IItemLabelProvider itemLabelProvider = (IItemLabelProvider) adapterFactory - .adapt(source, IItemLabelProvider.class); - // We don't want to use a ReflectiveItemProvider because it provides - // a string prefixed with the eObject's meta-class name. - if (itemLabelProvider instanceof ReflectiveItemProvider) { - result = LabelQuery.getDefaultName(source); - } else if (itemLabelProvider == null) { - result = ModelUtils.getDefaultName(source); - } else { - result = itemLabelProvider.getText(source); - } - } else { - try { - if (sfParam instanceof EAttribute && sfParam.getUpperBound() == 1) { - final Object object = facetManager.getOrInvoke(source, sfParam, Object.class); - final String objectLabel = getObjectLabel(object, facetManager); - result = sfParam.getName() + " = " + objectLabel; //$NON-NLS-1$ - } else { - result = sfParam.getName(); - } - } catch (final Exception e) { - throw new DerivedTypedElementException(e); - } - } - return result; - } - - private String getObjectLabel(final Object object, - final IFacetManager facetManager) - throws DerivedTypedElementException { - String result; - if (object instanceof EObject) { - final EObject eObject = (EObject) object; - result = evaluate(eObject, null, facetManager); - } else { - result = String.valueOf(object); - } - return result; - } - - /** - * @return a default name based on a string feature of the given - * {@link EObject} - */ - // from org.eclipse.emf.facet.infra.common.core.internal.utils.ModelUtils - public static String getDefaultName(final EObject eObject) { - String result = ""; //$NON-NLS-1$ - // find a feature that can be used as a name - final EStructuralFeature feature = LabelQuery.getLabelFeature(eObject - .eClass()); - if (feature != null) { - result = (String) eObject.eGet(feature); - } - return result; - } - - /** - * This method searches for a structural feature that can be used as a name - * - * @param eClass - * in which class to search a structural feature that can be used as - * a name - * @return an EStructuralFeature - */ - // Copied from org.eclipse.emf.edit.provider.ReflectiveItemProvider to org.eclipse.emf.facet.infra.common.core.internal.utils.ModelUtils - // Copied from org.eclipse.emf.facet.infra.common.core.internal.utils.ModelUtils - private static EStructuralFeature getLabelFeature(final EClass eClass) { - EAttribute result = null; - for (final EAttribute eAttribute : eClass.getEAllAttributes()) { - if (!eAttribute.isMany() - && eAttribute.getEType().getInstanceClass() != FeatureMap.Entry.class) { - if (LabelQuery.NAME.equalsIgnoreCase(eAttribute - .getName())) { - result = eAttribute; - break; - } else if (result == null) { - result = eAttribute; - } else if (eAttribute.getEAttributeType().getInstanceClass() == String.class - && result.getEAttributeType().getInstanceClass() != String.class) { - result = eAttribute; - } - } - } - return result; - } - -}
diff --git a/org.eclipse.modisco.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/internal/query/SelectionQuery.java b/org.eclipse.modisco.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/internal/query/SelectionQuery.java deleted file mode 100644 index 3597ae0..0000000 --- a/org.eclipse.modisco.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/internal/query/SelectionQuery.java +++ /dev/null
@@ -1,59 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2012 Mia-Software. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Nicolas Bros (Mia-Software) - Bug 377866 - selection customization - *******************************************************************************/ -package org.eclipse.emf.facet.custom.ui.internal.query; - -import java.util.Collections; -import java.util.List; - -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.ETypedElement; -import org.eclipse.emf.facet.efacet.core.IFacetManager; -import org.eclipse.emf.facet.efacet.core.exception.DerivedTypedElementException; -import org.eclipse.emf.facet.efacet.core.exception.FacetManagerException; -import org.eclipse.emf.facet.query.java.core.IJavaQuery2; -import org.eclipse.emf.facet.query.java.core.IParameterValueList2; - -/** - * This is the query that returns the default selection for a given source and feature (i.e. row and column in a table). - * By default, the selection is the {@link EObject} (or list of {@link EObject}s) returned by evaluating the feature on - * the source. - */ -public class SelectionQuery implements IJavaQuery2<EObject, List<Object>> { - - // @SuppressWarnings("unchecked") : facet manager is not type safe - @SuppressWarnings("unchecked") - public List<Object> evaluate(final EObject source, - final IParameterValueList2 parameterValues, - final IFacetManager facetManager) - throws DerivedTypedElementException { - if (parameterValues.size() != 1) { - throw new DerivedTypedElementException("the selection query expects one argument"); //$NON-NLS-1$ - } - final Object param1 = parameterValues.get(0).getValue(); - if (!(param1 instanceof ETypedElement)) { - throw new DerivedTypedElementException("the selection query expects an ETypedElement argument"); //$NON-NLS-1$ - } - final ETypedElement feature = (ETypedElement) param1; - - final List<Object> result; - try { - final Object featureResult = facetManager.getOrInvoke(source, feature, null); - if (feature.isMany()) { - result = (List<Object>) featureResult; - } else { - result = Collections.singletonList(featureResult); - } - } catch (FacetManagerException e) { - throw new DerivedTypedElementException(e); - } - return result; - } -}
diff --git a/org.eclipse.modisco.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/internal/query/ToolTipAlignmentQuery.java b/org.eclipse.modisco.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/internal/query/ToolTipAlignmentQuery.java deleted file mode 100644 index e4e8200..0000000 --- a/org.eclipse.modisco.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/internal/query/ToolTipAlignmentQuery.java +++ /dev/null
@@ -1,37 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2012 CEA LIST. - * - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Vincent Lorenzo (CEA-LIST) - Bug 372644 - Create Customizable tooltips for the TreeViewer using a CustomizableLabelProvider - * - *****************************************************************************/ - -package org.eclipse.emf.facet.custom.ui.internal.query; - -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.facet.custom.metamodel.v0_2_0.custompt.Alignment; -import org.eclipse.emf.facet.efacet.core.IFacetManager; -import org.eclipse.emf.facet.efacet.core.exception.DerivedTypedElementException; -import org.eclipse.emf.facet.query.java.core.IJavaQuery2; -import org.eclipse.emf.facet.query.java.core.IParameterValueList2; - -/** - * - * This query is used to get the default alignment for the tooltip texts - * - */ -public class ToolTipAlignmentQuery implements IJavaQuery2<EObject, Alignment> { - - public Alignment evaluate(final EObject source, - final IParameterValueList2 parameterValues, - final IFacetManager facetManager) - throws DerivedTypedElementException { - return Alignment.LEFT; - } -}
diff --git a/org.eclipse.modisco.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/internal/query/ToolTipBackgroundQuery.java b/org.eclipse.modisco.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/internal/query/ToolTipBackgroundQuery.java deleted file mode 100644 index 283052d..0000000 --- a/org.eclipse.modisco.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/internal/query/ToolTipBackgroundQuery.java +++ /dev/null
@@ -1,41 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2012 CEA LIST. - * - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Vincent Lorenzo (CEA-LIST) - Bug 372644 - Create Customizable tooltips for the TreeViewer using a CustomizableLabelProvider - * - *****************************************************************************/ - -package org.eclipse.emf.facet.custom.ui.internal.query; - -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.facet.custom.metamodel.custompt.IColor; -import org.eclipse.emf.facet.custom.ui.internal.custompt.Color; -import org.eclipse.emf.facet.efacet.core.IFacetManager; -import org.eclipse.emf.facet.efacet.core.exception.DerivedTypedElementException; -import org.eclipse.emf.facet.query.java.core.IJavaQuery2; -import org.eclipse.emf.facet.query.java.core.IParameterValueList2; - -/** - * - * This query is used to get the default background color for the tooltips (255,255,225) - * - */ -public class ToolTipBackgroundQuery implements IJavaQuery2<EObject, IColor> { - - private static final int BCK_GND_BLUE = 225; - - public IColor evaluate(final EObject source, - final IParameterValueList2 parameterValues, - final IFacetManager facetManager) - throws DerivedTypedElementException { - //default yellow background for tooltip - return new Color(Color.MAX_VALUE, Color.MAX_VALUE, ToolTipBackgroundQuery.BCK_GND_BLUE); - } -}
diff --git a/org.eclipse.modisco.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/internal/query/ToolTipDelayQuery.java b/org.eclipse.modisco.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/internal/query/ToolTipDelayQuery.java deleted file mode 100644 index 40fe97a..0000000 --- a/org.eclipse.modisco.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/internal/query/ToolTipDelayQuery.java +++ /dev/null
@@ -1,35 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2012 CEA LIST. - * - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Vincent Lorenzo (CEA-LIST) - Bug 372644 - Create Customizable tooltips for the TreeViewer using a CustomizableLabelProvider - * - *****************************************************************************/ -package org.eclipse.emf.facet.custom.ui.internal.query; - -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.facet.efacet.core.IFacetManager; -import org.eclipse.emf.facet.efacet.core.exception.DerivedTypedElementException; -import org.eclipse.emf.facet.query.java.core.IJavaQuery2; -import org.eclipse.emf.facet.query.java.core.IParameterValueList2; - -/** - * - * This query is used to get the default time for the tooltips - * - */ -public class ToolTipDelayQuery implements IJavaQuery2<EObject, Integer> { - - public Integer evaluate(final EObject source, - final IParameterValueList2 parameterValues, - final IFacetManager facetManager) - throws DerivedTypedElementException { - return Integer.valueOf(0); - } -}
diff --git a/org.eclipse.modisco.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/internal/query/ToolTipShadowQuery.java b/org.eclipse.modisco.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/internal/query/ToolTipShadowQuery.java deleted file mode 100644 index e0077ed..0000000 --- a/org.eclipse.modisco.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/internal/query/ToolTipShadowQuery.java +++ /dev/null
@@ -1,37 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2012 CEA LIST. - * - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Vincent Lorenzo (CEA-LIST) - Bug 372644 - Create Customizable tooltips for the TreeViewer using a CustomizableLabelProvider - * - *****************************************************************************/ - -package org.eclipse.emf.facet.custom.ui.internal.query; - -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.facet.custom.metamodel.v0_2_0.custompt.Shadow; -import org.eclipse.emf.facet.efacet.core.IFacetManager; -import org.eclipse.emf.facet.efacet.core.exception.DerivedTypedElementException; -import org.eclipse.emf.facet.query.java.core.IJavaQuery2; -import org.eclipse.emf.facet.query.java.core.IParameterValueList2; - -/** - * - * This query is used to get the default shadow for the tooltips - * - */ -public class ToolTipShadowQuery implements IJavaQuery2<EObject, Shadow> { - - public Shadow evaluate(final EObject source, - final IParameterValueList2 parameterValues, - final IFacetManager facetManager) - throws DerivedTypedElementException { - return Shadow.NONE; - } -}
diff --git a/org.eclipse.modisco.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/internal/query/ToolTipTextQuery.java b/org.eclipse.modisco.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/internal/query/ToolTipTextQuery.java deleted file mode 100644 index 2521276..0000000 --- a/org.eclipse.modisco.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/internal/query/ToolTipTextQuery.java +++ /dev/null
@@ -1,76 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2012 CEA LIST. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Vincent Lorenzo (CEA-LIST) - Bug 373255 - Add tooltips providing a documentation for the selected elements in the Select ETypedElement Dialog - * - *******************************************************************************/ - -package org.eclipse.emf.facet.custom.ui.internal.query; - -import org.eclipse.emf.ecore.EAnnotation; -import org.eclipse.emf.ecore.EModelElement; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.facet.custom.ui.internal.Messages; -import org.eclipse.emf.facet.efacet.core.IFacetManager; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.DocumentedElement; -import org.eclipse.emf.facet.query.java.core.IJavaQuery2; -import org.eclipse.emf.facet.query.java.core.IParameterValueList2; -import org.eclipse.osgi.util.NLS; - -/** - * - * This query returns the tooltip to display for DocumentedElement and - * EModelElement - * - */ -public class ToolTipTextQuery implements IJavaQuery2<EObject, String> { - - /** the URI used by EAnnotation for the documentation for the documentation */ - public static final String URI_GEN_MODEL = "http://www.eclipse.org/emf/2002/GenModel"; //$NON-NLS-1$ - - /** the key to get the documentation in an EAnnotation */ - public static final String DOCUMENTATION = "documentation"; //$NON-NLS-1$ - - /** the String displayed when there is no documentation */ - public static final String NO_DOCUMENTATION = Messages.ToolTipTextQuery_NoDocumentation; - - public String evaluate(final EObject source, - final IParameterValueList2 parameterValues, - final IFacetManager facetManager) { - String result = null; - final String documentation = getDocumentation(source); - if (documentation != null) { - result = NLS.bind(Messages.ToolTipTextQuery_Documentation, - documentation); - } - return result; - } - - /** - * - * @param source - * @param parameterValues - * @param facetManager - * @return the documentation for DocumentedElement and EModelElement - */ - private static String getDocumentation(final EObject source) { - String documentation = ""; //$NON-NLS-1$ - if (source instanceof DocumentedElement) { - documentation = ((DocumentedElement) source).getDocumentation(); - } else if (source instanceof EModelElement) { - final EAnnotation eAnnotation = ((EModelElement) source) - .getEAnnotation(ToolTipTextQuery.URI_GEN_MODEL); - if (eAnnotation != null) { - documentation = eAnnotation.getDetails().get( - ToolTipTextQuery.DOCUMENTATION); - } - } - return documentation; - } -} \ No newline at end of file
diff --git a/org.eclipse.modisco.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/internal/query/URIImageQueryImplementationFactory.java b/org.eclipse.modisco.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/internal/query/URIImageQueryImplementationFactory.java deleted file mode 100644 index 88111e8..0000000 --- a/org.eclipse.modisco.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/internal/query/URIImageQueryImplementationFactory.java +++ /dev/null
@@ -1,39 +0,0 @@ -/** - * Copyright (c) 2013 Soft-Maint. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * David Couvrand (Soft-Maint) - Bug 402725 - Need a query to get an image from an URI - * Nicolas Rault (Soft-Maint) - Bug 402725 - Need a query to get an image from an URI - */ - -package org.eclipse.emf.facet.custom.ui.internal.query; - -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.facet.custom.metamodel.v0_3_0.query.QueryPackage; -import org.eclipse.emf.facet.custom.ui.internal.querytype.URIImageQueryEvaluator; -import org.eclipse.emf.facet.efacet.core.IDerivedTypedElementManager; -import org.eclipse.emf.facet.efacet.core.exception.DerivedTypedElementException; -import org.eclipse.emf.facet.efacet.core.query.IQueryImplementation; -import org.eclipse.emf.facet.efacet.core.query.IQueryImplementationFactory; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.extensible.Query; -import org.osgi.framework.Bundle; - -public class URIImageQueryImplementationFactory implements - IQueryImplementationFactory { - - public IQueryImplementation create(final Query query, - final Bundle queryBundle, final IDerivedTypedElementManager manager) - throws DerivedTypedElementException { - return new URIImageQueryEvaluator(); - } - - public EClass getManagedQueryType() { - return QueryPackage.eINSTANCE.getURIImageQuery(); - } - -}
diff --git a/org.eclipse.modisco.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/internal/querytype/URIImageQueryEvaluator.java b/org.eclipse.modisco.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/internal/querytype/URIImageQueryEvaluator.java deleted file mode 100644 index d6fe262..0000000 --- a/org.eclipse.modisco.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/internal/querytype/URIImageQueryEvaluator.java +++ /dev/null
@@ -1,53 +0,0 @@ -/** - * Copyright (c) 2013 Soft-Maint. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * David Couvrand (Soft-Maint) - Bug 402725 - Need a query to get an image from an URI - * Nicolas Rault (Soft-Maint) - Bug 402725 - Need a query to get an image from an URI - */ -package org.eclipse.emf.facet.custom.ui.internal.querytype; - -import java.util.List; - -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.facet.custom.metamodel.v0_3_0.query.URIImageQuery; -import org.eclipse.emf.facet.custom.ui.internal.custompt.URIImage; -import org.eclipse.emf.facet.efacet.core.IFacetManager; -import org.eclipse.emf.facet.efacet.core.exception.DerivedTypedElementException; -import org.eclipse.emf.facet.efacet.core.query.IQueryImplementation; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.DerivedTypedElement; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.ParameterValue; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.extensible.Query; - -public class URIImageQueryEvaluator implements IQueryImplementation { - - public void setValue(final Query query, - final DerivedTypedElement feature, final EObject source, - final List<ParameterValue> parameterValues, - final Object newValue) throws DerivedTypedElementException { - throw new DerivedTypedElementException("Not implemented method"); //$NON-NLS-1$ - } - - public boolean isCheckResultType() { - return false; - } - - public Object getValue(final Query query, - final DerivedTypedElement feature, final EObject source, - final List<ParameterValue> parameterValues, - final IFacetManager facetManager) - throws DerivedTypedElementException { - // This cast is safe. The framework should only pass a query - // instance of URIImageQuery, because it has been declared in - // the method 'getManagedQueryType' that this query - // implementation is dedicated to the URIImageQuery type. - final String uri = ((URIImageQuery) query).getUri(); - return new URIImage(uri); - } - -}
diff --git a/org.eclipse.modisco.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/internal/view/CustomizationsCatalogView.java b/org.eclipse.modisco.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/internal/view/CustomizationsCatalogView.java deleted file mode 100644 index a976cf3..0000000 --- a/org.eclipse.modisco.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/internal/view/CustomizationsCatalogView.java +++ /dev/null
@@ -1,223 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009-2012 Mia-Software. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Nicolas Bros (Mia-Software) - initial API and implementation - * Nicolas Guyomar (Mia-Software) - Bug 333652 Extension point offering the possibility to declare an EPackage browser - * Nicolas Bros (Mia-Software) - Bug 372732 - [Facet] Rewrite the catalog views for 0.2 - * Nicolas Bros (Mia-Software) - Bug 372626 - Aggregates - * Gregoire Dupe (Mia-Software) - Bug 373078 - API Cleaning - *******************************************************************************/ -package org.eclipse.emf.facet.custom.ui.internal.view; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.List; - -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IExecutableExtensionFactory; -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.ecore.ENamedElement; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.EPackage; -import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl; -import org.eclipse.emf.facet.common.ui.internal.exported.views.IColumnDescription; -import org.eclipse.emf.facet.common.ui.internal.exported.views.IElementsViewFactory; -import org.eclipse.emf.facet.custom.core.ICustomizationCatalogManager; -import org.eclipse.emf.facet.custom.core.ICustomizationCatalogManagerFactory; -import org.eclipse.emf.facet.custom.core.internal.exported.CustomizationUtils; -import org.eclipse.emf.facet.custom.metamodel.v0_2_0.custom.Customization; -import org.eclipse.emf.facet.custom.ui.internal.ImageProvider; -import org.eclipse.emf.facet.custom.ui.internal.Messages; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.DocumentedElement; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.Facet; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.FacetSet; -import org.eclipse.jface.viewers.ColumnLabelProvider; -import org.eclipse.jface.viewers.IOpenListener; -import org.eclipse.jface.viewers.ITreeContentProvider; -import org.eclipse.jface.viewers.OpenEvent; -import org.eclipse.jface.viewers.Viewer; -import org.eclipse.swt.graphics.Image; - -public class CustomizationsCatalogView implements IExecutableExtensionFactory, IOpenListener { - - public Object create() throws CoreException { - this.customizationCatalogManager = ICustomizationCatalogManagerFactory.DEFAULT.getOrCreateCustomizationCatalogManager(new ResourceSetImpl()); - Collection<IColumnDescription> columnDescriptions = new ArrayList<IColumnDescription>(); - columnDescriptions.add(createNameColumnDescription()); - columnDescriptions.add(createExtendsColumnDescription()); - columnDescriptions.add(createDocumentationColumnDescription()); - return IElementsViewFactory.DEFAULT.createElementsView(columnDescriptions, getContentProvider(), getInput(), - Messages.CustomizationsCatalogView_title, ImageProvider.getInstance().getUiCustomIcon(), this); - } - - private static final String NAME_COLUMN = "CustomizationsView_NameColumn"; //$NON-NLS-1$ - private static final String EXTENDS_COLUMN = "CustomizationsView_ExtendsColumn"; //$NON-NLS-1$ - private static final String DOCUMENTATION_COLUMN = "CustomizationsView_DocumentationColumn"; //$NON-NLS-1$ - - private static final int NAME_COLUMN_WIDTH = 300; - private static final int EXTENDS_COLUMN_WIDTH = 300; - private static final int DOCUMENTATION_COLUMN_WIDTH = 400; - - private ICustomizationCatalogManager customizationCatalogManager; - - private static IColumnDescription createNameColumnDescription() { - ColumnLabelProvider columnLabelProvider = new ColumnLabelProvider() { - @Override - public String getText(final Object element) { - String result; - if (element instanceof ENamedElement) { - ENamedElement namedElement = (ENamedElement) element; - result = namedElement.getName(); - } else { - result = "<" + element.getClass().getName() + ">"; //$NON-NLS-1$//$NON-NLS-2$ - } - return result; - } - - @Override - public Image getImage(final Object element) { - return ImageProvider.getInstance().getUiCustomIcon(); - } - }; - return IElementsViewFactory.DEFAULT.createColumnDescription(Messages.CustomizationsView_nameColumn, CustomizationsCatalogView.NAME_COLUMN, - CustomizationsCatalogView.NAME_COLUMN_WIDTH, columnLabelProvider); - } - - private static IColumnDescription createExtendsColumnDescription() { - ColumnLabelProvider columnLabelProvider = new ColumnLabelProvider() { - @Override - public String getText(final Object element) { - String result = null; - if (element instanceof Customization) { - Customization customization = (Customization) element; - EPackage customizedEPackage = CustomizationUtils - .getCustomizedEPackage(customization); - if (customizedEPackage != null) { - result = customizedEPackage.getNsURI(); - } - } else if (element instanceof Facet) { - Facet facet = (Facet) element; - EClass extendedMetaclass = facet.getExtendedMetaclass(); - if (extendedMetaclass != null) { - result = extendedMetaclass.getName(); - } - } - return result; - } - }; - return IElementsViewFactory.DEFAULT.createColumnDescription(Messages.CustomizationsView_extendsColumn, - CustomizationsCatalogView.EXTENDS_COLUMN, - CustomizationsCatalogView.EXTENDS_COLUMN_WIDTH, columnLabelProvider); - } - - private static IColumnDescription createDocumentationColumnDescription() { - ColumnLabelProvider columnLabelProvider = new ColumnLabelProvider() { - @Override - public String getText(final Object element) { - String result = null; - if (element instanceof DocumentedElement) { - DocumentedElement documentedElement = (DocumentedElement) element; - result = documentedElement.getDocumentation(); - } - return result; - } - }; - return IElementsViewFactory.DEFAULT.createColumnDescription(Messages.CustomizationsView_documentationColumn, - CustomizationsCatalogView.DOCUMENTATION_COLUMN, CustomizationsCatalogView.DOCUMENTATION_COLUMN_WIDTH, - columnLabelProvider); - } - - protected static ITreeContentProvider getContentProvider() { - return new ITreeContentProvider() { - public Object[] getElements(final Object inputElement) { - @SuppressWarnings("unchecked") - final Collection<Customization> customizations = (Collection<Customization>) inputElement; - return customizations.toArray(); - } - - public void inputChanged(final Viewer viewer, final Object oldInput, - final Object newInput) { - // nothing - } - - public void dispose() { - // nothing - } - - public boolean hasChildren(final Object element) { - Object[] children = getChildren(element); - return children != null && children.length > 0; - } - - public Object getParent(final Object element) { - - Object result; - if (element instanceof EObject) { - EObject eObject = (EObject) element; - result = eObject.eContainer(); - } else { - result = null; - } - return result; - } - - public Object[] getChildren(final Object parentElement) { - Object[] result; - if (parentElement instanceof Customization) { - final Customization customization = (Customization) parentElement; - final List<Object> contents = new ArrayList<Object>(); - // Aggregate - for (final FacetSet facetSet : customization.getFacetSets()) { - if (facetSet instanceof Customization) { - final Customization childCustom = (Customization) facetSet; - contents.add(childCustom); - } - } - contents.addAll(customization.getEClassifiers()); - result = contents.toArray(); - } else { - result = new Object[0]; - } - return result; - } - }; - } - - protected Object getInput() { - return this.customizationCatalogManager.getRegisteredCustomizations(); - } - - public void open(final OpenEvent event) { - // TODO: re-enable once the customization editor is written - - // final MetamodelView metamodelView = (MetamodelView) element; - // // open customization in editor - // try { - // org.eclipse.emf.common.util.URI uri = org.eclipse.emf.common.util.URI - // .createURI(metamodelView.getLocation()); - // if (uri.isPlatformResource()) { - // IFile file = ResourcesPlugin.getWorkspace().getRoot().getFile( - // new Path(uri.toPlatformString(true))); - // FileEditorInput fileEditorInput = new FileEditorInput(file); - // IDE.openEditor( - // PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage(), - // fileEditorInput, Activator.CUSTOMIZATION_EDITOR_ID, true); - // } else { - // final URIEditorInput uriEditorInput = new URIEditorInput( - // org.eclipse.emf.common.util.URI.createURI(uri.toString())); - // IDE.openEditor( - // PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage(), - // uriEditorInput, Activator.CUSTOMIZATION_EDITOR_ID, true); - // } - // - // } catch (final Exception e) { - // Activator.logException(e); - // } - } - -}
diff --git a/org.eclipse.modisco.facet.custom.ui/src/org/eclipse/modisco/facet/custom/ui/CustomizedContentProviderUtils.java b/org.eclipse.modisco.facet.custom.ui/src/org/eclipse/modisco/facet/custom/ui/CustomizedContentProviderUtils.java new file mode 100644 index 0000000..9ea0ca0 --- /dev/null +++ b/org.eclipse.modisco.facet.custom.ui/src/org/eclipse/modisco/facet/custom/ui/CustomizedContentProviderUtils.java
@@ -0,0 +1,120 @@ +/******************************************************************************* + * Copyright (c) 2012, 2016 Mia-Software. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Nicolas Bros (Mia-Software) - Bug 379683 - customizable Tree content provider + * Nicolas Bros (Mia-Software) - Bug 380407 - Missing since tag on CustomizedContentProviderUtils + * Grégoire Dupé (Mia-Software) - Bug 506334 - Need to know which TreeElement has been updated + *******************************************************************************/ +package org.eclipse.modisco.facet.custom.ui; + +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; + +import org.eclipse.core.runtime.Assert; +import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.ecore.EStructuralFeature; +import org.eclipse.jface.viewers.ISelection; +import org.eclipse.jface.viewers.IStructuredSelection; +import org.eclipse.jface.viewers.StructuredSelection; +import org.eclipse.modisco.facet.custom.metamodel.v0_2_0.internal.treeproxy.EAttributeTreeElement; +import org.eclipse.modisco.facet.custom.metamodel.v0_2_0.internal.treeproxy.EObjectTreeElement; +import org.eclipse.modisco.facet.custom.metamodel.v0_2_0.internal.treeproxy.EReferenceTreeElement; +import org.eclipse.modisco.facet.custom.metamodel.v0_2_0.internal.treeproxy.TreeElement; + +/** + * A companion utility class for {@link ICustomizedTreeContentProvider} + * + * @since 0.2 + */ +public final class CustomizedContentProviderUtils { + private CustomizedContentProviderUtils() { + // utility class + } + + /** + * Replace proxy objects by their underlying model elements in the given selection + * + * @return the unwrapped version of the selection + */ + public static ISelection resolveSelection(final ISelection selection) { + Assert.isNotNull(selection); + ISelection result; + if (selection instanceof IStructuredSelection) { + final IStructuredSelection strSelection = (IStructuredSelection) selection; + final List<Object> resolvedElements = new ArrayList<Object>(); + final Iterator<?> iterator = strSelection.iterator(); + while (iterator.hasNext()) { + final Object element = iterator.next(); + resolvedElements.add(resolve(element)); + } + result = new StructuredSelection(resolvedElements); + } else { + throw new IllegalArgumentException("Unhandled selection type: " + selection.getClass().getName()); //$NON-NLS-1$ + } + return result; + } + + /** + * Resolve the given UI element into the underlying model element. + * + * @param element + * a UI element, that may be a proxy for a model element + * @return the corresponding model element, or the given element if it is not a proxy + */ + public static Object resolve(final Object element) { + Object resolved = element; + if (element instanceof EObjectTreeElement) { + resolved = ((EObjectTreeElement) element).getEObject(); + } else if (element instanceof EAttributeTreeElement) { + resolved = ((EAttributeTreeElement) element).getEAttribute(); + } else if (element instanceof EReferenceTreeElement) { + resolved = ((EReferenceTreeElement) element).getEReference(); + } + return resolved; + } + + /** + * @since 1.2 + */ + public static EStructuralFeature getEStructuralFeature(final Object treeElt) { + EStructuralFeature result = null; + if (treeElt instanceof EReferenceTreeElement) { + final EReferenceTreeElement refTreeElt = (EReferenceTreeElement) treeElt; + result = refTreeElt.getEReference(); + } + return result; + } + + /** + * @since 1.2 + */ + public static EObject getParentEObject(final Object object) { + Object supposedTreeElt = null; + if (!(object instanceof EObjectTreeElement) + && (object instanceof TreeElement)) { + final TreeElement treeElt = (TreeElement) object; + supposedTreeElt = treeElt.getParent(); + } else { + supposedTreeElt = object; + } + return getEObject(supposedTreeElt); + } + + /** + * @since 1.2 + */ + public static EObject getEObject(final Object object) { + EObject result = null; + if (object instanceof EObjectTreeElement) { + final EObjectTreeElement eObjTreeElt = (EObjectTreeElement) object; + result = eObjTreeElt.getEObject(); + } + return result; + } +}
diff --git a/org.eclipse.modisco.facet.custom.ui/src/org/eclipse/modisco/facet/custom/ui/IContentPropertiesHandler.java b/org.eclipse.modisco.facet.custom.ui/src/org/eclipse/modisco/facet/custom/ui/IContentPropertiesHandler.java new file mode 100644 index 0000000..c0d2123 --- /dev/null +++ b/org.eclipse.modisco.facet.custom.ui/src/org/eclipse/modisco/facet/custom/ui/IContentPropertiesHandler.java
@@ -0,0 +1,30 @@ +/** + * Copyright (c) 2012, 2014 Mia-Software. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Gregoire Dupe (Mia-Software) - Bug 369987 - [Restructuring][Table] Switch to the new customization and facet framework + * Gregoire Dupe (Mia-Software) - Bug 373078 - API Cleaning + * Gregoire Dupe (Mia-Software) - Bug 441570 - Children custom property + */ +package org.eclipse.modisco.facet.custom.ui; + +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.FacetOperation; + +/** + * + * @since 0.2 + * @noextend This interface is not intended to be extended by clients. + * @noimplement This interface is not intended to be implemented by clients. + */ +public interface IContentPropertiesHandler { + FacetOperation getIsVisible(); + /** + * @since 1.0 + */ + FacetOperation getChildren(); +}
diff --git a/org.eclipse.modisco.facet.custom.ui/src/org/eclipse/modisco/facet/custom/ui/IContentPropertiesHandlerFactory.java b/org.eclipse.modisco.facet.custom.ui/src/org/eclipse/modisco/facet/custom/ui/IContentPropertiesHandlerFactory.java new file mode 100644 index 0000000..3ffe0c2 --- /dev/null +++ b/org.eclipse.modisco.facet.custom.ui/src/org/eclipse/modisco/facet/custom/ui/IContentPropertiesHandlerFactory.java
@@ -0,0 +1,30 @@ +/** + * Copyright (c) 2012 Mia-Software. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Gregoire Dupe (Mia-Software) - Bug 369987 - [Restructuring][Table] Switch to the new customization and facet framework + * Gregoire Dupe (Mia-Software) - Bug 373078 - API Cleaning + */ +package org.eclipse.modisco.facet.custom.ui; + +import org.eclipse.modisco.facet.custom.core.ICustomizationManager; +import org.eclipse.modisco.facet.custom.ui.internal.PropertiesHandlerFactory; + +/** + * + * @since 0.2 + * @noextend This interface is not intended to be extended by clients. + * @noimplement This interface is not intended to be implemented by clients. + */ +public interface IContentPropertiesHandlerFactory { + + IContentPropertiesHandlerFactory DEFAULT = new PropertiesHandlerFactory(); + + IContentPropertiesHandler createIContentPropertiesHandler( + ICustomizationManager customizationMgr); +}
diff --git a/org.eclipse.modisco.facet.custom.ui/src/org/eclipse/modisco/facet/custom/ui/ICustomOverride.java b/org.eclipse.modisco.facet.custom.ui/src/org/eclipse/modisco/facet/custom/ui/ICustomOverride.java new file mode 100644 index 0000000..86c9f44 --- /dev/null +++ b/org.eclipse.modisco.facet.custom.ui/src/org/eclipse/modisco/facet/custom/ui/ICustomOverride.java
@@ -0,0 +1,31 @@ +/** + * Copyright (c) 2013 Soft-Maint. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * David Couvrand (Soft-Maint) - Bug 422058 - Implementation of strikethrough and underline in the CustomizedLabelProvider + */ +package org.eclipse.modisco.facet.custom.ui; + +import org.eclipse.modisco.facet.custom.core.ICustomizationManager; +import org.eclipse.modisco.facet.custom.core.exception.CustomizationException; +import org.eclipse.swt.graphics.FontData; + +/** + * @since 0.4 + */ +public interface ICustomOverride { + + String getText(String result, Object object, + ICustomizationManager customManager, + IFontPropertiesHandler propertiesHandler) throws CustomizationException; + + FontData getFont(FontData fontData, Object object, + ICustomizationManager customManager, + IFontPropertiesHandler propertiesHandler) throws CustomizationException; + +}
diff --git a/org.eclipse.modisco.facet.custom.ui/src/org/eclipse/modisco/facet/custom/ui/ICustomizationManagerProvider2.java b/org.eclipse.modisco.facet.custom.ui/src/org/eclipse/modisco/facet/custom/ui/ICustomizationManagerProvider2.java new file mode 100644 index 0000000..0104094 --- /dev/null +++ b/org.eclipse.modisco.facet.custom.ui/src/org/eclipse/modisco/facet/custom/ui/ICustomizationManagerProvider2.java
@@ -0,0 +1,35 @@ +/******************************************************************************* + * Copyright (c) 2015 Mia-Software + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Thomas Cicognani (Mia-Software) - Bug 472075 - Update API to create UI shortcuts to activate FacetSets + *******************************************************************************/ +package org.eclipse.modisco.facet.custom.ui; + +import java.util.List; + +import org.eclipse.jface.resource.ImageDescriptor; +import org.eclipse.modisco.facet.custom.core.ICustomizationManagerProvider; +import org.eclipse.modisco.facet.custom.metamodel.v0_2_0.custom.Customization; + +/** + * @since 1.1 + */ +public interface ICustomizationManagerProvider2 extends + ICustomizationManagerProvider { + + interface ICustomShortcut { + Customization getCustom(); + + String getLabel(); + + ImageDescriptor getIcon(); + } + + List<ICustomShortcut> getCustomShortcuts(); + +}
diff --git a/org.eclipse.modisco.facet.custom.ui/src/org/eclipse/modisco/facet/custom/ui/ICustomizedContentProviderFactory.java b/org.eclipse.modisco.facet.custom.ui/src/org/eclipse/modisco/facet/custom/ui/ICustomizedContentProviderFactory.java new file mode 100644 index 0000000..07e8569 --- /dev/null +++ b/org.eclipse.modisco.facet.custom.ui/src/org/eclipse/modisco/facet/custom/ui/ICustomizedContentProviderFactory.java
@@ -0,0 +1,59 @@ +/******************************************************************************* + * Copyright (c) 2011, 2016 Mia-Software. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Gregoire Dupe (Mia-Software) - Bug 361794 - [Restructuring] New customization meta-model + * Gregoire Dupe (Mia-Software) - Bug 373078 - API Cleaning + * Nicolas Bros (Mia-Software) - Bug 379683 - customizable Tree content provider + * Grégoire Dupé (Mia-Software) - Bug 506334 - Need to know which TreeElement has been updated + *******************************************************************************/ + +package org.eclipse.modisco.facet.custom.ui; + +import org.eclipse.jface.viewers.IContentProvider; +import org.eclipse.modisco.facet.custom.core.ICustomizationManager; +import org.eclipse.modisco.facet.custom.ui.internal.CustomizedContentProviderFactory; + +/** + * This is a factory for {@link ICustomizedContentProvider} and {@link ICustomizedTreeContentProvider}. + * + * @author Gregoire Dupe + * @noextend This interface is not intended to be extended by clients. + * @noimplement This interface is not intended to be implemented by clients. + * + */ +public interface ICustomizedContentProviderFactory { + /** + * The default factory instance + */ + ICustomizedContentProviderFactory DEFAULT = new CustomizedContentProviderFactory(); + + /** + * Instantiate an {@link ICustomizedTreeContentProvider}. With this content provider, your viewer's input has to be + * an EObject or an array or collection of EObjects.F + * + * @param customManager + * the customization manager used by the content provider + * @return a tree content provider + * @since 0.2 + */ + ICustomizedTreeContentProvider createCustomizedTreeContentProvider(ICustomizationManager customManager); + + /** + * @since 1.2 + */ + IContentProvider createCustomizedTreeContentProvider( + ICustomizationManager customManager, IContentListener iContentUpdate); + + /** + * @since 1.2 + * @noextend This interface is not intended to be extended by clients. + */ + interface IContentListener { + void onUpdate(Object object); + } +}
diff --git a/org.eclipse.modisco.facet.custom.ui/src/org/eclipse/modisco/facet/custom/ui/ICustomizedLabelProvider.java b/org.eclipse.modisco.facet.custom.ui/src/org/eclipse/modisco/facet/custom/ui/ICustomizedLabelProvider.java new file mode 100644 index 0000000..b788ba6 --- /dev/null +++ b/org.eclipse.modisco.facet.custom.ui/src/org/eclipse/modisco/facet/custom/ui/ICustomizedLabelProvider.java
@@ -0,0 +1,72 @@ +/** + * Copyright (c) 2011, 2017 Mia-Software. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Gregoire Dupe (Mia-Software) - Bug 361794 - [Restructuring] New customization meta-model + * Gregoire Dupe (Mia-Software) - Bug 369987 - [Restructuring][Table] Switch to the new customization and facet framework + * Vincent Lorenzo (CEA-LIST) - Bug 372644 - Create Customizable tooltips for the TreeViewer using a CustomizableLabelProvider + * Gregoire Dupe (Mia-Software) - Bug 373078 - API Cleaning + * Thomas Cicognani (Mia-Software) - Bug 513070 - NatTable and customization: cannot change background from columns + */ +package org.eclipse.modisco.facet.custom.ui; + +import org.eclipse.emf.ecore.ETypedElement; +import org.eclipse.jface.viewers.IColorProvider; +import org.eclipse.jface.viewers.IFontProvider; +import org.eclipse.jface.viewers.ILabelProvider; +import org.eclipse.modisco.facet.custom.core.ICustomizationManager; +import org.eclipse.swt.graphics.Color; +import org.eclipse.swt.graphics.Image; + +/** + * This interface allows to use a {@link ILabelProvider}, an + * {@link IColorProvider} and an {@link IFontProvider} which is implemented and + * customizable using the EMF Facet customization mechanism. + * + * @author Gregoire Dupe + * @noextend This interface is not intended to be extended by clients. + * @noimplement This interface is not intended to be implemented by clients. + */ +public interface ICustomizedLabelProvider extends ILabelProvider, + IColorProvider, IFontProvider , ICustomizedToolTipLabelProvider { + /** + * This method returns the customization manager used by the label provider. The + * customization stack updates have to be done using this + * {@link ICustomizationManager}. + * + * @return the customization manager used by the content provider. + */ + ICustomizationManager getCustomizationManager(); + + boolean isUnderlined(Object element, ETypedElement eTypedElement); + + boolean isStruckthrough(Object element, ETypedElement eTypedElement); + + Image getTopLeftOverlay(Object element, ETypedElement eTypedElement); + Image getTopMiddleOverlay(Object element, ETypedElement eTypedElement); + Image getTopRightOverlay(Object element, ETypedElement eTypedElement); + + Image getBottomLeftOverlay(Object element, ETypedElement eTypedElement); + Image getBottomMiddleOverlay(Object element, ETypedElement eTypedElement); + Image getBottomRightOverlay(Object element, ETypedElement eTypedElement); + + String getText(Object element, ETypedElement eTypedElement); + + Image getImage(Object element, ETypedElement eTypedElement); + + /** + * @since 0.2 + */ + ICustomizedLabelProvider cloneLabelProvider(); + + /** + * @since 1.2 + */ + Color getBackground(Object element, ETypedElement eTypedElement); + +}
diff --git a/org.eclipse.modisco.facet.custom.ui/src/org/eclipse/modisco/facet/custom/ui/ICustomizedLabelProviderFactory.java b/org.eclipse.modisco.facet.custom.ui/src/org/eclipse/modisco/facet/custom/ui/ICustomizedLabelProviderFactory.java new file mode 100644 index 0000000..b1be4b7 --- /dev/null +++ b/org.eclipse.modisco.facet.custom.ui/src/org/eclipse/modisco/facet/custom/ui/ICustomizedLabelProviderFactory.java
@@ -0,0 +1,39 @@ +/** + * Copyright (c) 2011 Mia-Software. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Gregoire Dupe (Mia-Software) - Bug 361794 - [Restructuring] New customization meta-model + * Gregoire Dupe (Mia-Software) - Bug 373078 - API Cleaning + */ +package org.eclipse.modisco.facet.custom.ui; + +import org.eclipse.modisco.facet.custom.core.ICustomizationManager; +import org.eclipse.modisco.facet.custom.ui.internal.CustomizedLabelProviderFactory; + +/** + * This class is the factory allowing to get a instance of + * {@link ICustomizedLabelProvider}. + * + * @author Gregoire Dupe + * @noextend This interface is not intended to be extended by clients. + * @noimplement This interface is not intended to be implemented by clients. + */ +public interface ICustomizedLabelProviderFactory { + ICustomizedLabelProviderFactory DEFAULT = new CustomizedLabelProviderFactory(); + + /** + * This method is used to instantiate a {@link ICustomizedLabelProvider}. + * + * @param customizationManager + * the customization manager which has to used by the content + * provider. + * @return a label provider + */ + ICustomizedLabelProvider createCustomizedLabelProvider( + ICustomizationManager customizationMgr); +}
diff --git a/org.eclipse.modisco.facet.custom.ui/src/org/eclipse/modisco/facet/custom/ui/ICustomizedToolTipLabelProvider.java b/org.eclipse.modisco.facet.custom.ui/src/org/eclipse/modisco/facet/custom/ui/ICustomizedToolTipLabelProvider.java new file mode 100644 index 0000000..96711f5 --- /dev/null +++ b/org.eclipse.modisco.facet.custom.ui/src/org/eclipse/modisco/facet/custom/ui/ICustomizedToolTipLabelProvider.java
@@ -0,0 +1,68 @@ +/** + * Copyright (c) 2012 CEA LIST. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Vincent Lorenzo (CEA-LIST) - Bug 372644 - Create Customizable tooltips for the TreeViewer using a CustomizableLabelProvider + * Gregoire Dupe (Mia-Software) - Bug 373078 - API Cleaning + */ +package org.eclipse.modisco.facet.custom.ui; + +import org.eclipse.emf.ecore.ETypedElement; +import org.eclipse.jface.viewers.ViewerCell; +import org.eclipse.swt.graphics.Color; +import org.eclipse.swt.graphics.Font; +import org.eclipse.swt.graphics.Image; + +/** + * + * This interface provides methods to customize tooltips + * + * @noextend This interface is not intended to be extended by clients. + * @noimplement This interface is not intended to be implemented by clients. + */ +public interface ICustomizedToolTipLabelProvider { + + void update(ViewerCell cell); + + String getToolTipText(Object element, ETypedElement eTypedElement); + + Image getToolTipImage(Object element, ETypedElement eTypedElement); + + Font getToolTipFont(Object element, ETypedElement eTypedElement); + + Color getToolTipBackgroundColor(Object element, ETypedElement eTypedElement); + + Color getToolTipForegroundColor(Object element, ETypedElement eTypedElement); + + Image getToolTipTopLeftOverlay(Object element, ETypedElement eTypedElement); + + Image getToolTipTopMiddleOverlay(Object element, ETypedElement eTypedElement); + + Image getToolTipTopRightOverlay(Object element, ETypedElement eTypedElement); + + Image getToolTipBottomLeftOverlay(Object element, + ETypedElement eTypedElement); + + Image getToolTipBottomMiddleOverlay(Object element, + ETypedElement eTypedElement); + + Image getToolTipBottomRightOverlay(Object element, + ETypedElement eTypedElement); + + int getToolTipTimeDisplayed(Object element, ETypedElement eTypedElement); + + int getToolTipDisplayDelayTime(Object element, ETypedElement eTypedElement); + + /** + * The style can be : SWT.LEFT, SWT.CENTER, SWT.RIGHT, SWT.SHADOW_IN, SWT.SHADOW_OUT, SWT.SHADOW_NONE. + * + * @param element + * @return + */ + int getToolTipStyle(Object element, ETypedElement eTypedElement); +}
diff --git a/org.eclipse.modisco.facet.custom.ui/src/org/eclipse/modisco/facet/custom/ui/ICustomizedTreeContentProvider.java b/org.eclipse.modisco.facet.custom.ui/src/org/eclipse/modisco/facet/custom/ui/ICustomizedTreeContentProvider.java new file mode 100644 index 0000000..d1999f1 --- /dev/null +++ b/org.eclipse.modisco.facet.custom.ui/src/org/eclipse/modisco/facet/custom/ui/ICustomizedTreeContentProvider.java
@@ -0,0 +1,31 @@ +/******************************************************************************* + * Copyright (c) 2012 Mia-Software. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Nicolas Bros (Mia-Software) - Bug 379683 - customizable Tree content provider + *******************************************************************************/ +package org.eclipse.modisco.facet.custom.ui; + +import org.eclipse.jface.viewers.ITreeContentProvider; +import org.eclipse.modisco.facet.custom.core.ICustomizationManager; + +/** + * An {@link ITreeContentProvider} which is implemented and customizable using the EMF Facet customization mechanisms. + * + * @noextend This interface is not intended to be extended by clients. + * @noimplement This interface is not intended to be implemented by clients. + * @since 0.2 + */ +public interface ICustomizedTreeContentProvider extends ITreeContentProvider { + /** + * This method returns the customization manager used by the content provider. Updates to the list of loaded + * customizations have to be done using the {@link ICustomizationManager} returned by this method. + * + * @return the customization manager used by this content provider. + */ + ICustomizationManager getCustomizationManager(); +}
diff --git a/org.eclipse.modisco.facet.custom.ui/src/org/eclipse/modisco/facet/custom/ui/IFontPropertiesHandler.java b/org.eclipse.modisco.facet.custom.ui/src/org/eclipse/modisco/facet/custom/ui/IFontPropertiesHandler.java new file mode 100644 index 0000000..1e52714 --- /dev/null +++ b/org.eclipse.modisco.facet.custom.ui/src/org/eclipse/modisco/facet/custom/ui/IFontPropertiesHandler.java
@@ -0,0 +1,40 @@ +/** + * Copyright (c) 2013 Soft-Maint. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * David Couvrand (Soft-Maint) - Bug 422058 - Implementation of strikethrough and underline in the CustomizedLabelProvider + */ +package org.eclipse.modisco.facet.custom.ui; + +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.FacetOperation; + +/** + * @since 0.4 + * @noimplement This interface is not intended to be implemented by clients. + * @noextend This interface is not intended to be extended by clients. + */ +public interface IFontPropertiesHandler { + + FacetOperation getBackgroundProperty(); + + FacetOperation getForegroundProperty(); + + FacetOperation getFontNameProperty(); + + FacetOperation getFontSizeProperty(); + + FacetOperation getIsBoldProperty(); + + FacetOperation getIsItalicProperty(); + + FacetOperation getIsVisible(); + + FacetOperation getIsUnderlinedProperty(); + + FacetOperation getIsStruckthroughProperty(); +}
diff --git a/org.eclipse.modisco.facet.custom.ui/src/org/eclipse/modisco/facet/custom/ui/IResolvingCustomizedLabelProviderFactory.java b/org.eclipse.modisco.facet.custom.ui/src/org/eclipse/modisco/facet/custom/ui/IResolvingCustomizedLabelProviderFactory.java new file mode 100644 index 0000000..cd7eea2 --- /dev/null +++ b/org.eclipse.modisco.facet.custom.ui/src/org/eclipse/modisco/facet/custom/ui/IResolvingCustomizedLabelProviderFactory.java
@@ -0,0 +1,35 @@ +/******************************************************************************* + * Copyright (c) 2012 Mia-Software. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Nicolas Bros (Mia-Software) - Bug 379683 - customizable Tree content provider + *******************************************************************************/ +package org.eclipse.modisco.facet.custom.ui; + +import org.eclipse.modisco.facet.custom.core.ICustomizationManager; +import org.eclipse.modisco.facet.custom.ui.internal.ResolvingCustomizedLabelProviderFactory; + +/** + * A factory to create instances of {@link ICustomizedLabelProvider} that work on proxy UI elements, by customizing the + * resolved elements. + * + * @noextend This interface is not intended to be extended by clients. + * @noimplement This interface is not intended to be implemented by clients. + * @since 0.2 + */ +public interface IResolvingCustomizedLabelProviderFactory { + IResolvingCustomizedLabelProviderFactory DEFAULT = new ResolvingCustomizedLabelProviderFactory(); + + /** + * This method is used to instantiate a {@link ICustomizedLabelProvider}. + * + * @param customizationManager + * the customization manager which has to used by the content provider. + * @return a label provider + */ + ICustomizedLabelProvider createCustomizedLabelProvider(ICustomizationManager customizationMgr); +}
diff --git a/org.eclipse.modisco.facet.custom.ui/src/org/eclipse/modisco/facet/custom/ui/ISelectionPropertiesHandler.java b/org.eclipse.modisco.facet.custom.ui/src/org/eclipse/modisco/facet/custom/ui/ISelectionPropertiesHandler.java new file mode 100644 index 0000000..005ef07 --- /dev/null +++ b/org.eclipse.modisco.facet.custom.ui/src/org/eclipse/modisco/facet/custom/ui/ISelectionPropertiesHandler.java
@@ -0,0 +1,24 @@ +/******************************************************************************* + * Copyright (c) 2012 Mia-Software. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Nicolas Bros (Mia-Software) - Bug 377866 - selection customization + *******************************************************************************/ +package org.eclipse.modisco.facet.custom.ui; + +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.FacetOperation; + +/** + * + * @since 0.2 + * @noextend This interface is not intended to be extended by clients. + * @noimplement This interface is not intended to be implemented by clients. + */ +public interface ISelectionPropertiesHandler { + /** This customization property returns the selection for a given source EObject and a given ETypedElement parameter */ + FacetOperation getSelectionProperty(); +}
diff --git a/org.eclipse.modisco.facet.custom.ui/src/org/eclipse/modisco/facet/custom/ui/ISelectionPropertiesHandlerFactory.java b/org.eclipse.modisco.facet.custom.ui/src/org/eclipse/modisco/facet/custom/ui/ISelectionPropertiesHandlerFactory.java new file mode 100644 index 0000000..6336646 --- /dev/null +++ b/org.eclipse.modisco.facet.custom.ui/src/org/eclipse/modisco/facet/custom/ui/ISelectionPropertiesHandlerFactory.java
@@ -0,0 +1,29 @@ +/******************************************************************************* + * Copyright (c) 2012 Mia-Software. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Nicolas Bros (Mia-Software) - Bug 377866 - selection customization + *******************************************************************************/ +package org.eclipse.modisco.facet.custom.ui; + +import org.eclipse.modisco.facet.custom.core.ICustomizationManager; +import org.eclipse.modisco.facet.custom.ui.internal.PropertiesHandlerFactory; + +/** + * Factory for {@link ISelectionPropertiesHandler} + * + * @since 0.2 + * @noextend This interface is not intended to be extended by clients. + * @noimplement This interface is not intended to be implemented by clients. + */ +public interface ISelectionPropertiesHandlerFactory { + + ISelectionPropertiesHandlerFactory DEFAULT = new PropertiesHandlerFactory(); + + ISelectionPropertiesHandler createSelectionPropertiesHandler( + ICustomizationManager customManager); +}
diff --git a/org.eclipse.modisco.facet.custom.ui/src/org/eclipse/modisco/facet/custom/ui/ImageUtils.java b/org.eclipse.modisco.facet.custom.ui/src/org/eclipse/modisco/facet/custom/ui/ImageUtils.java new file mode 100644 index 0000000..a252b25 --- /dev/null +++ b/org.eclipse.modisco.facet.custom.ui/src/org/eclipse/modisco/facet/custom/ui/ImageUtils.java
@@ -0,0 +1,57 @@ +/******************************************************************************* + * Copyright (c) 2012 CEA LIST. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Gregoire Dupe (Mia-Software) - Bug 374941 - To be able to customize overlay icons on EClass + * Nicolas Bros (Mia-Software) - Bug 375388 - Cell editor for IImage + * Nicolas Rault (Soft-Maint) - Bug 412565 - Need an URIImage Constructor + *******************************************************************************/ +package org.eclipse.modisco.facet.custom.ui; + +import org.eclipse.modisco.facet.custom.metamodel.custompt.IImage; +import org.eclipse.modisco.facet.custom.ui.internal.custompt.ImageWrapper; +import org.eclipse.modisco.facet.custom.ui.internal.custompt.URIImage; +import org.eclipse.swt.graphics.Image; + +/** + * @since 0.2 + */ +public final class ImageUtils { + + private ImageUtils() { + // Must not be used + } + + /** Creates an {@link IImage} that wraps the given SWT {@link Image} */ + public static IImage wrap(final Image image) { + return new ImageWrapper(image); + } + + /** + * Returns the SWT {@link Image} represented by this {@link IImage} + * + * @param image + * the image to unwrap + * @return the SWT image, or <code>null</code> if the {@link IImage} doesn't wrap a SWT image + */ + public static Image unwrap(final IImage image) { + Image result = null; + if (image instanceof ImageWrapper) { + final ImageWrapper imageWrapper = (ImageWrapper) image; + result = imageWrapper.getImage(); + } + return result; + } + + /** + * Creates an {@link IImage} that wraps the given uri + * @since 0.4 + */ + public static IImage wrap(final String uri) { + return new URIImage(uri); + } +}
diff --git a/org.eclipse.modisco.facet.custom.ui/src/org/eclipse/modisco/facet/custom/ui/LoadCustomShortcutsMenuUtils.java b/org.eclipse.modisco.facet.custom.ui/src/org/eclipse/modisco/facet/custom/ui/LoadCustomShortcutsMenuUtils.java new file mode 100644 index 0000000..626e9e5 --- /dev/null +++ b/org.eclipse.modisco.facet.custom.ui/src/org/eclipse/modisco/facet/custom/ui/LoadCustomShortcutsMenuUtils.java
@@ -0,0 +1,78 @@ +/******************************************************************************* + * Copyright (c) 2015 Mia-Software + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Thomas Cicognani (Mia-Software) - Bug 472075 - Update API to create UI shortcuts to activate FacetSets + * Grégoire Dupé (Mia-Software) - Bug 472075 - Update API to create UI shortcuts to activate FacetSets + *******************************************************************************/ +package org.eclipse.modisco.facet.custom.ui; + +import java.util.ArrayList; +import java.util.List; + +import org.eclipse.jface.action.Action; +import org.eclipse.jface.action.ActionContributionItem; +import org.eclipse.jface.action.IContributionItem; +import org.eclipse.modisco.facet.custom.core.ICustomizationManager; +import org.eclipse.modisco.facet.custom.metamodel.v0_2_0.custom.Customization; +import org.eclipse.modisco.facet.custom.ui.ICustomizationManagerProvider2.ICustomShortcut; +import org.eclipse.modisco.facet.custom.ui.internal.action.ShortcutCustomAction; +import org.eclipse.modisco.facet.efacet.ui.LoadFacetSetShortcutsMenuUtils; + +/** + * @since 1.1 + * @noinstantiate This class is not intended to be instantiated by clients. + */ +public final class LoadCustomShortcutsMenuUtils { + + private LoadCustomShortcutsMenuUtils() { + // NOT TO BE USED + } + + public static IContributionItem[] getCustomItemsFromCurrentPart() { + final ICustomizationManagerProvider2 customMgrPrv = LoadFacetSetShortcutsMenuUtils + .getProviderFromCurrentPart(ICustomizationManagerProvider2.class); + return getCustomItems(customMgrPrv); + } + + public static IContributionItem[] getCustomItemsFromCurrentEditor() { + final ICustomizationManagerProvider2 customMgrPrv = LoadFacetSetShortcutsMenuUtils + .getProviderFromCurrentEditor(ICustomizationManagerProvider2.class); + return getCustomItems(customMgrPrv); + } + + private static IContributionItem[] getCustomItems( + final ICustomizationManagerProvider2 customMgrPrv) { + final List<IContributionItem> menuList = new ArrayList<IContributionItem>(); + if (customMgrPrv != null) { + final List<ICustomShortcut> shortcuts = customMgrPrv + .getCustomShortcuts(); + final ICustomizationManager customManager = customMgrPrv + .getCustomizationManager(); + for (ICustomShortcut shortcut : shortcuts) { + final ActionContributionItem action = createCustomMenuItem( + shortcut, customManager); + menuList.add(action); + } + } + return menuList.toArray(new IContributionItem[menuList.size()]); + } + + private static ActionContributionItem createCustomMenuItem( + final ICustomShortcut shortcut, + final ICustomizationManager customManager) { + final Customization custom = shortcut.getCustom(); + final String customId = custom.getName(); + final Action action = new ShortcutCustomAction(customId, + shortcut.getLabel(), shortcut.getIcon(), customManager); + final List<Customization> activeCustoms = customManager + .getManagedCustomizations(); + return LoadFacetSetShortcutsMenuUtils.createMenuItem(customId, + activeCustoms, action); + } + +}
diff --git a/org.eclipse.modisco.facet.custom.ui/src/org/eclipse/modisco/facet/custom/ui/internal/Activator.java b/org.eclipse.modisco.facet.custom.ui/src/org/eclipse/modisco/facet/custom/ui/internal/Activator.java new file mode 100644 index 0000000..3ff39fc --- /dev/null +++ b/org.eclipse.modisco.facet.custom.ui/src/org/eclipse/modisco/facet/custom/ui/internal/Activator.java
@@ -0,0 +1,63 @@ +/** + * Copyright (c) 2011 Mia-Software. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Gregoire Dupe (Mia-Software) - Bug 361794 - [Restructuring] New customization meta-model + */ +package org.eclipse.modisco.facet.custom.ui.internal; + +import org.eclipse.ui.plugin.AbstractUIPlugin; +import org.osgi.framework.BundleContext; + +/** + * The activator class controls the plug-in life cycle + */ +public class Activator extends AbstractUIPlugin { + + // The plug-in ID + public static final String PLUGIN_ID = "org.eclipse.emf.facet.custom.ui"; //$NON-NLS-1$ + + // The shared instance + private static Activator plugin; + + /** + * The constructor + */ + public Activator() { + } + + /* + * (non-Javadoc) + * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext) + */ + @Override + public void start(final BundleContext context) throws Exception { + super.start(context); + Activator.plugin = this; + } + + /* + * (non-Javadoc) + * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext) + */ + @Override + public void stop(final BundleContext context) throws Exception { + Activator.plugin = null; + super.stop(context); + } + + /** + * Returns the shared instance + * + * @return the shared instance + */ + public static Activator getDefault() { + return Activator.plugin; + } + +}
diff --git a/org.eclipse.modisco.facet.custom.ui/src/org/eclipse/modisco/facet/custom/ui/internal/CustomizationCommandFactory.java b/org.eclipse.modisco.facet.custom.ui/src/org/eclipse/modisco/facet/custom/ui/internal/CustomizationCommandFactory.java new file mode 100644 index 0000000..9958f6a --- /dev/null +++ b/org.eclipse.modisco.facet.custom.ui/src/org/eclipse/modisco/facet/custom/ui/internal/CustomizationCommandFactory.java
@@ -0,0 +1,247 @@ +/** + * Copyright (c) 2012 Mia-Software. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Gregoire Dupe (Mia-Software) - Bug 369987 - [Restructuring][Table] Switch to the new customization and facet framework + * Gregoire Dupe (Mia-Software) - Bug 373078 - API Cleaning + * Nicolas Bros (Mia-Software) - Bug 378271 - [Table] Select Columns To Hide is broken + */ +package org.eclipse.modisco.facet.custom.ui.internal; + +import org.eclipse.emf.common.command.Command; +import org.eclipse.emf.common.command.CompoundCommand; +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.EParameter; +import org.eclipse.emf.ecore.ETypedElement; +import org.eclipse.emf.ecore.EcoreFactory; +import org.eclipse.emf.ecore.EcorePackage; +import org.eclipse.emf.edit.domain.EditingDomain; +import org.eclipse.modisco.facet.custom.metamodel.v0_2_0.custom.CustomFactory; +import org.eclipse.modisco.facet.custom.metamodel.v0_2_0.custom.CustomPackage; +import org.eclipse.modisco.facet.custom.metamodel.v0_2_0.custom.Customization; +import org.eclipse.modisco.facet.custom.metamodel.v0_2_0.custom.EClassCustomization; +import org.eclipse.modisco.facet.custom.metamodel.v0_2_0.custom.ETypedElementCase; +import org.eclipse.modisco.facet.custom.metamodel.v0_2_0.custom.ETypedElementSwitchQuery; +import org.eclipse.modisco.facet.custom.metamodel.v0_2_0.custom.FacetCustomization; +import org.eclipse.modisco.facet.custom.ui.internal.exception.CustomizationEditRuntimeException; +import org.eclipse.modisco.facet.custom.ui.internal.exported.ICustomizationCommandFactory; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.EFacetFactory; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.EFacetPackage; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.Facet; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.FacetAttribute; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.FacetOperation; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.extensible.Query; +import org.eclipse.modisco.facet.util.emf.core.command.ICommandFactoryResult; +import org.eclipse.modisco.facet.util.emf.core.command.ICommandFactoryResultFactory; +import org.eclipse.modisco.facet.util.emf.core.internal.exported.ICommandFactory; + +public class CustomizationCommandFactory implements ICustomizationCommandFactory { + + private static final String CONFORM_ATT_NAME = "isConforming"; //$NON-NLS-1$ + private final EditingDomain editingDomain; + private final ICommandFactory commandFactory; + + public CustomizationCommandFactory(final EditingDomain editingDomain, final ICommandFactory commandFactory) { + this.editingDomain = editingDomain; + this.commandFactory = commandFactory; + } + + public ICommandFactoryResult<EClassCustomization> createEClassCustomization( + final Customization customization, final EClass customedEClass, + final Query conformanceQuery) { + final EClassCustomization eClassCustom = CustomFactory.eINSTANCE.createEClassCustomization(); + final CompoundCommand resultCmd = new CompoundCommand( + "Create one instance of EClassCustomization for " + customedEClass.getName()); //$NON-NLS-1$ + final Command linkToContainer = this.commandFactory + .createAddCommand( + this.editingDomain, + customization, + EcorePackage.eINSTANCE + .getEPackage_EClassifiers(), + eClassCustom); + resultCmd.append(linkToContainer); + final Command linkToEClass = this.commandFactory + .createSetCommand( + this.editingDomain, + eClassCustom, + EFacetPackage.eINSTANCE + .getFacet_ExtendedMetaclass(), + customedEClass); + resultCmd.append(linkToEClass); + if (conformanceQuery != null) { + final ICommandFactoryResult<FacetAttribute> attResult = createConformanceOperation(eClassCustom, conformanceQuery); + resultCmd.append(attResult.getCommand()); + } + + return ICommandFactoryResultFactory.DEFAULT.createCommandFactoryResult(resultCmd, eClassCustom); + } + + //TODO Move to FacetCommandFactory + private ICommandFactoryResult<FacetAttribute> createConformanceOperation(final Facet facet, final Query query) { + final CompoundCommand resultCmd = new CompoundCommand("Creates a facet conformance attribute"); //$NON-NLS-1$ + final FacetAttribute conformanceAtt = EFacetFactory.eINSTANCE.createFacetAttribute(); + conformanceAtt.setName(CustomizationCommandFactory.CONFORM_ATT_NAME); + conformanceAtt.setEType(EcorePackage.eINSTANCE.getEBoolean()); + conformanceAtt.setQuery(query); + conformanceAtt.setDerived(true); + + final Command conformance = this.commandFactory.createSetCommand(this.editingDomain, facet, EFacetPackage.eINSTANCE.getFacet_ConformanceTypedElement(), conformanceAtt); + resultCmd.append(conformance); + final Command addToFacet = this.commandFactory.createAddCommand(this.editingDomain, facet, EFacetPackage.eINSTANCE.getFacet_FacetElements(), conformanceAtt); + resultCmd.append(addToFacet); + return ICommandFactoryResultFactory.DEFAULT.createCommandFactoryResult(resultCmd, conformanceAtt); + } + + public ICommandFactoryResult<FacetCustomization> createFacetCustomization( + final Customization customization, final Facet customizedFacet) { + final FacetCustomization eFacetCustom = CustomFactory.eINSTANCE.createFacetCustomization(); + final CompoundCommand resultCmd = new CompoundCommand( + "Create one instance of FacetCustomization for " + customizedFacet.getName()); //$NON-NLS-1$ + final Command linkToContainer = this.commandFactory + .createAddCommand(this.editingDomain, customization, + EcorePackage.eINSTANCE.getEPackage_EClassifiers(), + eFacetCustom); + resultCmd.append(linkToContainer); + final Command linkToFacet = this.commandFactory + .createAddCommand( + this.editingDomain, + customization, + CustomPackage.eINSTANCE + .getFacetCustomization_CustomizedFacet(), + customizedFacet); + resultCmd.append(linkToFacet); + return ICommandFactoryResultFactory.DEFAULT.createCommandFactoryResult(resultCmd, eFacetCustom); + } + + public ICommandFactoryResult<Facet> setPropertyConfig( + final Facet typeCustomization, + final ETypedElement customizedTElt, // customized typed element + final FacetOperation customProperty, final Query query) { + final CompoundCommand resultCmd = new CompoundCommand( + "Set the value of the customization property '" + customProperty.getName() + "'"); //$NON-NLS-1$ //$NON-NLS-2$ + FacetOperation fOpToModifiy = null; // Facet operation to modify + for (FacetOperation facetOperation : typeCustomization + .getFacetOperations()) { + if (facetOperation.getOverride().equals(customProperty)) { + fOpToModifiy = facetOperation; + } + } + if (fOpToModifiy == null) { + createPropertySetting(typeCustomization, customizedTElt, + customProperty, query, resultCmd); + } else { + final Query fOpQuery = fOpToModifiy.getQuery(); + if (fOpQuery instanceof ETypedElementSwitchQuery) { + final ETypedElementSwitchQuery switchQuery = (ETypedElementSwitchQuery) fOpQuery; + final Command setCase = setOrCreateETypedElementCase(switchQuery, customizedTElt, query); + resultCmd.append(setCase); + } else { + throw new CustomizationEditRuntimeException(); + } + } + return ICommandFactoryResultFactory.DEFAULT.createCommandFactoryResult(resultCmd, typeCustomization); + } + + private void createPropertySetting( + final Facet typeCustomization, + final ETypedElement customizedTElt, + final FacetOperation customProperty, final Query query, + final CompoundCommand resultCmd) { + FacetOperation facetOperation = EFacetFactory.eINSTANCE.createFacetOperation(); + // link the instance of FacetOperation to its parent + final Command linkFOpToParent = this.commandFactory.createAddCommand( + this.editingDomain, typeCustomization, + EFacetPackage.eINSTANCE.getFacet_FacetOperations(), + facetOperation); + resultCmd.append(linkFOpToParent); + // Link the instance of FacetOperation to the overridden custom property operation. + final Command linkToOverride = this.commandFactory.createSetCommand( + this.editingDomain, facetOperation, + EFacetPackage.eINSTANCE.getDerivedTypedElement_Override(), + customProperty); + resultCmd.append(linkToOverride); + facetOperation.setName(customProperty.getName()); + facetOperation.setEType(customProperty.getEType()); + facetOperation.setLowerBound(customProperty.getLowerBound()); + facetOperation.setUpperBound(customProperty.getUpperBound()); + + // add the "eStructuralFeature" EParameter that every customization operation must have + final EParameter eParameter = EcoreFactory.eINSTANCE.createEParameter(); + eParameter.setName("eStructuralFeature"); //$NON-NLS-1$ + eParameter.setEType(EcorePackage.eINSTANCE.getETypedElement()); + facetOperation.getEParameters().add(eParameter); + + final ETypedElementSwitchQuery switchQuery = CustomFactory.eINSTANCE.createETypedElementSwitchQuery(); + // Link the instance of ETypedElementSwitchQuery to its parent + final Command switchToParent = this.commandFactory + .createSetCommand(this.editingDomain, facetOperation, + EFacetPackage.eINSTANCE + .getDerivedTypedElement_Query(), + switchQuery); + resultCmd.append(switchToParent); + final Command setCase = setOrCreateETypedElementCase(switchQuery, customizedTElt, query); + resultCmd.append(setCase); + } + + private Command setOrCreateETypedElementCase( + final ETypedElementSwitchQuery switchQuery, + final ETypedElement customizedTElt, final Query query) { + final CompoundCommand resultCmd = new CompoundCommand("Set or create an instance of ETypedElementCase"); //$NON-NLS-1$ + ETypedElementCase caseToModify = getCaseByETypedElement(switchQuery, customizedTElt); + if (caseToModify == null) { + caseToModify = CustomFactory.eINSTANCE.createETypedElementCase(); + final Command linkToParent = this.commandFactory.createAddCommand( + this.editingDomain, switchQuery, + CustomPackage.eINSTANCE.getETypedElementSwitchQuery_Cases(), + caseToModify); + resultCmd.append(linkToParent); + } + final Command setCase = this.commandFactory.createSetCommand( + this.editingDomain, caseToModify, + CustomPackage.eINSTANCE.getETypedElementCase_Case(), + customizedTElt); + resultCmd.append(setCase); + final Command setQuery = this.commandFactory.createSetCommand( + this.editingDomain, caseToModify, + CustomPackage.eINSTANCE.getETypedElementCase_Value(), + query); + resultCmd.append(setQuery); + return resultCmd; + } + + private static ETypedElementCase getCaseByETypedElement( + final ETypedElementSwitchQuery switchQuery, + final ETypedElement customizedTElt) { + ETypedElementCase caseToModify = null; + for (ETypedElementCase casee : switchQuery.getCases()) { + //casee has to be null if we want to customize the EObject itself. + if (casee.getCase() == null) { + if (customizedTElt == null) { + caseToModify = casee; + } + } else { + if (casee.getCase().equals(customizedTElt)) { + caseToModify = casee; + break; + } + } + } + return caseToModify; + } + + public ICommandFactoryResult<Customization> createCustomization( + final String name) { + final Customization customization = CustomFactory.eINSTANCE + .createCustomization(); + final Command setName = this.commandFactory.createSetCommand( + this.editingDomain, customization, + EcorePackage.eINSTANCE.getENamedElement_Name(), name); + return ICommandFactoryResultFactory.DEFAULT.createCommandFactoryResult(setName, customization); + } + +}
diff --git a/org.eclipse.modisco.facet.custom.ui/src/org/eclipse/modisco/facet/custom/ui/internal/CustomizationCommandFactoryFactory.java b/org.eclipse.modisco.facet.custom.ui/src/org/eclipse/modisco/facet/custom/ui/internal/CustomizationCommandFactoryFactory.java new file mode 100644 index 0000000..0cf041e --- /dev/null +++ b/org.eclipse.modisco.facet.custom.ui/src/org/eclipse/modisco/facet/custom/ui/internal/CustomizationCommandFactoryFactory.java
@@ -0,0 +1,29 @@ +/** + * Copyright (c) 2012 Mia-Software. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Gregoire Dupe (Mia-Software) - Bug 369987 - [Restructuring][Table] Switch to the new customization and facet framework + * Gregoire Dupe (Mia-Software) - Bug 373078 - API Cleaning + */ +package org.eclipse.modisco.facet.custom.ui.internal; + +import org.eclipse.emf.edit.domain.EditingDomain; +import org.eclipse.modisco.facet.custom.ui.internal.exported.ICustomizationCommandFactory; +import org.eclipse.modisco.facet.custom.ui.internal.exported.ICustomizationCommandFactoryFactory; +import org.eclipse.modisco.facet.util.emf.core.internal.exported.ICommandFactory; + +public class CustomizationCommandFactoryFactory implements + ICustomizationCommandFactoryFactory { + + public ICustomizationCommandFactory createCustomizationCommandFactory( + final EditingDomain editingDomain, + final ICommandFactory commandFactory) { + return new CustomizationCommandFactory(editingDomain, commandFactory); + } + +}
diff --git a/org.eclipse.modisco.facet.custom.ui/src/org/eclipse/modisco/facet/custom/ui/internal/CustomizedContentProviderFactory.java b/org.eclipse.modisco.facet.custom.ui/src/org/eclipse/modisco/facet/custom/ui/internal/CustomizedContentProviderFactory.java new file mode 100644 index 0000000..c1e6403 --- /dev/null +++ b/org.eclipse.modisco.facet.custom.ui/src/org/eclipse/modisco/facet/custom/ui/internal/CustomizedContentProviderFactory.java
@@ -0,0 +1,36 @@ +/** + * Copyright (c) 2011, 2016 Mia-Software. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Gregoire Dupe (Mia-Software) - Bug 361794 - [Restructuring] New customization meta-model + * Nicolas Bros (Mia-Software) - Bug 379683 - customizable Tree content provider + * Grégoire Dupé (Mia-Software) - Bug 506334 - Need to know which TreeElement has been updated + */ +package org.eclipse.modisco.facet.custom.ui.internal; + +import org.eclipse.jface.viewers.IContentProvider; +import org.eclipse.modisco.facet.custom.core.ICustomizationManager; +import org.eclipse.modisco.facet.custom.ui.ICustomizedContentProviderFactory; +import org.eclipse.modisco.facet.custom.ui.ICustomizedTreeContentProvider; + +public class CustomizedContentProviderFactory implements ICustomizedContentProviderFactory { + + public ICustomizedTreeContentProvider createCustomizedTreeContentProvider(final ICustomizationManager customManager) { + return new CustomizedTreeContentProvider(customManager, new IContentListener() { + public void onUpdate(final Object object) { + // Nothing to do + } + }); + } + + public IContentProvider createCustomizedTreeContentProvider(final ICustomizationManager customManager, + final IContentListener contentListener) { + return new CustomizedTreeContentProvider(customManager, contentListener); + } + +}
diff --git a/org.eclipse.modisco.facet.custom.ui/src/org/eclipse/modisco/facet/custom/ui/internal/CustomizedLabelDecorator.java b/org.eclipse.modisco.facet.custom.ui/src/org/eclipse/modisco/facet/custom/ui/internal/CustomizedLabelDecorator.java new file mode 100644 index 0000000..0164a5b --- /dev/null +++ b/org.eclipse.modisco.facet.custom.ui/src/org/eclipse/modisco/facet/custom/ui/internal/CustomizedLabelDecorator.java
@@ -0,0 +1,124 @@ +/******************************************************************************* + * Copyright (c) 2013 Soft-Maint. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * David Couvrand (Soft-Maint) - Bug 418418 - [Customization] Overlay icons not implemented + * David Couvrand (Soft-Maint) - [Customization] NPE for CustomizableLabelProvider when no image found for image customization + * Thomas Cicognani (Soft-Maint) - Bug 424414 - ImageManager doesn't cache images + * Thomas Cicognani (Soft-Maint) - Bug 424416 - Plug-in for JFace Utilities + *******************************************************************************/ +package org.eclipse.modisco.facet.custom.ui.internal; + +import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.ecore.ETypedElement; +import org.eclipse.jface.resource.ImageDescriptor; +import org.eclipse.jface.viewers.DecorationOverlayIcon; +import org.eclipse.jface.viewers.IDecorationContext; +import org.eclipse.jface.viewers.ILabelProviderListener; +import org.eclipse.jface.viewers.LabelDecorator; +import org.eclipse.modisco.facet.custom.core.ICustomizationManager; +import org.eclipse.modisco.facet.custom.core.internal.exported.CustomizationUtils; +import org.eclipse.modisco.facet.custom.metamodel.custompt.IImage; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.FacetOperation; +import org.eclipse.modisco.facet.util.swt.imageprovider.IImageProvider; +import org.eclipse.modisco.facet.util.swt.imageprovider.IImageProviderFactory; +import org.eclipse.swt.graphics.Image; + +public class CustomizedLabelDecorator extends LabelDecorator { + + private final ICustomizationManager customizationMgr; + private final PropertiesHandler propertiesHandler; + private final ImageManager imageManager; + + public CustomizedLabelDecorator(final ICustomizationManager customizationMgr) { + super(); + this.customizationMgr = customizationMgr; + this.propertiesHandler = new PropertiesHandler(customizationMgr); + this.imageManager = new ImageManager(); + } + + public Image decorateImage(final Image image, final Object element) { + return null; + } + + public String decorateText(final String text, final Object element) { + return null; + } + + public void addListener(final ILabelProviderListener listener) { + // Nothing to do + } + + public void dispose() { + // Nothing to do + } + + public boolean isLabelProperty(final Object element, final String property) { + return false; + } + + public void removeListener(final ILabelProviderListener listener) { + // Nothing to do + } + + @Override + public Image decorateImage(final Image image, final Object element, + final IDecorationContext context) { + Image result = null; + if ((image != null) && (element instanceof EObject)) { + final IImage bLeftIImage = getPropertyValue(element, + this.propertiesHandler.getBottomLeftOverlayProperty(), + null, IImage.class); + final ImageDescriptor bottomLeftImDesc = this.imageManager + .getImageDescriptor(bLeftIImage); + final IImage tLeftIImage = getPropertyValue(element, + this.propertiesHandler.getTopLeftOverlayProperty(), null, + IImage.class); + final ImageDescriptor topLeftImDesc = this.imageManager + .getImageDescriptor(tLeftIImage); + final IImage bRightIImage = getPropertyValue(element, + this.propertiesHandler.getBottomRightOverlayProperty(), + null, IImage.class); + final ImageDescriptor bottomRightImDesc = this.imageManager + .getImageDescriptor(bRightIImage); + final IImage tRightIImage = getPropertyValue(element, + this.propertiesHandler.getTopRightOverlayProperty(), null, + IImage.class); + final ImageDescriptor topRightImDesc = this.imageManager + .getImageDescriptor(tRightIImage); + final ImageDescriptor[] overlaysArray = new ImageDescriptor[] { + topLeftImDesc, topRightImDesc, bottomLeftImDesc, + bottomRightImDesc, null }; + final DecorationOverlayIcon overlayIcon = new DecorationOverlayIcon( + image, overlaysArray); + final IImageProvider imageProvider = IImageProviderFactory.DEFAULT + .createIImageProvider(Activator.getDefault()); + result = imageProvider.getImage(overlayIcon); + } + return result; + } + + @Override + public String decorateText(final String text, final Object element, + final IDecorationContext context) { + return null; + } + + @Override + public boolean prepareDecoration(final Object element, + final String originalText, final IDecorationContext context) { + return false; + } + + private <T> T getPropertyValue(final Object element, + final FacetOperation property, final ETypedElement eTypedElement, + final Class<T> classs) { + return CustomizationUtils.getPropertyValue(this.customizationMgr, + element, property, eTypedElement, classs); + } + +}
diff --git a/org.eclipse.modisco.facet.custom.ui/src/org/eclipse/modisco/facet/custom/ui/internal/CustomizedLabelProvider.java b/org.eclipse.modisco.facet.custom.ui/src/org/eclipse/modisco/facet/custom/ui/internal/CustomizedLabelProvider.java new file mode 100644 index 0000000..d45058b --- /dev/null +++ b/org.eclipse.modisco.facet.custom.ui/src/org/eclipse/modisco/facet/custom/ui/internal/CustomizedLabelProvider.java
@@ -0,0 +1,601 @@ +/** + * Copyright (c) 2011, 2017 Mia-Software. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Gregoire Dupe (Mia-Software) - Bug 361794 - [Restructuring] New customization meta-model + * Gregoire Dupe (Mia-Software) - Bug 369987 - [Restructuring][Table] Switch to the new customization and facet framework + * Nicolas Bros (Mia-Software) - Bug 372198 - resource leak in org.eclipse.emf.facet.custom.ui.internal.CustomizedLabelProvider + * Vincent Lorenzo (CEA-LIST) - Bug 372644 - Create Customizable tooltips for the TreeViewer using a CustomizableLabelProvider + * Gregoire Dupe (Mia-Software) - Bug 373078 - API Cleaning + * Nicolas Bros (Mia-Software) - Bug 374941 - To be able to customize overlay icons on EClass + * Gregoire Dupe (Mia-Software) - Bug 374941 - To be able to customize overlay icons on EClass + * Gregoire Dupe (Mia-Software) - Bug 364325 - [Restructuring] The user must be able to navigate into a model using the Facet. + * Vincent Lorenzo (CEA-LIST) - Bug 352603 - [Table] A tooltip which displays the full label of a String cell editor + * Grégoire Dupé(Mia-Software) - Bug 352603 - [Table] A tooltip which displays the full label of a String cell editor + * David Couvrand (Soft-Maint) - Bug 402725 - Need a query to get an image from an URI + * Nicolas Rault (Soft-Maint) - Bug 402725 - Need a query to get an image from an URI + * David Couvrand (Soft-Maint) - Bug 418418 - [Customization] Overlay icons not implemented + * David Couvrand (Soft-Maint) - Bug 422058 - Implementation of strikethrough and underline in the CustomizedLabelProvider + * Grégoire Dupé (Mia-Software) - Bug 424122 - [Table] Images, fonts and colors are not shared between the instances of table + * Thomas Cicognani (Soft-Maint) - Bug 424414 - ImageManager doesn't cache images + * Thomas Cicognani (Mia-Software) - Bug 513070 - NatTable and customization: cannot change background from columns + */ +package org.eclipse.modisco.facet.custom.ui.internal; + +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; + +import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.ecore.ETypedElement; +import org.eclipse.emf.ecore.resource.ResourceSet; +import org.eclipse.jface.viewers.CellLabelProvider; +import org.eclipse.jface.viewers.DelegatingStyledCellLabelProvider.IStyledLabelProvider; +import org.eclipse.modisco.facet.custom.core.ICustomizationManager; +import org.eclipse.modisco.facet.custom.core.ICustomizationManagerFactory; +import org.eclipse.modisco.facet.custom.core.exception.CustomizationException; +import org.eclipse.modisco.facet.custom.core.internal.exported.CustomizationUtils; +import org.eclipse.modisco.facet.custom.metamodel.custompt.IColor; +import org.eclipse.modisco.facet.custom.metamodel.custompt.IImage; +import org.eclipse.modisco.facet.custom.metamodel.v0_2_0.custompt.Alignment; +import org.eclipse.modisco.facet.custom.metamodel.v0_2_0.custompt.Shadow; +import org.eclipse.modisco.facet.custom.ui.ICustomOverride; +import org.eclipse.modisco.facet.custom.ui.ICustomizedLabelProvider; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.FacetOperation; +import org.eclipse.modisco.facet.util.core.DebugUtils; +import org.eclipse.modisco.facet.util.core.Logger; +import org.eclipse.modisco.facet.util.swt.colorprovider.IColorProvider; +import org.eclipse.modisco.facet.util.swt.colorprovider.IColorProviderFactory; +import org.eclipse.modisco.facet.util.swt.fontprovider.IFontProvider; +import org.eclipse.modisco.facet.util.swt.fontprovider.IFontProviderFactory; +import org.eclipse.jface.viewers.ILabelProviderListener; +import org.eclipse.jface.viewers.StyledString; +import org.eclipse.jface.viewers.ViewerCell; +import org.eclipse.swt.SWT; +import org.eclipse.swt.graphics.Color; +import org.eclipse.swt.graphics.Font; +import org.eclipse.swt.graphics.FontData; +import org.eclipse.swt.graphics.Image; +import org.eclipse.swt.graphics.RGB; +import org.eclipse.swt.widgets.Display; +import org.osgi.framework.Bundle; +import org.osgi.framework.BundleContext; +import org.osgi.framework.ServiceReference; + +public class CustomizedLabelProvider extends CellLabelProvider implements + ICustomizedLabelProvider, IStyledLabelProvider { + + private static final boolean DEBUG_FONT = DebugUtils.getDebugStatus(Activator.getDefault(), "font"); //$NON-NLS-1$ + private static final boolean DEBUG_COLOR = DebugUtils.getDebugStatus(Activator.getDefault(), "color"); //$NON-NLS-1$ + private static final int RGB_MAX = 255; + private static final RGB DEFAULT_BCKGND = new RGB( + CustomizedLabelProvider.RGB_MAX, CustomizedLabelProvider.RGB_MAX, + CustomizedLabelProvider.RGB_MAX); + private static final RGB DEFAULT_FOREGND = new RGB(0, 0, 0); + private final ICustomizationManager customManager; + private final PropertiesHandler propertiesHandler; + private final List<ILabelProviderListener> listeners = new ArrayList<ILabelProviderListener>(); + private final ImageManager imageManager; + private final ICustomOverride customOverride; + + @Deprecated + public CustomizedLabelProvider(final ResourceSet resourceSet) { + this(ICustomizationManagerFactory.DEFAULT + .getOrCreateICustomizationManager(resourceSet)); + } + + public CustomizedLabelProvider(final ICustomizationManager customManager) { + super(); + this.customManager = customManager; + this.propertiesHandler = new PropertiesHandler(customManager); + this.imageManager = new ImageManager(); + this.customOverride = getICustomOverride(); + } + + private <T> T getPropertyValue(final Object element, + final FacetOperation property, final ETypedElement eTypedElement, final Class<T> classs) { + return CustomizationUtils.getPropertyValue(this.customManager, element, + property, eTypedElement, classs); + } + + public String getText(final Object element) { + String result; + if (element instanceof EObject) { + result = getPropertyValue(element, + this.propertiesHandler.getLabelProperty(), null, String.class); + } else if (element == null) { + result = Messages.CustomizedLabelProvider_null; + } else if (element instanceof List<?>) { + // Here we do not add any square brackets because the square + // brackets are useful to emphases the sublists and here we will non + // meet any sublists. + final StringBuffer strBuffer = new StringBuffer(); + final List<?> list = (List<?>) element; + final Iterator<?> iter = list.iterator(); + while (iter.hasNext()) { + final Object current = iter.next(); + strBuffer.append(getText(current)); + if (iter.hasNext()) { + strBuffer.append(", "); //$NON-NLS-1$ + } + } + result = strBuffer.toString(); + } else { + result = element.toString(); + } + if (this.customOverride != null) { + try { + result = this.customOverride.getText(result, element, + this.customManager, this.propertiesHandler); + } catch (final CustomizationException e) { + result = "ERROR, cf. log"; //$NON-NLS-1$ + Logger.logError(e, Activator.getDefault()); + } + } + return result; + } + + private static ICustomOverride getICustomOverride() { + final Bundle bundle = Activator.getDefault().getBundle(); + final BundleContext bundleContext = bundle.getBundleContext(); + final ServiceReference serviceReference = bundleContext + .getServiceReference(ICustomOverride.class.getName()); + final ICustomOverride customOverride = (ICustomOverride) bundleContext + .getService(serviceReference); + return customOverride; + } + + public String getText(final Object object, final ETypedElement eTypedElement) { + String result; + if (object == null) { + result = Messages.CustomizedLabelProvider_null; + } else { + if (object instanceof EObject) { + final EObject eObject = (EObject) object; + try { + result = this.customManager.getCustomValueOf(eObject, + eTypedElement, + this.propertiesHandler.getLabelProperty(), + String.class); + } catch (CustomizationException e) { + Logger.logError(e, Activator.getDefault()); + result = "!!! Error, cf log !!!"; + } + } else { + result = object.toString(); + } + + } + return result; + +//TODO Remove before to commit +// if (structuralFeature.getUpperBound() == 1) { +// final Object object = this.customManager.getFacetManager().get(eObject, +// structuralFeature, Object.class); +// result = getText(object); +// } else { +// final StringBuffer stringBuffer = new StringBuffer(); +// final List<Object> objects = this.customManager.getFacetManager() +// .getMultiValued(eObject, structuralFeature, Object.class); +// final Iterator<Object> objectsIter = objects.iterator(); +// while (objectsIter.hasNext()) { +// final Object object = objectsIter.next(); +// stringBuffer.append(this.getText(object)); +// if (objectsIter.hasNext()) { +// stringBuffer.append(", "); +// } +// } +// result = stringBuffer.toString(); +// } +//TODO (end) + } + + @Override + public void addListener(final ILabelProviderListener listener) { + this.listeners.add(listener); + } + + @Override + public void dispose() { + this.listeners.clear(); + } + + @Override + public boolean isLabelProperty(final Object element, final String property) { + return false; + } + + @Override + public void removeListener(final ILabelProviderListener listener) { + this.listeners.remove(listener); + } + + private static Color getColor(final RGB rgb) { + final Display display = Display.getDefault(); + final IColorProvider colorProvider = IColorProviderFactory.DEFAULT + .getOrCreateIColorProvider(display); + return colorProvider.getColor(rgb); + } + + public Color getForeground(final Object element) { + final IColor color = getPropertyValue(element, + this.propertiesHandler.getForegroundProperty(), + null, IColor.class); + Color result; + if (color == null) { + result = getColor(CustomizedLabelProvider.DEFAULT_FOREGND); + } else { + result = getColor(new RGB(color.getRed(), color.getGreen(), + color.getBlue())); + } + return result; + } + + public Color getBackground(final Object element, + final ETypedElement eTypedElement) { + final IColor color = getPropertyValue(element, + this.propertiesHandler.getBackgroundProperty(), eTypedElement, + IColor.class); + Color result; + if (color == null) { + result = getColor(CustomizedLabelProvider.DEFAULT_BCKGND); + } else { + result = getColor(new RGB(color.getRed(), color.getGreen(), + color.getBlue())); + } + return result; + } + + public Color getBackground(final Object element) { + return getBackground(element, null); + } + + private Font getFont(final FontData fontData) { + final IFontProvider fontProvider = IFontProviderFactory.DEFAULT + .getOrCreateIFontProvider(Display.getDefault()); + return fontProvider.getFont(fontData); + } + + public Font getFont(final Object element) { + + String fontName = getPropertyValue(element, + this.propertiesHandler.getFontNameProperty(), null, String.class); + if (fontName == null) { + final FontData[] fontData = Display.getDefault().getSystemFont() + .getFontData(); + fontName = fontData[0].getName(); + } + + Integer fontSize = getPropertyValue(element, + this.propertiesHandler.getFontSizeProperty(), null, Integer.class); + if (fontSize == null) { + final FontData[] fontData = Display.getDefault().getSystemFont() + .getFontData(); + fontSize = Integer.valueOf(fontData[0].getHeight()); + } + + Boolean isBold = getPropertyValue(element, + this.propertiesHandler.getIsBoldProperty(), null, Boolean.class); + if (isBold == null) { + isBold = Boolean.FALSE; + } + + Boolean isItalic = getPropertyValue(element, + this.propertiesHandler.getIsItalicProperty(), null, Boolean.class); + if (isItalic == null) { + isItalic = Boolean.FALSE; + } + + int fontStyle = 0; + if (isBold.booleanValue()) { + fontStyle = fontStyle | SWT.BOLD; + } + if (isItalic.booleanValue()) { + fontStyle = fontStyle | SWT.ITALIC; + } + FontData fontData = new FontData(fontName, fontSize.intValue(), + fontStyle); + try { + fontData = this.customOverride.getFont(fontData, element, + this.customManager, this.propertiesHandler); + } catch (final CustomizationException e) { + Logger.logError(e, Activator.getDefault()); + } + return getFont(fontData); + } + + public Image getImage(final Object element) { + final IImage image = getPropertyValue(element, + this.propertiesHandler.getImageProperty(), null, IImage.class); + return this.imageManager.getImage(image); + } + + public Image getImage(final Object element, final ETypedElement featureColumn) { + return getImage(element, this.propertiesHandler.getImageProperty(), featureColumn); + } + + public ICustomizationManager getCustomizationManager() { + return this.customManager; + } + + public boolean isUnderlined(final Object element, + final ETypedElement eTypedElement) { + return getPropertyValue(element, + this.propertiesHandler.getIsUnderlinedProperty(), null, Boolean.class).booleanValue(); + } + + public boolean isStruckthrough(final Object element, + final ETypedElement eTypedElement) { + final Boolean propertyValue = getPropertyValue(element, + this.propertiesHandler.getIsStruckthroughProperty(), + eTypedElement, Boolean.class); + boolean result = false; + if (propertyValue != null) { + result = propertyValue.booleanValue(); + } + return result; + } + + private Image getImage(final Object element, final FacetOperation operation, final ETypedElement feature) { + final IImage iimage = getPropertyValue(element, operation, feature, + IImage.class); + return this.imageManager.getImage(iimage); + } + + public Image getTopLeftOverlay(final Object element, + final ETypedElement eTypedElement) { + return getImage(element, this.propertiesHandler.getTopLeftOverlayProperty(), eTypedElement); + } + + public Image getTopMiddleOverlay(final Object element, + final ETypedElement eTypedElement) { + return getImage(element, this.propertiesHandler.getTopMiddleOverlayProperty(), eTypedElement); + } + + public Image getTopRightOverlay(final Object element, + final ETypedElement eTypedElement) { + return getImage(element, this.propertiesHandler.getTopRightOverlayProperty(), eTypedElement); + } + + public Image getBottomLeftOverlay(final Object element, + final ETypedElement eTypedElement) { + return getImage(element, this.propertiesHandler.getBottomLeftOverlayProperty(), eTypedElement); + } + + public Image getBottomMiddleOverlay(final Object element, + final ETypedElement eTypedElement) { + return getImage(element, this.propertiesHandler.getBottomMiddleOverlayProperty(), eTypedElement); + } + + public Image getBottomRightOverlay(final Object element, + final ETypedElement eTypedElement) { + return getImage(element, this.propertiesHandler.getBottomRightOverlayProperty(), eTypedElement); + } + + + @Override + public String getToolTipText(final Object element) { + return getPropertyValue(element, + this.propertiesHandler.getToolTipTextProperty(), null, String.class); + } + + @Override + public int getToolTipStyle(final Object element) { + int style = 0; + final Shadow shadow = getPropertyValue(element, + this.propertiesHandler.getToolTipShadowProperty(), null, + Shadow.class); + switch (shadow) { + case NONE : + style = SWT.SHADOW_NONE; + break; + case IN : + style = SWT.SHADOW_IN; + break; + case OUT: + style = SWT.SHADOW_OUT; + break; + default: + throw new IllegalStateException("Un expected value"); //$NON-NLS-1$ + } + + final Alignment alignment = getPropertyValue(element, + this.propertiesHandler.getToolTipAlignmentProperty(), null, + Alignment.class); + switch (alignment) { + case LEFT: + style |= SWT.LEFT; + break; + case CENTER: + style |= SWT.CENTER; + break; + case RIGHT: + style |= SWT.RIGHT; + break; + default: + throw new IllegalStateException("Un expected value"); //$NON-NLS-1$ + } + + return style; + } + + @Override + public Image getToolTipImage(final Object element) { + return getPropertyValue(element, + this.propertiesHandler.getToolTipImageProperty(), null, Image.class); + } + + @Override + public Color getToolTipBackgroundColor(final Object element) { + final IColor color = getPropertyValue(element, + this.propertiesHandler.getToolTipBackgroundProperty(), + null, IColor.class); + return getColor(new RGB(color.getRed(), color.getGreen(), color.getBlue())); + } + + @Override + public Color getToolTipForegroundColor(final Object element) { + final IColor color = getPropertyValue(element, + this.propertiesHandler.getToolTipForegroundProperty(), + null, IColor.class); + return getColor(new RGB(color.getRed(), color.getGreen(), color.getBlue())); + } + + public Image getToolTipTopLeftOverlay(final Object element, + final ETypedElement eTypedElement) { + return getPropertyValue(element, + this.propertiesHandler.getToolTipTopLeftOverlayProperty(), + null, Image.class); + } + + public Image getToolTipTopMiddleOverlay(final Object element, + final ETypedElement eTypedElement) { + return getPropertyValue(element, + this.propertiesHandler.getToolTipTopMiddleOverlayProperty(), + null, Image.class); + } + + public Image getToolTipTopRightOverlay(final Object element, + final ETypedElement eTypedElement) { + return getPropertyValue(element, + this.propertiesHandler.getToolTipTopRightOverlayProperty(), + null, Image.class); + } + + public Image getToolTipBottomLeftOverlay(final Object element, + final ETypedElement eTypedElement) { + return getPropertyValue(element, + this.propertiesHandler.getToolTipBottomLeftOverlayProperty(), + null, Image.class); + } + + public Image getToolTipBottomMiddleOverlay(final Object element, + final ETypedElement eTypedElement) { + return getPropertyValue(element, + this.propertiesHandler.getToolTipBottomMiddleOverlayProperty(), + null, Image.class); + } + + public Image getToolTipBottomRightOverlay(final Object element, + final ETypedElement eTypedElement) { + return getPropertyValue(element, + this.propertiesHandler.getToolTipBottomRightOverlayProperty(), + null, Image.class); + } + + @Override + public int getToolTipDisplayDelayTime(final Object element) { + return getPropertyValue(element, + this.propertiesHandler.getToolTipDisplayDelayTimeProperty(), + null, Integer.class).intValue(); + } + + @Override + public int getToolTipTimeDisplayed(final Object element) { + return getPropertyValue(element, + this.propertiesHandler.getToolTipTimeDisplayedProperty(), null, + Integer.class).intValue(); + + } + + @Override + public Font getToolTipFont(final Object element) { + + final String fontName = getPropertyValue(element, + this.propertiesHandler.getToolTipFontNameProperty(), null, + String.class); + final Integer fontSize = getPropertyValue(element, + this.propertiesHandler.getToolTipFontSizeProperty(), null, + Integer.class); + final Boolean isBold = getPropertyValue(element, + this.propertiesHandler.getToolTipIsBoldProperty(), null, + Boolean.class); + final Boolean isItalic = getPropertyValue(element, + this.propertiesHandler.getToolTipIsItalicProperty(), null, + Boolean.class); + int fontStyle = 0; + if (isBold.booleanValue()) { + fontStyle = fontStyle | SWT.BOLD; + } + if (isItalic.booleanValue()) { + fontStyle = fontStyle | SWT.ITALIC; + } + final FontData fontData = new FontData(fontName, fontSize.intValue(), + fontStyle); + final IFontProvider fontProvider = IFontProviderFactory.DEFAULT + .getOrCreateIFontProvider(Display.getDefault()); + return fontProvider.getFont(fontData); + } + + @Override + public void update(final ViewerCell cell) { + final Object element = cell.getElement(); + cell.setText(getText(element)); + cell.setBackground(getBackground(element)); + cell.setFont(getFont(element)); + cell.setForeground(getForeground(element)); + cell.setImage(getImage(element)); + } + + public String getToolTipText(final Object element, + final ETypedElement eTypedElement) { + // TODO Auto-generated method stub + return null; + } + + public Image getToolTipImage(final Object element, + final ETypedElement eTypedElement) { + // TODO Auto-generated method stub + return null; + } + + public Font getToolTipFont(final Object element, + final ETypedElement eTypedElement) { + // TODO Auto-generated method stub + return null; + } + + public Color getToolTipBackgroundColor(final Object element, + final ETypedElement eTypedElement) { + // TODO Auto-generated method stub + return null; + } + + public Color getToolTipForegroundColor(final Object element, + final ETypedElement eTypedElement) { + // TODO Auto-generated method stub + return null; + } + + public int getToolTipTimeDisplayed(final Object element, + final ETypedElement eTypedElement) { + // TODO Auto-generated method stub + return 0; + } + + public int getToolTipDisplayDelayTime(final Object element, + final ETypedElement eTypedElement) { + // TODO Auto-generated method stub + return 0; + } + + public int getToolTipStyle(final Object element, + final ETypedElement eTypedElement) { + // TODO Auto-generated method stub + return 0; + } + + public ICustomizedLabelProvider cloneLabelProvider() { + return new CustomizedLabelProvider(this.customManager); + } + + public StyledString getStyledText(final Object element) { + return new StyledString(getText(element)); + } + +}
diff --git a/org.eclipse.modisco.facet.custom.ui/src/org/eclipse/modisco/facet/custom/ui/internal/CustomizedLabelProviderFactory.java b/org.eclipse.modisco.facet.custom.ui/src/org/eclipse/modisco/facet/custom/ui/internal/CustomizedLabelProviderFactory.java new file mode 100644 index 0000000..f9be361 --- /dev/null +++ b/org.eclipse.modisco.facet.custom.ui/src/org/eclipse/modisco/facet/custom/ui/internal/CustomizedLabelProviderFactory.java
@@ -0,0 +1,28 @@ +/** + * Copyright (c) 2012 Mia-Software. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Gregoire Dupe (Mia-Software) - Bug 361794 - [Restructuring] New customization meta-model + * David Couvrand (Soft-Maint) - Bug 418418 - [Customization] Overlay icons not implemented + */ +package org.eclipse.modisco.facet.custom.ui.internal; + +import org.eclipse.modisco.facet.custom.core.ICustomizationManager; +import org.eclipse.modisco.facet.custom.ui.ICustomizedLabelProvider; +import org.eclipse.modisco.facet.custom.ui.ICustomizedLabelProviderFactory; + +public class CustomizedLabelProviderFactory implements + ICustomizedLabelProviderFactory { + + public ICustomizedLabelProvider createCustomizedLabelProvider( + final ICustomizationManager customizationMgr) { + return new DecoratingCustomizedLabelProvider( + customizationMgr); + } + +}
diff --git a/org.eclipse.modisco.facet.custom.ui/src/org/eclipse/modisco/facet/custom/ui/internal/CustomizedTreeContentProvider.java b/org.eclipse.modisco.facet.custom.ui/src/org/eclipse/modisco/facet/custom/ui/internal/CustomizedTreeContentProvider.java new file mode 100644 index 0000000..4db0263 --- /dev/null +++ b/org.eclipse.modisco.facet.custom.ui/src/org/eclipse/modisco/facet/custom/ui/internal/CustomizedTreeContentProvider.java
@@ -0,0 +1,452 @@ +/******************************************************************************* + * Copyright (c) 2012, 2016 Mia-Software. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Nicolas Bros (Mia-Software) - Bug 379683 - customizable Tree content provider + * Grégoire Dupé (Mia-Software) - Bug 385292 - [CustomizedTreeContentProvider] StackOverFlow when refreshing a TreeViewer with ICustomizedTreeContentProvider + * Grégoire Dupé (Mia-Software) - Bug 386387 - [CustomizedTreeContentProvider] The TreeElements are not preserved between two calls to getElements() + * Thomas Cicognani (Soft-Maint) - Bug 441321 - isVisible customization doesn't work after refreshing a tree + * Grégoire Dupé (Mia-Software) - Bug 441570 - Children custom property + * Grégoire Dupé (Mia-Software) - Bug 506334 - Need to know which TreeElement has been updated + * Grégoire Dupé (Mia-Software) - Bug 506929 - Refresh problems after CustomizedTreeContentProvider.dispose() + *******************************************************************************/ +package org.eclipse.modisco.facet.custom.ui.internal; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collection; +import java.util.Collections; +import java.util.List; +import java.util.Set; + +import org.eclipse.emf.common.notify.Adapter; +import org.eclipse.emf.common.notify.Notifier; +import org.eclipse.emf.common.util.EList; +import org.eclipse.emf.ecore.EAttribute; +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.ecore.EReference; +import org.eclipse.emf.ecore.EStructuralFeature; +import org.eclipse.emf.ecore.ETypedElement; +import org.eclipse.jface.viewers.Viewer; +import org.eclipse.modisco.facet.custom.core.ICustomizationManager; +import org.eclipse.modisco.facet.custom.core.exception.CustomizationException; +import org.eclipse.modisco.facet.custom.metamodel.v0_2_0.internal.treeproxy.EAttributeTreeElement; +import org.eclipse.modisco.facet.custom.metamodel.v0_2_0.internal.treeproxy.EObjectTreeElement; +import org.eclipse.modisco.facet.custom.metamodel.v0_2_0.internal.treeproxy.EReferenceTreeElement; +import org.eclipse.modisco.facet.custom.metamodel.v0_2_0.internal.treeproxy.EStructuralFeatureTreeElement; +import org.eclipse.modisco.facet.custom.metamodel.v0_2_0.internal.treeproxy.TreeElement; +import org.eclipse.modisco.facet.custom.metamodel.v0_2_0.internal.treeproxy.TreeproxyFactory; +import org.eclipse.modisco.facet.custom.ui.IContentPropertiesHandler; +import org.eclipse.modisco.facet.custom.ui.IContentPropertiesHandlerFactory; +import org.eclipse.modisco.facet.custom.ui.ICustomizedTreeContentProvider; +import org.eclipse.modisco.facet.custom.ui.ICustomizedContentProviderFactory.IContentListener; +import org.eclipse.modisco.facet.efacet.core.FacetUtils; +import org.eclipse.modisco.facet.efacet.core.IFacetManager; +import org.eclipse.modisco.facet.efacet.core.IFacetManagerListener; +import org.eclipse.modisco.facet.efacet.core.exception.FacetManagerException; +import org.eclipse.modisco.facet.util.core.Logger; + +@SuppressWarnings("deprecation") +// @SuppressWarnings("deprecation") : Bug 380229 - [deprecated] ICustomizedContentProvider +public class CustomizedTreeContentProvider implements ICustomizedTreeContentProvider { + + private final ICustomizationManager customManager; + private final IContentPropertiesHandler contentHandler; + private Object previousInput; + private Object[] rootElements = new Object[0]; + private final List<TreeElementAdapter> adapters; + private IContentListener contentListener; + + public CustomizedTreeContentProvider(final ICustomizationManager customManager, + final IContentListener contentListener) { + this.adapters = new ArrayList<TreeElementAdapter>(); + this.customManager = customManager; + this.customManager.getFacetManager().addListener(new IFacetManagerListener() { + public void facetManagerChanged() { + CustomizedTreeContentProvider.this.dispose(); + } + }); + this.contentHandler = IContentPropertiesHandlerFactory.DEFAULT.createIContentPropertiesHandler(customManager); + this.contentListener = contentListener; + } + + private static Object[] getRootElements(final Object inputElement) { + Object[] result; + if (inputElement == null) { + result = new Object[0]; + } else if (inputElement instanceof EObject) { + result = new EObject[] { (EObject) inputElement }; + } else if (inputElement instanceof Collection<?>) { + result = ((Collection<?>) inputElement).toArray(); + } else if (inputElement instanceof EObject[]) { + result = (EObject[]) inputElement; + } else { + throw new IllegalArgumentException("Unhandled input element type: " + inputElement.getClass().getSimpleName()); //$NON-NLS-1$ + } + return result; + } + + public Object[] getElements(final Object inputElement) { + Object[] result; + if (this.previousInput == inputElement) { + result = this.rootElements; + } else { + this.previousInput = inputElement; + final Object[] elements = getRootElements(inputElement); + final List<Object> elementList = new ArrayList<Object>(); + for (final Object element : elements) { + if (!isVisible(element, null)) { + continue; + } + if (element instanceof EObject) { + final EObjectTreeElement eObjectProxy = createEObjectProxy(element, null); + elementList.add(eObjectProxy); + } else { + elementList.add(element); + } + } + result = elementList.toArray(); + this.rootElements = result; + } + return result; + } + + protected EObjectTreeElement createEObjectProxy(final Object element, + final TreeElement parent) { + final EObject eObject = (EObject) element; + final EObjectTreeElement eObjectProxy = TreeproxyFactory.eINSTANCE.createEObjectTreeElement(); + eObjectProxy.setEObject(eObject); + eObjectProxy.setParent(parent); + /* + * The TreeElementAdapter is used to clear the content of + * eObjectProxy.setParent() when the eObject is updated. + */ + final TreeElementAdapter adapter = new TreeElementAdapter(eObjectProxy, + this.contentListener); + eObject.eAdapters().add(adapter); + this.adapters.add(adapter); + return eObjectProxy; + } + + public Object[] getChildren(final Object parentElement) { + Object[] result = null; + if (parentElement == null) { + result = new Object[0]; + } else if (parentElement instanceof TreeElement) { + final TreeElement treeElt = (TreeElement) parentElement; + if (parentElement instanceof EAttributeTreeElement) { + final EAttributeTreeElement attributeProxy = (EAttributeTreeElement) parentElement; + result = getChildren(attributeProxy); + } else { + /* + * treeElt.getChildren() is cleared by the TreeElementAdapter + * instances when the eObject is updated. + */ + final List<? extends TreeElement> cachedChildren = treeElt.getChildren(); + if (cachedChildren == null || cachedChildren.isEmpty()) { + if (parentElement instanceof EObjectTreeElement) { + final EObjectTreeElement eObjectProxy = (EObjectTreeElement) parentElement; + result = filter(getChildren(eObjectProxy)); + } else if (parentElement instanceof EReferenceTreeElement) { + final EReferenceTreeElement referenceProxy = (EReferenceTreeElement) parentElement; + result = filter(getChildren(referenceProxy)); + } + } else { + result = filter(cachedChildren); + } + } + } + if (result == null) { + @SuppressWarnings("null") + /* + * @SuppressWarnings("null"): gdupe> parentElement cannot be null, + * this is tested by the first if of this method + */ + final Class<? extends Object> unexpectedClass = parentElement.getClass(); + Logger.logError("Unknown element in tree: " + unexpectedClass, //$NON-NLS-1$ + Activator.getDefault()); + result = new Object[0]; + } + return result; + } + + private Object[] filter(final List<? extends TreeElement> notFilteredResult) { + final List<TreeElement> filteredChildren = new ArrayList<TreeElement>(); + for (TreeElement child : notFilteredResult) { + EObject eObject = null; + EStructuralFeature eStructFeature = null; + if (child instanceof EStructuralFeatureTreeElement) { + final EStructuralFeatureTreeElement sfTreeElt = (EStructuralFeatureTreeElement) child; + eObject = ((EObjectTreeElement) sfTreeElt.getParent()).getEObject(); + eStructFeature = sfTreeElt.getEStructuralFeature(); + } else if (child instanceof EObjectTreeElement) { + final EObjectTreeElement eObjTreeElt = (EObjectTreeElement) child; + eObject = eObjTreeElt.getEObject(); + } + if (isVisible(eObject, eStructFeature)) { + filteredChildren.add(child); + } + } + return filteredChildren.toArray(); + } + + private List<TreeElement> getChildren(final EObjectTreeElement treeElement) { + List<TreeElement> children = treeElement.getChildren(); + children.clear(); + final List<ETypedElement> customChildren = getCustomChildren(treeElement.getEObject(), null); + if (customChildren == null) { + children = new ArrayList<TreeElement>(); + children.addAll(createAttributes(treeElement)); + children.addAll(createReferences(treeElement)); + } else { + for (ETypedElement customChild : customChildren) { + if (customChild instanceof EAttribute) { + final EAttribute eAttribute = (EAttribute) customChild; + children.add(createAttributeProxy(eAttribute, treeElement)); + } else if (customChild instanceof EReference) { + final EReference eReference = (EReference) customChild; + children.addAll(getReferenceChildren(treeElement, eReference, treeElement.getEObject())); + } + } + } + return children; + } + + public Object[] getChildren(final EAttributeTreeElement attributeProxy) { + final List<Object> children = new ArrayList<Object>(); + final EAttribute eAttribute = attributeProxy.getEAttribute(); + if (eAttribute.isMany()) { + final TreeElement parent = attributeProxy.getParent(); + if (!(parent instanceof EObjectTreeElement)) { + throw new IllegalStateException("An attribute should appear only under a model element"); //$NON-NLS-1$ + } + final EObjectTreeElement parentProxy = (EObjectTreeElement) parent; + final EObject eObject = parentProxy.getEObject(); + try { + final IFacetManager facetManager = this.customManager.getFacetManager(); + final List<Object> result = facetManager.getOrInvokeMultiValued(eObject, eAttribute, null); + for (final Object object : result) { + if (object instanceof EObject) { + final EObject childEObject = (EObject) object; + children.add(createEObjectProxy(childEObject, attributeProxy)); + } + children.add(object); + } + } catch (final FacetManagerException e) { + Logger.logError(e, Activator.getDefault()); + } + } + return children.toArray(); + } + + public List<? extends TreeElement> getChildren(final EReferenceTreeElement referenceProxy) { + List<? extends TreeElement> result; + final EReference eReference = referenceProxy.getEReference(); + final TreeElement parent = referenceProxy.getParent(); + if (!(parent instanceof EObjectTreeElement)) { + throw new IllegalStateException("A reference should appear only under a model element"); //$NON-NLS-1$ + } + final EObjectTreeElement parentProxy = (EObjectTreeElement) parent; + final EObject eObject = parentProxy.getEObject(); + result = getReferenceChildren(referenceProxy, eReference, eObject); + return result; + } + + private List<? extends TreeElement> getReferenceChildren( + final TreeElement parent, + final EReference eReference, final EObject eObject) { + List<? extends TreeElement> result; + if (eReference.isMany()) { + result = getMultiValuedReferenceChildren(eReference, eObject, parent); + } else { + final EObjectTreeElement child = getSingleValuedReferenceChild(eReference, eObject, parent); + if (child == null) { + result = Collections.emptyList(); + } else { + result = Collections.singletonList(child); + } + } + return result; + } + + private EObjectTreeElement getSingleValuedReferenceChild(final EReference eReference, + final EObject eObject, final TreeElement parent) { + EObjectTreeElement child = null; + try { + final IFacetManager facetManager = this.customManager + .getFacetManager(); + final EObject referedEObject = facetManager.getOrInvoke( + eObject, eReference, EObject.class); + if (referedEObject != null) { + child = createEObjectProxy(referedEObject, parent); + } + } catch (final FacetManagerException e) { + Logger.logError(e, Activator.getDefault()); + } + return child; + } + + private List<EObjectTreeElement> getMultiValuedReferenceChildren( + final EReference eReference, final EObject eObject, + final TreeElement parent) { + final List<EObjectTreeElement> children = new ArrayList<EObjectTreeElement>(); + try { + final IFacetManager facetManager = this.customManager + .getFacetManager(); + final List<Object> result = facetManager + .getOrInvokeMultiValued(eObject, eReference, null); + for (final Object object : result) { + if (object instanceof EObject) { + final EObject childEObject = (EObject) object; + children.add(createEObjectProxy(childEObject, parent)); + } + } + } catch (final FacetManagerException e) { + Logger.logError(e, Activator.getDefault()); + } + return children; + } + + private Collection<EAttributeTreeElement> createAttributes(final EObjectTreeElement treeElement) { + final EObject eObject = treeElement.getEObject(); + final EClass eClass = eObject.eClass(); + final IFacetManager facetManager = this.customManager.getFacetManager(); + final List<EAttribute> allAttributes = new ArrayList<EAttribute>(); + allAttributes.addAll(eClass.getEAllAttributes()); + try { + final Set<EAttribute> facetAttributes = FacetUtils.getETypedElements(eObject, EAttribute.class, facetManager); + allAttributes.addAll(facetAttributes); + } catch (final FacetManagerException e) { + Logger.logError(e, Activator.getDefault()); + } + return createAttributeProxies(allAttributes, treeElement); + } + + private static Collection<EAttributeTreeElement> createAttributeProxies( + final List<EAttribute> allAttributes, + final EObjectTreeElement parent) { + final List<EAttributeTreeElement> result = new ArrayList<EAttributeTreeElement>(); + for (final EAttribute eAttribute : allAttributes) { + result.add(createAttributeProxy(eAttribute, parent)); + } + return result; + } + + private static EAttributeTreeElement createAttributeProxy( + final EAttribute eAttribute, final EObjectTreeElement parent) { + final EAttributeTreeElement attributeProxy = TreeproxyFactory.eINSTANCE + .createEAttributeTreeElement(); + attributeProxy.setEStructuralFeature(eAttribute); + attributeProxy.setParent(parent); + return attributeProxy; + } + + private Collection<EReferenceTreeElement> createReferences(final EObjectTreeElement treeElement) { + final EObject eObject = treeElement.getEObject(); + final EClass eClass = eObject.eClass(); + final IFacetManager facetManager = this.customManager.getFacetManager(); + final List<EReference> allReferences = new ArrayList<EReference>(); + allReferences.addAll(eClass.getEAllReferences()); + try { + final Set<EReference> facetReferences = FacetUtils.getETypedElements(eObject, EReference.class, facetManager); + allReferences.addAll(facetReferences); + } catch (final FacetManagerException e) { + Logger.logError(e, Activator.getDefault()); + } + return createReferenceProxies(allReferences, treeElement); + } + + private static Collection<EReferenceTreeElement> createReferenceProxies(final List<EReference> allReferences, final EObjectTreeElement parent) { + final List<EReferenceTreeElement> result = new ArrayList<EReferenceTreeElement>(); + for (final EReference eReference : allReferences) { + final EReferenceTreeElement referenceProxy = TreeproxyFactory.eINSTANCE + .createEReferenceTreeElement(); + referenceProxy.setEStructuralFeature(eReference); + referenceProxy.setParent(parent); + result.add(referenceProxy); + } + return result; + } + + public Object getParent(final Object element) { + Object result = null; + if (element instanceof TreeElement) { + final TreeElement treeElement = (TreeElement) element; + result = treeElement.eContainer(); + } + return result; + } + + public boolean hasChildren(final Object element) { + return getChildren(element).length > 0; + } + + public void dispose() { + final List<Object> rootList = Arrays.asList(this.rootElements); + /* gdupe> I copy the list to avoid ConcurrentModificationException */ + final Collection<TreeElementAdapter> adaptersCopy = Collections + .unmodifiableCollection(this.adapters); + for (TreeElementAdapter adapter : adaptersCopy) { + final EObjectTreeElement treeElement = adapter.getTreeElement(); + if (!rootList.contains(treeElement)) { + final Notifier target = adapter.getTarget(); + final EList<Adapter> eAdapters = target.eAdapters(); + eAdapters.remove(adapter); + } + treeElement.getChildren().clear(); + } + for (Object rootElt : this.rootElements) { + this.contentListener.onUpdate(rootElt); + } + } + + public void inputChanged(final Viewer viewer, final Object oldInput, final Object newInput) { + if (newInput == null || !newInput.equals(newInput)) { + dispose(); + } + } + + public ICustomizationManager getCustomizationManager() { + return this.customManager; + } + + public boolean isVisible(final Object object, final ETypedElement eTypedElement) { + Boolean result = Boolean.TRUE; + if (object instanceof EObject) { + final EObject eObject = (EObject) object; + try { + result = this.customManager.getCustomValueOf(eObject, eTypedElement, this.contentHandler.getIsVisible(), Boolean.class); + } catch (final CustomizationException e) { + Logger.logError(e, Activator.getDefault()); + } + } + return result.booleanValue(); + } + + public List<ETypedElement> getCustomChildren(final Object object, final ETypedElement eTypedElement) { + List<ETypedElement> result = null; + if (object instanceof EObject) { + final EObject eObject = (EObject) object; + try { + final List<?> tmpresult = this.customManager.getCustomValueOf(eObject, eTypedElement, this.contentHandler.getChildren(), List.class); + if (tmpresult != null && !tmpresult.isEmpty()) { + result = new ArrayList<ETypedElement>(); + for (Object tmpObject :tmpresult) { + if (tmpObject instanceof ETypedElement) { + final ETypedElement resultElt = (ETypedElement) tmpObject; + result.add(resultElt); + } + } + } + } catch (final CustomizationException e) { + Logger.logError(e, Activator.getDefault()); + } + } + return result; + } +}
diff --git a/org.eclipse.modisco.facet.custom.ui/src/org/eclipse/modisco/facet/custom/ui/internal/DecoratingCustomizedLabelProvider.java b/org.eclipse.modisco.facet.custom.ui/src/org/eclipse/modisco/facet/custom/ui/internal/DecoratingCustomizedLabelProvider.java new file mode 100644 index 0000000..335388b --- /dev/null +++ b/org.eclipse.modisco.facet.custom.ui/src/org/eclipse/modisco/facet/custom/ui/internal/DecoratingCustomizedLabelProvider.java
@@ -0,0 +1,189 @@ +/******************************************************************************* + * Copyright (c) 2013, 2017 Soft-Maint, and Mia-Software. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * David Couvrand (Soft-Maint) - Bug 418418 - [Customization] Overlay icons not implemented + * Thomas Cicognani (Mia-Software) - Bug 513070 - NatTable and customization: cannot change background from columns + *******************************************************************************/ +package org.eclipse.modisco.facet.custom.ui.internal; + +import org.eclipse.emf.ecore.ETypedElement; +import org.eclipse.jface.viewers.DecoratingStyledCellLabelProvider; +import org.eclipse.jface.viewers.IDecorationContext; +import org.eclipse.jface.viewers.ILabelDecorator; +import org.eclipse.modisco.facet.custom.core.ICustomizationManager; +import org.eclipse.modisco.facet.custom.ui.ICustomizedLabelProvider; +import org.eclipse.swt.graphics.Color; +import org.eclipse.swt.graphics.Font; +import org.eclipse.swt.graphics.Image; + +public class DecoratingCustomizedLabelProvider extends + DecoratingStyledCellLabelProvider implements ICustomizedLabelProvider { + + private ICustomizedLabelProvider lblProvider; + + private DecoratingCustomizedLabelProvider( + final IStyledLabelProvider labelProvider, + final ILabelDecorator decorator, + final IDecorationContext decorationContext) { + super(labelProvider, decorator, decorationContext); + } + + public DecoratingCustomizedLabelProvider( + final ICustomizationManager customizationMgr) { + this(new CustomizedLabelProvider(customizationMgr), + new CustomizedLabelDecorator(customizationMgr), null); + this.lblProvider = (ICustomizedLabelProvider) getStyledStringProvider(); + } + + public String getText(final Object element) { + return this.lblProvider.getText(element); + } + + public String getToolTipText(final Object element, + final ETypedElement eTypedElement) { + return this.lblProvider.getToolTipText(element, eTypedElement); + } + + public Image getToolTipImage(final Object element, + final ETypedElement eTypedElement) { + return this.lblProvider.getToolTipImage(element, eTypedElement); + } + + public Font getToolTipFont(final Object element, + final ETypedElement eTypedElement) { + return this.lblProvider.getToolTipFont(element, eTypedElement); + } + + public Color getToolTipBackgroundColor(final Object element, + final ETypedElement eTypedElement) { + return this.lblProvider.getToolTipBackgroundColor(element, + eTypedElement); + } + + public Color getToolTipForegroundColor(final Object element, + final ETypedElement eTypedElement) { + return this.lblProvider.getToolTipForegroundColor(element, + eTypedElement); + } + + public Image getToolTipTopLeftOverlay(final Object element, + final ETypedElement eTypedElement) { + return this.lblProvider + .getToolTipTopLeftOverlay(element, eTypedElement); + } + + public Image getToolTipTopMiddleOverlay(final Object element, + final ETypedElement eTypedElement) { + return this.lblProvider.getToolTipTopMiddleOverlay(element, + eTypedElement); + } + + public Image getToolTipTopRightOverlay(final Object element, + final ETypedElement eTypedElement) { + return this.lblProvider.getToolTipTopRightOverlay(element, + eTypedElement); + } + + public Image getToolTipBottomLeftOverlay(final Object element, + final ETypedElement eTypedElement) { + return this.lblProvider.getToolTipBottomLeftOverlay(element, + eTypedElement); + } + + public Image getToolTipBottomMiddleOverlay(final Object element, + final ETypedElement eTypedElement) { + return this.lblProvider.getToolTipBottomMiddleOverlay(element, + eTypedElement); + } + + public Image getToolTipBottomRightOverlay(final Object element, + final ETypedElement eTypedElement) { + return this.lblProvider.getToolTipBottomRightOverlay(element, + eTypedElement); + } + + public int getToolTipTimeDisplayed(final Object element, + final ETypedElement eTypedElement) { + return this.lblProvider.getToolTipTimeDisplayed(element, eTypedElement); + } + + public int getToolTipDisplayDelayTime(final Object element, + final ETypedElement eTypedElement) { + return this.lblProvider.getToolTipDisplayDelayTime(element, + eTypedElement); + } + + public int getToolTipStyle(final Object element, + final ETypedElement eTypedElement) { + return this.lblProvider.getToolTipStyle(element, eTypedElement); + } + + public ICustomizationManager getCustomizationManager() { + return this.lblProvider.getCustomizationManager(); + } + + public boolean isUnderlined(final Object element, + final ETypedElement eTypedElement) { + return this.lblProvider.isUnderlined(element, eTypedElement); + } + + public boolean isStruckthrough(final Object element, + final ETypedElement eTypedElement) { + return this.lblProvider.isStruckthrough(element, eTypedElement); + } + + public Image getTopLeftOverlay(final Object element, + final ETypedElement eTypedElement) { + return this.lblProvider.getTopLeftOverlay(element, eTypedElement); + } + + public Image getTopMiddleOverlay(final Object element, + final ETypedElement eTypedElement) { + return this.lblProvider.getTopMiddleOverlay(element, eTypedElement); + } + + public Image getTopRightOverlay(final Object element, + final ETypedElement eTypedElement) { + return this.lblProvider.getTopRightOverlay(element, eTypedElement); + } + + public Image getBottomLeftOverlay(final Object element, + final ETypedElement eTypedElement) { + return this.lblProvider.getBottomLeftOverlay(element, eTypedElement); + } + + public Image getBottomMiddleOverlay(final Object element, + final ETypedElement eTypedElement) { + return this.lblProvider.getBottomMiddleOverlay(element, eTypedElement); + } + + public Image getBottomRightOverlay(final Object element, + final ETypedElement eTypedElement) { + return this.lblProvider.getBottomRightOverlay(element, eTypedElement); + } + + public String getText(final Object element, + final ETypedElement eTypedElement) { + return this.lblProvider.getText(element, eTypedElement); + } + + public Image getImage(final Object element, + final ETypedElement eTypedElement) { + return this.lblProvider.getImage(element, eTypedElement); + } + + public ICustomizedLabelProvider cloneLabelProvider() { + return this.lblProvider.cloneLabelProvider(); + } + + public Color getBackground(final Object element, + final ETypedElement eTypedElement) { + return this.lblProvider.getBackground(element, eTypedElement); + } + +}
diff --git a/org.eclipse.modisco.facet.custom.ui/src/org/eclipse/modisco/facet/custom/ui/internal/DefaultCustomOverride.java b/org.eclipse.modisco.facet.custom.ui/src/org/eclipse/modisco/facet/custom/ui/internal/DefaultCustomOverride.java new file mode 100644 index 0000000..5a9c8c8 --- /dev/null +++ b/org.eclipse.modisco.facet.custom.ui/src/org/eclipse/modisco/facet/custom/ui/internal/DefaultCustomOverride.java
@@ -0,0 +1,55 @@ +/** + * Copyright (c) 2013 Soft-Maint. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * David Couvrand (Soft-Maint) - Bug 422058 - Implementation of strikethrough and underline in the CustomizedLabelProvider + */ +package org.eclipse.modisco.facet.custom.ui.internal; + +import org.eclipse.emf.ecore.EObject; +import org.eclipse.modisco.facet.custom.core.ICustomizationManager; +import org.eclipse.modisco.facet.custom.core.exception.CustomizationException; +import org.eclipse.modisco.facet.custom.ui.ICustomOverride; +import org.eclipse.modisco.facet.custom.ui.IFontPropertiesHandler; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.FacetOperation; +import org.eclipse.swt.graphics.FontData; + +public class DefaultCustomOverride implements ICustomOverride { + + public String getText(final String result, final Object object, + final ICustomizationManager customManager, + final IFontPropertiesHandler propertiesHandler) + throws CustomizationException { + String newResult = result; + if (object instanceof EObject) { + final EObject eObject = (EObject) object; + final FacetOperation isStruckProp = propertiesHandler + .getIsStruckthroughProperty(); + final boolean isStruckthrough = customManager.getCustomValueOf( + eObject, isStruckProp, Boolean.class).booleanValue(); + if (isStruckthrough) { + newResult = String.format("--%s--", newResult); //$NON-NLS-1$ + } + final FacetOperation isUnderlinedProp = propertiesHandler + .getIsUnderlinedProperty(); + final boolean isUnderlined = customManager.getCustomValueOf( + eObject, isUnderlinedProp, Boolean.class).booleanValue(); + if (isUnderlined) { + newResult = String.format("__%s__", newResult); //$NON-NLS-1$ + } + } + return newResult; + } + + public FontData getFont(final FontData fontData, final Object object, + final ICustomizationManager customManager, + final IFontPropertiesHandler propertiesHandler) { + return fontData; + } + +}
diff --git a/org.eclipse.modisco.facet.custom.ui/src/org/eclipse/modisco/facet/custom/ui/internal/ImageManager.java b/org.eclipse.modisco.facet.custom.ui/src/org/eclipse/modisco/facet/custom/ui/internal/ImageManager.java new file mode 100644 index 0000000..9a41668 --- /dev/null +++ b/org.eclipse.modisco.facet.custom.ui/src/org/eclipse/modisco/facet/custom/ui/internal/ImageManager.java
@@ -0,0 +1,98 @@ +/******************************************************************************* + * Copyright (c) 2013 Soft-Maint. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * David Couvrand (Soft-Maint) - Bug 418418 - [Customization] Overlay icons not implemented + * Thomas Cicognani (Soft-Maint) - Bug 424414 - ImageManager doesn't cache images + *******************************************************************************/ +package org.eclipse.modisco.facet.custom.ui.internal; + +import java.net.URL; +import java.util.HashMap; +import java.util.Map; + +import org.eclipse.core.runtime.Platform; +import org.eclipse.emf.common.util.URI; +import org.eclipse.jface.resource.ImageDescriptor; +import org.eclipse.modisco.facet.custom.metamodel.custompt.IImage; +import org.eclipse.modisco.facet.custom.ui.internal.custompt.ImageWrapper; +import org.eclipse.modisco.facet.custom.ui.internal.custompt.URIImage; +import org.eclipse.modisco.facet.util.core.Logger; +import org.eclipse.modisco.facet.util.swt.imageprovider.IImageProvider; +import org.eclipse.modisco.facet.util.swt.imageprovider.IImageProviderFactory; +import org.eclipse.osgi.util.NLS; +import org.eclipse.swt.graphics.Device; +import org.eclipse.swt.graphics.Image; +import org.eclipse.ui.PlatformUI; +import org.osgi.framework.Bundle; + +public class ImageManager { + + private final Map<String, ImageDescriptor> uriImageCache = new HashMap<String, ImageDescriptor>(); + + private Image getImage(final URIImage uriImage) { + Image result; + final String uriStr = uriImage.getUri(); + ImageDescriptor imageDescriptor; + if (this.uriImageCache.keySet().contains(uriStr)) { + imageDescriptor = this.uriImageCache.get(uriStr); + } else { + imageDescriptor = createImageDescriptor(uriStr); + this.uriImageCache.put(uriStr, imageDescriptor); + } + final IImageProvider imageProvider = IImageProviderFactory.DEFAULT + .createIImageProvider(Activator.getDefault()); + result = imageProvider.getImage(imageDescriptor); + return result; + } + + + private ImageDescriptor createImageDescriptor(final String uriStr) { + ImageDescriptor imgDecriptor; + final URI uri = URI.createURI(uriStr); + final String bundleId = uri.segment(1); + final Bundle bundle = Platform.getBundle(bundleId); + final URI baseURI = URI.createPlatformPluginURI(bundleId + '/', + false); + final String resourcePath = uri.deresolve(baseURI).toString(); + final URL url = bundle.getResource(resourcePath); + + if (url == null) { + Logger.logError(NLS.bind("Resource not found: {0}", //$NON-NLS-1$ + resourcePath), Activator.getDefault()); + imgDecriptor = ImageDescriptor.getMissingImageDescriptor(); + } else { + imgDecriptor = ImageDescriptor.createFromURL(url); + } + return imgDecriptor; + } + + + public Image getImage(final IImage image) { + Image result = null; + final Device device = PlatformUI.getWorkbench().getDisplay(); + if (image instanceof ImageWrapper) { + final ImageWrapper wrapper = (ImageWrapper) image; + result = wrapper.getImage(); + } else if (image instanceof URIImage) { + final URIImage uriImage = (URIImage) image; + result = getImage(uriImage); + } else if (image != null) { + result = new Image(device, image.getInputStream()); + } + return result; + } + + public ImageDescriptor getImageDescriptor(final IImage image) { + ImageDescriptor result = null; + if (image instanceof URIImage) { + final URIImage uriImage = (URIImage) image; + result = createImageDescriptor(uriImage.getUri()); + } + return result; + } +}
diff --git a/org.eclipse.modisco.facet.custom.ui/src/org/eclipse/modisco/facet/custom/ui/internal/ImageProvider.java b/org.eclipse.modisco.facet.custom.ui/src/org/eclipse/modisco/facet/custom/ui/internal/ImageProvider.java new file mode 100644 index 0000000..ed15e3a --- /dev/null +++ b/org.eclipse.modisco.facet.custom.ui/src/org/eclipse/modisco/facet/custom/ui/internal/ImageProvider.java
@@ -0,0 +1,182 @@ +/******************************************************************************* + * Copyright (c) 2008, 2010, 2014 Mia-Software. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Nicolas Bros (Mia-Software) - initial API and implementation + * Vincent Lorenzo (CEA-LIST) - bug 341238 - We need to be able to specify which column have to be hidden/visible using the customization mechanism + * Gregoire Dupe (Mia-Software) - Bug 369987 - [Restructuring][Table] Switch to the new customization and facet framework + * Nicolas Bros (Mia-Software) - Bug 379683 - customizable Tree content provider + * Thomas Cicognani (Soft-Maint) - Bug 442711 - Missing icon for URI FacetSet + *******************************************************************************/ + +package org.eclipse.modisco.facet.custom.ui.internal; + +import java.net.URL; + +import org.eclipse.jface.resource.ImageDescriptor; +import org.eclipse.modisco.facet.util.core.Logger; +import org.eclipse.osgi.util.NLS; +import org.eclipse.swt.SWT; +import org.eclipse.swt.graphics.Image; +import org.eclipse.swt.widgets.Display; + +/** A singleton image provider, which caches image descriptors */ +public final class ImageProvider { + + private ImageProvider() { + // This class must only be instantiated by getInstance(). + } + + private static ImageProvider instance; + + public static ImageProvider getInstance() { + if (ImageProvider.instance == null) { + ImageProvider.instance = new ImageProvider(); + } + return ImageProvider.instance; + } + + private Image uiCustomIcon = null; + private Image grayedUiCustomIcon; + + private Image linkIcon = null; + private Image linkUniDirIcon = null; + private Image linkFacetIcon = null; + private Image aggregIcon = null; + private Image aggregUniDirIcon = null; + private Image invAggregIcon = null; + + private Image attributeIcon = null; + private Image attribFacetIcon = null; + private Image featureIcon = null; + + private static final String UI_CUSTOM = "icons/uiCustom.gif"; //$NON-NLS-1$ + + private static final String AGGREG_UNIDIR = "icons/aggreg_unidir.gif"; //$NON-NLS-1$ + private static final String AGGREG_ICON_PATH = "icons/aggreg.gif"; //$NON-NLS-1$ + private static final String ATTRIBUTE_FACET = "icons/attribute_facet.gif"; //$NON-NLS-1$ + private static final String ATTRIBUTE = "icons/attributes.gif"; //$NON-NLS-1$ + private static final String INV_AGGREG = "icons/inv_aggreg.gif"; //$NON-NLS-1$ + private static final String LINK_FACET = "icons/link_unidir_facet.gif"; //$NON-NLS-1$ + private static final String LINK_UNIDIR = "icons/link_unidir.gif"; //$NON-NLS-1$ + private static final String LINK_ICON_PATH = "icons/link.gif"; //$NON-NLS-1$ + private static final String FEATURE_ICON_PATH = "icons/feature.gif"; //$NON-NLS-1$ + + /** + * Create an image descriptor from a resource + * + * @param resourcePath + * the path of the resource (in the bundle) + * @return the image descriptor + */ + private static ImageDescriptor createImageDescriptor(final String resourcePath) { + final URL url = Activator.getDefault().getBundle().getResource(resourcePath); + ImageDescriptor result; + if (url == null) { + Logger.logError(NLS.bind("Resource not found: {0}", //$NON-NLS-1$ + resourcePath), Activator.getDefault()); + result = ImageDescriptor.getMissingImageDescriptor(); + } else { + result = ImageDescriptor.createFromURL(url); + } + return result; + } + + /** Return an icon for "uiCustom" */ + public Image getUiCustomIcon() { + if (this.uiCustomIcon == null) { + this.uiCustomIcon = createImageDescriptor(ImageProvider.UI_CUSTOM) + .createImage(); + } + return this.uiCustomIcon; + } + + public Image getGrayedUiCustomIcon() { + if (this.grayedUiCustomIcon == null) { + this.grayedUiCustomIcon = new Image(Display.getCurrent(), getUiCustomIcon(), SWT.IMAGE_GRAY); + } + return this.grayedUiCustomIcon; + } + + /** Return the icon representing a bidirectional link */ + public Image getLinkIcon() { + if (this.linkIcon == null) { + this.linkIcon = createImageDescriptor(ImageProvider.LINK_ICON_PATH).createImage(); + } + return this.linkIcon; + } + + /** Return the icon representing an unidirectional link */ + public Image getUnidirectionalLinkIcon() { + if (this.linkUniDirIcon == null) { + this.linkUniDirIcon = createImageDescriptor(ImageProvider.LINK_UNIDIR) + .createImage(); + } + return this.linkUniDirIcon; + } + + /** Return the icon representing a facet reference */ + public Image getFacetLinkIcon() { + if (this.linkFacetIcon == null) { + this.linkFacetIcon = createImageDescriptor(ImageProvider.LINK_FACET) + .createImage(); + } + return this.linkFacetIcon; + } + + /** Return the icon representing a composition link */ + public Image getAggregIcon() { + if (this.aggregIcon == null) { + this.aggregIcon = createImageDescriptor(ImageProvider.AGGREG_ICON_PATH).createImage(); + } + return this.aggregIcon; + } + + /** Return the icon representing an unidirectional composition link */ + public Image getUnidirectionalAggregIcon() { + if (this.aggregUniDirIcon == null) { + this.aggregUniDirIcon = createImageDescriptor(ImageProvider.AGGREG_UNIDIR) + .createImage(); + } + return this.aggregUniDirIcon; + } + + /** Return the icon representing a reverse composition link */ + public Image getInvAggregIcon() { + if (this.invAggregIcon == null) { + this.invAggregIcon = createImageDescriptor(ImageProvider.INV_AGGREG) + .createImage(); + } + return this.invAggregIcon; + } + + /** Return the "attribute" icon */ + public Image getAttributeIcon() { + if (this.attributeIcon == null) { + this.attributeIcon = createImageDescriptor(ImageProvider.ATTRIBUTE) + .createImage(); + } + return this.attributeIcon; + } + + /** Return the "facet attribute" icon */ + public Image getFacetAttributeIcon() { + if (this.attribFacetIcon == null) { + this.attribFacetIcon = createImageDescriptor(ImageProvider.ATTRIBUTE_FACET) + .createImage(); + } + return this.attribFacetIcon; + } + + /** Return the "feature" icon */ + public Image getFeatureIcon() { + if (this.featureIcon == null) { + this.featureIcon = createImageDescriptor(ImageProvider.FEATURE_ICON_PATH).createImage(); + } + return this.featureIcon; + } +}
diff --git a/org.eclipse.modisco.facet.custom.ui/src/org/eclipse/modisco/facet/custom/ui/internal/Messages.java b/org.eclipse.modisco.facet.custom.ui/src/org/eclipse/modisco/facet/custom/ui/internal/Messages.java new file mode 100644 index 0000000..c67ca08 --- /dev/null +++ b/org.eclipse.modisco.facet.custom.ui/src/org/eclipse/modisco/facet/custom/ui/internal/Messages.java
@@ -0,0 +1,70 @@ +/******************************************************************************* + * Copyright (c) 2009 Mia-Software. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Nicolas Bros (Mia-Software) - initial API and implementation + * Gregoire Dupe (Mia-Software) - Bug 369987 - [Restructuring][Table] Switch to the new customization and facet framework + * Nicolas Bros (Mia-Software) - Bug 372732 - [Facet] Rewrite the catalog views for 0.2 + * Gregoire Dupe (Mia-Software) - Bug 373078 - API Cleaning + * Vincent Lorenzo (CEA-LIST) - Bug 373255 - Add tooltips providing a documentation for the selected elements in the Select ETypedElement Dialog + *******************************************************************************/ +package org.eclipse.modisco.facet.custom.ui.internal; + +import org.eclipse.osgi.util.NLS; + +public final class Messages extends NLS { + private static final String BUNDLE_NAME = "org.eclipse.emf.facet.custom.ui.internal.messages"; //$NON-NLS-1$ + public static String CustomizationsCatalogView_title; + public static String CustomizationsView_allQuerySets; + public static String CustomizationsView_jobName_RefreshCustomizationsView; + public static String CustomizationsView_extendsColumn; + public static String CustomizationsView_nameColumn; + public static String CustomizationsView_documentationColumn; + public static String CustomizedLabelProvider_null; + public static String NewCustomizationFilePage_browserCustomization; + public static String NewCustomizationFilePage_createsBrowserCustomization; + public static String NewCustomizationFilePage_customizationInNonEmfFacetProject; + public static String NewCustomizationWizard_newBrowserCustomization; + public static String QuerySetsSelectionControl_allExistingQuerySets; + public static String QuerySetsSelectionControl_availableQuerySets; + public static String QuerySetsSelectionControl_deselectAll; + public static String QuerySetsSelectionControl_querySetsSelectedBelowOnly; + public static String QuerySetsSelectionControl_selectAll; + public static String SelectMetamodelsPage_selectMetamodel; + public static String SelectMetamodelsPage_selectMetamodelToCustomize; + public static String SelectQuerySetsPage_selectAvailableQuerySets; + public static String SelectQuerySetsPage_selectAvailableQuerySetsInCustomization; + public static String LoadCustomizationsDialog_Add; + public static String LoadCustomizationsDialog_Add2; + public static String LoadCustomizationsDialog_AddAll; + public static String LoadCustomizationsDialog_AddAll2; + public static String LoadCustomizationsDialog_AvailiableCustom; + public static String LoadCustomizationsDialog_Can_not_be_unload; + public static String LoadCustomizationsDialog_Down; + public static String LoadCustomizationsDialog_LoadedCustomizations; + public static String LoadCustomizationsDialog_LoadCustomizationWarning; + public static String LoadCustomizationsDialog_Loading; + public static String LoadCustomizationsDialog_loadReferencedFacetsCheckbox; + public static String LoadCustomizationsDialog_OK; + public static String LoadCustomizationsDialog_Remove; + public static String LoadCustomizationsDialog_Remove2; + public static String LoadCustomizationsDialog_RemoveAll; + public static String LoadCustomizationsDialog_RemoveAll2; + public static String LoadCustomizationsDialog_title_LoadCustomizations; + public static String LoadCustomizationsDialog_type_filter_test; + public static String LoadCustomizationsDialog_Up; + public static String ToolTipTextQuery_Documentation; + public static String ToolTipTextQuery_NoDocumentation; + static { + // initialize resource bundle + NLS.initializeMessages(Messages.BUNDLE_NAME, Messages.class); + } + + private Messages() { + // cannot be instantiated + } +}
diff --git a/org.eclipse.modisco.facet.custom.ui/src/org/eclipse/modisco/facet/custom/ui/internal/PropertiesHandler.java b/org.eclipse.modisco.facet.custom.ui/src/org/eclipse/modisco/facet/custom/ui/internal/PropertiesHandler.java new file mode 100644 index 0000000..aaf25b1 --- /dev/null +++ b/org.eclipse.modisco.facet.custom.ui/src/org/eclipse/modisco/facet/custom/ui/internal/PropertiesHandler.java
@@ -0,0 +1,313 @@ +/** + * Copyright (c) 2012, 2014 Mia-Software. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Gregoire Dupe (Mia-Software) - Bug 361794 - [Restructuring] New customization meta-model + * Gregoire Dupe (Mia-Software) - Bug 369987 - [Restructuring][Table] Switch to the new customization and facet framework + * Vincent Lorenzo (CEA-LIST) - Bug 372644 - Create Customizable tooltips for the TreeViewer using a CustomizableLabelProvider + * Gregoire Dupe (Mia-Software) - Bug 372644 - Create Customizable tooltips for the TreeViewer using a CustomizableLabelProvider + * Gregoire Dupe (Mia-Software) - Bug 373078 - API Cleaning + * Nicolas Bros (Mia-Software) - Bug 377866 - selection customization + * David Couvrand (Soft-Maint) - Bug 422058 - Implementation of strikethrough and underline in the CustomizedLabelProvider + * Gregoire Dupe (Mia-Software) - Bug 441570 - Children custom property + * Gregoire Dupe (Mia-Software) - Bug 443682 - Access to the super facet + */ +package org.eclipse.modisco.facet.custom.ui.internal; + +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import org.eclipse.emf.common.util.URI; +import org.eclipse.emf.ecore.ETypedElement; +import org.eclipse.emf.ecore.resource.Resource; +import org.eclipse.emf.ecore.resource.ResourceSet; +import org.eclipse.modisco.facet.custom.core.ICustomizationManager; +import org.eclipse.modisco.facet.custom.ui.IContentPropertiesHandler; +import org.eclipse.modisco.facet.custom.ui.IFontPropertiesHandler; +import org.eclipse.modisco.facet.custom.ui.ISelectionPropertiesHandler; +import org.eclipse.modisco.facet.custom.ui.internal.exported.ILabelPropertiesHandler; +import org.eclipse.modisco.facet.efacet.core.FacetUtils; +import org.eclipse.modisco.facet.efacet.core.IFacetManager; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.Facet; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.FacetOperation; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.FacetSet; + +public class PropertiesHandler implements IContentPropertiesHandler, + ILabelPropertiesHandler, ISelectionPropertiesHandler, IFontPropertiesHandler { + private static final String SEPARATOR = "::"; //$NON-NLS-1$ + private static final String CUSTOM_PROPERTIES = "resources/customproperties.efacet"; //$NON-NLS-1$ + + private static final String CUSTOM = "CustomizedEObject"; //$NON-NLS-1$ + private static final String TT_CUSTOM = "CustomizedToolTipEObject"; //$NON-NLS-1$ + + private static final String IMAGE = "image"; //$NON-NLS-1$ + private static final String LABEL = "label"; //$NON-NLS-1$ + private static final String BACKGROUND = "background"; //$NON-NLS-1$ + private static final String FOREGROUND = "foreground"; //$NON-NLS-1$ + private static final String FONT = "fontName"; //$NON-NLS-1$ + private static final String FONT_SIZE = "fontSize"; //$NON-NLS-1$ + private static final String IS_BOLD = "isBold"; //$NON-NLS-1$ + private static final String IS_ITALIC = "isItalic"; //$NON-NLS-1$ + private static final String IS_VISIBLE = "isVisible"; //$NON-NLS-1$ + private static final String IS_UNDERLINED = "isUnderlined"; //$NON-NLS-1$ + private static final String IS_STRUCKTHROUGH = "isStruckthrough"; //$NON-NLS-1$ + private static final String TOP_L_OVERLAY = "topLeftOverlay"; //$NON-NLS-1$ + private static final String TOP_M_OVERLAY = "topMiddleOverlay"; //$NON-NLS-1$ + private static final String TOP_R_OVERLAY = "topRightOverlay"; //$NON-NLS-1$ + private static final String BOTTOM_L_OVERLAY = "bottomLeftOverlay"; //$NON-NLS-1$ + private static final String BOTTOM_M_OVERLAY = "bottomMiddleOverlay"; //$NON-NLS-1$ + private static final String BOTTOM_R_OVERLAY = "bottomRightOverlay"; //$NON-NLS-1$ + private static final String SELECTION = "selection"; //$NON-NLS-1$ + private static final String CHILDREN = "children"; //$NON-NLS-1$ + + //for tooltips + private static final String TEXT = "text"; //$NON-NLS-1$ + private static final String TIME_DISPLAYED = "timeDisplayed"; //$NON-NLS-1$ + private static final String DISPLAY_DELAY = "displayDelayTime"; //$NON-NLS-1$ + private static final String SHADOW = "shadow"; //$NON-NLS-1$ + private static final String ALIGNMENT = "alignment"; //$NON-NLS-1$ + + private final Resource resource; + private final Map<String, FacetOperation> map = new HashMap<String, FacetOperation>(); + + /** + * + * @deprecated Must be replaced by + * org.eclipse.emf.facet.custom.ui.internal.PropertiesHandler + * .PropertiesHandler(ICustomizationManager) + */ + @Deprecated + public PropertiesHandler(final ResourceSet resourceSet) { + final String bundleName = Activator.getDefault().getBundle().getSymbolicName(); + URI propertiesUri = URI.createPlatformPluginURI(bundleName, true); + propertiesUri = propertiesUri + .appendSegments(PropertiesHandler.CUSTOM_PROPERTIES.split("/")); //$NON-NLS-1$ + this.resource = resourceSet.getResource(propertiesUri, true); + } + + public PropertiesHandler(final ICustomizationManager customizationMgr) { + final String bundleName = Activator.getDefault().getBundle().getSymbolicName(); + URI propertiesUri = URI.createPlatformPluginURI(bundleName, true); + propertiesUri = propertiesUri + .appendSegments(PropertiesHandler.CUSTOM_PROPERTIES.split("/")); //$NON-NLS-1$ + final ResourceSet resourceSet = customizationMgr.getResourceSet(); + this.resource = resourceSet.getResource(propertiesUri, true); + final FacetSet facetSet = (FacetSet) this.resource.getContents().get(0); + final IFacetManager facetManager = customizationMgr.getFacetManager(); + final List<FacetSet> facetSets = facetManager.getManagedFacetSets(); + facetSets.add(facetSet); + } + + private FacetOperation getPropertyByName(final String facetName, + final String propertyName) { + final String key = facetName + PropertiesHandler.SEPARATOR + propertyName; + FacetOperation result = this.map.get(key); + if (result == null) { + final FacetSet facetSet = (FacetSet) this.resource.getContents() + .get(0); + final Facet facet = FacetUtils.getFacet( + FacetUtils.getFacets(facetSet), + facetName); + final ETypedElement eTypedElement = FacetUtils + .getETypedElement(facet, propertyName, + ETypedElement.class); + if (eTypedElement instanceof FacetOperation) { + result = (FacetOperation) eTypedElement; + this.map.put(key, result); + } + } + return result; + } + + public FacetOperation getImageProperty() { + return getPropertyByName(PropertiesHandler.CUSTOM, + PropertiesHandler.IMAGE); + } + + public FacetOperation getLabelProperty() { + return getPropertyByName(PropertiesHandler.CUSTOM, + PropertiesHandler.LABEL); + } + + public FacetOperation getBackgroundProperty() { + return getPropertyByName(PropertiesHandler.CUSTOM, + PropertiesHandler.BACKGROUND); + } + + public FacetOperation getForegroundProperty() { + return getPropertyByName(PropertiesHandler.CUSTOM, + PropertiesHandler.FOREGROUND); + } + + public FacetOperation getFontNameProperty() { + return getPropertyByName(PropertiesHandler.CUSTOM, + PropertiesHandler.FONT); + } + + public FacetOperation getFontSizeProperty() { + return getPropertyByName(PropertiesHandler.CUSTOM, + PropertiesHandler.FONT_SIZE); + } + + public FacetOperation getIsBoldProperty() { + return getPropertyByName(PropertiesHandler.CUSTOM, + PropertiesHandler.IS_BOLD); + } + + public FacetOperation getIsItalicProperty() { + return getPropertyByName(PropertiesHandler.CUSTOM, + PropertiesHandler.IS_ITALIC); + } + + public FacetOperation getIsVisible() { + return getPropertyByName(PropertiesHandler.CUSTOM, + PropertiesHandler.IS_VISIBLE); + } + + public FacetOperation getIsUnderlinedProperty() { + return getPropertyByName(PropertiesHandler.CUSTOM, + PropertiesHandler.IS_UNDERLINED); + } + + public FacetOperation getIsStruckthroughProperty() { + return getPropertyByName(PropertiesHandler.CUSTOM, + PropertiesHandler.IS_STRUCKTHROUGH); + } + + public FacetOperation getTopLeftOverlayProperty() { + return getPropertyByName(PropertiesHandler.CUSTOM, + PropertiesHandler.TOP_L_OVERLAY); + } + + public FacetOperation getTopMiddleOverlayProperty() { + return getPropertyByName(PropertiesHandler.CUSTOM, + PropertiesHandler.TOP_M_OVERLAY); + } + + public FacetOperation getTopRightOverlayProperty() { + return getPropertyByName(PropertiesHandler.CUSTOM, + PropertiesHandler.TOP_R_OVERLAY); + } + + public FacetOperation getBottomLeftOverlayProperty() { + return getPropertyByName(PropertiesHandler.CUSTOM, + PropertiesHandler.BOTTOM_L_OVERLAY); + } + + public FacetOperation getBottomMiddleOverlayProperty() { + return getPropertyByName(PropertiesHandler.CUSTOM, + PropertiesHandler.BOTTOM_M_OVERLAY); + } + + public FacetOperation getBottomRightOverlayProperty() { + return getPropertyByName(PropertiesHandler.CUSTOM, + PropertiesHandler.BOTTOM_R_OVERLAY); + } + + public FacetOperation getSelectionProperty() { + return getPropertyByName(PropertiesHandler.CUSTOM, + PropertiesHandler.SELECTION); + } + + // methods for tooltips + public FacetOperation getToolTipTextProperty() { + return getPropertyByName(PropertiesHandler.TT_CUSTOM, + PropertiesHandler.TEXT); + } + + public FacetOperation getToolTipImageProperty() { + return getPropertyByName(PropertiesHandler.TT_CUSTOM, + PropertiesHandler.IMAGE); + } + + public FacetOperation getToolTipFontNameProperty() { + return getPropertyByName(PropertiesHandler.TT_CUSTOM, + PropertiesHandler.FONT); + } + + public FacetOperation getToolTipFontSizeProperty() { + return getPropertyByName(PropertiesHandler.TT_CUSTOM, + PropertiesHandler.FONT_SIZE); + } + + public FacetOperation getToolTipIsBoldProperty() { + return getPropertyByName(PropertiesHandler.TT_CUSTOM, + PropertiesHandler.IS_BOLD); + } + + public FacetOperation getToolTipIsItalicProperty() { + return getPropertyByName(PropertiesHandler.TT_CUSTOM, + PropertiesHandler.IS_ITALIC); + } + + public FacetOperation getToolTipBackgroundProperty() { + return getPropertyByName(PropertiesHandler.TT_CUSTOM, + PropertiesHandler.BACKGROUND); + } + + public FacetOperation getToolTipForegroundProperty() { + return getPropertyByName(PropertiesHandler.TT_CUSTOM, + PropertiesHandler.FOREGROUND); + } + + public FacetOperation getToolTipTopLeftOverlayProperty() { + return getPropertyByName(PropertiesHandler.TT_CUSTOM, + PropertiesHandler.TOP_L_OVERLAY); + } + + public FacetOperation getToolTipTopMiddleOverlayProperty() { + return getPropertyByName(PropertiesHandler.TT_CUSTOM, + PropertiesHandler.TOP_M_OVERLAY); + } + + public FacetOperation getToolTipTopRightOverlayProperty() { + return getPropertyByName(PropertiesHandler.TT_CUSTOM, + PropertiesHandler.TOP_R_OVERLAY); + } + + public FacetOperation getToolTipBottomLeftOverlayProperty() { + return getPropertyByName(PropertiesHandler.TT_CUSTOM, + PropertiesHandler.BOTTOM_L_OVERLAY); + } + + public FacetOperation getToolTipBottomMiddleOverlayProperty() { + return getPropertyByName(PropertiesHandler.TT_CUSTOM, + PropertiesHandler.BOTTOM_M_OVERLAY); + } + + public FacetOperation getToolTipBottomRightOverlayProperty() { + return getPropertyByName(PropertiesHandler.TT_CUSTOM, + PropertiesHandler.BOTTOM_R_OVERLAY); + } + + public FacetOperation getToolTipTimeDisplayedProperty() { + return getPropertyByName(PropertiesHandler.TT_CUSTOM, + PropertiesHandler.TIME_DISPLAYED); + } + + public FacetOperation getToolTipDisplayDelayTimeProperty() { + return getPropertyByName(PropertiesHandler.TT_CUSTOM, + PropertiesHandler.DISPLAY_DELAY); + } + + public FacetOperation getToolTipAlignmentProperty() { + return getPropertyByName(PropertiesHandler.TT_CUSTOM, + PropertiesHandler.ALIGNMENT); + } + + public FacetOperation getToolTipShadowProperty() { + return getPropertyByName(PropertiesHandler.TT_CUSTOM, + PropertiesHandler.SHADOW); + } + + public FacetOperation getChildren() { + return getPropertyByName(PropertiesHandler.CUSTOM, + PropertiesHandler.CHILDREN); + } +} \ No newline at end of file
diff --git a/org.eclipse.modisco.facet.custom.ui/src/org/eclipse/modisco/facet/custom/ui/internal/PropertiesHandlerFactory.java b/org.eclipse.modisco.facet.custom.ui/src/org/eclipse/modisco/facet/custom/ui/internal/PropertiesHandlerFactory.java new file mode 100644 index 0000000..19b6c58 --- /dev/null +++ b/org.eclipse.modisco.facet.custom.ui/src/org/eclipse/modisco/facet/custom/ui/internal/PropertiesHandlerFactory.java
@@ -0,0 +1,53 @@ +/** + * Copyright (c) 2012 Mia-Software. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Gregoire Dupe (Mia-Software) - Bug 369987 - [Restructuring][Table] Switch to the new customization and facet framework + * Gregoire Dupe (Mia-Software) - Bug 373078 - API Cleaning + * Nicolas Bros (Mia-Software) - Bug 377866 - selection customization + */ +package org.eclipse.modisco.facet.custom.ui.internal; + +import org.eclipse.emf.ecore.resource.ResourceSet; +import org.eclipse.modisco.facet.custom.core.ICustomizationManager; +import org.eclipse.modisco.facet.custom.ui.IContentPropertiesHandler; +import org.eclipse.modisco.facet.custom.ui.IContentPropertiesHandlerFactory; +import org.eclipse.modisco.facet.custom.ui.ISelectionPropertiesHandler; +import org.eclipse.modisco.facet.custom.ui.ISelectionPropertiesHandlerFactory; +import org.eclipse.modisco.facet.custom.ui.internal.exported.ILabelPropertiesHandler; +import org.eclipse.modisco.facet.custom.ui.internal.exported.ILabelPropertiesHandlerFactory; + +public class PropertiesHandlerFactory implements + IContentPropertiesHandlerFactory, ILabelPropertiesHandlerFactory, ISelectionPropertiesHandlerFactory { + + /** + * @deprecated must be replaced by + * org.eclipse.emf.facet.custom.ui.internal.PropertiesHandlerFactory + * .createIContentPropertiesHandler(ICustomizationManager) + */ + @Deprecated + public IContentPropertiesHandler createIContentPropertiesHandler( + final ResourceSet resourceSet) { + return new PropertiesHandler(resourceSet); + } + + public IContentPropertiesHandler createIContentPropertiesHandler( + final ICustomizationManager customizationMgr) { + return new PropertiesHandler(customizationMgr); + } + + public ILabelPropertiesHandler createLabelPropertiesHandler( + final ICustomizationManager customizationMgr) { + return new PropertiesHandler(customizationMgr); + } + + public ISelectionPropertiesHandler createSelectionPropertiesHandler(final ICustomizationManager customManager) { + return new PropertiesHandler(customManager); + } + +}
diff --git a/org.eclipse.modisco.facet.custom.ui/src/org/eclipse/modisco/facet/custom/ui/internal/ResolvingCustomizedLabelProvider.java b/org.eclipse.modisco.facet.custom.ui/src/org/eclipse/modisco/facet/custom/ui/internal/ResolvingCustomizedLabelProvider.java new file mode 100644 index 0000000..90632ab --- /dev/null +++ b/org.eclipse.modisco.facet.custom.ui/src/org/eclipse/modisco/facet/custom/ui/internal/ResolvingCustomizedLabelProvider.java
@@ -0,0 +1,498 @@ +/******************************************************************************* + * Copyright (c) 2012, 2017 Mia-Software. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Nicolas Bros (Mia-Software) - Bug 379683 - customizable Tree content provider + * Thomas Cicognani (Mia-Software) - Bug 513070 - NatTable and customization: cannot change background from columns + *******************************************************************************/ +package org.eclipse.modisco.facet.custom.ui.internal; + +import org.eclipse.emf.ecore.ETypedElement; +import org.eclipse.jface.viewers.ILabelProviderListener; +import org.eclipse.jface.viewers.ViewerCell; +import org.eclipse.modisco.facet.custom.core.ICustomizationManager; +import org.eclipse.modisco.facet.custom.metamodel.v0_2_0.internal.treeproxy.EAttributeTreeElement; +import org.eclipse.modisco.facet.custom.metamodel.v0_2_0.internal.treeproxy.EObjectTreeElement; +import org.eclipse.modisco.facet.custom.metamodel.v0_2_0.internal.treeproxy.EReferenceTreeElement; +import org.eclipse.modisco.facet.custom.ui.CustomizedContentProviderUtils; +import org.eclipse.modisco.facet.custom.ui.ICustomizedLabelProvider; +import org.eclipse.swt.graphics.Color; +import org.eclipse.swt.graphics.Font; +import org.eclipse.swt.graphics.Image; + +public class ResolvingCustomizedLabelProvider implements ICustomizedLabelProvider { + + private final ICustomizedLabelProvider delegate; + + public ResolvingCustomizedLabelProvider(final ICustomizedLabelProvider delegate) { + super(); + this.delegate = delegate; + } + + public Image getImage(final Object element) { + Image image; + if (element instanceof EReferenceTreeElement) { + final EReferenceTreeElement treeElement = (EReferenceTreeElement) element; + final EObjectTreeElement parent = (EObjectTreeElement) treeElement.getParent(); + image = this.delegate.getImage(parent.getEObject(), treeElement.getEReference()); + } else if (element instanceof EAttributeTreeElement) { + final EAttributeTreeElement treeElement = (EAttributeTreeElement) element; + final EObjectTreeElement parent = (EObjectTreeElement) treeElement.getParent(); + image = this.delegate.getImage(parent.getEObject(), treeElement.getEAttribute()); + } else { + image = this.delegate.getImage(CustomizedContentProviderUtils.resolve(element)); + } + return image; + } + + public String getText(final Object element) { + String result; + if (element instanceof EReferenceTreeElement) { + final EReferenceTreeElement treeElement = (EReferenceTreeElement) element; + final EObjectTreeElement parent = (EObjectTreeElement) treeElement.getParent(); + result = this.delegate.getText(parent.getEObject(), treeElement.getEReference()); + } else if (element instanceof EAttributeTreeElement) { + final EAttributeTreeElement treeElement = (EAttributeTreeElement) element; + final EObjectTreeElement parent = (EObjectTreeElement) treeElement.getParent(); + result = this.delegate.getText(parent.getEObject(), treeElement.getEAttribute()); + } else { + result = this.delegate.getText(CustomizedContentProviderUtils.resolve(element)); + } + return result; + } + + public void addListener(final ILabelProviderListener listener) { + this.delegate.addListener(listener); + } + + public void dispose() { + this.delegate.dispose(); + } + + public boolean isLabelProperty(final Object element, final String property) { + return this.delegate.isLabelProperty(CustomizedContentProviderUtils.resolve(element), property); + } + + public void removeListener(final ILabelProviderListener listener) { + this.delegate.removeListener(listener); + } + + public Color getForeground(final Object element) { + return this.delegate.getForeground(CustomizedContentProviderUtils.resolve(element)); + } + + public Color getBackground(final Object element) { + return this.delegate.getBackground(CustomizedContentProviderUtils.resolve(element)); + } + + public Font getFont(final Object element) { + return this.delegate.getFont(CustomizedContentProviderUtils.resolve(element)); + } + + public void update(final ViewerCell cell) { + this.delegate.update(cell); + } + + public String getToolTipText(final Object element, final ETypedElement eTypedElement) { + String result; + if (element instanceof EReferenceTreeElement) { + final EReferenceTreeElement treeElement = (EReferenceTreeElement) element; + final EObjectTreeElement parent = (EObjectTreeElement) treeElement.getParent(); + result = this.delegate.getToolTipText(parent.getEObject(), treeElement.getEReference()); + } else if (element instanceof EAttributeTreeElement) { + final EAttributeTreeElement treeElement = (EAttributeTreeElement) element; + final EObjectTreeElement parent = (EObjectTreeElement) treeElement.getParent(); + result = this.delegate.getToolTipText(parent.getEObject(), treeElement.getEAttribute()); + } else { + result = this.delegate.getToolTipText(CustomizedContentProviderUtils.resolve(element), eTypedElement); + } + return result; + } + + public Image getToolTipImage(final Object element, final ETypedElement eTypedElement) { + Image result; + if (element instanceof EReferenceTreeElement) { + final EReferenceTreeElement treeElement = (EReferenceTreeElement) element; + final EObjectTreeElement parent = (EObjectTreeElement) treeElement.getParent(); + result = this.delegate.getToolTipImage(parent.getEObject(), treeElement.getEReference()); + } else if (element instanceof EAttributeTreeElement) { + final EAttributeTreeElement treeElement = (EAttributeTreeElement) element; + final EObjectTreeElement parent = (EObjectTreeElement) treeElement.getParent(); + result = this.delegate.getToolTipImage(parent.getEObject(), treeElement.getEAttribute()); + } else { + result = this.delegate.getToolTipImage(CustomizedContentProviderUtils.resolve(element), eTypedElement); + } + return result; + } + + public Font getToolTipFont(final Object element, final ETypedElement eTypedElement) { + Font result; + if (element instanceof EReferenceTreeElement) { + final EReferenceTreeElement treeElement = (EReferenceTreeElement) element; + final EObjectTreeElement parent = (EObjectTreeElement) treeElement.getParent(); + result = this.delegate.getToolTipFont(parent.getEObject(), treeElement.getEReference()); + } else if (element instanceof EAttributeTreeElement) { + final EAttributeTreeElement treeElement = (EAttributeTreeElement) element; + final EObjectTreeElement parent = (EObjectTreeElement) treeElement.getParent(); + result = this.delegate.getToolTipFont(parent.getEObject(), treeElement.getEAttribute()); + } else { + result = this.delegate.getToolTipFont(CustomizedContentProviderUtils.resolve(element), eTypedElement); + } + return result; + } + + public Color getToolTipBackgroundColor(final Object element, final ETypedElement eTypedElement) { + Color result; + if (element instanceof EReferenceTreeElement) { + final EReferenceTreeElement treeElement = (EReferenceTreeElement) element; + final EObjectTreeElement parent = (EObjectTreeElement) treeElement.getParent(); + result = this.delegate.getToolTipBackgroundColor(parent.getEObject(), treeElement.getEReference()); + } else if (element instanceof EAttributeTreeElement) { + final EAttributeTreeElement treeElement = (EAttributeTreeElement) element; + final EObjectTreeElement parent = (EObjectTreeElement) treeElement.getParent(); + result = this.delegate.getToolTipBackgroundColor(parent.getEObject(), treeElement.getEAttribute()); + } else { + result = this.delegate.getToolTipBackgroundColor(CustomizedContentProviderUtils.resolve(element), eTypedElement); + } + return result; + } + + public Color getToolTipForegroundColor(final Object element, final ETypedElement eTypedElement) { + Color result; + if (element instanceof EReferenceTreeElement) { + final EReferenceTreeElement treeElement = (EReferenceTreeElement) element; + final EObjectTreeElement parent = (EObjectTreeElement) treeElement.getParent(); + result = this.delegate.getToolTipForegroundColor(parent.getEObject(), treeElement.getEReference()); + } else if (element instanceof EAttributeTreeElement) { + final EAttributeTreeElement treeElement = (EAttributeTreeElement) element; + final EObjectTreeElement parent = (EObjectTreeElement) treeElement.getParent(); + result = this.delegate.getToolTipForegroundColor(parent.getEObject(), treeElement.getEAttribute()); + } else { + result = this.delegate.getToolTipForegroundColor(CustomizedContentProviderUtils.resolve(element), eTypedElement); + } + return result; + } + + public Image getToolTipTopLeftOverlay(final Object element, final ETypedElement eTypedElement) { + Image result; + if (element instanceof EReferenceTreeElement) { + final EReferenceTreeElement treeElement = (EReferenceTreeElement) element; + final EObjectTreeElement parent = (EObjectTreeElement) treeElement.getParent(); + result = this.delegate.getToolTipTopLeftOverlay(parent.getEObject(), treeElement.getEReference()); + } else if (element instanceof EAttributeTreeElement) { + final EAttributeTreeElement treeElement = (EAttributeTreeElement) element; + final EObjectTreeElement parent = (EObjectTreeElement) treeElement.getParent(); + result = this.delegate.getToolTipTopLeftOverlay(parent.getEObject(), treeElement.getEAttribute()); + } else { + result = this.delegate.getToolTipTopLeftOverlay(CustomizedContentProviderUtils.resolve(element), eTypedElement); + } + return result; + } + + public Image getToolTipTopMiddleOverlay(final Object element, final ETypedElement eTypedElement) { + Image result; + if (element instanceof EReferenceTreeElement) { + final EReferenceTreeElement treeElement = (EReferenceTreeElement) element; + final EObjectTreeElement parent = (EObjectTreeElement) treeElement.getParent(); + result = this.delegate.getToolTipTopMiddleOverlay(parent.getEObject(), treeElement.getEReference()); + } else if (element instanceof EAttributeTreeElement) { + final EAttributeTreeElement treeElement = (EAttributeTreeElement) element; + final EObjectTreeElement parent = (EObjectTreeElement) treeElement.getParent(); + result = this.delegate.getToolTipTopMiddleOverlay(parent.getEObject(), treeElement.getEAttribute()); + } else { + result = this.delegate.getToolTipTopMiddleOverlay(CustomizedContentProviderUtils.resolve(element), eTypedElement); + } + return result; + } + + public Image getToolTipTopRightOverlay(final Object element, final ETypedElement eTypedElement) { + Image result; + if (element instanceof EReferenceTreeElement) { + final EReferenceTreeElement treeElement = (EReferenceTreeElement) element; + final EObjectTreeElement parent = (EObjectTreeElement) treeElement.getParent(); + result = this.delegate.getToolTipTopRightOverlay(parent.getEObject(), treeElement.getEReference()); + } else if (element instanceof EAttributeTreeElement) { + final EAttributeTreeElement treeElement = (EAttributeTreeElement) element; + final EObjectTreeElement parent = (EObjectTreeElement) treeElement.getParent(); + result = this.delegate.getToolTipTopRightOverlay(parent.getEObject(), treeElement.getEAttribute()); + } else { + result = this.delegate.getToolTipTopRightOverlay(CustomizedContentProviderUtils.resolve(element), eTypedElement); + } + return result; + } + + public Image getToolTipBottomLeftOverlay(final Object element, final ETypedElement eTypedElement) { + Image result; + if (element instanceof EReferenceTreeElement) { + final EReferenceTreeElement treeElement = (EReferenceTreeElement) element; + final EObjectTreeElement parent = (EObjectTreeElement) treeElement.getParent(); + result = this.delegate.getToolTipBottomLeftOverlay(parent.getEObject(), treeElement.getEReference()); + } else if (element instanceof EAttributeTreeElement) { + final EAttributeTreeElement treeElement = (EAttributeTreeElement) element; + final EObjectTreeElement parent = (EObjectTreeElement) treeElement.getParent(); + result = this.delegate.getToolTipBottomLeftOverlay(parent.getEObject(), treeElement.getEAttribute()); + } else { + result = this.delegate.getToolTipBottomLeftOverlay(CustomizedContentProviderUtils.resolve(element), eTypedElement); + } + return result; + } + + public Image getToolTipBottomMiddleOverlay(final Object element, final ETypedElement eTypedElement) { + Image result; + if (element instanceof EReferenceTreeElement) { + final EReferenceTreeElement treeElement = (EReferenceTreeElement) element; + final EObjectTreeElement parent = (EObjectTreeElement) treeElement.getParent(); + result = this.delegate.getToolTipBottomMiddleOverlay(parent.getEObject(), treeElement.getEReference()); + } else if (element instanceof EAttributeTreeElement) { + final EAttributeTreeElement treeElement = (EAttributeTreeElement) element; + final EObjectTreeElement parent = (EObjectTreeElement) treeElement.getParent(); + result = this.delegate.getToolTipBottomMiddleOverlay(parent.getEObject(), treeElement.getEAttribute()); + } else { + result = this.delegate.getToolTipBottomMiddleOverlay(CustomizedContentProviderUtils.resolve(element), eTypedElement); + } + return result; + } + + public Image getToolTipBottomRightOverlay(final Object element, final ETypedElement eTypedElement) { + Image result; + if (element instanceof EReferenceTreeElement) { + final EReferenceTreeElement treeElement = (EReferenceTreeElement) element; + final EObjectTreeElement parent = (EObjectTreeElement) treeElement.getParent(); + result = this.delegate.getToolTipBottomRightOverlay(parent.getEObject(), treeElement.getEReference()); + } else if (element instanceof EAttributeTreeElement) { + final EAttributeTreeElement treeElement = (EAttributeTreeElement) element; + final EObjectTreeElement parent = (EObjectTreeElement) treeElement.getParent(); + result = this.delegate.getToolTipBottomRightOverlay(parent.getEObject(), treeElement.getEAttribute()); + } else { + result = this.delegate.getToolTipBottomRightOverlay(CustomizedContentProviderUtils.resolve(element), eTypedElement); + } + return result; + } + + public int getToolTipTimeDisplayed(final Object element, final ETypedElement eTypedElement) { + int result; + if (element instanceof EReferenceTreeElement) { + final EReferenceTreeElement treeElement = (EReferenceTreeElement) element; + final EObjectTreeElement parent = (EObjectTreeElement) treeElement.getParent(); + result = this.delegate.getToolTipTimeDisplayed(parent.getEObject(), treeElement.getEReference()); + } else if (element instanceof EAttributeTreeElement) { + final EAttributeTreeElement treeElement = (EAttributeTreeElement) element; + final EObjectTreeElement parent = (EObjectTreeElement) treeElement.getParent(); + result = this.delegate.getToolTipTimeDisplayed(parent.getEObject(), treeElement.getEAttribute()); + } else { + result = this.delegate.getToolTipTimeDisplayed(CustomizedContentProviderUtils.resolve(element), eTypedElement); + } + return result; + } + + public int getToolTipDisplayDelayTime(final Object element, final ETypedElement eTypedElement) { + int result; + if (element instanceof EReferenceTreeElement) { + final EReferenceTreeElement treeElement = (EReferenceTreeElement) element; + final EObjectTreeElement parent = (EObjectTreeElement) treeElement.getParent(); + result = this.delegate.getToolTipDisplayDelayTime(parent.getEObject(), treeElement.getEReference()); + } else if (element instanceof EAttributeTreeElement) { + final EAttributeTreeElement treeElement = (EAttributeTreeElement) element; + final EObjectTreeElement parent = (EObjectTreeElement) treeElement.getParent(); + result = this.delegate.getToolTipDisplayDelayTime(parent.getEObject(), treeElement.getEAttribute()); + } else { + result = this.delegate.getToolTipDisplayDelayTime(CustomizedContentProviderUtils.resolve(element), eTypedElement); + } + return result; + } + + public int getToolTipStyle(final Object element, final ETypedElement eTypedElement) { + int result; + if (element instanceof EReferenceTreeElement) { + final EReferenceTreeElement treeElement = (EReferenceTreeElement) element; + final EObjectTreeElement parent = (EObjectTreeElement) treeElement.getParent(); + result = this.delegate.getToolTipStyle(parent.getEObject(), treeElement.getEReference()); + } else if (element instanceof EAttributeTreeElement) { + final EAttributeTreeElement treeElement = (EAttributeTreeElement) element; + final EObjectTreeElement parent = (EObjectTreeElement) treeElement.getParent(); + result = this.delegate.getToolTipStyle(parent.getEObject(), treeElement.getEAttribute()); + } else { + result = this.delegate.getToolTipStyle(CustomizedContentProviderUtils.resolve(element), eTypedElement); + } + return result; + } + + public ICustomizationManager getCustomizationManager() { + return this.delegate.getCustomizationManager(); + } + + public boolean isUnderlined(final Object element, final ETypedElement eTypedElement) { + boolean result; + if (element instanceof EReferenceTreeElement) { + final EReferenceTreeElement treeElement = (EReferenceTreeElement) element; + final EObjectTreeElement parent = (EObjectTreeElement) treeElement.getParent(); + result = this.delegate.isUnderlined(parent.getEObject(), treeElement.getEReference()); + } else if (element instanceof EAttributeTreeElement) { + final EAttributeTreeElement treeElement = (EAttributeTreeElement) element; + final EObjectTreeElement parent = (EObjectTreeElement) treeElement.getParent(); + result = this.delegate.isUnderlined(parent.getEObject(), treeElement.getEAttribute()); + } else { + result = this.delegate.isUnderlined(CustomizedContentProviderUtils.resolve(element), eTypedElement); + } + return result; + } + + public boolean isStruckthrough(final Object element, final ETypedElement eTypedElement) { + boolean result; + if (element instanceof EReferenceTreeElement) { + final EReferenceTreeElement treeElement = (EReferenceTreeElement) element; + final EObjectTreeElement parent = (EObjectTreeElement) treeElement.getParent(); + result = this.delegate.isStruckthrough(parent.getEObject(), treeElement.getEReference()); + } else if (element instanceof EAttributeTreeElement) { + final EAttributeTreeElement treeElement = (EAttributeTreeElement) element; + final EObjectTreeElement parent = (EObjectTreeElement) treeElement.getParent(); + result = this.delegate.isStruckthrough(parent.getEObject(), treeElement.getEAttribute()); + } else { + result = this.delegate.isStruckthrough(CustomizedContentProviderUtils.resolve(element), eTypedElement); + } + return result; + } + + public Image getTopLeftOverlay(final Object element, final ETypedElement eTypedElement) { + Image result; + if (element instanceof EReferenceTreeElement) { + final EReferenceTreeElement treeElement = (EReferenceTreeElement) element; + final EObjectTreeElement parent = (EObjectTreeElement) treeElement.getParent(); + result = this.delegate.getTopLeftOverlay(parent.getEObject(), treeElement.getEReference()); + } else if (element instanceof EAttributeTreeElement) { + final EAttributeTreeElement treeElement = (EAttributeTreeElement) element; + final EObjectTreeElement parent = (EObjectTreeElement) treeElement.getParent(); + result = this.delegate.getTopLeftOverlay(parent.getEObject(), treeElement.getEAttribute()); + } else { + result = this.delegate.getTopLeftOverlay(CustomizedContentProviderUtils.resolve(element), eTypedElement); + } + return result; + } + + public Image getTopMiddleOverlay(final Object element, final ETypedElement eTypedElement) { + Image result; + if (element instanceof EReferenceTreeElement) { + final EReferenceTreeElement treeElement = (EReferenceTreeElement) element; + final EObjectTreeElement parent = (EObjectTreeElement) treeElement.getParent(); + result = this.delegate.getTopMiddleOverlay(parent.getEObject(), treeElement.getEReference()); + } else if (element instanceof EAttributeTreeElement) { + final EAttributeTreeElement treeElement = (EAttributeTreeElement) element; + final EObjectTreeElement parent = (EObjectTreeElement) treeElement.getParent(); + result = this.delegate.getTopMiddleOverlay(parent.getEObject(), treeElement.getEAttribute()); + } else { + result = this.delegate.getTopMiddleOverlay(CustomizedContentProviderUtils.resolve(element), eTypedElement); + } + return result; + } + + public Image getTopRightOverlay(final Object element, final ETypedElement eTypedElement) { + Image result; + if (element instanceof EReferenceTreeElement) { + final EReferenceTreeElement treeElement = (EReferenceTreeElement) element; + final EObjectTreeElement parent = (EObjectTreeElement) treeElement.getParent(); + result = this.delegate.getTopRightOverlay(parent.getEObject(), treeElement.getEReference()); + } else if (element instanceof EAttributeTreeElement) { + final EAttributeTreeElement treeElement = (EAttributeTreeElement) element; + final EObjectTreeElement parent = (EObjectTreeElement) treeElement.getParent(); + result = this.delegate.getTopRightOverlay(parent.getEObject(), treeElement.getEAttribute()); + } else { + result = this.delegate.getTopRightOverlay(CustomizedContentProviderUtils.resolve(element), eTypedElement); + } + return result; + } + + public Image getBottomLeftOverlay(final Object element, final ETypedElement eTypedElement) { + Image result; + if (element instanceof EReferenceTreeElement) { + final EReferenceTreeElement treeElement = (EReferenceTreeElement) element; + final EObjectTreeElement parent = (EObjectTreeElement) treeElement.getParent(); + result = this.delegate.getBottomLeftOverlay(parent.getEObject(), treeElement.getEReference()); + } else if (element instanceof EAttributeTreeElement) { + final EAttributeTreeElement treeElement = (EAttributeTreeElement) element; + final EObjectTreeElement parent = (EObjectTreeElement) treeElement.getParent(); + result = this.delegate.getBottomLeftOverlay(parent.getEObject(), treeElement.getEAttribute()); + } else { + result = this.delegate.getBottomLeftOverlay(CustomizedContentProviderUtils.resolve(element), eTypedElement); + } + return result; + } + + public Image getBottomMiddleOverlay(final Object element, final ETypedElement eTypedElement) { + Image result; + if (element instanceof EReferenceTreeElement) { + final EReferenceTreeElement treeElement = (EReferenceTreeElement) element; + final EObjectTreeElement parent = (EObjectTreeElement) treeElement.getParent(); + result = this.delegate.getBottomMiddleOverlay(parent.getEObject(), treeElement.getEReference()); + } else if (element instanceof EAttributeTreeElement) { + final EAttributeTreeElement treeElement = (EAttributeTreeElement) element; + final EObjectTreeElement parent = (EObjectTreeElement) treeElement.getParent(); + result = this.delegate.getBottomMiddleOverlay(parent.getEObject(), treeElement.getEAttribute()); + } else { + result = this.delegate.getBottomMiddleOverlay(CustomizedContentProviderUtils.resolve(element), eTypedElement); + } + return result; + } + + public Image getBottomRightOverlay(final Object element, final ETypedElement eTypedElement) { + Image result; + if (element instanceof EReferenceTreeElement) { + final EReferenceTreeElement treeElement = (EReferenceTreeElement) element; + final EObjectTreeElement parent = (EObjectTreeElement) treeElement.getParent(); + result = this.delegate.getBottomRightOverlay(parent.getEObject(), treeElement.getEReference()); + } else if (element instanceof EAttributeTreeElement) { + final EAttributeTreeElement treeElement = (EAttributeTreeElement) element; + final EObjectTreeElement parent = (EObjectTreeElement) treeElement.getParent(); + result = this.delegate.getBottomRightOverlay(parent.getEObject(), treeElement.getEAttribute()); + } else { + result = this.delegate.getBottomRightOverlay(CustomizedContentProviderUtils.resolve(element), eTypedElement); + } + return result; + } + + public String getText(final Object element, final ETypedElement eTypedElement) { + String result; + if (element instanceof EReferenceTreeElement) { + final EReferenceTreeElement treeElement = (EReferenceTreeElement) element; + final EObjectTreeElement parent = (EObjectTreeElement) treeElement.getParent(); + result = this.delegate.getText(parent.getEObject(), treeElement.getEReference()); + } else if (element instanceof EAttributeTreeElement) { + final EAttributeTreeElement treeElement = (EAttributeTreeElement) element; + final EObjectTreeElement parent = (EObjectTreeElement) treeElement.getParent(); + result = this.delegate.getText(parent.getEObject(), treeElement.getEAttribute()); + } else { + result = this.delegate.getText(CustomizedContentProviderUtils.resolve(element), eTypedElement); + } + return result; + } + + public Image getImage(final Object element, final ETypedElement eTypedElement) { + Image result; + if (element instanceof EReferenceTreeElement) { + final EReferenceTreeElement treeElement = (EReferenceTreeElement) element; + final EObjectTreeElement parent = (EObjectTreeElement) treeElement.getParent(); + result = this.delegate.getImage(parent.getEObject(), treeElement.getEReference()); + } else if (element instanceof EAttributeTreeElement) { + final EAttributeTreeElement treeElement = (EAttributeTreeElement) element; + final EObjectTreeElement parent = (EObjectTreeElement) treeElement.getParent(); + result = this.delegate.getImage(parent.getEObject(), treeElement.getEAttribute()); + } else { + result = this.delegate.getImage(CustomizedContentProviderUtils.resolve(element), eTypedElement); + } + return result; + } + + public ICustomizedLabelProvider cloneLabelProvider() { + return new ResolvingCustomizedLabelProvider(this.delegate.cloneLabelProvider()); + } + + public Color getBackground(final Object element, + final ETypedElement eTypedElement) { + return this.delegate.getBackground( + CustomizedContentProviderUtils.resolve(element), eTypedElement); + } + +}
diff --git a/org.eclipse.modisco.facet.custom.ui/src/org/eclipse/modisco/facet/custom/ui/internal/ResolvingCustomizedLabelProviderFactory.java b/org.eclipse.modisco.facet.custom.ui/src/org/eclipse/modisco/facet/custom/ui/internal/ResolvingCustomizedLabelProviderFactory.java new file mode 100644 index 0000000..8ec6d7c --- /dev/null +++ b/org.eclipse.modisco.facet.custom.ui/src/org/eclipse/modisco/facet/custom/ui/internal/ResolvingCustomizedLabelProviderFactory.java
@@ -0,0 +1,26 @@ +/******************************************************************************* + * Copyright (c) 2012 Mia-Software. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Nicolas Bros (Mia-Software) - Bug 379683 - customizable Tree content provider + * David Couvrand (Soft-Maint) - Bug 418418 - [Customization] Overlay icons not implemented + *******************************************************************************/ +package org.eclipse.modisco.facet.custom.ui.internal; + +import org.eclipse.modisco.facet.custom.core.ICustomizationManager; +import org.eclipse.modisco.facet.custom.ui.ICustomizedLabelProvider; +import org.eclipse.modisco.facet.custom.ui.IResolvingCustomizedLabelProviderFactory; + +public class ResolvingCustomizedLabelProviderFactory implements IResolvingCustomizedLabelProviderFactory { + + public ICustomizedLabelProvider createCustomizedLabelProvider(final ICustomizationManager customManager) { + return new ResolvingCustomizedLabelProvider( + new DecoratingCustomizedLabelProvider( + customManager)); + } + +}
diff --git a/org.eclipse.modisco.facet.custom.ui/src/org/eclipse/modisco/facet/custom/ui/internal/TreeElementAdapter.java b/org.eclipse.modisco.facet.custom.ui/src/org/eclipse/modisco/facet/custom/ui/internal/TreeElementAdapter.java new file mode 100644 index 0000000..8c063e8 --- /dev/null +++ b/org.eclipse.modisco.facet.custom.ui/src/org/eclipse/modisco/facet/custom/ui/internal/TreeElementAdapter.java
@@ -0,0 +1,124 @@ +/******************************************************************************* + * Copyright (c) 2012, 2016 Mia-Software. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Gregoire Dupe (Mia-Software) - Bug 386387 - [CustomizedTreeContentProvider] The TreeElements are not preserved between two calls to getElements() + * Gregoire Dupe (Mia-Software) - Bug 441570 - Children custom property + * Grégoire Dupé (Mia-Software) - Bug 506334 - Need to know which TreeElement has been updated + * Grégoire Dupé (Mia-Software) - Bug 506930 - Proxy resolution break the CustomizedTreeContentProvider + *******************************************************************************/ +package org.eclipse.modisco.facet.custom.ui.internal; + +import org.eclipse.emf.common.notify.Adapter; +import org.eclipse.emf.common.notify.Notification; +import org.eclipse.emf.common.notify.Notifier; +import org.eclipse.emf.common.util.EList; +import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.ecore.EStructuralFeature; +import org.eclipse.modisco.facet.custom.metamodel.v0_2_0.internal.treeproxy.EAttributeTreeElement; +import org.eclipse.modisco.facet.custom.metamodel.v0_2_0.internal.treeproxy.EObjectTreeElement; +import org.eclipse.modisco.facet.custom.metamodel.v0_2_0.internal.treeproxy.EReferenceTreeElement; +import org.eclipse.modisco.facet.custom.metamodel.v0_2_0.internal.treeproxy.TreeElement; +import org.eclipse.modisco.facet.custom.ui.ICustomizedContentProviderFactory.IContentListener; +import org.eclipse.modisco.facet.custom.ui.internal.exception.CustomizedContentProviderRuntimeException; +import org.eclipse.modisco.facet.util.core.DebugUtils; +import org.eclipse.osgi.util.NLS; + +public class TreeElementAdapter implements Adapter { + + private static final boolean DEBUG = DebugUtils.getDebugStatus(Activator + .getDefault()); + + private final EObjectTreeElement treeElement; + private final IContentListener contentListener; + private Notifier target; + + public TreeElementAdapter(final EObjectTreeElement treeElement, + final IContentListener contentListener) { + this.treeElement = treeElement; + this.contentListener = contentListener; + } + + public void notifyChanged(final Notification notification) { + DebugUtils.debug(DEBUG, + "Modified element=" + this.treeElement.getEObject()); //$NON-NLS-1$ + DebugUtils.debug(DEBUG, + "Notification feature=" + notification.getFeature()); //$NON-NLS-1$ + for (TreeElement subElement : this.treeElement.getChildren()) { + final EStructuralFeature feature = getSF(subElement); + if (feature.equals(notification.getFeature())) { + if (notification.getEventType() == Notification.RESOLVE) { + final EObjectTreeElement toBeChanged = findWrapperOf( + subElement.getChildren(), + notification.getOldValue()); + if (toBeChanged != null) { + toBeChanged.setEObject( + (EObject) notification.getNewValue()); + } + } else { + subElement.getChildren().clear(); + } + DebugUtils.debug( + DEBUG, + NLS.bind( + "Cleanning= {0}::{1}", //$NON-NLS-1$ + feature.getContainerClass().getName(), + feature.getName())); + this.contentListener.onUpdate(this.treeElement); + } + } + } + + private static EObjectTreeElement findWrapperOf(final EList<TreeElement> children, + final Object oldValue) { + EObjectTreeElement result = null; + for (TreeElement child : children) { + if (child instanceof EObjectTreeElement) { + EObjectTreeElement eObjChild = (EObjectTreeElement) child; + if (eObjChild.getEObject() == oldValue) { + result = eObjChild; + break; + } + } + } + return result; + } + + private static EStructuralFeature getSF(final TreeElement structFeatuteTE) { + EStructuralFeature result; + if (structFeatuteTE instanceof EAttributeTreeElement) { + final EAttributeTreeElement eAttributeTE = (EAttributeTreeElement) structFeatuteTE; + result = eAttributeTE.getEAttribute(); + } else if (structFeatuteTE instanceof EReferenceTreeElement) { + final EReferenceTreeElement eReferenceTE = (EReferenceTreeElement) structFeatuteTE; + result = eReferenceTE.getEReference(); + } else { + throw new CustomizedContentProviderRuntimeException( + "Illegal agrument: " + structFeatuteTE); //$NON-NLS-1$ + } + return result; + } + + public Notifier getTarget() { + return this.target; + } + + public void setTarget(final Notifier newTarget) { + if (newTarget != null) { + this.target = newTarget; + } + } + + public boolean isAdapterForType(final Object type) { + return false; + } + + public EObjectTreeElement getTreeElement() { + return this.treeElement; + } + +}
diff --git a/org.eclipse.modisco.facet.custom.ui/src/org/eclipse/modisco/facet/custom/ui/internal/action/ShortcutCustomAction.java b/org.eclipse.modisco.facet.custom.ui/src/org/eclipse/modisco/facet/custom/ui/internal/action/ShortcutCustomAction.java new file mode 100644 index 0000000..6771ae4 --- /dev/null +++ b/org.eclipse.modisco.facet.custom.ui/src/org/eclipse/modisco/facet/custom/ui/internal/action/ShortcutCustomAction.java
@@ -0,0 +1,60 @@ +/******************************************************************************* + * Copyright (c) 2015 Mia-Software + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Thomas Cicognani (Mia-Software) - Bug 472075 - Update API to create UI shortcuts to activate FacetSets + *******************************************************************************/ +package org.eclipse.modisco.facet.custom.ui.internal.action; + +import java.util.HashSet; +import java.util.List; +import java.util.Set; + +import org.eclipse.emf.ecore.resource.ResourceSet; +import org.eclipse.jface.action.Action; +import org.eclipse.jface.resource.ImageDescriptor; +import org.eclipse.modisco.facet.custom.core.ICustomizationCatalogManager; +import org.eclipse.modisco.facet.custom.core.ICustomizationCatalogManagerFactory; +import org.eclipse.modisco.facet.custom.core.ICustomizationManager; +import org.eclipse.modisco.facet.custom.metamodel.v0_2_0.custom.Customization; +import org.eclipse.modisco.facet.efacet.ui.FacetSetShortcutActionUtils; + +public class ShortcutCustomAction extends Action { + + private final String actionId; + private final ICustomizationManager customManager; + + public ShortcutCustomAction(final String actionId, final String label, + final ImageDescriptor imageDescriptor, + final ICustomizationManager customManager) { + super(label, AS_CHECK_BOX); + this.actionId = actionId; + this.customManager = customManager; + FacetSetShortcutActionUtils.setImageDescriptor(this, imageDescriptor); + } + + @Override + public void run() { + FacetSetShortcutActionUtils.runAction(this, this.actionId, + getAvailableFacetSets(), getAppliedFacetSets()); + } + + private Set<Customization> getAvailableFacetSets() { + final ResourceSet resourceSet = this.customManager.getResourceSet(); + final ICustomizationCatalogManager catalog = ICustomizationCatalogManagerFactory.DEFAULT + .getOrCreateCustomizationCatalogManager(resourceSet); + final Set<Customization> availableCustoms = new HashSet<Customization>(); + availableCustoms.addAll(catalog.getRegisteredCustomizations()); + availableCustoms.addAll(this.customManager.getManagedCustomizations()); + return availableCustoms; + } + + private List<Customization> getAppliedFacetSets() { + return this.customManager.getManagedCustomizations(); + } + +}
diff --git a/org.eclipse.modisco.facet.custom.ui/src/org/eclipse/modisco/facet/custom/ui/internal/custompt/Color.java b/org.eclipse.modisco.facet.custom.ui/src/org/eclipse/modisco/facet/custom/ui/internal/custompt/Color.java new file mode 100644 index 0000000..8d7bd08 --- /dev/null +++ b/org.eclipse.modisco.facet.custom.ui/src/org/eclipse/modisco/facet/custom/ui/internal/custompt/Color.java
@@ -0,0 +1,67 @@ +/** + * Copyright (c) 2012 Mia-Software. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Gregoire Dupe (Mia-Software) - Bug 361794 - [Restructuring] New customization meta-model + */ +package org.eclipse.modisco.facet.custom.ui.internal.custompt; + +import org.eclipse.modisco.facet.custom.metamodel.custompt.IColor; + +public class Color implements IColor { + + private static final long serialVersionUID = 240076770346261769L; + private static final int BYTE_SIZE = Byte.SIZE; + private static final int TWO_BYTE_SIZE = Byte.SIZE * 2; + public static final int MAX_VALUE = 255; + + private final int red; + private final int green; + private final int blue; + + public Color(final int red, final int green, final int blue) { + this.red = red; + this.green = green; + this.blue = blue; + } + + public Color getColor() { + return this.getColor(); + } + + public int getRed() { + return this.red; + } + + public int getGreen() { + return this.green; + } + + public int getBlue() { + return this.blue; + } + + @Override + public boolean equals(final Object obj) { + boolean result = false; + if (obj instanceof Color) { + final Color color = (Color) obj; + result = (color.getRed() == this.red) + && (color.getGreen() == this.green) + && (color.getBlue() == this.blue); + } + return result; + } + + @Override + public int hashCode() { + return this.red & (this.green << Color.BYTE_SIZE) + & (this.blue << Color.TWO_BYTE_SIZE); + } + +}
diff --git a/org.eclipse.modisco.facet.custom.ui/src/org/eclipse/modisco/facet/custom/ui/internal/custompt/ImageWrapper.java b/org.eclipse.modisco.facet.custom.ui/src/org/eclipse/modisco/facet/custom/ui/internal/custompt/ImageWrapper.java new file mode 100644 index 0000000..89b6b3a --- /dev/null +++ b/org.eclipse.modisco.facet.custom.ui/src/org/eclipse/modisco/facet/custom/ui/internal/custompt/ImageWrapper.java
@@ -0,0 +1,48 @@ +/** + * Copyright (c) 2012 Mia-Software. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Gregoire Dupe (Mia-Software) - Bug 361794 - [Restructuring] New customization meta-model + * Nicolas Bros (Mia-Software) - Bug 374941 - To be able to customize overlay icons on EClass + */ +package org.eclipse.modisco.facet.custom.ui.internal.custompt; + +import java.io.ByteArrayInputStream; +import java.io.ByteArrayOutputStream; +import java.io.InputStream; + +import org.eclipse.modisco.facet.custom.metamodel.custompt.IImage; +import org.eclipse.swt.SWT; +import org.eclipse.swt.graphics.Image; +import org.eclipse.swt.graphics.ImageData; +import org.eclipse.swt.graphics.ImageLoader; + +public class ImageWrapper implements IImage { + + private static final long serialVersionUID = -2538802017710069448L; + private final Image wrappedImage; + + public ImageWrapper(final Image image) { + this.wrappedImage = image; + } + + public InputStream getInputStream() { + // note: this is an inefficient way to get an inputStream from the wrapped Image + final ByteArrayOutputStream stream = new ByteArrayOutputStream(); + final ImageLoader loader = new ImageLoader(); + loader.data = new ImageData[] { this.wrappedImage.getImageData() }; + loader.save(stream, SWT.IMAGE_PNG); + final byte[] byteArray = stream.toByteArray(); + return new ByteArrayInputStream(byteArray); + } + + public Image getImage() { + return this.wrappedImage; + } + +}
diff --git a/org.eclipse.modisco.facet.custom.ui/src/org/eclipse/modisco/facet/custom/ui/internal/custompt/URIImage.java b/org.eclipse.modisco.facet.custom.ui/src/org/eclipse/modisco/facet/custom/ui/internal/custompt/URIImage.java new file mode 100644 index 0000000..40bce00 --- /dev/null +++ b/org.eclipse.modisco.facet.custom.ui/src/org/eclipse/modisco/facet/custom/ui/internal/custompt/URIImage.java
@@ -0,0 +1,40 @@ +/** + * Copyright (c) 2013 Soft-Maint. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * David Couvrand (Soft-Maint) - Bug 402725 - Need a query to get an image from an URI + * Nicolas Rault (Soft-Maint) - Bug 402725 - Need a query to get an image from an URI + */ +package org.eclipse.modisco.facet.custom.ui.internal.custompt; + +import java.io.InputStream; + +import org.eclipse.modisco.facet.custom.metamodel.custompt.IImage; + +public class URIImage implements IImage { + + private static final long serialVersionUID = 6801140731857137834L; + private String uri; + + public URIImage(final String uri) { + this.uri = uri; + } + + public InputStream getInputStream() { + return null; + } + + public String getUri() { + return this.uri; + } + + public void setUri(final String uri) { + this.uri = uri; + } + +}
diff --git a/org.eclipse.modisco.facet.custom.ui/src/org/eclipse/modisco/facet/custom/ui/internal/dialog/ColorLabelProvider.java b/org.eclipse.modisco.facet.custom.ui/src/org/eclipse/modisco/facet/custom/ui/internal/dialog/ColorLabelProvider.java new file mode 100644 index 0000000..32c25ff --- /dev/null +++ b/org.eclipse.modisco.facet.custom.ui/src/org/eclipse/modisco/facet/custom/ui/internal/dialog/ColorLabelProvider.java
@@ -0,0 +1,66 @@ +/** + * Copyright (c) 2012, 2015 Mia-Software. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Grégoire Dupé (Mia-Software) - Bug 369987 - [Restructuring][Table] Switch to the new customization and facet framework + * Grégoire Dupé (Mia-Software) - Bug 472747 - The customization loading dialog is not easily readable + */ +package org.eclipse.modisco.facet.custom.ui.internal.dialog; + +import org.eclipse.jface.viewers.IColorProvider; +import org.eclipse.jface.viewers.LabelProvider; +import org.eclipse.modisco.facet.custom.metamodel.v0_2_0.custom.Customization; +import org.eclipse.modisco.facet.custom.ui.internal.ImageProvider; +import org.eclipse.swt.SWT; +import org.eclipse.swt.graphics.Color; +import org.eclipse.swt.graphics.Image; +import org.eclipse.swt.widgets.Display; + +public class ColorLabelProvider extends LabelProvider implements IColorProvider { + + private final LoadCustomizationsDialog<?> loadCustomDialog; + + public ColorLabelProvider(final LoadCustomizationsDialog<?> loadCustomDialog) { + super(); + this.loadCustomDialog = loadCustomDialog; + } + + @Override + public String getText(final Object element) { + final Customization customization = (Customization) element; + String name = customization.getName(); + if (name == null) { + name = ""; //$NON-NLS-1$ + } + return name.replaceAll("(.*)\\.(.*)", "$2 ($1)"); //$NON-NLS-1$//$NON-NLS-2$ + } + + @Override + public Image getImage(final Object element) { + Image result; + if (this.loadCustomDialog.getLockedCustoms().contains(element)) { + result = ImageProvider.getInstance().getGrayedUiCustomIcon(); + } else { + result = ImageProvider.getInstance().getUiCustomIcon(); + } + return result; + } + + public Color getForeground(final Object element) { + Color result = null; + if (this.loadCustomDialog.getLockedCustoms().contains(element)) { + result = Display.getDefault().getSystemColor(SWT.COLOR_DARK_GRAY); + } + return result; + } + + public Color getBackground(final Object element) { + return null; + } + +} \ No newline at end of file
diff --git a/org.eclipse.modisco.facet.custom.ui/src/org/eclipse/modisco/facet/custom/ui/internal/dialog/LoadCustomizationsDialog.java b/org.eclipse.modisco.facet.custom.ui/src/org/eclipse/modisco/facet/custom/ui/internal/dialog/LoadCustomizationsDialog.java new file mode 100644 index 0000000..370ea43 --- /dev/null +++ b/org.eclipse.modisco.facet.custom.ui/src/org/eclipse/modisco/facet/custom/ui/internal/dialog/LoadCustomizationsDialog.java
@@ -0,0 +1,649 @@ +/******************************************************************************* + * Copyright (c) 2009, 2015 Mia-Software, CEA-LIST, and Soft-Maint. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Nicolas Bros (Mia-Software) - initial API and implementation + * Vincent Lorenzo (CEA-LIST) - Bug 341328 - We need to be able to specify which column have to be hidden/visible using the customization mechanism + * Grégoire Dupé (Mia-Software) - Bug 369987 - [Restructuring][Table] Switch to the new customization and facet framework + * Grégoire Dupé (Mia-Software) - Bug 373078 - API Cleaning + * Thomas Cicognani (Soft-Maint) - Bug 441422 - LoadCustomizationsDialog UI bugs + * Grégoire Dupé (Mia-Software) - Bug 472747 - The customization loading dialog is not easily readable + *******************************************************************************/ +package org.eclipse.modisco.facet.custom.ui.internal.dialog; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.Comparator; +import java.util.List; +import java.util.ListIterator; + +import org.eclipse.emf.common.util.BasicEList; +import org.eclipse.emf.common.util.EList; +import org.eclipse.emf.common.util.URI; +import org.eclipse.emf.ecore.util.EcoreUtil; +import org.eclipse.jface.dialogs.Dialog; +import org.eclipse.jface.dialogs.MessageDialog; +import org.eclipse.jface.viewers.DoubleClickEvent; +import org.eclipse.jface.viewers.IContentProvider; +import org.eclipse.jface.viewers.IDoubleClickListener; +import org.eclipse.jface.viewers.ISelection; +import org.eclipse.jface.viewers.IStructuredSelection; +import org.eclipse.jface.viewers.ITreeContentProvider; +import org.eclipse.jface.viewers.LabelProvider; +import org.eclipse.jface.viewers.StructuredSelection; +import org.eclipse.jface.viewers.TreeViewer; +import org.eclipse.jface.viewers.Viewer; +import org.eclipse.modisco.facet.custom.metamodel.v0_2_0.custom.Customization; +import org.eclipse.modisco.facet.custom.ui.internal.Messages; +import org.eclipse.modisco.facet.custom.ui.internal.exported.dialog.ILoadCustomizationsDialog; +import org.eclipse.modisco.facet.custom.ui.internal.exported.exception.IllegalParameterException; +import org.eclipse.modisco.facet.util.ui.internal.exported.dialog.IDialogCallback; +import org.eclipse.modisco.facet.util.ui.internal.exported.dialog.IDialogCallbackWithPreCommit; +import org.eclipse.swt.SWT; +import org.eclipse.swt.events.ModifyEvent; +import org.eclipse.swt.events.ModifyListener; +import org.eclipse.swt.events.SelectionAdapter; +import org.eclipse.swt.events.SelectionEvent; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.widgets.Button; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Control; +import org.eclipse.swt.widgets.Display; +import org.eclipse.swt.widgets.Label; +import org.eclipse.swt.widgets.Shell; +import org.eclipse.swt.widgets.Text; +import org.eclipse.swt.widgets.Tree; +import org.eclipse.ui.dialogs.PatternFilter; + +public class LoadCustomizationsDialog<D> extends Dialog implements + ILoadCustomizationsDialog<D> { + + private static final int TREE_WIDTH = 300; + private static final int TREE_HEIGHT = 250; + private static final int NUM_COLUMNS = 4; + private final List<Customization> availableCustoms; + private final LabelProvider labelProvider; + private final IContentProvider contentProvider = new ITreeContentProvider() { + private final Comparator<Customization> comparator = new Comparator<Customization>() { + public int compare(final Customization custom1, final Customization custom2) { + String name1 = custom1.getName(); + String name2 = custom2.getName(); + if (name1 == null) { + name1 = ""; //$NON-NLS-1$ + } + if (name2 == null) { + name2 = ""; //$NON-NLS-1$ + } + return name1.compareTo(name2); + } + }; + + public Object[] getElements(final Object inputElement) { + @SuppressWarnings("unchecked") + final List<Customization> customizations = (List<Customization>) inputElement; + Collections.sort(customizations, this.comparator); + return customizations.toArray(); + } + + public void inputChanged(final Viewer viewer, final Object oldInput, + final Object newInput) { + // nothing + } + + public void dispose() { + // nothing + } + + public Object[] getChildren(final Object parentElement) { + return new Object[]{}; + } + + public Object getParent(final Object element) { + return null; + } + + public boolean hasChildren(final Object element) { + return false; + } + }; + private final EList<Customization> selectedCustoms; + private TreeViewer availableCustomTV; + private TreeViewer selectedCustomTV; + private Button addButton; + private Button removeButton; + private Button addAllButton; + private Button removeAllButton; + private Button upButton; + private Button downButton; + private Button loadRequiredFacetsCheckbox; + private boolean loadRequiredFacetsSelected = false; + private final IDialogCallbackWithPreCommit<List<Customization>, Boolean, D> callback; + private final List<Customization> lockedCustoms; + private final String lockMsg; + + public LoadCustomizationsDialog(final Shell parent, + final List<Customization> availableCustoms, + final List<Customization> selectedCustoms, + final List<Customization> lockedCustoms, + final IDialogCallbackWithPreCommit<List<Customization>, Boolean, D> callback, + final String lockMsg) { + super(parent); + this.labelProvider = new ColorLabelProvider(this); + this.callback = callback; + this.selectedCustoms = new BasicEList<Customization>(); + this.availableCustoms = new ArrayList<Customization>(availableCustoms); + this.lockedCustoms = lockedCustoms; + this.lockMsg = lockMsg; + setShellStyle(getShellStyle() | SWT.RESIZE | SWT.MAX); + // initial selection + for (final Customization iniSelectedCustom : selectedCustoms) { + final URI selectedCustomURI = EcoreUtil + .getURI(iniSelectedCustom); + final ListIterator<Customization> availableCustIter = this.availableCustoms + .listIterator(); + while (availableCustIter.hasNext()) { + final Customization availableCustom = availableCustIter + .next(); + final URI availableCustURI = EcoreUtil + .getURI(availableCustom); + if (availableCustURI + .equals(selectedCustomURI)) { + availableCustIter.remove(); + LoadCustomizationsDialog.this.selectedCustoms + .add(iniSelectedCustom); + } + } + } + for (Customization lockedCustom : this.lockedCustoms) { + if (!this.selectedCustoms.contains(lockedCustom)) { + this.selectedCustoms.add(lockedCustom); + } + } + } + + @Override + protected void configureShell(final Shell shell) { + super.configureShell(shell); + shell.setText(Messages.LoadCustomizationsDialog_title_LoadCustomizations); + } + + @Override + protected Control createDialogArea(final Composite parent) { + final Composite contents = (Composite) super.createDialogArea(parent); + + final GridLayout contentsGLayout = (GridLayout) contents.getLayout(); + contentsGLayout.numColumns = LoadCustomizationsDialog.NUM_COLUMNS; + + final GridData contentsGridData = (GridData) contents.getLayoutData(); + contentsGridData.horizontalAlignment = SWT.FILL; + contentsGridData.verticalAlignment = SWT.FILL; + + createLeftPane(contents); + createMiddleButtonsPane(contents); + createRightPane(contents); + createRightButtonsPane(contents); + createLoadRequiredFacetsCheckbox(contents); + + this.availableCustomTV.addDoubleClickListener(new IDoubleClickListener() { + + public void doubleClick(final DoubleClickEvent event) { + loadSelectedCustoms(); + } + }); + + this.selectedCustomTV.addDoubleClickListener(new IDoubleClickListener() { + public void doubleClick(final DoubleClickEvent event) { + unloadSelectedCustoms(); + } + }); + + this.upButton.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(final SelectionEvent event) { + upButtonClicked(); + } + }); + + this.downButton.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(final SelectionEvent event) { + downButtonClicked(); + } + }); + + this.addButton.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(final SelectionEvent event) { + loadSelectedCustoms(); + } + }); + + this.addAllButton.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(final SelectionEvent event) { + addAllButtonClicked(); + } + }); + + this.removeButton.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(final SelectionEvent event) { + unloadSelectedCustoms(); + } + }); + + this.removeAllButton.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(final SelectionEvent event) { + removeAllButtonClicked(); + } + }); + + return contents; + } + + public final void upButtonClicked() { + final IStructuredSelection selection = (IStructuredSelection) LoadCustomizationsDialog.this.selectedCustomTV + .getSelection(); + int minIndex = 0; + for (Object selectedObject : selection.toList()) { + if (selectedObject instanceof Customization) { + final Customization customization = (Customization) selectedObject; + final int index = this.selectedCustoms + .indexOf(customization); + this.selectedCustoms.move( + Math.max(index - 1, minIndex++), customization); + } + } + LoadCustomizationsDialog.this.selectedCustomTV.refresh(); + } + + public final void downButtonClicked() { + final IStructuredSelection selection = (IStructuredSelection) LoadCustomizationsDialog.this.selectedCustomTV + .getSelection(); + final ArrayList<Object> selectedObjects = new ArrayList<Object>(); + for (final Object selectedObject : selection.toArray()) { + selectedObjects.add(selectedObject); + } + + // prevent the last two elements from swapping + boolean canMove = !selectedObjects + .contains(LoadCustomizationsDialog.this.selectedCustoms + .get(LoadCustomizationsDialog.this.selectedCustoms.size() - 1)); + for (int i = LoadCustomizationsDialog.this.selectedCustoms.size() - 2; i >= 0; i--) { + final Customization selectedCustom = LoadCustomizationsDialog.this.selectedCustoms + .get(i); + if (selectedObjects.contains(selectedCustom)) { + if (canMove) { + LoadCustomizationsDialog.this.selectedCustoms.move(i + 1, + selectedCustom); + } + } else { + canMove = true; + } + + } + + LoadCustomizationsDialog.this.selectedCustomTV.refresh(); + } + + public final void loadSelectedCustoms() { + final IStructuredSelection selection = (IStructuredSelection) LoadCustomizationsDialog.this.availableCustomTV + .getSelection(); + for (Object object : selection.toList()) { + if (object instanceof Customization) { + final Customization custom = (Customization) object; + if (!this.selectedCustoms.contains(custom)) { + this.selectedCustoms.add(custom); + this.availableCustoms.remove(custom); + } + } + } + refresh(); + this.selectedCustomTV.setSelection(selection); + } + + public final void addAllButtonClicked() { + final ListIterator<Customization> listIterator = this.availableCustoms + .listIterator(); + while (listIterator.hasNext()) { + final Customization element = listIterator.next(); + this.selectedCustoms.add(element); + listIterator.remove(); + } + refresh(); + } + + public final void unloadSelectedCustoms() { + final IStructuredSelection selection = (IStructuredSelection) LoadCustomizationsDialog.this.selectedCustomTV + .getSelection(); + final List<Customization> toBeRemoved = new ArrayList<Customization>(); + boolean lockedCustomFound = false; + for (Object object : selection.toList()) { + if (this.lockedCustoms.contains(object)) { + lockedCustomFound = true; + } else if (object instanceof Customization) { + final Customization element = (Customization) object; + toBeRemoved.add(element); + } + } + if (lockedCustomFound) { + final MessageDialog dialog = new MessageDialog( + null, + Messages.LoadCustomizationsDialog_LoadCustomizationWarning, + null, + Messages.LoadCustomizationsDialog_Can_not_be_unload + this.lockMsg, + MessageDialog.WARNING, new String[] { Messages.LoadCustomizationsDialog_OK }, 1); + dialog.open(); + } + removeFromSelection(toBeRemoved); + refresh(); + } + + protected void removeFromSelection(final List<Customization> toBeRemoved) { + this.availableCustoms.addAll(toBeRemoved); + this.selectedCustoms.removeAll(toBeRemoved); + if (LoadCustomizationsDialog.this.selectedCustoms.size() > 0) { + LoadCustomizationsDialog.this.selectedCustomTV + .setSelection(new StructuredSelection( + LoadCustomizationsDialog.this.selectedCustoms.get(0))); + } + } + + public final void removeAllButtonClicked() { + removeFromSelection(this.selectedCustoms); + refresh(); + } + + private void createLeftPane(final Composite contents) { + final Composite choiceComposite = new Composite(contents, SWT.NONE); + final GridData data = new GridData(SWT.FILL, SWT.FILL, true, true); + data.horizontalAlignment = SWT.END; + choiceComposite.setLayoutData(data); + + final GridLayout layout = new GridLayout(); + data.horizontalAlignment = SWT.FILL; + layout.marginHeight = 0; + layout.marginWidth = 0; + layout.numColumns = 1; + choiceComposite.setLayout(layout); + + final Label choiceLabel = new Label(choiceComposite, SWT.NONE); + choiceLabel.setText(Messages.LoadCustomizationsDialog_AvailiableCustom); + + final GridData choiceLabelGD = new GridData(); + choiceLabelGD.verticalAlignment = SWT.FILL; + choiceLabelGD.horizontalAlignment = SWT.FILL; + choiceLabel.setLayoutData(choiceLabelGD); + + final Text patternText = createFilterText(choiceComposite); + + final Tree availableCustomsT = new Tree(choiceComposite, SWT.MULTI | SWT.BORDER); + final GridData availableCustsGD = new GridData(); + availableCustsGD.widthHint = LoadCustomizationsDialog.TREE_WIDTH; + availableCustsGD.heightHint = LoadCustomizationsDialog.TREE_HEIGHT; + availableCustsGD.horizontalAlignment = SWT.FILL; + availableCustsGD.verticalAlignment = SWT.FILL; + availableCustsGD.grabExcessHorizontalSpace = true; + availableCustsGD.grabExcessVerticalSpace = true; + availableCustomsT.setLayoutData(availableCustsGD); + + this.availableCustomTV = new TreeViewer(availableCustomsT); + this.availableCustomTV.setContentProvider(this.contentProvider); + this.availableCustomTV.setLabelProvider(this.labelProvider); + final PatternFilter filter = new PatternFilter(); + this.availableCustomTV.addFilter(filter); + + this.availableCustomTV.setInput(this.availableCustoms); + + patternText.addModifyListener(new ModifyListener() { + public void modifyText(final ModifyEvent event) { + filter.setPattern(patternText.getText()); + LoadCustomizationsDialog.this.availableCustomTV.refresh(); + } + }); + } + + private void createMiddleButtonsPane(final Composite contents) { + final Composite buttonsComposite = new Composite(contents, SWT.NONE); + final GridData buttonsCompositeGridData = new GridData(); + buttonsCompositeGridData.verticalAlignment = SWT.CENTER; + buttonsCompositeGridData.horizontalAlignment = SWT.FILL; + buttonsComposite.setLayoutData(buttonsCompositeGridData); + buttonsComposite.setLayout(new GridLayout()); + + // new Label(buttonsComposite, SWT.NONE); + + this.addButton = new Button(buttonsComposite, SWT.PUSH); + this.addButton.setText(Messages.LoadCustomizationsDialog_Add); + this.addButton.setToolTipText(Messages.LoadCustomizationsDialog_Add2); + final GridData addButtonGridData = new GridData(); + addButtonGridData.verticalAlignment = SWT.FILL; + addButtonGridData.horizontalAlignment = SWT.FILL; + this.addButton.setLayoutData(addButtonGridData); + + this.removeButton = new Button(buttonsComposite, SWT.PUSH); + this.removeButton.setText(Messages.LoadCustomizationsDialog_Remove); + this.removeButton.setToolTipText(Messages.LoadCustomizationsDialog_Remove2); + final GridData removeButtonGridData = new GridData(); + removeButtonGridData.verticalAlignment = SWT.FILL; + removeButtonGridData.horizontalAlignment = SWT.FILL; + this.removeButton.setLayoutData(removeButtonGridData); + + spacer(buttonsComposite); + + this.addAllButton = new Button(buttonsComposite, SWT.PUSH); + this.addAllButton.setText(Messages.LoadCustomizationsDialog_AddAll); + this.addAllButton.setToolTipText(Messages.LoadCustomizationsDialog_AddAll2); + + this.removeAllButton = new Button(buttonsComposite, SWT.PUSH); + this.removeAllButton.setText(Messages.LoadCustomizationsDialog_RemoveAll); + this.removeAllButton.setToolTipText(Messages.LoadCustomizationsDialog_RemoveAll2); + } + + private static void spacer(final Composite parent) { + Label label = new Label(parent, SWT.NONE); + } + + private void createRightButtonsPane(final Composite contents) { + final Composite buttonsComposite = new Composite(contents, SWT.NONE); + final GridData buttonsCompositeGridData = new GridData(); + buttonsCompositeGridData.verticalAlignment = SWT.FILL; + buttonsCompositeGridData.horizontalAlignment = SWT.FILL; + buttonsComposite.setLayoutData(buttonsCompositeGridData); + buttonsComposite.setLayout(new GridLayout()); + + // spacer + spacer(buttonsComposite); + + this.upButton = new Button(buttonsComposite, SWT.PUSH); + this.upButton.setText(Messages.LoadCustomizationsDialog_Up); + final GridData upButtonGridData = new GridData(); + upButtonGridData.verticalAlignment = SWT.FILL; + upButtonGridData.horizontalAlignment = SWT.FILL; + this.upButton.setLayoutData(upButtonGridData); + + this.downButton = new Button(buttonsComposite, SWT.PUSH); + this.downButton.setText(Messages.LoadCustomizationsDialog_Down); + final GridData downButtonGridData = new GridData(); + downButtonGridData.verticalAlignment = SWT.FILL; + downButtonGridData.horizontalAlignment = SWT.FILL; + this.downButton.setLayoutData(downButtonGridData); + } + + private void createRightPane(final Composite contents) { + final Composite featureComposite = new Composite(contents, SWT.NONE); + final GridData featureCompositeData = new GridData(SWT.FILL, SWT.FILL, true, true); + featureCompositeData.horizontalAlignment = SWT.END; + featureComposite.setLayoutData(featureCompositeData); + + final GridLayout featureCompositeLayout = new GridLayout(); + featureCompositeData.horizontalAlignment = SWT.FILL; + featureCompositeLayout.marginHeight = 0; + featureCompositeLayout.marginWidth = 0; + featureCompositeLayout.numColumns = 1; + featureComposite.setLayout(featureCompositeLayout); + + final Label featureLabel = new Label(featureComposite, SWT.NONE); + featureLabel.setText(Messages.LoadCustomizationsDialog_LoadedCustomizations); + final GridData featureLabelGridData = new GridData(); + featureLabelGridData.horizontalSpan = 2; + featureLabelGridData.horizontalAlignment = SWT.FILL; + featureLabelGridData.verticalAlignment = SWT.FILL; + featureLabel.setLayoutData(featureLabelGridData); + + final Tree loadedCustomizationsTree = new Tree(featureComposite, SWT.MULTI | SWT.BORDER); + final GridData loadedCustomizationsGridData = new GridData(); + loadedCustomizationsGridData.widthHint = LoadCustomizationsDialog.TREE_WIDTH; + loadedCustomizationsGridData.heightHint = LoadCustomizationsDialog.TREE_HEIGHT; + loadedCustomizationsGridData.verticalAlignment = SWT.FILL; + loadedCustomizationsGridData.horizontalAlignment = SWT.FILL; + loadedCustomizationsGridData.grabExcessHorizontalSpace = true; + loadedCustomizationsGridData.grabExcessVerticalSpace = true; + loadedCustomizationsTree.setLayoutData(loadedCustomizationsGridData); + + this.selectedCustomTV = new TreeViewer(loadedCustomizationsTree); + this.selectedCustomTV.setContentProvider(this.contentProvider); + this.selectedCustomTV.setLabelProvider(this.labelProvider); + this.selectedCustomTV.setInput(this.selectedCustoms); + } + + private void createLoadRequiredFacetsCheckbox(final Composite contents) { + spacer(contents); + spacer(contents); + this.loadRequiredFacetsCheckbox = new Button(contents, SWT.CHECK); + this.loadRequiredFacetsCheckbox + .setText(Messages.LoadCustomizationsDialog_loadReferencedFacetsCheckbox); + this.loadRequiredFacetsCheckbox.setSelection(true); + this.loadRequiredFacetsCheckbox + .setLayoutData(new GridData(SWT.END, SWT.FILL, false, false)); + + } + + private static Text createFilterText(final Composite contents) { + final Text patternText = new Text(contents, SWT.BORDER | SWT.SEARCH); + patternText.setMessage(Messages.LoadCustomizationsDialog_type_filter_test); + patternText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); + return patternText; + } + + @Override + protected void okPressed() { + pressOk(); + } + + public void commit(final Boolean result) { + this.callback.committed(this.selectedCustoms, result); + super.okPressed(); + } + + public boolean isLoadRequiredFacetsSelected() { + return this.loadRequiredFacetsSelected; + } + + public List<Customization> getSelectedCustomizations() { + return this.selectedCustoms; + } + + private void refresh() { + LoadCustomizationsDialog.this.availableCustomTV.refresh(); + LoadCustomizationsDialog.this.selectedCustomTV.refresh(); + } + + public void asyncOpen() { + Display display; + if (this.getShell() == null) { + display = Display.getDefault(); + } else { + display = this.getShell().getDisplay(); + } + display.asyncExec(new Runnable() { + public void run() { + LoadCustomizationsDialog.this.open(); + } + }); + } + + public D pressOk() { + this.loadRequiredFacetsSelected = this.loadRequiredFacetsCheckbox + .getSelection(); + final D preCommitDialog = this.callback + .openPrecommitDialog(this.selectedCustoms, + new IDialogCallback<Boolean>() { + public void committed(final Boolean result) { + if (result.booleanValue()) { + LoadCustomizationsDialog.this + .commit(result); + } + } + }); + if (preCommitDialog == null) { + this.callback.committed(this.selectedCustoms, Boolean.TRUE); + super.okPressed(); + } + return preCommitDialog; + } + + public void selectAvailableCustom(final Customization customization) { + final ISelection selection = new StructuredSelection(customization); + this.availableCustomTV.setSelection(selection); + } + + public void selectSelectedCustom(final Customization customization) { + final ISelection selection = new StructuredSelection(customization); + this.selectedCustomTV.setSelection(selection); + + } + + public List<Customization> getLockedCustoms() { + return this.lockedCustoms; + } + + public void addCustomization(final Customization customization) + throws IllegalParameterException { + // TODO Auto-generated method stub + } + + public void addCustomizations(final List<Customization> customizations) + throws IllegalParameterException { + // TODO Auto-generated method stub + } + + public void removeCustomization(final Customization customization) + throws IllegalParameterException { + // TODO Auto-generated method stub + } + + public void removeCustomizations(final List<Customization> customizations) + throws IllegalParameterException { + // TODO Auto-generated method stub + } + + public void cancel() { + // TODO Auto-generated method stub + } + + public void validate() { + // TODO Auto-generated method stub + } + + public List<Customization> getAvailableCustomizations() { + // TODO Auto-generated method stub + return null; + } + + public void pushUp(final Customization customization) + throws IllegalParameterException { + // TODO Auto-generated method stub + } + + public void pushDown(final Customization customization) + throws IllegalParameterException { + // TODO Auto-generated method stub + } +}
diff --git a/org.eclipse.modisco.facet.custom.ui/src/org/eclipse/modisco/facet/custom/ui/internal/dialog/LoadCustomizationsDialogFactory.java b/org.eclipse.modisco.facet.custom.ui/src/org/eclipse/modisco/facet/custom/ui/internal/dialog/LoadCustomizationsDialogFactory.java new file mode 100644 index 0000000..826276e --- /dev/null +++ b/org.eclipse.modisco.facet.custom.ui/src/org/eclipse/modisco/facet/custom/ui/internal/dialog/LoadCustomizationsDialogFactory.java
@@ -0,0 +1,46 @@ +/** + * Copyright (c) 2012 Mia-Software. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Gregoire Dupe (Mia-Software) - Bug 369987 - [Restructuring][Table] Switch to the new customization and facet framework + */ +package org.eclipse.modisco.facet.custom.ui.internal.dialog; + +import java.util.Collections; +import java.util.List; + +import org.eclipse.modisco.facet.custom.metamodel.v0_2_0.custom.Customization; +import org.eclipse.modisco.facet.custom.ui.internal.exported.dialog.ILoadCustomizationsDialog; +import org.eclipse.modisco.facet.custom.ui.internal.exported.dialog.ILoadCustomizationsDialogFactory; +import org.eclipse.modisco.facet.util.ui.internal.exported.dialog.IDialogCallbackWithPreCommit; +import org.eclipse.swt.widgets.Shell; + +public class LoadCustomizationsDialogFactory implements ILoadCustomizationsDialogFactory { + + public <D> ILoadCustomizationsDialog<D> createLoadCustomizationDialog( + final Shell parent, + final List<Customization> availableCustoms, + final List<Customization> selectedCustoms, + final IDialogCallbackWithPreCommit<List<Customization>, Boolean, D> callback) { + return new SynchronizedLoadCustomizationsDialog(parent, + availableCustoms, selectedCustoms, + Collections.<Customization> emptyList(), callback, ""); //$NON-NLS-1$ + } + + public <D> ILoadCustomizationsDialog<D> createLoadCustomizationDialog( + final Shell parent, + final List<Customization> availableCustoms, + final List<Customization> selectedCustoms, + final List<Customization> lockedCustoms, + final IDialogCallbackWithPreCommit<List<Customization>, Boolean, D> callback, + final String lockMsg) { + return new SynchronizedLoadCustomizationsDialog(parent, + availableCustoms, selectedCustoms, lockedCustoms, callback, + lockMsg); + } +}
diff --git a/org.eclipse.modisco.facet.custom.ui/src/org/eclipse/modisco/facet/custom/ui/internal/dialog/SynchronizedLoadCustomizationsDialog.java b/org.eclipse.modisco.facet.custom.ui/src/org/eclipse/modisco/facet/custom/ui/internal/dialog/SynchronizedLoadCustomizationsDialog.java new file mode 100644 index 0000000..d6476dc --- /dev/null +++ b/org.eclipse.modisco.facet.custom.ui/src/org/eclipse/modisco/facet/custom/ui/internal/dialog/SynchronizedLoadCustomizationsDialog.java
@@ -0,0 +1,222 @@ +/** + * Copyright (c) 2012 Mia-Software. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Gregoire Dupe (Mia-Software) - Bug 369987 - [Restructuring][Table] Switch to the new customization and facet framework + * Gregoire Dupe (Mia-Software) - Bug 373078 - API Cleaning + * Nicolas Bros (Mia-Software) - Bug 372626 - Aggregates + */ +package org.eclipse.modisco.facet.custom.ui.internal.dialog; + +import java.util.List; + +import org.eclipse.modisco.facet.custom.metamodel.v0_2_0.custom.Customization; +import org.eclipse.modisco.facet.custom.ui.internal.exported.dialog.ILoadCustomizationsDialog; +import org.eclipse.modisco.facet.custom.ui.internal.exported.exception.IllegalParameterException; +import org.eclipse.modisco.facet.util.ui.internal.exported.dialog.IDialogCallbackWithPreCommit; +import org.eclipse.modisco.facet.util.ui.internal.exported.displaysync.AbstractExceptionFreeRunnable; +import org.eclipse.modisco.facet.util.ui.internal.exported.displaysync.AbstractVoidExceptionFreeRunnable; +import org.eclipse.modisco.facet.util.ui.internal.exported.displaysync.AbstractVoidRunnable; +import org.eclipse.modisco.facet.util.ui.internal.exported.displaysync.SynchronizedObject; +import org.eclipse.swt.widgets.Display; +import org.eclipse.swt.widgets.Shell; + +public class SynchronizedLoadCustomizationsDialog<D> extends + SynchronizedObject<LoadCustomizationsDialog<D>> implements + ILoadCustomizationsDialog<D> { // NOPMD by gdupe on 03/02/12 12:13 - We cannot do more. This class is a facade/wrapper of an other class. + + public SynchronizedLoadCustomizationsDialog(final Shell parent, + final List<Customization> availableCustoms, + final List<Customization> selectedCustoms, + final List<Customization> lockedCustoms, + final IDialogCallbackWithPreCommit<List<Customization>, Boolean, D> callback, + final String lockMsg) { + super(new LoadCustomizationsDialog(parent, availableCustoms, + selectedCustoms, lockedCustoms, callback, lockMsg), + initDisplay(parent)); + } + + private static Display initDisplay(final Shell parent) { + Display display; + if (parent == null) { + display = Display.getDefault(); + } else { + display = parent.getDisplay(); + } + return display; + } + + public int open() { + return this.safeSyncExec(new AbstractExceptionFreeRunnable<Integer>() { + @Override + public Integer safeRun() { + return Integer.valueOf(SynchronizedLoadCustomizationsDialog.this + .getSynchronizedObject().open()); + } + }).intValue(); + } + + public void asyncOpen() { + this.voidExceptionFreeRunnable(new AbstractVoidExceptionFreeRunnable() { + @Override + public void voidSafeRun() { + SynchronizedLoadCustomizationsDialog.this + .getSynchronizedObject().asyncOpen(); + } + }); + } + + public D pressOk() { + return this.safeSyncExec(new AbstractExceptionFreeRunnable<D>() { + @Override + public D safeRun() { + return SynchronizedLoadCustomizationsDialog.this + .getSynchronizedObject().pressOk(); + } + }); + } + + public void selectAvailableCustom(final Customization customization) { + this.voidExceptionFreeRunnable(new AbstractVoidExceptionFreeRunnable() { + @Override + public void voidSafeRun() { + SynchronizedLoadCustomizationsDialog.this + .getSynchronizedObject().selectAvailableCustom( + customization); + } + }); + } + + public void loadSelectedCustoms() { + this.voidExceptionFreeRunnable(new AbstractVoidExceptionFreeRunnable() { + @Override + public void voidSafeRun() { + SynchronizedLoadCustomizationsDialog.this + .getSynchronizedObject().loadSelectedCustoms(); + } + }); + } + + public void selectSelectedCustom(final Customization customization) { + this.voidExceptionFreeRunnable(new AbstractVoidExceptionFreeRunnable() { + @Override + public void voidSafeRun() { + SynchronizedLoadCustomizationsDialog.this + .getSynchronizedObject().selectSelectedCustom( + customization); + } + }); + } + + public void unloadSelectedCustoms() { + this.voidExceptionFreeRunnable(new AbstractVoidExceptionFreeRunnable() { + @Override + public void voidSafeRun() { + SynchronizedLoadCustomizationsDialog.this + .getSynchronizedObject().unloadSelectedCustoms(); + } + }); + } + + public void addCustomization(final Customization customization) + throws IllegalParameterException { + voidSyncExec(new AbstractVoidRunnable<IllegalParameterException>() { + @Override + public void voidRun() throws IllegalParameterException { + getSynchronizedObject().addCustomization(customization); + } + }); + } + + public void addCustomizations(final List<Customization> customizations) + throws IllegalParameterException { + voidSyncExec(new AbstractVoidRunnable<IllegalParameterException>() { + @Override + public void voidRun() throws IllegalParameterException { + getSynchronizedObject().addCustomizations(customizations); + } + }); + } + + public void removeCustomization(final Customization customization) + throws IllegalParameterException { + voidSyncExec(new AbstractVoidRunnable<IllegalParameterException>() { + @Override + public void voidRun() throws IllegalParameterException { + getSynchronizedObject().removeCustomization(customization); + } + }); + } + + public void removeCustomizations(final List<Customization> customizations) + throws IllegalParameterException { + voidSyncExec(new AbstractVoidRunnable<IllegalParameterException>() { + @Override + public void voidRun() throws IllegalParameterException { + getSynchronizedObject().removeCustomizations(customizations); + } + }); + } + + public void cancel() { + voidExceptionFreeRunnable(new AbstractVoidExceptionFreeRunnable() { + @Override + public void voidSafeRun() { + getSynchronizedObject().cancel(); + } + }); + } + + public void validate() { + voidExceptionFreeRunnable(new AbstractVoidExceptionFreeRunnable() { + @Override + public void voidSafeRun() { + getSynchronizedObject().validate(); + } + }); + } + + public List<Customization> getSelectedCustomizations() { + return safeSyncExec(new AbstractExceptionFreeRunnable<List<Customization>>() { + @Override + public List<Customization> safeRun() { + return getSynchronizedObject().getSelectedCustomizations(); + } + }); + } + + public List<Customization> getAvailableCustomizations() { + return safeSyncExec(new AbstractExceptionFreeRunnable<List<Customization>>() { + @Override + public List<Customization> safeRun() { + return getSynchronizedObject().getAvailableCustomizations(); + } + }); + } + + public void pushUp(final Customization customization) + throws IllegalParameterException { + voidSyncExec(new AbstractVoidRunnable<IllegalParameterException>() { + @Override + public void voidRun() throws IllegalParameterException { + getSynchronizedObject().pushUp(customization); + } + }); + } + + public void pushDown(final Customization customization) + throws IllegalParameterException { + voidSyncExec(new AbstractVoidRunnable<IllegalParameterException>() { + @Override + public void voidRun() throws IllegalParameterException { + getSynchronizedObject().pushDown(customization); + } + }); + } + +}
diff --git a/org.eclipse.modisco.facet.custom.ui/src/org/eclipse/modisco/facet/custom/ui/internal/exception/CustomizationEditRuntimeException.java b/org.eclipse.modisco.facet.custom.ui/src/org/eclipse/modisco/facet/custom/ui/internal/exception/CustomizationEditRuntimeException.java new file mode 100644 index 0000000..94b62cf --- /dev/null +++ b/org.eclipse.modisco.facet.custom.ui/src/org/eclipse/modisco/facet/custom/ui/internal/exception/CustomizationEditRuntimeException.java
@@ -0,0 +1,35 @@ + +/** + * Copyright (c) 2012 Mia-Software. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Gregoire Dupe (Mia-Software) - Bug 369987 - [Restructuring][Table] Switch to the new customization and facet framework + */ +package org.eclipse.modisco.facet.custom.ui.internal.exception; + +public class CustomizationEditRuntimeException extends RuntimeException { + + private static final long serialVersionUID = -632229513667261515L; + + public CustomizationEditRuntimeException() { + super(); + } + + public CustomizationEditRuntimeException(final String message) { + super(message); + } + + public CustomizationEditRuntimeException(final Throwable cause) { + super(cause); + } + + public CustomizationEditRuntimeException(final String message, final Throwable cause) { + super(message, cause); + } + +}
diff --git a/org.eclipse.modisco.facet.custom.ui/src/org/eclipse/modisco/facet/custom/ui/internal/exception/CustomizedContentProviderRuntimeException.java b/org.eclipse.modisco.facet.custom.ui/src/org/eclipse/modisco/facet/custom/ui/internal/exception/CustomizedContentProviderRuntimeException.java new file mode 100644 index 0000000..fc7fb24 --- /dev/null +++ b/org.eclipse.modisco.facet.custom.ui/src/org/eclipse/modisco/facet/custom/ui/internal/exception/CustomizedContentProviderRuntimeException.java
@@ -0,0 +1,34 @@ +/******************************************************************************* + * Copyright (c) 2012 Mia-Software. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Gregoire Dupe (Mia-Software) - Bug 386387 - [CustomizedTreeContentProvider] The TreeElements are not preserved between two calls to getElements() + *******************************************************************************/ +package org.eclipse.modisco.facet.custom.ui.internal.exception; + +public class CustomizedContentProviderRuntimeException extends RuntimeException { + + private static final long serialVersionUID = 6962461313131533003L; + + public CustomizedContentProviderRuntimeException() { + super(); + } + + public CustomizedContentProviderRuntimeException(final String message) { + super(message); + } + + public CustomizedContentProviderRuntimeException(final Throwable cause) { + super(cause); + } + + public CustomizedContentProviderRuntimeException(final String message, + final Throwable cause) { + super(message, cause); + } + +}
diff --git a/org.eclipse.modisco.facet.custom.ui/src/org/eclipse/modisco/facet/custom/ui/internal/exported/CustomizationUIConstants.java b/org.eclipse.modisco.facet.custom.ui/src/org/eclipse/modisco/facet/custom/ui/internal/exported/CustomizationUIConstants.java new file mode 100644 index 0000000..cc0c48d --- /dev/null +++ b/org.eclipse.modisco.facet.custom.ui/src/org/eclipse/modisco/facet/custom/ui/internal/exported/CustomizationUIConstants.java
@@ -0,0 +1,27 @@ +/******************************************************************************* + * Copyright (c) 2012 CEA LIST. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Nicolas Bros (Mia-Software) - Bug 372626 - Aggregates + *******************************************************************************/ +package org.eclipse.modisco.facet.custom.ui.internal.exported; + +/** + * @since 0.2 + */ +public final class CustomizationUIConstants { + + private static final String CATALOG_VIEW_ID = "org.eclipse.emf.facet.custom.ui.view.catalog"; //$NON-NLS-1$ + + private CustomizationUIConstants() { + // utility class + } + + public static String getCustomizationCatalogViewId() { + return CustomizationUIConstants.CATALOG_VIEW_ID; + } +}
diff --git a/org.eclipse.modisco.facet.custom.ui/src/org/eclipse/modisco/facet/custom/ui/internal/exported/ICustomizationCommandFactory.java b/org.eclipse.modisco.facet.custom.ui/src/org/eclipse/modisco/facet/custom/ui/internal/exported/ICustomizationCommandFactory.java new file mode 100644 index 0000000..7fd81aa --- /dev/null +++ b/org.eclipse.modisco.facet.custom.ui/src/org/eclipse/modisco/facet/custom/ui/internal/exported/ICustomizationCommandFactory.java
@@ -0,0 +1,39 @@ +/** + * Copyright (c) 2012 Mia-Software. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Gregoire Dupe (Mia-Software) - Bug 369987 - [Restructuring][Table] Switch to the new customization and facet framework + */ +package org.eclipse.modisco.facet.custom.ui.internal.exported; + +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.ETypedElement; +import org.eclipse.modisco.facet.custom.metamodel.v0_2_0.custom.Customization; +import org.eclipse.modisco.facet.custom.metamodel.v0_2_0.custom.EClassCustomization; +import org.eclipse.modisco.facet.custom.metamodel.v0_2_0.custom.FacetCustomization; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.Facet; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.FacetOperation; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.extensible.Query; +import org.eclipse.modisco.facet.util.emf.core.command.ICommandFactoryResult; + +public interface ICustomizationCommandFactory { + + ICommandFactoryResult<Customization> createCustomization( + String name); + + ICommandFactoryResult<EClassCustomization> createEClassCustomization( + Customization customization, EClass customedEClass, Query conformanceQuery); + + ICommandFactoryResult<FacetCustomization> createFacetCustomization( + Customization customization, Facet customizedFacet); + + ICommandFactoryResult<Facet> setPropertyConfig(Facet typeCustomization, + ETypedElement customizedTElt, // customized typed element + FacetOperation customProperty, + Query query); +}
diff --git a/org.eclipse.modisco.facet.custom.ui/src/org/eclipse/modisco/facet/custom/ui/internal/exported/ICustomizationCommandFactoryFactory.java b/org.eclipse.modisco.facet.custom.ui/src/org/eclipse/modisco/facet/custom/ui/internal/exported/ICustomizationCommandFactoryFactory.java new file mode 100644 index 0000000..2477719 --- /dev/null +++ b/org.eclipse.modisco.facet.custom.ui/src/org/eclipse/modisco/facet/custom/ui/internal/exported/ICustomizationCommandFactoryFactory.java
@@ -0,0 +1,24 @@ +/** + * Copyright (c) 2012 Mia-Software. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Gregoire Dupe (Mia-Software) - Bug 369987 - [Restructuring][Table] Switch to the new customization and facet framework + */ +package org.eclipse.modisco.facet.custom.ui.internal.exported; + +import org.eclipse.emf.edit.domain.EditingDomain; +import org.eclipse.modisco.facet.custom.ui.internal.CustomizationCommandFactoryFactory; +import org.eclipse.modisco.facet.util.emf.core.internal.exported.ICommandFactory; + +public interface ICustomizationCommandFactoryFactory { + + ICustomizationCommandFactoryFactory DEFAULT = new CustomizationCommandFactoryFactory(); + + ICustomizationCommandFactory createCustomizationCommandFactory( + EditingDomain editingDomain, ICommandFactory commandFactory); +}
diff --git a/org.eclipse.modisco.facet.custom.ui/src/org/eclipse/modisco/facet/custom/ui/internal/exported/ILabelPropertiesHandler.java b/org.eclipse.modisco.facet.custom.ui/src/org/eclipse/modisco/facet/custom/ui/internal/exported/ILabelPropertiesHandler.java new file mode 100644 index 0000000..27f33ad --- /dev/null +++ b/org.eclipse.modisco.facet.custom.ui/src/org/eclipse/modisco/facet/custom/ui/internal/exported/ILabelPropertiesHandler.java
@@ -0,0 +1,24 @@ +/** + * Copyright (c) 2012 Mia-Software. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Gregoire Dupe (Mia-Software) - Bug 369987 - [Restructuring][Table] Switch to the new customization and facet framework + * Gregoire Dupe (Mia-Software) - Bug 373078 - API Cleaning + */ +package org.eclipse.modisco.facet.custom.ui.internal.exported; + +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.FacetOperation; + +/** + * + * @since 0.2 + * + */ +public interface ILabelPropertiesHandler { + FacetOperation getLabelProperty(); +}
diff --git a/org.eclipse.modisco.facet.custom.ui/src/org/eclipse/modisco/facet/custom/ui/internal/exported/ILabelPropertiesHandlerFactory.java b/org.eclipse.modisco.facet.custom.ui/src/org/eclipse/modisco/facet/custom/ui/internal/exported/ILabelPropertiesHandlerFactory.java new file mode 100644 index 0000000..8b3657c --- /dev/null +++ b/org.eclipse.modisco.facet.custom.ui/src/org/eclipse/modisco/facet/custom/ui/internal/exported/ILabelPropertiesHandlerFactory.java
@@ -0,0 +1,29 @@ +/** + * Copyright (c) 2012 Mia-Software. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Gregoire Dupe (Mia-Software) - Bug 369987 - [Restructuring][Table] Switch to the new customization and facet framework + * Gregoire Dupe (Mia-Software) - Bug 373078 - API Cleaning + */ +package org.eclipse.modisco.facet.custom.ui.internal.exported; + +import org.eclipse.modisco.facet.custom.core.ICustomizationManager; +import org.eclipse.modisco.facet.custom.ui.internal.PropertiesHandlerFactory; + +/** + * + * @since 0.2 + * + */ +public interface ILabelPropertiesHandlerFactory { + + ILabelPropertiesHandlerFactory DEFAULT = new PropertiesHandlerFactory(); + + ILabelPropertiesHandler createLabelPropertiesHandler( + ICustomizationManager customizationMgr); +}
diff --git a/org.eclipse.modisco.facet.custom.ui/src/org/eclipse/modisco/facet/custom/ui/internal/exported/dialog/ILoadCustomizationsDialog.java b/org.eclipse.modisco.facet.custom.ui/src/org/eclipse/modisco/facet/custom/ui/internal/exported/dialog/ILoadCustomizationsDialog.java new file mode 100644 index 0000000..7bfedbc --- /dev/null +++ b/org.eclipse.modisco.facet.custom.ui/src/org/eclipse/modisco/facet/custom/ui/internal/exported/dialog/ILoadCustomizationsDialog.java
@@ -0,0 +1,168 @@ +/** + * Copyright (c) 2011 Mia-Software. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Gregoire Dupe (Mia-Software) - Bug 369987 - [Restructuring][Table] Switch to the new customization and facet framework + * Gregoire Dupe (Mia-Software) - Bug 373078 - API Cleaning + */ +package org.eclipse.modisco.facet.custom.ui.internal.exported.dialog; + +import java.util.List; + +import org.eclipse.modisco.facet.custom.metamodel.v0_2_0.custom.Customization; +import org.eclipse.modisco.facet.custom.ui.internal.exported.exception.IllegalParameterException; + +/** + * A dialog to load {@link Customization}s. + * + * @noextend This interface is not intended to be extended by clients. + * @noimplement This interface is not intended to be implemented by clients. + * @since 0.2.0 + */ +public interface ILoadCustomizationsDialog<D> { + + /** + * Opens the dialog and blocks until it closes. + * + * @return the dialog's return code + */ + int open(); + + /** Opens the dialog asynchronously */ + void asyncOpen(); + + /** + * Emulate a press on the OK button + * + * @since 0.2 + */ + D pressOk(); + + /** Selects the given customization in the left "available customizations" pane */ + void selectAvailableCustom(Customization customization); + + /** + * Moves the customizations selected in the left "available customizations" pane to the right + * "loaded customizations" pane. + */ + void loadSelectedCustoms(); + + /** Selects the given customization in the right "loaded customizations" pane */ + void selectSelectedCustom(Customization customization); + + /** + * Moves the customizations selected in the right "loaded customizations" pane to the left + * "available customizations" pane. + */ + void unloadSelectedCustoms(); + + /** + * This method is used to add a customization on the top of the + * customization stack. + * + * @param customization + * must be one element of the list returned by {@link + * ICustomizationLoaderDialo.getAvailableCustomizations()} + * @throws IllegalParameterException + * when the parameter is not one element of the list returned by + * {@link + * ICustomizationLoaderDialo.getAvailableCustomizations()} + */ + void addCustomization(Customization customization) + throws IllegalParameterException; + + /** + * This method is used to add customizations on the top of the customization + * stack. + * + * @param customizations + * must be one element of the list returned by {@link + * ICustomizationLoaderDialo.getAvailableCustomizations()} + * @throws IllegalParameterException + * when one of the element of the parameter list in not one + * element of the list returned by {@link + * ICustomizationLoaderDialo.getAvailableCustomizations()} + */ + void addCustomizations(List<Customization> customizations) + throws IllegalParameterException; + + /** + * This method is used to remove a customization from the list. + * + * @param customization + * must be one element of the list returned by {@link + * ICustomizationLoaderDialo.getSelectedCustomizations()} + * @throws IllegalParameterException + * when the parameter is not one element of the list returned by + * {@link ICustomizationLoaderDialo.getSelectedCustomizations()} + */ + void removeCustomization(Customization customization) + throws IllegalParameterException; + + /** + * This method is used to remove a list of customization from the list. + * + * @param customizations + * must be one element of the list returned by {@link + * ICustomizationLoaderDialo.getSelectedCustomizations()} + * @throws IllegalParameterException + * when one of the element of the parameter list in not one + * element of the list returned by {@link + * ICustomizationLoaderDialo.getSelectedCustomizations()} + */ + void removeCustomizations(List<Customization> customizations) + throws IllegalParameterException; + + /** + * Cancel the dialog + */ + void cancel(); + + /** + * Validate the dialog + */ + void validate(); + + /** + * The intersection between getSelectedCustomizations() and + * getAvailableCustomizations') has to be empty. + * + * @return the customizations selected using the dialog. + */ + List<Customization> getSelectedCustomizations(); + + /** + * The intersection between getSelectedCustomizations() and + * getAvailableCustomizations') has to be empty. + * + * @return the available and not yet selected customizations + */ + List<Customization> getAvailableCustomizations(); + + /** + * This method is used to push up a customization. + * + * @param customization + * a selected customization. + * @throws IllegalParameterException + * when the parameter in not on element of the list returned by + * getSelectedCustomizations(). + */ + void pushUp(Customization customization) throws IllegalParameterException; + + /** + * This method is used to push down a customization. + * + * @param customization + * a selected customization. + * @throws IllegalParameterException + * when the parameter in not on element of the list returned by + * getSelectedCustomizations(). + */ + void pushDown(Customization customization) throws IllegalParameterException; +}
diff --git a/org.eclipse.modisco.facet.custom.ui/src/org/eclipse/modisco/facet/custom/ui/internal/exported/dialog/ILoadCustomizationsDialogFactory.java b/org.eclipse.modisco.facet.custom.ui/src/org/eclipse/modisco/facet/custom/ui/internal/exported/dialog/ILoadCustomizationsDialogFactory.java new file mode 100644 index 0000000..16cb0e6 --- /dev/null +++ b/org.eclipse.modisco.facet.custom.ui/src/org/eclipse/modisco/facet/custom/ui/internal/exported/dialog/ILoadCustomizationsDialogFactory.java
@@ -0,0 +1,72 @@ +/** + * Copyright (c) 2011 Mia-Software. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Gregoire Dupe (Mia-Software) - Bug 369987 - [Restructuring][Table] Switch to the new customization and facet framework + */ +package org.eclipse.modisco.facet.custom.ui.internal.exported.dialog; + +import java.util.List; + +import org.eclipse.modisco.facet.custom.metamodel.v0_2_0.custom.Customization; +import org.eclipse.modisco.facet.custom.ui.internal.dialog.LoadCustomizationsDialogFactory; +import org.eclipse.modisco.facet.util.ui.internal.exported.dialog.IDialogCallbackWithPreCommit; +import org.eclipse.swt.widgets.Shell; + +/** + * Factory for {@link ILoadCustomizationsDialog}. + * + * @noextend This interface is not intended to be extended by clients. + * @noimplement This interface is not intended to be implemented by clients. + * @since 0.2.0 + */ +public interface ILoadCustomizationsDialogFactory { + /** The default implementation */ + ILoadCustomizationsDialogFactory DEFAULT = new LoadCustomizationsDialogFactory(); + + /** + * @param parent + * the parent shell + * @param availableCustoms + * the customizations that the user will be able to select + * @param selectedCustoms + * the customizations that will be selected when the dialog opens + * @param listener + * called when the dialog closes + * @return the dialog + * @since 0.2 + */ + <D> ILoadCustomizationsDialog<D> createLoadCustomizationDialog(final Shell parent, + final List<Customization> availableCustoms, + final List<Customization> selectedCustoms, + IDialogCallbackWithPreCommit<List<Customization>, Boolean, D> callback); + + /** + * @param parent + * the parent shell + * @param availableCustoms + * the customizations that the user will be able to select + * @param selectedCustoms + * the customizations that will be selected when the dialog opens + * @param lockedCustoms + * a list of customizations that the user will not be able to unload + * @param listener + * called when the dialog closes + * @param lockMsg + * a message indicating why certain customizations cannot be unloaded + * @return the dialog + * @since 0.2 + */ + <D> ILoadCustomizationsDialog<D> createLoadCustomizationDialog(final Shell parent, + final List<Customization> availableCustoms, + final List<Customization> selectedCustoms, + final List<Customization> lockedCustoms, + IDialogCallbackWithPreCommit<List<Customization>, Boolean, D> callback, + String lockMsg); + +}
diff --git a/org.eclipse.modisco.facet.custom.ui/src/org/eclipse/modisco/facet/custom/ui/internal/exported/exception/IllegalParameterException.java b/org.eclipse.modisco.facet.custom.ui/src/org/eclipse/modisco/facet/custom/ui/internal/exported/exception/IllegalParameterException.java new file mode 100644 index 0000000..be39849 --- /dev/null +++ b/org.eclipse.modisco.facet.custom.ui/src/org/eclipse/modisco/facet/custom/ui/internal/exported/exception/IllegalParameterException.java
@@ -0,0 +1,53 @@ +/** + * Copyright (c) 2011 Mia-Software. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Gregoire Dupe (Mia-Software) - Bug 361794 - [Restructuring] New customization meta-model + */ +package org.eclipse.modisco.facet.custom.ui.internal.exported.exception; + +import java.util.List; + +public class IllegalParameterException extends Exception { + + private static final long serialVersionUID = 2470355059500176931L; + private final List<? extends Object> illegalParameters; + + public IllegalParameterException( + final List<? extends Object> illegalParameters) { + super(); + this.illegalParameters = illegalParameters; + } + + public IllegalParameterException(final String message, + final List<? extends Object> illegalParameters) { + super(message); + this.illegalParameters = illegalParameters; + } + + public IllegalParameterException(final Throwable cause, + final List<? extends Object> illegalParameters) { + super(cause); + this.illegalParameters = illegalParameters; + } + + public IllegalParameterException(final String message, + final Throwable cause, + final List<? extends Object> illegalParameters) { + super(message, cause); + this.illegalParameters = illegalParameters; + } + + /** + * @return the illegalParameters + */ + public List<? extends Object> getIllegalParameters() { + return this.illegalParameters; + } + +}
diff --git a/org.eclipse.modisco.facet.custom.ui/src/org/eclipse/modisco/facet/custom/ui/internal/handler/LoadCustomizationsHandler.java b/org.eclipse.modisco.facet.custom.ui/src/org/eclipse/modisco/facet/custom/ui/internal/handler/LoadCustomizationsHandler.java new file mode 100644 index 0000000..9614145 --- /dev/null +++ b/org.eclipse.modisco.facet.custom.ui/src/org/eclipse/modisco/facet/custom/ui/internal/handler/LoadCustomizationsHandler.java
@@ -0,0 +1,91 @@ +/** + * Copyright (c) 2014 Mia-Software. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Gregoire Dupe (Mia-Software) - Bug 441051 - Reusable customization and facet loading dialogs + * Gregoire Dupe (Mia-Software) - Bug 443682 - Access to the super facet + */ +package org.eclipse.modisco.facet.custom.ui.internal.handler; + +import java.util.ArrayList; +import java.util.HashSet; +import java.util.List; +import java.util.Set; + +import org.eclipse.core.commands.AbstractHandler; +import org.eclipse.core.commands.ExecutionEvent; +import org.eclipse.core.commands.ExecutionException; +import org.eclipse.modisco.facet.custom.core.ICustomizationCatalogManager; +import org.eclipse.modisco.facet.custom.core.ICustomizationCatalogManagerFactory; +import org.eclipse.modisco.facet.custom.core.ICustomizationManager; +import org.eclipse.modisco.facet.custom.core.ICustomizationManagerProvider; +import org.eclipse.modisco.facet.custom.metamodel.v0_2_0.custom.Customization; +import org.eclipse.modisco.facet.custom.ui.internal.exported.dialog.ILoadCustomizationsDialog; +import org.eclipse.modisco.facet.custom.ui.internal.exported.dialog.ILoadCustomizationsDialogFactory; +import org.eclipse.modisco.facet.efacet.core.IFacetManager; +import org.eclipse.modisco.facet.util.ui.internal.exported.dialog.IDialogCallback; +import org.eclipse.modisco.facet.util.ui.internal.exported.dialog.IDialogCallbackWithPreCommit; +import org.eclipse.modisco.facet.util.ui.internal.exported.dialog.IQuestionDialog; +import org.eclipse.ui.IWorkbenchPart; +import org.eclipse.ui.handlers.HandlerUtil; + +public class LoadCustomizationsHandler extends AbstractHandler { + + public Object execute(final ExecutionEvent event) throws ExecutionException { + final IWorkbenchPart activePart = HandlerUtil.getActivePart(event); + if (activePart != null) { + final ICustomizationManagerProvider customMgrProvider = (ICustomizationManagerProvider) activePart + .getAdapter(ICustomizationManagerProvider.class); + if (customMgrProvider != null) { + final ICustomizationManager manager = customMgrProvider + .getCustomizationManager(); + final Set<Customization> availableCustoms = new HashSet<Customization>(); + final ICustomizationCatalogManager catalog = ICustomizationCatalogManagerFactory.DEFAULT + .getOrCreateCustomizationCatalogManager(manager.getResourceSet()); + availableCustoms.addAll(catalog.getRegisteredCustomizations()); + availableCustoms.addAll(manager.getManagedCustomizations()); + final IDialogCallbackWithPreCommit<List<Customization>, Boolean, IQuestionDialog> callback = new DialogCallbackWithPreCommit(manager); + final List<Customization> availableCustomsL = new ArrayList<Customization>( + availableCustoms); + final ILoadCustomizationsDialog<IQuestionDialog> dialog = ILoadCustomizationsDialogFactory.DEFAULT + .createLoadCustomizationDialog(null, + availableCustomsL, + manager.getManagedCustomizations(), + new ArrayList<Customization>(), + callback, + ""); //$NON-NLS-1$ + dialog.asyncOpen(); + } + } + return null; + } + + private class DialogCallbackWithPreCommit implements IDialogCallbackWithPreCommit<List<Customization>, Boolean, IQuestionDialog> { + + private final ICustomizationManager manager; + + public DialogCallbackWithPreCommit(final ICustomizationManager manager) { + this.manager = manager; + } + + public void committed(final List<Customization> result, + final Boolean precommitResult) { + if (precommitResult.booleanValue()) { + this.manager.getManagedCustomizations().clear(); + final IFacetManager facetManager = this.manager.getFacetManager(); + facetManager.getManagedFacetSets().addAll(0, result); + } + } + + public IQuestionDialog openPrecommitDialog( + final List<Customization> result, + final IDialogCallback<Boolean> precommitCallback) { + return null; + } + } +}
diff --git a/org.eclipse.modisco.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/internal/messages.properties b/org.eclipse.modisco.facet.custom.ui/src/org/eclipse/modisco/facet/custom/ui/internal/messages.properties similarity index 100% rename from org.eclipse.modisco.facet.custom.ui/src/org/eclipse/emf/facet/custom/ui/internal/messages.properties rename to org.eclipse.modisco.facet.custom.ui/src/org/eclipse/modisco/facet/custom/ui/internal/messages.properties
diff --git a/org.eclipse.modisco.facet.custom.ui/src/org/eclipse/modisco/facet/custom/ui/internal/query/BackgroundQuery.java b/org.eclipse.modisco.facet.custom.ui/src/org/eclipse/modisco/facet/custom/ui/internal/query/BackgroundQuery.java new file mode 100644 index 0000000..e5e08c2 --- /dev/null +++ b/org.eclipse.modisco.facet.custom.ui/src/org/eclipse/modisco/facet/custom/ui/internal/query/BackgroundQuery.java
@@ -0,0 +1,32 @@ +/** + * Copyright (c) 2012 Mia-Software. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Gregoire Dupe (Mia-Software) - Bug 361794 - [Restructuring] EMF Facet customization meta-model + * Gregoire Dupe (Mia-Software) - Bug 369987 - [Restructuring][Table] Switch to the new customization and facet framework + */ +package org.eclipse.modisco.facet.custom.ui.internal.query; + +import org.eclipse.emf.ecore.EObject; +import org.eclipse.modisco.facet.custom.metamodel.custompt.IColor; +import org.eclipse.modisco.facet.custom.ui.internal.custompt.Color; +import org.eclipse.modisco.facet.efacet.core.IFacetManager; +import org.eclipse.modisco.facet.efacet.core.exception.DerivedTypedElementException; +import org.eclipse.modisco.facet.query.java.core.IJavaQuery2; +import org.eclipse.modisco.facet.query.java.core.IParameterValueList2; + +public class BackgroundQuery implements IJavaQuery2<EObject, IColor> { + + public IColor evaluate(final EObject source, + final IParameterValueList2 parameterValues, + final IFacetManager facetManager) + throws DerivedTypedElementException { + return new Color(Color.MAX_VALUE, Color.MAX_VALUE, Color.MAX_VALUE); + } + +}
diff --git a/org.eclipse.modisco.facet.custom.ui/src/org/eclipse/modisco/facet/custom/ui/internal/query/ChildrenQuery.java b/org.eclipse.modisco.facet.custom.ui/src/org/eclipse/modisco/facet/custom/ui/internal/query/ChildrenQuery.java new file mode 100644 index 0000000..145a2d3 --- /dev/null +++ b/org.eclipse.modisco.facet.custom.ui/src/org/eclipse/modisco/facet/custom/ui/internal/query/ChildrenQuery.java
@@ -0,0 +1,30 @@ +/** + * Copyright (c) 2014 Mia-Software. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Gregoire Dupe (Mia-Software) - Bug 441570 - Children custom property + */ +package org.eclipse.modisco.facet.custom.ui.internal.query; + +import java.util.List; + +import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.ecore.EStructuralFeature; +import org.eclipse.modisco.facet.efacet.core.IFacetManager; +import org.eclipse.modisco.facet.efacet.core.exception.DerivedTypedElementException; +import org.eclipse.modisco.facet.query.java.core.IJavaQuery2; +import org.eclipse.modisco.facet.query.java.core.IParameterValueList2; + +public class ChildrenQuery implements IJavaQuery2<EObject, List<EStructuralFeature>> { + public List<EStructuralFeature> evaluate(final EObject context, + final IParameterValueList2 parameterValues, + final IFacetManager facetManager) + throws DerivedTypedElementException { + return null; + } +}
diff --git a/org.eclipse.modisco.facet.custom.ui/src/org/eclipse/modisco/facet/custom/ui/internal/query/FontNameQuery.java b/org.eclipse.modisco.facet.custom.ui/src/org/eclipse/modisco/facet/custom/ui/internal/query/FontNameQuery.java new file mode 100644 index 0000000..312d23f --- /dev/null +++ b/org.eclipse.modisco.facet.custom.ui/src/org/eclipse/modisco/facet/custom/ui/internal/query/FontNameQuery.java
@@ -0,0 +1,31 @@ +/** + * Copyright (c) 2012 Mia-Software. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Gregoire Dupe (Mia-Software) - Bug 361794 - [Restructuring] EMF Facet customization meta-model + * Gregoire Dupe (Mia-Software) - Bug 369987 - [Restructuring][Table] Switch to the new customization and facet framework + */ +package org.eclipse.modisco.facet.custom.ui.internal.query; + +import org.eclipse.emf.ecore.EObject; +import org.eclipse.modisco.facet.efacet.core.IFacetManager; +import org.eclipse.modisco.facet.efacet.core.exception.DerivedTypedElementException; +import org.eclipse.modisco.facet.query.java.core.IJavaQuery2; +import org.eclipse.modisco.facet.query.java.core.IParameterValueList2; +import org.eclipse.swt.widgets.Display; + +public class FontNameQuery implements IJavaQuery2<EObject, String> { + + public String evaluate(final EObject source, + final IParameterValueList2 parameterValues, + final IFacetManager facetManager) + throws DerivedTypedElementException { + return Display.getDefault().getSystemFont().getFontData()[0].getName(); + } + +}
diff --git a/org.eclipse.modisco.facet.custom.ui/src/org/eclipse/modisco/facet/custom/ui/internal/query/FontSizeQuery.java b/org.eclipse.modisco.facet.custom.ui/src/org/eclipse/modisco/facet/custom/ui/internal/query/FontSizeQuery.java new file mode 100644 index 0000000..05a05ee --- /dev/null +++ b/org.eclipse.modisco.facet.custom.ui/src/org/eclipse/modisco/facet/custom/ui/internal/query/FontSizeQuery.java
@@ -0,0 +1,31 @@ +/** + * Copyright (c) 2012 Mia-Software. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Gregoire Dupe (Mia-Software) - Bug 361794 - [Restructuring] EMF Facet customization meta-model + * Gregoire Dupe (Mia-Software) - Bug 369987 - [Restructuring][Table] Switch to the new customization and facet framework + */ +package org.eclipse.modisco.facet.custom.ui.internal.query; + +import org.eclipse.emf.ecore.EObject; +import org.eclipse.modisco.facet.efacet.core.IFacetManager; +import org.eclipse.modisco.facet.efacet.core.exception.DerivedTypedElementException; +import org.eclipse.modisco.facet.query.java.core.IJavaQuery2; +import org.eclipse.modisco.facet.query.java.core.IParameterValueList2; +import org.eclipse.swt.widgets.Display; + +public class FontSizeQuery implements IJavaQuery2<EObject, Integer> { + + public Integer evaluate(final EObject source, + final IParameterValueList2 parameterValues, + final IFacetManager facetManager) + throws DerivedTypedElementException { + return Integer.valueOf(Display.getDefault().getSystemFont().getFontData()[0].getHeight()); + } + +}
diff --git a/org.eclipse.modisco.facet.custom.ui/src/org/eclipse/modisco/facet/custom/ui/internal/query/ForegroundQuery.java b/org.eclipse.modisco.facet.custom.ui/src/org/eclipse/modisco/facet/custom/ui/internal/query/ForegroundQuery.java new file mode 100644 index 0000000..1697aed --- /dev/null +++ b/org.eclipse.modisco.facet.custom.ui/src/org/eclipse/modisco/facet/custom/ui/internal/query/ForegroundQuery.java
@@ -0,0 +1,32 @@ +/** + * Copyright (c) 2012 Mia-Software. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Gregoire Dupe (Mia-Software) - Bug 361794 - [Restructuring] EMF Facet customization meta-model + * Gregoire Dupe (Mia-Software) - Bug 369987 - [Restructuring][Table] Switch to the new customization and facet framework + */ +package org.eclipse.modisco.facet.custom.ui.internal.query; + +import org.eclipse.emf.ecore.EObject; +import org.eclipse.modisco.facet.custom.metamodel.custompt.IColor; +import org.eclipse.modisco.facet.custom.ui.internal.custompt.Color; +import org.eclipse.modisco.facet.efacet.core.IFacetManager; +import org.eclipse.modisco.facet.efacet.core.exception.DerivedTypedElementException; +import org.eclipse.modisco.facet.query.java.core.IJavaQuery2; +import org.eclipse.modisco.facet.query.java.core.IParameterValueList2; + +public class ForegroundQuery implements IJavaQuery2<EObject, IColor> { + + public IColor evaluate(final EObject source, + final IParameterValueList2 parameterValues, + final IFacetManager facetManager) + throws DerivedTypedElementException { + return new Color(0, 0, 0); + } + +}
diff --git a/org.eclipse.modisco.facet.custom.ui/src/org/eclipse/modisco/facet/custom/ui/internal/query/ImageQuery.java b/org.eclipse.modisco.facet.custom.ui/src/org/eclipse/modisco/facet/custom/ui/internal/query/ImageQuery.java new file mode 100644 index 0000000..d6d8988 --- /dev/null +++ b/org.eclipse.modisco.facet.custom.ui/src/org/eclipse/modisco/facet/custom/ui/internal/query/ImageQuery.java
@@ -0,0 +1,130 @@ +/** + * Copyright (c) 2011, 2015 Mia-Software, and Soft-Maint. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Gregoire Dupe (Mia-Software) - Bug 361794 - [Restructuring] EMF Facet customization meta-model + * Gregoire Dupe (Mia-Software) - Bug 369987 - [Restructuring][Table] Switch to the new customization and facet framework + * Nicolas Bros (Mia-Software) - Bug 379683 - customizable Tree content provider + * Gregoire Dupe (Mia-Software) - Bug 424122 - [Table] Images, fonts and colors are not shared between the instances of table + * Jonathan Pepin (Soft-Maint) - Bug 469177 - IResolvingCustomizedLabelProviderFactory display no default Image + * Grégoire Dupé (Mia-Software) - Bug 469177 - IResolvingCustomizedLabelProviderFactory display no default Image + */ +package org.eclipse.modisco.facet.custom.ui.internal.query; + +import org.eclipse.emf.ecore.EAttribute; +import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.ecore.EReference; +import org.eclipse.emf.ecore.ETypedElement; +import org.eclipse.emf.edit.provider.ComposedAdapterFactory; +import org.eclipse.emf.edit.provider.IItemLabelProvider; +import org.eclipse.emf.edit.ui.provider.ExtendedImageRegistry; +import org.eclipse.jface.resource.ImageDescriptor; +import org.eclipse.modisco.facet.custom.metamodel.custompt.IImage; +import org.eclipse.modisco.facet.custom.ui.internal.Activator; +import org.eclipse.modisco.facet.custom.ui.internal.ImageProvider; +import org.eclipse.modisco.facet.custom.ui.internal.custompt.ImageWrapper; +import org.eclipse.modisco.facet.efacet.core.IFacetManager; +import org.eclipse.modisco.facet.efacet.core.exception.DerivedTypedElementException; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.FacetAttribute; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.FacetReference; +import org.eclipse.modisco.facet.query.java.core.IJavaQuery2; +import org.eclipse.modisco.facet.query.java.core.IParameterValueList2; +import org.eclipse.modisco.facet.util.swt.imageprovider.IImageProvider; +import org.eclipse.modisco.facet.util.swt.imageprovider.IImageProviderFactory; +import org.eclipse.swt.graphics.Image; + +public class ImageQuery implements IJavaQuery2<EObject, IImage> { + + public IImage evaluate(final EObject source, + final IParameterValueList2 parameterValues, + final IFacetManager facetManager) + throws DerivedTypedElementException { + IImage result = null; + ETypedElement sfParam = null; + if (parameterValues != null) { + sfParam = (ETypedElement) parameterValues + .getParameterValueByName("eStructuralFeature").getValue(); //$NON-NLS-1$ + } + if (sfParam == null) { + result = getEObjectImage(source); + } else { + result = getLinkImage(sfParam); + } + return result; + } + + protected static IImage getEObjectImage(final EObject source) { + IImage result = null; + final ComposedAdapterFactory adapterFactory = new ComposedAdapterFactory( + ComposedAdapterFactory.Descriptor.Registry.INSTANCE); + final IItemLabelProvider itemLabelProvider = (IItemLabelProvider) adapterFactory + .adapt(source, IItemLabelProvider.class); + if (itemLabelProvider != null) { + final Object imageObj = itemLabelProvider.getImage(source); + final ImageDescriptor imgDescriptor = ExtendedImageRegistry + .getInstance().getImageDescriptor(imageObj); + final IImageProvider imgProvider = IImageProviderFactory.DEFAULT + .createIImageProvider(Activator.getDefault()); + if (imgDescriptor != null) { + final Image image = imgProvider.getImage(imgDescriptor); + result = new ImageWrapper(image); + } + } + return result; + } + + /** + * Returns the image for an attribute or reference link. + * + * @param sfParam + * the attribute or reference + * @param source + * the EObject under which the attribute or reference appears + * @return the image + */ + private static IImage getLinkImage(final ETypedElement sfParam) { + Image image = null; + if (sfParam instanceof FacetReference) { + image = ImageProvider.getInstance().getFacetLinkIcon(); + } else if (sfParam instanceof EReference) { + image = getReferenceImage((EReference) sfParam); + } else if (sfParam instanceof FacetAttribute) { + image = ImageProvider.getInstance().getFacetAttributeIcon(); + } else if (sfParam instanceof EAttribute) { + image = getAttributeImage(); + } else { + image = ImageProvider.getInstance().getFeatureIcon(); + } + return new ImageWrapper(image); + } + + private static Image getReferenceImage(final EReference reference) { + Image result; + final EReference opposite = reference.getEOpposite(); + if (reference.isContainment()) { + if (opposite == null) { + result = ImageProvider.getInstance().getUnidirectionalAggregIcon(); + } else { + result = ImageProvider.getInstance().getAggregIcon(); + } + } else { + if (opposite != null && opposite.isContainment()) { + result = ImageProvider.getInstance().getInvAggregIcon(); + } else if (opposite == null) { + result = ImageProvider.getInstance().getUnidirectionalLinkIcon(); + } else { + result = ImageProvider.getInstance().getLinkIcon(); + } + } + return result; + } + + private static Image getAttributeImage() { + return ImageProvider.getInstance().getAttributeIcon(); + } +}
diff --git a/org.eclipse.modisco.facet.custom.ui/src/org/eclipse/modisco/facet/custom/ui/internal/query/LabelQuery.java b/org.eclipse.modisco.facet.custom.ui/src/org/eclipse/modisco/facet/custom/ui/internal/query/LabelQuery.java new file mode 100644 index 0000000..09be9b0 --- /dev/null +++ b/org.eclipse.modisco.facet.custom.ui/src/org/eclipse/modisco/facet/custom/ui/internal/query/LabelQuery.java
@@ -0,0 +1,136 @@ +/** + * Copyright (c) 2011 Mia-Software. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Gregoire Dupe (Mia-Software) - Bug 361794 - [Restructuring] EMF Facet customization meta-model + * Gregoire Dupe (Mia-Software) - Bug 369987 - [Restructuring][Table] Switch to the new customization and facet framework + * Gregoire Dupe (Mia-Software) - Bug 373078 - API Cleaning + * Gregoire Dupe (Mia-Software) - Bug 375087 - [Table] ITableWidget.addColumn(List<ETypedElement>, List<FacetSet>) + * Nicolas Bros (Mia-Software) - Bug 379683 - customizable Tree content provider + */ +package org.eclipse.modisco.facet.custom.ui.internal.query; + +import org.eclipse.emf.ecore.EAttribute; +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.ecore.EStructuralFeature; +import org.eclipse.emf.ecore.ETypedElement; +import org.eclipse.emf.ecore.util.FeatureMap; +import org.eclipse.emf.edit.provider.ComposedAdapterFactory; +import org.eclipse.emf.edit.provider.IItemLabelProvider; +import org.eclipse.emf.edit.provider.ReflectiveItemProvider; +import org.eclipse.modisco.facet.efacet.core.IFacetManager; +import org.eclipse.modisco.facet.efacet.core.exception.DerivedTypedElementException; +import org.eclipse.modisco.facet.query.java.core.IJavaQuery2; +import org.eclipse.modisco.facet.query.java.core.IParameterValueList2; +import org.eclipse.modisco.facet.util.emf.core.ModelUtils; + +public class LabelQuery implements IJavaQuery2<EObject, String> { + + private static final String NAME = "name"; //$NON-NLS-1$ + + public String evaluate(final EObject source, + final IParameterValueList2 parameterValues, + final IFacetManager facetManager) + throws DerivedTypedElementException { + ETypedElement sfParam = null; + if (parameterValues != null) { + sfParam = (ETypedElement) parameterValues + .getParameterValueByName("eStructuralFeature").getValue(); //$NON-NLS-1$ + } + String result = null; + if (sfParam == null) { + final ComposedAdapterFactory adapterFactory = new ComposedAdapterFactory( + ComposedAdapterFactory.Descriptor.Registry.INSTANCE); + final IItemLabelProvider itemLabelProvider = (IItemLabelProvider) adapterFactory + .adapt(source, IItemLabelProvider.class); + // We don't want to use a ReflectiveItemProvider because it provides + // a string prefixed with the eObject's meta-class name. + if (itemLabelProvider instanceof ReflectiveItemProvider) { + result = LabelQuery.getDefaultName(source); + } else if (itemLabelProvider == null) { + result = ModelUtils.getDefaultName(source); + } else { + result = itemLabelProvider.getText(source); + } + } else { + try { + if (sfParam instanceof EAttribute && sfParam.getUpperBound() == 1) { + final Object object = facetManager.getOrInvoke(source, sfParam, Object.class); + final String objectLabel = getObjectLabel(object, facetManager); + result = sfParam.getName() + " = " + objectLabel; //$NON-NLS-1$ + } else { + result = sfParam.getName(); + } + } catch (final Exception e) { + throw new DerivedTypedElementException(e); + } + } + return result; + } + + private String getObjectLabel(final Object object, + final IFacetManager facetManager) + throws DerivedTypedElementException { + String result; + if (object instanceof EObject) { + final EObject eObject = (EObject) object; + result = evaluate(eObject, null, facetManager); + } else { + result = String.valueOf(object); + } + return result; + } + + /** + * @return a default name based on a string feature of the given + * {@link EObject} + */ + // from org.eclipse.emf.facet.infra.common.core.internal.utils.ModelUtils + public static String getDefaultName(final EObject eObject) { + String result = ""; //$NON-NLS-1$ + // find a feature that can be used as a name + final EStructuralFeature feature = LabelQuery.getLabelFeature(eObject + .eClass()); + if (feature != null) { + result = (String) eObject.eGet(feature); + } + return result; + } + + /** + * This method searches for a structural feature that can be used as a name + * + * @param eClass + * in which class to search a structural feature that can be used as + * a name + * @return an EStructuralFeature + */ + // Copied from org.eclipse.emf.edit.provider.ReflectiveItemProvider to org.eclipse.emf.facet.infra.common.core.internal.utils.ModelUtils + // Copied from org.eclipse.emf.facet.infra.common.core.internal.utils.ModelUtils + private static EStructuralFeature getLabelFeature(final EClass eClass) { + EAttribute result = null; + for (final EAttribute eAttribute : eClass.getEAllAttributes()) { + if (!eAttribute.isMany() + && eAttribute.getEType().getInstanceClass() != FeatureMap.Entry.class) { + if (LabelQuery.NAME.equalsIgnoreCase(eAttribute + .getName())) { + result = eAttribute; + break; + } else if (result == null) { + result = eAttribute; + } else if (eAttribute.getEAttributeType().getInstanceClass() == String.class + && result.getEAttributeType().getInstanceClass() != String.class) { + result = eAttribute; + } + } + } + return result; + } + +}
diff --git a/org.eclipse.modisco.facet.custom.ui/src/org/eclipse/modisco/facet/custom/ui/internal/query/SelectionQuery.java b/org.eclipse.modisco.facet.custom.ui/src/org/eclipse/modisco/facet/custom/ui/internal/query/SelectionQuery.java new file mode 100644 index 0000000..3a2bf71 --- /dev/null +++ b/org.eclipse.modisco.facet.custom.ui/src/org/eclipse/modisco/facet/custom/ui/internal/query/SelectionQuery.java
@@ -0,0 +1,59 @@ +/******************************************************************************* + * Copyright (c) 2012 Mia-Software. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Nicolas Bros (Mia-Software) - Bug 377866 - selection customization + *******************************************************************************/ +package org.eclipse.modisco.facet.custom.ui.internal.query; + +import java.util.Collections; +import java.util.List; + +import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.ecore.ETypedElement; +import org.eclipse.modisco.facet.efacet.core.IFacetManager; +import org.eclipse.modisco.facet.efacet.core.exception.DerivedTypedElementException; +import org.eclipse.modisco.facet.efacet.core.exception.FacetManagerException; +import org.eclipse.modisco.facet.query.java.core.IJavaQuery2; +import org.eclipse.modisco.facet.query.java.core.IParameterValueList2; + +/** + * This is the query that returns the default selection for a given source and feature (i.e. row and column in a table). + * By default, the selection is the {@link EObject} (or list of {@link EObject}s) returned by evaluating the feature on + * the source. + */ +public class SelectionQuery implements IJavaQuery2<EObject, List<Object>> { + + // @SuppressWarnings("unchecked") : facet manager is not type safe + @SuppressWarnings("unchecked") + public List<Object> evaluate(final EObject source, + final IParameterValueList2 parameterValues, + final IFacetManager facetManager) + throws DerivedTypedElementException { + if (parameterValues.size() != 1) { + throw new DerivedTypedElementException("the selection query expects one argument"); //$NON-NLS-1$ + } + final Object param1 = parameterValues.get(0).getValue(); + if (!(param1 instanceof ETypedElement)) { + throw new DerivedTypedElementException("the selection query expects an ETypedElement argument"); //$NON-NLS-1$ + } + final ETypedElement feature = (ETypedElement) param1; + + final List<Object> result; + try { + final Object featureResult = facetManager.getOrInvoke(source, feature, null); + if (feature.isMany()) { + result = (List<Object>) featureResult; + } else { + result = Collections.singletonList(featureResult); + } + } catch (FacetManagerException e) { + throw new DerivedTypedElementException(e); + } + return result; + } +}
diff --git a/org.eclipse.modisco.facet.custom.ui/src/org/eclipse/modisco/facet/custom/ui/internal/query/ToolTipAlignmentQuery.java b/org.eclipse.modisco.facet.custom.ui/src/org/eclipse/modisco/facet/custom/ui/internal/query/ToolTipAlignmentQuery.java new file mode 100644 index 0000000..e15949b --- /dev/null +++ b/org.eclipse.modisco.facet.custom.ui/src/org/eclipse/modisco/facet/custom/ui/internal/query/ToolTipAlignmentQuery.java
@@ -0,0 +1,37 @@ +/***************************************************************************** + * Copyright (c) 2012 CEA LIST. + * + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Vincent Lorenzo (CEA-LIST) - Bug 372644 - Create Customizable tooltips for the TreeViewer using a CustomizableLabelProvider + * + *****************************************************************************/ + +package org.eclipse.modisco.facet.custom.ui.internal.query; + +import org.eclipse.emf.ecore.EObject; +import org.eclipse.modisco.facet.custom.metamodel.v0_2_0.custompt.Alignment; +import org.eclipse.modisco.facet.efacet.core.IFacetManager; +import org.eclipse.modisco.facet.efacet.core.exception.DerivedTypedElementException; +import org.eclipse.modisco.facet.query.java.core.IJavaQuery2; +import org.eclipse.modisco.facet.query.java.core.IParameterValueList2; + +/** + * + * This query is used to get the default alignment for the tooltip texts + * + */ +public class ToolTipAlignmentQuery implements IJavaQuery2<EObject, Alignment> { + + public Alignment evaluate(final EObject source, + final IParameterValueList2 parameterValues, + final IFacetManager facetManager) + throws DerivedTypedElementException { + return Alignment.LEFT; + } +}
diff --git a/org.eclipse.modisco.facet.custom.ui/src/org/eclipse/modisco/facet/custom/ui/internal/query/ToolTipBackgroundQuery.java b/org.eclipse.modisco.facet.custom.ui/src/org/eclipse/modisco/facet/custom/ui/internal/query/ToolTipBackgroundQuery.java new file mode 100644 index 0000000..56dd24a --- /dev/null +++ b/org.eclipse.modisco.facet.custom.ui/src/org/eclipse/modisco/facet/custom/ui/internal/query/ToolTipBackgroundQuery.java
@@ -0,0 +1,41 @@ +/***************************************************************************** + * Copyright (c) 2012 CEA LIST. + * + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Vincent Lorenzo (CEA-LIST) - Bug 372644 - Create Customizable tooltips for the TreeViewer using a CustomizableLabelProvider + * + *****************************************************************************/ + +package org.eclipse.modisco.facet.custom.ui.internal.query; + +import org.eclipse.emf.ecore.EObject; +import org.eclipse.modisco.facet.custom.metamodel.custompt.IColor; +import org.eclipse.modisco.facet.custom.ui.internal.custompt.Color; +import org.eclipse.modisco.facet.efacet.core.IFacetManager; +import org.eclipse.modisco.facet.efacet.core.exception.DerivedTypedElementException; +import org.eclipse.modisco.facet.query.java.core.IJavaQuery2; +import org.eclipse.modisco.facet.query.java.core.IParameterValueList2; + +/** + * + * This query is used to get the default background color for the tooltips (255,255,225) + * + */ +public class ToolTipBackgroundQuery implements IJavaQuery2<EObject, IColor> { + + private static final int BCK_GND_BLUE = 225; + + public IColor evaluate(final EObject source, + final IParameterValueList2 parameterValues, + final IFacetManager facetManager) + throws DerivedTypedElementException { + //default yellow background for tooltip + return new Color(Color.MAX_VALUE, Color.MAX_VALUE, ToolTipBackgroundQuery.BCK_GND_BLUE); + } +}
diff --git a/org.eclipse.modisco.facet.custom.ui/src/org/eclipse/modisco/facet/custom/ui/internal/query/ToolTipDelayQuery.java b/org.eclipse.modisco.facet.custom.ui/src/org/eclipse/modisco/facet/custom/ui/internal/query/ToolTipDelayQuery.java new file mode 100644 index 0000000..16e594f --- /dev/null +++ b/org.eclipse.modisco.facet.custom.ui/src/org/eclipse/modisco/facet/custom/ui/internal/query/ToolTipDelayQuery.java
@@ -0,0 +1,35 @@ +/***************************************************************************** + * Copyright (c) 2012 CEA LIST. + * + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Vincent Lorenzo (CEA-LIST) - Bug 372644 - Create Customizable tooltips for the TreeViewer using a CustomizableLabelProvider + * + *****************************************************************************/ +package org.eclipse.modisco.facet.custom.ui.internal.query; + +import org.eclipse.emf.ecore.EObject; +import org.eclipse.modisco.facet.efacet.core.IFacetManager; +import org.eclipse.modisco.facet.efacet.core.exception.DerivedTypedElementException; +import org.eclipse.modisco.facet.query.java.core.IJavaQuery2; +import org.eclipse.modisco.facet.query.java.core.IParameterValueList2; + +/** + * + * This query is used to get the default time for the tooltips + * + */ +public class ToolTipDelayQuery implements IJavaQuery2<EObject, Integer> { + + public Integer evaluate(final EObject source, + final IParameterValueList2 parameterValues, + final IFacetManager facetManager) + throws DerivedTypedElementException { + return Integer.valueOf(0); + } +}
diff --git a/org.eclipse.modisco.facet.custom.ui/src/org/eclipse/modisco/facet/custom/ui/internal/query/ToolTipShadowQuery.java b/org.eclipse.modisco.facet.custom.ui/src/org/eclipse/modisco/facet/custom/ui/internal/query/ToolTipShadowQuery.java new file mode 100644 index 0000000..09d2697 --- /dev/null +++ b/org.eclipse.modisco.facet.custom.ui/src/org/eclipse/modisco/facet/custom/ui/internal/query/ToolTipShadowQuery.java
@@ -0,0 +1,37 @@ +/***************************************************************************** + * Copyright (c) 2012 CEA LIST. + * + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Vincent Lorenzo (CEA-LIST) - Bug 372644 - Create Customizable tooltips for the TreeViewer using a CustomizableLabelProvider + * + *****************************************************************************/ + +package org.eclipse.modisco.facet.custom.ui.internal.query; + +import org.eclipse.emf.ecore.EObject; +import org.eclipse.modisco.facet.custom.metamodel.v0_2_0.custompt.Shadow; +import org.eclipse.modisco.facet.efacet.core.IFacetManager; +import org.eclipse.modisco.facet.efacet.core.exception.DerivedTypedElementException; +import org.eclipse.modisco.facet.query.java.core.IJavaQuery2; +import org.eclipse.modisco.facet.query.java.core.IParameterValueList2; + +/** + * + * This query is used to get the default shadow for the tooltips + * + */ +public class ToolTipShadowQuery implements IJavaQuery2<EObject, Shadow> { + + public Shadow evaluate(final EObject source, + final IParameterValueList2 parameterValues, + final IFacetManager facetManager) + throws DerivedTypedElementException { + return Shadow.NONE; + } +}
diff --git a/org.eclipse.modisco.facet.custom.ui/src/org/eclipse/modisco/facet/custom/ui/internal/query/ToolTipTextQuery.java b/org.eclipse.modisco.facet.custom.ui/src/org/eclipse/modisco/facet/custom/ui/internal/query/ToolTipTextQuery.java new file mode 100644 index 0000000..f19d1fd --- /dev/null +++ b/org.eclipse.modisco.facet.custom.ui/src/org/eclipse/modisco/facet/custom/ui/internal/query/ToolTipTextQuery.java
@@ -0,0 +1,76 @@ +/******************************************************************************* + * Copyright (c) 2012 CEA LIST. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Vincent Lorenzo (CEA-LIST) - Bug 373255 - Add tooltips providing a documentation for the selected elements in the Select ETypedElement Dialog + * + *******************************************************************************/ + +package org.eclipse.modisco.facet.custom.ui.internal.query; + +import org.eclipse.emf.ecore.EAnnotation; +import org.eclipse.emf.ecore.EModelElement; +import org.eclipse.emf.ecore.EObject; +import org.eclipse.modisco.facet.custom.ui.internal.Messages; +import org.eclipse.modisco.facet.efacet.core.IFacetManager; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.DocumentedElement; +import org.eclipse.modisco.facet.query.java.core.IJavaQuery2; +import org.eclipse.modisco.facet.query.java.core.IParameterValueList2; +import org.eclipse.osgi.util.NLS; + +/** + * + * This query returns the tooltip to display for DocumentedElement and + * EModelElement + * + */ +public class ToolTipTextQuery implements IJavaQuery2<EObject, String> { + + /** the URI used by EAnnotation for the documentation for the documentation */ + public static final String URI_GEN_MODEL = "http://www.eclipse.org/emf/2002/GenModel"; //$NON-NLS-1$ + + /** the key to get the documentation in an EAnnotation */ + public static final String DOCUMENTATION = "documentation"; //$NON-NLS-1$ + + /** the String displayed when there is no documentation */ + public static final String NO_DOCUMENTATION = Messages.ToolTipTextQuery_NoDocumentation; + + public String evaluate(final EObject source, + final IParameterValueList2 parameterValues, + final IFacetManager facetManager) { + String result = null; + final String documentation = getDocumentation(source); + if (documentation != null) { + result = NLS.bind(Messages.ToolTipTextQuery_Documentation, + documentation); + } + return result; + } + + /** + * + * @param source + * @param parameterValues + * @param facetManager + * @return the documentation for DocumentedElement and EModelElement + */ + private static String getDocumentation(final EObject source) { + String documentation = ""; //$NON-NLS-1$ + if (source instanceof DocumentedElement) { + documentation = ((DocumentedElement) source).getDocumentation(); + } else if (source instanceof EModelElement) { + final EAnnotation eAnnotation = ((EModelElement) source) + .getEAnnotation(ToolTipTextQuery.URI_GEN_MODEL); + if (eAnnotation != null) { + documentation = eAnnotation.getDetails().get( + ToolTipTextQuery.DOCUMENTATION); + } + } + return documentation; + } +} \ No newline at end of file
diff --git a/org.eclipse.modisco.facet.custom.ui/src/org/eclipse/modisco/facet/custom/ui/internal/query/URIImageQueryImplementationFactory.java b/org.eclipse.modisco.facet.custom.ui/src/org/eclipse/modisco/facet/custom/ui/internal/query/URIImageQueryImplementationFactory.java new file mode 100644 index 0000000..3f6a573 --- /dev/null +++ b/org.eclipse.modisco.facet.custom.ui/src/org/eclipse/modisco/facet/custom/ui/internal/query/URIImageQueryImplementationFactory.java
@@ -0,0 +1,39 @@ +/** + * Copyright (c) 2013 Soft-Maint. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * David Couvrand (Soft-Maint) - Bug 402725 - Need a query to get an image from an URI + * Nicolas Rault (Soft-Maint) - Bug 402725 - Need a query to get an image from an URI + */ + +package org.eclipse.modisco.facet.custom.ui.internal.query; + +import org.eclipse.emf.ecore.EClass; +import org.eclipse.modisco.facet.custom.metamodel.v0_3_0.query.QueryPackage; +import org.eclipse.modisco.facet.custom.ui.internal.querytype.URIImageQueryEvaluator; +import org.eclipse.modisco.facet.efacet.core.IDerivedTypedElementManager; +import org.eclipse.modisco.facet.efacet.core.exception.DerivedTypedElementException; +import org.eclipse.modisco.facet.efacet.core.query.IQueryImplementation; +import org.eclipse.modisco.facet.efacet.core.query.IQueryImplementationFactory; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.extensible.Query; +import org.osgi.framework.Bundle; + +public class URIImageQueryImplementationFactory implements + IQueryImplementationFactory { + + public IQueryImplementation create(final Query query, + final Bundle queryBundle, final IDerivedTypedElementManager manager) + throws DerivedTypedElementException { + return new URIImageQueryEvaluator(); + } + + public EClass getManagedQueryType() { + return QueryPackage.eINSTANCE.getURIImageQuery(); + } + +}
diff --git a/org.eclipse.modisco.facet.custom.ui/src/org/eclipse/modisco/facet/custom/ui/internal/querytype/URIImageQueryEvaluator.java b/org.eclipse.modisco.facet.custom.ui/src/org/eclipse/modisco/facet/custom/ui/internal/querytype/URIImageQueryEvaluator.java new file mode 100644 index 0000000..8908ec6 --- /dev/null +++ b/org.eclipse.modisco.facet.custom.ui/src/org/eclipse/modisco/facet/custom/ui/internal/querytype/URIImageQueryEvaluator.java
@@ -0,0 +1,53 @@ +/** + * Copyright (c) 2013 Soft-Maint. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * David Couvrand (Soft-Maint) - Bug 402725 - Need a query to get an image from an URI + * Nicolas Rault (Soft-Maint) - Bug 402725 - Need a query to get an image from an URI + */ +package org.eclipse.modisco.facet.custom.ui.internal.querytype; + +import java.util.List; + +import org.eclipse.emf.ecore.EObject; +import org.eclipse.modisco.facet.custom.metamodel.v0_3_0.query.URIImageQuery; +import org.eclipse.modisco.facet.custom.ui.internal.custompt.URIImage; +import org.eclipse.modisco.facet.efacet.core.IFacetManager; +import org.eclipse.modisco.facet.efacet.core.exception.DerivedTypedElementException; +import org.eclipse.modisco.facet.efacet.core.query.IQueryImplementation; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.DerivedTypedElement; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.ParameterValue; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.extensible.Query; + +public class URIImageQueryEvaluator implements IQueryImplementation { + + public void setValue(final Query query, + final DerivedTypedElement feature, final EObject source, + final List<ParameterValue> parameterValues, + final Object newValue) throws DerivedTypedElementException { + throw new DerivedTypedElementException("Not implemented method"); //$NON-NLS-1$ + } + + public boolean isCheckResultType() { + return false; + } + + public Object getValue(final Query query, + final DerivedTypedElement feature, final EObject source, + final List<ParameterValue> parameterValues, + final IFacetManager facetManager) + throws DerivedTypedElementException { + // This cast is safe. The framework should only pass a query + // instance of URIImageQuery, because it has been declared in + // the method 'getManagedQueryType' that this query + // implementation is dedicated to the URIImageQuery type. + final String uri = ((URIImageQuery) query).getUri(); + return new URIImage(uri); + } + +}
diff --git a/org.eclipse.modisco.facet.custom.ui/src/org/eclipse/modisco/facet/custom/ui/internal/view/CustomizationsCatalogView.java b/org.eclipse.modisco.facet.custom.ui/src/org/eclipse/modisco/facet/custom/ui/internal/view/CustomizationsCatalogView.java new file mode 100644 index 0000000..e8fb0ad --- /dev/null +++ b/org.eclipse.modisco.facet.custom.ui/src/org/eclipse/modisco/facet/custom/ui/internal/view/CustomizationsCatalogView.java
@@ -0,0 +1,223 @@ +/******************************************************************************* + * Copyright (c) 2009-2012 Mia-Software. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Nicolas Bros (Mia-Software) - initial API and implementation + * Nicolas Guyomar (Mia-Software) - Bug 333652 Extension point offering the possibility to declare an EPackage browser + * Nicolas Bros (Mia-Software) - Bug 372732 - [Facet] Rewrite the catalog views for 0.2 + * Nicolas Bros (Mia-Software) - Bug 372626 - Aggregates + * Gregoire Dupe (Mia-Software) - Bug 373078 - API Cleaning + *******************************************************************************/ +package org.eclipse.modisco.facet.custom.ui.internal.view; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.List; + +import org.eclipse.core.runtime.CoreException; +import org.eclipse.core.runtime.IExecutableExtensionFactory; +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.ENamedElement; +import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.ecore.EPackage; +import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl; +import org.eclipse.jface.viewers.ColumnLabelProvider; +import org.eclipse.jface.viewers.IOpenListener; +import org.eclipse.jface.viewers.ITreeContentProvider; +import org.eclipse.jface.viewers.OpenEvent; +import org.eclipse.jface.viewers.Viewer; +import org.eclipse.modisco.facet.common.ui.internal.exported.views.IColumnDescription; +import org.eclipse.modisco.facet.common.ui.internal.exported.views.IElementsViewFactory; +import org.eclipse.modisco.facet.custom.core.ICustomizationCatalogManager; +import org.eclipse.modisco.facet.custom.core.ICustomizationCatalogManagerFactory; +import org.eclipse.modisco.facet.custom.core.internal.exported.CustomizationUtils; +import org.eclipse.modisco.facet.custom.metamodel.v0_2_0.custom.Customization; +import org.eclipse.modisco.facet.custom.ui.internal.ImageProvider; +import org.eclipse.modisco.facet.custom.ui.internal.Messages; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.DocumentedElement; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.Facet; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.FacetSet; +import org.eclipse.swt.graphics.Image; + +public class CustomizationsCatalogView implements IExecutableExtensionFactory, IOpenListener { + + public Object create() throws CoreException { + this.customizationCatalogManager = ICustomizationCatalogManagerFactory.DEFAULT.getOrCreateCustomizationCatalogManager(new ResourceSetImpl()); + Collection<IColumnDescription> columnDescriptions = new ArrayList<IColumnDescription>(); + columnDescriptions.add(createNameColumnDescription()); + columnDescriptions.add(createExtendsColumnDescription()); + columnDescriptions.add(createDocumentationColumnDescription()); + return IElementsViewFactory.DEFAULT.createElementsView(columnDescriptions, getContentProvider(), getInput(), + Messages.CustomizationsCatalogView_title, ImageProvider.getInstance().getUiCustomIcon(), this); + } + + private static final String NAME_COLUMN = "CustomizationsView_NameColumn"; //$NON-NLS-1$ + private static final String EXTENDS_COLUMN = "CustomizationsView_ExtendsColumn"; //$NON-NLS-1$ + private static final String DOCUMENTATION_COLUMN = "CustomizationsView_DocumentationColumn"; //$NON-NLS-1$ + + private static final int NAME_COLUMN_WIDTH = 300; + private static final int EXTENDS_COLUMN_WIDTH = 300; + private static final int DOCUMENTATION_COLUMN_WIDTH = 400; + + private ICustomizationCatalogManager customizationCatalogManager; + + private static IColumnDescription createNameColumnDescription() { + ColumnLabelProvider columnLabelProvider = new ColumnLabelProvider() { + @Override + public String getText(final Object element) { + String result; + if (element instanceof ENamedElement) { + ENamedElement namedElement = (ENamedElement) element; + result = namedElement.getName(); + } else { + result = "<" + element.getClass().getName() + ">"; //$NON-NLS-1$//$NON-NLS-2$ + } + return result; + } + + @Override + public Image getImage(final Object element) { + return ImageProvider.getInstance().getUiCustomIcon(); + } + }; + return IElementsViewFactory.DEFAULT.createColumnDescription(Messages.CustomizationsView_nameColumn, CustomizationsCatalogView.NAME_COLUMN, + CustomizationsCatalogView.NAME_COLUMN_WIDTH, columnLabelProvider); + } + + private static IColumnDescription createExtendsColumnDescription() { + ColumnLabelProvider columnLabelProvider = new ColumnLabelProvider() { + @Override + public String getText(final Object element) { + String result = null; + if (element instanceof Customization) { + Customization customization = (Customization) element; + EPackage customizedEPackage = CustomizationUtils + .getCustomizedEPackage(customization); + if (customizedEPackage != null) { + result = customizedEPackage.getNsURI(); + } + } else if (element instanceof Facet) { + Facet facet = (Facet) element; + EClass extendedMetaclass = facet.getExtendedMetaclass(); + if (extendedMetaclass != null) { + result = extendedMetaclass.getName(); + } + } + return result; + } + }; + return IElementsViewFactory.DEFAULT.createColumnDescription(Messages.CustomizationsView_extendsColumn, + CustomizationsCatalogView.EXTENDS_COLUMN, + CustomizationsCatalogView.EXTENDS_COLUMN_WIDTH, columnLabelProvider); + } + + private static IColumnDescription createDocumentationColumnDescription() { + ColumnLabelProvider columnLabelProvider = new ColumnLabelProvider() { + @Override + public String getText(final Object element) { + String result = null; + if (element instanceof DocumentedElement) { + DocumentedElement documentedElement = (DocumentedElement) element; + result = documentedElement.getDocumentation(); + } + return result; + } + }; + return IElementsViewFactory.DEFAULT.createColumnDescription(Messages.CustomizationsView_documentationColumn, + CustomizationsCatalogView.DOCUMENTATION_COLUMN, CustomizationsCatalogView.DOCUMENTATION_COLUMN_WIDTH, + columnLabelProvider); + } + + protected static ITreeContentProvider getContentProvider() { + return new ITreeContentProvider() { + public Object[] getElements(final Object inputElement) { + @SuppressWarnings("unchecked") + final Collection<Customization> customizations = (Collection<Customization>) inputElement; + return customizations.toArray(); + } + + public void inputChanged(final Viewer viewer, final Object oldInput, + final Object newInput) { + // nothing + } + + public void dispose() { + // nothing + } + + public boolean hasChildren(final Object element) { + Object[] children = getChildren(element); + return children != null && children.length > 0; + } + + public Object getParent(final Object element) { + + Object result; + if (element instanceof EObject) { + EObject eObject = (EObject) element; + result = eObject.eContainer(); + } else { + result = null; + } + return result; + } + + public Object[] getChildren(final Object parentElement) { + Object[] result; + if (parentElement instanceof Customization) { + final Customization customization = (Customization) parentElement; + final List<Object> contents = new ArrayList<Object>(); + // Aggregate + for (final FacetSet facetSet : customization.getFacetSets()) { + if (facetSet instanceof Customization) { + final Customization childCustom = (Customization) facetSet; + contents.add(childCustom); + } + } + contents.addAll(customization.getEClassifiers()); + result = contents.toArray(); + } else { + result = new Object[0]; + } + return result; + } + }; + } + + protected Object getInput() { + return this.customizationCatalogManager.getRegisteredCustomizations(); + } + + public void open(final OpenEvent event) { + // TODO: re-enable once the customization editor is written + + // final MetamodelView metamodelView = (MetamodelView) element; + // // open customization in editor + // try { + // org.eclipse.emf.common.util.URI uri = org.eclipse.emf.common.util.URI + // .createURI(metamodelView.getLocation()); + // if (uri.isPlatformResource()) { + // IFile file = ResourcesPlugin.getWorkspace().getRoot().getFile( + // new Path(uri.toPlatformString(true))); + // FileEditorInput fileEditorInput = new FileEditorInput(file); + // IDE.openEditor( + // PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage(), + // fileEditorInput, Activator.CUSTOMIZATION_EDITOR_ID, true); + // } else { + // final URIEditorInput uriEditorInput = new URIEditorInput( + // org.eclipse.emf.common.util.URI.createURI(uri.toString())); + // IDE.openEditor( + // PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage(), + // uriEditorInput, Activator.CUSTOMIZATION_EDITOR_ID, true); + // } + // + // } catch (final Exception e) { + // Activator.logException(e); + // } + } + +}
diff --git a/org.eclipse.modisco.facet.efacet.core/.settings/org.eclipse.core.resources.prefs b/org.eclipse.modisco.facet.efacet.core/.settings/org.eclipse.core.resources.prefs index 0d9ebf5..9f90c1a 100644 --- a/org.eclipse.modisco.facet.efacet.core/.settings/org.eclipse.core.resources.prefs +++ b/org.eclipse.modisco.facet.efacet.core/.settings/org.eclipse.core.resources.prefs
@@ -1,4 +1,3 @@ -#Thu Sep 22 10:54:33 CEST 2011 eclipse.preferences.version=1 -encoding//src/org/eclipse/emf/facet/efacet/core/internal/messages.properties=ISO-8859-1 +encoding//src/org/eclipse/modisco/facet/efacet/core/internal/messages.properties=ISO-8859-1 encoding/<project>=UTF-8
diff --git a/org.eclipse.modisco.facet.efacet.core/META-INF/MANIFEST.MF b/org.eclipse.modisco.facet.efacet.core/META-INF/MANIFEST.MF index 453cebd..c27d072 100644 --- a/org.eclipse.modisco.facet.efacet.core/META-INF/MANIFEST.MF +++ b/org.eclipse.modisco.facet.efacet.core/META-INF/MANIFEST.MF
@@ -3,7 +3,7 @@ Bundle-Name: %Bundle-Name Bundle-SymbolicName: org.eclipse.emf.facet.efacet.core;singleton:=true Bundle-Version: 1.3.0.qualifier -Bundle-Activator: org.eclipse.emf.facet.efacet.core.internal.Activator +Bundle-Activator: org.eclipse.modisco.facet.efacet.core.internal.Activator Require-Bundle: org.eclipse.core.runtime;bundle-version="3.6.0", org.eclipse.emf.ecore;bundle-version="2.6.0", org.eclipse.emf.facet.util.emf.core;bundle-version="0.1.0";visibility:=reexport, @@ -16,14 +16,14 @@ Bundle-ActivationPolicy: lazy Bundle-Vendor: %Bundle-Vendor Bundle-RequiredExecutionEnvironment: JavaSE-1.8 -Export-Package: org.eclipse.emf.facet.efacet.core, - org.eclipse.emf.facet.efacet.core.exception, - org.eclipse.emf.facet.efacet.core.internal.exported; +Export-Package: org.eclipse.modisco.facet.efacet.core, + org.eclipse.modisco.facet.efacet.core.exception, + org.eclipse.modisco.facet.efacet.core.internal.exported; x-friends:="org.eclipse.emf.facet.aggregate.metamodel.notgenerated, org.eclipse.emf.facet.widgets.table.ui, org.eclipse.emf.facet.efacet.ui, org.eclipse.emf.facet.aggregate.tests", - org.eclipse.emf.facet.efacet.core.internal.incubatingapi;x-friends:="org.eclipse.emf.facet.efacet.tests", - org.eclipse.emf.facet.efacet.core.internal.query;x-friends:="org.eclipse.emf.facet.efacet.ui,org.eclipse.emf.facet.query.java.core", - org.eclipse.emf.facet.efacet.core.query + org.eclipse.modisco.facet.efacet.core.internal.incubatingapi;x-friends:="org.eclipse.emf.facet.efacet.tests", + org.eclipse.modisco.facet.efacet.core.internal.query;x-friends:="org.eclipse.emf.facet.efacet.ui,org.eclipse.emf.facet.query.java.core", + org.eclipse.modisco.facet.efacet.core.query Automatic-Module-Name: org.eclipse.emf.facet.efacet.core
diff --git a/org.eclipse.modisco.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/FacetUtils.java b/org.eclipse.modisco.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/FacetUtils.java deleted file mode 100644 index 9225072..0000000 --- a/org.eclipse.modisco.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/FacetUtils.java +++ /dev/null
@@ -1,766 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2011, 2017 Mia-Software, and Soft-Maint. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Nicolas Bros (Mia-Software) - Bug 361612 - New core for new version of the Facet metamodel - * Nicolas Bros (Mia-Software) - Bug 361817 - [Restructuring] Dynamic load to the facet catalog - * Gregoire Dupe (Mia-Software) - Bug 369987 - [Restructuring][Table] Switch to the new customization and facet framework - * Nicolas Bros (Mia-Software) - Bug 371367 - Hierarchical FacetSets - * Gregoire Dupe (Mia-Software) - Bug 371367 - Hierarchical FacetSets - * Gregoire Dupe (Mia-Software) - Bug 364325 - [Restructuring] The user must be able to navigate into a model using the Facet. - * Gregoire Dupe (Mia-Software) - Bug 373510 - EditingDomain, ResourceSet, Catalogs, etc. have to be properly managed between editors and views - * Gregoire Dupe (Mia-Software) - Bug 373078 - API Cleaning - * Gregoire Dupe (Mia-Software) - Bug 374903 - [Table] ITableWidget.setLoadedFacetSets - * Gregoire Dupe (Mia-Software) - Bug 375087 - [Table] ITableWidget.addColumn(List<ETypedElement>, List<FacetSet>) - * Olivier Remaud (Soft-Maint) - Bug 361794 - [Restructuring] EMF Facet customization meta-model - * Gregoire Dupe (Mia-Software) - Bug 364325 - [Restructuring] The user must be able to navigate into a model using the Facet. - * Gregoire Dupe (Mia-Software) - Bug 361794 - [Restructuring] EMF Facet customization meta-model - * Gregoire Dupe (Mia-Software) - Bug 373078 - API Cleaning - * Gregoire Dupe (Mia-Software) - Bug 372626 - Aggregates - * Nicolas Bros (Mia-Software) - Bug 372626 - Aggregates - * Gregoire Dupe (Mia-Software) - Bug 376576 - [EFacet] Change the multiplicity of Facet::extendedFacet - * Vincent Lorenzo (CEA-LIST) - Bug 357621 - Improve the label displayed for Customization and Facets - * Grégoire Dupé (Mia-Software) - Bug 387470 - [EFacet][Custom] Editors - * Alban Ménager (Soft-Maint) - Bug 387470 - [EFacet][Custom] Editors - * Gregoire Dupe (Mia-Software) - Bug 377870 - [EFacet] ETypedElementDialog doesn't show all available ETypedElement (library example problem?) - * Grégoire Dupé (Mia-Software) - Bug 387470 - [EFacet][Custom] Editors - * Grégoire Dupé (Mia-Software) - Bug 391442 - Select ETypedElement Dialog doesn't used the subpackages (subEFacetSet) - * Gregoire Dupe (Mia-Software) - Bug 443682 - Access to the super facet - * Jonathan Pepin (Soft-Maint) - Bug 463898 - Create FacetReference not derived, without query and with opposite mechanism - * Grégoire Dupé (Mia-Software) - Bug 472146 - Fail to open 'Navigation View' - * Grégoire Dupé (Mia-Software) - Bug 472151 - The navigation view fails if an EPackage load fails. - * Grégoire Dupé (Mia-Software) - Bug 474289 - ConcurrentModificationException in FacetUtils.getETypedElements (301) - * Jonathan Pepin (Soft-Maint) - Bug 512179 - Table widget refactoring. - * Jonathan Pepin (Soft-Maint) - Bug 514489 - Order problem on header columns - *******************************************************************************/ -package org.eclipse.emf.facet.efacet.core; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.HashMap; -import java.util.HashSet; -import java.util.LinkedHashSet; -import java.util.LinkedList; -import java.util.List; -import java.util.Map; -import java.util.Set; - -import org.eclipse.emf.common.util.EList; -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.ecore.EClassifier; -import org.eclipse.emf.ecore.ENamedElement; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.EPackage; -import org.eclipse.emf.ecore.EStructuralFeature; -import org.eclipse.emf.ecore.ETypedElement; -import org.eclipse.emf.ecore.resource.ResourceSet; -import org.eclipse.emf.facet.efacet.core.exception.FacetManagerException; -import org.eclipse.emf.facet.efacet.core.internal.Activator; -import org.eclipse.emf.facet.efacet.core.internal.exported.IResolverManager; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.DerivedTypedElement; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.Facet; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.FacetOperation; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.FacetSet; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.runtime.ETypedElementEObjectListResult; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.runtime.ETypedElementEObjectResult; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.runtime.ETypedElementPrimitiveTypeListResult; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.runtime.ETypedElementPrimitiveTypeResult; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.runtime.ETypedElementResult; -import org.eclipse.emf.facet.util.core.Logger; -import org.eclipse.emf.facet.util.emf.core.ModelUtils; -import org.eclipse.emf.facet.util.emf.core.internal.EMFUtils; - -/** - * @since 0.2 - */ -public final class FacetUtils { - - private FacetUtils() { - // static methods only - } - - /** - * Find a Facet in a FacetSet - * - * @param facetSet - * the FacetSet - * @param facetName - * the name of the Facet to look for - * @return the Facet with the given name in the given FacetSet - */ - public static Facet getFacet(final FacetSet facetSet, final String facetName) { - Facet result = null; - final List<Facet> facets = FacetUtils.getFacets(facetSet); - for (Facet facet : facets) { - if (facetName.equals(facet.getName())) { - result = facet; - break; - } - } - return result; - } - - public static <T extends ETypedElement> T getETypedElement( - final Facet facet, final String name, final Class<T> classs) { - T result = null; - final List<ETypedElement> eTypedElements = new ArrayList<ETypedElement>(); - eTypedElements.addAll(facet.getFacetElements()); - eTypedElements.addAll(facet.getFacetOperations()); - for (ETypedElement eTypedElement : eTypedElements) { - if (name.equals(eTypedElement.getName()) - && classs.isInstance(eTypedElement)) { - @SuppressWarnings("unchecked") - // @SuppressWarnings("unchecked") This assignment is check by - // the call 'classs.isInstance(structuralFeature)' - final T castResult = (T) eTypedElement; - result = castResult; - break; - } - } - return result; - } - - public static Object getResultValue(final ETypedElementResult eTEresult) { - Object result = null; - if (eTEresult instanceof ETypedElementEObjectListResult<?>) { - final ETypedElementEObjectListResult<?> eObjectList = (ETypedElementEObjectListResult<?>) eTEresult; - result = eObjectList.getResultList(); - } else if (eTEresult instanceof ETypedElementEObjectResult<?>) { - final ETypedElementEObjectResult<?> eObjectRef = (ETypedElementEObjectResult<?>) eTEresult; - result = eObjectRef.getResult(); - } else if (eTEresult instanceof ETypedElementPrimitiveTypeListResult<?>) { - final ETypedElementPrimitiveTypeListResult<?> objectList = (ETypedElementPrimitiveTypeListResult<?>) eTEresult; - result = objectList.getDerivedTypedElement(); - } else if (eTEresult instanceof ETypedElementPrimitiveTypeResult<?>) { - final ETypedElementPrimitiveTypeResult<?> objectRef = (ETypedElementPrimitiveTypeResult<?>) eTEresult; - result = objectRef.getResult(); - } else { - throw new IllegalStateException( - "Unknown ETypedElementResult type: " + eTEresult.getClass()); //$NON-NLS-1$ - } - return result; - } - - /** - * Find a FacetSet with the given name among the given list of FacetSets. If several FacetSets have the same name, - * then return the first one. - * - * @param facetSets - * where to look for - * @param name - * the name of the FacetSet to find - * @return the FacetSet, or <code>null</code> if not found in the given list - */ - public static FacetSet getFacetSet(final Collection<FacetSet> facetSets, final String name) { - FacetSet result = null; - for (FacetSet facetSet : facetSets) { - if (name.equals(facetSet.getName())) { - result = facetSet; - } - } - return result; - } - - /** - * Find all FacetSets with the given name among the given list of FacetSets. - * - * @param facetSets - * where to look for - * @param name - * the name of the FacetSets to find - * @return the FacetSets with the given name - */ - public static List<FacetSet> getFacetSets( - final Collection<FacetSet> facetSets, final String name) { - final List<FacetSet> result = new ArrayList<FacetSet>(); - for (FacetSet facetSet : facetSets) { - if (name.equals(facetSet.getName())) { - result.add(facetSet); - } - } - return result; - } - - /** - * - * @param facetSet - * a facetSet - * @return a set with all the EPackage extended by the facetSet and its - * owned facetSet - * @since 0.2 - */ - public static Set<EPackage> getAllExtendedEPackage(final FacetSet facetSet) { - final Set<EPackage> extendedEPackages = new HashSet<EPackage>(); - final EPackage res1 = getExtendedEPackage(facetSet); - if (res1 != null) { - extendedEPackages.add(res1); - } - for (FacetSet current : facetSet.getFacetSets()) { - extendedEPackages.addAll(getAllExtendedEPackage(current)); - } - final EList<EPackage> pack = facetSet.getESubpackages(); - for (EPackage current : pack) { - if (current instanceof FacetSet) { - extendedEPackages - .addAll(getAllExtendedEPackage((FacetSet) current)); - } - } - return extendedEPackages; - } - - /** - * Find all the FacetSets with the given path among the given list of root - * FacetSets. For example: <code>getFacetSetsByPath("a", "b", "c")</code> - * returns a FacetSet named "c", contained in a FacetSet named "b", - * contained in a registered FacetSet named "a". - * - * @param path - * a list of FacetSet names, starting from the root registered - * FacetSets, and leading to the wanted FacetSet(s) - * @return the FacetSets that have the given path - */ - public static List<FacetSet> getFacetSetsByPath( - final Collection<FacetSet> rootFacetSets, final String... path) { - if (path.length == 0) { - throw new IllegalArgumentException("The given path cannot be empty"); //$NON-NLS-1$ - } - List<FacetSet> facetSets = new ArrayList<FacetSet>(rootFacetSets); - for (int i = 0; i < path.length; i++) { - if (i > 0) { - facetSets = getSubFacetSets(facetSets); - } - final String name = path[i]; - facetSets = getFacetSets(facetSets, name); - if (facetSets.isEmpty()) { - break; - } - - } - return facetSets; - } - - private static List<FacetSet> getSubFacetSets( - final Collection<FacetSet> parents) { - final List<FacetSet> subFacetSets = new ArrayList<FacetSet>(); - for (FacetSet facetSet : parents) { - final EList<EPackage> eSubpackages = facetSet.getESubpackages(); - for (EPackage ePackage : eSubpackages) { - if (ePackage instanceof FacetSet) { - final FacetSet subFacetSet = (FacetSet) ePackage; - subFacetSets.add(subFacetSet); - } - } - } - return subFacetSets; - } - - /** - * Find a Facet with the given name among the given list of Facets. - * - * @param facets - * where to look - * @param name - * the name of the Facet that is being looked for - * @return the first {@link Facet} with this name, or <code>null</code> if - * none - */ - public static Facet getFacet(final Collection<Facet> facets, - final String name) { - Facet result = null; - for (Facet facet : facets) { - if (name.equals(facet.getName())) { - result = facet; - } - } - return result; - } - - public static FacetSet getRootFacetSet(final Facet facet) { - FacetSet result = (FacetSet) facet.eContainer(); - while (result != null && result.eContainer() instanceof FacetSet) { - result = (FacetSet) result.eContainer(); - } - return result; - } - - public static FacetSet getRootFacetSet(final FacetSet facetSet) { - FacetSet result = facetSet; - while (result != null && result.eContainer() instanceof FacetSet) { - result = (FacetSet) result.eContainer(); - } - return result; - } - - /** - * This methods returns all the known (registered) eTypedElements. - * - * @param resourceSet - * the eTypedElement search will be done in/using this resourceSet - * @return all the known (registered) eTypedElements - */ - public static Set<? extends ETypedElement> getETypedElements( - final ResourceSet resourceSet) { - final Set<ETypedElement> result = new HashSet<ETypedElement>(); - final Collection<Object> ePackages = EPackage.Registry.INSTANCE - .values(); - /* - * gdupe> Creating a copy of the ePackages list to avoid - * ConcurrentModificationException. cf. - * https://bugs.eclipse.org/bugs/show_bug.cgi?id=474289 - */ - final Collection<Object> localEPackages = new ArrayList<Object>(ePackages); - for (Object object : localEPackages) { - EPackage ePackage = null; - try { - if (object instanceof EPackage) { - ePackage = (EPackage) object; - } else if (object instanceof EPackage.Descriptor) { - final EPackage.Descriptor descriptor = (EPackage.Descriptor) object; - ePackage = descriptor.getEPackage(); - } - if (ePackage != null) { - result.addAll(getETypedElements(ePackage)); - } - } catch (Exception e) { - String nsURI; - if (ePackage == null) { - nsURI = "<unknown ePacakge>"; //$NON-NLS-1$ - } else { - nsURI = ePackage.getNsURI(); - } - final String message = String.format("Failed to acces to %s.", //$NON-NLS-1$ - nsURI); - Logger.logError(e, message , Activator.getDefault()); - } - } - result.addAll(getFacetETypedElements(resourceSet)); - return result; - } - - /** - * @since 0.3 - */ - public static Set<? extends ETypedElement> getFacetETypedElements( - final ResourceSet resourceSet) { - final Set<ETypedElement> result = new HashSet<ETypedElement>(); - final Collection<FacetSet> facetSets = IFacetSetCatalogManagerFactory.DEFAULT - .getOrCreateFacetSetCatalogManager(resourceSet) - .getRegisteredFacetSets(); - for (FacetSet facetSet : facetSets) { - result.addAll(getETypedElements(facetSet)); - } - return result; - } - - public static List<ETypedElement> getETypedElements(final EPackage ePackage) { - final List<ETypedElement> result = new LinkedList<ETypedElement>(); - for (EClassifier eClassifier : ePackage.getEClassifiers()) { - result.addAll(getETypedElements(eClassifier)); - } - for (EPackage subPackage : ePackage.getESubpackages()) { - result.addAll(getETypedElements(subPackage)); - } - return result; - } - - /** - * @since 0.3 - */ - public static List<ETypedElement> getETypedElements( - final EClassifier eClassifier) { - final List<ETypedElement> result = new ArrayList<ETypedElement>(); - if (eClassifier instanceof Facet) { - final Facet facet = (Facet) eClassifier; - result.addAll(facet.getFacetElements()); - result.addAll(facet.getFacetOperations()); - } else if (eClassifier instanceof EClass) { - final EClass eClass = (EClass) eClassifier; - result.addAll(eClass.getEAllStructuralFeatures()); - result.addAll(eClass.getEAllOperations()); - } - return result; - } - - public static List<Facet> getFacets(final FacetSet facetSet) { - final List<Facet> result = new LinkedList<Facet>(); - for (EClassifier eClassifier : facetSet.getEClassifiers()) { - if (eClassifier instanceof Facet) { - final Facet facet = (Facet) eClassifier; - result.add(facet); - } - } - return result; - } - - public static FacetSet getFacetSet(final Facet facet) { - FacetSet result = null; - if (facet.getEPackage() instanceof FacetSet) { - result = (FacetSet) facet.getEPackage(); - } - return result; - } - - // Moved from - // org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.impl.FacetSetImpl - public static EPackage getExtendedEPackage(final FacetSet facetSet) { - final List<Facet> facets = FacetUtils.getFacets(facetSet); - EPackage result = null; - for (Facet facet : facets) { - final EClass extendedMetaclass = facet.getExtendedMetaclass(); - if (extendedMetaclass != null) { - final EPackage ePackage = extendedMetaclass.getEPackage(); - if (ePackage != null) { - if (result != null && !ePackage.equals(result)) { - throw new IllegalStateException( - "The Facets in a FacetSet must all extend EClasses from the same EPackage"); //$NON-NLS-1$ - } - result = ePackage; - } - } - } - return result; - } - - // Copied (and refactored) from - // org.eclipse.emf.facet.efacet.core.internal.FacetManager - public static <T extends ETypedElement> Set<T> getETypedElements( - final EObject eObject, final Class<T> classs, - final IFacetManager facetManager) throws FacetManagerException { - final Set<T> result = new HashSet<T>(); - for (FacetSet facetSet : facetManager.getManagedFacetSets()) { - result.addAll(getETypedElements(eObject, facetSet, classs, - facetManager)); - } - return result; - } - - // Copied (and refactored) from - // org.eclipse.emf.facet.efacet.core.internal.FacetManager - private static <T extends ETypedElement> Set<T> getETypedElements( - final EObject eObject, final FacetSet facetSet, - final Class<T> classs, final IFacetManager manager) - throws FacetManagerException { - final Set<T> result = new HashSet<T>(); - for (EClassifier eClassifier : facetSet.getEClassifiers()) { - if (eClassifier instanceof Facet) { - final Facet facet = (Facet) eClassifier; - if (manager.isConforming(eObject, facet)) { - result.addAll(getETypedElement(classs, facet)); - } - } - } - // hierarchical FacetSets - for (EPackage ePackage : facetSet.getESubpackages()) { - if (ePackage instanceof FacetSet) { - final FacetSet subFacetSet = (FacetSet) ePackage; - result.addAll(getETypedElements(eObject, subFacetSet, classs, - manager)); - } - } - // aggregates - for (FacetSet subFacetSet : facetSet.getFacetSets()) { - result.addAll(getETypedElements(eObject, subFacetSet, classs, - manager)); - } - return result; - } - - private static <T> Set<T> getETypedElement(final Class<T> classs, - final Facet facet) { - final Set<T> result = new HashSet<T>(); - for (ETypedElement eTypedElement : getAllETypedElements(facet)) { - if (classs.isInstance(eTypedElement)) { - @SuppressWarnings("unchecked") - // @SuppressWarnings("unchecked") This type has been - // checked using isInstance - final T typedSF = (T) eTypedElement; - final T resolvedTE = IResolverManager.DEFAULT - .resolve(typedSF, classs); - if (resolvedTE == null) { - result.add(typedSF); - } else { - result.add(resolvedTE); - } - } - } - return result; - } - - // Copied (and refactored) from - // org.eclipse.emf.facet.efacet.core.internal.FacetManager - private static List<ETypedElement> getAllETypedElements( - final Facet facet) { - final List<ETypedElement> structFeatures = new LinkedList<ETypedElement>(); - structFeatures.addAll(facet.getFacetElements()); - structFeatures.addAll(facet.getFacetOperations()); - for (Facet extFacet : facet.getExtendedFacets()) { - structFeatures.addAll(getAllETypedElements(extFacet)); - } - return structFeatures; - } - - /** - * @param eTypedElement - * @return - * @since 0.2 - */ - public static FacetSet getFacetSet(final ETypedElement eTypedElement) { - FacetSet result = null; - if (eTypedElement.eContainer() instanceof Facet) { - final Facet facet = (Facet) eTypedElement.eContainer(); - if (facet.eContainer() instanceof FacetSet) { - result = (FacetSet) facet.eContainer(); - } - } - return result; - } - - /** - * - * @param facetOperation - * @return - * @since 0.2 - */ - public static DerivedTypedElement getSignature( - final FacetOperation facetOperation) { - DerivedTypedElement current = facetOperation; - while (current.getOverride() != null) { - current = current.getOverride(); - } - return current; - } - - /** - * - * @param facet - * @return - * @since 0.2 - */ - public static EClass getExtendedMetaclass(final Facet facet) { - EClass result = facet.getExtendedMetaclass(); - if (result == null) { - final List<EClass> eClasses = new LinkedList<EClass>(); - for (Facet extfacet : facet.getExtendedFacets()) { - eClasses.add(getExtendedMetaclass(extfacet)); - } - result = EMFUtils.computeLeastCommonSupertype(eClasses); - } - return result; - } - - /** - * Find the top level feature in the override chain - * - * @param feature - * @return The top level feature in the override chain or the feature - * parameter itself if no override - * @throws FacetManagerException - * @since 0.2 - * - */ - // Copied from - // org.eclipse.emf.facet.efacet.core.internal.FacetManagerContext - // * Contributors: - // * Olivier Remaud (Soft-Maint) - Bug 361794 - [Restructuring] EMF Facet - // customization meta-model - // * Gregoire Dupe (Mia-Software) - Bug 364325 - [Restructuring] The user - // must be able to navigate into a model using the Facet. - // * Gregoire Dupe (Mia-Software) - Bug 361794 - [Restructuring] EMF Facet - // customization meta-model - // * Gregoire Dupe (Mia-Software) - Bug 373078 - API Cleaning - @SuppressWarnings("unchecked") - // @SuppressWarnings("unchecked") cf. comment in the method body - public static <T extends DerivedTypedElement> T getTopOverrideFeature( - final T feature) throws FacetManagerException { - T signatureFeature = feature; - while (signatureFeature.getOverride() != null) { - if (feature.getClass().isInstance(signatureFeature.getOverride())) { - // @SuppressWarnings("unchecked") the if test check the - // assignment using the method 'isInstance' - signatureFeature = (T) signatureFeature.getOverride(); - } else { - // signature feature type name - final String sfTypeName = signatureFeature.eClass().getName(); - // signature feature name - final String sfName = ModelUtils - .getQualifiedName(signatureFeature); - final String ofName = signatureFeature.getOverride().eClass() - .getName(); // overridden feature type name - throw new FacetManagerException("The " + sfTypeName + " '" //$NON-NLS-1$ //$NON-NLS-2$ - + sfName + "' overides a " + ofName); //$NON-NLS-1$ - } - } - return signatureFeature; - } - - /** - * @since 0.3 - */ - public static EClass findExtendedEClass(final Facet facet) { - EClass result = facet.getExtendedMetaclass(); - if (result == null) { - for (Facet extFacet : facet.getExtendedFacets()) { - result = findExtendedEClass(extFacet); - if (result != null) { - break; - } - } - } - return result; - } - - /** - * @since 0.3 - */ - public static DerivedTypedElement getContainingDerivedTypedElement( - final EObject eObject) { - DerivedTypedElement dte = null; - if (eObject instanceof DerivedTypedElement) { - dte = (DerivedTypedElement) eObject; - } else if (eObject != null) { - dte = getContainingDerivedTypedElement(eObject.eContainer()); - } - return dte; - } - - /** - * Return the main facetSet. - * - * @param eObject - * the element in the model selected. - * @return the main facetSet. - * @since 0.3 - */ - public static FacetSet getContainingFacetSet(final EObject eObject) { - FacetSet result = null; - if (eObject instanceof FacetSet) { - result = (FacetSet) eObject; - } else { - final EObject container = eObject.eContainer(); - if (container != null) { - result = getContainingFacetSet(container); - } - } - return result; - } - - /** - * Return all the operations of the model. - * - * @param parent - * the first FacetSet of the model. - * @return the list of operations. - * @since 0.3 - */ - public static Map<String, FacetOperation> getAllOperationsByName( - final FacetSet parent) { - final Map<String, FacetOperation> operations = new HashMap<String, FacetOperation>(); - for (final EClassifier facet : parent.getEClassifiers()) { - for (final FacetOperation operation : ((Facet) facet) - .getFacetOperations()) { - operations.put(operation.getName(), operation); - } - } - for (final EPackage element : parent.getESubpackages()) { - operations.putAll(getAllOperationsByName((FacetSet) element)); - } - return operations; - } - - /** - * Return all the facets of the model. - * - * @param parent - * the first FacetSet of the model. - * @return the list of facets. - * @since 0.3 - */ - public static Map<String, Facet> getAllFacetsByName(final FacetSet parent) { - final Map<String, Facet> facets = new HashMap<String, Facet>(); - for (final EClassifier facet : parent.getEClassifiers()) { - facets.put(facet.getName(), (Facet) facet); - } - for (final EPackage element : parent.getESubpackages()) { - facets.putAll(getAllFacetsByName((FacetSet) element)); - } - - return facets; - } - - /** - * Return all the facets of the model. - * - * @param parent - * the first FacetSet of the model. - * @return the list of facets. - * @since 0.3 - */ - public static Map<String, FacetSet> getAllFacetSetsByName( - final EPackage parent) { - final Map<String, FacetSet> facetSets = new HashMap<String, FacetSet>(); - if (parent instanceof FacetSet) { - final FacetSet facetSet = (FacetSet) parent; - facetSets.put(parent.getName(), facetSet); - } - for (final EPackage element : parent.getESubpackages()) { - facetSets.putAll(getAllFacetSetsByName(element)); - } - return facetSets; - } - - /** - * @since 0.3 - */ - public static List<Facet> getAllFacet(final FacetSet facetSet) { - final List<Facet> result = new ArrayList<Facet>(); - for (EClassifier eClassifier : facetSet.getEClassifiers()) { - if (eClassifier instanceof Facet) { - final Facet facet = (Facet) eClassifier; - result.add(facet); - } - } - for (EPackage ePackage : facetSet.getESubpackages()) { - if (ePackage instanceof FacetSet) { - final FacetSet subFacetSet = (FacetSet) ePackage; - result.addAll(getAllFacet(subFacetSet)); - } - } - return result; - } - - /** - * @since 1.2 - */ - public static Set<EStructuralFeature> getAllStructrualFeatures( - final EObject eObject, final IFacetManager facetMgr) - throws FacetManagerException { - final Set<EStructuralFeature> result = new LinkedHashSet<EStructuralFeature>(); - result.addAll(eObject.eClass().getEAllStructuralFeatures()); - final Set<EStructuralFeature> typedElements = FacetUtils - .getETypedElements(eObject, EStructuralFeature.class, facetMgr); - result.addAll(typedElements); - return result; - } - - /** - * @since 1.0 - */ - public static String toString(final DerivedTypedElement feature) { - final StringBuffer result = new StringBuffer(); - result.append(feature.eResource().getURI()); - result.append(" -> "); //$NON-NLS-1$ - final EObject eContainer = feature.eContainer(); - if (eContainer instanceof ENamedElement) { - final ENamedElement parent = (ENamedElement) eContainer; - result.append(parent.getName()); - result.append('.'); - } - result.append(feature.getName()); - return result.toString(); - } - -}
diff --git a/org.eclipse.modisco.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/IDerivedTypedElementManager.java b/org.eclipse.modisco.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/IDerivedTypedElementManager.java deleted file mode 100644 index 5f805f8..0000000 --- a/org.eclipse.modisco.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/IDerivedTypedElementManager.java +++ /dev/null
@@ -1,203 +0,0 @@ -/** - * Copyright (c) 2011, 2012 Mia-Software. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Gregoire Dupe (Mia-Software) - Bug 333553 - The user has not to deal with two files to create a facet - * Emmanuelle Rouillé (Mia-Software) - Bug 352618 - To be able to use non derived facet structural features and save them values. - * Nicolas Bros (Mia-Software) - Bug 361612 - New core for new version of the Facet metamodel - * Nicolas Bros (Mia-Software) - Bug 362191 - [Restructuring] Query mechanism for eFacet2 - * Gregoire Dupe (Mia-Software) - Bug 369987 - [Restructuring][Table] Switch to the new customization and facet framework - * Gregoire Dupe (Mia-Software) - Bug 364325 - [Restructuring] The user must be able to navigate into a model using the Facet. - * Nicolas Bros (Mia-Software) - Bug 376941 - [EFacet] Facet operation arguments in Facet model - */ -package org.eclipse.emf.facet.efacet.core; - -import java.util.Collection; -import java.util.List; - -import org.eclipse.emf.ecore.EAttribute; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.EOperation; -import org.eclipse.emf.ecore.EReference; -import org.eclipse.emf.facet.efacet.core.exception.DerivedTypedElementException; -import org.eclipse.emf.facet.efacet.core.internal.DerivedTypedElementManager; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.DerivedTypedElement; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.FacetOperation; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.ParameterValue; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.extensible.Query; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.runtime.ETypedElementResult; - -/** - * Used to evaluate derived typed elements through their queries. - * - * @since 0.2 - * @noimplement This interface is not intended to be implemented by clients. - * @noextend This interface is not intended to be extended by clients. - */ -public interface IDerivedTypedElementManager { - IDerivedTypedElementManager INSTANCE = new DerivedTypedElementManager(); - - /** - * Evaluates a derived typed element on a model element. - * <p> - * <b>Note:</b> this method does not return a typed result, and it does not - * check the result type. Use - * {@link IDerivedTypedElementManager#evaluateSingleValued(DerivedTypedElement, EObject, List, Class) - * evaluateSingleValued} or - * {@link IDerivedTypedElementManager#evaluateMultiValued(DerivedTypedElement, EObject, List, Class) - * evaluateMultiValued} instead if you want a typed and type-checked result. - * - * @param derivedTE - * the derived typed element to evaluate - * @param source - * the model element on which the derived typed element must be - * evaluated - * @param parameterValues - * the arguments of the derived typed element (in the case of a - * {@link FacetOperation}; can be <code>null</code> if there are - * no parameters) - * @return the derived typed element result: a single Object in the case of - * a single-valued derived typed element, or a List in the case of a - * multi-valued derived typed element. - * @throws DerivedTypedElementException - * <ul> - * <li>in case of error in the derived typed element</li> <li>in - * case of error when evaluating the derived typed element</li> - * </ul> - */ - Object evaluate(DerivedTypedElement derivedTE, EObject source, - List<ParameterValue> parameterValues, IFacetManager facetManager) - throws DerivedTypedElementException; - - /** - * Evaluates a query on a model element. Calling this method is discouraged. You should evaluate a - * {@link DerivedTypedElement}s (which contains a query) instead of trying to evaluate a {@link Query} directly. - * Since the source type, return type and multiplicity of a query are carried by the {@link DerivedTypedElement} - * that normally contains it, this method doesn't check the source type, return type or multiplicity. - * - * @param query - * the query to evaluate - * @param source - * the model element on which the query must be evaluated - * @param parameterValues - * the arguments of the query (in the case of a query for a {@link FacetOperation}; can be - * <code>null</code> if there are no parameters) - * @return the query result: may be a single Object or a List. - * @throws DerivedTypedElementException - * if the evaluation failed - */ - Object evaluate(Query query, EObject source, List<ParameterValue> parameterValues, IFacetManager facetManager) - throws DerivedTypedElementException; - - /** - * Evaluates a single valued derived typed element on a model element. - * - * @param derivedTE - * the derived typed element to evaluate - * @param source - * the model element on which the derived typed element is - * evaluated - * @param parameterValues - * the arguments of the derived typed element (in the case of a - * {@link FacetOperation}; can be <code>null</code> if there are - * no parameters) - * @param resultType - * the type that the returned value must have - * @return the result of the evaluation - * @throws DerivedTypedElementException - * <ul> - * <li>in case of error in the derived typed element</li> - * <li>in case of error when evaluating the derived typed - * element</li> - * <li> - * if the effective return type does not match the expected type - * </li> - * </ul> - */ - <T> T evaluateSingleValued(DerivedTypedElement derivedTE, EObject source, - List<ParameterValue> parameterValues, Class<T> resultType, - IFacetManager facetManager) throws DerivedTypedElementException; - - /** - * Evaluates a multi-valued derived typed element on a model element. - * - * @param derivedTypedElement - * the derived typed element to evaluate - * @param source - * the model element on which the derived typed element must be - * evaluated - * @param parameterValues - * the arguments of the derived typed element (in the case of a - * {@link FacetOperation}; can be <code>null</code> if there are - * no parameters) - * @param resultType - * the type that the returned value must have - * @return the result of the evaluation - * @throws DerivedTypedElementException - * <ul> - * <li>in case of error in the derived typed element</li> - * <li>in case of error when evaluating the derived typed - * element</li> - * <li>if the effective return type does not match the expected - * type</li> - * </ul> - */ - <T> List<T> evaluateMultiValued(DerivedTypedElement derivedTE, - EObject source, List<ParameterValue> parameterValues, - Class<T> resultType, IFacetManager facetManager) - throws DerivedTypedElementException; - - /** - * Evaluates a derived typed element on a list of model elements in a single - * call. - * - * @param derivedTE - * the derived typed element to evaluate - * @param sources - * the model elements on which the derived typed element must be - * evaluated - * @param parameterValues - * the arguments of the derived typed element (in the case of a - * {@link FacetOperation}; can be <code>null</code> if there are - * no parameters) - * @param resultType - * the expected type of the returned list: - * <ul> - * <li> {@link DerivedTypedElementEObjectResult} if the - * {@link DerivedTypedElement} is a single-valued - * {@link EReference} or {@link EOperation} that returns EObjects - * <li>{@link DerivedTypedElementEObjectListResult} if the - * {@link DerivedTypedElement} is a multi-valued - * {@link EReference} or {@link EOperation} that returns EObjects - * <li>{@link DerivedTypedElementPrimitiveTypeResult} if the - * {@link DerivedTypedElement} is a single-valued - * {@link EAttribute} or {@link EOperation} that returns a - * primitive type value - * <li>{@link DerivedTypedElementPrimitiveTypeListResult} if the - * {@link DerivedTypedElement} is a multi-valued - * {@link EAttribute} or {@link EOperation} that returns a list - * of primitive type values - * </ul> - * @return one derived typed element result for each source element that was - * evaluated - * @throws DerivedTypedElementException - * <ul> - * <li>in case of error in the derived typed element. - * <b>Note</b>: an error that happens when evaluating the - * derived typed element on any of the given sources is not - * thrown but stored in the corresponding element result.</li> - * <li>if the effective return type does not match the expected - * type</li> - * </ul> - */ - <T extends ETypedElementResult> List<T> batchEvaluate( - DerivedTypedElement derivedTE, - Collection<? extends EObject> sources, - List<ParameterValue> parameterValues, Class<T> resultType, - IFacetManager facetManager) throws DerivedTypedElementException; -}
diff --git a/org.eclipse.modisco.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/IFacetActions.java b/org.eclipse.modisco.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/IFacetActions.java deleted file mode 100644 index c09141d..0000000 --- a/org.eclipse.modisco.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/IFacetActions.java +++ /dev/null
@@ -1,45 +0,0 @@ -/** - * Copyright (c) 2012 Mia-Software. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Alban Ménager (Soft-Maint) - Bug 387470 - [EFacet][Custom] Editors - */ -package org.eclipse.emf.facet.efacet.core; - -import java.io.IOException; - -import org.eclipse.core.resources.IFile; -import org.eclipse.emf.facet.efacet.core.internal.FacetActionsImpl; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.FacetSet; -import org.eclipse.emf.facet.util.emf.core.exception.InvalidFacetSetException; - -/** - * This interface contains methods to create {@link FacetSet}s. - * - * @since 0.3 - * @noextend This interface is not intended to be extended by clients. - * @noimplement This interface is not intended to be implemented by clients. - */ -public interface IFacetActions { - - IFacetActions INSTANCE = new FacetActionsImpl(); - - /** - * Add the given facetSet to the given facetSet model file, which will be - * created - * - * @param facetSet - * the facetSet to be created. Cannot be <code>null</code> - * @param file - * the new file in which the facetSet has to be created. Cannot - * be <code>null</code>, and cannot already exist - */ - void saveFacetSet(FacetSet facetSet, IFile file) throws IOException, - InvalidFacetSetException; - -}
diff --git a/org.eclipse.modisco.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/IFacetCommandFactory.java b/org.eclipse.modisco.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/IFacetCommandFactory.java deleted file mode 100644 index be13994..0000000 --- a/org.eclipse.modisco.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/IFacetCommandFactory.java +++ /dev/null
@@ -1,193 +0,0 @@ -/** - * Copyright (c) 2012 Mia-Software. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Alban Ménager (Soft-Maint) - Bug 387470 - [EFacet][Custom] Editors - * Grégoire Dupé (Mia-Software) - Bug 387470 - [EFacet][Custom] Editors - */ -package org.eclipse.emf.facet.efacet.core; - -import org.eclipse.emf.common.command.Command; -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.ecore.EClassifier; -import org.eclipse.emf.ecore.EParameter; -import org.eclipse.emf.ecore.ETypedElement; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.DerivedTypedElement; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.Facet; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.FacetAttribute; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.FacetOperation; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.FacetReference; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.FacetSet; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.extensible.Query; - -/** - * This interface provide a command factory. A command modify the editingDomain. - * - * @since 0.3 - * @noextend This interface is not intended to be extended by clients. - * @noimplement This interface is not intended to be implemented by clients. - */ -public interface IFacetCommandFactory { - - /** - * Create the command to add a FacetSet (facetSet) to an existing FacetSet - * (parent). - * - * @param parent - * the parent of the facetSet to add. - * @param facetSet - * the facetSet to add. - * @return the command. - */ - Command createFacetSetInFacetSetCommand(FacetSet parent, FacetSet facetSet); - - /** - * Create the command to add a Facet (facet) to an existing FacetSet - * (parent). - * - * @param parent - * the parent of the facet to add. - * @param facet - * the facet to add. - * @return the command. - */ - Command createFacetInFacetSetCommand(FacetSet parent, Facet facet); - - /** - * Create the command to add an Attribute (facetAttrbute) to an existing - * Facet (parent). - * - * @param parent - * the parent of the attribute to add. - * @param facetAttrbute - * the attribute to add. - * @return the command. - */ - Command createEditFacetStructuralFeatureCommand( - final DerivedTypedElement feature, final Facet container, - final String name, final int lowerBd, final int upperBd, - final EClassifier type, final boolean ordered, - final boolean unique, final Query query, final boolean volatilee, - final boolean change, final boolean derived, - final boolean transientt); - - /** - * Create the command to add a Reference (facetReference) to an existing - * Facet (parent). - * - * @param parent - * the parent of the reference to add. - * @param facetReference - * the reference to add. - * @return the command. - */ - Command createAddReferenceInFacetCommand(Facet parent, - FacetReference facetReference); - - /** - * Create the command to add an Operation (FacetOperation) to an existing - * Facet (parent). - * - * @param parent - * the parent of the operation to add. - * @param facetOperation - * the operation to add. - * @return the command. - */ - Command createAddOperationInFacetCommand(Facet parent, - FacetOperation facetOperation); - - /** - * Create the command to add a Parameter (operationParameter) to an existing - * Operation (parent). - * - * @param parent - * the parent of the operation to add. - * @param facetOperation - * the operation to add. - * @return the command. - */ - Command createAddParameterInOperationCommand(FacetOperation parent, - EParameter opeParameter); - - /** - * Create the command to change the owner of an element. - * - * @param element - * @param newOwner - * @return - */ - Command createChangeOwnerCommand(Object element, Object newOwner); - - /** - * Create the command to change the attributes of a FacetSet. - * - * @param initialElement - * @param newElement - * @param newElement - * @return - */ - Command createEditFacetSetCommand(final FacetSet editedFacetSet, - final FacetSet container, final String name); - - /** - * Create the command to change the attributes of a Facet. - * - * @param initialElement - * @param newElement - * @return - */ - Command createEditFacetCommand(Facet facet, FacetSet container, - String name, ETypedElement conformance, EClass extendEClass, - FacetSet extendedFacetSet); - - /** - * Create the command to change the attributes of a FacetAttribute. - * - * @param initialElement - * @param newElement - * @return - */ - Command createSetFacetAttributeCommand(final Facet initialContainer, - final FacetAttribute initialElement, - final FacetAttribute newElement); - - /** - * Create the command to change the attributes of a FacetReference. - * - * @param initialElement - * @param newElement - * @return - */ - Command createSetFacetReferenceCommand(final Facet initialContainer, - final FacetReference initialElement, - final FacetReference newElement); - - /** - * Create the command to change the attributes of a FacetOperation. - * - * @param initialElement - * @param newElement - * @return - */ - Command createEditFacetOperationCommand(DerivedTypedElement dte, - Facet facetContainer, String name, int lowerBound, int upperBound, - EClassifier type, boolean ordered, boolean unique, Query query); - - /** - * Create the command to change the attributes of a FacetAttribute. - * - * @param initialElement - * @param newElement - * @return - */ - Command createEditOperationParameterCommand(EParameter parameter, - FacetOperation container, String name, int lowerBound, - int upperBound, EClassifier type, boolean ordered, boolean unique); - -}
diff --git a/org.eclipse.modisco.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/IFacetCommandFactoryFactory.java b/org.eclipse.modisco.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/IFacetCommandFactoryFactory.java deleted file mode 100644 index 3f453a0..0000000 --- a/org.eclipse.modisco.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/IFacetCommandFactoryFactory.java +++ /dev/null
@@ -1,27 +0,0 @@ -/** - * Copyright (c) 2012 Mia-Software. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Grégoire Dupé (Mia-Software) - Bug 387470 - [EFacet][Custom] Editors - */ -package org.eclipse.emf.facet.efacet.core; - -import org.eclipse.emf.edit.domain.EditingDomain; -import org.eclipse.emf.facet.efacet.core.internal.FacetCommandFactoryFactory; - -/** - * @since 0.3 - * @noimplement This interface is not intended to be implemented by clients. - * @noextend This interface is not intended to be extended by clients. - */ -public interface IFacetCommandFactoryFactory { - - IFacetCommandFactoryFactory DEFAULT = new FacetCommandFactoryFactory(); - - IFacetCommandFactory createCommandFactory(EditingDomain editingDomain); -}
diff --git a/org.eclipse.modisco.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/IFacetManager.java b/org.eclipse.modisco.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/IFacetManager.java deleted file mode 100644 index 474f3a0..0000000 --- a/org.eclipse.modisco.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/IFacetManager.java +++ /dev/null
@@ -1,267 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2011, 2015 Mia-Software, Soft-Maint. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Emmanuelle Rouillé (Mia-Software) - Bug 352618 - To be able to use non derived facet structural features and save them values. - * Nicolas Bros (Mia-Software) - Bug 361612 - New core for new version of the Facet metamodel - * Olivier Remaud (Soft-Maint) - Bug 361794 - [Restructuring] EMF Facet customization meta-model - * Gregoire Dupe (Mia-Software) - Bug 361794 - [Restructuring] New customization meta-model - * Gregoire Dupe (Mia-Software) - Bug 369987 - [Restructuring][Table] Switch to the new customization and facet framework - * Gregoire Dupe (Mia-Software) - Bug 364325 - [Restructuring] The user must be able to navigate into a model using the Facet. - * Gregoire Dupe (Mia-Software) - Bug 373078 - API Cleaning - * Thomas Cicognani (Soft-Maint) - Bug 416221 - New methods to get references in FacetManager API - * Thomas Cicognani (Soft-Maint) - Bug 420193 - Listener on FacetManager - * Gregoire Dupe (Mia-Software) - Bug 443682 - Access to the super facet - * Jonathan Pepin (Soft-Maint) - Bug 463907 - Command for load and save Facet serialization - *******************************************************************************/ -package org.eclipse.emf.facet.efacet.core; - -import java.util.Collection; -import java.util.List; -import java.util.Set; - -import org.eclipse.emf.ecore.EAttribute; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.EOperation; -import org.eclipse.emf.ecore.EReference; -import org.eclipse.emf.ecore.EStructuralFeature; -import org.eclipse.emf.ecore.ETypedElement; -import org.eclipse.emf.ecore.resource.Resource; -import org.eclipse.emf.ecore.resource.ResourceSet; -import org.eclipse.emf.edit.domain.EditingDomain; -import org.eclipse.emf.facet.efacet.core.exception.FacetManagerException; -import org.eclipse.emf.facet.efacet.core.exception.SuperInvokeException; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.DerivedTypedElement; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.Facet; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.FacetAttribute; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.FacetReference; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.FacetSet; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.ParameterValue; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.runtime.ETypedElementResult; - -/** - * This interface allows clients to use the EMF Facet API to get and set the values of virtually - * added {@link EReference}s and {@link EAttribute}s, and invoke {@link EOperation}s. - * <p> - * Derived {@link FacetAttribute}s and {@link FacetReference}s are computed by queries, whereas - * non-derived {@link FacetAttribute}s and {@link EAttribute}s and {@link EReference}s and - * {@link FacetReference}s are stored in the serialization {@link Resource} specified in the - * {@link IFacetManagerFactory} that created this {@link IFacetManager}. - * - * @since 0.2 - * @noextend This interface is not intended to be extended by clients. - * @noimplement This interface is not intended to be implemented by clients. - */ -public interface IFacetManager { - - /** - * Serialize the model containing the structural feature instances. - */ - void saveStructuralFeatureInstanceModel() throws FacetManagerException; - - /** - * Returns whether the given model element conforms to the given Facet - * - * @param eObject - * the model element - * @param facet - * the Facet the applicability of which is being tested - * @throws FacetManagerException - * if there is an error evaluating the Facet's conformance typed element - * @return whether the given model element should be seen as an instance of the given Facet - */ - boolean isConforming(final EObject eObject, final Facet facet) - throws FacetManagerException; - - /** - * Set the value of the given {@link EStructuralFeature} on the given - * {@link EObject} to the given {@link Object} value. - * - * @param eObject - * the model element whose feature must be set - * @param structuralFeature - * the feature to set - * @param newValue - * the new value - * @param editingDomain - * @throws FacetManagerException - * <ul> - * <li>if the eObject doesn't conform to the Facet of the given - * attribute (in the case of a FacetAttribute)</li> - * <li>if the Facet of the given attribute is not applicable to - * the given eObject (in the case of a FacetAttribute)</li> - * <li> - * if there is an error evaluating the Facet's conformance typed - * element</li> - * </ul> - */ - void set(EObject eObject, EStructuralFeature structuralFeature, - Object newValue, EditingDomain editingDomain) - throws FacetManagerException; - - /** - * Evaluate the given {@link EOperation} of the given {@link EObject}. The - * returned value has to be of the given expectedType {@link Class} - * - * @param eObject - * the model element on which the operation is evaluated - * @param operation - * the operation to evaluate - * @param resultType - * the expected type of the returned value; if the effective type - * is not compatible, an UnmatchingExpectedTypeException will be - * thrown - * @param arguments - * the values of the parameters of the EOperation that is - * evaluated: they must match both in size, types and - * multiplicity - * @return the return value of the operation - * @throws FacetManagerException - * <ul> - * <li>if the effective type does not match the expected type</li> - * <li>in case of an error in the query that returns the value - * (can only happen in the case of a FacetOperation)</li> - * <li>in case of an error when delegating to the Ecore - * reflexive API (if the given EOperation is not a - * FacetOperation)</li> - * <li>if the eObject doesn't conform to the Facet of the given - * operation (in the case of a FacetOperation)</li> - * <li>if the Facet of the given operation is not applicable to - * the given eObject (in the case of a FacetOperation)</li> - * <li>if there is an error evaluating the Facet's conformance - * typed element</li> - * <li>if the given actual parameters don't match the - * EOperation's formal parameters</li> - * </ul> - */ - <T> T invoke(EObject eObject, EOperation operation, - Class<T> resultType, EditingDomain editingDomain, - Object... arguments) throws FacetManagerException; - - /** - * Invoke the given {@link EOperation} on each element of the given - * collection of {@link EObject}s. - * - * @param eObjects - * the model elements on which the operation is evaluated - * @param operation - * the operation to evaluate - * @param arguments - * the values of the parameters of the EOperation that is - * evaluated: they must match both in size, types and - * multiplicity - * @return the list of results, one for each model element of the given - * <code>eObjects</code> - * @throws FacetManagerException - * <ul> - * <li>in case of an error when delegating to the Ecore - * reflexive API (if the given EOperation is not a - * FacetOperation)</li> - * <li> - * in case of an error in the derived typed element that returns - * the value</li> - * </ul> - */ - List<ETypedElementResult> batchInvoke(Collection<EObject> eObjects, - EOperation operation, Object... arguments) - throws FacetManagerException; - - /** - * This method returns the list of loaded facet sets. - * - * @return a modifiable list of all FacetSets that - * constitute the working context of the FacetManager - */ - List<FacetSet> getManagedFacetSets(); - - /** @return the resourceSet used to manage the facet models. */ - ResourceSet getResourceSet(); - - <T> T getOrInvoke(EObject element, ETypedElement query, Class<T> aClass) - throws FacetManagerException; - - <T> List<T> getOrInvokeMultiValued(EObject eObject, ETypedElement feature, - Class<T> aClass) throws FacetManagerException; - - <T> List<ETypedElementResult> batchGetOrInvoke(Collection<EObject> sources, - ETypedElement query, Class<T> aClass) throws FacetManagerException; - - /** - * Get virtual references from an EObject. References must be defined in a - * FacetSet - * - * @param eObject - * Model element - * @return All not duplicated virtual references - * @throws FacetManagerException - * @since 0.4 - */ - Set<EReference> getReferences(EObject eObject) throws FacetManagerException; - - /** - * Get virtual attributes from an EObject. References must be defined in a - * FacetSet - * - * @param eObject - * Model element - * @return All not duplicated virtual attributes - * @throws FacetManagerException - * @since 0.4 - */ - Set<EAttribute> getAttributes(EObject eObject) throws FacetManagerException; - - /** - * Get virtual references and attributes from an EObject. References must be - * defined in a FacetSet - * - * @param eObject - * Model element - * @return All not duplicated virtual references and attributes - * @throws FacetManagerException - * @since 0.4 - */ - Set<EStructuralFeature> getStructuralFeature(EObject eObject) - throws FacetManagerException; - - /** - * Adds a listener to this manager that will be notified when this manager's - * state changes. - * - * @param listener - * The listener to be added - * @since 0.4 - */ - void addListener(IFacetManagerListener listener); - - /** - * Removes a listener from this manager. - * - * @param listener - * The listener to be removed - * @since 0.4 - */ - void removeListener(IFacetManagerListener listener); - - /** - * @since 1.0 - */ - <T> T getSuperValueOf(DerivedTypedElement derivedTypedElt, EObject source, - List<ParameterValue> parameterValues, Class<T> expectedType) - throws SuperInvokeException, FacetManagerException; - - /** - * @since 1.0 - */ - Resource getSerializationResource(); - - /** - * @since 1.0 - */ - void setSerializationResource(Resource resource) - throws FacetManagerException; - -}
diff --git a/org.eclipse.modisco.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/IFacetManagerFactory.java b/org.eclipse.modisco.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/IFacetManagerFactory.java deleted file mode 100644 index 33daa42..0000000 --- a/org.eclipse.modisco.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/IFacetManagerFactory.java +++ /dev/null
@@ -1,105 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2011 Mia-Software - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Emmanuelle Rouillé (Mia-Software) - Bug 352618 - To be able to use non derived facet structural features and save them values. - * Nicolas Bros (Mia-Software) - Bug 361612 - New core for new version of the Facet metamodel - * Gregoire Dupe (Mia-Software) - Bug 361794 - [Restructuring] New customization meta-model - * Gregoire Dupe (Mia-Software) - Bug 369987 - [Restructuring][Table] Switch to the new customization and facet framework - * Gregoire Dupe (Mia-Software) - Bug 373078 - API Cleaning - * Thomas Cicognani (Soft-Maint) - Bug 463658 - Impossibility to just create a FacetManager - *******************************************************************************/ -package org.eclipse.emf.facet.efacet.core; - -import org.eclipse.emf.ecore.EStructuralFeature; -import org.eclipse.emf.ecore.resource.Resource; -import org.eclipse.emf.ecore.resource.ResourceSet; -import org.eclipse.emf.facet.efacet.core.internal.FacetManagerFactory; - -/** - * Factory for {@link IFacetManager}. - * - * @since 0.2 - * @noimplement This interface is not intended to be implemented by clients. - * @noextend This interface is not intended to be extended by clients. - */ -public interface IFacetManagerFactory { - - /** - * The singleton instance of the factory. - */ - IFacetManagerFactory DEFAULT = new FacetManagerFactory(); - - /** - * Create an {@link IFacetManager}. - * - * @param resource - * the {@link Resource} in which virtual {@link EStructuralFeature}s are serialized. - * Can be null if no EStructuralFeature provided a Facet are used. - * @deprecated Use {@link #getOrCreateDefaultFacetManagerWithSerializationResource(Resource)} instead. The new method name is more understandable - */ - @Deprecated - IFacetManager getOrCreateFacetManager(Resource resource); - - /** - * Get an existing {@link IFacetManager} or create a new one. - * - * @param resource - * the {@link Resource} in which virtual - * {@link EStructuralFeature}s are serialized. Can be - * <code>null</code> if no EStructuralFeature provided a Facet - * are used. - * @return The default IFacetManager associated to the Resource - * @since 1.0 - */ - IFacetManager getOrCreateDefaultFacetManagerWithSerializationResource( - Resource resource); - - - /** - * Create an {@link IFacetManager}. - * - * @param resourceSet - * the resourceSet which will be used to manage the facet models. - * @deprecated Use {@link #getOrCreateDefaultFacetManager(ResourceSet)} instead. The new method name is more understandable - * - */ - @Deprecated - IFacetManager getOrCreateFacetManager(ResourceSet resourceSet); - - /** - * Get an existing {@link IFacetManager} or create a new one. - * - * @param resourceSet - * the resourceSet which will be used to manage the facet models. - * @return The default IFacetManager associated to the ResourceSet - * @since 1.0 - */ - IFacetManager getOrCreateDefaultFacetManager(ResourceSet resourceSet); - - /** - * Create a new {@link IFacetManager}. - * - * @param resource - * the {@link Resource} in which virtual - * {@link EStructuralFeature}s are serialized. Can be - * <code>null</code> if no EStructuralFeature provided a Facet - * are used. - * @since 1.0 - */ - IFacetManager createFacetManagerWithSerializationResource(Resource resource); - - /** - * Create a new {@link IFacetManager}. - * - * @param resourceSet - * the resourceSet which will be used to manage the facet models. - * @since 1.0 - */ - IFacetManager createFacetManager(ResourceSet resourceSet); - -}
diff --git a/org.eclipse.modisco.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/IFacetManagerListener.java b/org.eclipse.modisco.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/IFacetManagerListener.java deleted file mode 100644 index 8039422..0000000 --- a/org.eclipse.modisco.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/IFacetManagerListener.java +++ /dev/null
@@ -1,28 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2013 Mia-Maint - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Thomas Cicognani (Soft-Maint) - Bug 420193 - Listener on FacetManager - * Thomas Cicognani (Soft-Maint) - Bug 472075 - Update API to create UI shortcuts to activate FacetSets - *******************************************************************************/ -package org.eclipse.emf.facet.efacet.core; - -/** - * This interface allows clients to manage listeners added on the - * {@link IFacetManager} - * - * @since 0.4 - * @noextend This interface is not intended to be extended by clients. - */ -public interface IFacetManagerListener { - - /** - * Notifies that the {@link IFacetManager} has changed. - */ - void facetManagerChanged(); - -}
diff --git a/org.eclipse.modisco.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/IFacetManagerProvider.java b/org.eclipse.modisco.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/IFacetManagerProvider.java deleted file mode 100644 index 2ef5a65..0000000 --- a/org.eclipse.modisco.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/IFacetManagerProvider.java +++ /dev/null
@@ -1,20 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2014 Mia-Software - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Gregoire Dupe (Mia-Software) - Bug 441051 - Reusable customization and facet loading dialogs - *******************************************************************************/ -package org.eclipse.emf.facet.efacet.core; - -/** - * @since 0.5 - */ -public interface IFacetManagerProvider { - - IFacetManager getFacetManager(); - -}
diff --git a/org.eclipse.modisco.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/IFacetSetCatalogManager.java b/org.eclipse.modisco.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/IFacetSetCatalogManager.java deleted file mode 100644 index 62317db..0000000 --- a/org.eclipse.modisco.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/IFacetSetCatalogManager.java +++ /dev/null
@@ -1,28 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2012 Mia-Software. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Gregoire Dupe (Mia-Software) - Bug 369987 - [Restructuring][Table] Switch to the new customization and facet framework - * Gregoire Dupe (Mia-Software) - Bug 373078 - API Cleaning - *******************************************************************************/ -package org.eclipse.emf.facet.efacet.core; - -import java.util.Collection; - -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.FacetSet; - -/** - * @since 0.2 - * @noimplement This interface is not intended to be implemented by clients. - * @noextend This interface is not intended to be extended by clients. - */ -public interface IFacetSetCatalogManager { - - Collection<FacetSet> getRegisteredFacetSets(); - - void registerFacetSet(FacetSet facetSet); -}
diff --git a/org.eclipse.modisco.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/IFacetSetCatalogManagerFactory.java b/org.eclipse.modisco.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/IFacetSetCatalogManagerFactory.java deleted file mode 100644 index d3b8d55..0000000 --- a/org.eclipse.modisco.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/IFacetSetCatalogManagerFactory.java +++ /dev/null
@@ -1,28 +0,0 @@ -/** - * Copyright (c) 2012 Mia-Software. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Gregoire Dupe (Mia-Software) - Bug 369987 - [Restructuring][Table] Switch to the new customization and facet - * Gregoire Dupe (Mia-Software) - Bug 373078 - API Cleaning - */ -package org.eclipse.emf.facet.efacet.core; - -import org.eclipse.emf.ecore.resource.ResourceSet; -import org.eclipse.emf.facet.efacet.core.internal.FacetCatalogManagerFactory; - -/** - * @since 0.2 - * @noimplement This interface is not intended to be implemented by clients. - * @noextend This interface is not intended to be extended by clients. - */ -public interface IFacetSetCatalogManagerFactory { - - IFacetSetCatalogManagerFactory DEFAULT = new FacetCatalogManagerFactory(); - - IFacetSetCatalogManager getOrCreateFacetSetCatalogManager(ResourceSet resourceSet); -}
diff --git a/org.eclipse.modisco.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/exception/DerivedTypedElementException.java b/org.eclipse.modisco.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/exception/DerivedTypedElementException.java deleted file mode 100644 index f8ab410..0000000 --- a/org.eclipse.modisco.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/exception/DerivedTypedElementException.java +++ /dev/null
@@ -1,40 +0,0 @@ -/** - * Copyright (c) 2009 Mia-Software. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Gregoire Dupe (Mia-Software) - initial API and implementation - * Nicolas Bros (Mia-Software) - Bug 362191 - [Restructuring] Query mechanism for eFacet2 - */ -package org.eclipse.emf.facet.efacet.core.exception; - -import org.eclipse.emf.facet.efacet.core.internal.exception.DerivedTypedElementEvaluationException; - -/** - * This exception is raised when something is wrong with a query, and there is not a more specific - * sub-class to describe the error (e.g. {@link DerivedTypedElementEvaluationException} ) - * @since 0.2 - */ -public class DerivedTypedElementException extends Exception { - - // This class is a copy of : - // org.eclipse.emf.facet.infra.query.core.exception.ModelQueryException - - private static final long serialVersionUID = -3203874059325745157L; - - public DerivedTypedElementException(final String message) { - super(message); - } - - public DerivedTypedElementException(final String message, final Throwable cause) { - super(message, cause); - } - - public DerivedTypedElementException(final Throwable cause) { - super(cause); - } - -}
diff --git a/org.eclipse.modisco.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/exception/FacetManagerException.java b/org.eclipse.modisco.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/exception/FacetManagerException.java deleted file mode 100644 index ee949cf..0000000 --- a/org.eclipse.modisco.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/exception/FacetManagerException.java +++ /dev/null
@@ -1,37 +0,0 @@ -/** - * Copyright (c) 2012 Mia-Software. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Gregoire Dupe (Mia-Software) - Bug 369987 - [Restructuring][Table] Switch to the new customization and facet framework - */ -package org.eclipse.emf.facet.efacet.core.exception; - -/** - * @since 0.2 - */ -public class FacetManagerException extends Exception { - - private static final long serialVersionUID = -4670132391244495825L; - - public FacetManagerException() { - super(); - } - - public FacetManagerException(final String message) { - super(message); - } - - public FacetManagerException(final Throwable cause) { - super(cause); - } - - public FacetManagerException(final String message, final Throwable cause) { - super(message, cause); - } - -}
diff --git a/org.eclipse.modisco.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/exception/SuperInvokeException.java b/org.eclipse.modisco.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/exception/SuperInvokeException.java deleted file mode 100644 index c910aaa..0000000 --- a/org.eclipse.modisco.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/exception/SuperInvokeException.java +++ /dev/null
@@ -1,36 +0,0 @@ -/** - * Copyright (c) 2014 Mia-Software. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Gregoire Dupe (Mia-Software) - Bug 443682 - Access to the super facet - */ -package org.eclipse.emf.facet.efacet.core.exception; - -/** - * @since 1.0 - */ -public class SuperInvokeException extends Exception { - - private static final long serialVersionUID = -2090554884512810064L; - - public SuperInvokeException() { - super(); - } - - public SuperInvokeException(final String message) { - super(message); - } - - public SuperInvokeException(final Throwable cause) { - super(cause); - } - - public SuperInvokeException(final String message, final Throwable cause) { - super(message, cause); - } - -}
diff --git a/org.eclipse.modisco.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/internal/Activator.java b/org.eclipse.modisco.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/internal/Activator.java deleted file mode 100644 index 172b3f4..0000000 --- a/org.eclipse.modisco.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/internal/Activator.java +++ /dev/null
@@ -1,46 +0,0 @@ -/** - * Copyright (c) 2011 Mia-Software. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Nicolas Guyomar (Mia-Software) - Bug 333553 - The user has not to deal with two files to create a facet - */ -package org.eclipse.emf.facet.efacet.core.internal; - -import org.eclipse.core.runtime.Plugin; -import org.osgi.framework.BundleContext; - -public class Activator extends Plugin { - - private static BundleContext context; - - static BundleContext getContext() { - return Activator.context; - } - - @Override - public void start(final BundleContext bundleContext) throws Exception { - super.start(bundleContext); - Activator.context = bundleContext; - Activator.plugin = this; - } - - @Override - public void stop(final BundleContext bundleContext) throws Exception { - Activator.context = null; - Activator.plugin = null; - super.stop(bundleContext); - } - - // The shared instance - private static Activator plugin; - - public static Plugin getDefault() { - return Activator.plugin; - } - -}
diff --git a/org.eclipse.modisco.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/internal/CastUtils.java b/org.eclipse.modisco.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/internal/CastUtils.java deleted file mode 100644 index 86757ae..0000000 --- a/org.eclipse.modisco.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/internal/CastUtils.java +++ /dev/null
@@ -1,91 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2011, 2016 Mia-Software, and Soft-Maint. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Emmanuelle Rouillé (Mia-Software) - Bug 352618 - To be able to use non derived facet structural features and save them values. - * Nicolas Bros (Mia-Software) - Bug 361612 - New core for new version of the Facet metamodel - * Grégoire Dupé (Mia-Software) - Bug 361612 - [Restructuring] New core for new version of the Facet metamodel - * Alban Ménager (Soft-Maint) - Bug 387470 - [EFacet][Custom] Editors - * Jonathan Pepin (Soft-Maint) - Bug 463898 - Create FacetReference not derived, without query and with opposite mechanism - * Jonathan Pepin (Soft-Maint) - Bug 510034 - Null value is wrongly casted in a new list - *******************************************************************************/ -package org.eclipse.emf.facet.efacet.core.internal; - -import java.util.Iterator; -import java.util.List; - -import org.eclipse.emf.facet.efacet.core.internal.exception.UnmatchingExpectedTypeException; - -public final class CastUtils { - - private CastUtils() { - //Must no be used. - } - - public static <T> List<T> castToExpectedListType(final Object object, - final Class<T> expectedType, final boolean canContainsNull) - throws UnmatchingExpectedTypeException { - List<T> result = null; - if (object != null) { - if (!(object instanceof List)) { - throw new UnmatchingExpectedTypeException( - "The parameter 'object' is not a List"); //$NON-NLS-1$ - } - final List<?> list = (List<?>) object; - result = castToExpectedListType(list, expectedType, canContainsNull); - } - return result; - } - - @SuppressWarnings("unchecked") - /* - * @SuppressWarnings("unchecked") jpepin> The cast checked is done by the - * method 'checkTypeOfAllListElements' - */ - public static <T> List<T> castToExpectedListType(final List<?> list, - final Class<T> expectedType, final boolean canContainsNull) - throws UnmatchingExpectedTypeException { - checkTypeOfAllListElements(list, expectedType, canContainsNull); - return (List<T>) list; - } - - @SuppressWarnings("unchecked") - //@SuppressWarnings("unchecked") This method is used to isolate unsafe cast. - public static <T> T castToExpectedType(final Object value, final Class<T> expectedType) - throws UnmatchingExpectedTypeException { - try { - return (T) value; - } catch (ClassCastException e) { - throw new UnmatchingExpectedTypeException("Type mismatch. Expected: " + //$NON-NLS-1$ - expectedType.getClass().getName() + ", got " + value.getClass().getName(), e); //$NON-NLS-1$); - } - } - - public static void checkTypeOfAllListElements(final List<?> list, - final Class<?> expectedType, final boolean canContainsNull) - throws UnmatchingExpectedTypeException { - if (expectedType == null) { - // null means match everything - return; - } - final Iterator<?> iterator = list.iterator(); - int index = -1; - while (iterator.hasNext()) { - final Object object = iterator.next(); - index++; - if (!canContainsNull && object == null) { - throw new UnmatchingExpectedTypeException( - "The 'no null' constraint is violated at index " //$NON-NLS-1$ - + index, expectedType, object); - } - if (object != null && !expectedType.isInstance(object)) { - throw new UnmatchingExpectedTypeException("Type mismatch at index " + index, expectedType, object); //$NON-NLS-1$ - } - } - } - -}
diff --git a/org.eclipse.modisco.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/internal/DerivedTypedElementManager.java b/org.eclipse.modisco.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/internal/DerivedTypedElementManager.java deleted file mode 100644 index 330aafd..0000000 --- a/org.eclipse.modisco.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/internal/DerivedTypedElementManager.java +++ /dev/null
@@ -1,845 +0,0 @@ -/** - * Copyright (c) 2011, 2012, 2013, 2014 Mia-Software. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Gregoire Dupe (Mia-Software) - Bug 333553 - The user has not to deal with two files to create a facet - * Emmanuelle Rouillé (Mia-Software) - Bug 352618 - To be able to use non derived facet structural features and save them values. - * Nicolas Bros (Mia-Software) - Bug 361612 - New core for new version of the Facet metamodel - * Nicolas Bros (Mia-Software) - Bug 362191 - [Restructuring] Query mechanism for eFacet2 - * Gregoire Dupe (Mia-Software) - Bug 369987 - [Restructuring][Table] Switch to the new customization and facet framework - * Gregoire Dupe (Mia-Software) - Bug 364325 - [Restructuring] The user must be able to navigate into a model using the Facet. - * Gregoire Dupe (Mia-Software) - Bug 373078 - API Cleaning - * Nicolas Bros (Mia-Software) - Bug 376941 - [EFacet] Facet operation arguments in Facet model - * Alban Ménager (Soft-Maint) - Bug 387470 - [EFacet][Custom] Editors - * Gregoire Dupe (Mia-Software) - Bug 418885 - ETypedElementSwitchQuery implemented using a deprecated query evaluator extension point - * Gregoire Dupe (Mia-Software) - Bug 441570 - Children custom property - */ -package org.eclipse.emf.facet.efacet.core.internal; - -import java.util.Collection; -import java.util.LinkedList; -import java.util.List; - -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.ecore.EClassifier; -import org.eclipse.emf.ecore.EDataType; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.facet.efacet.core.IDerivedTypedElementManager; -import org.eclipse.emf.facet.efacet.core.IFacetManager; -import org.eclipse.emf.facet.efacet.core.exception.DerivedTypedElementException; -import org.eclipse.emf.facet.efacet.core.internal.exception.DerivedTypedElementEvaluationException; -import org.eclipse.emf.facet.efacet.core.internal.exception.DerivedTypedElementTypeCheckingException; -import org.eclipse.emf.facet.efacet.core.internal.exception.UnmatchingExpectedTypeException; -import org.eclipse.emf.facet.efacet.core.internal.query.QueryImplementationFactoryRegistry; -import org.eclipse.emf.facet.efacet.core.internal.query.QueryUtils; -import org.eclipse.emf.facet.efacet.core.query.IQueryImplementation; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.DerivedTypedElement; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.ParameterValue; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.extensible.Query; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.runtime.ETypedElementResult; -import org.eclipse.emf.facet.util.core.Logger; - -public class DerivedTypedElementManager implements IDerivedTypedElementManager { - - private static final boolean SET_AS_LIST = Boolean.getBoolean(DerivedTypedElementManager.class.getName() + ".setAsList"); //$NON-NLS-1$ - - public Object evaluate(final DerivedTypedElement derivedTypedElement, - final EObject source, final List<ParameterValue> parameterValues, - final IFacetManager facetManager) - throws DerivedTypedElementException { - Object result; - if (derivedTypedElement.isMany()) { - result = evaluateMultiValued(derivedTypedElement, source, parameterValues, null, facetManager); - } else { - result = evaluateSingleValued(derivedTypedElement, source, parameterValues, null, facetManager); - } - return result; - } - - public Object evaluate(final Query query, final EObject source, final List<ParameterValue> parameterValues, final IFacetManager facetManager) - throws DerivedTypedElementException { - final IQueryImplementation evaluator = QueryImplementationFactoryRegistry.INSTANCE.getEvaluatorFor(query, this); - final DerivedTypedElement derivedTE = QueryUtils.getOwningDerivedTypedElement(query); - Object result; - try { - result = evaluator.getValue(query, derivedTE, source, parameterValues, facetManager); - } catch (Exception e) { - throw new DerivedTypedElementEvaluationException(e); - } - return result; - } - - public <T> T evaluateSingleValued(final DerivedTypedElement derivedTypedElement, - final EObject source, final List<ParameterValue> parameterValues, final Class<T> expectedType, final IFacetManager facetManager) - throws DerivedTypedElementException { - if (derivedTypedElement.isMany()) { - throw new IllegalArgumentException("This method doesn't accept a multi-valued derived typed element."); //$NON-NLS-1$ - } - - Query query = derivedTypedElement.getQuery(); - if (query == null) { - throw new DerivedTypedElementException("The given derived typed element doesn't contain a query"); //$NON-NLS-1$ - } - Object queryResult = evaluate(derivedTypedElement, source, parameterValues, facetManager, query); - - // expectedResultType == null means match everything - // And a null value for queryResult matches any type - if (expectedType != null && queryResult != null && !expectedType.isInstance(queryResult)) { - Exception e1 = new UnmatchingExpectedTypeException( - "The derived typed element did not evaluate to the expected type", expectedType, queryResult); //$NON-NLS-1$ - throw new DerivedTypedElementException(e1); - } - // just checked - @SuppressWarnings("unchecked") - T typedQueryResult = (T) queryResult; - return typedQueryResult; - } - - public <T> List<T> evaluateMultiValued(final DerivedTypedElement derivedTypedElement, - final EObject source, final List<ParameterValue> parameterValues, final Class<T> expectedType, final IFacetManager facetManager) - throws DerivedTypedElementException { - if (!derivedTypedElement.isMany()) { - throw new IllegalArgumentException("This method doesn't accept a single-valued derived typed element."); //$NON-NLS-1$ - } - - Query query = derivedTypedElement.getQuery(); - if (query == null) { - throw new DerivedTypedElementException("The given derived typed element doesn't contain a query"); //$NON-NLS-1$ - } - Object queryResult = evaluate(derivedTypedElement, source, parameterValues, facetManager, query); - if (SET_AS_LIST) { - /* - * gdupe> This conversion seem to be a bit too magic to be a default - * behavior. - */ - queryResult = setAsList(queryResult); - } - List<T> result = null; - if (queryResult instanceof List<?>) { - List<?> queryListResult = (List<?>) queryResult; - for (Object queryResultElement : queryListResult) { - // expectedType == null means match everything - // And a null queryResultElement for queryResult matches any type - if (expectedType != null && queryResultElement != null && !expectedType.isInstance(queryResultElement)) { - Exception e1 = new UnmatchingExpectedTypeException( - "The derived typed element did not evaluate to the expected type"); //$NON-NLS-1$ - throw new DerivedTypedElementException(e1); - } - } - // just checked - @SuppressWarnings("unchecked") - List<T> typedQueryListResult = (List<T>) queryListResult; - result = typedQueryListResult; - } else if (queryResult != null) { - throw new DerivedTypedElementException("The given multi-valued derived typed element did not evaluate to a List."); //$NON-NLS-1$ - } - return result; - } - - protected Object evaluate(final DerivedTypedElement derivedTE, final EObject source, final List<ParameterValue> parameterValues, - final IFacetManager facetManager, final Query query) throws DerivedTypedElementException { - final IQueryImplementation evaluator = QueryImplementationFactoryRegistry.INSTANCE - .getEvaluatorFor(query, this); - return evaluateAndCheck(derivedTE.getQuery(), source, parameterValues, - evaluator, facetManager); - } - - private static Object evaluateAndCheck(final Query query, final EObject source, final List<ParameterValue> parameterValues, - final IQueryImplementation evaluator, final IFacetManager facetManager) - throws DerivedTypedElementException { - checkQuery(query, source); - Object result; - try { - result = evaluator.getValue(query, QueryUtils.getOwningDerivedTypedElement(query), source, parameterValues, facetManager); - } catch (Throwable e) { - if (e instanceof DerivedTypedElementEvaluationException) { - throw (DerivedTypedElementEvaluationException) e; - } - throw new DerivedTypedElementEvaluationException(e); - } - checkResult(query, result, evaluator.isCheckResultType(), isPrimitive(QueryUtils.getReturnType(query))); - return result; - } - - private static void checkQuery(final Query query, final EObject source) throws DerivedTypedElementException { - if (query == null) { - throw new IllegalArgumentException("query cannot be null"); //$NON-NLS-1$ - } - - EClassifier sourceType = QueryUtils.getSourceType(query); - if (sourceType == null && source != null) { - throw new DerivedTypedElementException("the query's sourceType is null and the source is not null"); //$NON-NLS-1$ - } - - // a null value for eObject matches any type - if (sourceType != null && source != null && !sourceType.isInstance(source)) { - StringBuffer message = new StringBuffer(); - message.append("Wrong source type (for " + QueryUtils.getQueryDescription(query) + "): '"); //$NON-NLS-1$ //$NON-NLS-2$ - message.append(source.eClass().getName()); - message.append("' found; expected '"); //$NON-NLS-1$ - message.append(sourceType.getName()); - message.append("'."); //$NON-NLS-1$ - throw new DerivedTypedElementTypeCheckingException(message.toString()); - } - } - - // public List<? extends AbstractDerivedTypedElementResult> evaluate(final DerivedTypedElement - // derivedTypedElement, final Collection<EObject> sources, - // final List<ParameterValue> parameterValues) throws DerivedTypedElementException { - // if (derivedTypedElement.isMany()) { - // try { - // return evaluateSingleValued(derivedTypedElement, sources, parameterValues, null); - // } catch (UnmatchingExpectedTypeException e) { - // // should never happen - // throw new IllegalStateException("Unexpected error"); //$NON-NLS-1$ - // } - // } else { - // try { - // return evaluateMultiValued(derivedTypedElement, sources, parameterValues, null); - // } catch (UnmatchingExpectedTypeException e) { - // // should never happen - // throw new IllegalStateException("Unexpected error"); //$NON-NLS-1$ - // } - // } - // } - - - // batch evaluation disabled : Bug 365429 - DerivedTypedElementManager : re-implement batch evaluation - - public <T extends ETypedElementResult> List<T> batchEvaluate(final DerivedTypedElement derivedTypedElement, - final Collection<? extends EObject> sources, final List<ParameterValue> parameterValues, final Class<T> expectedType, final IFacetManager facetManager) - throws DerivedTypedElementException { - - throw new UnsupportedOperationException("not implemented yet"); //$NON-NLS-1$ - -// if (derivedTypedElement == null) { -// throw new IllegalArgumentException("The given derived typed element must not be null"); //$NON-NLS-1$ -// } -// -// List<T> abstractResultList; -// -// Query query = derivedTypedElement.getQuery(); -// if (query == null) { -// throw new DerivedTypedElementException("The given derived typed element doesn't contain a query"); //$NON-NLS-1$ -// } -// EClassifier eType = derivedTypedElement.getEType(); -// if (eType == null) { -// throw new DerivedTypedElementException("The given derived typed element has a null type"); //$NON-NLS-1$ -// } -// IDerivedTypedElementImplementation evaluator = DerivedTypedElementImplementationFactoryRegistry.INSTANCE.getEvaluatorFor(query); -// if (evaluator == null) { -// throw new DerivedTypedElementEvaluationException("No evaluator was found for a query of type " + query.getClass().getName()); //$NON-NLS-1$ -// } -// -// final boolean primitiveType = isPrimitive(eType); -// -// // if the evaluator implements multiple evaluation itself, then use it -// if (evaluator instanceof IDerivedTypedElementCollectionImplementation) { -// IDerivedTypedElementCollectionImplementation collectionEvaluator = (IDerivedTypedElementCollectionImplementation) evaluator; -// if (derivedTypedElement.isMany()) { -// if (primitiveType) { -// if (expectedType != DerivedTypedElementPrimitiveTypeListResult.class) { -// throw new UnmatchingExpectedTypeException("The derivedTypedElement is multi-valued, and its type is primitive, " + //$NON-NLS-1$ -// "so expectedType must be " + DerivedTypedElementPrimitiveTypeListResult.class.getSimpleName()); //$NON-NLS-1$ -// } -// List<DerivedTypedElementPrimitiveTypeListResult<?>> listResultList = batchEvaluateMultiValuedPrimitiveDerivedTypedElementWithCollectionEvaluator( -// derivedTypedElement, sources, parameterValues, collectionEvaluator); -// // we just checked the type parameter T through expectedType -// @SuppressWarnings("unchecked") -// List<T> castList = (List<T>) listResultList; -// abstractResultList = castList; -// } else { -// if (expectedType != DerivedTypedElementEObjectListResult.class) { -// throw new UnmatchingExpectedTypeException("The derivedTypedElement is multi-valued, and it returns model elements, " + //$NON-NLS-1$ -// "so expectedType must be " + DerivedTypedElementEObjectListResult.class.getSimpleName()); //$NON-NLS-1$ -// } -// List<DerivedTypedElementEObjectListResult<?>> listResultList = batchEvaluateMultiValuedEObjectDerivedTypedElementWithCollectionEvaluator( -// derivedTypedElement, sources, parameterValues, collectionEvaluator); -// // we just checked the type parameter T through expectedType -// @SuppressWarnings("unchecked") -// List<T> castList = (List<T>) listResultList; -// abstractResultList = castList; -// } -// } else { -// if (primitiveType) { -// if (expectedType != DerivedTypedElementPrimitiveTypeResult.class) { -// throw new UnmatchingExpectedTypeException("The derivedTypedElement is single-valued, and its type is primitive, " + //$NON-NLS-1$ -// "so expectedType must be " + DerivedTypedElementPrimitiveTypeResult.class.getSimpleName()); //$NON-NLS-1$ -// } -// List<DerivedTypedElementPrimitiveTypeResult<?>> resultList = batchEvaluateSingleValuedPrimitiveDerivedTypedElementWithCollectionEvaluator( -// derivedTypedElement, sources, parameterValues, collectionEvaluator); -// // we just checked the type parameter T through expectedType -// @SuppressWarnings("unchecked") -// List<T> castList = (List<T>) resultList; -// abstractResultList = castList; -// } else { -// if (expectedType != DerivedTypedElementEObjectResult.class) { -// throw new UnmatchingExpectedTypeException("The derivedTypedElement is single-valued, and it returns a model element, " + //$NON-NLS-1$ -// "so expectedType must be " + DerivedTypedElementEObjectResult.class.getSimpleName()); //$NON-NLS-1$ -// } -// List<DerivedTypedElementEObjectResult<?>> resultList = batchEvaluateSingleValuedEObjectDerivedTypedElementWithCollectionEvaluator( -// derivedTypedElement, sources, parameterValues, collectionEvaluator); -// // we just checked the type parameter T through expectedType -// @SuppressWarnings("unchecked") -// List<T> castList = (List<T>) resultList; -// abstractResultList = castList; -// } -// } -// -// } else { -// // otherwise, do multiple evaluation by calling the evaluator's -// // single evaluation multiple times -// -// if (derivedTypedElement.isMany()) { -// if (primitiveType) { -// if (expectedType != DerivedTypedElementPrimitiveTypeListResult.class) { -// throw new UnmatchingExpectedTypeException("The derivedTypedElement is multi-valued, and its type is primitive, " + //$NON-NLS-1$ -// "so expectedType must be " + DerivedTypedElementPrimitiveTypeListResult.class.getSimpleName()); //$NON-NLS-1$ -// } -// List<DerivedTypedElementPrimitiveTypeListResult<?>> listResultList = batchEvaluateMultiValuedPrimitiveDerivedTypedElementWithSimpleEvaluator( -// derivedTypedElement, sources, parameterValues, evaluator); -// @SuppressWarnings("unchecked") -// List<T> castList = (List<T>) listResultList; -// abstractResultList = castList; -// } else { -// if (expectedType != DerivedTypedElementEObjectListResult.class) { -// throw new UnmatchingExpectedTypeException("The derivedTypedElement is multi-valued, and it returns model elements, " + //$NON-NLS-1$ -// "so expectedType must be " + DerivedTypedElementEObjectListResult.class.getSimpleName()); //$NON-NLS-1$ -// } -// List<DerivedTypedElementEObjectListResult<?>> listResultList = batchEvaluateMultiValuedEObjectDerivedTypedElementWithSimpleEvaluator( -// derivedTypedElement, sources, parameterValues, evaluator); -// @SuppressWarnings("unchecked") -// List<T> castList = (List<T>) listResultList; -// abstractResultList = castList; -// } -// } else { -// if (primitiveType) { -// if (expectedType != DerivedTypedElementPrimitiveTypeResult.class) { -// throw new UnmatchingExpectedTypeException("The derivedTypedElement is single-valued, and its type is primitive, " + //$NON-NLS-1$ -// "so expectedType must be " + DerivedTypedElementPrimitiveTypeResult.class.getSimpleName()); //$NON-NLS-1$ -// } -// List<DerivedTypedElementPrimitiveTypeResult<?>> resultList = batchEvaluateSingleValuedPrimitiveDerivedTypedElementWithSimpleCollectionEvaluator( -// derivedTypedElement, sources, parameterValues, evaluator); -// @SuppressWarnings("unchecked") -// List<T> castList = (List<T>) resultList; -// abstractResultList = castList; -// } else { -// if (expectedType != DerivedTypedElementEObjectResult.class) { -// throw new UnmatchingExpectedTypeException("The derivedTypedElement is single-valued, and it returns a model element, " + //$NON-NLS-1$ -// "so expectedType must be " + DerivedTypedElementEObjectResult.class.getSimpleName()); //$NON-NLS-1$ -// } -// List<DerivedTypedElementEObjectResult<?>> resultList = batchEvaluateSingleValuedEObjectDerivedTypedElementWithSimpleCollectionEvaluator( -// derivedTypedElement, sources, parameterValues, null); -// @SuppressWarnings("unchecked") -// List<T> castList = (List<T>) resultList; -// abstractResultList = castList; -// } -// } -// } -// return abstractResultList; - } - -// private static List<DerivedTypedElementPrimitiveTypeListResult<?>> batchEvaluateMultiValuedPrimitiveDerivedTypedElementWithCollectionEvaluator( -// final DerivedTypedElement derivedTypedElement, final Collection<EObject> sources, final List<ParameterValue> parameterValues, -// final IDerivedTypedElementCollectionImplementation collectionEvaluator) -// throws DerivedTypedElementException { -// -// List<? extends AbstractDerivedTypedElementResult> listResultList = collectionEvaluator -// .getValues(derivedTypedElement, sources, parameterValues); -// -// // check the return type from the evaluator in order to be able to cast safely -// for (int index = 0; index < listResultList.size(); index++) { -// AbstractDerivedTypedElementResult elementResult = listResultList.get(index); -// if (elementResult instanceof DerivedTypedElementPrimitiveTypeListResult<?>) { -// DerivedTypedElementPrimitiveTypeListResult<?> derivedTypedElementPrimitiveTypeListResult = (DerivedTypedElementPrimitiveTypeListResult<?>) elementResult; -// checkResult(derivedTypedElement.getQuery(), derivedTypedElementPrimitiveTypeListResult.getResultList(), -// collectionEvaluator.getCheckResultType()); -// } else { -// throw new DerivedTypedElementEvaluationException(ErrorHandlingUtils.buildWrongTypeMessage( -// "Wrong element type at index " + index + " in the result from the evaluator: " + collectionEvaluator.getClass().getName(), //$NON-NLS-1$//$NON-NLS-2$ -// DerivedTypedElementPrimitiveTypeListResult.class, elementResult)); -// } -// } -// -// // just checked -// @SuppressWarnings("unchecked") -// List<DerivedTypedElementPrimitiveTypeListResult<?>> result = (List<DerivedTypedElementPrimitiveTypeListResult<?>>) listResultList; -// return result; -// } -// -// private static List<DerivedTypedElementEObjectListResult<?>> batchEvaluateMultiValuedEObjectDerivedTypedElementWithCollectionEvaluator( -// final DerivedTypedElement derivedTypedElement, final Collection<EObject> sources, final List<ParameterValue> parameterValues, -// final IDerivedTypedElementCollectionImplementation collectionEvaluator) -// throws DerivedTypedElementException { -// List<? extends AbstractDerivedTypedElementResult> listResultList = collectionEvaluator -// .getValues(derivedTypedElement, sources, parameterValues); -// -// // check the return type from the evaluator in order to be able to cast safely -// for (int index = 0; index < listResultList.size(); index++) { -// AbstractDerivedTypedElementResult elementResult = listResultList.get(index); -// if (elementResult instanceof DerivedTypedElementEObjectListResult<?>) { -// DerivedTypedElementEObjectListResult<?> derivedTypedElementEObjectListResult = (DerivedTypedElementEObjectListResult<?>) elementResult; -// checkResult(derivedTypedElement.getQuery(), derivedTypedElementEObjectListResult.getResultList(), -// collectionEvaluator.getCheckResultType()); -// } else { -// throw new DerivedTypedElementEvaluationException(ErrorHandlingUtils.buildWrongTypeMessage( -// "Wrong element type at index " + index + " in the result from the evaluator: " + collectionEvaluator.getClass().getName(), //$NON-NLS-1$//$NON-NLS-2$ -// DerivedTypedElementEObjectListResult.class, elementResult)); -// } -// } -// -// // just checked -// @SuppressWarnings("unchecked") -// List<DerivedTypedElementEObjectListResult<?>> result = (List<DerivedTypedElementEObjectListResult<?>>) listResultList; -// return result; -// } -// -// private static List<DerivedTypedElementPrimitiveTypeResult<?>> batchEvaluateSingleValuedPrimitiveDerivedTypedElementWithCollectionEvaluator( -// final DerivedTypedElement derivedTypedElement, final Collection<EObject> sources, final List<ParameterValue> parameterValues, -// final IDerivedTypedElementCollectionImplementation collectionEvaluator) -// throws DerivedTypedElementException { -// // TODO Auto-generated method stub -// return null; -// } -// -// private static List<DerivedTypedElementEObjectResult<?>> batchEvaluateSingleValuedEObjectDerivedTypedElementWithCollectionEvaluator( -// final DerivedTypedElement derivedTypedElement, final Collection<EObject> sources, final List<ParameterValue> parameterValues, -// final IDerivedTypedElementCollectionImplementation collectionEvaluator) throws DerivedTypedElementException { -// // TODO Auto-generated method stub -// return null; -// } -// -// private static List<DerivedTypedElementPrimitiveTypeListResult<?>> batchEvaluateMultiValuedPrimitiveDerivedTypedElementWithSimpleEvaluator( -// final DerivedTypedElement derivedTypedElement, final Collection<EObject> sources, final List<ParameterValue> parameterValues, -// final IDerivedTypedElementImplementation evaluator) { -// -// Query query = derivedTypedElement.getQuery(); -// -// List<DerivedTypedElementPrimitiveTypeListResult<?>> listResultList = new ArrayList<DerivedTypedElementPrimitiveTypeListResult<?>>(); -// for (EObject eObject : sources) { -// DerivedTypedElementPrimitiveTypeListResult<Object> primitiveTypeListResult = EFacetFactory.eINSTANCE -// .createDerivedTypedElementPrimitiveTypeListResult(); -// -// Throwable error = null; -// try { -// primitiveTypeListResult.setSource(eObject); -// primitiveTypeListResult.setDerivedTypedElement(derivedTypedElement); -// setParameterValues(primitiveTypeListResult.getParameterValues(), parameterValues); -// checkSourceType(query.getSourceType(), query, eObject); -// } catch (Throwable e) { -// error = e; -// } -// if (error != null) { -// primitiveTypeListResult.setException(error); -// } else { -// try { -// Object evaluationResult = evaluator.getValue(derivedTypedElement, eObject, parameterValues); -// checkResult(query, evaluationResult, evaluator.getCheckResultType()); -// // checked by checkResult -// Collection<?> evaluationResultCollection = (Collection<?>) evaluationResult; -// for (Object object : evaluationResultCollection) { -// primitiveTypeListResult.getResultList().add(object); -// } -// } catch (Throwable e) { -// primitiveTypeListResult.setException(e); -// } -// } -// listResultList.add(primitiveTypeListResult); -// -// } -// return listResultList; -// } -// -// private static List<DerivedTypedElementEObjectListResult<?>> batchEvaluateMultiValuedEObjectDerivedTypedElementWithSimpleEvaluator( -// final DerivedTypedElement derivedTypedElement, final Collection<EObject> sources, final List<ParameterValue> parameterValues, -// final IDerivedTypedElementImplementation evaluator) { -// Query query = derivedTypedElement.getQuery(); -// -// List<DerivedTypedElementEObjectListResult<?>> listResultList = new ArrayList<DerivedTypedElementEObjectListResult<?>>(); -// for (EObject eObject : sources) { -// DerivedTypedElementEObjectListResult<EObject> eObjectListResult = EFacetFactory.eINSTANCE -// .createDerivedTypedElementEObjectListResult(); -// -// Throwable error = null; -// try { -// eObjectListResult.setSource(eObject); -// eObjectListResult.setDerivedTypedElement(derivedTypedElement); -// setParameterValues(eObjectListResult.getParameterValues(), parameterValues); -// checkSourceType(query.getSourceType(), query, eObject); -// } catch (Throwable e) { -// error = e; -// } -// if (error != null) { -// eObjectListResult.setException(error); -// } else { -// try { -// Object evaluationResult = evaluator.getValue(derivedTypedElement, eObject, parameterValues); -// checkResult(query, evaluationResult, evaluator.getCheckResultType(), false); -// // checked by checkResult -// @SuppressWarnings("unchecked") -// Collection<? extends EObject> evaluationResultCollection = (Collection<? extends EObject>) evaluationResult; -// for (EObject e : evaluationResultCollection) { -// eObjectListResult.getResultList().add(e); -// } -// } catch (Throwable e) { -// eObjectListResult.setException(e); -// } -// } -// listResultList.add(eObjectListResult); -// -// } -// return listResultList; -// } -// -// private static List<DerivedTypedElementPrimitiveTypeResult<?>> batchEvaluateSingleValuedPrimitiveDerivedTypedElementWithSimpleCollectionEvaluator( -// final DerivedTypedElement derivedTypedElement, final Collection<EObject> sources, final List<ParameterValue> parameterValues, -// final IDerivedTypedElementImplementation evaluator) -// throws DerivedTypedElementException { -// // TODO Auto-generated method stub -// return null; -// } -// -// private static List<DerivedTypedElementEObjectResult<?>> batchEvaluateSingleValuedEObjectDerivedTypedElementWithSimpleCollectionEvaluator( -// final DerivedTypedElement derivedTypedElement, final Collection<EObject> sources, final List<ParameterValue> parameterValues, -// final IDerivedTypedElementImplementation evaluator) -// throws DerivedTypedElementException { -// // TODO Auto-generated method stub -// return null; -// } - -// public <T> List<DerivedTypedElementListResult<T>> evaluateMultiValued(final DerivedTypedElement derivedTypedElement, -// final Collection<? extends EObject> sources, final List<ParameterValue> parameterValues, -// final Class<T> expectedType) -// throws DerivedTypedElementException, UnmatchingExpectedTypeException { -// if (!derivedTypedElement.isMany()) { -// throw new IllegalArgumentException("This method doesn't accept a single-valued derived typed element."); //$NON-NLS-1$ -// } -// -// Query query = derivedTypedElement.getQuery(); -// if (query == null) { -// throw new DerivedTypedElementException("The given derived typed element doesn't contain a query"); //$NON-NLS-1$ -// } -// IDerivedTypedElementImplementation evaluator = -// DerivedTypedElementImplementationFactoryRegistry.INSTANCE.getEvaluatorFor(query); -// -// List<?> queryResult = batchEvaluateAndCheck(derivedTypedElement, sources, parameterValues, -// evaluator); -// // Java doesn't support co- or contra-variance on generics, -// // so we can't return the right type -// @SuppressWarnings("unchecked") -// List<DerivedTypedElementListResult<T>> multiResultList = -// (List<DerivedTypedElementListResult<T>>) queryResult; -// -// // check each result element in each result list -// if (expectedType != null) { -// int sourceIndex = 0; -// for (DerivedTypedElementListResult<?> derivedTypedElementResult : multiResultList) { -// EList<?> resultList = derivedTypedElementResult.getResultList(); -// int index = 0; -// for (Object resultElement : resultList) { -// // a null value for resultElement matches any type -// if (resultElement != null && !expectedType.isInstance(resultElement)) { -// throw new UnmatchingExpectedTypeException( -// "The element at index " + index + " in the list that resulted from the evaluation of the multi-valued " //$NON-NLS-1$ //$NON-NLS-2$ -// + "derived typed element does not match the expected type " //$NON-NLS-1$ -// + "for the source element at index " + sourceIndex, expectedType, resultElement); //$NON-NLS-1$ -// } -// index++; -// } -// sourceIndex++; -// } -// } -// return multiResultList; -// } -// -// private static List<?> batchEvaluateAndCheck(final DerivedTypedElement derivedTypedElement, -// final Collection<EObject> eObjects, -// final List<ParameterValue> parameterValues, final IDerivedTypedElementImplementation -// evaluator) -// throws DerivedTypedElementException { -// List<?> result; -// -// Query query = derivedTypedElement.getQuery(); -// if (query == null) { -// throw new IllegalArgumentException("the query cannot be null"); //$NON-NLS-1$ -// } -// -// EClassifier sourceType = query.getSourceType(); -// -// final boolean primitiveType = derivedTypedElement instanceof EAttribute; -// -// if (derivedTypedElement.isMany()) { -// if (evaluator instanceof IDerivedTypedElementCollectionImplementation) { -// IDerivedTypedElementCollectionImplementation collectionEvaluator = -// (IDerivedTypedElementCollectionImplementation) evaluator; -// // List<? extends AbstractDerivedTypedElementResult> listResultList = -// // collectionEvaluator -// // .getValues(derivedTypedElement, eObjects, parameterValues); -// // int index = 0; -// // for (AbstractDerivedTypedElementResult listResult : listResultList) { -// // EList<?> resultList; -// // if (primitiveType && listResult instanceof -// // DerivedTypedElementPrimitiveTypeListResult<?>) { -// // DerivedTypedElementPrimitiveTypeListResult<?> primitiveListResult = -// // (DerivedTypedElementPrimitiveTypeListResult<?>) listResult; -// // resultList = primitiveListResult.getResultList(); -// // } else if (!primitiveType && listResult instanceof -// // DerivedTypedElementEObjectListResult<?>) { -// // DerivedTypedElementEObjectListResult<?> eObjectListResult = -// // (DerivedTypedElementEObjectListResult<?>) listResult; -// // resultList = eObjectListResult.getResultList(); -// // } else { -// // throw new DerivedTypedElementEvaluationException( -// // "Wrong element type at index " + index + " in the result from the evaluator " + collectionEvaluator.getClass().getName()); //$NON-NLS-1$//$NON-NLS-2$ -// // } -// // checkResult(query, resultList, evaluator.getCheckResultType()); -// // index++; -// // } -// // result = listResultList; -// } else { -// -// // List<AbstractDerivedTypedElementResult> listResultList = new -// // ArrayList<AbstractDerivedTypedElementResult>(); -// // for (EObject eObject : eObjects) { -// // AbstractDerivedTypedElementResult listResult; -// // List<?> resultList; -// // if (primitiveType) { -// // DerivedTypedElementPrimitiveTypeListResult<?> primitiveTypeListResult = -// // EFacetFactory.eINSTANCE -// // .createDerivedTypedElementPrimitiveTypeListResult(); -// // listResult = primitiveTypeListResult; -// // resultList = primitiveTypeListResult.getResultList(); -// // } else { -// // DerivedTypedElementEObjectListResult<?> eObjectTypeListResult = -// // EFacetFactory.eINSTANCE -// // .createDerivedTypedElementEObjectListResult(); -// // listResult = eObjectTypeListResult; -// // resultList = eObjectTypeListResult.getResultList(); -// // } -// // -// // Throwable error = null; -// // try { -// // listResult.setSource(eObject); -// // listResult.setDerivedTypedElement(derivedTypedElement); -// // setParameterValues(listResult.getParameterValues(), parameterValues); -// // checkSourceType(sourceType, query, eObject); -// // } catch (Throwable e) { -// // error = e; -// // } -// // if (error != null) { -// // listResult.setException(error); -// // } else { -// // try { -// // Object evaluationResult = evaluator.getValue(derivedTypedElement, eObject, -// // parameterValues); -// // checkResult(query, evaluationResult, evaluator.getCheckResultType()); -// // // checked by checkResult -// // Collection<?> evaluationResultCollection = (Collection<?>) evaluationResult; -// // for (Object object : evaluationResultCollection) { -// // resultList.add(object); -// // } -// // } catch (Throwable e) { -// // listResult.setException(e); -// // } -// // } -// // listResultList.add(listResult); -// // -// // } -// // result = listResultList; -// -// } -// } else { -// // if the evaluator implements multiple evaluation itself, then use it -// if (evaluator instanceof IDerivedTypedElementCollectionImplementation) { -// IDerivedTypedElementCollectionImplementation collectionEvaluator = -// (IDerivedTypedElementCollectionImplementation) evaluator; -// List<? extends AbstractDerivedTypedElementResult> singleResultList = collectionEvaluator -// .getValues(derivedTypedElement, eObjects, parameterValues); -// int index = 0; -// for (AbstractDerivedTypedElementResult singleResult : singleResultList) { -// Object resultElement; -// if (primitiveType && singleResult instanceof DerivedTypedElementPrimitiveTypeResult<?>) { -// DerivedTypedElementPrimitiveTypeResult<?> primitiveResult = -// (DerivedTypedElementPrimitiveTypeResult<?>) singleResult; -// resultElement = primitiveResult.getResult(); -// } else if (!primitiveType && singleResult instanceof DerivedTypedElementEObjectResult<?>) { -// DerivedTypedElementEObjectResult<?> eObjectResult = (DerivedTypedElementEObjectResult<?>) -// singleResult; -// resultElement = eObjectResult.getResult(); -// } else { -// throw new DerivedTypedElementEvaluationException( -// "Wrong element type at index " + index + " in the result from the evaluator " + collectionEvaluator.getClass().getName()); //$NON-NLS-1$//$NON-NLS-2$ -// } -// checkResult(query, result, evaluator.getCheckResultType()); -// index++; -// } -// } else { -// // otherwise, do multiple evaluation by calling the evaluator's -// // single evaluation multiple times -// List<DerivedTypedElementResult<?>> resultList = new -// ArrayList<DerivedTypedElementResult<?>>(); -// for (EObject eObject : eObjects) { -// DerivedTypedElementResult<Object> singleResult = -// EFacetFactory.eINSTANCE.createDerivedTypedElementResult(); -// Throwable error = null; -// try { -// singleResult.setSource(eObject); -// singleResult.setDerivedTypedElement(derivedTypedElement); -// setParameterValues(singleResult.getParameterValues(), parameterValues); -// checkSourceType(sourceType, query, eObject); -// } catch (Throwable e) { -// error = e; -// } -// if (error != null) { -// singleResult.setException(error); -// } else { -// try { -// Object evaluationResult = evaluator.getValue(derivedTypedElement, eObject, parameterValues); -// checkResult(query, evaluationResult, evaluator.getCheckResultType()); -// singleResult.setResult(evaluationResult); -// } catch (Throwable e) { -// singleResult.setException(e); -// } -// } -// resultList.add(singleResult); -// } -// result = resultList; -// } -// } -// -// return result; -// } - -// private static void checkSourceType(final EClassifier sourceType, final Query query, final EObject eObject) -// throws DerivedTypedElementException { -// if (sourceType != null) { -// // a null value for eObject matches any type -// if (eObject != null && !sourceType.isInstance(eObject)) { -// StringBuffer message = new StringBuffer(); -// message.append("Wrong source type (for " + QueryUtils.getQueryDescription(query) + "): '"); //$NON-NLS-1$ //$NON-NLS-2$ -// message.append(eObject.eClass().getName()); -// message.append("' found; expected '"); //$NON-NLS-1$ -// message.append(sourceType.getName()); -// message.append("'."); //$NON-NLS-1$ -// throw new DerivedTypedElementTypeCheckingException(message.toString()); -// } -// } else { -// if (eObject != null) { -// throw new DerivedTypedElementException("the query's sourceType is null and the source is not null"); //$NON-NLS-1$ -// } -// } -// } -// -// private static void setParameterValues(final EList<ParameterValue> target, final List<ParameterValue> parameterValues) { -// if (parameterValues != null) { -// for (ParameterValue parameterValue : parameterValues) { -// if (parameterValue == null) { -// throw new IllegalArgumentException("null parameter value"); //$NON-NLS-1$ -// } -// // containment link -> we need to copy since we can have the same -// // parameter for several results -// target.add(EcoreUtil.copy(parameterValue)); -// } -// } -// } - - private static final void checkResult(final Query query, final Object result, - final boolean checkResultType, final boolean primitive) throws DerivedTypedElementTypeCheckingException { - if (result != null) { - if (QueryUtils.isMany(query)) { - if (!(result instanceof Collection<?>)) { - final String message = String.format( - "A collection is expected as result. The result is an instance of %s (on %s)", //$NON-NLS-1$ - result.getClass().getName(), - QueryUtils.getQueryDescription(query)); - throw new DerivedTypedElementTypeCheckingException(message); - } - if (checkResultType) { - for (Object collectionElement : (Collection<?>) result) { - if (collectionElement != null - && !(QueryUtils.getReturnType(query) - .isInstance(collectionElement))) { - throw new DerivedTypedElementTypeCheckingException( - "Wrong result collection element type: " + collectionElement.getClass().getName() //$NON-NLS-1$ - + "(" + QueryUtils.getReturnType(query).getName() + " is expected) " //$NON-NLS-1$ //$NON-NLS-2$ - + " on " + QueryUtils.getQueryDescription(query)); //$NON-NLS-1$ - } - } - } else if (!primitive) { - // at least check that EObjects are returned - for (Object collectionElement : (Collection<?>) result) { - if (collectionElement != null && !(collectionElement instanceof EObject)) { - throw new DerivedTypedElementTypeCheckingException( - "Wrong result collection element type: " + collectionElement.getClass().getName() //$NON-NLS-1$ - + "(an instance of " + EObject.class.getName() + " is expected) " //$NON-NLS-1$ //$NON-NLS-2$ - + " on " + QueryUtils.getQueryDescription(query)); //$NON-NLS-1$ - } - } - } - } else { - if (result instanceof Collection<?>) { - throw new DerivedTypedElementTypeCheckingException("A " //$NON-NLS-1$ - + QueryUtils.getSourceType(query).getName() - + " instance is expected as result. The result is: " //$NON-NLS-1$ - + result + " (on " + QueryUtils.getQueryDescription(query) + ")"); //$NON-NLS-1$//$NON-NLS-2$ - } - if (checkResultType) { - if (result != null && !(QueryUtils.getReturnType(query).isInstance(result))) { - throw new DerivedTypedElementTypeCheckingException("Wrong result type: " //$NON-NLS-1$ - + result.getClass().getName() - + " is returned while " //$NON-NLS-1$ - + QueryUtils.getReturnType(query).getInstanceClassName() - + " is expected." + " (on " + QueryUtils.getQueryDescription(query) + ")"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ - } - } else if (!primitive) { - // at least check that an EObject is returned - if (result != null && !(result instanceof EObject)) { - throw new DerivedTypedElementTypeCheckingException( - "Wrong result collection element type: " + result.getClass().getName() //$NON-NLS-1$ - + "(an instance of " + EObject.class.getName() + " is expected) " //$NON-NLS-1$ //$NON-NLS-2$ - + " on " + QueryUtils.getQueryDescription(query)); //$NON-NLS-1$ - } - } - } - } - } - - private static boolean isPrimitive(final EClassifier eType) { - final boolean primitiveType; - if (eType instanceof EDataType) { - primitiveType = true; - } else if (eType instanceof EClass) { - primitiveType = false; - } else { - throw new IllegalArgumentException("unhandled derived typed element type: " + eType.getName()); //$NON-NLS-1$ - } - return primitiveType; - } - - /** - * Transform the element in parameter in list (if necessary). - * - * @param element - * the element to transform - * @return a list. - */ - protected static List<Object> setAsList(final Object element) { - List<Object> newList = new LinkedList<Object>(); - if (element instanceof List) { - @SuppressWarnings("unchecked") - //@SuppressWarnings("unchecked") the cast is safe because were - //casting a List to a List<Object> - final List<Object> tmpList = (List<Object>) element; - newList = tmpList; - } else { - newList.add(element); - } - return newList; - } - -}
diff --git a/org.eclipse.modisco.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/internal/DerivedTypedElementUtils.java b/org.eclipse.modisco.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/internal/DerivedTypedElementUtils.java deleted file mode 100644 index 883b191..0000000 --- a/org.eclipse.modisco.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/internal/DerivedTypedElementUtils.java +++ /dev/null
@@ -1,70 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2011 Mia-Software - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Emmanuelle Rouillé (Mia-Software) - Bug 352618 - To be able to use non derived facet structural features and save them values. - * Nicolas Bros (Mia-Software) - Bug 361612 - New core for new version of the Facet metamodel - * Grégoire Dupé (Mia-Software) - Bug 361612 - [Restructuring] New core for new version of the Facet metamodel - * Gregoire Dupe (Mia-Software) - Bug 369987 - [Restructuring][Table] Switch to the new customization and facet framework - * Gregoire Dupe (Mia-Software) - Bug 375087 - [Table] ITableWidget.addColumn(List<ETypedElement>, List<FacetSet>) - *******************************************************************************/ -package org.eclipse.emf.facet.efacet.core.internal; - -import java.util.ArrayList; -import java.util.List; - -import org.eclipse.emf.common.util.EList; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.EOperation; -import org.eclipse.emf.ecore.EParameter; -import org.eclipse.emf.facet.efacet.core.IDerivedTypedElementManager; -import org.eclipse.emf.facet.efacet.core.IFacetManager; -import org.eclipse.emf.facet.efacet.core.exception.DerivedTypedElementException; -import org.eclipse.emf.facet.efacet.core.internal.exception.UnmatchingExpectedTypeException; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.EFacetFactory; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.FacetOperation; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.ParameterValue; - -public final class DerivedTypedElementUtils { - - private DerivedTypedElementUtils() { - // Must not be used - } - - private static <T> List<ParameterValue> createAndCheckOperationParameterValues(final EOperation operation, - final Object... arguments) throws UnmatchingExpectedTypeException { - final EList<EParameter> operationParameters = operation.getEParameters(); - //Begin precondition checking - if (arguments.length > 0 - && operationParameters.size() != arguments.length) { - throw new IllegalArgumentException("Facet operation '" + operation.getName() + //$NON-NLS-1$ - "' expects " + operationParameters.size() + " parameters. Got " + arguments.length); //$NON-NLS-1$ //$NON-NLS-2$ - } - //End precondition checking - final List<ParameterValue> parameterValues = new ArrayList<ParameterValue>(); - for (int i = 0; i < arguments.length; i++) { - final Object argument = arguments[i]; - final EParameter eParameter = operationParameters.get(i); - //Begin precondition checking - EmfUtils.checkAssignment(argument, eParameter); - //End precondition checking - final ParameterValue parameterValue = EFacetFactory.eINSTANCE.createParameterValue(); - parameterValue.setParameter(eParameter); - parameterValue.setValue(argument); - parameterValues.add(parameterValue); - } - return parameterValues; - } - - public static Object evaluate(final EObject eObject, final EOperation operation, final IFacetManager facetManager, final Object... arguments) throws UnmatchingExpectedTypeException, - DerivedTypedElementException { - Object result; - final List<ParameterValue> parameterValues = DerivedTypedElementUtils.createAndCheckOperationParameterValues(operation, arguments); - result = IDerivedTypedElementManager.INSTANCE.evaluate((FacetOperation) operation, eObject, parameterValues, facetManager); - return result; - } -}
diff --git a/org.eclipse.modisco.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/internal/EmfUtils.java b/org.eclipse.modisco.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/internal/EmfUtils.java deleted file mode 100644 index b0a3191..0000000 --- a/org.eclipse.modisco.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/internal/EmfUtils.java +++ /dev/null
@@ -1,105 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2011, 2016 Mia-Software, and Soft-Maint. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Emmanuelle Rouillé (Mia-Software) - Bug 352618 - To be able to use non derived facet structural features and save them values. - * Nicolas Bros (Mia-Software) - Bug 361612 - New core for new version of the Facet metamodel - * Grégoire Dupé (Mia-Software) - Bug 361612 - [Restructuring] New core for new version of the Facet metamodel - * Gregoire Dupe (Mia-Software) - Bug 375087 - [Table] ITableWidget.addColumn(List<ETypedElement>, List<FacetSet>) - * Gregoire Dupe (Mia-Software) - Bug 372626 - Aggregates - * Jonathan Pepin (Soft-Maint) - Bug 510034 - Null value is wrongly casted in a new list - *******************************************************************************/ -package org.eclipse.emf.facet.efacet.core.internal; - -import java.lang.reflect.InvocationTargetException; -import java.util.Collection; -import java.util.List; - -import org.eclipse.emf.common.util.BasicEList; -import org.eclipse.emf.ecore.ENamedElement; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.EOperation; -import org.eclipse.emf.ecore.EStructuralFeature; -import org.eclipse.emf.ecore.ETypedElement; -import org.eclipse.emf.ecore.util.EcoreUtil; -import org.eclipse.emf.facet.efacet.core.internal.exception.UnmatchingExpectedTypeException; - -public final class EmfUtils { - - private EmfUtils() { - //Must not be used - } - - public static void checkAssignment(final Object value, final ETypedElement eTypedElement) - throws UnmatchingExpectedTypeException { - final String typedElementName = getTypeElementDescription(eTypedElement); - //Begin checking precondition - if (eTypedElement.getEType() == null) { - throw new IllegalArgumentException(typedElementName + " has a null type"); //$NON-NLS-1$ - } - //End checking precondition - if (value == null && (eTypedElement.getLowerBound() > 0)) { - throw new IllegalArgumentException( - "The assigned value cannot be null for " + typedElementName + " because multiplicity is " + eTypedElement.getLowerBound() + ".." + eTypedElement.getUpperBound()); //$NON-NLS-1$//$NON-NLS-2$ //$NON-NLS-3$ - } - if (value != null) { - if (eTypedElement.getUpperBound() == 1) { - if (!eTypedElement.getEType().isInstance(value)) { - throw new IllegalArgumentException( - "Type mismatch for " + EcoreUtil.getURI(eTypedElement) + ": expected '" + eTypedElement.getEType().getName() + "' but got '" + value.getClass().getName() + "'."); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - } - } else { // expect a list for multiplicity-many - if (!(value instanceof List<?>)) { - throw new IllegalArgumentException("Type mismatch for " + typedElementName + "': expected a List because the parameter is multiplicity-many. But got a " + //$NON-NLS-1$ //$NON-NLS-2$ - value.getClass().getName() + "'."); //$NON-NLS-1$ - } - final List<?> argumentList = (List<?>) value; - try { - CastUtils.checkTypeOfAllListElements(argumentList, - eTypedElement.getEType().getInstanceClass(), true); - //FIXME What happens if we use a not generated meta-model ? - } catch (UnmatchingExpectedTypeException e) { - throw new UnmatchingExpectedTypeException( - "Type mismatch for an element of the list value " + typedElementName , e); //$NON-NLS-1$ - } - } - } - } - - private static String getTypeElementDescription(final ETypedElement eTypedElement) { - String containerName = ""; //$NON-NLS-1$ - if (eTypedElement.eContainer() instanceof ENamedElement) { - final ENamedElement namedContainer = (ENamedElement) eTypedElement.eContainer(); - containerName = "the " + namedContainer.eClass().getName() + " named '" + namedContainer.getName() + "'"; //$NON-NLS-1$//$NON-NLS-2$ //$NON-NLS-3$ - } - return "the " + eTypedElement.eClass().getName() + " named '" + eTypedElement.getName() + "' in " + containerName; //$NON-NLS-1$//$NON-NLS-2$ //$NON-NLS-3$ - } - - public static Object ecoreInvoke(final EObject eObject, final EOperation operation, final Object... arguments) throws InvocationTargetException { - // delegate to Ecore - final BasicEList<Object> operationParams = new BasicEList<Object>(); - for (Object param : arguments) { - operationParams.add(param); - } - return eObject.eInvoke(operation, operationParams); - } - - public static <T> T checkAssignment(final EStructuralFeature eStructuralFeature, final Class<T> expectedType, final Object value) - throws UnmatchingExpectedTypeException { - if (eStructuralFeature.isMany() && expectedType != null) { - if (expectedType != Object.class - && !Collection.class.isAssignableFrom(expectedType)) { - throw new UnmatchingExpectedTypeException("The required eStructuralFeature is multi-valued, so expectedType must be a subtype of Collection."); //$NON-NLS-1$ - } - if (!expectedType.isInstance(value)) { - throw new UnmatchingExpectedTypeException("The derived typed element did not evaluate to the expected type", Collection.class, value); //$NON-NLS-1$ - } - } - return CastUtils.castToExpectedType(value, expectedType); - } - -}
diff --git a/org.eclipse.modisco.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/internal/FacetActions2Impl.java b/org.eclipse.modisco.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/internal/FacetActions2Impl.java deleted file mode 100644 index 2e41031..0000000 --- a/org.eclipse.modisco.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/internal/FacetActions2Impl.java +++ /dev/null
@@ -1,230 +0,0 @@ -/** - * Copyright (c) 2011 Mia-Software. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Nicolas Guyomar (Mia-Software) - Bug 338813 - [EMF Facet Framework] basic Facet actions - * Nicolas Bros (Mia-Software) - Bug 361612 - New core for new version of the Facet metamodel - * Gregoire Dupe (Mia-Software) - Bug 362087 - [Deprecated] org.eclipse.emf.facet.util.emf.core.ICatalogSetManager - */ -package org.eclipse.emf.facet.efacet.core.internal; - -import java.io.IOException; - -import org.eclipse.core.resources.IFile; -import org.eclipse.emf.common.command.Command; -import org.eclipse.emf.common.util.URI; -import org.eclipse.emf.ecore.EParameter; -import org.eclipse.emf.ecore.EcorePackage; -import org.eclipse.emf.ecore.resource.Resource; -import org.eclipse.emf.ecore.resource.ResourceSet; -import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl; -import org.eclipse.emf.edit.command.AddCommand; -import org.eclipse.emf.edit.command.SetCommand; -import org.eclipse.emf.edit.domain.EditingDomain; -import org.eclipse.emf.facet.efacet.core.internal.incubatingapi.IFacetActions2; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.EFacetPackage; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.Facet; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.FacetAttribute; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.FacetOperation; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.FacetReference; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.FacetSet; -import org.eclipse.emf.facet.util.core.Logger; -import org.eclipse.emf.facet.util.emf.core.ICatalogSetManager2; -import org.eclipse.emf.facet.util.emf.core.exception.InvalidFacetSetException; -import org.eclipse.emf.facet.util.pde.core.internal.exported.BuildPropertiesUtils; - -public class FacetActions2Impl implements IFacetActions2 { - - public void saveFacetSet(final FacetSet facetSet, final IFile file) throws IOException, - InvalidFacetSetException { - if (facetSet == null) { - throw new IllegalArgumentException("The given FacetSet cannot be null"); //$NON-NLS-1$ - } - if (file == null) { - throw new IllegalArgumentException("The given IFile cannot be null"); //$NON-NLS-1$ - } - if (file.exists()) { - throw new IllegalArgumentException("The given IFile already exists"); //$NON-NLS-1$ - } - - // Create a resource set - ResourceSet resourceSet = new ResourceSetImpl(); - - // Get the URI of the model file. - URI fileURI = URI.createPlatformResourceURI(file.getFullPath().toString(), true); - - // Create a resource for this file. - Resource resource = resourceSet.createResource(fileURI); - - // Add the facetSet the resource contents. - resource.getContents().add(facetSet); - - // Save the contents of the resource to the file system. - resource.save(null); - - try { - BuildPropertiesUtils.addToBuild(file); - } catch (Exception e) { - Logger.logError(e, "Error adding file " + file.getFullPath() //$NON-NLS-1$ - + " to the build.properties", Activator.getDefault()); //$NON-NLS-1$ - } - } - - public Facet createFacetInFacetSet(final FacetSet facetSet, final Facet facet, - final EditingDomain editingDomain) { - Command command = createCreateFacetInFacetSetCommand(facetSet, facet, editingDomain); - // If the current editingDomain's resourceSet does not contain the facetSet resource, then - // we need to add it so that we can edit the facetSet - if (!editingDomain.getResourceSet().getResources().contains(facetSet.eResource())) { - editingDomain.getResourceSet().getResources().add(facetSet.eResource()); - } - editingDomain.getCommandStack().execute(command); - return facet; - } - - public Command createCreateFacetInFacetSetCommand(final FacetSet facetSet, final Facet facet, - final EditingDomain editingDomain) { - if (facetSet == null) { - throw new IllegalArgumentException("The given FacetSet cannot be null"); //$NON-NLS-1$ - } - if (facet == null) { - throw new IllegalArgumentException("The given Facet cannot be null"); //$NON-NLS-1$ - } - if (facet.eResource() != null || facet.eContainer() != null) { - throw new IllegalArgumentException("The given Facet cannot be contained by a resource"); //$NON-NLS-1$ - } - if (editingDomain == null) { - throw new IllegalArgumentException("The given EditingDomain cannot be null"); //$NON-NLS-1$ - } - - return AddCommand.create(editingDomain, facetSet, - EcorePackage.eINSTANCE.getEPackage_EClassifiers(), facet); - } - - public void addAttributeInFacet(final Facet facet, final FacetAttribute facetAttribute, - final EditingDomain editingDomain) { - Command command = createAddAttributeInFacetCommand(facet, facetAttribute, editingDomain); - editingDomain.getCommandStack().execute(command); - } - - public Command createAddAttributeInFacetCommand(final Facet facet, - final FacetAttribute facetAttribute, final EditingDomain editingDomain) { - if (facet == null) { - throw new IllegalArgumentException("The given Facet cannot be null"); //$NON-NLS-1$ - } - if (facetAttribute == null) { - throw new IllegalArgumentException("The given FacetAttribute cannot be null"); //$NON-NLS-1$ - } - if (facetAttribute.eResource() != null || facetAttribute.eContainer() != null) { - throw new IllegalArgumentException( - "The given FacetAttribute cannot be contained by a resource"); //$NON-NLS-1$ - } - if (editingDomain == null) { - throw new IllegalArgumentException("The given EditingDomain cannot be null"); //$NON-NLS-1$ - } - - return AddCommand.create(editingDomain, facet, - EFacetPackage.eINSTANCE.getFacet_FacetElements(), facetAttribute); - } - - public void addReferenceInFacet(final Facet facet, final FacetReference facetReference, - final EditingDomain editingDomain) { - Command command = createAddReferenceInFacetCommand(facet, facetReference, editingDomain); - editingDomain.getCommandStack().execute(command); - } - - public Command createAddReferenceInFacetCommand(final Facet facet, - final FacetReference facetReference, final EditingDomain editingDomain) { - if (facet == null) { - throw new IllegalArgumentException("The given Facet cannot be null."); //$NON-NLS-1$ - } - if (facetReference == null) { - throw new IllegalArgumentException("The given FacetReference cannot be null"); //$NON-NLS-1$ - } - if (facetReference.eResource() != null || facetReference.eContainer() != null) { - throw new IllegalArgumentException( - "The given FacetReference cannot be contained by a resource"); //$NON-NLS-1$ - } - if (editingDomain == null) { - throw new IllegalArgumentException("The given EditingDomain cannot be null."); //$NON-NLS-1$ - } - - return AddCommand.create(editingDomain, facet, - EFacetPackage.eINSTANCE.getFacet_FacetElements(), facetReference); - } - - public void addOperationInFacet(final Facet facet, final FacetOperation facetOperation, - final EditingDomain editingDomain) { - Command command = createAddOperationInFacetCommand(facet, facetOperation, editingDomain); - editingDomain.getCommandStack().execute(command); - } - - public Command createAddOperationInFacetCommand(final Facet facet, - final FacetOperation facetOperation, final EditingDomain editingDomain) { - if (editingDomain == null) { - throw new IllegalArgumentException("The given EditingDomain cannot be null"); //$NON-NLS-1$ - } - if (facetOperation == null) { - throw new IllegalArgumentException("The given FacetOperation cannot be null"); //$NON-NLS-1$ - } - if (facetOperation.eResource() != null || facetOperation.eContainer() != null) { - throw new IllegalArgumentException( - "The given FacetOperation cannot be contained by a resource"); //$NON-NLS-1$ - } - if (facet == null) { - throw new IllegalArgumentException("The given Facet cannot be null"); //$NON-NLS-1$ - } - - return AddCommand.create(editingDomain, facet, - EFacetPackage.eINSTANCE.getFacet_FacetOperations(), facetOperation); - } - - public void addParameterInOperation(final FacetOperation operation, final EParameter parameter, - final EditingDomain editingDomain) { - Command command = createAddParameterInOperationCommand(operation, parameter, editingDomain); - editingDomain.getCommandStack().execute(command); - } - - public Command createAddParameterInOperationCommand(final FacetOperation operation, - final EParameter parameter, final EditingDomain editingDomain) { - if (operation == null) { - throw new IllegalArgumentException("The given FacetOperation cannot be null"); //$NON-NLS-1$ - } - if (parameter == null) { - throw new IllegalArgumentException("The given EParameter cannot be null"); //$NON-NLS-1$ - } - if (parameter.eResource() != null || parameter.eContainer() != null) { - throw new IllegalArgumentException( - "The given EParameter cannot be contained by a resource"); //$NON-NLS-1$ - } - if (editingDomain == null) { - throw new IllegalArgumentException("The given EditingDomain cannot be null"); //$NON-NLS-1$ - } - - return AddCommand.create(editingDomain, operation, - EcorePackage.eINSTANCE.getEOperation_EParameters(), parameter); - } - - public void setFacetSetNsUri(final FacetSet facetSet, final String nsUri, - final EditingDomain editingDomain) { - Command command = createSetFacetSetNsUriCommand(facetSet, nsUri, editingDomain); - editingDomain.getCommandStack().execute(command); - } - - public Command createSetFacetSetNsUriCommand(final FacetSet facetSet, final String nsUri, - final EditingDomain editingDomain) { - if (editingDomain == null) { - throw new IllegalArgumentException("The given EditingDomain cannot be null"); //$NON-NLS-1$ - } - if (facetSet == null) { - throw new IllegalArgumentException("The given FacetSet cannot be null"); //$NON-NLS-1$ - } - return SetCommand.create(editingDomain, facetSet, - EcorePackage.eINSTANCE.getEPackage_NsURI(), nsUri); - } -}
diff --git a/org.eclipse.modisco.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/internal/FacetActionsImpl.java b/org.eclipse.modisco.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/internal/FacetActionsImpl.java deleted file mode 100644 index cf6a4bb..0000000 --- a/org.eclipse.modisco.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/internal/FacetActionsImpl.java +++ /dev/null
@@ -1,78 +0,0 @@ -/** - * Copyright (c) 2012 Mia-Software. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Alban Ménager (Soft-Maint) - Bug 387470 - [EFacet][Custom] Editors - */ -package org.eclipse.emf.facet.efacet.core.internal; - -import java.io.IOException; - -import org.eclipse.core.resources.IFile; -import org.eclipse.emf.common.util.URI; -import org.eclipse.emf.ecore.resource.Resource; -import org.eclipse.emf.ecore.resource.ResourceSet; -import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl; -import org.eclipse.emf.facet.efacet.core.IFacetActions; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.FacetSet; -import org.eclipse.emf.facet.util.core.Logger; -import org.eclipse.emf.facet.util.core.internal.Activator; -import org.eclipse.emf.facet.util.emf.core.ICatalogSetManager2; -import org.eclipse.emf.facet.util.emf.core.ICatalogSetManagerFactory; -import org.eclipse.emf.facet.util.emf.core.exception.InvalidFacetSetException; -import org.eclipse.emf.facet.util.pde.core.internal.exported.BuildPropertiesUtils; - -/** - * Concrete implementation of {@link IFacetActions}. - */ -public class FacetActionsImpl implements IFacetActions { - - public void saveFacetSet(final FacetSet facetSet, final IFile file) - throws IOException, InvalidFacetSetException { - if (facetSet == null) { - throw new IllegalArgumentException( - "The given FacetSet cannot be null"); //$NON-NLS-1$ - } - if (file == null) { - throw new IllegalArgumentException("The given IFile cannot be null"); //$NON-NLS-1$ - } - if (file.exists()) { - throw new IllegalArgumentException("The given IFile already exists"); //$NON-NLS-1$ - } - - // Create a resource set - final ResourceSet resourceSet = new ResourceSetImpl(); - - // Get the URI of the model file. - final URI fileURI = URI.createPlatformResourceURI(file.getFullPath() - .toString(), true); - - // Create a resource for this file. - final Resource resource = resourceSet.createResource(fileURI); - - // Add the facetSet the resource contents. - resource.getContents().add(facetSet); - - // Save the contents of the resource to the file system. - resource.save(null); - - try { - BuildPropertiesUtils.addToBuild(file); - } catch (final Exception e) { - Logger.logError(e, "Error adding file " + file.getFullPath() //$NON-NLS-1$ - + " to the build.properties", Activator.getDefault()); //$NON-NLS-1$ - } - - final ICatalogSetManager2 catalogSetManager = ICatalogSetManagerFactory.DEFAULT - .createICatalogSetManager(resourceSet); - catalogSetManager.registerModelDeclaration(file); - - // ICatalogSetManager.INSTANCE.registerModelDeclaration(file); - } - -}
diff --git a/org.eclipse.modisco.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/internal/FacetCatalogManagerFactory.java b/org.eclipse.modisco.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/internal/FacetCatalogManagerFactory.java deleted file mode 100644 index 56ea541..0000000 --- a/org.eclipse.modisco.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/internal/FacetCatalogManagerFactory.java +++ /dev/null
@@ -1,28 +0,0 @@ -/** - * Copyright (c) 2012, 2015 Mia-Software. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Grégoire Dupé (Mia-Software) - Bug 369987 - [Restructuring][Table] Switch to the new customization and facet - * Grégoire Dupé (Mia-Software) - Bug 373078 - API Cleaning - * Grégoire Dupé (Mia-Software) - Bug 477657 - The catalog manager should be able to manage workspace model - */ -package org.eclipse.emf.facet.efacet.core.internal; - -import org.eclipse.emf.ecore.resource.ResourceSet; -import org.eclipse.emf.facet.efacet.core.IFacetSetCatalogManager; -import org.eclipse.emf.facet.efacet.core.IFacetSetCatalogManagerFactory; -import org.eclipse.emf.facet.efacet.core.internal.catalog.EFacetCatalogManager2; - -public class FacetCatalogManagerFactory implements IFacetSetCatalogManagerFactory { - - public IFacetSetCatalogManager getOrCreateFacetSetCatalogManager( - final ResourceSet resourceSet) { - return new EFacetCatalogManager2(resourceSet); - } - -}
diff --git a/org.eclipse.modisco.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/internal/FacetCommandFactoryFactory.java b/org.eclipse.modisco.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/internal/FacetCommandFactoryFactory.java deleted file mode 100644 index 1e59839..0000000 --- a/org.eclipse.modisco.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/internal/FacetCommandFactoryFactory.java +++ /dev/null
@@ -1,25 +0,0 @@ -/** - * Copyright (c) 2012 Mia-Software. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Grégoire Dupé (Mia-Software) - Bug 387470 - [EFacet][Custom] Editors - */ -package org.eclipse.emf.facet.efacet.core.internal; - -import org.eclipse.emf.edit.domain.EditingDomain; -import org.eclipse.emf.facet.efacet.core.IFacetCommandFactoryFactory; -import org.eclipse.emf.facet.efacet.core.IFacetCommandFactory; - -public class FacetCommandFactoryFactory implements IFacetCommandFactoryFactory { - - public IFacetCommandFactory createCommandFactory( - final EditingDomain editingDomain) { - return new FacetCommandFactoryImpl(editingDomain); - } - -}
diff --git a/org.eclipse.modisco.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/internal/FacetCommandFactoryImpl.java b/org.eclipse.modisco.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/internal/FacetCommandFactoryImpl.java deleted file mode 100644 index 9a428f7..0000000 --- a/org.eclipse.modisco.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/internal/FacetCommandFactoryImpl.java +++ /dev/null
@@ -1,511 +0,0 @@ -/** - * Copyright (c) 2012 Mia-Software. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Alban Ménager (Soft-Maint) - Bug 387470 - [EFacet][Custom] Editors - * Grégoire Dupé (Mia-Software) - Bug 387470 - [EFacet][Custom] Editors - */ -package org.eclipse.emf.facet.efacet.core.internal; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; - -import org.eclipse.emf.common.command.Command; -import org.eclipse.emf.common.command.CompoundCommand; -import org.eclipse.emf.ecore.EAttribute; -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.ecore.EClassifier; -import org.eclipse.emf.ecore.ENamedElement; -import org.eclipse.emf.ecore.EParameter; -import org.eclipse.emf.ecore.EStructuralFeature; -import org.eclipse.emf.ecore.ETypedElement; -import org.eclipse.emf.ecore.EcorePackage; -import org.eclipse.emf.edit.command.AddCommand; -import org.eclipse.emf.edit.command.SetCommand; -import org.eclipse.emf.edit.domain.EditingDomain; -import org.eclipse.emf.facet.efacet.core.IFacetCommandFactory; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.DerivedTypedElement; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.EFacetPackage; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.Facet; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.FacetAttribute; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.FacetOperation; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.FacetReference; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.FacetSet; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.extensible.Query; -import org.eclipse.emf.facet.util.emf.core.command.EmfCommandUtils; - -/** - * Concrete implementation of {@link IFacetCommandFactory}. - */ -public class FacetCommandFactoryImpl implements IFacetCommandFactory { - - private static final String VALUE_NOT_NULL = "The given value cannot be null"; //$NON-NLS-1$ - private static final String PARENT_NOT_NULL = "The given parent cannot be null"; //$NON-NLS-1$ - private static final Object NAME = "name"; //$NON-NLS-1$ - private static final Object LOWER_BOUND = "lowerBound"; //$NON-NLS-1$ - private static final Object UPPER_BOUND = "upperBound"; //$NON-NLS-1$ - private static final Object VOLATILE = "volatile"; //$NON-NLS-1$ - private static final Object CHANGEABLE = "changeable"; //$NON-NLS-1$ - private static final Object DERIVED = "derived"; //$NON-NLS-1$ - private static final Object TRANSIENT = "transient"; //$NON-NLS-1$ - private static final Object ORDERED = "ordered"; //$NON-NLS-1$ - private static final Object UNIQUE = "unique"; //$NON-NLS-1$ - private final EditingDomain editingDomain; - - public FacetCommandFactoryImpl(final EditingDomain editingDomain) { - this.editingDomain = editingDomain; - } - - /** - * Create an {@link AddCommand} to add the element to the owner. - * - * @param owner - * the owner. - * @param element - * the element to add. - * @return the command. - */ - private Command createAddCommand(final Object owner, final Object element) { - - if (owner == null) { - throw new IllegalArgumentException("The given owner cannot be null"); //$NON-NLS-1$ - } - - if (element == null) { - throw new IllegalArgumentException( - "The given element cannot be null"); //$NON-NLS-1$ - } - - return AddCommand.create(this.editingDomain, owner, - getEStructuralFeature(element), element); - } - - /** - * Create an {@link SetCommand} to add the element to the owner. - * - * @param initialObject - * the owner. - * @param newObject - * the element to add. - * @return the command. - */ - public Command createSetCommand(final Object initialObject, - final Object feature, final Object newValue) { - - if (initialObject == null) { - throw new IllegalArgumentException("The given owner cannot be null"); //$NON-NLS-1$ - } - - if (feature == null) { - throw new IllegalArgumentException( - "The given feature cannot be null"); //$NON-NLS-1$ - } - - if (newValue == null) { - throw new IllegalArgumentException( - "The given newValue cannot be null"); //$NON-NLS-1$ - } - - return SetCommand.create(this.editingDomain, initialObject, feature, - newValue); - } - - /** - * Return the {@link EStructuralFeature} for a given element. - * - * @param element - * the element. - * @return the eStructuralFeature for the element. - */ - private static EStructuralFeature getEStructuralFeature(final Object element) { - EStructuralFeature result = null; - if (element instanceof FacetSet) { - result = EcorePackage.eINSTANCE.getEPackage_ESubpackages(); - } else if (element instanceof Facet) { - result = EcorePackage.eINSTANCE.getEPackage_EClassifiers(); - } else if ((element instanceof FacetAttribute) - || (element instanceof FacetReference)) { - result = EFacetPackage.eINSTANCE.getFacet_FacetElements(); - } else if (element instanceof FacetOperation) { - result = EFacetPackage.eINSTANCE.getFacet_FacetOperations(); - } - return result; - - } - - public Command createFacetSetInFacetSetCommand(final FacetSet owner, - final FacetSet facetSet) { - return createAddCommand(owner, facetSet); - } - - public Command createFacetInFacetSetCommand(final FacetSet parent, - final Facet facet) { - return createAddCommand(parent, facet); - } - - public Command createEditFacetStructuralFeatureCommand( - final DerivedTypedElement feature, final Facet container, - final String name, final int lowerBound, final int upperBound, - final EClassifier type, final boolean ordered, - final boolean unique, final Query query, final boolean volatilee, - final boolean change, final boolean derived, - final boolean transientt) { - if (feature == null) { - throw new IllegalArgumentException( - "The parameter facetOperation must not be null"); //$NON-NLS-1$ - } - final List<Command> commands = new ArrayList<Command>(); - if (feature.eContainer() != container) { - final Command command = new AddCommand(this.editingDomain, - container, - EFacetPackage.eINSTANCE.getFacet_FacetElements(), feature); - commands.add(command); - } - if (feature instanceof EStructuralFeature) { - final EStructuralFeature structuralFeature = (EStructuralFeature) feature; - if (structuralFeature.isVolatile() != volatilee) { - final Command command = new SetCommand(this.editingDomain, - structuralFeature, - EcorePackage.eINSTANCE.getEStructuralFeature_Volatile(), - Boolean.valueOf(volatilee)); - commands.add(command); - } - if (structuralFeature.isChangeable() != change) { - final Command command = new SetCommand(this.editingDomain, - structuralFeature, - EcorePackage.eINSTANCE - .getEStructuralFeature_Changeable(), - Boolean.valueOf(change)); - commands.add(command); - } - if (structuralFeature.isDerived() != derived) { - final Command command = new SetCommand(this.editingDomain, - structuralFeature, - EcorePackage.eINSTANCE.getEStructuralFeature_Derived(), - Boolean.valueOf(ordered)); - commands.add(command); - } - if (structuralFeature.isTransient() != transientt) { - final Command command = new SetCommand(this.editingDomain, - structuralFeature, - EcorePackage.eINSTANCE - .getEStructuralFeature_Transient(), - Boolean.valueOf(unique)); - commands.add(command); - } - } - commands.add(createEditDerivedTypeElementCommand(feature, - name, lowerBound, upperBound, type, ordered, unique, query)); - return EmfCommandUtils.createResult(commands, - "edit facet structural feature"); //$NON-NLS-1$ - } - - public Command createAddOperationInFacetCommand(final Facet parent, - final FacetOperation facetOperation) { - return createAddCommand(parent, facetOperation); - } - - public Command createAddReferenceInFacetCommand(final Facet parent, - final FacetReference facetReference) { - return createAddCommand(parent, facetReference); - } - - public Command createAddParameterInOperationCommand( - final FacetOperation parent, final EParameter opParameter) { - return createAddCommand(parent, opParameter); - } - - public Command createChangeOwnerCommand(final Object element, - final Object newOwner) { - if (element == null) { - throw new IllegalArgumentException( - "The given element cannot be null"); //$NON-NLS-1$ - } - if (newOwner == null) { - throw new IllegalArgumentException( - "The given element cannot be null"); //$NON-NLS-1$ - } - return createAddCommand(newOwner, element); - } - - public Command createEditFacetSetCommand(final FacetSet editedFacetSet, - final FacetSet container, final String name) { - if (editedFacetSet == null) { - throw new IllegalArgumentException( - "The parameter 'editedFacetSet' must not be null"); //$NON-NLS-1$ - } - final List<Command> commands = new ArrayList<Command>(); - commands.add(createEditENamedElementcommand(editedFacetSet, name)); - if (editedFacetSet.eContainer() != container) { - final Command command = new AddCommand(this.editingDomain, - container, - EcorePackage.eINSTANCE.getEPackage_ESubpackages(), - editedFacetSet); - commands.add(command); - } - return EmfCommandUtils.createResult(commands, "Edit FacetSet"); //$NON-NLS-1$ - } - - public Command createEditFacetCommand(final Facet facet, - final FacetSet container, final String name, - final ETypedElement conformance, final EClass extendMetaclass, - final FacetSet extendedFacetSet) { - final List<Command> commands = new ArrayList<Command>(); - commands.add(createEditENamedElementcommand(facet, name)); - if (facet.eContainer() != container) { - final Command command = new AddCommand(this.editingDomain, - container, - EcorePackage.eINSTANCE.getEPackage_EClassifiers(), facet); - commands.add(command); - } - if (facet.getConformanceTypedElement() != conformance) { - final Command command = new SetCommand(this.editingDomain, facet, - EFacetPackage.eINSTANCE.getFacet_ConformanceTypedElement(), - conformance); - commands.add(command); - } - if (extendedFacetSet != null - && (facet.getExtendedFacets().isEmpty() || facet - .getExtendedFacets().get(0) != extendedFacetSet)) { - final Command command = new SetCommand(this.editingDomain, - facet, - EFacetPackage.eINSTANCE.getFacet_ExtendedFacets(), - Collections.singletonList(extendedFacetSet)); - commands.add(command); - } - if (facet.getExtendedMetaclass() != extendMetaclass) { - final Command command = new SetCommand(this.editingDomain, facet, - EFacetPackage.eINSTANCE.getFacet_ExtendedMetaclass(), - extendMetaclass); - commands.add(command); - } - return EmfCommandUtils.createResult(commands, "Edit Facet"); //$NON-NLS-1$ - } - - private Command createEditENamedElementcommand( - final ENamedElement namedElement, final String name) { - if (namedElement == null) { - throw new IllegalArgumentException( - "The parameter 'editedFacetSet' must not be null"); //$NON-NLS-1$ - } - final List<Command> commands = new ArrayList<Command>(); - if (namedElement.getName() != name) { - final Command command = new SetCommand(this.editingDomain, - namedElement, - EcorePackage.eINSTANCE.getENamedElement_Name(), name); - commands.add(command); - } - return EmfCommandUtils.createResult(commands, "Edit NamedElement"); //$NON-NLS-1$ - } - - public Command createSetFacetAttributeCommand(final Facet initialContainer, - final FacetAttribute initialElement, final FacetAttribute newElement) { - if (initialElement == null) { - throw new IllegalArgumentException(PARENT_NOT_NULL); - } - if (newElement == null) { - throw new IllegalArgumentException(VALUE_NOT_NULL); - } - final CompoundCommand commands = new CompoundCommand(); - final List<EAttribute> facetAttributes = EFacetPackage.eINSTANCE - .getFacetAttribute().getEAllAttributes(); - setEStructuralFeatureAttributes(initialElement, newElement, commands, - facetAttributes); - setETypedElementAttributes(initialElement, newElement, commands, - facetAttributes); - final Command changeOwner = createChangeOwnerCommand(newElement, - initialContainer); - commands.append(changeOwner); - return commands; - } - - public Command createSetFacetReferenceCommand(final Facet initialContainer, - final FacetReference initialElement, final FacetReference newElement) { - if (initialElement == null) { - throw new IllegalArgumentException(PARENT_NOT_NULL); - } - if (newElement == null) { - throw new IllegalArgumentException(VALUE_NOT_NULL); - } - final CompoundCommand commands = new CompoundCommand(); - final List<EAttribute> facetReferences = EFacetPackage.eINSTANCE - .getFacetReference().getEAllAttributes(); - setEStructuralFeatureAttributes(initialElement, newElement, commands, - facetReferences); - setETypedElementAttributes(initialElement, newElement, commands, - facetReferences); - final Command changeOwner = createChangeOwnerCommand(newElement, initialContainer); - commands.append(changeOwner); - return commands; - } - - public Command createEditFacetOperationCommand( - final FacetOperation facetOperation, final Facet container, - final String name, final int lowerBound, final int upperBound, - final EClassifier type, final boolean ordered, - final boolean unique, final Query query) { - if (facetOperation == null) { - throw new IllegalArgumentException( - "The parameter facetOperation must not be null"); //$NON-NLS-1$ - } - final List<Command> commands = new ArrayList<Command>(); - if (facetOperation.eContainer() != container) { - final Command command = new AddCommand(this.editingDomain, - container, - EFacetPackage.eINSTANCE.getFacet_FacetOperations(), - facetOperation); - commands.add(command); - } - commands.add(createEditDerivedTypeElementCommand(facetOperation, name, - lowerBound, upperBound, type, ordered, unique, query)); - return EmfCommandUtils.createResult(commands, "Edit facet operation"); //$NON-NLS-1$ - } - - private Command createEditDerivedTypeElementCommand( - final DerivedTypedElement dte, final String name, - final int lowerBound, final int upperBound, final EClassifier type, - final boolean ordered, final boolean unique, final Query query) { - if (dte == null) { - throw new IllegalArgumentException( - "The parameter facetOperation must not be null"); //$NON-NLS-1$ - } - final List<Command> commands = new ArrayList<Command>(); - commands.add(createEditETypedElementCommand(dte, name, lowerBound, - upperBound, type, ordered, unique)); - if (dte.getQuery() != query) { - final Command command = new SetCommand(this.editingDomain, dte, - EFacetPackage.eINSTANCE.getDerivedTypedElement_Query(), - query); - commands.add(command); - } - return EmfCommandUtils.createResult(commands, - "Edit derived typed element"); //$NON-NLS-1$ - } - - private Command createEditETypedElementCommand( - final ETypedElement typedElement, final String name, - final int lowerBound, final int upperBound, final EClassifier type, - final boolean ordered, final boolean unique) { - final List<Command> commands = new ArrayList<Command>(); - commands.add(createEditENamedElementcommand(typedElement, name)); - if (typedElement.getLowerBound() != lowerBound) { - final Command command = new SetCommand(this.editingDomain, - typedElement, - EcorePackage.eINSTANCE.getETypedElement_LowerBound(), - Integer.valueOf(lowerBound)); - commands.add(command); - } - if (typedElement.getUpperBound() != upperBound) { - final Command command = new SetCommand(this.editingDomain, - typedElement, - EcorePackage.eINSTANCE.getETypedElement_LowerBound(), - Integer.valueOf(upperBound)); - commands.add(command); - } - if (typedElement.isOrdered() != ordered) { - final Command command = new SetCommand(this.editingDomain, - typedElement, - EcorePackage.eINSTANCE.getETypedElement_Ordered(), - Boolean.valueOf(ordered)); - commands.add(command); - } - if (typedElement.isUnique() != unique) { - final Command command = new SetCommand(this.editingDomain, - typedElement, - EcorePackage.eINSTANCE.getETypedElement_Ordered(), - Boolean.valueOf(unique)); - commands.add(command); - } - if (typedElement.getEType() != type) { - final Command command = new SetCommand(this.editingDomain, - typedElement, - EcorePackage.eINSTANCE.getETypedElement_EType(), type); - commands.add(command); - } - return EmfCommandUtils.createResult(commands, "Edit ETypedElement"); //$NON-NLS-1$ - } - - public Command createEditOperationParameterCommand( - final EParameter parameter, final FacetOperation facetOperation, - final String name, final int lowerBound, final int upperBound, - final EClassifier type, final boolean ordered, final boolean unique) { - if (parameter == null) { - throw new IllegalArgumentException( - "The parameter parameter must not be null"); //$NON-NLS-1$ - } - final List<Command> commands = new ArrayList<Command>(); - commands.add(createEditETypedElementCommand(parameter, name, - lowerBound, upperBound, type, ordered, unique)); - return EmfCommandUtils.createResult(commands, - "Edit operation parameter"); //$NON-NLS-1$ - } - - private void setEStructuralFeatureAttributes( - final EStructuralFeature initialElement, - final EStructuralFeature newElement, - final CompoundCommand commands, - final List<EAttribute> facetOperations) { - for (final EAttribute attribute : facetOperations) { - if (attribute.getName().equals(TRANSIENT)) { - commands.append(createSetCommand(initialElement, attribute, - Boolean.valueOf(newElement.isTransient()))); - } - if (attribute.getName().equals(VOLATILE)) { - commands.append(createSetCommand(initialElement, attribute, - Boolean.valueOf(newElement.isVolatile()))); - } - if (attribute.getName().equals(CHANGEABLE)) { - commands.append(createSetCommand(initialElement, attribute, - Boolean.valueOf(newElement.isChangeable()))); - } - if (attribute.getName().equals(DERIVED)) { - commands.append(createSetCommand(initialElement, attribute, - Boolean.valueOf(newElement.isDerived()))); - } - } - } - - private void setETypedElementAttributes(final ETypedElement initialElement, - final ETypedElement newElement, final CompoundCommand commands, - final List<EAttribute> facetOperations) { - for (final EAttribute attribute : facetOperations) { - if (attribute.getName().equals(NAME)) { - commands.append(createSetCommand(initialElement, attribute, - newElement.getName())); - } - if (attribute.getName().equals(LOWER_BOUND)) { - commands.append(createSetCommand(initialElement, attribute, - Integer.valueOf(newElement.getLowerBound()))); - } - if (attribute.getName().equals(UPPER_BOUND)) { - commands.append(createSetCommand(initialElement, attribute, - Integer.valueOf(newElement.getUpperBound()))); - } - if (attribute.getName().equals(ORDERED)) { - commands.append(createSetCommand(initialElement, attribute, - Boolean.valueOf(newElement.isOrdered()))); - } - if (attribute.getName().equals(UNIQUE)) { - commands.append(createSetCommand(initialElement, attribute, - Boolean.valueOf(newElement.isUnique()))); - } - } - } - - - public Command createEditFacetOperationCommand( - final DerivedTypedElement dte, final Facet facetContainer, - final String name, final int lowerBound, final int upperBound, - final EClassifier type, final boolean ordered, - final boolean unique, final Query query) { - // TODO Auto-generated method stub - return null; - } - -}
diff --git a/org.eclipse.modisco.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/internal/FacetManager.java b/org.eclipse.modisco.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/internal/FacetManager.java deleted file mode 100644 index 5925f34..0000000 --- a/org.eclipse.modisco.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/internal/FacetManager.java +++ /dev/null
@@ -1,788 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2011, 2016 Mia-Software, and Soft-Maint. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Emmanuelle Rouillé (Mia-Software) - Bug 352618 - To be able to use non derived facet structural features and save them values. - * Nicolas Bros (Mia-Software) - Bug 361612 - New core for new version of the Facet metamodel - * Grégoire Dupé (Mia-Software) - Bug 361612 - [Restructuring] New core for new version of the Facet metamodel* - * Olivier Remaud (Soft-Maint) - Bug 361794 - [Restructuring] EMF Facet customization meta-model - * Gregoire Dupe (Mia-Software) - Bug 361794 - [Restructuring] New customization meta-model - * Gregoire Dupe (Mia-Software) - Bug 369987 - [Restructuring][Table] Switch to the new customization and facet framework - * Gregoire Dupe (Mia-Software) - Bug 364325 - [Restructuring] The user must be able to navigate into a model using the Facet. - * Olivier Remaud (Mia-Software) - Bug 374348 - Infinite loop in Facet override resolution - * Gregoire Dupe (Mia-Software) - Bug 373078 - API Cleaning - * Gregoire Dupe (Mia-Software) - Bug 376576 - [EFacet] Change the multiplicity of Facet::extendedFacet - * Nicolas Bros (Mia-Software) - Bug 378475 - unit test failures after table refactoring - * Thomas Cicognani (Soft-Maint) - Bug 416221 - New methods to get references in FacetManager API - * Thomas Cicognani (Soft-Maint) - Bug 420193 - Listener on FacetManager - * Gregoire Dupe (Mia-Software) - Bug 443682 - Access to the super facet - * Jonathan Pepin (Soft-Maint) - Bug 463898 - Create FacetReference not derived, without query and with opposite mechanism - * Jonathan Pepin (Soft-Maint) - Bug 463907 - Command for load and save Facet serialization - * Jonathan Pepin (Soft-Maint) - Bug 464069 - Applying facet inferred from attribute and reference instances contained in facet serialisation model - * Grégoire Dupé (Mia-Software) - Bug 464069 - Applying facet inferred from attribute and reference instances contained in facet serialisation model - * Jonathan Pepin (Soft-Maint) - Bug 473217 - On SerializationManager getMultiValuedStructuralFeature create ExtendedEObjectReference despite empty instances - * Jonathan Pepin (Soft-Maint) - Bug 473673 - Applying facet inferred from fopposite reference - * Grégoire Dupé (Mia-Software) - Bug 476141 - Facet manger can fail with ConcurrentModificationException - * Jonathan Pepin (Soft-Maint) - Bug 510034 - Null value is wrongly casted in a new list - * Jonathan Pepin (Soft-Maint) - Bug 510039 - Facet references many-to-one and one-to-many are not managed - *******************************************************************************/ -package org.eclipse.emf.facet.efacet.core.internal; - -import java.lang.reflect.InvocationTargetException; -import java.util.ArrayList; -import java.util.Collection; -import java.util.HashSet; -import java.util.LinkedList; -import java.util.List; -import java.util.Set; -import java.util.concurrent.CopyOnWriteArrayList; - -import org.eclipse.emf.common.notify.Adapter; -import org.eclipse.emf.common.notify.Notification; -import org.eclipse.emf.common.notify.Notifier; -import org.eclipse.emf.common.util.EList; -import org.eclipse.emf.ecore.EAttribute; -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.ecore.EClassifier; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.EOperation; -import org.eclipse.emf.ecore.EPackage; -import org.eclipse.emf.ecore.EReference; -import org.eclipse.emf.ecore.EStructuralFeature; -import org.eclipse.emf.ecore.ETypedElement; -import org.eclipse.emf.ecore.EcorePackage; -import org.eclipse.emf.ecore.resource.Resource; -import org.eclipse.emf.ecore.resource.ResourceSet; -import org.eclipse.emf.edit.domain.EditingDomain; -import org.eclipse.emf.facet.efacet.core.FacetUtils; -import org.eclipse.emf.facet.efacet.core.IDerivedTypedElementManager; -import org.eclipse.emf.facet.efacet.core.IFacetManager; -import org.eclipse.emf.facet.efacet.core.IFacetManagerListener; -import org.eclipse.emf.facet.efacet.core.exception.DerivedTypedElementException; -import org.eclipse.emf.facet.efacet.core.exception.FacetManagerException; -import org.eclipse.emf.facet.efacet.core.exception.SuperInvokeException; -import org.eclipse.emf.facet.efacet.core.internal.exception.FacetConformanceEvaluationException; -import org.eclipse.emf.facet.efacet.core.internal.exception.UnmatchingExpectedTypeException; -import org.eclipse.emf.facet.efacet.core.internal.serialization.SerializationManager; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.DerivedTypedElement; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.Facet; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.FacetAttribute; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.FacetOperation; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.FacetReference; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.FacetSet; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.ParameterValue; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.runtime.ETypedElementEObjectListResult; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.runtime.ETypedElementEObjectResult; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.runtime.ETypedElementPrimitiveTypeListResult; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.runtime.ETypedElementPrimitiveTypeResult; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.runtime.ETypedElementResult; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.runtime.RuntimeFactory; -import org.eclipse.emf.facet.util.core.Logger; - -public class FacetManager implements IFacetManager, Adapter { - - private static final EClassifier EBOOLEAN = EcorePackage.eINSTANCE.getEBoolean(); - private static final EClassifier EBOOLEAN_OBJECT = EcorePackage.eINSTANCE.getEBooleanObject(); - private final FacetManagerContext context; - private final SerializationManager serializationMgr; - private final ResourceSet resourceSet; - private final List<IFacetManagerListener> listeners = new CopyOnWriteArrayList<IFacetManagerListener>(); - - public FacetManager(final Resource resource) { - this.context = new FacetManagerContext(this); - this.serializationMgr = new SerializationManager(resource, this); - this.resourceSet = resource.getResourceSet(); - } - - public FacetManager(final ResourceSet resourceSet) { - this.context = new FacetManagerContext(this); - this.serializationMgr = new SerializationManager(null, this); - this.resourceSet = resourceSet; - } - - public void saveStructuralFeatureInstanceModel() - throws FacetManagerException { - this.serializationMgr.saveStructuralFeatureInstanceModel(); - } - - /** - * Returns whether the given model element conforms to the given Facet - * - * @param eObject - * the model element - * @param facet - * the Facet the applicability of which is being tested - * @return whether the given model element should be seen as an instance of the given Facet - */ - public boolean isConforming(final EObject eObject, final Facet facet) - throws FacetManagerException { - return getConformanceState(eObject, facet) == FacetManager.ConformanceState.Conformant; - } - - public enum ConformanceState { - Conformant, NonConformingMetaclass, NonConformingElement - } - - private void checkConformance(final EObject eObject, final Facet facet) - throws FacetManagerException { - final ConformanceState conformanceState = getConformanceState(eObject, facet); - if (conformanceState == FacetManager.ConformanceState.NonConformingMetaclass) { - throw new FacetManagerException("NonApplicableFacetException"); //$NON-NLS-1$ - } - if (conformanceState == FacetManager.ConformanceState.NonConformingElement) { - throw new FacetManagerException("NonConformingEObjectException"); //$NON-NLS-1$ - } - } - - protected ConformanceState getConformanceState(final EObject eObject, - final Facet facet) throws FacetManagerException { - // Begin of precondition section - if (eObject == null) { - throw new IllegalArgumentException("eObject cannot be null"); //$NON-NLS-1$ - } - if (facet == null) { - throw new IllegalArgumentException("facet cannot be null"); //$NON-NLS-1$ - } - // End of precondition section - ConformanceState result; - final EClass extendedMetaclass = FacetUtils.getExtendedMetaclass(facet); - if (extendedMetaclass != null - && (extendedMetaclass.isSuperTypeOf(eObject.eClass()) || extendedMetaclass == EcorePackage.eINSTANCE.getEObject())) { - final ETypedElement typeElement = facet.getConformanceTypedElement(); - if (typeElement == null) { - result = FacetManager.ConformanceState.Conformant; - } else { - final Boolean isConforming = getConformanceValue(eObject, typeElement); - if (isConforming.booleanValue()) { - result = FacetManager.ConformanceState.Conformant; - } else { - result = FacetManager.ConformanceState.NonConformingElement; - } - } - } else { - result = FacetManager.ConformanceState.NonConformingMetaclass; - } - // The conformance constraint is inherited from the super facet. - if (result == FacetManager.ConformanceState.Conformant) { - for (Facet extFacet : facet.getExtendedFacets()) { - result = getConformanceState(eObject, extFacet); - if (result != FacetManager.ConformanceState.Conformant) { - break; - } - } - } - return result; - } - - private Boolean getConformanceValue(final EObject eObject, - final ETypedElement typeElement) throws FacetManagerException { - // Begin precondition checking - if (typeElement.isMany()) { - throw new FacetManagerException( - "The Facet's conformance typed element must not be multi-valued"); //$NON-NLS-1$ - } - if (typeElement.getEType() != FacetManager.EBOOLEAN && typeElement.getEType() != FacetManager.EBOOLEAN_OBJECT) { - throw new FacetManagerException( - "The Facet conformance typed element evaluated to a wrong type."); //$NON-NLS-1$ - } - // End precondition checking - Boolean result; // conformance typedElement Value - try { - if (typeElement instanceof EStructuralFeature) { - final EStructuralFeature structuralFeature = (EStructuralFeature) typeElement; - // basicGet = true in order to avoid an infinite recursion - result = internalGet(eObject, structuralFeature, Boolean.class, true); - } else if (typeElement instanceof EOperation) { - final EOperation operation = (EOperation) typeElement; - if (operation.getEParameters().size() > 0) { - throw new FacetConformanceEvaluationException("The Facet's conformance operation cannot have parameters"); //$NON-NLS-1$ - } - // basicInvoke = true in order to avoid an infinite recursion, - // ie don't check conformance and don't resolve overrides - result = internalInvoke(eObject, operation, Boolean.class, true); - } else { - throw new FacetConformanceEvaluationException("Unsupported conformance typed element type: " + typeElement.getClass().getName()); //$NON-NLS-1$ - } - } catch (Exception e) { - throw new FacetManagerException(e); - } - if (result == null) { - throw new FacetManagerException( - "The Facet conformance typed element evaluated to null"); //$NON-NLS-1$ - } - return result; - } - - public void set(final EObject eObject, - final EStructuralFeature structuralFeature, final Object newValue, - final EditingDomain editingDomain) throws FacetManagerException { - if (structuralFeature.isMany() && !(newValue instanceof Collection<?>)) { - throw new IllegalArgumentException("newValue should be a Collection because eStructuralFeature is an EReference"); //$NON-NLS-1$ - // TODO: check the type of the elements of the list. - } - final EObject eContainer = structuralFeature.eContainer(); - if (eContainer instanceof Facet) { - final Facet facet = (Facet) eContainer; - checkConformance(eObject, facet); - if (structuralFeature instanceof EAttribute) { - final EAttribute eAttribute = (EAttribute) structuralFeature; - setAttribute(eObject, eAttribute, newValue); - } else if (structuralFeature instanceof EReference) { - final EReference eReference = (EReference) structuralFeature; - setReference(eObject, eReference, newValue); - } else { - final String message = String.format( - "Setting a structural feature of type '%s' is not implemented", //$NON-NLS-1$ - structuralFeature.getClass().getName()); - throw new UnsupportedOperationException(message); - } - } else { - eObject.eSet(structuralFeature, newValue); - } - } - - private void setReference(final EObject eObject, - final EReference eReference, final Object newValue) - throws FacetManagerException { - // Begin precondition - if (eReference.isDerived()) { - if (eReference instanceof FacetReference) { - /* - * TODO We still have to implement the setting of a - * derived facet attribute. Cf. - * https://bugs.eclipse.org/bugs/show_bug.cgi?id=365726 - */ - throw new UnsupportedOperationException( - "Setting a FacetReference is not yet implemented"); //$NON-NLS-1$ - } - throw new IllegalStateException( - "A eReference owned by a Facet must be derived"); //$NON-NLS-1$ - } - // End precondition - manageFOpposite(eObject, newValue, eReference); - this.serializationMgr.setReference(eObject, eReference, newValue); - } - - private void manageFOpposite(final EObject eObject, final Object newValue, - final EReference eReference) throws FacetManagerException { - if (eReference instanceof FacetReference) { - final FacetReference facetReference = (FacetReference) eReference; - final FacetReference fOpposite = facetReference.getFOpposite(); - if (fOpposite != null) { - FacetManagerInternalUtils.loadParentFacetSet(fOpposite, this); - if (newValue instanceof List<?>) { - @SuppressWarnings("unchecked") - final List<EObject> newList = (List<EObject>) newValue; - manageManyFOpposite(eObject, newList, eReference, - fOpposite); - } else if (newValue instanceof EObject) { - final EObject newEObject = (EObject) newValue; - manageOneFOpposite(eObject, newEObject, eReference, fOpposite); - } - } - } - } - - /** - * manage many to one, and one to one - */ - private void manageOneFOpposite(final EObject eObject, - final EObject newObj, final EReference eReference, - final FacetReference fOpposite) throws FacetManagerException { - // prepare old reference - final EObject oldObj = get(eObject, eReference, EObject.class); - // many to one - if (fOpposite.isMany()) { - // Delete old only opposite references - if (oldObj != null) { - removeReferenceToExisting(oldObj, fOpposite, eObject); - } - // Create new only opposite references - addReferenceToExisting(newObj, fOpposite, eObject); - } else { // one to one - if (oldObj != null) { - // Delete old reference - this.serializationMgr.clearReference(oldObj, eReference); - // Delete old opposite reference - this.serializationMgr.clearReference(oldObj, fOpposite); - } - // Create opposite reference - this.serializationMgr.setReference(newObj, fOpposite, eObject); - - } - } - - /** - * manage many to many, and one to many - */ - private void manageManyFOpposite(final EObject eObject, - final List<EObject> newList, final EReference eReference, - final FacetReference fOpposite) throws FacetManagerException { - // prepare old references, difference between old and new values - final List<EObject> oldList = getMultiValued(eObject, eReference, - EObject.class); - if (!oldList.isEmpty()) { - oldList.removeAll(newList); - } - // many to many - if (fOpposite.isMany()) { - // Delete old only opposite references - for (final EObject oldObj : oldList) { - removeReferenceToExisting(oldObj, fOpposite, eObject); - } - // Create new only opposite references - for (final EObject newObj : newList) { - addReferenceToExisting(newObj, fOpposite, eObject); - } - } else { // one to many - // Delete old opposite references - for (final EObject oldObj : oldList) { - this.serializationMgr.clearReference(oldObj, fOpposite); - } - // For new values - for (final EObject newObj : newList) { - final EObject oldOppObj = get(newObj, fOpposite, EObject.class); - // Delete old reference - if (oldOppObj != null) { - this.removeReferenceToExisting(oldOppObj, eReference, newObj); - } - // Create opposite reference - this.serializationMgr.setReference(newObj, fOpposite, eObject); - } - } - } - - /** - * add new to existing references - */ - private void addReferenceToExisting(final EObject newObj, - final EReference eReference, final EObject eObject) - throws FacetManagerException { - final List<EObject> existingList = this.getMultiValued(newObj, - eReference, EObject.class); - // performance of collection created with initial size is better - final List<EObject> newList = new ArrayList<EObject>( - existingList.size() + 1); - newList.addAll(existingList); - newList.add(eObject); - this.serializationMgr.setReference(newObj, eReference, newList); - } - - /** - * remove old from existing references - */ - private void removeReferenceToExisting(final EObject oldObj, - final EReference eReference, final EObject eObject) - throws FacetManagerException { - final List<EObject> existingList = getMultiValued(oldObj, eReference, - EObject.class); - // performance of collection created with initial size is better - final List<EObject> newList = new ArrayList<EObject>( - existingList.size()); - newList.addAll(existingList); - newList.remove(eObject); - this.serializationMgr.setReference(oldObj, eReference, newList); - } - - private void setAttribute(final EObject eObject, - final EAttribute eAttribute, final Object newValue) { - // Begin precondition - if (eAttribute.isDerived()) { - if (eAttribute instanceof FacetAttribute) { - /* - * TODO We still have to implement the setting of a - * derived facet attribute. Cf. - * https://bugs.eclipse.org/bugs/show_bug.cgi?id=365726 - */ - throw new UnsupportedOperationException( - "Setting a FacetAttribute is not yet implemented"); //$NON-NLS-1$ - } - throw new IllegalStateException( - "A eAttribute owned by a Facet must be derived"); //$NON-NLS-1$ - } - // End precondition - this.serializationMgr.setAttribute(eObject, eAttribute, newValue); - } - - public <T> T get(final EObject eObject, - final EStructuralFeature structuralFeature, - final Class<T> expectedType) throws FacetManagerException { - return internalGet(eObject, structuralFeature, expectedType, false); - } - - private <T> T internalGet(final EObject eObject, - final EStructuralFeature structuralFeature, - final Class<T> expectedType, final boolean basicGet) - throws FacetManagerException { - try { - Object value; - if (structuralFeature.eContainer() instanceof Facet) { - - EStructuralFeature baseFeature = structuralFeature; - - if (!basicGet) { - baseFeature = this.context.resolveOverrides(structuralFeature, eObject); - final Facet facet = (Facet) baseFeature.eContainer(); - checkConformance(eObject, facet); - } - if (baseFeature.isDerived()) { - if (!(baseFeature instanceof DerivedTypedElement)) { - throw new UnsupportedOperationException("Cannot evaluate a derived structural feature that is not a DerivedTypedElement : not implemented"); //$NON-NLS-1$ - } - value = IDerivedTypedElementManager.INSTANCE.evaluate((DerivedTypedElement) baseFeature, eObject, null, this); - } else { - value = SerializationManager.getNotDerivedValue(eObject, - baseFeature); - } - } else { // Regular structural feature - if (structuralFeature instanceof DerivedTypedElement) { - throw new IllegalStateException("The given DerivedTypedElement is not contained in a Facet"); //$NON-NLS-1$ - } - value = eObject.eGet(structuralFeature, true); - } - return EmfUtils.checkAssignment(structuralFeature, expectedType, value); - } catch (Exception e) { - throw new FacetManagerException(e); - } - } - - public <T> List<T> getMultiValued(final EObject eObject, - final EStructuralFeature structuralFeature, - final Class<T> expectedType) throws FacetManagerException { - final Object result = internalGet(eObject, structuralFeature, null, false); - // return the original list, which must be modifiable by the caller - try { - return CastUtils.castToExpectedListType(result, expectedType, - !(structuralFeature instanceof EReference)); - } catch (UnmatchingExpectedTypeException e) { - throw new UnmatchingExpectedTypeException("Failed to cast the value of '" + structuralFeature.getName() + "' to a list of " + expectedType.getName(), e); //$NON-NLS-1$//$NON-NLS-2$ - } - } - - public <T> T invoke(final EObject eObject, final EOperation operation, - final Class<T> expectedType, final EditingDomain editingDomain, final Object... arguments) - throws FacetManagerException { - try { - return internalInvoke(eObject, operation, expectedType, false, arguments); - } catch (Exception e) { - throw new FacetManagerException("Error invoking Facet operation '" + operation.getName() + "'", e); //$NON-NLS-1$ //$NON-NLS-2$ - } - } - - public <T> List<T> invokeMultiValued(final EObject eObject, final EOperation operation, - final Class<T> expectedType, final Object... arguments) - throws FacetManagerException { - Object result; - try { - result = internalInvoke(eObject, operation, null, false, arguments); - } catch (Exception e) { - throw new FacetManagerException("Error invoking Facet operation '" + operation.getName() + "'", e); //$NON-NLS-1$ //$NON-NLS-2$ - } - return CastUtils.castToExpectedListType(result, expectedType, true); - } - - private <T> T internalInvoke(final EObject eObject, final EOperation operation, final Class<T> expectedType, - final boolean basicInvoke, final Object... arguments) - throws DerivedTypedElementException, InvocationTargetException, - FacetManagerException { - Object result; - if (operation.eContainer() instanceof Facet) { - final Facet facet = (Facet) operation.eContainer(); - - if (!basicInvoke) { - checkConformance(eObject, facet); - } - if (operation instanceof FacetOperation) { - final FacetOperation facetOperation = (FacetOperation) operation; - FacetOperation baseOperation = facetOperation; - if (!basicInvoke) { - baseOperation = this.context.resolveOverrides(facetOperation, eObject); - } - result = DerivedTypedElementUtils.evaluate(eObject, baseOperation, this, arguments); - } else { - result = EmfUtils.ecoreInvoke(eObject, operation, null, arguments); - } - } else { // Regular eOperation - if (operation instanceof FacetOperation) { - throw new IllegalStateException("The given FacetOperation is not contained in a Facet"); //$NON-NLS-1$ - } - result = EmfUtils.ecoreInvoke(eObject, operation, null, arguments); - } - return CastUtils.castToExpectedType(result, expectedType); - } - - public List<ETypedElementResult> get(final Collection<EObject> eObjects, final EStructuralFeature structuralFeature) { - // TODO Auto-generated method stub - throw new UnsupportedOperationException("not implemented yet"); //$NON-NLS-1$ - } - - public List<ETypedElementResult> batchInvoke( - final Collection<EObject> eObjects, final EOperation operation, - final Object... arguments) throws FacetManagerException { - // TODO Auto-generated method stub - throw new UnsupportedOperationException("not implemented yet"); //$NON-NLS-1$ - } - - public List<FacetSet> getManagedFacetSets() { - return this.context; - } - - public void setManagedFacetSets(final List<FacetSet> facetSets) { - this.context.setManagedFacetSets(facetSets); - } - - public void removeFacetSet(final FacetSet facetSet) { - this.context.removeFacetSet(facetSet); - } - - public ResourceSet getResourceSet() { - return this.resourceSet; - } - - public List<ETypedElement> getAppliedFeatures() { - // TODO Auto-generated method stub - throw new UnsupportedOperationException("not implemented yet"); //$NON-NLS-1$ - } - - public Set<EAttribute> getAttributes(final EObject eObject) - throws FacetManagerException { - return getEStructuralFeatures(eObject, EAttribute.class); - } - - public Set<EStructuralFeature> getStructuralFeature(final EObject eObject) - throws FacetManagerException { - return getEStructuralFeatures(eObject, EStructuralFeature.class); - } - - public <T extends ETypedElement> Set<T> getEStructuralFeatures( - final EObject eObject, final Class<T> classs) - throws FacetManagerException { - final Set<T> result = new HashSet<T>(); - for (FacetSet facetSet : this.context.getManagedFacetSets()) { - result.addAll(getETypedElements(eObject, facetSet, classs)); - } - return result; - } - - private <T extends ETypedElement> Collection<T> getETypedElements( - final EObject eObject, final FacetSet facetSet, - final Class<T> classs) throws FacetManagerException { - final Set<T> result = new HashSet<T>(); - for (EClassifier eClassifier : facetSet.getEClassifiers()) { - if (eClassifier instanceof Facet) { - final Facet facet = (Facet) eClassifier; - if (isConforming(eObject, facet)) { - for (EStructuralFeature eStructuralFeature : getAllEStructuralFeatures(facet)) { - if (classs.isInstance(eStructuralFeature)) { - @SuppressWarnings("unchecked") - // @SuppressWarnings("unchecked") This type has been - // checked using isInstance - final T typedSF = (T) eStructuralFeature; - result.add(typedSF); - } - } - } - } - } - // hierarchical FacetSets - for (EPackage ePackage : facetSet.getESubpackages()) { - if (ePackage instanceof FacetSet) { - final FacetSet subFacetSet = (FacetSet) ePackage; - result.addAll(getETypedElements(eObject, - subFacetSet, classs)); - } - } - // aggregates - for (FacetSet subFacetSet : facetSet.getFacetSets()) { - result.addAll(getETypedElements(eObject, subFacetSet, classs)); - } - return result; - } - - private List<EStructuralFeature> getAllEStructuralFeatures(final Facet facet) { - final List<EStructuralFeature> structFeatures = new LinkedList<EStructuralFeature>(); - structFeatures.addAll(facet.getFacetElements()); - for (Facet extFacet : facet.getExtendedFacets()) { - structFeatures.addAll(getAllEStructuralFeatures(extFacet)); - } - return structFeatures; - } - - public Set<EReference> getReferences(final EObject eObject) - throws FacetManagerException { - return getEStructuralFeatures(eObject, EReference.class); - } - - public Collection<? extends EStructuralFeature> getSF(final EObject eObject) - throws FacetManagerException { - return getEStructuralFeatures(eObject, EStructuralFeature.class); - } - - @Deprecated - public void addFacets(final EList<Facet> facets) { - for (Facet facetToLoad : facets) { - this.context.addFrontManagedFacetSet((FacetSet) facetToLoad - .getEPackage()); - } - } - - @Deprecated - public void unLoadAllFacets() { - removeAllManagedFacetSets(); - } - - public void removeAllManagedFacetSets() { - this.context.clear(); - } - - public <T> List<T> getOrInvokeMultiValued(final EObject eObject, - final ETypedElement eTypedElement, final Class<T> classs) - throws FacetManagerException { - List<T> result = null; - if (eTypedElement instanceof EStructuralFeature) { - final EStructuralFeature structuralFeature = (EStructuralFeature) eTypedElement; - result = getMultiValued(eObject, structuralFeature, classs); - } else if (eTypedElement instanceof EOperation) { - final EOperation eOperation = (EOperation) eTypedElement; - result = invokeMultiValued(eObject, eOperation, classs); - } - return result; - } - - public <T> T getOrInvoke(final EObject eObject, - final ETypedElement eTypedElement, final Class<T> classs) - throws FacetManagerException { - T result = null; - if (eTypedElement instanceof EStructuralFeature) { - final EStructuralFeature structuralFeature = (EStructuralFeature) eTypedElement; - result = get(eObject, structuralFeature, classs); - } else if (eTypedElement instanceof EOperation) { - final EOperation eOperation = (EOperation) eTypedElement; - result = invoke(eObject, eOperation, classs, null); - } - return result; - } - - public List<Facet> getManagedFacets() { - throw new IllegalStateException("Not implemented, and never will since it's deprecated"); //$NON-NLS-1$ - } - - public <T> List<ETypedElementResult> batchGetOrInvoke(final Collection<EObject> sources, final ETypedElement query, final Class<T> classs) - throws FacetManagerException { - final List<ETypedElementResult> results = new LinkedList<ETypedElementResult>(); - for (EObject source : sources) { - ETypedElementResult result = null; - Exception exception = null; - if (query.getEType() instanceof EClass) { - if (query.getUpperBound() == 1) { - final ETypedElementEObjectResult<EObject> eObjectResult = RuntimeFactory.eINSTANCE.createETypedElementEObjectResult(); - try { - eObjectResult.setResult(this.getOrInvoke(source, query, EObject.class)); - } catch (Exception e) { - exception = e; - } - result = eObjectResult; - } else { - final ETypedElementEObjectListResult<EObject> eObjectResultList = RuntimeFactory.eINSTANCE.createETypedElementEObjectListResult(); - try { - eObjectResultList.getResultList().addAll(this.getOrInvokeMultiValued(source, query, EObject.class)); - } catch (Exception e) { - exception = e; - } - result = eObjectResultList; - } - } else { - if (query.getUpperBound() == 1) { - final ETypedElementPrimitiveTypeResult<Object> eObjectResult = RuntimeFactory.eINSTANCE.createETypedElementPrimitiveTypeResult(); - try { - eObjectResult.setResult(this.getOrInvoke(source, query, Collection.class)); - } catch (Exception e) { - exception = e; - } - result = eObjectResult; - } else { - final ETypedElementPrimitiveTypeListResult<Object> eObjectResultList = RuntimeFactory.eINSTANCE.createETypedElementPrimitiveTypeListResult(); - eObjectResultList.getResultList().addAll(this.getOrInvokeMultiValued(source, query, Object.class)); - result = eObjectResultList; - } - } - if (exception != null) { - result.setException(exception); - Logger.logWarning(exception, Activator.getDefault()); - } - result.setDerivedTypedElement(query); - result.setSource(source); - results.add(result); - } - return results; - } - - public void addBackManagedFacetSet(final FacetSet facetSet) { - this.context.addBackManagedFacetSet(facetSet); - } - - public void addFrontManagedFacetSet(final FacetSet facetSet) { - this.context.addFrontManagedFacetSet(facetSet); - } - - public void notifyChanged(final Notification notification) { - // Nothing to do - } - - public Notifier getTarget() { - return null; - } - - public void setTarget(final Notifier newTarget) { - // Nothing to do - } - - public boolean isAdapterForType(final Object type) { - return false; - } - - public void addListener(final IFacetManagerListener listener) { - this.context.addListener(listener); - } - - public void removeListener(final IFacetManagerListener listener) { - this.context.removeListener(listener); - } - - public <T> T getSuperValueOf(final DerivedTypedElement derivedTypedElt, - final EObject source, final List<ParameterValue> parameterValues, - final Class<T> expectedType) throws SuperInvokeException, FacetManagerException { - Object result; - final DerivedTypedElement superDTE = this.context.getSuperOf( - derivedTypedElt, source); - if (superDTE == null) { - throw new SuperInvokeException("No super operation available."); //$NON-NLS-1$ - } - try { - result = IDerivedTypedElementManager.INSTANCE.evaluate(superDTE, - source, parameterValues, this); - } catch (DerivedTypedElementException e) { - throw new FacetManagerException(e); - } - return CastUtils.castToExpectedType(result, expectedType); - } - - public Resource getSerializationResource() { - return this.serializationMgr.getSerializationResource(); - } - - public void setSerializationResource(final Resource resource) { - this.serializationMgr.setSerializationResource(resource); - notifyListeners(); - } - - private void notifyListeners() { - for (IFacetManagerListener listener : this.listeners) { - listener.facetManagerChanged(); - } - } -}
diff --git a/org.eclipse.modisco.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/internal/FacetManagerContext.java b/org.eclipse.modisco.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/internal/FacetManagerContext.java deleted file mode 100644 index c9e13d5..0000000 --- a/org.eclipse.modisco.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/internal/FacetManagerContext.java +++ /dev/null
@@ -1,610 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2011, 2015 Mia-Software. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Olivier Remaud (Soft-Maint) - Bug 361794 - [Restructuring] EMF Facet customization meta-model - * Gregoire Dupe (Mia-Software) - Bug 364325 - [Restructuring] The user must be able to navigate into a model using the Facet. - * Gregoire Dupe (Mia-Software) - Bug 361794 - [Restructuring] EMF Facet customization meta-model - * Gregoire Dupe (Mia-Software) - Bug 373078 - API Cleaning - * Gregoire Dupe (Mia-Software) - Bug 375087 - [Table] ITableWidget.addColumn(List<ETypedElement>, List<FacetSet>) - * Gregoire Dupe (Mia-Software) - Bug 372626 - Aggregates - * Gregoire Dupe (Mia-Software) - Bug 377178 - [EFacet] infinite recursion in override resolution - * Gregoire Dupe (Mia-software) - Bug 383418 - [Table] FacetManagerContext.getOverrideCandidateFeatures(...) is empty - * Gregoire Dupe (Mia-software) - Bug 420093 - [EFacet] The facetManger list doesn't deal with uniqueness - * Thomas Cicognani (Soft-Maint) - Bug 420193 - Listener on FacetManager - * Fabien Treguer (Soft-Maint) - Bug 423285 - [Table] FacetSets not stored in a resource cause model manager crashes - * Gregoire Dupe (Mia-Software) - Bug 443682 - Access to the super facet - * Grégoire Dupé (Mia-Software) - Bug 476141 - Facet manger can fail with ConcurrentModificationException - *******************************************************************************/ - -package org.eclipse.emf.facet.efacet.core.internal; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.Collections; -import java.util.HashSet; -import java.util.Iterator; -import java.util.LinkedList; -import java.util.List; -import java.util.ListIterator; -import java.util.Set; - -import org.eclipse.emf.common.util.EList; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.EOperation; -import org.eclipse.emf.ecore.ETypedElement; -import org.eclipse.emf.ecore.resource.Resource; -import org.eclipse.emf.ecore.resource.ResourceSet; -import org.eclipse.emf.ecore.util.EcoreUtil; -import org.eclipse.emf.facet.efacet.core.FacetUtils; -import org.eclipse.emf.facet.efacet.core.IFacetManagerListener; -import org.eclipse.emf.facet.efacet.core.exception.FacetManagerException; -import org.eclipse.emf.facet.efacet.core.internal.FacetManager.ConformanceState; -import org.eclipse.emf.facet.efacet.core.internal.exception.UnmatchingExpectedTypeException; -import org.eclipse.emf.facet.efacet.core.internal.exported.IResolverManager; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.DerivedTypedElement; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.Facet; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.FacetSet; -import org.eclipse.emf.facet.util.core.DebugUtils; -import org.eclipse.emf.facet.util.core.Logger; -import org.eclipse.emf.facet.util.core.internal.exported.ListUtils; -import org.eclipse.emf.facet.util.emf.core.ModelUtils; - -/** - * @author oremaud - * - * FacetManager Context - * - * Defines which FacetSets will be taken into account, and in which - * order ('front' FacetSets have higher precedence) - * - * Responsible of overrides resolution for Facets and Customs - */ -class FacetManagerContext implements List<FacetSet> { - - private static final String SILENT_OPTION = "org.eclipse.emf.facet.efacet.core.internal.FacetManagerContext.getOverrideCandidateFeatures.silent"; //$NON-NLS-1$ - private static final boolean SILENT = Boolean - .getBoolean(FacetManagerContext.SILENT_OPTION); - private static final boolean DEBUG = DebugUtils.getDebugStatus(Activator.getDefault()); - - // We cannot use the interface (i.e, List) instead because we need to use - // the methods addLast and addFirst - private LinkedList<FacetSet> managedFacetSets = new LinkedList<FacetSet>(); // NOPMD by gdupe on 15/03/12 10:36 - private final transient FacetManager manager; - /** - * This field is used to avoid to have to many error messages in the log. - */ - private final Set<ETypedElement> failingFeatures = new HashSet<ETypedElement>(); - - private final Set<IFacetManagerListener> listeners = new HashSet<IFacetManagerListener>(); - - public FacetManagerContext(final FacetManager manager) { - this.manager = manager; - } - - /** - * - * @param baseFeature - * @param eObject - * @return - * @throws FacetConformanceEvaluationException - * @throws UnmatchingExpectedTypeException - * @throws FacetManagerException - */ - public <T extends ETypedElement> T resolveOverrides(final T baseFeature, - final EObject eObject) throws FacetManagerException { - T result = baseFeature; - if (baseFeature instanceof DerivedTypedElement) { - final DerivedTypedElement derivedResult = resolveOverrides( - (DerivedTypedElement) baseFeature, eObject); - if (derivedResult != null - && !(derivedResult instanceof ETypedElement)) { - throw new UnmatchingExpectedTypeException( - "Type mismatch in override resolution '" + baseFeature.getName() + "'"); //$NON-NLS-1$ //$NON-NLS-2$ - } - result = (T) derivedResult; - } - // If nothing is found, return the original basefeature - if (result == null) { - result = baseFeature; - } - return result; - } - - /** - * - * @param baseFeature - * @param eObject - * @return - * @throws FacetConformanceEvaluationException - * @throws FacetManagerException - */ - public <T extends DerivedTypedElement> T resolveOverrides( - final T baseFeature, final EObject eObject) - throws FacetManagerException { - try { - // -- Find master override - // If the baseFeature overrides another feature, then we follow the - // override chain to find the top feature - // The main idea behind this is that the baseFeature does not really - // represents a specific feature but a - // feature signature (as in java method invocation) - final T signatureFeature = FacetUtils - .getTopOverrideFeature(baseFeature); - - // -- Find all candidates - // Get all Facet referenced by the FacetManager to get all features - // matching this signature - // Note : candidates are searched ine the order provided by the current - // FacetManager, - // so they are already ordered by the wanted priority - // XXX : Debug check that DerivedTypedElement only contained by Facet - final List<T> orderedCandidates = getOverrideCandidateFeatures(eObject, - signatureFeature); - - // -- Find the most specific feature - return findMostSpecificFeature(orderedCandidates); - } catch (Exception e) { - throw new FacetManagerException(e); - } - } - - public <T extends DerivedTypedElement> T getSuperOf( - final T currentFeature, final EObject eObject) - throws FacetManagerException { - try { - // -- Find master override - // If the baseFeature overrides another feature, then we follow the - // override chain to find the top feature - // The main idea behind this is that the baseFeature does not really - // represents a specific feature but a - // feature signature (as in java method invocation) - final T signatureFeature = FacetUtils.getTopOverrideFeature(currentFeature); - // -- Find all candidates - // Get all Facet referenced by the FacetManager to get all features - // matching this signature - // Note : candidates are searched ine the order provided by the current - // FacetManager, - // so they are already ordered by the wanted priority - // XXX : Debug check that DerivedTypedElement only contained by Facet - final List<T> orderedCandidates = getOverrideCandidateFeatures(eObject, - signatureFeature); - // -- Find the most specific feature - final int mostSpecificIndex = orderedCandidates.indexOf(currentFeature); - if (mostSpecificIndex == -1) { - throw new IllegalStateException("\"currentFeature\" must exists in \"orderedCandidates\""); //$NON-NLS-1$ - } - final int lastIndex = orderedCandidates.size() - 1; - T result = null; - if (mostSpecificIndex != lastIndex) { - final int superIndex = mostSpecificIndex + 1; - // -- Find the most specific feature - result = orderedCandidates.get(superIndex); - } - return result; - } catch (Exception e) { - throw new FacetManagerException(e); - } - } - - public List<FacetSet> getManagedFacetSets() { - return Collections.unmodifiableList( - new ArrayList<FacetSet>(this.managedFacetSets) - ); - } - - public void setManagedFacetSets(final List<FacetSet> facetSets) { - this.managedFacetSets = new LinkedList<FacetSet>(facetSets); - notifyListeners(); - } - - public void addBackManagedFacetSet(final FacetSet facetSet) { - // adding an already managed FacetSet again moves it to the right position - this.managedFacetSets.remove(facetSet); - this.managedFacetSets.addLast(facetSet); - notifyListeners(); - } - - public void addFrontManagedFacetSet(final FacetSet facetSet) { - if (this.managedFacetSets == null) { - this.managedFacetSets = new LinkedList<FacetSet>(); - } - // adding an already managed FacetSet again moves it to the right position - this.managedFacetSets.remove(facetSet); - this.managedFacetSets.addFirst(facetSet); - notifyListeners(); - } - - /** - * Find the most specific feature in the candidates list. The most specific - * is the feature that : - is the most specific (in terms of Facet - * inheritance) : the lowest in the inheritance tree (per branch) - is - * encountered first. The order is given by the FacetManager context. - * - * @param candidates - * The list of candidates features. Can be empty. - * @return - */ - private static <T extends DerivedTypedElement> T findMostSpecificFeature( - final List<T> orderedCandidates) { - T result = null; - if (!orderedCandidates.isEmpty()) { - final Iterator<T> candidatesIt = orderedCandidates.iterator(); - result = candidatesIt.next(); - // We have the highest priority feature, we just have to check - // that there is no more specific one in the override chain (from - // top to bottom) - while (candidatesIt.hasNext()) { - final T candidate = candidatesIt.next(); - if (isOverridenBy(candidate, result)) { - result = candidate; - } - } - } - return result; - } - - /** - * Find matching candidates. - * - * @param eObject - * @param baseFeature - * @return A list of candidates, in the right order for conflict resolution - * @throws FacetManagerException - */ - private <T extends DerivedTypedElement> List<T> getOverrideCandidateFeatures( - final EObject eObject, final T baseFeature) - throws FacetManagerException { - final ResourceSet baserFeatureRS = baseFeature.eResource().getResourceSet(); - final List<T> result = new LinkedList<T>(); - // Iterate over all Facets from all facetSets to find conforming - // features - final List<FacetSet> managedFSets = getManagedFacetSets(); - final List<FacetSet> allFacetSets = new ArrayList<FacetSet>(managedFSets); - // add aggregated FacetSets - for (FacetSet facetSet : managedFSets) { - //FIXME Should handle recursive containment. - for (FacetSet subFacetSet : facetSet.getFacetSets()) { - final FacetSet resolvedFacetSet = IResolverManager.DEFAULT - .resolve(subFacetSet, FacetSet.class); - allFacetSets.add(resolvedFacetSet); - } - } - for (FacetSet facetSet : allFacetSets) { - final Resource resource = facetSet.eResource(); - if (resource == null) { - final String message = String.format( - "The facetSet %s (%s) is not stored in a resource.", //$NON-NLS-1$ - facetSet.getName(), facetSet.getNsURI()); - Logger.logWarning(message, Activator.getDefault()); - } else { - final ResourceSet facetSetRS = resource.getResourceSet(); - if (!facetSetRS.equals(baserFeatureRS)) { - Logger.logWarning( - "The facet manager is dealing with more than one resource set.", //$NON-NLS-1$ - Activator.getDefault()); - } - } - for (Facet facet : FacetUtils.getFacets(facetSet)) { - final T matchingFeature = getMatchingFeature(eObject, facet, - baseFeature); - if (matchingFeature != null) { - result.add(matchingFeature); - } - } - } - if (result.isEmpty()) { - if (!this.failingFeatures.contains(baseFeature) - && !FacetManagerContext.SILENT) { - Logger.logWarning( - "The result of " //$NON-NLS-1$ - + this.getClass().getSimpleName() - + ".getOverrideCandidateFeatures(...) is empty! baseFeature=" //$NON-NLS-1$ - + EcoreUtil.getURI(baseFeature) - + " (This message will be sent only once)", //$NON-NLS-1$ - Activator.getDefault()); - // This avoid to have to many error messages in the log. - this.failingFeatures.add(baseFeature); - } - result.add(baseFeature); - } - if (DEBUG) { - final StringBuffer message = new StringBuffer('\n'); - message.append('\n'); - for (T feature : result) { - message.append(" - "); //$NON-NLS-1$ - message.append(FacetUtils.toString(feature)); - message.append('\n'); - } - DebugUtils.debug(message.toString()); - } - return result; - } - - /** - * Test whether a feature is overridden by another (directly or not) - * - * @param targetParent - * @param child - * @return true if child is directly or indirectly overridden by parent, - * false otherwise - */ - private static boolean isOverridenBy(final DerivedTypedElement child, - final DerivedTypedElement targetParent) { - - boolean result = false; - if (child.equals(targetParent)) { - result = true; - } else { - DerivedTypedElement currentParent = child.getOverride(); - while (!result && currentParent != null) { - if (currentParent.equals(targetParent)) { - result = true; - } else { - currentParent = currentParent.getOverride(); - } - } - } - return result; - } - - /** - * Find DerivedTypedElement features that matches the 'signature' - * - * @param eObject - * EObject used to test conformance - * @param facet - * @param signatureFeature - * reference feature that serves as 'signature' - * @throws FacetManagerException - */ - private <T extends DerivedTypedElement> T getMatchingFeature( - final EObject eObject, final Facet facet, final T signatureFeature) - throws FacetManagerException { - T result = null; - EList<? extends ETypedElement> eTypedElements; - if (signatureFeature instanceof EOperation) { - eTypedElements = facet.getFacetOperations(); - } else { - eTypedElements = facet.getFacetElements(); - } - // For each eTypedElement check is it override the signature feature and - // if the eTypedElement is owned by a facet to which the eObject - // conforms. - for (ETypedElement feature : eTypedElements) { - if (isMatchingFeature2(signatureFeature, feature)) { - // The conformance check is done after the check on the override - // to avoid infinite recursion. - final ConformanceState conformanceState = this.manager - .getConformanceState(eObject, facet); - if (conformanceState == ConformanceState.Conformant) { - if (!signatureFeature.getClass().isInstance(feature)) { - throw new FacetManagerException( - ModelUtils.getQualifiedName(feature) - + " overrides " //$NON-NLS-1$ - + ModelUtils - .getQualifiedName(signatureFeature) - + " but both are not of the same kind."); //$NON-NLS-1$ - } - @SuppressWarnings("unchecked") - // @SuppressWarnings("unchecked") check by - // "if (!signatureFeature.getClass().isInstance(feature))" - final T tmpFeature = (T) feature; - result = tmpFeature; - break; - // Two features from the same Facet cannot - // override a feature, so only one can be find - // in this Facet => stop search here. - } - } - } - return result; - } - - private static <T extends DerivedTypedElement> boolean isMatchingFeature2( - final T signatureFeature, final ETypedElement feature) - throws FacetManagerException { - boolean result = false; - // We're focusing on DerivedTypedElements - // ECore native features could not be overridden by Facets - // (EMF facet is supposed to be non intrusive) - - if (signatureFeature.getClass().isInstance(feature)) { - final T element = (T) feature; - // Just check that the top override is the same as the base feature - // i.e. that the current feature matches the 'signature' - final DerivedTypedElement topFeature = FacetUtils - .getTopOverrideFeature(element); - if (topFeature == signatureFeature) { - // found a match - result = true; - } else { - final Resource topResource = topFeature.eResource(); - final Resource signatureResource = signatureFeature.eResource(); - if (topResource == null || signatureResource == null || topFeature.eResource().getResourceSet() != signatureFeature.eResource().getResourceSet()) { - Logger.logWarning( - "topOverrideFeature.eResource().getResourceSet() != signatureFeature.eResource().getResourceSet()", //$NON-NLS-1$ - Activator.getDefault()); - } - } - } - return result; - } - - public void removeFacetSet(final FacetSet facetSet) { - final boolean removed = this.managedFacetSets.remove(facetSet); - if (removed) { - notifyListeners(); - } - } - - public void clear() { - final boolean empty = this.managedFacetSets.isEmpty(); - if (!empty) { - this.managedFacetSets.clear(); - notifyListeners(); - } - } - - public int size() { - return this.managedFacetSets.size(); - } - - public boolean isEmpty() { - return this.managedFacetSets.isEmpty(); - } - - public boolean contains(final Object object) { - return this.managedFacetSets.contains(object); - } - - public Iterator<FacetSet> iterator() { - return new ArrayList<FacetSet>(this.managedFacetSets).iterator(); - } - - public Object[] toArray() { - return this.managedFacetSets.toArray(); - } - - public <T> T[] toArray(final T[] array) { - return this.managedFacetSets.toArray(array); - } - - public boolean add(final FacetSet object) { - boolean result = false; - this.managedFacetSets.remove(object); - if (object != null) { - result = this.managedFacetSets.add(object); - } - if (result) { - notifyListeners(); - } - return result; - } - - public boolean remove(final Object object) { - final boolean isRemoved = this.managedFacetSets.remove(object); - if (isRemoved) { - notifyListeners(); - } - return isRemoved; - } - - public boolean containsAll(final Collection<?> collection) { - return this.managedFacetSets.containsAll(collection); - } - - public boolean addAll(final Collection<? extends FacetSet> collection) { - boolean result = false; - for (FacetSet facetSet : collection) { - this.managedFacetSets.remove(facetSet); - if (facetSet != null) { - final boolean addResult = this.managedFacetSets.add(facetSet); - result = result || addResult; - } - } - if (result) { - notifyListeners(); - } - return result; - } - - public boolean addAll(final int index, - final Collection<? extends FacetSet> collection) { - final List<FacetSet> filtered = new ArrayList<FacetSet>(); - for (FacetSet facetSet : collection) { - if (!filtered.contains(facetSet)) { - filtered.add(facetSet); - } - } - this.managedFacetSets.removeAll(filtered); - final boolean isAdded = this.managedFacetSets.addAll(index, - ListUtils.cleanList(filtered)); - if (isAdded) { - notifyListeners(); - } - return isAdded; - } - - public boolean removeAll(final Collection<?> collection) { - final boolean isRemoved = this.managedFacetSets.removeAll(collection); - if (isRemoved) { - notifyListeners(); - } - return isRemoved; - } - - public boolean retainAll(final Collection<?> collection) { - final boolean isRetained = this.managedFacetSets.retainAll(collection); - if (isRetained) { - notifyListeners(); - } - return isRetained; - } - - public FacetSet get(final int index) { - return this.managedFacetSets.get(index); - } - - public FacetSet set(final int index, final FacetSet element) { - final FacetSet oldElement = this.managedFacetSets.set(index, element); - if (!oldElement.equals(element)) { - notifyListeners(); - } - return oldElement; - } - - public void add(final int index, final FacetSet element) { - this.managedFacetSets.remove(element); - if (element != null) { - this.managedFacetSets.add(index, element); - notifyListeners(); - } - } - - public FacetSet remove(final int index) { - final FacetSet oldElement = this.managedFacetSets.remove(index); - notifyListeners(); - return oldElement; - } - - public int indexOf(final Object object) { - return this.managedFacetSets.indexOf(object); - } - - public int lastIndexOf(final Object object) { - return this.managedFacetSets.lastIndexOf(object); - } - - public ListIterator<FacetSet> listIterator() { - return this.managedFacetSets.listIterator(); - } - - public ListIterator<FacetSet> listIterator(final int index) { - return this.managedFacetSets.listIterator(index); - } - - public List<FacetSet> subList(final int fromIndex, final int toIndex) { - return this.managedFacetSets.subList(fromIndex, toIndex); - } - - public void addListener(final IFacetManagerListener listener) { - this.listeners.add(listener); - } - - public void removeListener(final IFacetManagerListener listener) { - this.listeners.remove(listener); - } - - private void notifyListeners() { - final IFacetManagerListener[] listenersCopy = this.listeners - .toArray(new IFacetManagerListener[this.listeners.size()]); - for (IFacetManagerListener listener : listenersCopy) { - listener.facetManagerChanged(); - } - } -}
diff --git a/org.eclipse.modisco.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/internal/FacetManagerFactory.java b/org.eclipse.modisco.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/internal/FacetManagerFactory.java deleted file mode 100644 index 3b53767..0000000 --- a/org.eclipse.modisco.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/internal/FacetManagerFactory.java +++ /dev/null
@@ -1,85 +0,0 @@ -/** - * Copyright (c) 2011 Mia-Software. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Emmanuelle Rouillé (Mia-Software) - Bug 352618 - To be able to use non derived facet structural features and save them values. - * Nicolas Bros (Mia-Software) - Bug 361612 - New core for new version of the Facet metamodel - * Gregoire Dupe (Mia-Software) - Bug 361794 - [Restructuring] New customization meta-model - * Gregoire Dupe (Mia-Software) - Bug 373078 - API Cleaning - * Thomas Cicognani (Soft-Maint) - Bug 416223 - IFacetManagerFactory.getOrCreateFacetManager should not create an instance per call - * Thomas Cicognani (Soft-Maint) - Bug 463658 - Impossibility to just create a FacetManager - */ -package org.eclipse.emf.facet.efacet.core.internal; - -import org.eclipse.emf.common.notify.Adapter; -import org.eclipse.emf.ecore.resource.Resource; -import org.eclipse.emf.ecore.resource.ResourceSet; -import org.eclipse.emf.facet.efacet.core.IFacetManager; -import org.eclipse.emf.facet.efacet.core.IFacetManagerFactory; - -public class FacetManagerFactory implements IFacetManagerFactory { - - /** - * @deprecated Use - * {@link #getOrCreateDefaultFacetManagerWithSerializationResource(Resource)} - * instead. The new method name is more understandable - */ - @Deprecated - public IFacetManager getOrCreateFacetManager(final Resource resource) { - return getOrCreateDefaultFacetManagerWithSerializationResource(resource); - } - - /** - * @deprecated Use {@link #getOrCreateDefaultFacetManager(ResourceSet)} - * instead. The new method name is more understandable - */ - @Deprecated - public IFacetManager getOrCreateFacetManager(final ResourceSet resourceSet) { - return getOrCreateDefaultFacetManager(resourceSet); - } - - public IFacetManager getOrCreateDefaultFacetManagerWithSerializationResource( - final Resource resource) { - FacetManager result = null; - for (Adapter adapter : resource.eAdapters()) { - if (adapter instanceof FacetManager) { - result = (FacetManager) adapter; - } - } - if (result == null) { - result = new FacetManager(resource); - resource.eAdapters().add(result); - } - return result; - } - - public IFacetManager getOrCreateDefaultFacetManager( - final ResourceSet resourceSet) { - FacetManager result = null; - for (Adapter adapter : resourceSet.eAdapters()) { - if (adapter instanceof FacetManager) { - result = (FacetManager) adapter; - } - } - if (result == null) { - result = new FacetManager(resourceSet); - resourceSet.eAdapters().add(result); - } - return result; - } - - public IFacetManager createFacetManagerWithSerializationResource( - final Resource resource) { - return new FacetManager(resource); - } - - public IFacetManager createFacetManager(final ResourceSet resourceSet) { - return new FacetManager(resourceSet); - } - -}
diff --git a/org.eclipse.modisco.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/internal/FacetManagerInternalUtils.java b/org.eclipse.modisco.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/internal/FacetManagerInternalUtils.java deleted file mode 100644 index 08db8ae..0000000 --- a/org.eclipse.modisco.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/internal/FacetManagerInternalUtils.java +++ /dev/null
@@ -1,33 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2015 Soft-Maint. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Jonathan Pepin (Soft-Maint) - Bug 473673 - Applying facet inferred from fopposite reference - *******************************************************************************/ - -package org.eclipse.emf.facet.efacet.core.internal; - -import org.eclipse.emf.ecore.EStructuralFeature; -import org.eclipse.emf.facet.efacet.core.FacetUtils; -import org.eclipse.emf.facet.efacet.core.IFacetManager; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.FacetSet; - -public final class FacetManagerInternalUtils { - - private FacetManagerInternalUtils() { - // Must not be used - } - - public static void loadParentFacetSet(final EStructuralFeature sFeature, - final IFacetManager facetManager) { - final FacetSet facetSet = FacetUtils.getFacetSet(sFeature); - if (!facetManager.getManagedFacetSets().contains(facetSet)) { - facetManager.getManagedFacetSets().add(facetSet); - } - } - -}
diff --git a/org.eclipse.modisco.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/internal/Messages.java b/org.eclipse.modisco.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/internal/Messages.java deleted file mode 100644 index cac5c63..0000000 --- a/org.eclipse.modisco.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/internal/Messages.java +++ /dev/null
@@ -1,28 +0,0 @@ -/** - * Copyright (c) 2011 Mia-Software. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Gregoire Dupe (Mia-Software) - Bug 333553 - The user has not to deal with two files to create a facet - */ -package org.eclipse.emf.facet.efacet.core.internal; - -import org.eclipse.osgi.util.NLS; - -@SuppressWarnings("PMD") -public final class Messages extends NLS { - private static final String BUNDLE_NAME = "org.eclipse.emf.facet.efacet.core.internal.messages"; //$NON-NLS-1$ - public static String EFacetCatalogManager_FacetSetCatalogName; - public static String EFacetCatalogManager_QuerySetCatalogName; - static { - // initialize resource bundle - NLS.initializeMessages(Messages.BUNDLE_NAME, Messages.class); - } - - private Messages() { - } -}
diff --git a/org.eclipse.modisco.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/internal/ResolverManager.java b/org.eclipse.modisco.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/internal/ResolverManager.java deleted file mode 100644 index a115682..0000000 --- a/org.eclipse.modisco.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/internal/ResolverManager.java +++ /dev/null
@@ -1,113 +0,0 @@ -/** - * Copyright (c) 2012 CEA LIST. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Gregoire Dupe (Mia-Software) - Bug 375087 - [Table] ITableWidget.addColumn(List<ETypedElement>, List<FacetSet>) - * Gregoire Dupe (Mia-Software) - Bug 372626 - Aggregates - */ -package org.eclipse.emf.facet.efacet.core.internal; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; - -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IConfigurationElement; -import org.eclipse.core.runtime.Platform; -import org.eclipse.emf.facet.efacet.core.internal.exported.IResolver; -import org.eclipse.emf.facet.efacet.core.internal.exported.IResolverManager; -import org.eclipse.emf.facet.util.core.Logger; - -public class ResolverManager implements IResolverManager { - - private static final String ATT_NAME = "class"; //$NON-NLS-1$ - private static final String EXT_POINT_ID = "org.eclipse.emf.facet.efacet.core.internal.resolver"; //$NON-NLS-1$ - private final List<IResolver> resolvers = new ArrayList<IResolver>(); - - public ResolverManager() { - final IConfigurationElement[] configs = Platform.getExtensionRegistry() - .getConfigurationElementsFor(ResolverManager.EXT_POINT_ID); - for (IConfigurationElement config : configs) { - try { - final Object object = config - .createExecutableExtension(ResolverManager.ATT_NAME); - if (object instanceof IResolver) { - final IResolver resolver = (IResolver) object; - this.resolvers.add(resolver); - } - } catch (CoreException e) { - Logger.logError(e, Activator.getDefault()); - } - - } - } - - public <T> T resolve(final Object object, final Class<T> aClass) { - T result = null; - for (IResolver resolver : this.resolvers) { - if (resolver.canHandle(object)) { - try { - result = resolver.resolve(object, aClass); - } catch (ClassCastException e) { - Logger.logWarning(e, Activator.getDefault()); - // Nothing to: we will try with an other resolver or return - // null - } - if (result != null) { - break; - } - } - } - return result; - } - - public <T> List<T> selectionPropagation(final Object selectedObject, - final Class<T> aClass) { - @SuppressWarnings("unchecked") - // @SuppressWarnings("unchecked") The untyped list is an definitely - // empty list. - List<T> result = Collections.EMPTY_LIST; - for (IResolver resolver : this.resolvers) { - if (resolver.canHandle(selectedObject)) { - try { - result = resolver.selectionPropagation(selectedObject, - aClass); - } catch (ClassCastException e) { - Logger.logWarning(e, Activator.getDefault()); - // Nothing to: we will try with an other resolver or return - // null - } - if (result != null) { - break; - } - } - } - return result; - } - - public <T> T selectionRoot(final Object selectedObject, - final Class<T> aClass) { - T result = null; - for (IResolver resolver : this.resolvers) { - if (resolver.canHandle(selectedObject)) { - try { - result = resolver.selectionRoot(selectedObject, - aClass); - } catch (ClassCastException e) { - Logger.logWarning(e, Activator.getDefault()); - // Nothing to: we will try with an other resolver or return - // null - } - if (result != null) { - break; - } - } - } - return result; - } - -}
diff --git a/org.eclipse.modisco.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/internal/catalog/EFacetCatalogManager2.java b/org.eclipse.modisco.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/internal/catalog/EFacetCatalogManager2.java deleted file mode 100644 index ae1aa72..0000000 --- a/org.eclipse.modisco.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/internal/catalog/EFacetCatalogManager2.java +++ /dev/null
@@ -1,71 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2011, 2016 Mia-Software - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Grégoire Dupé (Mia-Software) - Bug 333553 - The user has not to deal with two files to create a facet - * Nicolas Guyomar (Mia-Software) - Bug 333553 - The user has not to deal with two files to create a facet - * Emmanuelle Rouillé (Mia-Software) - Bug 352618 - To be able to use non derived facet structural features and save them values. - * Nicolas Bros (Mia-Software) - Bug 361612 - New core for new version of the Facet metamodel - * Nicolas Bros (Mia-Software) - Bug 361817 - [Restructuring] Dynamic load to the facet catalog - * Nicolas Bros (Mia-Software) - Bug 370110 - Rename efacetcatalog2.ecore - * Grégoire Dupé (Mia-Software) - Bug 369987 - [Restructuring][Table] Switch to the new customization and facet framework - * Grégoire Dupé (Mia-Software) - Bug 373078 - API Cleaning - * Grégoire Dupé (Mia-Software) - Bug 477657 - The catalog manager should be able to manage workspace model - * Grégoire Dupé (Mia-Software) - Bug 482887 - CatalogManager create files with too long name - *******************************************************************************/ -package org.eclipse.emf.facet.efacet.core.internal.catalog; - -import java.util.Collections; -import java.util.List; - -import org.eclipse.emf.common.util.BasicEList; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.resource.ResourceSet; -import org.eclipse.emf.facet.efacet.core.IFacetSetCatalogManager; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.FacetSet; -import org.eclipse.emf.facet.util.emf.core.catalog.ICatalogManager; -import org.eclipse.emf.facet.util.emf.core.catalog.ICatalogManagerConfiguration; -import org.eclipse.emf.facet.util.emf.core.catalog.ICatalogManagerFactory; - -public class EFacetCatalogManager2 implements IFacetSetCatalogManager { - - private final ICatalogManager catalogMgr; - - public EFacetCatalogManager2(final ResourceSet resourceSet) { - final ICatalogManagerConfiguration catalogMgrConfig = - new CatalogManagerConfiguration(); - this.catalogMgr = ICatalogManagerFactory.DEFAULT.getOrCreateCatalogManager( - catalogMgrConfig, resourceSet, this.getClass().getName()); - } - - public List<FacetSet> getRegisteredFacetSets() { - final BasicEList<FacetSet> result = new BasicEList<FacetSet>(); - for (EObject eObject : this.catalogMgr.getEntries(EObject.class)) { - if (eObject instanceof FacetSet) { - final FacetSet facetSet = (FacetSet) eObject; - result.add(facetSet); - } - } - return Collections.unmodifiableList(result); - } - - public void registerFacetSet(final FacetSet facetSet) { - this.catalogMgr.addWsEntry(facetSet); - } - - class CatalogManagerConfiguration implements ICatalogManagerConfiguration { - - public boolean canBeManaged(final EObject root) { - return root instanceof FacetSet; - } - - public boolean isValid(final EObject root) { - return true; - } - - } -}
diff --git a/org.eclipse.modisco.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/internal/exception/DerivedTypedElementEvaluationException.java b/org.eclipse.modisco.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/internal/exception/DerivedTypedElementEvaluationException.java deleted file mode 100644 index 5a56a16..0000000 --- a/org.eclipse.modisco.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/internal/exception/DerivedTypedElementEvaluationException.java +++ /dev/null
@@ -1,44 +0,0 @@ -/** - * Copyright (c) 2009 Mia-Software. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Gregoire Dupe (Mia-Software) - initial API and implementation - * Nicolas Bros (Mia-Software) - Bug 362191 - [Restructuring] Query mechanism for eFacet2 - */ -package org.eclipse.emf.facet.efacet.core.internal.exception; - -import org.eclipse.emf.facet.efacet.core.exception.DerivedTypedElementException; -import org.eclipse.emf.facet.util.core.internal.ErrorHandlingUtils; - -/** - * This exception occurs when something goes wrong during the execution of a query. - * - * @since 0.2 - */ -public class DerivedTypedElementEvaluationException extends DerivedTypedElementException { - // This class is a copy of - // org.eclipse.emf.facet.infra.query.core.ModelQueryExecutionException - - private static final long serialVersionUID = -8464252257666617685L; - - public DerivedTypedElementEvaluationException(final String message) { - super(message); - } - - public DerivedTypedElementEvaluationException(final String message, final Throwable cause) { - super(message, cause); - } - - public DerivedTypedElementEvaluationException(final Throwable cause) { - super(cause); - } - - /** Constructor for evaluation exception due to wrong type */ - public DerivedTypedElementEvaluationException(final String message, final Class<?> expectedType, final Object resultElement) { - super(ErrorHandlingUtils.buildWrongTypeMessage(message, expectedType, resultElement)); - } -}
diff --git a/org.eclipse.modisco.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/internal/exception/DerivedTypedElementTypeCheckingException.java b/org.eclipse.modisco.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/internal/exception/DerivedTypedElementTypeCheckingException.java deleted file mode 100644 index 6af52e9..0000000 --- a/org.eclipse.modisco.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/internal/exception/DerivedTypedElementTypeCheckingException.java +++ /dev/null
@@ -1,37 +0,0 @@ -/** - * Copyright (c) 2009 Mia-Software. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Gregoire Dupe (Mia-Software) - initial API and implementation - * Nicolas Bros (Mia-Software) - Bug 362191 - [Restructuring] Query mechanism for eFacet2 - */ -package org.eclipse.emf.facet.efacet.core.internal.exception; - -import org.eclipse.emf.facet.efacet.core.exception.DerivedTypedElementException; - -/** - * This exception occurs when the type of the result of evaluating a derived typed element is not - * the one that was expected - * - * @since 0.2 - */ -public class DerivedTypedElementTypeCheckingException extends DerivedTypedElementException { - - private static final long serialVersionUID = -9064274334817642819L; - - public DerivedTypedElementTypeCheckingException(final String message) { - super(message); - } - - public DerivedTypedElementTypeCheckingException(final String message, final Throwable cause) { - super(message, cause); - } - - public DerivedTypedElementTypeCheckingException(final Throwable cause) { - super(cause); - } -}
diff --git a/org.eclipse.modisco.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/internal/exception/FacetConformanceEvaluationException.java b/org.eclipse.modisco.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/internal/exception/FacetConformanceEvaluationException.java deleted file mode 100644 index bbdbeed..0000000 --- a/org.eclipse.modisco.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/internal/exception/FacetConformanceEvaluationException.java +++ /dev/null
@@ -1,32 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2011 Mia-Software - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Nicolas Bros (Mia-Software) - Bug 361612 - New core for new version of the Facet metamodel - *******************************************************************************/ -package org.eclipse.emf.facet.efacet.core.internal.exception; - -/** - * Happens when there is an error evaluating a Facet's conformance typed element. - * - * @since 0.2 - */ -public class FacetConformanceEvaluationException extends Exception { - private static final long serialVersionUID = -5306430483154103388L; - - public FacetConformanceEvaluationException(final String message) { - super(message); - } - - public FacetConformanceEvaluationException(final String message, final Throwable cause) { - super(message, cause); - } - - public FacetConformanceEvaluationException(final Throwable cause) { - super(cause); - } -}
diff --git a/org.eclipse.modisco.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/internal/exception/NonApplicableFacetException.java b/org.eclipse.modisco.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/internal/exception/NonApplicableFacetException.java deleted file mode 100644 index cd3c4af..0000000 --- a/org.eclipse.modisco.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/internal/exception/NonApplicableFacetException.java +++ /dev/null
@@ -1,21 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2012 Mia-Software - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Nicolas Bros (Mia-Software) - Bug 361612 - New core for new version of the Facet metamodel - *******************************************************************************/ -package org.eclipse.emf.facet.efacet.core.internal.exception; - -/** - * This exception is raised when an object cannot be extended by a facet because the class of the object does not correspond - * to the extended metaclass of the facet. - * @since 0.2 - */ -public class NonApplicableFacetException extends Exception { - - private static final long serialVersionUID = 2984069177830836577L; -}
diff --git a/org.eclipse.modisco.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/internal/exception/NonConformingEObjectException.java b/org.eclipse.modisco.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/internal/exception/NonConformingEObjectException.java deleted file mode 100644 index a456230..0000000 --- a/org.eclipse.modisco.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/internal/exception/NonConformingEObjectException.java +++ /dev/null
@@ -1,21 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2012 Mia-Software - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Nicolas Bros (Mia-Software) - Bug 361612 - New core for new version of the Facet metamodel - *******************************************************************************/ -package org.eclipse.emf.facet.efacet.core.internal.exception; - -/** - * This exception is raised when an object cannot be extended by a facet because it is filtered by the conformance query - * of this facet. - * @since 0.2 - */ -public class NonConformingEObjectException extends Exception { - - private static final long serialVersionUID = -7778081627619345385L; -}
diff --git a/org.eclipse.modisco.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/internal/exception/SaveStructuralFeatureInstanceModelException.java b/org.eclipse.modisco.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/internal/exception/SaveStructuralFeatureInstanceModelException.java deleted file mode 100644 index ea924dc..0000000 --- a/org.eclipse.modisco.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/internal/exception/SaveStructuralFeatureInstanceModelException.java +++ /dev/null
@@ -1,40 +0,0 @@ -/** - * Copyright (c) 2011 Mia-Software. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Emmanuelle Rouillé (Mia-Software) - Bug 352618 - To be able to use non derived facet structural features and save them values. - */ -package org.eclipse.emf.facet.efacet.core.internal.exception; - -import org.eclipse.emf.facet.efacet.core.exception.FacetManagerException; - -/** - * This exception is raised when an IOException is caught when trying to save a structural feature instance model - * @since 0.2 - */ -public class SaveStructuralFeatureInstanceModelException extends - FacetManagerException { - - private static final long serialVersionUID = 7024009106572531846L; - - /** - * Creates a new instance of UnmatchingExpectedTypeException - * with {@link Throwable} the exception at the origin of this exception - */ - public SaveStructuralFeatureInstanceModelException(final Throwable cause) { - super(cause); - } - - /** - * Creates a new instance of UnmatchingExpectedTypeException - * with {@link Throwable} the exception at the origin of this exception - */ - public SaveStructuralFeatureInstanceModelException(final String message) { - super(message); - } -}
diff --git a/org.eclipse.modisco.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/internal/exception/UnmatchingExpectedTypeException.java b/org.eclipse.modisco.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/internal/exception/UnmatchingExpectedTypeException.java deleted file mode 100644 index 1f68b16..0000000 --- a/org.eclipse.modisco.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/internal/exception/UnmatchingExpectedTypeException.java +++ /dev/null
@@ -1,45 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2011 Mia-Software - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Emmanuelle Rouillé (Mia-Software) - Bug 352618 - To be able to use non derived facet structural features and save them values. - * Nicolas Bros (Mia-Software) - Bug 361612 - New core for new version of the Facet metamodel - *******************************************************************************/ -package org.eclipse.emf.facet.efacet.core.internal.exception; - -import org.eclipse.emf.facet.efacet.core.exception.FacetManagerException; -import org.eclipse.emf.facet.util.core.internal.ErrorHandlingUtils; - -/** - * This exception is raised when a value's type does not match with the expected type - * - * @since 0.2 - */ -public class UnmatchingExpectedTypeException extends FacetManagerException { - - private static final long serialVersionUID = 1456802297756942271L; - - public UnmatchingExpectedTypeException() { - super(); - } - - public UnmatchingExpectedTypeException(final String message) { - super(message); - } - - public UnmatchingExpectedTypeException(final String message, final Throwable cause) { - super(message, cause); - } - - public UnmatchingExpectedTypeException(final Throwable cause) { - super(cause); - } - - public UnmatchingExpectedTypeException(final String message, final Class<?> expectedType, final Object resultElement) { - super(ErrorHandlingUtils.buildWrongTypeMessage(message, expectedType, resultElement)); - } -}
diff --git a/org.eclipse.modisco.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/internal/exported/IResolver.java b/org.eclipse.modisco.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/internal/exported/IResolver.java deleted file mode 100644 index ac9bba1..0000000 --- a/org.eclipse.modisco.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/internal/exported/IResolver.java +++ /dev/null
@@ -1,61 +0,0 @@ -/** - * Copyright (c) 2012 CEA LIST. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Gregoire Dupe (Mia-Software) - Bug 375087 - [Table] ITableWidget.addColumn(List<ETypedElement>, List<FacetSet>) - * Gregoire Dupe (Mia-Software) - Bug 372626 - Aggregates - */ -package org.eclipse.emf.facet.efacet.core.internal.exported; - -import java.util.List; - -/** - * The interface has to be implemented to contribute to the extension point - * 'org.eclipse.emf.facet.efacet.core.internal.resolver'. - */ -public interface IResolver { - - /** - * Return true is the parameter object can be handle by the implementation - * of this interface. - * - * @param object - * @return - */ - boolean canHandle(Object object); - - /** - * If the parameter 'object' is a proxy, this method returns the - * corresponding a resolved object. - * - * @param object - * a proxy - * @param aClass - * the expected resolved object - */ - <T> T resolve(Object object, Class<T> aClass); - - /** - * This method returns the objects that have to be automatically selected - * when the parameter 'selectedObject' is selected. - * - * @param selectedObject - * @param aClass - * the expected list elements type. - */ - <T> List<T> selectionPropagation(Object selectedObject, Class<T> aClass); - - /** - * This method returns the root of the objects that have to be automatically - * selected when the parameter 'selectedObject' is selected. - * - * @param selectedObject - * @param aClass - * the expected list elements type. - */ - <T> T selectionRoot(Object selectedObject, Class<T> aClass); -}
diff --git a/org.eclipse.modisco.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/internal/exported/IResolverManager.java b/org.eclipse.modisco.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/internal/exported/IResolverManager.java deleted file mode 100644 index d491750..0000000 --- a/org.eclipse.modisco.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/internal/exported/IResolverManager.java +++ /dev/null
@@ -1,28 +0,0 @@ -/** - * Copyright (c) 2012 CEA LIST. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Gregoire Dupe (Mia-Software) - Bug 375087 - [Table] ITableWidget.addColumn(List<ETypedElement>, List<FacetSet>) - * Gregoire Dupe (Mia-Software) - Bug 372626 - Aggregates - */ -package org.eclipse.emf.facet.efacet.core.internal.exported; - -import java.util.List; - -import org.eclipse.emf.facet.efacet.core.internal.ResolverManager; - -public interface IResolverManager { - - IResolverManager DEFAULT = new ResolverManager(); - - <T> T resolve(Object object, Class<T> aClass); - - <T> List<T> selectionPropagation(Object selectedObject, Class<T> aClass); - - <T> T selectionRoot(Object selectedObject, Class<T> aClass); - -}
diff --git a/org.eclipse.modisco.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/internal/incubatingapi/IFacetActions2.java b/org.eclipse.modisco.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/internal/incubatingapi/IFacetActions2.java deleted file mode 100644 index 781eb59..0000000 --- a/org.eclipse.modisco.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/internal/incubatingapi/IFacetActions2.java +++ /dev/null
@@ -1,208 +0,0 @@ -/** - * Copyright (c) 2011 Mia-Software. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Nicolas Guyomar (Mia-Software) - Bug 338813 - [EMF Facet Framework] basic Facet actions - * Nicolas Bros (Mia-Software) - Bug 361612 - New core for new version of the Facet metamodel - * Gregoire Dupe (Mia-Software) - Bug 373078 - API Cleaning - */ -package org.eclipse.emf.facet.efacet.core.internal.incubatingapi; - -import java.io.IOException; - -import org.eclipse.core.resources.IFile; -import org.eclipse.emf.common.command.Command; -import org.eclipse.emf.ecore.EOperation; -import org.eclipse.emf.ecore.EParameter; -import org.eclipse.emf.edit.domain.EditingDomain; -import org.eclipse.emf.facet.efacet.core.internal.FacetActions2Impl; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.Facet; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.FacetAttribute; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.FacetOperation; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.FacetReference; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.FacetSet; -import org.eclipse.emf.facet.util.emf.core.exception.InvalidFacetSetException; - -/** - * This interface contains methods to create {@link Facet}s. - * - * @since 0.2 - */ -public interface IFacetActions2 { - - IFacetActions2 INSTANCE = new FacetActions2Impl(); - - /** - * Add the given facetSet to the given facetSet model file, which will be created - * - * @param facetSet - * the facetSet to be created. Cannot be <code>null</code> - * @param project - * the new file in which the facetSet has to be created. Cannot be <code>null</code>, - * and cannot already exist - */ - void saveFacetSet(FacetSet facetSet, IFile file) throws IOException, - InvalidFacetSetException; - - /** - * Add the given {@link Facet} to the given {@link FacetSet} - * - * @param facetSet - * the parent facetSet, cannot be null - * @param facet - * the {@link Facet}, cannot be null, or contained by a resource - * @param editingDomain - * the editing domain needed to perform the Add EMF command, cannot be null - */ - Facet createFacetInFacetSet(FacetSet facetSet, Facet facet, - EditingDomain editingDomain); - - /** - * Create a command to add the given {@link Facet} to the given {@link FacetSet} - * - * @param facetSet - * the parent facetSet, cannot be null - * @param facet - * the {@link Facet}, cannot be null, or contained by a resource - * @param editingDomain - * the editing domain needed to perform the Add EMF command, cannot be null - */ - Command createCreateFacetInFacetSetCommand(FacetSet facetSet, Facet facet, - EditingDomain editingDomain); - - /** - * Add the given {@link FacetAttribute} to the given {@link Facet} - * - * @param facet - * the parent {@link Facet}, cannot be null - * @param facetAttribute - * the {@link FacetAttribute}, cannot be null, or contained by a resource - * @param editingDomain - * the editing domain needed to perform the Add Emf command, cannot be null - */ - void addAttributeInFacet(Facet facet, FacetAttribute facetAttribute, - EditingDomain editingDomain); - - /** - * Create a command to add the given {@link FacetAttribute} to the given {@link Facet} - * - * @param facet - * the parent {@link Facet}, cannot be null - * @param facetAttribute - * the {@link FacetAttribute}, cannot be null, or contained by a resource - * @param editingDomain - * the editing domain needed to perform the Add Emf command, cannot be null - */ - Command createAddAttributeInFacetCommand(Facet facet, FacetAttribute facetAttribute, - EditingDomain editingDomain); - - /** - * Add the given {@link FacetReference} to the given {@link Facet} - * - * @param facet - * the parent {@link Facet}, cannot be null - * @param facetReference - * the {@link FacetReference}, cannot be null, or contained by a resource - * @param editingDomain - * the editing domain needed to perform the Add Emf command, cannot be null - */ - void addReferenceInFacet(Facet facet, FacetReference facetReference, - EditingDomain editingDomain); - - /** - * Create a command to add the given {@link FacetReference} to the given {@link Facet} - * - * @param facet - * the parent {@link Facet}, cannot be null - * @param facetReference - * the {@link FacetReference}, cannot be null, or contained by a resource - * @param editingDomain - * the editing domain needed to perform the Add Emf command, cannot be null - */ - Command createAddReferenceInFacetCommand(Facet facet, - FacetReference facetReference, EditingDomain editingDomain); - - /** - * Add a new {@link FacetOperation} to the given {@link Facet} - * - * @param facet - * the parent {@link Facet}, cannot be null - * @param facetOperation - * the new {@link FacetOperation}, cannot be null, or contained by a resource - * @param editingDomain - * the editing domain needed to perform the Add Emf command, cannot be null - */ - void addOperationInFacet(Facet facet, FacetOperation facetOperation, - EditingDomain editingDomain); - - /** - * Add a new {@link FacetOperation} to the given {@link Facet} - * - * @param facet - * the parent {@link Facet}, cannot be null - * @param facetOperation - * the new {@link FacetOperation}, cannot be null, or contained by a resource - * @param editingDomain - * the editing domain needed to perform the Add Emf command, cannot be null - */ - Command createAddOperationInFacetCommand(Facet facet, - FacetOperation facetOperation, EditingDomain editingDomain); - - /** - * Add a new {@link EParameter} to the given {@link FacetOperation} - * - * @param operation - * the parent {@link EOperation} - * @param parameter - * the new {@link EParameter} - * @param editingDomain - * the editing domain needed to perform the Add Emf command, cannot be null - */ - void addParameterInOperation(FacetOperation operation, - EParameter parameter, EditingDomain editingDomain); - - /** - * Add a new {@link EParameter} to the given {@link FacetOperation} - * - * @param operation - * the parent {@link EOperation} - * @param parameter - * the new {@link EParameter} - * @param editingDomain - * the editing domain needed to perform the Add Emf command, cannot be null - */ - Command createAddParameterInOperationCommand(FacetOperation operation, - EParameter parameter, EditingDomain editingDomain); - - /** - * Set the given URI to the given {@link FacetSet} - * - * @param facetSet - * the {@link FacetSet} to be modified - * @param nsUri - * the Uri - * @param editingDomain - * the editing domain needed to perform the Set Emf command, cannot be null - */ - void setFacetSetNsUri(FacetSet facetSet, String nsUri, - EditingDomain editingDomain); - - /** - * Set the given URI to the given {@link FacetSet} - * - * @param facetSet - * the {@link FacetSet} to be modified - * @param nsUri - * the Uri - * @param editingDomain - * the editing domain needed to perform the Set Emf command, cannot be null - */ - Command createSetFacetSetNsUriCommand(FacetSet facetSet, String nsUri, - EditingDomain editingDomain); - -}
diff --git a/org.eclipse.modisco.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/internal/query/EObjectLiteralQueryImplementation.java b/org.eclipse.modisco.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/internal/query/EObjectLiteralQueryImplementation.java deleted file mode 100644 index 26408a3..0000000 --- a/org.eclipse.modisco.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/internal/query/EObjectLiteralQueryImplementation.java +++ /dev/null
@@ -1,48 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2012 CEA LIST. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Nicolas Bros (Mia-Software) - Bug 376941 - [EFacet] Facet operation arguments in Facet model - *******************************************************************************/ -package org.eclipse.emf.facet.efacet.core.internal.query; - -import java.util.List; - -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.facet.efacet.core.IFacetManager; -import org.eclipse.emf.facet.efacet.core.exception.DerivedTypedElementException; -import org.eclipse.emf.facet.efacet.core.internal.exception.DerivedTypedElementEvaluationException; -import org.eclipse.emf.facet.efacet.core.query.IQueryImplementation; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.DerivedTypedElement; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.ParameterValue; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.extensible.Query; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.query.EObjectLiteralQuery; - -public class EObjectLiteralQueryImplementation implements IQueryImplementation { - - private boolean checkResultType = false; - - public Object getValue(final Query query, final DerivedTypedElement feature, final EObject source, final List<ParameterValue> parameterValues, - final IFacetManager facetManager) - throws DerivedTypedElementException { - return ((EObjectLiteralQuery) query).getElement(); - } - - public void setValue(final Query query, final DerivedTypedElement feature, final EObject source, final List<ParameterValue> parameterValues, - final Object newValue) - throws DerivedTypedElementException { - throw new DerivedTypedElementEvaluationException("Not implemented"); //$NON-NLS-1$ - } - - public boolean isCheckResultType() { - return this.checkResultType; - } - - public void setCheckResultType(final boolean checkResultType) { - this.checkResultType = checkResultType; - } -}
diff --git a/org.eclipse.modisco.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/internal/query/EObjectLiteralQueryImplementationFactory.java b/org.eclipse.modisco.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/internal/query/EObjectLiteralQueryImplementationFactory.java deleted file mode 100644 index 1fa6d0c..0000000 --- a/org.eclipse.modisco.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/internal/query/EObjectLiteralQueryImplementationFactory.java +++ /dev/null
@@ -1,33 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2012 CEA LIST. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Nicolas Bros (Mia-Software) - Bug 376941 - [EFacet] Facet operation arguments in Facet model - *******************************************************************************/ -package org.eclipse.emf.facet.efacet.core.internal.query; - -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.facet.efacet.core.IDerivedTypedElementManager; -import org.eclipse.emf.facet.efacet.core.exception.DerivedTypedElementException; -import org.eclipse.emf.facet.efacet.core.query.IQueryImplementation; -import org.eclipse.emf.facet.efacet.core.query.IQueryImplementationFactory; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.extensible.Query; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.query.QueryPackage; -import org.osgi.framework.Bundle; - -public class EObjectLiteralQueryImplementationFactory implements IQueryImplementationFactory { - - public EClass getManagedQueryType() { - return QueryPackage.eINSTANCE.getEObjectLiteralQuery(); - } - - public IQueryImplementation create(final Query query, final Bundle queryBundle, final IDerivedTypedElementManager manager) throws DerivedTypedElementException { - final EObjectLiteralQueryImplementation evaluator = new EObjectLiteralQueryImplementation(); - evaluator.setCheckResultType(true); - return evaluator; - } -}
diff --git a/org.eclipse.modisco.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/internal/query/FalseLiteralQueryImplementation.java b/org.eclipse.modisco.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/internal/query/FalseLiteralQueryImplementation.java deleted file mode 100644 index feb64f6..0000000 --- a/org.eclipse.modisco.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/internal/query/FalseLiteralQueryImplementation.java +++ /dev/null
@@ -1,46 +0,0 @@ -/** - * Copyright (c) 2012 Mia-Software. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Gregoire Dupe (Mia-Software) - Bug 369987 - [Restructuring][Table] Switch to the new customization and facet framework - * Nicolas Bros (Mia-Software) - Bug 376941 - [EFacet] Facet operation arguments in Facet model - */ -package org.eclipse.emf.facet.efacet.core.internal.query; - -import java.util.List; - -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.facet.efacet.core.IFacetManager; -import org.eclipse.emf.facet.efacet.core.exception.DerivedTypedElementException; -import org.eclipse.emf.facet.efacet.core.internal.exception.DerivedTypedElementEvaluationException; -import org.eclipse.emf.facet.efacet.core.query.IQueryImplementation; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.DerivedTypedElement; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.ParameterValue; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.extensible.Query; - -public class FalseLiteralQueryImplementation implements IQueryImplementation { - - private boolean checkResultType = false; - - public Object getValue(final Query query, final DerivedTypedElement feature, final EObject source, final List<ParameterValue> parameterValues, final IFacetManager facetManager) - throws DerivedTypedElementException { - return Boolean.FALSE; - } - - public void setValue(final Query query, final DerivedTypedElement feature, final EObject source, final List<ParameterValue> parameterValues, final Object newValue) - throws DerivedTypedElementException { - throw new DerivedTypedElementEvaluationException("Not implemented"); //$NON-NLS-1$ - } - - public void setCheckResultType(final boolean checkResultType) { - this.checkResultType = checkResultType; - } - - public boolean isCheckResultType() { - return this.checkResultType; - } -}
diff --git a/org.eclipse.modisco.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/internal/query/FalseLiteralQueryImplementationFactory.java b/org.eclipse.modisco.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/internal/query/FalseLiteralQueryImplementationFactory.java deleted file mode 100644 index 2d92739..0000000 --- a/org.eclipse.modisco.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/internal/query/FalseLiteralQueryImplementationFactory.java +++ /dev/null
@@ -1,35 +0,0 @@ -/** - * Copyright (c) 2012 Mia-Software. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Grégoire Dupé (Mia-Software) - Bug 369987 - [Restructuring][Table] Switch to the new customization and facet framework - * Nicolas Bros (Mia-Software) - Bug 376941 - [EFacet] Facet operation arguments in Facet model - */ -package org.eclipse.emf.facet.efacet.core.internal.query; - -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.facet.efacet.core.IDerivedTypedElementManager; -import org.eclipse.emf.facet.efacet.core.exception.DerivedTypedElementException; -import org.eclipse.emf.facet.efacet.core.query.IQueryImplementation; -import org.eclipse.emf.facet.efacet.core.query.IQueryImplementationFactory; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.extensible.Query; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.query.QueryPackage; -import org.osgi.framework.Bundle; - -public class FalseLiteralQueryImplementationFactory implements IQueryImplementationFactory { - - public EClass getManagedQueryType() { - return QueryPackage.eINSTANCE.getFalseLiteralQuery(); - } - - public IQueryImplementation create(final Query query, final Bundle queryBundle, final IDerivedTypedElementManager manager) throws DerivedTypedElementException { - final FalseLiteralQueryImplementation evaluator = new FalseLiteralQueryImplementation(); - evaluator.setCheckResultType(false); - return evaluator; - } - -}
diff --git a/org.eclipse.modisco.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/internal/query/FloatLiteralQueryImplementation.java b/org.eclipse.modisco.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/internal/query/FloatLiteralQueryImplementation.java deleted file mode 100644 index 2736840..0000000 --- a/org.eclipse.modisco.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/internal/query/FloatLiteralQueryImplementation.java +++ /dev/null
@@ -1,46 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2012 CEA LIST. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Nicolas Bros (Mia-Software) - Bug 376941 - [EFacet] Facet operation arguments in Facet model - *******************************************************************************/ -package org.eclipse.emf.facet.efacet.core.internal.query; - -import java.util.List; - -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.facet.efacet.core.IFacetManager; -import org.eclipse.emf.facet.efacet.core.exception.DerivedTypedElementException; -import org.eclipse.emf.facet.efacet.core.internal.exception.DerivedTypedElementEvaluationException; -import org.eclipse.emf.facet.efacet.core.query.IQueryImplementation; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.DerivedTypedElement; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.ParameterValue; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.extensible.Query; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.query.FloatLiteralQuery; - -public class FloatLiteralQueryImplementation implements IQueryImplementation { - - private boolean checkResultType = false; - - public Object getValue(final Query query, final DerivedTypedElement feature, final EObject source, final List<ParameterValue> parameterValues, final IFacetManager facetManager) - throws DerivedTypedElementException { - return Float.valueOf(((FloatLiteralQuery) query).getValue()); - } - - public void setValue(final Query query, final DerivedTypedElement feature, final EObject source, final List<ParameterValue> parameterValues, final Object newValue) - throws DerivedTypedElementException { - throw new DerivedTypedElementEvaluationException("Not implemented"); //$NON-NLS-1$ - } - - public void setCheckResultType(final boolean checkResultType) { - this.checkResultType = checkResultType; - } - - public boolean isCheckResultType() { - return this.checkResultType; - } -}
diff --git a/org.eclipse.modisco.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/internal/query/FloatLiteralQueryImplementationFactory.java b/org.eclipse.modisco.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/internal/query/FloatLiteralQueryImplementationFactory.java deleted file mode 100644 index c71db27..0000000 --- a/org.eclipse.modisco.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/internal/query/FloatLiteralQueryImplementationFactory.java +++ /dev/null
@@ -1,33 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2012 CEA LIST. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Nicolas Bros (Mia-Software) - Bug 376941 - [EFacet] Facet operation arguments in Facet model - *******************************************************************************/ -package org.eclipse.emf.facet.efacet.core.internal.query; - -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.facet.efacet.core.IDerivedTypedElementManager; -import org.eclipse.emf.facet.efacet.core.exception.DerivedTypedElementException; -import org.eclipse.emf.facet.efacet.core.query.IQueryImplementation; -import org.eclipse.emf.facet.efacet.core.query.IQueryImplementationFactory; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.extensible.Query; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.query.QueryPackage; -import org.osgi.framework.Bundle; - -public class FloatLiteralQueryImplementationFactory implements IQueryImplementationFactory { - - public EClass getManagedQueryType() { - return QueryPackage.eINSTANCE.getFloatLiteralQuery(); - } - - public IQueryImplementation create(final Query query, final Bundle queryBundle, final IDerivedTypedElementManager manager) throws DerivedTypedElementException { - final FloatLiteralQueryImplementation evaluator = new FloatLiteralQueryImplementation(); - evaluator.setCheckResultType(true); - return evaluator; - } -}
diff --git a/org.eclipse.modisco.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/internal/query/IntegerLiteralQueryImplementation.java b/org.eclipse.modisco.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/internal/query/IntegerLiteralQueryImplementation.java deleted file mode 100644 index 2558403..0000000 --- a/org.eclipse.modisco.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/internal/query/IntegerLiteralQueryImplementation.java +++ /dev/null
@@ -1,46 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2012 CEA LIST. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Nicolas Bros (Mia-Software) - Bug 376941 - [EFacet] Facet operation arguments in Facet model - *******************************************************************************/ -package org.eclipse.emf.facet.efacet.core.internal.query; - -import java.util.List; - -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.facet.efacet.core.IFacetManager; -import org.eclipse.emf.facet.efacet.core.exception.DerivedTypedElementException; -import org.eclipse.emf.facet.efacet.core.internal.exception.DerivedTypedElementEvaluationException; -import org.eclipse.emf.facet.efacet.core.query.IQueryImplementation; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.DerivedTypedElement; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.ParameterValue; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.extensible.Query; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.query.IntegerLiteralQuery; - -public class IntegerLiteralQueryImplementation implements IQueryImplementation { - - private boolean checkResultType = false; - - public Object getValue(final Query query, final DerivedTypedElement feature, final EObject source, final List<ParameterValue> parameterValues, final IFacetManager facetManager) - throws DerivedTypedElementException { - return Integer.valueOf(((IntegerLiteralQuery) query).getValue()); - } - - public void setValue(final Query query, final DerivedTypedElement feature, final EObject source, final List<ParameterValue> parameterValues, final Object newValue) - throws DerivedTypedElementException { - throw new DerivedTypedElementEvaluationException("Not implemented"); //$NON-NLS-1$ - } - - public void setCheckResultType(final boolean checkResultType) { - this.checkResultType = checkResultType; - } - - public boolean isCheckResultType() { - return this.checkResultType; - } -}
diff --git a/org.eclipse.modisco.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/internal/query/IntegerLiteralQueryImplementationFactory.java b/org.eclipse.modisco.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/internal/query/IntegerLiteralQueryImplementationFactory.java deleted file mode 100644 index b7d9f78..0000000 --- a/org.eclipse.modisco.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/internal/query/IntegerLiteralQueryImplementationFactory.java +++ /dev/null
@@ -1,33 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2012 CEA LIST. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Nicolas Bros (Mia-Software) - Bug 376941 - [EFacet] Facet operation arguments in Facet model - *******************************************************************************/ -package org.eclipse.emf.facet.efacet.core.internal.query; - -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.facet.efacet.core.IDerivedTypedElementManager; -import org.eclipse.emf.facet.efacet.core.exception.DerivedTypedElementException; -import org.eclipse.emf.facet.efacet.core.query.IQueryImplementation; -import org.eclipse.emf.facet.efacet.core.query.IQueryImplementationFactory; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.extensible.Query; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.query.QueryPackage; -import org.osgi.framework.Bundle; - -public class IntegerLiteralQueryImplementationFactory implements IQueryImplementationFactory { - - public EClass getManagedQueryType() { - return QueryPackage.eINSTANCE.getIntegerLiteralQuery(); - } - - public IQueryImplementation create(final Query query, final Bundle queryBundle, final IDerivedTypedElementManager manager) throws DerivedTypedElementException { - final IntegerLiteralQueryImplementation evaluator = new IntegerLiteralQueryImplementation(); - evaluator.setCheckResultType(true); - return evaluator; - } -}
diff --git a/org.eclipse.modisco.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/internal/query/IsOneOfQueryImplementation.java b/org.eclipse.modisco.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/internal/query/IsOneOfQueryImplementation.java deleted file mode 100644 index 41c9ee7..0000000 --- a/org.eclipse.modisco.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/internal/query/IsOneOfQueryImplementation.java +++ /dev/null
@@ -1,52 +0,0 @@ -/** - * Copyright (c) 2012 Mia-Software. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Gregoire Dupe (Mia-Software) - Bug 369673 - [Facet] IsOneOfQuery - * Gregoire Dupe (Mia-Software) - Bug 369987 - [Restructuring][Table] Switch to the new customization and facet framework - * Nicolas Bros (Mia-Software) - Bug 376941 - [EFacet] Facet operation arguments in Facet model - */ -package org.eclipse.emf.facet.efacet.core.internal.query; - -import java.util.List; - -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.facet.efacet.core.IFacetManager; -import org.eclipse.emf.facet.efacet.core.exception.DerivedTypedElementException; -import org.eclipse.emf.facet.efacet.core.internal.exception.DerivedTypedElementEvaluationException; -import org.eclipse.emf.facet.efacet.core.query.IQueryImplementation; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.DerivedTypedElement; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.ParameterValue; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.extensible.Query; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.query.IsOneOfQuery; - -public class IsOneOfQueryImplementation implements IQueryImplementation { - - // This class is a modified copy of : - // org.eclipse.emf.facet.infra.query.core.java.internal.JavaModelQueryAdapter - - private boolean checkResultType = false; - - public Object getValue(final Query query, final DerivedTypedElement feature, final EObject source, final List<ParameterValue> parameterValues, final IFacetManager facetManager) - throws DerivedTypedElementException { - return Boolean.valueOf(((IsOneOfQuery) query).getExpectedEObjects().contains(source)); - } - - public void setValue(final Query query, final DerivedTypedElement feature, final EObject source, final List<ParameterValue> parameterValues, final Object newValue) - throws DerivedTypedElementException { - throw new DerivedTypedElementEvaluationException("Not implemented"); //$NON-NLS-1$ - } - - public void setCheckResultType(final boolean checkResultType) { - this.checkResultType = checkResultType; - } - - public boolean isCheckResultType() { - return this.checkResultType; - } - -}
diff --git a/org.eclipse.modisco.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/internal/query/IsOneOfQueryImplementationFactory.java b/org.eclipse.modisco.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/internal/query/IsOneOfQueryImplementationFactory.java deleted file mode 100644 index ff22421..0000000 --- a/org.eclipse.modisco.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/internal/query/IsOneOfQueryImplementationFactory.java +++ /dev/null
@@ -1,36 +0,0 @@ -/** - * Copyright (c) 2012 Mia-Software. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Grégoire Dupé (Mia-Software) - Bug 369673 - [Facet] IsOneOfQuery - * Gregoire Dupe (Mia-Software) - Bug 369987 - [Restructuring][Table] Switch to the new customization and facet framework - * Nicolas Bros (Mia-Software) - Bug 376941 - [EFacet] Facet operation arguments in Facet model - */ -package org.eclipse.emf.facet.efacet.core.internal.query; - -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.facet.efacet.core.IDerivedTypedElementManager; -import org.eclipse.emf.facet.efacet.core.exception.DerivedTypedElementException; -import org.eclipse.emf.facet.efacet.core.query.IQueryImplementation; -import org.eclipse.emf.facet.efacet.core.query.IQueryImplementationFactory; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.extensible.Query; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.query.QueryPackage; -import org.osgi.framework.Bundle; - -public class IsOneOfQueryImplementationFactory implements IQueryImplementationFactory { - - public EClass getManagedQueryType() { - return QueryPackage.eINSTANCE.getIsOneOfQuery(); - } - - public IQueryImplementation create(final Query query, final Bundle queryBundle, final IDerivedTypedElementManager manager) throws DerivedTypedElementException { - final IsOneOfQueryImplementation evaluator = new IsOneOfQueryImplementation(); - evaluator.setCheckResultType(false); - return evaluator; - } - -}
diff --git a/org.eclipse.modisco.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/internal/query/NavigationQueryImplementation.java b/org.eclipse.modisco.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/internal/query/NavigationQueryImplementation.java deleted file mode 100644 index 9360bf2..0000000 --- a/org.eclipse.modisco.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/internal/query/NavigationQueryImplementation.java +++ /dev/null
@@ -1,80 +0,0 @@ -/** - * Copyright (c) 2011, 2012 Mia-Software. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Gregoire Dupe (Mia-Software) - Bug 366055 - NavigationQuery - * Gregoire Dupe (Mia-Software) - Bug 369987 - [Restructuring][Table] Switch to the new customization and facet framework - * Olivier Remaud (Soft-Maint) - Bug 373087 - [Improvement] Adaptable behavior on error - * Nicolas Bros (Mia-Software) - Bug 376941 - [EFacet] Facet operation arguments in Facet model - */ -package org.eclipse.emf.facet.efacet.core.internal.query; - -import java.lang.reflect.InvocationTargetException; -import java.util.List; - -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.EOperation; -import org.eclipse.emf.ecore.EStructuralFeature; -import org.eclipse.emf.ecore.ETypedElement; -import org.eclipse.emf.facet.efacet.core.IFacetManager; -import org.eclipse.emf.facet.efacet.core.exception.DerivedTypedElementException; -import org.eclipse.emf.facet.efacet.core.internal.exception.DerivedTypedElementEvaluationException; -import org.eclipse.emf.facet.efacet.core.query.IQueryImplementation; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.DerivedTypedElement; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.ParameterValue; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.extensible.Query; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.query.NavigationQuery; - -public class NavigationQueryImplementation implements IQueryImplementation { - - // This class is a modified copy of : - // org.eclipse.emf.facet.infra.query.core.java.internal.JavaModelQueryAdapter - - private boolean checkResultType = false; - - public Object getValue(final Query query, final DerivedTypedElement feature, final EObject source, final List<ParameterValue> parameterValues, final IFacetManager facetManager) - throws DerivedTypedElementException { - final NavigationQuery navigationQuery = (NavigationQuery) query; - Object current = source; - for (final ETypedElement typedElement : navigationQuery.getPath()) { - if (current instanceof EObject) { - final EObject currentEObject = (EObject) current; - if (typedElement instanceof EOperation) { - final EOperation operation = (EOperation) typedElement; - try { - current = currentEObject.eInvoke(operation, null); - } catch (final InvocationTargetException e) { - throw new DerivedTypedElementEvaluationException("Invocation of " + operation.getName() + " failed.", e); //$NON-NLS-1$//$NON-NLS-2$ - } - } else if (typedElement instanceof EStructuralFeature) { - final EStructuralFeature structuralFeature = (EStructuralFeature) typedElement; - current = currentEObject.eGet(structuralFeature); - } else { - throw new DerivedTypedElementEvaluationException("The " + typedElement.eClass().getName() + " is not supported."); //$NON-NLS-1$//$NON-NLS-2$ - } - } else { - if (current != null || navigationQuery.isFailOnError()) { - throw new DerivedTypedElementEvaluationException("Invalid path"); //$NON-NLS-1$ - } - } - } - return current; - } - - public void setValue(final Query query, final DerivedTypedElement feature, final EObject source, final List<ParameterValue> parameterValues, final Object newValue) - throws DerivedTypedElementException { - throw new DerivedTypedElementEvaluationException("Not implemented"); //$NON-NLS-1$ - } - - public void setCheckResultType(final boolean checkResultType) { - this.checkResultType = checkResultType; - } - - public boolean isCheckResultType() { - return this.checkResultType; - } -}
diff --git a/org.eclipse.modisco.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/internal/query/NavigationQueryImplementationFactory.java b/org.eclipse.modisco.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/internal/query/NavigationQueryImplementationFactory.java deleted file mode 100644 index 44fadad..0000000 --- a/org.eclipse.modisco.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/internal/query/NavigationQueryImplementationFactory.java +++ /dev/null
@@ -1,35 +0,0 @@ -/** - * Copyright (c) 2011, 2012 Mia-Software. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Grégoire Dupé (Mia-Software) - Bug 366055 - NavigationQuery - * Gregoire Dupe (Mia-Software) - Bug 369987 - [Restructuring][Table] Switch to the new customization and facet framework - * Nicolas Bros (Mia-Software) - Bug 376941 - [EFacet] Facet operation arguments in Facet model - */ -package org.eclipse.emf.facet.efacet.core.internal.query; - -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.facet.efacet.core.IDerivedTypedElementManager; -import org.eclipse.emf.facet.efacet.core.exception.DerivedTypedElementException; -import org.eclipse.emf.facet.efacet.core.query.IQueryImplementation; -import org.eclipse.emf.facet.efacet.core.query.IQueryImplementationFactory; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.extensible.Query; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.query.QueryPackage; -import org.osgi.framework.Bundle; - -public class NavigationQueryImplementationFactory implements IQueryImplementationFactory { - - public EClass getManagedQueryType() { - return QueryPackage.eINSTANCE.getNavigationQuery(); - } - - public IQueryImplementation create(final Query query, final Bundle queryBundle, final IDerivedTypedElementManager manager) throws DerivedTypedElementException { - final NavigationQueryImplementation evaluator = new NavigationQueryImplementation(); - evaluator.setCheckResultType(true); - return evaluator; - } -}
diff --git a/org.eclipse.modisco.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/internal/query/NullLiteralQueryImplementation.java b/org.eclipse.modisco.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/internal/query/NullLiteralQueryImplementation.java deleted file mode 100644 index 9617193..0000000 --- a/org.eclipse.modisco.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/internal/query/NullLiteralQueryImplementation.java +++ /dev/null
@@ -1,46 +0,0 @@ -/** - * Copyright (c) 2012 Mia-Software. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Gregoire Dupe (Mia-Software) - Bug 369987 - [Restructuring][Table] Switch to the new customization and facet framework - * Nicolas Bros (Mia-Software) - Bug 376941 - [EFacet] Facet operation arguments in Facet model - */ -package org.eclipse.emf.facet.efacet.core.internal.query; - -import java.util.List; - -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.facet.efacet.core.IFacetManager; -import org.eclipse.emf.facet.efacet.core.exception.DerivedTypedElementException; -import org.eclipse.emf.facet.efacet.core.internal.exception.DerivedTypedElementEvaluationException; -import org.eclipse.emf.facet.efacet.core.query.IQueryImplementation; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.DerivedTypedElement; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.ParameterValue; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.extensible.Query; - -public class NullLiteralQueryImplementation implements IQueryImplementation { - - private boolean checkResultType = false; - - public Object getValue(final Query query, final DerivedTypedElement feature, final EObject source, final List<ParameterValue> parameterValues, final IFacetManager facetManager) - throws DerivedTypedElementException { - return null; - } - - public void setValue(final Query query, final DerivedTypedElement feature, final EObject source, final List<ParameterValue> parameterValues, final Object newValue) - throws DerivedTypedElementException { - throw new DerivedTypedElementEvaluationException("Not implemented"); //$NON-NLS-1$ - } - - public void setCheckResultType(final boolean checkResultType) { - this.checkResultType = checkResultType; - } - - public boolean isCheckResultType() { - return this.checkResultType; - } -}
diff --git a/org.eclipse.modisco.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/internal/query/NullLiteralQueryImplementationFactory.java b/org.eclipse.modisco.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/internal/query/NullLiteralQueryImplementationFactory.java deleted file mode 100644 index c4e437e..0000000 --- a/org.eclipse.modisco.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/internal/query/NullLiteralQueryImplementationFactory.java +++ /dev/null
@@ -1,35 +0,0 @@ -/** - * Copyright (c) 2012 Mia-Software. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Grégoire Dupé (Mia-Software) - Bug 369987 - [Restructuring][Table] Switch to the new customization and facet framework - * Nicolas Bros (Mia-Software) - Bug 376941 - [EFacet] Facet operation arguments in Facet model - */ -package org.eclipse.emf.facet.efacet.core.internal.query; - -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.facet.efacet.core.IDerivedTypedElementManager; -import org.eclipse.emf.facet.efacet.core.exception.DerivedTypedElementException; -import org.eclipse.emf.facet.efacet.core.query.IQueryImplementation; -import org.eclipse.emf.facet.efacet.core.query.IQueryImplementationFactory; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.extensible.Query; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.query.QueryPackage; -import org.osgi.framework.Bundle; - -public class NullLiteralQueryImplementationFactory implements IQueryImplementationFactory { - - public EClass getManagedQueryType() { - return QueryPackage.eINSTANCE.getNullLiteralQuery(); - } - - public IQueryImplementation create(final Query query, final Bundle queryBundle, final IDerivedTypedElementManager manager) throws DerivedTypedElementException { - final NullLiteralQueryImplementation evaluator = new NullLiteralQueryImplementation(); - evaluator.setCheckResultType(false); - return evaluator; - } - -}
diff --git a/org.eclipse.modisco.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/internal/query/OperationCallQueryImplementation.java b/org.eclipse.modisco.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/internal/query/OperationCallQueryImplementation.java deleted file mode 100644 index 42bb247..0000000 --- a/org.eclipse.modisco.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/internal/query/OperationCallQueryImplementation.java +++ /dev/null
@@ -1,68 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2012 CEA LIST. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Nicolas Bros (Mia-Software) - Bug 376941 - [EFacet] Facet operation arguments in Facet model - *******************************************************************************/ -package org.eclipse.emf.facet.efacet.core.internal.query; - -import java.util.ArrayList; -import java.util.List; - -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.facet.efacet.core.IDerivedTypedElementManager; -import org.eclipse.emf.facet.efacet.core.IFacetManager; -import org.eclipse.emf.facet.efacet.core.exception.DerivedTypedElementException; -import org.eclipse.emf.facet.efacet.core.exception.FacetManagerException; -import org.eclipse.emf.facet.efacet.core.internal.exception.DerivedTypedElementEvaluationException; -import org.eclipse.emf.facet.efacet.core.query.IQueryImplementation; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.DerivedTypedElement; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.ParameterValue; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.extensible.Query; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.query.OperationCallQuery; - -public class OperationCallQueryImplementation implements IQueryImplementation { - - private boolean checkResultType = false; - private final IDerivedTypedElementManager derivedTEManager; - - public OperationCallQueryImplementation(final IDerivedTypedElementManager derivedTEManager) { - this.derivedTEManager = derivedTEManager; - } - - public Object getValue(final Query query, final DerivedTypedElement feature, final EObject source, final List<ParameterValue> parameterValues, final IFacetManager facetManager) - throws DerivedTypedElementException { - Object result; - final OperationCallQuery opQuery = (OperationCallQuery) query; - final List<Object> operationArgs = new ArrayList<Object>(); - for (final Query queryArgument : opQuery.getArguments()) { - operationArgs.add(this.derivedTEManager.evaluate(queryArgument, source, parameterValues, facetManager)); - } - - // FIXME: no EditingDomain is available here - try { - result = facetManager.invoke(source, opQuery.getOperation(), null, null, operationArgs.toArray()); - } catch (final FacetManagerException e) { - throw new DerivedTypedElementEvaluationException("Operation call evaluation failed", e); //$NON-NLS-1$ - } - return result; - } - - public void setValue(final Query query, final DerivedTypedElement feature, final EObject source, final List<ParameterValue> parameterValues, final Object newValue) - throws DerivedTypedElementException { - throw new DerivedTypedElementEvaluationException("A set operation cannot be performed through an operation call."); //$NON-NLS-1$ - - } - - public void setCheckResultType(final boolean checkResultType) { - this.checkResultType = checkResultType; - } - - public boolean isCheckResultType() { - return this.checkResultType; - } -}
diff --git a/org.eclipse.modisco.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/internal/query/OperationCallQueryImplementationFactory.java b/org.eclipse.modisco.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/internal/query/OperationCallQueryImplementationFactory.java deleted file mode 100644 index 577c6bd..0000000 --- a/org.eclipse.modisco.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/internal/query/OperationCallQueryImplementationFactory.java +++ /dev/null
@@ -1,32 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2012 CEA LIST. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Nicolas Bros (Mia-Software) - Bug 376941 - [EFacet] Facet operation arguments in Facet model - *******************************************************************************/ -package org.eclipse.emf.facet.efacet.core.internal.query; - -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.facet.efacet.core.IDerivedTypedElementManager; -import org.eclipse.emf.facet.efacet.core.exception.DerivedTypedElementException; -import org.eclipse.emf.facet.efacet.core.query.IQueryImplementation; -import org.eclipse.emf.facet.efacet.core.query.IQueryImplementationFactory; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.extensible.Query; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.query.QueryPackage; -import org.osgi.framework.Bundle; - -public class OperationCallQueryImplementationFactory implements IQueryImplementationFactory { - - public EClass getManagedQueryType() { - return QueryPackage.eINSTANCE.getOperationCallQuery(); - } - - public IQueryImplementation create(final Query query, final Bundle queryBundle, final IDerivedTypedElementManager manager) - throws DerivedTypedElementException { - return new OperationCallQueryImplementation(manager); - } -}
diff --git a/org.eclipse.modisco.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/internal/query/QueryImplementationFactoryRegistry.java b/org.eclipse.modisco.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/internal/query/QueryImplementationFactoryRegistry.java deleted file mode 100644 index 752bfde..0000000 --- a/org.eclipse.modisco.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/internal/query/QueryImplementationFactoryRegistry.java +++ /dev/null
@@ -1,114 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2012 CEA LIST. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Nicolas Bros (Mia-Software) - Bug 376941 - [EFacet] Facet operation arguments in Facet model - *******************************************************************************/ -package org.eclipse.emf.facet.efacet.core.internal.query; - -import java.util.ArrayList; -import java.util.List; - -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IConfigurationElement; -import org.eclipse.core.runtime.IExtension; -import org.eclipse.core.runtime.IExtensionPoint; -import org.eclipse.core.runtime.IExtensionRegistry; -import org.eclipse.core.runtime.Platform; -import org.eclipse.emf.ecore.resource.Resource; -import org.eclipse.emf.facet.efacet.core.IDerivedTypedElementManager; -import org.eclipse.emf.facet.efacet.core.exception.DerivedTypedElementException; -import org.eclipse.emf.facet.efacet.core.internal.Activator; -import org.eclipse.emf.facet.efacet.core.query.IQueryImplementation; -import org.eclipse.emf.facet.efacet.core.query.IQueryImplementationFactory; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.extensible.Query; -import org.eclipse.emf.facet.util.core.Logger; -import org.eclipse.emf.facet.util.emf.core.ICatalogSetManagerFactory; -import org.osgi.framework.Bundle; - -public class QueryImplementationFactoryRegistry { - private static final String EXT_ID = "org.eclipse.emf.facet.efacet.core.queryImplementationRegistration"; //$NON-NLS-1$ - private static final String CLASS = "class"; //$NON-NLS-1$ - public static final QueryImplementationFactoryRegistry INSTANCE = new QueryImplementationFactoryRegistry(); - - private final List<IQueryImplementationFactory> factories = new ArrayList<IQueryImplementationFactory>(); - - public QueryImplementationFactoryRegistry() { - initRegisteredEntries(); - } - - private void initRegisteredEntries() { - final IExtensionRegistry registry = Platform.getExtensionRegistry(); - final IExtensionPoint extPoint = registry.getExtensionPoint(QueryImplementationFactoryRegistry.EXT_ID); - if (extPoint != null) { - for (final IExtension ext : extPoint.getExtensions()) { - for (final IConfigurationElement configElt : ext.getConfigurationElements()) { - try { - final Object impl = configElt.createExecutableExtension(QueryImplementationFactoryRegistry.CLASS); - if (impl instanceof IQueryImplementationFactory) { - final IQueryImplementationFactory factory = (IQueryImplementationFactory) impl; - this.factories.add(factory); - } else { - Logger.logError("Invalid extension in " + ext.getNamespaceIdentifier() + "." + //$NON-NLS-1$ //$NON-NLS-2$ - ". The factory must be an instance of " + IQueryImplementationFactory.class.getName(), Activator.getDefault()); //$NON-NLS-1$ - } - } catch (final CoreException e) { - Logger.logError(e, Activator.getDefault()); - } - } - } - } - } - - /** - * Returns the query evaluator that handles the given type of query - * - * @param query - * the type of query for which an {@link IQueryImplementation} is searched - * @return the {@link IQueryImplementation} - * @throws DerivedTypedElementException - * if no factory implementation was registered for the type of the given query - */ - public IQueryImplementation getEvaluatorFor(final Query query, final IDerivedTypedElementManager manager) - throws DerivedTypedElementException { - if (query == null) { - throw new IllegalArgumentException("query cannot be null"); //$NON-NLS-1$ - } - IQueryImplementation queryImpl = null; - boolean factoryFound = false; - for (final IQueryImplementationFactory queryImplFactory : this.factories) { - factoryFound = queryImplFactory.getManagedQueryType() == query.eClass(); - if (factoryFound) { - final Resource queryResource = query.eResource(); - Bundle bundle = null; - if (queryResource != null) { - bundle = ICatalogSetManagerFactory.DEFAULT.createICatalogSetManager(query.eResource().getResourceSet()).getBundleByResource(queryResource); - } - queryImpl = queryImplFactory.create(query, bundle, manager); - break; - } - } - if (!factoryFound) { - final StringBuffer buffer = new StringBuffer(); - buffer.append("No factory implementation found for "); //$NON-NLS-1$ - buffer.append(QueryUtils.getQueryDescription(query)); - buffer.append(".\nA factory should be registered through the "); //$NON-NLS-1$ - buffer.append(QueryImplementationFactoryRegistry.EXT_ID); - buffer.append(" extension point."); //$NON-NLS-1$ // NOPMD: cannot merge with extracted constant string - buffer.append("\nAvailable Query types are: "); //$NON-NLS-1$ - for (int i = 0; i < this.factories.size(); i++) { - if (i > 0) { - buffer.append(", "); //$NON-NLS-1$ - } - final IQueryImplementationFactory factory = this.factories.get(i); - buffer.append(factory.getManagedQueryType().getName()); - } - throw new DerivedTypedElementException(buffer.toString()); - } - return queryImpl; - } -}
diff --git a/org.eclipse.modisco.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/internal/query/QueryUtils.java b/org.eclipse.modisco.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/internal/query/QueryUtils.java deleted file mode 100644 index c015207..0000000 --- a/org.eclipse.modisco.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/internal/query/QueryUtils.java +++ /dev/null
@@ -1,121 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2011, 2012 Mia-Software - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Nicolas Bros (Mia-Software) - Bug 361612 - New core for new version of the Facet metamodel - * Nicolas Bros (Mia-Software) - Bug 362191 - [Restructuring] Query mechanism for eFacet2 - * Gregoire Dupe (Mia-Software) - Bug 373078 - API Cleaning - * Nicolas Bros (Mia-Software) - Bug 376941 - [EFacet] Facet operation arguments in Facet model - *******************************************************************************/ -package org.eclipse.emf.facet.efacet.core.internal.query; - -import org.eclipse.emf.ecore.EClassifier; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.ETypedElement; -import org.eclipse.emf.facet.efacet.core.FacetUtils; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.DerivedTypedElement; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.Facet; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.extensible.Query; - -public final class QueryUtils { - - private QueryUtils() { - // utility class - } - - /** @return a description to help identify this query in error messages */ - public static String getQueryDescription(final Query query) { - StringBuffer sb = new StringBuffer(); - sb.append("[Query eClass:"); //$NON-NLS-1$ - sb.append(query.eClass().getName()); - DerivedTypedElement owningDerivedTypedElement = QueryUtils - .getOwningDerivedTypedElement(query); - if (owningDerivedTypedElement != null) { - sb.append(" defined on "); //$NON-NLS-1$ - sb.append(owningDerivedTypedElement.getClass().getSimpleName()); - EClassifier eType = owningDerivedTypedElement.getEType(); - if (eType != null) { - sb.append(" of type '"); //$NON-NLS-1$ - sb.append(eType.getName()); - sb.append("' named: '"); //$NON-NLS-1$ - } else { - sb.append(" named: '"); //$NON-NLS-1$ - } - sb.append(owningDerivedTypedElement.getName()); - sb.append("'"); //$NON-NLS-1$ - } else { - sb.append(" with a null owning derived typed element"); //$NON-NLS-1$ - } - sb.append("]"); //$NON-NLS-1$ - return sb.toString(); - } - - // Moved from - // org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.extensible.impl.QueryImpl - public static EClassifier getReturnType(final Query query) { - EClassifier result = null; - final DerivedTypedElement owningDTE = QueryUtils - .getOwningDerivedTypedElement(query); - if (owningDTE != null) { - result = owningDTE.getEType(); - } - return result; - } - - // Moved from - // org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.extensible.impl.QueryImpl - public static EClassifier getSourceType(final Query query) { - EClassifier result = null; - final DerivedTypedElement owningDTE = QueryUtils - .getOwningDerivedTypedElement(query); - if (owningDTE != null) { - final EObject eContainer = QueryUtils.getOwningDerivedTypedElement( - query).eContainer(); - if (eContainer instanceof Facet) { - final Facet facet = (Facet) eContainer; - result = FacetUtils.getExtendedMetaclass(facet); - } else if (eContainer instanceof ETypedElement) { - final ETypedElement typedElement = (ETypedElement) eContainer; - result = typedElement.getEType(); - } - } - return result; - } - - // Moved from - // org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.extensible.impl.QueryImpl - public static DerivedTypedElement getOwningDerivedTypedElement( - final Query query) { - DerivedTypedElement result = null; - EObject container = query.eContainer(); - while (container != null) { - if (container instanceof DerivedTypedElement) { - result = (DerivedTypedElement) container; - break; - } - container = container.eContainer(); - } - if (result == null) { - throw new IllegalStateException( - "Query must always be contained by a DerivedTypedElement"); //$NON-NLS-1$ - } - return (DerivedTypedElement) container; - - } - - // Moved from - // org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.extensible.impl.QueryImpl - public static boolean isMany(final Query query) { - boolean result = false; - final DerivedTypedElement owningDTE = QueryUtils - .getOwningDerivedTypedElement(query); - if (owningDTE != null) { - result = owningDTE.isMany(); - } - return result; - } -}
diff --git a/org.eclipse.modisco.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/internal/query/StringLiteralQueryImplementation.java b/org.eclipse.modisco.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/internal/query/StringLiteralQueryImplementation.java deleted file mode 100644 index 90dae76..0000000 --- a/org.eclipse.modisco.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/internal/query/StringLiteralQueryImplementation.java +++ /dev/null
@@ -1,49 +0,0 @@ -/** - * Copyright (c) 2011, 2012 Mia-Software. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - Olivier Remaud (Soft-Maint) - Bug 369824 - Add a simple way to return string literal constants from a customization query - Gregoire Dupe (Mia-Software) - Bug 369987 - [Restructuring][Table] Switch to the new customization and facet framework - Nicolas Bros (Mia-Software) - Bug 376941 - [EFacet] Facet operation arguments in Facet model - */ - -package org.eclipse.emf.facet.efacet.core.internal.query; - -import java.util.List; - -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.facet.efacet.core.IFacetManager; -import org.eclipse.emf.facet.efacet.core.exception.DerivedTypedElementException; -import org.eclipse.emf.facet.efacet.core.internal.exception.DerivedTypedElementEvaluationException; -import org.eclipse.emf.facet.efacet.core.query.IQueryImplementation; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.DerivedTypedElement; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.ParameterValue; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.extensible.Query; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.query.StringLiteralQuery; - -public class StringLiteralQueryImplementation implements IQueryImplementation { - - private boolean checkResultType = false; - - public Object getValue(final Query query, final DerivedTypedElement feature, final EObject source, final List<ParameterValue> parameterValues, final IFacetManager facetManager) - throws DerivedTypedElementException { - return ((StringLiteralQuery) query).getValue(); - } - - public void setValue(final Query query, final DerivedTypedElement feature, final EObject source, final List<ParameterValue> parameterValues, final Object newValue) - throws DerivedTypedElementException { - throw new DerivedTypedElementEvaluationException("Not implemented"); //$NON-NLS-1$ - } - - public void setCheckResultType(final boolean checkResultType) { - this.checkResultType = checkResultType; - } - - public boolean isCheckResultType() { - return this.checkResultType; - } -}
diff --git a/org.eclipse.modisco.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/internal/query/StringLiteralQueryImplementationFactory.java b/org.eclipse.modisco.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/internal/query/StringLiteralQueryImplementationFactory.java deleted file mode 100644 index a079916..0000000 --- a/org.eclipse.modisco.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/internal/query/StringLiteralQueryImplementationFactory.java +++ /dev/null
@@ -1,36 +0,0 @@ -/** - * Copyright (c) 2011, 2012 Mia-Software. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - Olivier Remaud (Soft-Maint) - Bug 369824 - Add a simple way to return string literal constants from a customization query - Gregoire Dupe (Mia-Software) - Bug 369987 - [Restructuring][Table] Switch to the new customization and facet framework - Nicolas Bros (Mia-Software) - Bug 376941 - [EFacet] Facet operation arguments in Facet model - */ -package org.eclipse.emf.facet.efacet.core.internal.query; - -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.facet.efacet.core.IDerivedTypedElementManager; -import org.eclipse.emf.facet.efacet.core.exception.DerivedTypedElementException; -import org.eclipse.emf.facet.efacet.core.query.IQueryImplementation; -import org.eclipse.emf.facet.efacet.core.query.IQueryImplementationFactory; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.extensible.Query; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.query.QueryPackage; -import org.osgi.framework.Bundle; - -public class StringLiteralQueryImplementationFactory implements IQueryImplementationFactory { - - public EClass getManagedQueryType() { - return QueryPackage.eINSTANCE.getStringLiteralQuery(); - } - - public IQueryImplementation create(final Query query, final Bundle queryBundle, final IDerivedTypedElementManager manager) throws DerivedTypedElementException { - final StringLiteralQueryImplementation evaluator = new StringLiteralQueryImplementation(); - evaluator.setCheckResultType(true); - return evaluator; - } - -}
diff --git a/org.eclipse.modisco.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/internal/query/TrueLiteralQueryImplementation.java b/org.eclipse.modisco.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/internal/query/TrueLiteralQueryImplementation.java deleted file mode 100644 index 1040935..0000000 --- a/org.eclipse.modisco.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/internal/query/TrueLiteralQueryImplementation.java +++ /dev/null
@@ -1,48 +0,0 @@ -/** - * Copyright (c) 2012 Mia-Software. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Gregoire Dupe (Mia-Software) - Bug 369987 - [Restructuring][Table] Switch to the new customization and facet framework - * Nicolas Bros (Mia-Software) - Bug 376941 - [EFacet] Facet operation arguments in Facet model - */ -package org.eclipse.emf.facet.efacet.core.internal.query; - -import java.util.List; - -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.facet.efacet.core.IFacetManager; -import org.eclipse.emf.facet.efacet.core.exception.DerivedTypedElementException; -import org.eclipse.emf.facet.efacet.core.internal.exception.DerivedTypedElementEvaluationException; -import org.eclipse.emf.facet.efacet.core.query.IQueryImplementation; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.DerivedTypedElement; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.ParameterValue; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.extensible.Query; - -public class TrueLiteralQueryImplementation implements IQueryImplementation { - - private boolean checkResultType = false; - - public Object getValue(final Query query, final DerivedTypedElement feature, final EObject source, final List<ParameterValue> parameterValues, - final IFacetManager facetManager) - throws DerivedTypedElementException { - return Boolean.TRUE; - } - - public void setValue(final Query query, final DerivedTypedElement feature, final EObject source, final List<ParameterValue> parameterValues, - final Object newValue) - throws DerivedTypedElementException { - throw new DerivedTypedElementEvaluationException("Not implemented"); //$NON-NLS-1$ - } - - public void setCheckResultType(final boolean checkResultType) { - this.checkResultType = checkResultType; - } - - public boolean isCheckResultType() { - return this.checkResultType; - } -}
diff --git a/org.eclipse.modisco.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/internal/query/TrueLiteralQueryImplementationFactory.java b/org.eclipse.modisco.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/internal/query/TrueLiteralQueryImplementationFactory.java deleted file mode 100644 index afdb51b..0000000 --- a/org.eclipse.modisco.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/internal/query/TrueLiteralQueryImplementationFactory.java +++ /dev/null
@@ -1,36 +0,0 @@ -/** - * Copyright (c) 2012 Mia-Software. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Grégoire Dupé (Mia-Software) - Bug 369987 - [Restructuring][Table] Switch to the new customization and facet framework - * Nicolas Bros (Mia-Software) - Bug 376941 - [EFacet] Facet operation arguments in Facet model - */ -package org.eclipse.emf.facet.efacet.core.internal.query; - -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.facet.efacet.core.IDerivedTypedElementManager; -import org.eclipse.emf.facet.efacet.core.exception.DerivedTypedElementException; -import org.eclipse.emf.facet.efacet.core.query.IQueryImplementation; -import org.eclipse.emf.facet.efacet.core.query.IQueryImplementationFactory; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.extensible.Query; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.query.QueryPackage; -import org.osgi.framework.Bundle; - -public class TrueLiteralQueryImplementationFactory implements IQueryImplementationFactory { - - public IQueryImplementation create(final Query query, final Bundle bundle, final IDerivedTypedElementManager derivedTEManager) - throws DerivedTypedElementException { - final TrueLiteralQueryImplementation evaluator = new TrueLiteralQueryImplementation(); - evaluator.setCheckResultType(false); - return evaluator; - } - - public EClass getManagedQueryType() { - return QueryPackage.eINSTANCE.getTrueLiteralQuery(); - } - -}
diff --git a/org.eclipse.modisco.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/internal/serialization/ILinkToExtendedEObjectReference.java b/org.eclipse.modisco.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/internal/serialization/ILinkToExtendedEObjectReference.java deleted file mode 100644 index 9b015a2..0000000 --- a/org.eclipse.modisco.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/internal/serialization/ILinkToExtendedEObjectReference.java +++ /dev/null
@@ -1,33 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2011 Mia-Software - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Emmanuelle Rouillé (Mia-Software) - Bug 352618 - To be able to use non derived facet structural features and save them values. - *******************************************************************************/ -package org.eclipse.emf.facet.efacet.core.internal.serialization; - -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.serialization.ExtendedEObjectReference; - -/** - * Interface for the adapter that attaches {@link ExtendedEObjectReference} to {@link EObject}s. - * - * @since 0.2 - */ -public interface ILinkToExtendedEObjectReference { - - /** - * @return the current {@link ExtendedEObjectReference}. - */ - public ExtendedEObjectReference getExtendedEObjectReference(); - - /** - * Replace the current ExtendedEObjectReference by {@link ExtendedEObjectReference}. - */ - public void setExtendedEObjectReference(ExtendedEObjectReference extendedEObjectReference); - -}
diff --git a/org.eclipse.modisco.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/internal/serialization/ILinkToExtendedEObjectReferenceAdapterFactory.java b/org.eclipse.modisco.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/internal/serialization/ILinkToExtendedEObjectReferenceAdapterFactory.java deleted file mode 100644 index db43a0e..0000000 --- a/org.eclipse.modisco.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/internal/serialization/ILinkToExtendedEObjectReferenceAdapterFactory.java +++ /dev/null
@@ -1,40 +0,0 @@ -/** - * Copyright (c) 2011 Mia-Software. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Emmanuelle Rouillé (Mia-Software) - Bug 352618 - To be able to use non derived facet structural features and save them values. - */ -package org.eclipse.emf.facet.efacet.core.internal.serialization; - -import org.eclipse.emf.common.notify.Adapter; -import org.eclipse.emf.common.notify.AdapterFactory; -import org.eclipse.emf.common.notify.Notifier; - -/** - * Factory to create {@link ILinkToExtendedEObjectReference} adapters. - * - */ -public interface ILinkToExtendedEObjectReferenceAdapterFactory extends AdapterFactory { - - /** - * Singleton {@link LinkToExtendedEObjectReferenceAdapterFactory} - */ - public static ILinkToExtendedEObjectReferenceAdapterFactory INSTANCE = new LinkToExtendedEObjectReferenceAdapterFactory(); - - /** - * This method returns <code>true</code> if this factory is a factory for the given type - * {@link Object}, or <code>false</code> otherwise - */ - public boolean isFactoryForType(final Object type); - - /** - * Creates a new instance of Adapter for the given {@link Notifier} - */ - public Adapter createAdapter(final Notifier target); - -}
diff --git a/org.eclipse.modisco.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/internal/serialization/LinkToExtendedEObjectReferenceAdapter.java b/org.eclipse.modisco.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/internal/serialization/LinkToExtendedEObjectReferenceAdapter.java deleted file mode 100644 index e04dfea..0000000 --- a/org.eclipse.modisco.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/internal/serialization/LinkToExtendedEObjectReferenceAdapter.java +++ /dev/null
@@ -1,34 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2011 Mia-Software - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Emmanuelle Rouillé (Mia-Software) - Bug 352618 - To be able to use non derived facet structural features and save them values. - *******************************************************************************/ -package org.eclipse.emf.facet.efacet.core.internal.serialization; - -import org.eclipse.emf.common.notify.impl.AdapterImpl; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.serialization.ExtendedEObjectReference; - -public class LinkToExtendedEObjectReferenceAdapter extends AdapterImpl implements - ILinkToExtendedEObjectReference { - - private ExtendedEObjectReference extendedEObjectReference; - - public ExtendedEObjectReference getExtendedEObjectReference() { - return this.extendedEObjectReference; - } - - public void setExtendedEObjectReference(final ExtendedEObjectReference extendedEObjectReference) { - this.extendedEObjectReference = extendedEObjectReference; - } - - @Override - public boolean isAdapterForType(final Object type) { - return type == ILinkToExtendedEObjectReference.class; - } - -}
diff --git a/org.eclipse.modisco.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/internal/serialization/LinkToExtendedEObjectReferenceAdapterFactory.java b/org.eclipse.modisco.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/internal/serialization/LinkToExtendedEObjectReferenceAdapterFactory.java deleted file mode 100644 index 3c45740..0000000 --- a/org.eclipse.modisco.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/internal/serialization/LinkToExtendedEObjectReferenceAdapterFactory.java +++ /dev/null
@@ -1,29 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2011 Mia-Software - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Emmanuelle Rouillé (Mia-Software) - Bug 352618 - To be able to use non derived facet structural features and save them values. - *******************************************************************************/ -package org.eclipse.emf.facet.efacet.core.internal.serialization; - -import org.eclipse.emf.common.notify.Adapter; -import org.eclipse.emf.common.notify.Notifier; -import org.eclipse.emf.common.notify.impl.AdapterFactoryImpl; - -public class LinkToExtendedEObjectReferenceAdapterFactory extends AdapterFactoryImpl implements ILinkToExtendedEObjectReferenceAdapterFactory { - - @Override - public boolean isFactoryForType(final Object type) { - return type == ILinkToExtendedEObjectReference.class; - } - - @Override - public Adapter createAdapter(final Notifier target) { - return new LinkToExtendedEObjectReferenceAdapter(); - } - -}
diff --git a/org.eclipse.modisco.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/internal/serialization/SerializationManager.java b/org.eclipse.modisco.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/internal/serialization/SerializationManager.java deleted file mode 100644 index c1e7ccc..0000000 --- a/org.eclipse.modisco.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/internal/serialization/SerializationManager.java +++ /dev/null
@@ -1,576 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2011, 2016 Mia-Software, and Soft-Maint. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Emmanuelle Rouillé (Mia-Software) - Bug 352618 - To be able to use non derived facet structural features and save them values. - * Nicolas Bros (Mia-Software) - Bug 361612 - New core for new version of the Facet metamodel - * Grégoire Dupé (Mia-Software) - Bug 361612 - [Restructuring] New core for new version of the Facet metamodel - * Jonathan Pepin (Soft-Maint) - Bug 463898 - Create FacetReference not derived, without query and with opposite mechanism - * Jonathan Pepin (Soft-Maint) - Bug 463907 - Command for load and save Facet serialization - * Jonathan Pepin (Soft-Maint) - Bug 464069 - Applying facet inferred from attribute and reference instances contained in facet serialisation model - * Grégoire Dupé (Mia-Software) - Bug 464069 - Applying facet inferred from attribute and reference instances contained in facet serialisation model - * Jonathan Pepin (Soft-Maint) - Bug 473217 - On SerializationManager getMultiValuedStructuralFeature create ExtendedEObjectReference despite empty instances - * Jonathan Pepin (Soft-Maint) - Bug 473673 - Applying facet inferred from fopposite reference - * Jonathan Pepin (Soft-Maint) - Bug 509427 - Facet attribute always returned null instead of default value - * Jonathan Pepin (Soft-Maint) - Bug 509605 - NullPointerException on SerializationManager getSingleValuedStructuralFeature - * Jonathan Pepin (Soft-Maint) - Bug 510034 - Null value is wrongly casted in a new list - *******************************************************************************/ -package org.eclipse.emf.facet.efacet.core.internal.serialization; - -import java.io.IOException; -import java.util.Collection; -import java.util.Collections; -import java.util.List; - -import org.eclipse.emf.common.notify.Adapter; -import org.eclipse.emf.common.util.EList; -import org.eclipse.emf.ecore.EAttribute; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.EReference; -import org.eclipse.emf.ecore.EStructuralFeature; -import org.eclipse.emf.ecore.resource.Resource; -import org.eclipse.emf.facet.efacet.core.IFacetManager; -import org.eclipse.emf.facet.efacet.core.internal.CastUtils; -import org.eclipse.emf.facet.efacet.core.internal.FacetManagerInternalUtils; -import org.eclipse.emf.facet.efacet.core.internal.exception.SaveStructuralFeatureInstanceModelException; -import org.eclipse.emf.facet.efacet.core.internal.exception.UnmatchingExpectedTypeException; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.serialization.AbstractAttributeInstance; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.serialization.AbstractReferenceInstance; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.serialization.ExtendedEObjectReference; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.serialization.MultiValuedAttributeInstance; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.serialization.MultiValuedContainmentReferenceInstance; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.serialization.MultiValuedReferenceInstance; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.serialization.SerializationFactory; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.serialization.SingleValuedAttributeInstance; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.serialization.SingleValuedContainmentReferenceInstance; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.serialization.SingleValuedReferenceInstance; - -public class SerializationManager { - - private Resource sfInstResource; - private final IFacetManager facetManager; - - public SerializationManager( - final Resource sfInstResource, - final IFacetManager facetManager) { - this.facetManager = facetManager; - setSerializationResource(sfInstResource); - } - - /** - * This method creates a ReferenceInstance in the given {@link ExtendedEObjectReference} with - * the reference {@link EStructuralFeature} and the value {@link Object}. - */ - private static MultiValuedContainmentReferenceInstance createMultiValuedContainmentReferenceInstance(final EReference reference, - final List<EObject> values, - final ExtendedEObjectReference extendedEObjRef) { - final MultiValuedContainmentReferenceInstance containmentRI = SerializationFactory.eINSTANCE - .createMultiValuedContainmentReferenceInstance(); - containmentRI.setEReference(reference); - if (values != null) { - containmentRI.getOwnedElements().addAll(values); - } - extendedEObjRef.getReferenceInstances().add(containmentRI); - return containmentRI; - } - - /** - * This method returns the {@link ExtendedEObjectReference} associated with the given - * {@link EObject} if it exists or <code>null</code> if it does not exist. - */ - private static ExtendedEObjectReference getExtendedEObjectReference(final EObject eObject) { - ExtendedEObjectReference result = null; - for (final Adapter adapter : eObject.eAdapters()) { - if (adapter.isAdapterForType(ILinkToExtendedEObjectReference.class)) { - final LinkToExtendedEObjectReferenceAdapter castedAdapter = (LinkToExtendedEObjectReferenceAdapter) adapter; - result = castedAdapter.getExtendedEObjectReference(); - break; - } - } - return result; - } - - /** - * This method creates an AttributeInstance in the given {@link ExtendedEObjectReference} with - * the attribute {@link EStructuralFeature} and the value {@link Object}. - */ - private static MultiValuedAttributeInstance createMultiValuedAttributeInstance(final EAttribute attribute, final List<Object> values, - final ExtendedEObjectReference extendedEObjRef) { - final MultiValuedAttributeInstance attributeInstance = SerializationFactory.eINSTANCE.createMultiValuedAttributeInstance(); - attributeInstance.setEAttribute(attribute); - if (values != null) { - attributeInstance.getValues().addAll(values); - } - final EList<AbstractAttributeInstance> attInstances = extendedEObjRef - .getAttributeInstances(); - attInstances.add(attributeInstance); - return attributeInstance; - } - - /** - * This method creates a ReferenceInstance in the given {@link ExtendedEObjectReference} with - * the reference {@link EStructuralFeature} and the value {@link Object}. - */ - private static MultiValuedReferenceInstance createMultiValuedReferenceInstance( - final EReference reference, final Collection<EObject> values, - final ExtendedEObjectReference extendedEObjRef) { - final MultiValuedReferenceInstance referenceInstance = SerializationFactory.eINSTANCE - .createMultiValuedReferenceInstance(); - referenceInstance.setEReference(reference); - if (values != null) { - referenceInstance.getReferencedElements().addAll(values); - } - extendedEObjRef.getReferenceInstances().add(referenceInstance); - return referenceInstance; - } - - private static SingleValuedAttributeInstance getSingleValuedAttributeInstance( - final ExtendedEObjectReference extendedEObjRef, - final EAttribute eAttribute) { - SingleValuedAttributeInstance result = null; - final EList<AbstractAttributeInstance> attInstances = extendedEObjRef.getAttributeInstances(); - for (final AbstractAttributeInstance attributeInstance : attInstances) { - if (eAttribute.equals(attributeInstance.getEAttribute())) { - if (attributeInstance instanceof SingleValuedAttributeInstance) { - result = (SingleValuedAttributeInstance) attributeInstance; - break; - } - throw new IllegalStateException("single valued attribute should be associated to an instance of SingleValuedAttributeInstance"); //$NON-NLS-1$ - } - } - return result; - } - - private static MultiValuedAttributeInstance getMultiValuedAttributeInstance( - final ExtendedEObjectReference extendedEObjRef, - final EAttribute eAttribute) { - MultiValuedAttributeInstance result = null; - final EList<AbstractAttributeInstance> attInstances = extendedEObjRef.getAttributeInstances(); - for (final AbstractAttributeInstance attributeInstance : attInstances) { - if (eAttribute.equals(attributeInstance.getEAttribute())) { - if (attributeInstance instanceof MultiValuedAttributeInstance) { - result = (MultiValuedAttributeInstance) attributeInstance; - break; - } - throw new IllegalStateException("multi valued attribute should be associated to an instance of MultiValuedAttributeInstance"); //$NON-NLS-1$ - - } - } - return result; - } - - private static SingleValuedReferenceInstance getSingleValuedReferenceInstance( - final ExtendedEObjectReference extendedEObjRef, - final EReference eReference) { - SingleValuedReferenceInstance result = null; - final EList<AbstractReferenceInstance> refInstances = extendedEObjRef.getReferenceInstances(); - for (final AbstractReferenceInstance referenceInstance : refInstances) { - if (eReference.equals(referenceInstance.getEReference())) { - if (referenceInstance instanceof SingleValuedReferenceInstance) { - result = (SingleValuedReferenceInstance) referenceInstance; - break; - } - throw new IllegalStateException( - "a single valued non-containment reference should be associated to an instance of SingleValuedReferenceInstance"); //$NON-NLS-1$ - } - } - return result; - } - - private static SingleValuedContainmentReferenceInstance getSingleValuedContainmentReferenceInstance( - final ExtendedEObjectReference extendedEObjRef, - final EReference eReference) { - SingleValuedContainmentReferenceInstance result = null; - final EList<AbstractReferenceInstance> refInstances = extendedEObjRef.getReferenceInstances(); - for (final AbstractReferenceInstance referenceInstance : refInstances) { - if (eReference.equals(referenceInstance.getEReference())) { - if (referenceInstance instanceof SingleValuedContainmentReferenceInstance) { - result = (SingleValuedContainmentReferenceInstance) referenceInstance; - break; - } - throw new IllegalStateException( - "a single valued containment reference should be associated to an instance of SingleValuedContainmentReferenceInstance"); //$NON-NLS-1$ - } - } - return result; - } - - private static MultiValuedReferenceInstance getMultiValuedReferenceInstance( - final ExtendedEObjectReference extendedEObjRef, - final EReference eReference) { - MultiValuedReferenceInstance result = null; - final EList<AbstractReferenceInstance> refInstances = extendedEObjRef - .getReferenceInstances(); - for (final AbstractReferenceInstance referenceInstance : refInstances) { - if (eReference.equals(referenceInstance.getEReference())) { - if (referenceInstance instanceof MultiValuedReferenceInstance) { - result = (MultiValuedReferenceInstance) referenceInstance; - break; - } - throw new IllegalStateException( - "a multi valued non-containment reference should be associated to an instance of MultiValuedReferenceInstance"); //$NON-NLS-1$ - } - } - return result; - } - - private static MultiValuedContainmentReferenceInstance getMultiValuedContainmentReferenceInstance( - final ExtendedEObjectReference extendedEObjRef, - final EReference eReference) { - MultiValuedContainmentReferenceInstance result = null; - final EList<AbstractReferenceInstance> refInstances = extendedEObjRef.getReferenceInstances(); - for (final AbstractReferenceInstance referenceInstance : refInstances) { - if (eReference.equals(referenceInstance.getEReference())) { - if (referenceInstance instanceof MultiValuedContainmentReferenceInstance) { - result = (MultiValuedContainmentReferenceInstance) referenceInstance; - break; - } - throw new IllegalStateException( - "a multi valued containment reference should be associated to an instance of MultiValuedContainmentReferenceInstance"); //$NON-NLS-1$ - } - } - return result; - } - - public void saveStructuralFeatureInstanceModel() - throws SaveStructuralFeatureInstanceModelException { - if (this.sfInstResource == null) { - throw new SaveStructuralFeatureInstanceModelException("This facet manager has been initailized with a null structural feature instances resource"); //$NON-NLS-1$ - } - try { - this.sfInstResource.save(Collections.EMPTY_MAP); - } catch (final IOException e) { - throw new SaveStructuralFeatureInstanceModelException(e); - } - } - - /** - * This method returns the ExtendedEObjectReference associated with the given {@link EObject} if - * it exists or creates it if it does not exist. - */ - private ExtendedEObjectReference getOrCreateExtendedEObjectReference(final EObject eObject) { - ExtendedEObjectReference extendedEObjRef = SerializationManager - .getExtendedEObjectReference(eObject); - if (extendedEObjRef == null) { - extendedEObjRef = SerializationFactory.eINSTANCE.createExtendedEObjectReference(); - extendedEObjRef.setExtendedEObject(eObject); - if (this.sfInstResource != null) { - this.sfInstResource.getContents().add(extendedEObjRef); - } - final LinkToExtendedEObjectReferenceAdapter adapter = (LinkToExtendedEObjectReferenceAdapter) ILinkToExtendedEObjectReferenceAdapterFactory.INSTANCE - .adapt(eObject, ILinkToExtendedEObjectReference.class); - adapter.setExtendedEObjectReference(extendedEObjRef); - } - return extendedEObjRef; - } - - public void setAttribute(final EObject eObject, final EAttribute attribute, - final Object newValue) { - final ExtendedEObjectReference extendedEObjRef = this - .getOrCreateExtendedEObjectReference(eObject); - if (attribute.isMany()) { - if (newValue instanceof List) { - // safe to cast - @SuppressWarnings("unchecked") - final List<Object> list = (List<Object>) newValue; - final MultiValuedAttributeInstance attributeInstance = SerializationManager - .getMultiValuedAttributeInstance(extendedEObjRef, - attribute); - if (attributeInstance == null) { - SerializationManager.createMultiValuedAttributeInstance( - attribute, list, extendedEObjRef); - } else { - attributeInstance.getValues().clear(); - attributeInstance.getValues().addAll(list); - } - } else { - throw new IllegalArgumentException("The given FacetAttribute is multiplicity-many, so the value must be a List"); //$NON-NLS-1$ - } - } else { - final SingleValuedAttributeInstance attributeInstance = SerializationManager - .getSingleValuedAttributeInstance(extendedEObjRef, - attribute); - if (attributeInstance == null) { - createSingleValuedAttributeInstance(attribute, newValue, - extendedEObjRef); - } else { - attributeInstance.setValue(newValue); - } - } - - } - - - /** - * This method creates an AttributeInstance in the given {@link ExtendedEObjectReference} with - * the attribute {@link EStructuralFeature} and the value {@link Object}. - */ - private static SingleValuedAttributeInstance createSingleValuedAttributeInstance(final EAttribute attribute, final Object value, - final ExtendedEObjectReference extendedEObjRef) { - final SingleValuedAttributeInstance attributeInstance = SerializationFactory.eINSTANCE - .createSingleValuedAttributeInstance(); - attributeInstance.setEAttribute(attribute); - attributeInstance.setValue(value); - extendedEObjRef.getAttributeInstances().add(attributeInstance); - return attributeInstance; - } - - /** - * This method creates a ReferenceInstance in the given {@link ExtendedEObjectReference} with - * the reference {@link EStructuralFeature} and the value {@link Object}. - */ - private static SingleValuedReferenceInstance createSingleValuedReferenceInstance(final EReference reference, final EObject value, - final ExtendedEObjectReference extendedEObjRef) { - final SingleValuedReferenceInstance referenceInstance = SerializationFactory.eINSTANCE - .createSingleValuedReferenceInstance(); - referenceInstance.setEReference(reference); - referenceInstance.setReferencedElement(value); - final EList<AbstractReferenceInstance> refInstances = extendedEObjRef - .getReferenceInstances(); - refInstances.add(referenceInstance); - return referenceInstance; - } - - public void clearReference(final EObject eObject, final EReference reference) { - final ExtendedEObjectReference extendedEObjRef = this - .getOrCreateExtendedEObjectReference(eObject); - if (reference.isMany()) { - final MultiValuedReferenceInstance mValuedRefInst = getMultiValuedReferenceInstance( - extendedEObjRef, reference); - if (mValuedRefInst != null) { - mValuedRefInst.getReferencedElements().clear(); - } - } else { - if (reference.isContainment()) { - final SingleValuedContainmentReferenceInstance referenceInstance = SerializationManager - .getSingleValuedContainmentReferenceInstance( - extendedEObjRef, reference); - if (referenceInstance != null) { - referenceInstance.setOwnedElement(null); - } - } else { - final SingleValuedReferenceInstance referenceInstance = SerializationManager - .getSingleValuedReferenceInstance(extendedEObjRef, - reference); - if (referenceInstance != null) { - referenceInstance.setReferencedElement(null); - } - } - } - } - - public void setReference(final EObject eObject, final EReference reference, final Object newValue) { - final ExtendedEObjectReference extendedEObjRef = this - .getOrCreateExtendedEObjectReference(eObject); - if (reference.isMany()) { - Collection<EObject> newList; - try { - newList = CastUtils.castToExpectedListType( - newValue, EObject.class, false); - } catch (UnmatchingExpectedTypeException e) { - final String message = String.format( - "The reference %s.%s is multivaluted, that's why the new value must be a list of EObjet.", //$NON-NLS-1$ - reference.getName(), - reference.getEContainingClass().getName()); - throw new IllegalArgumentException(message, e); - } - final MultiValuedReferenceInstance mValuedRefInst = - getMultiValuedReferenceInstance( - extendedEObjRef, - reference); - if (mValuedRefInst == null) { - createMultiValuedReferenceInstance(reference, newList, extendedEObjRef); - } else { - mValuedRefInst.getReferencedElements().clear(); - mValuedRefInst.getReferencedElements().addAll(newList); - } - } else { - if (newValue != null && !(newValue instanceof EObject)) { - throw new IllegalArgumentException("newValue should be an EObject because eStructuralFeature is an EReference"); //$NON-NLS-1$ - } - final EObject newEObjectValue = (EObject) newValue; - if (reference.isContainment()) { - final SingleValuedContainmentReferenceInstance referenceInstance = - SerializationManager.getSingleValuedContainmentReferenceInstance( - extendedEObjRef, - reference); - if (referenceInstance == null) { - createSingleValuedContainmentReferenceInstance( - reference, newEObjectValue, extendedEObjRef); - } else { - referenceInstance.setOwnedElement(newEObjectValue); - } - } else { - final SingleValuedReferenceInstance referenceInstance = - SerializationManager.getSingleValuedReferenceInstance( - extendedEObjRef, reference); - if (referenceInstance == null) { - createSingleValuedReferenceInstance( - reference, newEObjectValue, extendedEObjRef); - } else { - referenceInstance.setReferencedElement(newEObjectValue); - } - } - } - } - - /** - * This method creates a ReferenceInstance in the given {@link ExtendedEObjectReference} with - * the reference {@link EStructuralFeature} and the value {@link Object}. - */ - private static SingleValuedContainmentReferenceInstance createSingleValuedContainmentReferenceInstance(final EReference reference, - final EObject value, - final ExtendedEObjectReference extendedEObjRef) { - final SingleValuedContainmentReferenceInstance containmentRefI = SerializationFactory.eINSTANCE - .createSingleValuedContainmentReferenceInstance(); - containmentRefI.setEReference(reference); - containmentRefI.setOwnedElement(value); - extendedEObjRef.getReferenceInstances().add(containmentRefI); - return containmentRefI; - } - - private static List<?> getMultiValuedStructuralFeature( - final EObject eObject, final EStructuralFeature structuralFeature) { - List<?> result = null; - final ExtendedEObjectReference extendedEObjRef = SerializationManager.getExtendedEObjectReference(eObject); - if (extendedEObjRef == null) { - result = Collections.emptyList(); - } else { - if (structuralFeature instanceof EAttribute) { - final EAttribute eAttribute = (EAttribute) structuralFeature; - final MultiValuedAttributeInstance attributeInstance = SerializationManager - .getMultiValuedAttributeInstance(extendedEObjRef, - eAttribute); - if (attributeInstance != null) { - result = attributeInstance.getValues(); - } - } else if (structuralFeature instanceof EReference) { - final EReference eReference = (EReference) structuralFeature; - if (eReference.isContainment()) { - MultiValuedContainmentReferenceInstance referenceInstance = SerializationManager - .getMultiValuedContainmentReferenceInstance( - extendedEObjRef, eReference); - if (referenceInstance == null) { - referenceInstance = SerializationManager - .createMultiValuedContainmentReferenceInstance( - eReference, null, extendedEObjRef); - result = referenceInstance.getOwnedElements(); - } else { - result = referenceInstance.getOwnedElements(); - } - } else { - MultiValuedReferenceInstance referenceInstance = SerializationManager - .getMultiValuedReferenceInstance(extendedEObjRef, - eReference); - if (referenceInstance == null) { - referenceInstance = SerializationManager - .createMultiValuedReferenceInstance(eReference, - null, extendedEObjRef); - result = referenceInstance.getReferencedElements(); - } else { - result = referenceInstance.getReferencedElements(); - } - } - } else { - final String message = String.format( - "Getting a structural feature of type '%s' is not implemented", //$NON-NLS-1$ - structuralFeature.getClass().getName()); - throw new UnsupportedOperationException(message); - } - } - return result; - } - - private static Object getSingleValuedStructuralFeature(final EObject eObject, final EStructuralFeature structuralFeature) { - Object result = structuralFeature.getDefaultValue(); - final ExtendedEObjectReference extendedEObjRef = SerializationManager - .getExtendedEObjectReference(eObject); - if (extendedEObjRef != null) { - if (structuralFeature instanceof EAttribute) { - final EAttribute eAttribute = (EAttribute) structuralFeature; - final SingleValuedAttributeInstance attributeInstance = SerializationManager - .getSingleValuedAttributeInstance(extendedEObjRef, - eAttribute); - if (attributeInstance != null) { - result = attributeInstance.getValue(); - } - } else if (structuralFeature instanceof EReference) { - final EReference eReference = (EReference) structuralFeature; - if (eReference.isContainment()) { - final SingleValuedContainmentReferenceInstance referenceInstance = SerializationManager - .getSingleValuedContainmentReferenceInstance( - extendedEObjRef, eReference); - if (referenceInstance != null) { - result = referenceInstance.getOwnedElement(); - } - } else { - final SingleValuedReferenceInstance referenceInstance = SerializationManager - .getSingleValuedReferenceInstance(extendedEObjRef, - eReference); - if (referenceInstance != null) { - result = referenceInstance.getReferencedElement(); - } - } - } else { - throw new IllegalArgumentException("Unexpected structuralFeature kind"); //$NON-NLS-1$ - } - } - return result; - } - - public static Object getNotDerivedValue(final EObject eObject, - final EStructuralFeature structuralFeature) { - Object result; - if (structuralFeature.isMany()) { - result = SerializationManager.getMultiValuedStructuralFeature( - eObject, structuralFeature); - } else { - result = SerializationManager.getSingleValuedStructuralFeature(eObject, structuralFeature); - } - return result; - } - - public Resource getSerializationResource() { - return this.sfInstResource; - } - - public final void setSerializationResource(final Resource resource) { - this.sfInstResource = resource; - if (this.sfInstResource != null) { - final EList<EObject> contents = this.sfInstResource.getContents(); - for (EObject eObject : contents) { - if (eObject instanceof ExtendedEObjectReference) { - final ExtendedEObjectReference extendedEObjRef = (ExtendedEObjectReference) eObject; - final EObject extendedEObject = extendedEObjRef.getExtendedEObject(); - final LinkToExtendedEObjectReferenceAdapter adapter = - (LinkToExtendedEObjectReferenceAdapter) ILinkToExtendedEObjectReferenceAdapterFactory - .INSTANCE.adapt( - extendedEObject, - ILinkToExtendedEObjectReference.class); - adapter.setExtendedEObjectReference(extendedEObjRef); - final EList<AbstractAttributeInstance> attInstances = extendedEObjRef - .getAttributeInstances(); - for (final AbstractAttributeInstance attributeInstance : attInstances) { - final EAttribute attribute = attributeInstance - .getEAttribute(); - FacetManagerInternalUtils.loadParentFacetSet(attribute, - this.facetManager); - } - final EList<AbstractReferenceInstance> refInstances = extendedEObjRef - .getReferenceInstances(); - for (final AbstractReferenceInstance referenceInstance : refInstances) { - final EReference reference = referenceInstance - .getEReference(); - FacetManagerInternalUtils.loadParentFacetSet(reference, - this.facetManager); - } - } - } - } - } - -}
diff --git a/org.eclipse.modisco.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/query/IQueryCollectionImplementation.java b/org.eclipse.modisco.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/query/IQueryCollectionImplementation.java deleted file mode 100644 index 7ab82c0..0000000 --- a/org.eclipse.modisco.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/query/IQueryCollectionImplementation.java +++ /dev/null
@@ -1,97 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2012 CEA LIST. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Nicolas Bros (Mia-Software) - Bug 376941 - [EFacet] Facet operation arguments in Facet model - *******************************************************************************/ -package org.eclipse.emf.facet.efacet.core.query; - -import java.util.Collection; -import java.util.List; - -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.ETypedElement; -import org.eclipse.emf.facet.efacet.core.exception.DerivedTypedElementException; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.DerivedTypedElement; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.FacetOperation; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.ParameterValue; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.extensible.Query; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.runtime.ETypedElementEObjectListResult; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.runtime.ETypedElementEObjectResult; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.runtime.ETypedElementPrimitiveTypeListResult; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.runtime.ETypedElementPrimitiveTypeResult; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.runtime.ETypedElementResult; - -/** - * This interface can be implemented by EMF Facet query implementations that want to handle multiple evaluation - * themselves, presumably to improve the performance of the evaluation. - * <p> - * If only {@link IQueryImplementation} is implemented, then the framework will perform multiple-evaluation by calling - * the single evaluation multiple times, which may be slow in the case of high-latency implementations. - * - * @since 0.2 - */ -public interface IQueryCollectionImplementation extends IQueryImplementation { - - /** - * This method must be implemented by each sub-class to evaluate a query on a collection of elements. The query - * should be evaluated on each of the elements in the given collection. - * <p> - * This method should throw a {@link DerivedTypedElementException} only if the eTypedElement is an incorrect - * {@link DerivedTypedElement}. But it must not throw an exception if the evaluation of one element fails. Instead, - * it must set the exception on the corresponding result ({@link ETypedElementResult#setException(Throwable)}). - * - * @param query - * The query to evaluate - * @param eTypedElement - * The feature or operation to get on the sources - * @param sources - * The model elements on which the feature or operation is evaluated using the query - * @param arguments - * The parameter values for the eTypedElement (in the case of a {@link FacetOperation}); can be - * <code>null</code> - * @return the result : - * <ul> - * <li> a list of {@link ETypedElementPrimitiveTypeResult} if the eTypedElement is single-valued and returns - * a primitive type <li> a list of {@link ETypedElementPrimitiveTypeListResult} if the eTypedElement is - * multi-valued and returns a primitive type <li> a list of {@link ETypedElementEObjectResult} if the - * eTypedElement is single-valued and returns a model element <li> a list of - * {@link ETypedElementEObjectListResult} if the eTypedElement is multi-valued and returns model elements - * </ul> - * @throws DerivedTypedElementException - * if the given derivedTypedElement is incorrect - */ - List<? extends ETypedElementResult> getValues(Query query, ETypedElement eTypedElement, Collection<? extends EObject> sources, - List<ParameterValue> arguments) - throws DerivedTypedElementException; - - /** - * This method must be implemented by each sub-class to set the values of a collection of elements. The query should - * be used to set the value of each of the elements in the given collection. - * - * @param query - * The query to evaluate - * @param feature - * The derived typed element to set - * @param sources - * The model elements on which the query is evaluated - * @param arguments - * The parameter values for the derived typed element (in the case of a {@link FacetOperation}); can be - * <code>null</code> - * @param newValues - * the new values for the sources; the size of this list must match the size of the list of sources - * @throws DerivedTypedElementException - * if the given derivedTypedElement is incorrect - * @throws DerivedTypedElementEvaluationException - * if the query could not be evaluated correctly - * @throws IllegalArgumentException - * if the given list of values does not match the list of sources - */ - void setValues(Query query, DerivedTypedElement feature, Collection<? extends EObject> sources, List<ParameterValue> arguments, - List<? extends Object> newValues) - throws DerivedTypedElementException; -}
diff --git a/org.eclipse.modisco.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/query/IQueryImplementation.java b/org.eclipse.modisco.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/query/IQueryImplementation.java deleted file mode 100644 index 2fe5aaa..0000000 --- a/org.eclipse.modisco.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/query/IQueryImplementation.java +++ /dev/null
@@ -1,85 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2012 CEA LIST. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Nicolas Bros (Mia-Software) - Bug 376941 - [EFacet] Facet operation arguments in Facet model - *******************************************************************************/ -package org.eclipse.emf.facet.efacet.core.query; - -import java.util.List; - -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.facet.efacet.core.IFacetManager; -import org.eclipse.emf.facet.efacet.core.exception.DerivedTypedElementException; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.DerivedTypedElement; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.FacetOperation; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.ParameterValue; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.extensible.Query; - -/** - * Interface implemented by all EMF Facet query evaluators. - * <p> - * A query evaluator may choose to implement {@link IQueryCollectionImplementation} instead if it wants to improve the - * performance of evaluation on collections of elements. - * - * @since 0.2 - */ -public interface IQueryImplementation { - - /** - * This method must be implemented by each sub class to evaluate a query - * - * @param query - * The query to evaluate - * @param feature - * The feature or operation to get on the source - * @param source - * The model element on which the query is evaluated - * @param parameterValues - * The derived typed element's query parameter values (in the case of a {@link FacetOperation}); can be - * <code>null</code> - * @return the result, which can be either a single object or a collection of values depending on the multiplicity - * of the given derived typed element - * @throws DerivedTypedElementException - * if the query could not be evaluated correctly to get the value - */ - Object getValue(Query query, DerivedTypedElement feature, EObject source, - List<ParameterValue> parameterValues, IFacetManager facetManager) - throws DerivedTypedElementException; - - /** - * This method must be implemented by each sub class that allows to set the value of a derivedTypedElement using a - * query - * - * @param query - * The query that sets the value - * @param feature - * The derived typed element to set - * @param source - * The model element on which the derived typed element must be set - * @param parameterValues - * The query parameter values (in the case of a {@link FacetOperation}); can be <code>null</code> - * @param newValue - * the value to set on the derived typed element - * @throws DerivedTypedElementException - * if the query could not be evaluated correctly to set the value - */ - void setValue(Query query, DerivedTypedElement feature, EObject source, - List<ParameterValue> parameterValues, Object newValue) - throws DerivedTypedElementException; - - /** - * Return whether to check the type of the query result after its evaluation - * <p> - * Normally, this is <code>true</code>, but the query evaluator can choose to skip the check, for example if the - * return type of the query can't be loaded. - * - * @return whether to check the type of the query result after its evaluation - */ - boolean isCheckResultType(); - -}
diff --git a/org.eclipse.modisco.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/query/IQueryImplementationFactory.java b/org.eclipse.modisco.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/query/IQueryImplementationFactory.java deleted file mode 100644 index 76d2d56..0000000 --- a/org.eclipse.modisco.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/query/IQueryImplementationFactory.java +++ /dev/null
@@ -1,45 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2012 CEA LIST. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Nicolas Bros (Mia-Software) - Bug 376941 - [EFacet] Facet operation arguments in Facet model - *******************************************************************************/ -package org.eclipse.emf.facet.efacet.core.query; - -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.facet.efacet.core.IDerivedTypedElementManager; -import org.eclipse.emf.facet.efacet.core.exception.DerivedTypedElementException; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.extensible.Query; -import org.osgi.framework.Bundle; - -/** - * This factory allows clients to create a {@link IQueryImplementation} for queries corresponding to this type of - * factory. - * - * @since 0.2 - */ -public interface IQueryImplementationFactory { - - /** - * Create a query implementation for the given query. - * - * @param query - * the query to create an implementation for - * @param queryBundle - * the bundle in which the query is defined. May be <code>null</code> if the query is not defined in a - * {@link Bundle}. - */ - IQueryImplementation create(Query query, Bundle queryBundle, IDerivedTypedElementManager manager) - throws DerivedTypedElementException; - - /** - * Return the type of query handled by this implementation. - * - * @return the type of query this implementation handles. - */ - EClass getManagedQueryType(); -}
diff --git a/org.eclipse.modisco.facet.efacet.core/src/org/eclipse/modisco/facet/efacet/core/FacetUtils.java b/org.eclipse.modisco.facet.efacet.core/src/org/eclipse/modisco/facet/efacet/core/FacetUtils.java new file mode 100644 index 0000000..925f6ef --- /dev/null +++ b/org.eclipse.modisco.facet.efacet.core/src/org/eclipse/modisco/facet/efacet/core/FacetUtils.java
@@ -0,0 +1,766 @@ +/******************************************************************************* + * Copyright (c) 2011, 2017 Mia-Software, and Soft-Maint. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Nicolas Bros (Mia-Software) - Bug 361612 - New core for new version of the Facet metamodel + * Nicolas Bros (Mia-Software) - Bug 361817 - [Restructuring] Dynamic load to the facet catalog + * Gregoire Dupe (Mia-Software) - Bug 369987 - [Restructuring][Table] Switch to the new customization and facet framework + * Nicolas Bros (Mia-Software) - Bug 371367 - Hierarchical FacetSets + * Gregoire Dupe (Mia-Software) - Bug 371367 - Hierarchical FacetSets + * Gregoire Dupe (Mia-Software) - Bug 364325 - [Restructuring] The user must be able to navigate into a model using the Facet. + * Gregoire Dupe (Mia-Software) - Bug 373510 - EditingDomain, ResourceSet, Catalogs, etc. have to be properly managed between editors and views + * Gregoire Dupe (Mia-Software) - Bug 373078 - API Cleaning + * Gregoire Dupe (Mia-Software) - Bug 374903 - [Table] ITableWidget.setLoadedFacetSets + * Gregoire Dupe (Mia-Software) - Bug 375087 - [Table] ITableWidget.addColumn(List<ETypedElement>, List<FacetSet>) + * Olivier Remaud (Soft-Maint) - Bug 361794 - [Restructuring] EMF Facet customization meta-model + * Gregoire Dupe (Mia-Software) - Bug 364325 - [Restructuring] The user must be able to navigate into a model using the Facet. + * Gregoire Dupe (Mia-Software) - Bug 361794 - [Restructuring] EMF Facet customization meta-model + * Gregoire Dupe (Mia-Software) - Bug 373078 - API Cleaning + * Gregoire Dupe (Mia-Software) - Bug 372626 - Aggregates + * Nicolas Bros (Mia-Software) - Bug 372626 - Aggregates + * Gregoire Dupe (Mia-Software) - Bug 376576 - [EFacet] Change the multiplicity of Facet::extendedFacet + * Vincent Lorenzo (CEA-LIST) - Bug 357621 - Improve the label displayed for Customization and Facets + * Grégoire Dupé (Mia-Software) - Bug 387470 - [EFacet][Custom] Editors + * Alban Ménager (Soft-Maint) - Bug 387470 - [EFacet][Custom] Editors + * Gregoire Dupe (Mia-Software) - Bug 377870 - [EFacet] ETypedElementDialog doesn't show all available ETypedElement (library example problem?) + * Grégoire Dupé (Mia-Software) - Bug 387470 - [EFacet][Custom] Editors + * Grégoire Dupé (Mia-Software) - Bug 391442 - Select ETypedElement Dialog doesn't used the subpackages (subEFacetSet) + * Gregoire Dupe (Mia-Software) - Bug 443682 - Access to the super facet + * Jonathan Pepin (Soft-Maint) - Bug 463898 - Create FacetReference not derived, without query and with opposite mechanism + * Grégoire Dupé (Mia-Software) - Bug 472146 - Fail to open 'Navigation View' + * Grégoire Dupé (Mia-Software) - Bug 472151 - The navigation view fails if an EPackage load fails. + * Grégoire Dupé (Mia-Software) - Bug 474289 - ConcurrentModificationException in FacetUtils.getETypedElements (301) + * Jonathan Pepin (Soft-Maint) - Bug 512179 - Table widget refactoring. + * Jonathan Pepin (Soft-Maint) - Bug 514489 - Order problem on header columns + *******************************************************************************/ +package org.eclipse.modisco.facet.efacet.core; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.HashMap; +import java.util.HashSet; +import java.util.LinkedHashSet; +import java.util.LinkedList; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.eclipse.emf.common.util.EList; +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.EClassifier; +import org.eclipse.emf.ecore.ENamedElement; +import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.ecore.EPackage; +import org.eclipse.emf.ecore.EStructuralFeature; +import org.eclipse.emf.ecore.ETypedElement; +import org.eclipse.emf.ecore.resource.ResourceSet; +import org.eclipse.modisco.facet.efacet.core.exception.FacetManagerException; +import org.eclipse.modisco.facet.efacet.core.internal.Activator; +import org.eclipse.modisco.facet.efacet.core.internal.exported.IResolverManager; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.DerivedTypedElement; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.Facet; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.FacetOperation; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.FacetSet; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.runtime.ETypedElementEObjectListResult; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.runtime.ETypedElementEObjectResult; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.runtime.ETypedElementPrimitiveTypeListResult; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.runtime.ETypedElementPrimitiveTypeResult; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.runtime.ETypedElementResult; +import org.eclipse.modisco.facet.util.core.Logger; +import org.eclipse.modisco.facet.util.emf.core.ModelUtils; +import org.eclipse.modisco.facet.util.emf.core.internal.EMFUtils; + +/** + * @since 0.2 + */ +public final class FacetUtils { + + private FacetUtils() { + // static methods only + } + + /** + * Find a Facet in a FacetSet + * + * @param facetSet + * the FacetSet + * @param facetName + * the name of the Facet to look for + * @return the Facet with the given name in the given FacetSet + */ + public static Facet getFacet(final FacetSet facetSet, final String facetName) { + Facet result = null; + final List<Facet> facets = FacetUtils.getFacets(facetSet); + for (Facet facet : facets) { + if (facetName.equals(facet.getName())) { + result = facet; + break; + } + } + return result; + } + + public static <T extends ETypedElement> T getETypedElement( + final Facet facet, final String name, final Class<T> classs) { + T result = null; + final List<ETypedElement> eTypedElements = new ArrayList<ETypedElement>(); + eTypedElements.addAll(facet.getFacetElements()); + eTypedElements.addAll(facet.getFacetOperations()); + for (ETypedElement eTypedElement : eTypedElements) { + if (name.equals(eTypedElement.getName()) + && classs.isInstance(eTypedElement)) { + @SuppressWarnings("unchecked") + // @SuppressWarnings("unchecked") This assignment is check by + // the call 'classs.isInstance(structuralFeature)' + final T castResult = (T) eTypedElement; + result = castResult; + break; + } + } + return result; + } + + public static Object getResultValue(final ETypedElementResult eTEresult) { + Object result = null; + if (eTEresult instanceof ETypedElementEObjectListResult<?>) { + final ETypedElementEObjectListResult<?> eObjectList = (ETypedElementEObjectListResult<?>) eTEresult; + result = eObjectList.getResultList(); + } else if (eTEresult instanceof ETypedElementEObjectResult<?>) { + final ETypedElementEObjectResult<?> eObjectRef = (ETypedElementEObjectResult<?>) eTEresult; + result = eObjectRef.getResult(); + } else if (eTEresult instanceof ETypedElementPrimitiveTypeListResult<?>) { + final ETypedElementPrimitiveTypeListResult<?> objectList = (ETypedElementPrimitiveTypeListResult<?>) eTEresult; + result = objectList.getDerivedTypedElement(); + } else if (eTEresult instanceof ETypedElementPrimitiveTypeResult<?>) { + final ETypedElementPrimitiveTypeResult<?> objectRef = (ETypedElementPrimitiveTypeResult<?>) eTEresult; + result = objectRef.getResult(); + } else { + throw new IllegalStateException( + "Unknown ETypedElementResult type: " + eTEresult.getClass()); //$NON-NLS-1$ + } + return result; + } + + /** + * Find a FacetSet with the given name among the given list of FacetSets. If several FacetSets have the same name, + * then return the first one. + * + * @param facetSets + * where to look for + * @param name + * the name of the FacetSet to find + * @return the FacetSet, or <code>null</code> if not found in the given list + */ + public static FacetSet getFacetSet(final Collection<FacetSet> facetSets, final String name) { + FacetSet result = null; + for (FacetSet facetSet : facetSets) { + if (name.equals(facetSet.getName())) { + result = facetSet; + } + } + return result; + } + + /** + * Find all FacetSets with the given name among the given list of FacetSets. + * + * @param facetSets + * where to look for + * @param name + * the name of the FacetSets to find + * @return the FacetSets with the given name + */ + public static List<FacetSet> getFacetSets( + final Collection<FacetSet> facetSets, final String name) { + final List<FacetSet> result = new ArrayList<FacetSet>(); + for (FacetSet facetSet : facetSets) { + if (name.equals(facetSet.getName())) { + result.add(facetSet); + } + } + return result; + } + + /** + * + * @param facetSet + * a facetSet + * @return a set with all the EPackage extended by the facetSet and its + * owned facetSet + * @since 0.2 + */ + public static Set<EPackage> getAllExtendedEPackage(final FacetSet facetSet) { + final Set<EPackage> extendedEPackages = new HashSet<EPackage>(); + final EPackage res1 = getExtendedEPackage(facetSet); + if (res1 != null) { + extendedEPackages.add(res1); + } + for (FacetSet current : facetSet.getFacetSets()) { + extendedEPackages.addAll(getAllExtendedEPackage(current)); + } + final EList<EPackage> pack = facetSet.getESubpackages(); + for (EPackage current : pack) { + if (current instanceof FacetSet) { + extendedEPackages + .addAll(getAllExtendedEPackage((FacetSet) current)); + } + } + return extendedEPackages; + } + + /** + * Find all the FacetSets with the given path among the given list of root + * FacetSets. For example: <code>getFacetSetsByPath("a", "b", "c")</code> + * returns a FacetSet named "c", contained in a FacetSet named "b", + * contained in a registered FacetSet named "a". + * + * @param path + * a list of FacetSet names, starting from the root registered + * FacetSets, and leading to the wanted FacetSet(s) + * @return the FacetSets that have the given path + */ + public static List<FacetSet> getFacetSetsByPath( + final Collection<FacetSet> rootFacetSets, final String... path) { + if (path.length == 0) { + throw new IllegalArgumentException("The given path cannot be empty"); //$NON-NLS-1$ + } + List<FacetSet> facetSets = new ArrayList<FacetSet>(rootFacetSets); + for (int i = 0; i < path.length; i++) { + if (i > 0) { + facetSets = getSubFacetSets(facetSets); + } + final String name = path[i]; + facetSets = getFacetSets(facetSets, name); + if (facetSets.isEmpty()) { + break; + } + + } + return facetSets; + } + + private static List<FacetSet> getSubFacetSets( + final Collection<FacetSet> parents) { + final List<FacetSet> subFacetSets = new ArrayList<FacetSet>(); + for (FacetSet facetSet : parents) { + final EList<EPackage> eSubpackages = facetSet.getESubpackages(); + for (EPackage ePackage : eSubpackages) { + if (ePackage instanceof FacetSet) { + final FacetSet subFacetSet = (FacetSet) ePackage; + subFacetSets.add(subFacetSet); + } + } + } + return subFacetSets; + } + + /** + * Find a Facet with the given name among the given list of Facets. + * + * @param facets + * where to look + * @param name + * the name of the Facet that is being looked for + * @return the first {@link Facet} with this name, or <code>null</code> if + * none + */ + public static Facet getFacet(final Collection<Facet> facets, + final String name) { + Facet result = null; + for (Facet facet : facets) { + if (name.equals(facet.getName())) { + result = facet; + } + } + return result; + } + + public static FacetSet getRootFacetSet(final Facet facet) { + FacetSet result = (FacetSet) facet.eContainer(); + while (result != null && result.eContainer() instanceof FacetSet) { + result = (FacetSet) result.eContainer(); + } + return result; + } + + public static FacetSet getRootFacetSet(final FacetSet facetSet) { + FacetSet result = facetSet; + while (result != null && result.eContainer() instanceof FacetSet) { + result = (FacetSet) result.eContainer(); + } + return result; + } + + /** + * This methods returns all the known (registered) eTypedElements. + * + * @param resourceSet + * the eTypedElement search will be done in/using this resourceSet + * @return all the known (registered) eTypedElements + */ + public static Set<? extends ETypedElement> getETypedElements( + final ResourceSet resourceSet) { + final Set<ETypedElement> result = new HashSet<ETypedElement>(); + final Collection<Object> ePackages = EPackage.Registry.INSTANCE + .values(); + /* + * gdupe> Creating a copy of the ePackages list to avoid + * ConcurrentModificationException. cf. + * https://bugs.eclipse.org/bugs/show_bug.cgi?id=474289 + */ + final Collection<Object> localEPackages = new ArrayList<Object>(ePackages); + for (Object object : localEPackages) { + EPackage ePackage = null; + try { + if (object instanceof EPackage) { + ePackage = (EPackage) object; + } else if (object instanceof EPackage.Descriptor) { + final EPackage.Descriptor descriptor = (EPackage.Descriptor) object; + ePackage = descriptor.getEPackage(); + } + if (ePackage != null) { + result.addAll(getETypedElements(ePackage)); + } + } catch (Exception e) { + String nsURI; + if (ePackage == null) { + nsURI = "<unknown ePacakge>"; //$NON-NLS-1$ + } else { + nsURI = ePackage.getNsURI(); + } + final String message = String.format("Failed to acces to %s.", //$NON-NLS-1$ + nsURI); + Logger.logError(e, message , Activator.getDefault()); + } + } + result.addAll(getFacetETypedElements(resourceSet)); + return result; + } + + /** + * @since 0.3 + */ + public static Set<? extends ETypedElement> getFacetETypedElements( + final ResourceSet resourceSet) { + final Set<ETypedElement> result = new HashSet<ETypedElement>(); + final Collection<FacetSet> facetSets = IFacetSetCatalogManagerFactory.DEFAULT + .getOrCreateFacetSetCatalogManager(resourceSet) + .getRegisteredFacetSets(); + for (FacetSet facetSet : facetSets) { + result.addAll(getETypedElements(facetSet)); + } + return result; + } + + public static List<ETypedElement> getETypedElements(final EPackage ePackage) { + final List<ETypedElement> result = new LinkedList<ETypedElement>(); + for (EClassifier eClassifier : ePackage.getEClassifiers()) { + result.addAll(getETypedElements(eClassifier)); + } + for (EPackage subPackage : ePackage.getESubpackages()) { + result.addAll(getETypedElements(subPackage)); + } + return result; + } + + /** + * @since 0.3 + */ + public static List<ETypedElement> getETypedElements( + final EClassifier eClassifier) { + final List<ETypedElement> result = new ArrayList<ETypedElement>(); + if (eClassifier instanceof Facet) { + final Facet facet = (Facet) eClassifier; + result.addAll(facet.getFacetElements()); + result.addAll(facet.getFacetOperations()); + } else if (eClassifier instanceof EClass) { + final EClass eClass = (EClass) eClassifier; + result.addAll(eClass.getEAllStructuralFeatures()); + result.addAll(eClass.getEAllOperations()); + } + return result; + } + + public static List<Facet> getFacets(final FacetSet facetSet) { + final List<Facet> result = new LinkedList<Facet>(); + for (EClassifier eClassifier : facetSet.getEClassifiers()) { + if (eClassifier instanceof Facet) { + final Facet facet = (Facet) eClassifier; + result.add(facet); + } + } + return result; + } + + public static FacetSet getFacetSet(final Facet facet) { + FacetSet result = null; + if (facet.getEPackage() instanceof FacetSet) { + result = (FacetSet) facet.getEPackage(); + } + return result; + } + + // Moved from + // org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.impl.FacetSetImpl + public static EPackage getExtendedEPackage(final FacetSet facetSet) { + final List<Facet> facets = FacetUtils.getFacets(facetSet); + EPackage result = null; + for (Facet facet : facets) { + final EClass extendedMetaclass = facet.getExtendedMetaclass(); + if (extendedMetaclass != null) { + final EPackage ePackage = extendedMetaclass.getEPackage(); + if (ePackage != null) { + if (result != null && !ePackage.equals(result)) { + throw new IllegalStateException( + "The Facets in a FacetSet must all extend EClasses from the same EPackage"); //$NON-NLS-1$ + } + result = ePackage; + } + } + } + return result; + } + + // Copied (and refactored) from + // org.eclipse.emf.facet.efacet.core.internal.FacetManager + public static <T extends ETypedElement> Set<T> getETypedElements( + final EObject eObject, final Class<T> classs, + final IFacetManager facetManager) throws FacetManagerException { + final Set<T> result = new HashSet<T>(); + for (FacetSet facetSet : facetManager.getManagedFacetSets()) { + result.addAll(getETypedElements(eObject, facetSet, classs, + facetManager)); + } + return result; + } + + // Copied (and refactored) from + // org.eclipse.emf.facet.efacet.core.internal.FacetManager + private static <T extends ETypedElement> Set<T> getETypedElements( + final EObject eObject, final FacetSet facetSet, + final Class<T> classs, final IFacetManager manager) + throws FacetManagerException { + final Set<T> result = new HashSet<T>(); + for (EClassifier eClassifier : facetSet.getEClassifiers()) { + if (eClassifier instanceof Facet) { + final Facet facet = (Facet) eClassifier; + if (manager.isConforming(eObject, facet)) { + result.addAll(getETypedElement(classs, facet)); + } + } + } + // hierarchical FacetSets + for (EPackage ePackage : facetSet.getESubpackages()) { + if (ePackage instanceof FacetSet) { + final FacetSet subFacetSet = (FacetSet) ePackage; + result.addAll(getETypedElements(eObject, subFacetSet, classs, + manager)); + } + } + // aggregates + for (FacetSet subFacetSet : facetSet.getFacetSets()) { + result.addAll(getETypedElements(eObject, subFacetSet, classs, + manager)); + } + return result; + } + + private static <T> Set<T> getETypedElement(final Class<T> classs, + final Facet facet) { + final Set<T> result = new HashSet<T>(); + for (ETypedElement eTypedElement : getAllETypedElements(facet)) { + if (classs.isInstance(eTypedElement)) { + @SuppressWarnings("unchecked") + // @SuppressWarnings("unchecked") This type has been + // checked using isInstance + final T typedSF = (T) eTypedElement; + final T resolvedTE = IResolverManager.DEFAULT + .resolve(typedSF, classs); + if (resolvedTE == null) { + result.add(typedSF); + } else { + result.add(resolvedTE); + } + } + } + return result; + } + + // Copied (and refactored) from + // org.eclipse.emf.facet.efacet.core.internal.FacetManager + private static List<ETypedElement> getAllETypedElements( + final Facet facet) { + final List<ETypedElement> structFeatures = new LinkedList<ETypedElement>(); + structFeatures.addAll(facet.getFacetElements()); + structFeatures.addAll(facet.getFacetOperations()); + for (Facet extFacet : facet.getExtendedFacets()) { + structFeatures.addAll(getAllETypedElements(extFacet)); + } + return structFeatures; + } + + /** + * @param eTypedElement + * @return + * @since 0.2 + */ + public static FacetSet getFacetSet(final ETypedElement eTypedElement) { + FacetSet result = null; + if (eTypedElement.eContainer() instanceof Facet) { + final Facet facet = (Facet) eTypedElement.eContainer(); + if (facet.eContainer() instanceof FacetSet) { + result = (FacetSet) facet.eContainer(); + } + } + return result; + } + + /** + * + * @param facetOperation + * @return + * @since 0.2 + */ + public static DerivedTypedElement getSignature( + final FacetOperation facetOperation) { + DerivedTypedElement current = facetOperation; + while (current.getOverride() != null) { + current = current.getOverride(); + } + return current; + } + + /** + * + * @param facet + * @return + * @since 0.2 + */ + public static EClass getExtendedMetaclass(final Facet facet) { + EClass result = facet.getExtendedMetaclass(); + if (result == null) { + final List<EClass> eClasses = new LinkedList<EClass>(); + for (Facet extfacet : facet.getExtendedFacets()) { + eClasses.add(getExtendedMetaclass(extfacet)); + } + result = EMFUtils.computeLeastCommonSupertype(eClasses); + } + return result; + } + + /** + * Find the top level feature in the override chain + * + * @param feature + * @return The top level feature in the override chain or the feature + * parameter itself if no override + * @throws FacetManagerException + * @since 0.2 + * + */ + // Copied from + // org.eclipse.emf.facet.efacet.core.internal.FacetManagerContext + // * Contributors: + // * Olivier Remaud (Soft-Maint) - Bug 361794 - [Restructuring] EMF Facet + // customization meta-model + // * Gregoire Dupe (Mia-Software) - Bug 364325 - [Restructuring] The user + // must be able to navigate into a model using the Facet. + // * Gregoire Dupe (Mia-Software) - Bug 361794 - [Restructuring] EMF Facet + // customization meta-model + // * Gregoire Dupe (Mia-Software) - Bug 373078 - API Cleaning + @SuppressWarnings("unchecked") + // @SuppressWarnings("unchecked") cf. comment in the method body + public static <T extends DerivedTypedElement> T getTopOverrideFeature( + final T feature) throws FacetManagerException { + T signatureFeature = feature; + while (signatureFeature.getOverride() != null) { + if (feature.getClass().isInstance(signatureFeature.getOverride())) { + // @SuppressWarnings("unchecked") the if test check the + // assignment using the method 'isInstance' + signatureFeature = (T) signatureFeature.getOverride(); + } else { + // signature feature type name + final String sfTypeName = signatureFeature.eClass().getName(); + // signature feature name + final String sfName = ModelUtils + .getQualifiedName(signatureFeature); + final String ofName = signatureFeature.getOverride().eClass() + .getName(); // overridden feature type name + throw new FacetManagerException("The " + sfTypeName + " '" //$NON-NLS-1$ //$NON-NLS-2$ + + sfName + "' overides a " + ofName); //$NON-NLS-1$ + } + } + return signatureFeature; + } + + /** + * @since 0.3 + */ + public static EClass findExtendedEClass(final Facet facet) { + EClass result = facet.getExtendedMetaclass(); + if (result == null) { + for (Facet extFacet : facet.getExtendedFacets()) { + result = findExtendedEClass(extFacet); + if (result != null) { + break; + } + } + } + return result; + } + + /** + * @since 0.3 + */ + public static DerivedTypedElement getContainingDerivedTypedElement( + final EObject eObject) { + DerivedTypedElement dte = null; + if (eObject instanceof DerivedTypedElement) { + dte = (DerivedTypedElement) eObject; + } else if (eObject != null) { + dte = getContainingDerivedTypedElement(eObject.eContainer()); + } + return dte; + } + + /** + * Return the main facetSet. + * + * @param eObject + * the element in the model selected. + * @return the main facetSet. + * @since 0.3 + */ + public static FacetSet getContainingFacetSet(final EObject eObject) { + FacetSet result = null; + if (eObject instanceof FacetSet) { + result = (FacetSet) eObject; + } else { + final EObject container = eObject.eContainer(); + if (container != null) { + result = getContainingFacetSet(container); + } + } + return result; + } + + /** + * Return all the operations of the model. + * + * @param parent + * the first FacetSet of the model. + * @return the list of operations. + * @since 0.3 + */ + public static Map<String, FacetOperation> getAllOperationsByName( + final FacetSet parent) { + final Map<String, FacetOperation> operations = new HashMap<String, FacetOperation>(); + for (final EClassifier facet : parent.getEClassifiers()) { + for (final FacetOperation operation : ((Facet) facet) + .getFacetOperations()) { + operations.put(operation.getName(), operation); + } + } + for (final EPackage element : parent.getESubpackages()) { + operations.putAll(getAllOperationsByName((FacetSet) element)); + } + return operations; + } + + /** + * Return all the facets of the model. + * + * @param parent + * the first FacetSet of the model. + * @return the list of facets. + * @since 0.3 + */ + public static Map<String, Facet> getAllFacetsByName(final FacetSet parent) { + final Map<String, Facet> facets = new HashMap<String, Facet>(); + for (final EClassifier facet : parent.getEClassifiers()) { + facets.put(facet.getName(), (Facet) facet); + } + for (final EPackage element : parent.getESubpackages()) { + facets.putAll(getAllFacetsByName((FacetSet) element)); + } + + return facets; + } + + /** + * Return all the facets of the model. + * + * @param parent + * the first FacetSet of the model. + * @return the list of facets. + * @since 0.3 + */ + public static Map<String, FacetSet> getAllFacetSetsByName( + final EPackage parent) { + final Map<String, FacetSet> facetSets = new HashMap<String, FacetSet>(); + if (parent instanceof FacetSet) { + final FacetSet facetSet = (FacetSet) parent; + facetSets.put(parent.getName(), facetSet); + } + for (final EPackage element : parent.getESubpackages()) { + facetSets.putAll(getAllFacetSetsByName(element)); + } + return facetSets; + } + + /** + * @since 0.3 + */ + public static List<Facet> getAllFacet(final FacetSet facetSet) { + final List<Facet> result = new ArrayList<Facet>(); + for (EClassifier eClassifier : facetSet.getEClassifiers()) { + if (eClassifier instanceof Facet) { + final Facet facet = (Facet) eClassifier; + result.add(facet); + } + } + for (EPackage ePackage : facetSet.getESubpackages()) { + if (ePackage instanceof FacetSet) { + final FacetSet subFacetSet = (FacetSet) ePackage; + result.addAll(getAllFacet(subFacetSet)); + } + } + return result; + } + + /** + * @since 1.2 + */ + public static Set<EStructuralFeature> getAllStructrualFeatures( + final EObject eObject, final IFacetManager facetMgr) + throws FacetManagerException { + final Set<EStructuralFeature> result = new LinkedHashSet<EStructuralFeature>(); + result.addAll(eObject.eClass().getEAllStructuralFeatures()); + final Set<EStructuralFeature> typedElements = FacetUtils + .getETypedElements(eObject, EStructuralFeature.class, facetMgr); + result.addAll(typedElements); + return result; + } + + /** + * @since 1.0 + */ + public static String toString(final DerivedTypedElement feature) { + final StringBuffer result = new StringBuffer(); + result.append(feature.eResource().getURI()); + result.append(" -> "); //$NON-NLS-1$ + final EObject eContainer = feature.eContainer(); + if (eContainer instanceof ENamedElement) { + final ENamedElement parent = (ENamedElement) eContainer; + result.append(parent.getName()); + result.append('.'); + } + result.append(feature.getName()); + return result.toString(); + } + +}
diff --git a/org.eclipse.modisco.facet.efacet.core/src/org/eclipse/modisco/facet/efacet/core/IDerivedTypedElementManager.java b/org.eclipse.modisco.facet.efacet.core/src/org/eclipse/modisco/facet/efacet/core/IDerivedTypedElementManager.java new file mode 100644 index 0000000..442e125 --- /dev/null +++ b/org.eclipse.modisco.facet.efacet.core/src/org/eclipse/modisco/facet/efacet/core/IDerivedTypedElementManager.java
@@ -0,0 +1,203 @@ +/** + * Copyright (c) 2011, 2012 Mia-Software. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Gregoire Dupe (Mia-Software) - Bug 333553 - The user has not to deal with two files to create a facet + * Emmanuelle Rouillé (Mia-Software) - Bug 352618 - To be able to use non derived facet structural features and save them values. + * Nicolas Bros (Mia-Software) - Bug 361612 - New core for new version of the Facet metamodel + * Nicolas Bros (Mia-Software) - Bug 362191 - [Restructuring] Query mechanism for eFacet2 + * Gregoire Dupe (Mia-Software) - Bug 369987 - [Restructuring][Table] Switch to the new customization and facet framework + * Gregoire Dupe (Mia-Software) - Bug 364325 - [Restructuring] The user must be able to navigate into a model using the Facet. + * Nicolas Bros (Mia-Software) - Bug 376941 - [EFacet] Facet operation arguments in Facet model + */ +package org.eclipse.modisco.facet.efacet.core; + +import java.util.Collection; +import java.util.List; + +import org.eclipse.emf.ecore.EAttribute; +import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.ecore.EOperation; +import org.eclipse.emf.ecore.EReference; +import org.eclipse.modisco.facet.efacet.core.exception.DerivedTypedElementException; +import org.eclipse.modisco.facet.efacet.core.internal.DerivedTypedElementManager; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.DerivedTypedElement; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.FacetOperation; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.ParameterValue; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.extensible.Query; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.runtime.ETypedElementResult; + +/** + * Used to evaluate derived typed elements through their queries. + * + * @since 0.2 + * @noimplement This interface is not intended to be implemented by clients. + * @noextend This interface is not intended to be extended by clients. + */ +public interface IDerivedTypedElementManager { + IDerivedTypedElementManager INSTANCE = new DerivedTypedElementManager(); + + /** + * Evaluates a derived typed element on a model element. + * <p> + * <b>Note:</b> this method does not return a typed result, and it does not + * check the result type. Use + * {@link IDerivedTypedElementManager#evaluateSingleValued(DerivedTypedElement, EObject, List, Class) + * evaluateSingleValued} or + * {@link IDerivedTypedElementManager#evaluateMultiValued(DerivedTypedElement, EObject, List, Class) + * evaluateMultiValued} instead if you want a typed and type-checked result. + * + * @param derivedTE + * the derived typed element to evaluate + * @param source + * the model element on which the derived typed element must be + * evaluated + * @param parameterValues + * the arguments of the derived typed element (in the case of a + * {@link FacetOperation}; can be <code>null</code> if there are + * no parameters) + * @return the derived typed element result: a single Object in the case of + * a single-valued derived typed element, or a List in the case of a + * multi-valued derived typed element. + * @throws DerivedTypedElementException + * <ul> + * <li>in case of error in the derived typed element</li> <li>in + * case of error when evaluating the derived typed element</li> + * </ul> + */ + Object evaluate(DerivedTypedElement derivedTE, EObject source, + List<ParameterValue> parameterValues, IFacetManager facetManager) + throws DerivedTypedElementException; + + /** + * Evaluates a query on a model element. Calling this method is discouraged. You should evaluate a + * {@link DerivedTypedElement}s (which contains a query) instead of trying to evaluate a {@link Query} directly. + * Since the source type, return type and multiplicity of a query are carried by the {@link DerivedTypedElement} + * that normally contains it, this method doesn't check the source type, return type or multiplicity. + * + * @param query + * the query to evaluate + * @param source + * the model element on which the query must be evaluated + * @param parameterValues + * the arguments of the query (in the case of a query for a {@link FacetOperation}; can be + * <code>null</code> if there are no parameters) + * @return the query result: may be a single Object or a List. + * @throws DerivedTypedElementException + * if the evaluation failed + */ + Object evaluate(Query query, EObject source, List<ParameterValue> parameterValues, IFacetManager facetManager) + throws DerivedTypedElementException; + + /** + * Evaluates a single valued derived typed element on a model element. + * + * @param derivedTE + * the derived typed element to evaluate + * @param source + * the model element on which the derived typed element is + * evaluated + * @param parameterValues + * the arguments of the derived typed element (in the case of a + * {@link FacetOperation}; can be <code>null</code> if there are + * no parameters) + * @param resultType + * the type that the returned value must have + * @return the result of the evaluation + * @throws DerivedTypedElementException + * <ul> + * <li>in case of error in the derived typed element</li> + * <li>in case of error when evaluating the derived typed + * element</li> + * <li> + * if the effective return type does not match the expected type + * </li> + * </ul> + */ + <T> T evaluateSingleValued(DerivedTypedElement derivedTE, EObject source, + List<ParameterValue> parameterValues, Class<T> resultType, + IFacetManager facetManager) throws DerivedTypedElementException; + + /** + * Evaluates a multi-valued derived typed element on a model element. + * + * @param derivedTypedElement + * the derived typed element to evaluate + * @param source + * the model element on which the derived typed element must be + * evaluated + * @param parameterValues + * the arguments of the derived typed element (in the case of a + * {@link FacetOperation}; can be <code>null</code> if there are + * no parameters) + * @param resultType + * the type that the returned value must have + * @return the result of the evaluation + * @throws DerivedTypedElementException + * <ul> + * <li>in case of error in the derived typed element</li> + * <li>in case of error when evaluating the derived typed + * element</li> + * <li>if the effective return type does not match the expected + * type</li> + * </ul> + */ + <T> List<T> evaluateMultiValued(DerivedTypedElement derivedTE, + EObject source, List<ParameterValue> parameterValues, + Class<T> resultType, IFacetManager facetManager) + throws DerivedTypedElementException; + + /** + * Evaluates a derived typed element on a list of model elements in a single + * call. + * + * @param derivedTE + * the derived typed element to evaluate + * @param sources + * the model elements on which the derived typed element must be + * evaluated + * @param parameterValues + * the arguments of the derived typed element (in the case of a + * {@link FacetOperation}; can be <code>null</code> if there are + * no parameters) + * @param resultType + * the expected type of the returned list: + * <ul> + * <li> {@link DerivedTypedElementEObjectResult} if the + * {@link DerivedTypedElement} is a single-valued + * {@link EReference} or {@link EOperation} that returns EObjects + * <li>{@link DerivedTypedElementEObjectListResult} if the + * {@link DerivedTypedElement} is a multi-valued + * {@link EReference} or {@link EOperation} that returns EObjects + * <li>{@link DerivedTypedElementPrimitiveTypeResult} if the + * {@link DerivedTypedElement} is a single-valued + * {@link EAttribute} or {@link EOperation} that returns a + * primitive type value + * <li>{@link DerivedTypedElementPrimitiveTypeListResult} if the + * {@link DerivedTypedElement} is a multi-valued + * {@link EAttribute} or {@link EOperation} that returns a list + * of primitive type values + * </ul> + * @return one derived typed element result for each source element that was + * evaluated + * @throws DerivedTypedElementException + * <ul> + * <li>in case of error in the derived typed element. + * <b>Note</b>: an error that happens when evaluating the + * derived typed element on any of the given sources is not + * thrown but stored in the corresponding element result.</li> + * <li>if the effective return type does not match the expected + * type</li> + * </ul> + */ + <T extends ETypedElementResult> List<T> batchEvaluate( + DerivedTypedElement derivedTE, + Collection<? extends EObject> sources, + List<ParameterValue> parameterValues, Class<T> resultType, + IFacetManager facetManager) throws DerivedTypedElementException; +}
diff --git a/org.eclipse.modisco.facet.efacet.core/src/org/eclipse/modisco/facet/efacet/core/IFacetActions.java b/org.eclipse.modisco.facet.efacet.core/src/org/eclipse/modisco/facet/efacet/core/IFacetActions.java new file mode 100644 index 0000000..da0416f --- /dev/null +++ b/org.eclipse.modisco.facet.efacet.core/src/org/eclipse/modisco/facet/efacet/core/IFacetActions.java
@@ -0,0 +1,45 @@ +/** + * Copyright (c) 2012 Mia-Software. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Alban Ménager (Soft-Maint) - Bug 387470 - [EFacet][Custom] Editors + */ +package org.eclipse.modisco.facet.efacet.core; + +import java.io.IOException; + +import org.eclipse.core.resources.IFile; +import org.eclipse.modisco.facet.efacet.core.internal.FacetActionsImpl; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.FacetSet; +import org.eclipse.modisco.facet.util.emf.core.exception.InvalidFacetSetException; + +/** + * This interface contains methods to create {@link FacetSet}s. + * + * @since 0.3 + * @noextend This interface is not intended to be extended by clients. + * @noimplement This interface is not intended to be implemented by clients. + */ +public interface IFacetActions { + + IFacetActions INSTANCE = new FacetActionsImpl(); + + /** + * Add the given facetSet to the given facetSet model file, which will be + * created + * + * @param facetSet + * the facetSet to be created. Cannot be <code>null</code> + * @param file + * the new file in which the facetSet has to be created. Cannot + * be <code>null</code>, and cannot already exist + */ + void saveFacetSet(FacetSet facetSet, IFile file) throws IOException, + InvalidFacetSetException; + +}
diff --git a/org.eclipse.modisco.facet.efacet.core/src/org/eclipse/modisco/facet/efacet/core/IFacetCommandFactory.java b/org.eclipse.modisco.facet.efacet.core/src/org/eclipse/modisco/facet/efacet/core/IFacetCommandFactory.java new file mode 100644 index 0000000..82945fc --- /dev/null +++ b/org.eclipse.modisco.facet.efacet.core/src/org/eclipse/modisco/facet/efacet/core/IFacetCommandFactory.java
@@ -0,0 +1,193 @@ +/** + * Copyright (c) 2012 Mia-Software. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Alban Ménager (Soft-Maint) - Bug 387470 - [EFacet][Custom] Editors + * Grégoire Dupé (Mia-Software) - Bug 387470 - [EFacet][Custom] Editors + */ +package org.eclipse.modisco.facet.efacet.core; + +import org.eclipse.emf.common.command.Command; +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.EClassifier; +import org.eclipse.emf.ecore.EParameter; +import org.eclipse.emf.ecore.ETypedElement; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.DerivedTypedElement; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.Facet; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.FacetAttribute; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.FacetOperation; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.FacetReference; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.FacetSet; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.extensible.Query; + +/** + * This interface provide a command factory. A command modify the editingDomain. + * + * @since 0.3 + * @noextend This interface is not intended to be extended by clients. + * @noimplement This interface is not intended to be implemented by clients. + */ +public interface IFacetCommandFactory { + + /** + * Create the command to add a FacetSet (facetSet) to an existing FacetSet + * (parent). + * + * @param parent + * the parent of the facetSet to add. + * @param facetSet + * the facetSet to add. + * @return the command. + */ + Command createFacetSetInFacetSetCommand(FacetSet parent, FacetSet facetSet); + + /** + * Create the command to add a Facet (facet) to an existing FacetSet + * (parent). + * + * @param parent + * the parent of the facet to add. + * @param facet + * the facet to add. + * @return the command. + */ + Command createFacetInFacetSetCommand(FacetSet parent, Facet facet); + + /** + * Create the command to add an Attribute (facetAttrbute) to an existing + * Facet (parent). + * + * @param parent + * the parent of the attribute to add. + * @param facetAttrbute + * the attribute to add. + * @return the command. + */ + Command createEditFacetStructuralFeatureCommand( + final DerivedTypedElement feature, final Facet container, + final String name, final int lowerBd, final int upperBd, + final EClassifier type, final boolean ordered, + final boolean unique, final Query query, final boolean volatilee, + final boolean change, final boolean derived, + final boolean transientt); + + /** + * Create the command to add a Reference (facetReference) to an existing + * Facet (parent). + * + * @param parent + * the parent of the reference to add. + * @param facetReference + * the reference to add. + * @return the command. + */ + Command createAddReferenceInFacetCommand(Facet parent, + FacetReference facetReference); + + /** + * Create the command to add an Operation (FacetOperation) to an existing + * Facet (parent). + * + * @param parent + * the parent of the operation to add. + * @param facetOperation + * the operation to add. + * @return the command. + */ + Command createAddOperationInFacetCommand(Facet parent, + FacetOperation facetOperation); + + /** + * Create the command to add a Parameter (operationParameter) to an existing + * Operation (parent). + * + * @param parent + * the parent of the operation to add. + * @param facetOperation + * the operation to add. + * @return the command. + */ + Command createAddParameterInOperationCommand(FacetOperation parent, + EParameter opeParameter); + + /** + * Create the command to change the owner of an element. + * + * @param element + * @param newOwner + * @return + */ + Command createChangeOwnerCommand(Object element, Object newOwner); + + /** + * Create the command to change the attributes of a FacetSet. + * + * @param initialElement + * @param newElement + * @param newElement + * @return + */ + Command createEditFacetSetCommand(final FacetSet editedFacetSet, + final FacetSet container, final String name); + + /** + * Create the command to change the attributes of a Facet. + * + * @param initialElement + * @param newElement + * @return + */ + Command createEditFacetCommand(Facet facet, FacetSet container, + String name, ETypedElement conformance, EClass extendEClass, + FacetSet extendedFacetSet); + + /** + * Create the command to change the attributes of a FacetAttribute. + * + * @param initialElement + * @param newElement + * @return + */ + Command createSetFacetAttributeCommand(final Facet initialContainer, + final FacetAttribute initialElement, + final FacetAttribute newElement); + + /** + * Create the command to change the attributes of a FacetReference. + * + * @param initialElement + * @param newElement + * @return + */ + Command createSetFacetReferenceCommand(final Facet initialContainer, + final FacetReference initialElement, + final FacetReference newElement); + + /** + * Create the command to change the attributes of a FacetOperation. + * + * @param initialElement + * @param newElement + * @return + */ + Command createEditFacetOperationCommand(DerivedTypedElement dte, + Facet facetContainer, String name, int lowerBound, int upperBound, + EClassifier type, boolean ordered, boolean unique, Query query); + + /** + * Create the command to change the attributes of a FacetAttribute. + * + * @param initialElement + * @param newElement + * @return + */ + Command createEditOperationParameterCommand(EParameter parameter, + FacetOperation container, String name, int lowerBound, + int upperBound, EClassifier type, boolean ordered, boolean unique); + +}
diff --git a/org.eclipse.modisco.facet.efacet.core/src/org/eclipse/modisco/facet/efacet/core/IFacetCommandFactoryFactory.java b/org.eclipse.modisco.facet.efacet.core/src/org/eclipse/modisco/facet/efacet/core/IFacetCommandFactoryFactory.java new file mode 100644 index 0000000..8f4e5b0 --- /dev/null +++ b/org.eclipse.modisco.facet.efacet.core/src/org/eclipse/modisco/facet/efacet/core/IFacetCommandFactoryFactory.java
@@ -0,0 +1,27 @@ +/** + * Copyright (c) 2012 Mia-Software. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Grégoire Dupé (Mia-Software) - Bug 387470 - [EFacet][Custom] Editors + */ +package org.eclipse.modisco.facet.efacet.core; + +import org.eclipse.emf.edit.domain.EditingDomain; +import org.eclipse.modisco.facet.efacet.core.internal.FacetCommandFactoryFactory; + +/** + * @since 0.3 + * @noimplement This interface is not intended to be implemented by clients. + * @noextend This interface is not intended to be extended by clients. + */ +public interface IFacetCommandFactoryFactory { + + IFacetCommandFactoryFactory DEFAULT = new FacetCommandFactoryFactory(); + + IFacetCommandFactory createCommandFactory(EditingDomain editingDomain); +}
diff --git a/org.eclipse.modisco.facet.efacet.core/src/org/eclipse/modisco/facet/efacet/core/IFacetManager.java b/org.eclipse.modisco.facet.efacet.core/src/org/eclipse/modisco/facet/efacet/core/IFacetManager.java new file mode 100644 index 0000000..fa74acc --- /dev/null +++ b/org.eclipse.modisco.facet.efacet.core/src/org/eclipse/modisco/facet/efacet/core/IFacetManager.java
@@ -0,0 +1,267 @@ +/******************************************************************************* + * Copyright (c) 2011, 2015 Mia-Software, Soft-Maint. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Emmanuelle Rouillé (Mia-Software) - Bug 352618 - To be able to use non derived facet structural features and save them values. + * Nicolas Bros (Mia-Software) - Bug 361612 - New core for new version of the Facet metamodel + * Olivier Remaud (Soft-Maint) - Bug 361794 - [Restructuring] EMF Facet customization meta-model + * Gregoire Dupe (Mia-Software) - Bug 361794 - [Restructuring] New customization meta-model + * Gregoire Dupe (Mia-Software) - Bug 369987 - [Restructuring][Table] Switch to the new customization and facet framework + * Gregoire Dupe (Mia-Software) - Bug 364325 - [Restructuring] The user must be able to navigate into a model using the Facet. + * Gregoire Dupe (Mia-Software) - Bug 373078 - API Cleaning + * Thomas Cicognani (Soft-Maint) - Bug 416221 - New methods to get references in FacetManager API + * Thomas Cicognani (Soft-Maint) - Bug 420193 - Listener on FacetManager + * Gregoire Dupe (Mia-Software) - Bug 443682 - Access to the super facet + * Jonathan Pepin (Soft-Maint) - Bug 463907 - Command for load and save Facet serialization + *******************************************************************************/ +package org.eclipse.modisco.facet.efacet.core; + +import java.util.Collection; +import java.util.List; +import java.util.Set; + +import org.eclipse.emf.ecore.EAttribute; +import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.ecore.EOperation; +import org.eclipse.emf.ecore.EReference; +import org.eclipse.emf.ecore.EStructuralFeature; +import org.eclipse.emf.ecore.ETypedElement; +import org.eclipse.emf.ecore.resource.Resource; +import org.eclipse.emf.ecore.resource.ResourceSet; +import org.eclipse.emf.edit.domain.EditingDomain; +import org.eclipse.modisco.facet.efacet.core.exception.FacetManagerException; +import org.eclipse.modisco.facet.efacet.core.exception.SuperInvokeException; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.DerivedTypedElement; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.Facet; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.FacetAttribute; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.FacetReference; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.FacetSet; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.ParameterValue; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.runtime.ETypedElementResult; + +/** + * This interface allows clients to use the EMF Facet API to get and set the values of virtually + * added {@link EReference}s and {@link EAttribute}s, and invoke {@link EOperation}s. + * <p> + * Derived {@link FacetAttribute}s and {@link FacetReference}s are computed by queries, whereas + * non-derived {@link FacetAttribute}s and {@link EAttribute}s and {@link EReference}s and + * {@link FacetReference}s are stored in the serialization {@link Resource} specified in the + * {@link IFacetManagerFactory} that created this {@link IFacetManager}. + * + * @since 0.2 + * @noextend This interface is not intended to be extended by clients. + * @noimplement This interface is not intended to be implemented by clients. + */ +public interface IFacetManager { + + /** + * Serialize the model containing the structural feature instances. + */ + void saveStructuralFeatureInstanceModel() throws FacetManagerException; + + /** + * Returns whether the given model element conforms to the given Facet + * + * @param eObject + * the model element + * @param facet + * the Facet the applicability of which is being tested + * @throws FacetManagerException + * if there is an error evaluating the Facet's conformance typed element + * @return whether the given model element should be seen as an instance of the given Facet + */ + boolean isConforming(final EObject eObject, final Facet facet) + throws FacetManagerException; + + /** + * Set the value of the given {@link EStructuralFeature} on the given + * {@link EObject} to the given {@link Object} value. + * + * @param eObject + * the model element whose feature must be set + * @param structuralFeature + * the feature to set + * @param newValue + * the new value + * @param editingDomain + * @throws FacetManagerException + * <ul> + * <li>if the eObject doesn't conform to the Facet of the given + * attribute (in the case of a FacetAttribute)</li> + * <li>if the Facet of the given attribute is not applicable to + * the given eObject (in the case of a FacetAttribute)</li> + * <li> + * if there is an error evaluating the Facet's conformance typed + * element</li> + * </ul> + */ + void set(EObject eObject, EStructuralFeature structuralFeature, + Object newValue, EditingDomain editingDomain) + throws FacetManagerException; + + /** + * Evaluate the given {@link EOperation} of the given {@link EObject}. The + * returned value has to be of the given expectedType {@link Class} + * + * @param eObject + * the model element on which the operation is evaluated + * @param operation + * the operation to evaluate + * @param resultType + * the expected type of the returned value; if the effective type + * is not compatible, an UnmatchingExpectedTypeException will be + * thrown + * @param arguments + * the values of the parameters of the EOperation that is + * evaluated: they must match both in size, types and + * multiplicity + * @return the return value of the operation + * @throws FacetManagerException + * <ul> + * <li>if the effective type does not match the expected type</li> + * <li>in case of an error in the query that returns the value + * (can only happen in the case of a FacetOperation)</li> + * <li>in case of an error when delegating to the Ecore + * reflexive API (if the given EOperation is not a + * FacetOperation)</li> + * <li>if the eObject doesn't conform to the Facet of the given + * operation (in the case of a FacetOperation)</li> + * <li>if the Facet of the given operation is not applicable to + * the given eObject (in the case of a FacetOperation)</li> + * <li>if there is an error evaluating the Facet's conformance + * typed element</li> + * <li>if the given actual parameters don't match the + * EOperation's formal parameters</li> + * </ul> + */ + <T> T invoke(EObject eObject, EOperation operation, + Class<T> resultType, EditingDomain editingDomain, + Object... arguments) throws FacetManagerException; + + /** + * Invoke the given {@link EOperation} on each element of the given + * collection of {@link EObject}s. + * + * @param eObjects + * the model elements on which the operation is evaluated + * @param operation + * the operation to evaluate + * @param arguments + * the values of the parameters of the EOperation that is + * evaluated: they must match both in size, types and + * multiplicity + * @return the list of results, one for each model element of the given + * <code>eObjects</code> + * @throws FacetManagerException + * <ul> + * <li>in case of an error when delegating to the Ecore + * reflexive API (if the given EOperation is not a + * FacetOperation)</li> + * <li> + * in case of an error in the derived typed element that returns + * the value</li> + * </ul> + */ + List<ETypedElementResult> batchInvoke(Collection<EObject> eObjects, + EOperation operation, Object... arguments) + throws FacetManagerException; + + /** + * This method returns the list of loaded facet sets. + * + * @return a modifiable list of all FacetSets that + * constitute the working context of the FacetManager + */ + List<FacetSet> getManagedFacetSets(); + + /** @return the resourceSet used to manage the facet models. */ + ResourceSet getResourceSet(); + + <T> T getOrInvoke(EObject element, ETypedElement query, Class<T> aClass) + throws FacetManagerException; + + <T> List<T> getOrInvokeMultiValued(EObject eObject, ETypedElement feature, + Class<T> aClass) throws FacetManagerException; + + <T> List<ETypedElementResult> batchGetOrInvoke(Collection<EObject> sources, + ETypedElement query, Class<T> aClass) throws FacetManagerException; + + /** + * Get virtual references from an EObject. References must be defined in a + * FacetSet + * + * @param eObject + * Model element + * @return All not duplicated virtual references + * @throws FacetManagerException + * @since 0.4 + */ + Set<EReference> getReferences(EObject eObject) throws FacetManagerException; + + /** + * Get virtual attributes from an EObject. References must be defined in a + * FacetSet + * + * @param eObject + * Model element + * @return All not duplicated virtual attributes + * @throws FacetManagerException + * @since 0.4 + */ + Set<EAttribute> getAttributes(EObject eObject) throws FacetManagerException; + + /** + * Get virtual references and attributes from an EObject. References must be + * defined in a FacetSet + * + * @param eObject + * Model element + * @return All not duplicated virtual references and attributes + * @throws FacetManagerException + * @since 0.4 + */ + Set<EStructuralFeature> getStructuralFeature(EObject eObject) + throws FacetManagerException; + + /** + * Adds a listener to this manager that will be notified when this manager's + * state changes. + * + * @param listener + * The listener to be added + * @since 0.4 + */ + void addListener(IFacetManagerListener listener); + + /** + * Removes a listener from this manager. + * + * @param listener + * The listener to be removed + * @since 0.4 + */ + void removeListener(IFacetManagerListener listener); + + /** + * @since 1.0 + */ + <T> T getSuperValueOf(DerivedTypedElement derivedTypedElt, EObject source, + List<ParameterValue> parameterValues, Class<T> expectedType) + throws SuperInvokeException, FacetManagerException; + + /** + * @since 1.0 + */ + Resource getSerializationResource(); + + /** + * @since 1.0 + */ + void setSerializationResource(Resource resource) + throws FacetManagerException; + +}
diff --git a/org.eclipse.modisco.facet.efacet.core/src/org/eclipse/modisco/facet/efacet/core/IFacetManagerFactory.java b/org.eclipse.modisco.facet.efacet.core/src/org/eclipse/modisco/facet/efacet/core/IFacetManagerFactory.java new file mode 100644 index 0000000..a841856 --- /dev/null +++ b/org.eclipse.modisco.facet.efacet.core/src/org/eclipse/modisco/facet/efacet/core/IFacetManagerFactory.java
@@ -0,0 +1,105 @@ +/******************************************************************************* + * Copyright (c) 2011 Mia-Software + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Emmanuelle Rouillé (Mia-Software) - Bug 352618 - To be able to use non derived facet structural features and save them values. + * Nicolas Bros (Mia-Software) - Bug 361612 - New core for new version of the Facet metamodel + * Gregoire Dupe (Mia-Software) - Bug 361794 - [Restructuring] New customization meta-model + * Gregoire Dupe (Mia-Software) - Bug 369987 - [Restructuring][Table] Switch to the new customization and facet framework + * Gregoire Dupe (Mia-Software) - Bug 373078 - API Cleaning + * Thomas Cicognani (Soft-Maint) - Bug 463658 - Impossibility to just create a FacetManager + *******************************************************************************/ +package org.eclipse.modisco.facet.efacet.core; + +import org.eclipse.emf.ecore.EStructuralFeature; +import org.eclipse.emf.ecore.resource.Resource; +import org.eclipse.emf.ecore.resource.ResourceSet; +import org.eclipse.modisco.facet.efacet.core.internal.FacetManagerFactory; + +/** + * Factory for {@link IFacetManager}. + * + * @since 0.2 + * @noimplement This interface is not intended to be implemented by clients. + * @noextend This interface is not intended to be extended by clients. + */ +public interface IFacetManagerFactory { + + /** + * The singleton instance of the factory. + */ + IFacetManagerFactory DEFAULT = new FacetManagerFactory(); + + /** + * Create an {@link IFacetManager}. + * + * @param resource + * the {@link Resource} in which virtual {@link EStructuralFeature}s are serialized. + * Can be null if no EStructuralFeature provided a Facet are used. + * @deprecated Use {@link #getOrCreateDefaultFacetManagerWithSerializationResource(Resource)} instead. The new method name is more understandable + */ + @Deprecated + IFacetManager getOrCreateFacetManager(Resource resource); + + /** + * Get an existing {@link IFacetManager} or create a new one. + * + * @param resource + * the {@link Resource} in which virtual + * {@link EStructuralFeature}s are serialized. Can be + * <code>null</code> if no EStructuralFeature provided a Facet + * are used. + * @return The default IFacetManager associated to the Resource + * @since 1.0 + */ + IFacetManager getOrCreateDefaultFacetManagerWithSerializationResource( + Resource resource); + + + /** + * Create an {@link IFacetManager}. + * + * @param resourceSet + * the resourceSet which will be used to manage the facet models. + * @deprecated Use {@link #getOrCreateDefaultFacetManager(ResourceSet)} instead. The new method name is more understandable + * + */ + @Deprecated + IFacetManager getOrCreateFacetManager(ResourceSet resourceSet); + + /** + * Get an existing {@link IFacetManager} or create a new one. + * + * @param resourceSet + * the resourceSet which will be used to manage the facet models. + * @return The default IFacetManager associated to the ResourceSet + * @since 1.0 + */ + IFacetManager getOrCreateDefaultFacetManager(ResourceSet resourceSet); + + /** + * Create a new {@link IFacetManager}. + * + * @param resource + * the {@link Resource} in which virtual + * {@link EStructuralFeature}s are serialized. Can be + * <code>null</code> if no EStructuralFeature provided a Facet + * are used. + * @since 1.0 + */ + IFacetManager createFacetManagerWithSerializationResource(Resource resource); + + /** + * Create a new {@link IFacetManager}. + * + * @param resourceSet + * the resourceSet which will be used to manage the facet models. + * @since 1.0 + */ + IFacetManager createFacetManager(ResourceSet resourceSet); + +}
diff --git a/org.eclipse.modisco.facet.efacet.core/src/org/eclipse/modisco/facet/efacet/core/IFacetManagerListener.java b/org.eclipse.modisco.facet.efacet.core/src/org/eclipse/modisco/facet/efacet/core/IFacetManagerListener.java new file mode 100644 index 0000000..b7995dc --- /dev/null +++ b/org.eclipse.modisco.facet.efacet.core/src/org/eclipse/modisco/facet/efacet/core/IFacetManagerListener.java
@@ -0,0 +1,28 @@ +/******************************************************************************* + * Copyright (c) 2013 Mia-Maint + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Thomas Cicognani (Soft-Maint) - Bug 420193 - Listener on FacetManager + * Thomas Cicognani (Soft-Maint) - Bug 472075 - Update API to create UI shortcuts to activate FacetSets + *******************************************************************************/ +package org.eclipse.modisco.facet.efacet.core; + +/** + * This interface allows clients to manage listeners added on the + * {@link IFacetManager} + * + * @since 0.4 + * @noextend This interface is not intended to be extended by clients. + */ +public interface IFacetManagerListener { + + /** + * Notifies that the {@link IFacetManager} has changed. + */ + void facetManagerChanged(); + +}
diff --git a/org.eclipse.modisco.facet.efacet.core/src/org/eclipse/modisco/facet/efacet/core/IFacetManagerProvider.java b/org.eclipse.modisco.facet.efacet.core/src/org/eclipse/modisco/facet/efacet/core/IFacetManagerProvider.java new file mode 100644 index 0000000..36fdd6a --- /dev/null +++ b/org.eclipse.modisco.facet.efacet.core/src/org/eclipse/modisco/facet/efacet/core/IFacetManagerProvider.java
@@ -0,0 +1,20 @@ +/******************************************************************************* + * Copyright (c) 2014 Mia-Software + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Gregoire Dupe (Mia-Software) - Bug 441051 - Reusable customization and facet loading dialogs + *******************************************************************************/ +package org.eclipse.modisco.facet.efacet.core; + +/** + * @since 0.5 + */ +public interface IFacetManagerProvider { + + IFacetManager getFacetManager(); + +}
diff --git a/org.eclipse.modisco.facet.efacet.core/src/org/eclipse/modisco/facet/efacet/core/IFacetSetCatalogManager.java b/org.eclipse.modisco.facet.efacet.core/src/org/eclipse/modisco/facet/efacet/core/IFacetSetCatalogManager.java new file mode 100644 index 0000000..783c318 --- /dev/null +++ b/org.eclipse.modisco.facet.efacet.core/src/org/eclipse/modisco/facet/efacet/core/IFacetSetCatalogManager.java
@@ -0,0 +1,28 @@ +/******************************************************************************* + * Copyright (c) 2012 Mia-Software. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Gregoire Dupe (Mia-Software) - Bug 369987 - [Restructuring][Table] Switch to the new customization and facet framework + * Gregoire Dupe (Mia-Software) - Bug 373078 - API Cleaning + *******************************************************************************/ +package org.eclipse.modisco.facet.efacet.core; + +import java.util.Collection; + +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.FacetSet; + +/** + * @since 0.2 + * @noimplement This interface is not intended to be implemented by clients. + * @noextend This interface is not intended to be extended by clients. + */ +public interface IFacetSetCatalogManager { + + Collection<FacetSet> getRegisteredFacetSets(); + + void registerFacetSet(FacetSet facetSet); +}
diff --git a/org.eclipse.modisco.facet.efacet.core/src/org/eclipse/modisco/facet/efacet/core/IFacetSetCatalogManagerFactory.java b/org.eclipse.modisco.facet.efacet.core/src/org/eclipse/modisco/facet/efacet/core/IFacetSetCatalogManagerFactory.java new file mode 100644 index 0000000..ee897ea --- /dev/null +++ b/org.eclipse.modisco.facet.efacet.core/src/org/eclipse/modisco/facet/efacet/core/IFacetSetCatalogManagerFactory.java
@@ -0,0 +1,28 @@ +/** + * Copyright (c) 2012 Mia-Software. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Gregoire Dupe (Mia-Software) - Bug 369987 - [Restructuring][Table] Switch to the new customization and facet + * Gregoire Dupe (Mia-Software) - Bug 373078 - API Cleaning + */ +package org.eclipse.modisco.facet.efacet.core; + +import org.eclipse.emf.ecore.resource.ResourceSet; +import org.eclipse.modisco.facet.efacet.core.internal.FacetCatalogManagerFactory; + +/** + * @since 0.2 + * @noimplement This interface is not intended to be implemented by clients. + * @noextend This interface is not intended to be extended by clients. + */ +public interface IFacetSetCatalogManagerFactory { + + IFacetSetCatalogManagerFactory DEFAULT = new FacetCatalogManagerFactory(); + + IFacetSetCatalogManager getOrCreateFacetSetCatalogManager(ResourceSet resourceSet); +}
diff --git a/org.eclipse.modisco.facet.efacet.core/src/org/eclipse/modisco/facet/efacet/core/exception/DerivedTypedElementException.java b/org.eclipse.modisco.facet.efacet.core/src/org/eclipse/modisco/facet/efacet/core/exception/DerivedTypedElementException.java new file mode 100644 index 0000000..daabe80 --- /dev/null +++ b/org.eclipse.modisco.facet.efacet.core/src/org/eclipse/modisco/facet/efacet/core/exception/DerivedTypedElementException.java
@@ -0,0 +1,40 @@ +/** + * Copyright (c) 2009 Mia-Software. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Gregoire Dupe (Mia-Software) - initial API and implementation + * Nicolas Bros (Mia-Software) - Bug 362191 - [Restructuring] Query mechanism for eFacet2 + */ +package org.eclipse.modisco.facet.efacet.core.exception; + +import org.eclipse.modisco.facet.efacet.core.internal.exception.DerivedTypedElementEvaluationException; + +/** + * This exception is raised when something is wrong with a query, and there is not a more specific + * sub-class to describe the error (e.g. {@link DerivedTypedElementEvaluationException} ) + * @since 0.2 + */ +public class DerivedTypedElementException extends Exception { + + // This class is a copy of : + // org.eclipse.emf.facet.infra.query.core.exception.ModelQueryException + + private static final long serialVersionUID = -3203874059325745157L; + + public DerivedTypedElementException(final String message) { + super(message); + } + + public DerivedTypedElementException(final String message, final Throwable cause) { + super(message, cause); + } + + public DerivedTypedElementException(final Throwable cause) { + super(cause); + } + +}
diff --git a/org.eclipse.modisco.facet.efacet.core/src/org/eclipse/modisco/facet/efacet/core/exception/FacetManagerException.java b/org.eclipse.modisco.facet.efacet.core/src/org/eclipse/modisco/facet/efacet/core/exception/FacetManagerException.java new file mode 100644 index 0000000..cc1cb03 --- /dev/null +++ b/org.eclipse.modisco.facet.efacet.core/src/org/eclipse/modisco/facet/efacet/core/exception/FacetManagerException.java
@@ -0,0 +1,37 @@ +/** + * Copyright (c) 2012 Mia-Software. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Gregoire Dupe (Mia-Software) - Bug 369987 - [Restructuring][Table] Switch to the new customization and facet framework + */ +package org.eclipse.modisco.facet.efacet.core.exception; + +/** + * @since 0.2 + */ +public class FacetManagerException extends Exception { + + private static final long serialVersionUID = -4670132391244495825L; + + public FacetManagerException() { + super(); + } + + public FacetManagerException(final String message) { + super(message); + } + + public FacetManagerException(final Throwable cause) { + super(cause); + } + + public FacetManagerException(final String message, final Throwable cause) { + super(message, cause); + } + +}
diff --git a/org.eclipse.modisco.facet.efacet.core/src/org/eclipse/modisco/facet/efacet/core/exception/SuperInvokeException.java b/org.eclipse.modisco.facet.efacet.core/src/org/eclipse/modisco/facet/efacet/core/exception/SuperInvokeException.java new file mode 100644 index 0000000..be1fa28 --- /dev/null +++ b/org.eclipse.modisco.facet.efacet.core/src/org/eclipse/modisco/facet/efacet/core/exception/SuperInvokeException.java
@@ -0,0 +1,36 @@ +/** + * Copyright (c) 2014 Mia-Software. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Gregoire Dupe (Mia-Software) - Bug 443682 - Access to the super facet + */ +package org.eclipse.modisco.facet.efacet.core.exception; + +/** + * @since 1.0 + */ +public class SuperInvokeException extends Exception { + + private static final long serialVersionUID = -2090554884512810064L; + + public SuperInvokeException() { + super(); + } + + public SuperInvokeException(final String message) { + super(message); + } + + public SuperInvokeException(final Throwable cause) { + super(cause); + } + + public SuperInvokeException(final String message, final Throwable cause) { + super(message, cause); + } + +}
diff --git a/org.eclipse.modisco.facet.efacet.core/src/org/eclipse/modisco/facet/efacet/core/internal/Activator.java b/org.eclipse.modisco.facet.efacet.core/src/org/eclipse/modisco/facet/efacet/core/internal/Activator.java new file mode 100644 index 0000000..ad15757 --- /dev/null +++ b/org.eclipse.modisco.facet.efacet.core/src/org/eclipse/modisco/facet/efacet/core/internal/Activator.java
@@ -0,0 +1,46 @@ +/** + * Copyright (c) 2011 Mia-Software. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Nicolas Guyomar (Mia-Software) - Bug 333553 - The user has not to deal with two files to create a facet + */ +package org.eclipse.modisco.facet.efacet.core.internal; + +import org.eclipse.core.runtime.Plugin; +import org.osgi.framework.BundleContext; + +public class Activator extends Plugin { + + private static BundleContext context; + + static BundleContext getContext() { + return Activator.context; + } + + @Override + public void start(final BundleContext bundleContext) throws Exception { + super.start(bundleContext); + Activator.context = bundleContext; + Activator.plugin = this; + } + + @Override + public void stop(final BundleContext bundleContext) throws Exception { + Activator.context = null; + Activator.plugin = null; + super.stop(bundleContext); + } + + // The shared instance + private static Activator plugin; + + public static Plugin getDefault() { + return Activator.plugin; + } + +}
diff --git a/org.eclipse.modisco.facet.efacet.core/src/org/eclipse/modisco/facet/efacet/core/internal/CastUtils.java b/org.eclipse.modisco.facet.efacet.core/src/org/eclipse/modisco/facet/efacet/core/internal/CastUtils.java new file mode 100644 index 0000000..cc6bc27 --- /dev/null +++ b/org.eclipse.modisco.facet.efacet.core/src/org/eclipse/modisco/facet/efacet/core/internal/CastUtils.java
@@ -0,0 +1,91 @@ +/******************************************************************************* + * Copyright (c) 2011, 2016 Mia-Software, and Soft-Maint. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Emmanuelle Rouillé (Mia-Software) - Bug 352618 - To be able to use non derived facet structural features and save them values. + * Nicolas Bros (Mia-Software) - Bug 361612 - New core for new version of the Facet metamodel + * Grégoire Dupé (Mia-Software) - Bug 361612 - [Restructuring] New core for new version of the Facet metamodel + * Alban Ménager (Soft-Maint) - Bug 387470 - [EFacet][Custom] Editors + * Jonathan Pepin (Soft-Maint) - Bug 463898 - Create FacetReference not derived, without query and with opposite mechanism + * Jonathan Pepin (Soft-Maint) - Bug 510034 - Null value is wrongly casted in a new list + *******************************************************************************/ +package org.eclipse.modisco.facet.efacet.core.internal; + +import java.util.Iterator; +import java.util.List; + +import org.eclipse.modisco.facet.efacet.core.internal.exception.UnmatchingExpectedTypeException; + +public final class CastUtils { + + private CastUtils() { + //Must no be used. + } + + public static <T> List<T> castToExpectedListType(final Object object, + final Class<T> expectedType, final boolean canContainsNull) + throws UnmatchingExpectedTypeException { + List<T> result = null; + if (object != null) { + if (!(object instanceof List)) { + throw new UnmatchingExpectedTypeException( + "The parameter 'object' is not a List"); //$NON-NLS-1$ + } + final List<?> list = (List<?>) object; + result = castToExpectedListType(list, expectedType, canContainsNull); + } + return result; + } + + @SuppressWarnings("unchecked") + /* + * @SuppressWarnings("unchecked") jpepin> The cast checked is done by the + * method 'checkTypeOfAllListElements' + */ + public static <T> List<T> castToExpectedListType(final List<?> list, + final Class<T> expectedType, final boolean canContainsNull) + throws UnmatchingExpectedTypeException { + checkTypeOfAllListElements(list, expectedType, canContainsNull); + return (List<T>) list; + } + + @SuppressWarnings("unchecked") + //@SuppressWarnings("unchecked") This method is used to isolate unsafe cast. + public static <T> T castToExpectedType(final Object value, final Class<T> expectedType) + throws UnmatchingExpectedTypeException { + try { + return (T) value; + } catch (ClassCastException e) { + throw new UnmatchingExpectedTypeException("Type mismatch. Expected: " + //$NON-NLS-1$ + expectedType.getClass().getName() + ", got " + value.getClass().getName(), e); //$NON-NLS-1$); + } + } + + public static void checkTypeOfAllListElements(final List<?> list, + final Class<?> expectedType, final boolean canContainsNull) + throws UnmatchingExpectedTypeException { + if (expectedType == null) { + // null means match everything + return; + } + final Iterator<?> iterator = list.iterator(); + int index = -1; + while (iterator.hasNext()) { + final Object object = iterator.next(); + index++; + if (!canContainsNull && object == null) { + throw new UnmatchingExpectedTypeException( + "The 'no null' constraint is violated at index " //$NON-NLS-1$ + + index, expectedType, object); + } + if (object != null && !expectedType.isInstance(object)) { + throw new UnmatchingExpectedTypeException("Type mismatch at index " + index, expectedType, object); //$NON-NLS-1$ + } + } + } + +}
diff --git a/org.eclipse.modisco.facet.efacet.core/src/org/eclipse/modisco/facet/efacet/core/internal/DerivedTypedElementManager.java b/org.eclipse.modisco.facet.efacet.core/src/org/eclipse/modisco/facet/efacet/core/internal/DerivedTypedElementManager.java new file mode 100644 index 0000000..63cbf64 --- /dev/null +++ b/org.eclipse.modisco.facet.efacet.core/src/org/eclipse/modisco/facet/efacet/core/internal/DerivedTypedElementManager.java
@@ -0,0 +1,845 @@ +/** + * Copyright (c) 2011, 2012, 2013, 2014 Mia-Software. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Gregoire Dupe (Mia-Software) - Bug 333553 - The user has not to deal with two files to create a facet + * Emmanuelle Rouillé (Mia-Software) - Bug 352618 - To be able to use non derived facet structural features and save them values. + * Nicolas Bros (Mia-Software) - Bug 361612 - New core for new version of the Facet metamodel + * Nicolas Bros (Mia-Software) - Bug 362191 - [Restructuring] Query mechanism for eFacet2 + * Gregoire Dupe (Mia-Software) - Bug 369987 - [Restructuring][Table] Switch to the new customization and facet framework + * Gregoire Dupe (Mia-Software) - Bug 364325 - [Restructuring] The user must be able to navigate into a model using the Facet. + * Gregoire Dupe (Mia-Software) - Bug 373078 - API Cleaning + * Nicolas Bros (Mia-Software) - Bug 376941 - [EFacet] Facet operation arguments in Facet model + * Alban Ménager (Soft-Maint) - Bug 387470 - [EFacet][Custom] Editors + * Gregoire Dupe (Mia-Software) - Bug 418885 - ETypedElementSwitchQuery implemented using a deprecated query evaluator extension point + * Gregoire Dupe (Mia-Software) - Bug 441570 - Children custom property + */ +package org.eclipse.modisco.facet.efacet.core.internal; + +import java.util.Collection; +import java.util.LinkedList; +import java.util.List; + +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.EClassifier; +import org.eclipse.emf.ecore.EDataType; +import org.eclipse.emf.ecore.EObject; +import org.eclipse.modisco.facet.efacet.core.IDerivedTypedElementManager; +import org.eclipse.modisco.facet.efacet.core.IFacetManager; +import org.eclipse.modisco.facet.efacet.core.exception.DerivedTypedElementException; +import org.eclipse.modisco.facet.efacet.core.internal.exception.DerivedTypedElementEvaluationException; +import org.eclipse.modisco.facet.efacet.core.internal.exception.DerivedTypedElementTypeCheckingException; +import org.eclipse.modisco.facet.efacet.core.internal.exception.UnmatchingExpectedTypeException; +import org.eclipse.modisco.facet.efacet.core.internal.query.QueryImplementationFactoryRegistry; +import org.eclipse.modisco.facet.efacet.core.internal.query.QueryUtils; +import org.eclipse.modisco.facet.efacet.core.query.IQueryImplementation; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.DerivedTypedElement; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.ParameterValue; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.extensible.Query; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.runtime.ETypedElementResult; +import org.eclipse.modisco.facet.util.core.Logger; + +public class DerivedTypedElementManager implements IDerivedTypedElementManager { + + private static final boolean SET_AS_LIST = Boolean.getBoolean(DerivedTypedElementManager.class.getName() + ".setAsList"); //$NON-NLS-1$ + + public Object evaluate(final DerivedTypedElement derivedTypedElement, + final EObject source, final List<ParameterValue> parameterValues, + final IFacetManager facetManager) + throws DerivedTypedElementException { + Object result; + if (derivedTypedElement.isMany()) { + result = evaluateMultiValued(derivedTypedElement, source, parameterValues, null, facetManager); + } else { + result = evaluateSingleValued(derivedTypedElement, source, parameterValues, null, facetManager); + } + return result; + } + + public Object evaluate(final Query query, final EObject source, final List<ParameterValue> parameterValues, final IFacetManager facetManager) + throws DerivedTypedElementException { + final IQueryImplementation evaluator = QueryImplementationFactoryRegistry.INSTANCE.getEvaluatorFor(query, this); + final DerivedTypedElement derivedTE = QueryUtils.getOwningDerivedTypedElement(query); + Object result; + try { + result = evaluator.getValue(query, derivedTE, source, parameterValues, facetManager); + } catch (Exception e) { + throw new DerivedTypedElementEvaluationException(e); + } + return result; + } + + public <T> T evaluateSingleValued(final DerivedTypedElement derivedTypedElement, + final EObject source, final List<ParameterValue> parameterValues, final Class<T> expectedType, final IFacetManager facetManager) + throws DerivedTypedElementException { + if (derivedTypedElement.isMany()) { + throw new IllegalArgumentException("This method doesn't accept a multi-valued derived typed element."); //$NON-NLS-1$ + } + + Query query = derivedTypedElement.getQuery(); + if (query == null) { + throw new DerivedTypedElementException("The given derived typed element doesn't contain a query"); //$NON-NLS-1$ + } + Object queryResult = evaluate(derivedTypedElement, source, parameterValues, facetManager, query); + + // expectedResultType == null means match everything + // And a null value for queryResult matches any type + if (expectedType != null && queryResult != null && !expectedType.isInstance(queryResult)) { + Exception e1 = new UnmatchingExpectedTypeException( + "The derived typed element did not evaluate to the expected type", expectedType, queryResult); //$NON-NLS-1$ + throw new DerivedTypedElementException(e1); + } + // just checked + @SuppressWarnings("unchecked") + T typedQueryResult = (T) queryResult; + return typedQueryResult; + } + + public <T> List<T> evaluateMultiValued(final DerivedTypedElement derivedTypedElement, + final EObject source, final List<ParameterValue> parameterValues, final Class<T> expectedType, final IFacetManager facetManager) + throws DerivedTypedElementException { + if (!derivedTypedElement.isMany()) { + throw new IllegalArgumentException("This method doesn't accept a single-valued derived typed element."); //$NON-NLS-1$ + } + + Query query = derivedTypedElement.getQuery(); + if (query == null) { + throw new DerivedTypedElementException("The given derived typed element doesn't contain a query"); //$NON-NLS-1$ + } + Object queryResult = evaluate(derivedTypedElement, source, parameterValues, facetManager, query); + if (SET_AS_LIST) { + /* + * gdupe> This conversion seem to be a bit too magic to be a default + * behavior. + */ + queryResult = setAsList(queryResult); + } + List<T> result = null; + if (queryResult instanceof List<?>) { + List<?> queryListResult = (List<?>) queryResult; + for (Object queryResultElement : queryListResult) { + // expectedType == null means match everything + // And a null queryResultElement for queryResult matches any type + if (expectedType != null && queryResultElement != null && !expectedType.isInstance(queryResultElement)) { + Exception e1 = new UnmatchingExpectedTypeException( + "The derived typed element did not evaluate to the expected type"); //$NON-NLS-1$ + throw new DerivedTypedElementException(e1); + } + } + // just checked + @SuppressWarnings("unchecked") + List<T> typedQueryListResult = (List<T>) queryListResult; + result = typedQueryListResult; + } else if (queryResult != null) { + throw new DerivedTypedElementException("The given multi-valued derived typed element did not evaluate to a List."); //$NON-NLS-1$ + } + return result; + } + + protected Object evaluate(final DerivedTypedElement derivedTE, final EObject source, final List<ParameterValue> parameterValues, + final IFacetManager facetManager, final Query query) throws DerivedTypedElementException { + final IQueryImplementation evaluator = QueryImplementationFactoryRegistry.INSTANCE + .getEvaluatorFor(query, this); + return evaluateAndCheck(derivedTE.getQuery(), source, parameterValues, + evaluator, facetManager); + } + + private static Object evaluateAndCheck(final Query query, final EObject source, final List<ParameterValue> parameterValues, + final IQueryImplementation evaluator, final IFacetManager facetManager) + throws DerivedTypedElementException { + checkQuery(query, source); + Object result; + try { + result = evaluator.getValue(query, QueryUtils.getOwningDerivedTypedElement(query), source, parameterValues, facetManager); + } catch (Throwable e) { + if (e instanceof DerivedTypedElementEvaluationException) { + throw (DerivedTypedElementEvaluationException) e; + } + throw new DerivedTypedElementEvaluationException(e); + } + checkResult(query, result, evaluator.isCheckResultType(), isPrimitive(QueryUtils.getReturnType(query))); + return result; + } + + private static void checkQuery(final Query query, final EObject source) throws DerivedTypedElementException { + if (query == null) { + throw new IllegalArgumentException("query cannot be null"); //$NON-NLS-1$ + } + + EClassifier sourceType = QueryUtils.getSourceType(query); + if (sourceType == null && source != null) { + throw new DerivedTypedElementException("the query's sourceType is null and the source is not null"); //$NON-NLS-1$ + } + + // a null value for eObject matches any type + if (sourceType != null && source != null && !sourceType.isInstance(source)) { + StringBuffer message = new StringBuffer(); + message.append("Wrong source type (for " + QueryUtils.getQueryDescription(query) + "): '"); //$NON-NLS-1$ //$NON-NLS-2$ + message.append(source.eClass().getName()); + message.append("' found; expected '"); //$NON-NLS-1$ + message.append(sourceType.getName()); + message.append("'."); //$NON-NLS-1$ + throw new DerivedTypedElementTypeCheckingException(message.toString()); + } + } + + // public List<? extends AbstractDerivedTypedElementResult> evaluate(final DerivedTypedElement + // derivedTypedElement, final Collection<EObject> sources, + // final List<ParameterValue> parameterValues) throws DerivedTypedElementException { + // if (derivedTypedElement.isMany()) { + // try { + // return evaluateSingleValued(derivedTypedElement, sources, parameterValues, null); + // } catch (UnmatchingExpectedTypeException e) { + // // should never happen + // throw new IllegalStateException("Unexpected error"); //$NON-NLS-1$ + // } + // } else { + // try { + // return evaluateMultiValued(derivedTypedElement, sources, parameterValues, null); + // } catch (UnmatchingExpectedTypeException e) { + // // should never happen + // throw new IllegalStateException("Unexpected error"); //$NON-NLS-1$ + // } + // } + // } + + + // batch evaluation disabled : Bug 365429 - DerivedTypedElementManager : re-implement batch evaluation + + public <T extends ETypedElementResult> List<T> batchEvaluate(final DerivedTypedElement derivedTypedElement, + final Collection<? extends EObject> sources, final List<ParameterValue> parameterValues, final Class<T> expectedType, final IFacetManager facetManager) + throws DerivedTypedElementException { + + throw new UnsupportedOperationException("not implemented yet"); //$NON-NLS-1$ + +// if (derivedTypedElement == null) { +// throw new IllegalArgumentException("The given derived typed element must not be null"); //$NON-NLS-1$ +// } +// +// List<T> abstractResultList; +// +// Query query = derivedTypedElement.getQuery(); +// if (query == null) { +// throw new DerivedTypedElementException("The given derived typed element doesn't contain a query"); //$NON-NLS-1$ +// } +// EClassifier eType = derivedTypedElement.getEType(); +// if (eType == null) { +// throw new DerivedTypedElementException("The given derived typed element has a null type"); //$NON-NLS-1$ +// } +// IDerivedTypedElementImplementation evaluator = DerivedTypedElementImplementationFactoryRegistry.INSTANCE.getEvaluatorFor(query); +// if (evaluator == null) { +// throw new DerivedTypedElementEvaluationException("No evaluator was found for a query of type " + query.getClass().getName()); //$NON-NLS-1$ +// } +// +// final boolean primitiveType = isPrimitive(eType); +// +// // if the evaluator implements multiple evaluation itself, then use it +// if (evaluator instanceof IDerivedTypedElementCollectionImplementation) { +// IDerivedTypedElementCollectionImplementation collectionEvaluator = (IDerivedTypedElementCollectionImplementation) evaluator; +// if (derivedTypedElement.isMany()) { +// if (primitiveType) { +// if (expectedType != DerivedTypedElementPrimitiveTypeListResult.class) { +// throw new UnmatchingExpectedTypeException("The derivedTypedElement is multi-valued, and its type is primitive, " + //$NON-NLS-1$ +// "so expectedType must be " + DerivedTypedElementPrimitiveTypeListResult.class.getSimpleName()); //$NON-NLS-1$ +// } +// List<DerivedTypedElementPrimitiveTypeListResult<?>> listResultList = batchEvaluateMultiValuedPrimitiveDerivedTypedElementWithCollectionEvaluator( +// derivedTypedElement, sources, parameterValues, collectionEvaluator); +// // we just checked the type parameter T through expectedType +// @SuppressWarnings("unchecked") +// List<T> castList = (List<T>) listResultList; +// abstractResultList = castList; +// } else { +// if (expectedType != DerivedTypedElementEObjectListResult.class) { +// throw new UnmatchingExpectedTypeException("The derivedTypedElement is multi-valued, and it returns model elements, " + //$NON-NLS-1$ +// "so expectedType must be " + DerivedTypedElementEObjectListResult.class.getSimpleName()); //$NON-NLS-1$ +// } +// List<DerivedTypedElementEObjectListResult<?>> listResultList = batchEvaluateMultiValuedEObjectDerivedTypedElementWithCollectionEvaluator( +// derivedTypedElement, sources, parameterValues, collectionEvaluator); +// // we just checked the type parameter T through expectedType +// @SuppressWarnings("unchecked") +// List<T> castList = (List<T>) listResultList; +// abstractResultList = castList; +// } +// } else { +// if (primitiveType) { +// if (expectedType != DerivedTypedElementPrimitiveTypeResult.class) { +// throw new UnmatchingExpectedTypeException("The derivedTypedElement is single-valued, and its type is primitive, " + //$NON-NLS-1$ +// "so expectedType must be " + DerivedTypedElementPrimitiveTypeResult.class.getSimpleName()); //$NON-NLS-1$ +// } +// List<DerivedTypedElementPrimitiveTypeResult<?>> resultList = batchEvaluateSingleValuedPrimitiveDerivedTypedElementWithCollectionEvaluator( +// derivedTypedElement, sources, parameterValues, collectionEvaluator); +// // we just checked the type parameter T through expectedType +// @SuppressWarnings("unchecked") +// List<T> castList = (List<T>) resultList; +// abstractResultList = castList; +// } else { +// if (expectedType != DerivedTypedElementEObjectResult.class) { +// throw new UnmatchingExpectedTypeException("The derivedTypedElement is single-valued, and it returns a model element, " + //$NON-NLS-1$ +// "so expectedType must be " + DerivedTypedElementEObjectResult.class.getSimpleName()); //$NON-NLS-1$ +// } +// List<DerivedTypedElementEObjectResult<?>> resultList = batchEvaluateSingleValuedEObjectDerivedTypedElementWithCollectionEvaluator( +// derivedTypedElement, sources, parameterValues, collectionEvaluator); +// // we just checked the type parameter T through expectedType +// @SuppressWarnings("unchecked") +// List<T> castList = (List<T>) resultList; +// abstractResultList = castList; +// } +// } +// +// } else { +// // otherwise, do multiple evaluation by calling the evaluator's +// // single evaluation multiple times +// +// if (derivedTypedElement.isMany()) { +// if (primitiveType) { +// if (expectedType != DerivedTypedElementPrimitiveTypeListResult.class) { +// throw new UnmatchingExpectedTypeException("The derivedTypedElement is multi-valued, and its type is primitive, " + //$NON-NLS-1$ +// "so expectedType must be " + DerivedTypedElementPrimitiveTypeListResult.class.getSimpleName()); //$NON-NLS-1$ +// } +// List<DerivedTypedElementPrimitiveTypeListResult<?>> listResultList = batchEvaluateMultiValuedPrimitiveDerivedTypedElementWithSimpleEvaluator( +// derivedTypedElement, sources, parameterValues, evaluator); +// @SuppressWarnings("unchecked") +// List<T> castList = (List<T>) listResultList; +// abstractResultList = castList; +// } else { +// if (expectedType != DerivedTypedElementEObjectListResult.class) { +// throw new UnmatchingExpectedTypeException("The derivedTypedElement is multi-valued, and it returns model elements, " + //$NON-NLS-1$ +// "so expectedType must be " + DerivedTypedElementEObjectListResult.class.getSimpleName()); //$NON-NLS-1$ +// } +// List<DerivedTypedElementEObjectListResult<?>> listResultList = batchEvaluateMultiValuedEObjectDerivedTypedElementWithSimpleEvaluator( +// derivedTypedElement, sources, parameterValues, evaluator); +// @SuppressWarnings("unchecked") +// List<T> castList = (List<T>) listResultList; +// abstractResultList = castList; +// } +// } else { +// if (primitiveType) { +// if (expectedType != DerivedTypedElementPrimitiveTypeResult.class) { +// throw new UnmatchingExpectedTypeException("The derivedTypedElement is single-valued, and its type is primitive, " + //$NON-NLS-1$ +// "so expectedType must be " + DerivedTypedElementPrimitiveTypeResult.class.getSimpleName()); //$NON-NLS-1$ +// } +// List<DerivedTypedElementPrimitiveTypeResult<?>> resultList = batchEvaluateSingleValuedPrimitiveDerivedTypedElementWithSimpleCollectionEvaluator( +// derivedTypedElement, sources, parameterValues, evaluator); +// @SuppressWarnings("unchecked") +// List<T> castList = (List<T>) resultList; +// abstractResultList = castList; +// } else { +// if (expectedType != DerivedTypedElementEObjectResult.class) { +// throw new UnmatchingExpectedTypeException("The derivedTypedElement is single-valued, and it returns a model element, " + //$NON-NLS-1$ +// "so expectedType must be " + DerivedTypedElementEObjectResult.class.getSimpleName()); //$NON-NLS-1$ +// } +// List<DerivedTypedElementEObjectResult<?>> resultList = batchEvaluateSingleValuedEObjectDerivedTypedElementWithSimpleCollectionEvaluator( +// derivedTypedElement, sources, parameterValues, null); +// @SuppressWarnings("unchecked") +// List<T> castList = (List<T>) resultList; +// abstractResultList = castList; +// } +// } +// } +// return abstractResultList; + } + +// private static List<DerivedTypedElementPrimitiveTypeListResult<?>> batchEvaluateMultiValuedPrimitiveDerivedTypedElementWithCollectionEvaluator( +// final DerivedTypedElement derivedTypedElement, final Collection<EObject> sources, final List<ParameterValue> parameterValues, +// final IDerivedTypedElementCollectionImplementation collectionEvaluator) +// throws DerivedTypedElementException { +// +// List<? extends AbstractDerivedTypedElementResult> listResultList = collectionEvaluator +// .getValues(derivedTypedElement, sources, parameterValues); +// +// // check the return type from the evaluator in order to be able to cast safely +// for (int index = 0; index < listResultList.size(); index++) { +// AbstractDerivedTypedElementResult elementResult = listResultList.get(index); +// if (elementResult instanceof DerivedTypedElementPrimitiveTypeListResult<?>) { +// DerivedTypedElementPrimitiveTypeListResult<?> derivedTypedElementPrimitiveTypeListResult = (DerivedTypedElementPrimitiveTypeListResult<?>) elementResult; +// checkResult(derivedTypedElement.getQuery(), derivedTypedElementPrimitiveTypeListResult.getResultList(), +// collectionEvaluator.getCheckResultType()); +// } else { +// throw new DerivedTypedElementEvaluationException(ErrorHandlingUtils.buildWrongTypeMessage( +// "Wrong element type at index " + index + " in the result from the evaluator: " + collectionEvaluator.getClass().getName(), //$NON-NLS-1$//$NON-NLS-2$ +// DerivedTypedElementPrimitiveTypeListResult.class, elementResult)); +// } +// } +// +// // just checked +// @SuppressWarnings("unchecked") +// List<DerivedTypedElementPrimitiveTypeListResult<?>> result = (List<DerivedTypedElementPrimitiveTypeListResult<?>>) listResultList; +// return result; +// } +// +// private static List<DerivedTypedElementEObjectListResult<?>> batchEvaluateMultiValuedEObjectDerivedTypedElementWithCollectionEvaluator( +// final DerivedTypedElement derivedTypedElement, final Collection<EObject> sources, final List<ParameterValue> parameterValues, +// final IDerivedTypedElementCollectionImplementation collectionEvaluator) +// throws DerivedTypedElementException { +// List<? extends AbstractDerivedTypedElementResult> listResultList = collectionEvaluator +// .getValues(derivedTypedElement, sources, parameterValues); +// +// // check the return type from the evaluator in order to be able to cast safely +// for (int index = 0; index < listResultList.size(); index++) { +// AbstractDerivedTypedElementResult elementResult = listResultList.get(index); +// if (elementResult instanceof DerivedTypedElementEObjectListResult<?>) { +// DerivedTypedElementEObjectListResult<?> derivedTypedElementEObjectListResult = (DerivedTypedElementEObjectListResult<?>) elementResult; +// checkResult(derivedTypedElement.getQuery(), derivedTypedElementEObjectListResult.getResultList(), +// collectionEvaluator.getCheckResultType()); +// } else { +// throw new DerivedTypedElementEvaluationException(ErrorHandlingUtils.buildWrongTypeMessage( +// "Wrong element type at index " + index + " in the result from the evaluator: " + collectionEvaluator.getClass().getName(), //$NON-NLS-1$//$NON-NLS-2$ +// DerivedTypedElementEObjectListResult.class, elementResult)); +// } +// } +// +// // just checked +// @SuppressWarnings("unchecked") +// List<DerivedTypedElementEObjectListResult<?>> result = (List<DerivedTypedElementEObjectListResult<?>>) listResultList; +// return result; +// } +// +// private static List<DerivedTypedElementPrimitiveTypeResult<?>> batchEvaluateSingleValuedPrimitiveDerivedTypedElementWithCollectionEvaluator( +// final DerivedTypedElement derivedTypedElement, final Collection<EObject> sources, final List<ParameterValue> parameterValues, +// final IDerivedTypedElementCollectionImplementation collectionEvaluator) +// throws DerivedTypedElementException { +// // TODO Auto-generated method stub +// return null; +// } +// +// private static List<DerivedTypedElementEObjectResult<?>> batchEvaluateSingleValuedEObjectDerivedTypedElementWithCollectionEvaluator( +// final DerivedTypedElement derivedTypedElement, final Collection<EObject> sources, final List<ParameterValue> parameterValues, +// final IDerivedTypedElementCollectionImplementation collectionEvaluator) throws DerivedTypedElementException { +// // TODO Auto-generated method stub +// return null; +// } +// +// private static List<DerivedTypedElementPrimitiveTypeListResult<?>> batchEvaluateMultiValuedPrimitiveDerivedTypedElementWithSimpleEvaluator( +// final DerivedTypedElement derivedTypedElement, final Collection<EObject> sources, final List<ParameterValue> parameterValues, +// final IDerivedTypedElementImplementation evaluator) { +// +// Query query = derivedTypedElement.getQuery(); +// +// List<DerivedTypedElementPrimitiveTypeListResult<?>> listResultList = new ArrayList<DerivedTypedElementPrimitiveTypeListResult<?>>(); +// for (EObject eObject : sources) { +// DerivedTypedElementPrimitiveTypeListResult<Object> primitiveTypeListResult = EFacetFactory.eINSTANCE +// .createDerivedTypedElementPrimitiveTypeListResult(); +// +// Throwable error = null; +// try { +// primitiveTypeListResult.setSource(eObject); +// primitiveTypeListResult.setDerivedTypedElement(derivedTypedElement); +// setParameterValues(primitiveTypeListResult.getParameterValues(), parameterValues); +// checkSourceType(query.getSourceType(), query, eObject); +// } catch (Throwable e) { +// error = e; +// } +// if (error != null) { +// primitiveTypeListResult.setException(error); +// } else { +// try { +// Object evaluationResult = evaluator.getValue(derivedTypedElement, eObject, parameterValues); +// checkResult(query, evaluationResult, evaluator.getCheckResultType()); +// // checked by checkResult +// Collection<?> evaluationResultCollection = (Collection<?>) evaluationResult; +// for (Object object : evaluationResultCollection) { +// primitiveTypeListResult.getResultList().add(object); +// } +// } catch (Throwable e) { +// primitiveTypeListResult.setException(e); +// } +// } +// listResultList.add(primitiveTypeListResult); +// +// } +// return listResultList; +// } +// +// private static List<DerivedTypedElementEObjectListResult<?>> batchEvaluateMultiValuedEObjectDerivedTypedElementWithSimpleEvaluator( +// final DerivedTypedElement derivedTypedElement, final Collection<EObject> sources, final List<ParameterValue> parameterValues, +// final IDerivedTypedElementImplementation evaluator) { +// Query query = derivedTypedElement.getQuery(); +// +// List<DerivedTypedElementEObjectListResult<?>> listResultList = new ArrayList<DerivedTypedElementEObjectListResult<?>>(); +// for (EObject eObject : sources) { +// DerivedTypedElementEObjectListResult<EObject> eObjectListResult = EFacetFactory.eINSTANCE +// .createDerivedTypedElementEObjectListResult(); +// +// Throwable error = null; +// try { +// eObjectListResult.setSource(eObject); +// eObjectListResult.setDerivedTypedElement(derivedTypedElement); +// setParameterValues(eObjectListResult.getParameterValues(), parameterValues); +// checkSourceType(query.getSourceType(), query, eObject); +// } catch (Throwable e) { +// error = e; +// } +// if (error != null) { +// eObjectListResult.setException(error); +// } else { +// try { +// Object evaluationResult = evaluator.getValue(derivedTypedElement, eObject, parameterValues); +// checkResult(query, evaluationResult, evaluator.getCheckResultType(), false); +// // checked by checkResult +// @SuppressWarnings("unchecked") +// Collection<? extends EObject> evaluationResultCollection = (Collection<? extends EObject>) evaluationResult; +// for (EObject e : evaluationResultCollection) { +// eObjectListResult.getResultList().add(e); +// } +// } catch (Throwable e) { +// eObjectListResult.setException(e); +// } +// } +// listResultList.add(eObjectListResult); +// +// } +// return listResultList; +// } +// +// private static List<DerivedTypedElementPrimitiveTypeResult<?>> batchEvaluateSingleValuedPrimitiveDerivedTypedElementWithSimpleCollectionEvaluator( +// final DerivedTypedElement derivedTypedElement, final Collection<EObject> sources, final List<ParameterValue> parameterValues, +// final IDerivedTypedElementImplementation evaluator) +// throws DerivedTypedElementException { +// // TODO Auto-generated method stub +// return null; +// } +// +// private static List<DerivedTypedElementEObjectResult<?>> batchEvaluateSingleValuedEObjectDerivedTypedElementWithSimpleCollectionEvaluator( +// final DerivedTypedElement derivedTypedElement, final Collection<EObject> sources, final List<ParameterValue> parameterValues, +// final IDerivedTypedElementImplementation evaluator) +// throws DerivedTypedElementException { +// // TODO Auto-generated method stub +// return null; +// } + +// public <T> List<DerivedTypedElementListResult<T>> evaluateMultiValued(final DerivedTypedElement derivedTypedElement, +// final Collection<? extends EObject> sources, final List<ParameterValue> parameterValues, +// final Class<T> expectedType) +// throws DerivedTypedElementException, UnmatchingExpectedTypeException { +// if (!derivedTypedElement.isMany()) { +// throw new IllegalArgumentException("This method doesn't accept a single-valued derived typed element."); //$NON-NLS-1$ +// } +// +// Query query = derivedTypedElement.getQuery(); +// if (query == null) { +// throw new DerivedTypedElementException("The given derived typed element doesn't contain a query"); //$NON-NLS-1$ +// } +// IDerivedTypedElementImplementation evaluator = +// DerivedTypedElementImplementationFactoryRegistry.INSTANCE.getEvaluatorFor(query); +// +// List<?> queryResult = batchEvaluateAndCheck(derivedTypedElement, sources, parameterValues, +// evaluator); +// // Java doesn't support co- or contra-variance on generics, +// // so we can't return the right type +// @SuppressWarnings("unchecked") +// List<DerivedTypedElementListResult<T>> multiResultList = +// (List<DerivedTypedElementListResult<T>>) queryResult; +// +// // check each result element in each result list +// if (expectedType != null) { +// int sourceIndex = 0; +// for (DerivedTypedElementListResult<?> derivedTypedElementResult : multiResultList) { +// EList<?> resultList = derivedTypedElementResult.getResultList(); +// int index = 0; +// for (Object resultElement : resultList) { +// // a null value for resultElement matches any type +// if (resultElement != null && !expectedType.isInstance(resultElement)) { +// throw new UnmatchingExpectedTypeException( +// "The element at index " + index + " in the list that resulted from the evaluation of the multi-valued " //$NON-NLS-1$ //$NON-NLS-2$ +// + "derived typed element does not match the expected type " //$NON-NLS-1$ +// + "for the source element at index " + sourceIndex, expectedType, resultElement); //$NON-NLS-1$ +// } +// index++; +// } +// sourceIndex++; +// } +// } +// return multiResultList; +// } +// +// private static List<?> batchEvaluateAndCheck(final DerivedTypedElement derivedTypedElement, +// final Collection<EObject> eObjects, +// final List<ParameterValue> parameterValues, final IDerivedTypedElementImplementation +// evaluator) +// throws DerivedTypedElementException { +// List<?> result; +// +// Query query = derivedTypedElement.getQuery(); +// if (query == null) { +// throw new IllegalArgumentException("the query cannot be null"); //$NON-NLS-1$ +// } +// +// EClassifier sourceType = query.getSourceType(); +// +// final boolean primitiveType = derivedTypedElement instanceof EAttribute; +// +// if (derivedTypedElement.isMany()) { +// if (evaluator instanceof IDerivedTypedElementCollectionImplementation) { +// IDerivedTypedElementCollectionImplementation collectionEvaluator = +// (IDerivedTypedElementCollectionImplementation) evaluator; +// // List<? extends AbstractDerivedTypedElementResult> listResultList = +// // collectionEvaluator +// // .getValues(derivedTypedElement, eObjects, parameterValues); +// // int index = 0; +// // for (AbstractDerivedTypedElementResult listResult : listResultList) { +// // EList<?> resultList; +// // if (primitiveType && listResult instanceof +// // DerivedTypedElementPrimitiveTypeListResult<?>) { +// // DerivedTypedElementPrimitiveTypeListResult<?> primitiveListResult = +// // (DerivedTypedElementPrimitiveTypeListResult<?>) listResult; +// // resultList = primitiveListResult.getResultList(); +// // } else if (!primitiveType && listResult instanceof +// // DerivedTypedElementEObjectListResult<?>) { +// // DerivedTypedElementEObjectListResult<?> eObjectListResult = +// // (DerivedTypedElementEObjectListResult<?>) listResult; +// // resultList = eObjectListResult.getResultList(); +// // } else { +// // throw new DerivedTypedElementEvaluationException( +// // "Wrong element type at index " + index + " in the result from the evaluator " + collectionEvaluator.getClass().getName()); //$NON-NLS-1$//$NON-NLS-2$ +// // } +// // checkResult(query, resultList, evaluator.getCheckResultType()); +// // index++; +// // } +// // result = listResultList; +// } else { +// +// // List<AbstractDerivedTypedElementResult> listResultList = new +// // ArrayList<AbstractDerivedTypedElementResult>(); +// // for (EObject eObject : eObjects) { +// // AbstractDerivedTypedElementResult listResult; +// // List<?> resultList; +// // if (primitiveType) { +// // DerivedTypedElementPrimitiveTypeListResult<?> primitiveTypeListResult = +// // EFacetFactory.eINSTANCE +// // .createDerivedTypedElementPrimitiveTypeListResult(); +// // listResult = primitiveTypeListResult; +// // resultList = primitiveTypeListResult.getResultList(); +// // } else { +// // DerivedTypedElementEObjectListResult<?> eObjectTypeListResult = +// // EFacetFactory.eINSTANCE +// // .createDerivedTypedElementEObjectListResult(); +// // listResult = eObjectTypeListResult; +// // resultList = eObjectTypeListResult.getResultList(); +// // } +// // +// // Throwable error = null; +// // try { +// // listResult.setSource(eObject); +// // listResult.setDerivedTypedElement(derivedTypedElement); +// // setParameterValues(listResult.getParameterValues(), parameterValues); +// // checkSourceType(sourceType, query, eObject); +// // } catch (Throwable e) { +// // error = e; +// // } +// // if (error != null) { +// // listResult.setException(error); +// // } else { +// // try { +// // Object evaluationResult = evaluator.getValue(derivedTypedElement, eObject, +// // parameterValues); +// // checkResult(query, evaluationResult, evaluator.getCheckResultType()); +// // // checked by checkResult +// // Collection<?> evaluationResultCollection = (Collection<?>) evaluationResult; +// // for (Object object : evaluationResultCollection) { +// // resultList.add(object); +// // } +// // } catch (Throwable e) { +// // listResult.setException(e); +// // } +// // } +// // listResultList.add(listResult); +// // +// // } +// // result = listResultList; +// +// } +// } else { +// // if the evaluator implements multiple evaluation itself, then use it +// if (evaluator instanceof IDerivedTypedElementCollectionImplementation) { +// IDerivedTypedElementCollectionImplementation collectionEvaluator = +// (IDerivedTypedElementCollectionImplementation) evaluator; +// List<? extends AbstractDerivedTypedElementResult> singleResultList = collectionEvaluator +// .getValues(derivedTypedElement, eObjects, parameterValues); +// int index = 0; +// for (AbstractDerivedTypedElementResult singleResult : singleResultList) { +// Object resultElement; +// if (primitiveType && singleResult instanceof DerivedTypedElementPrimitiveTypeResult<?>) { +// DerivedTypedElementPrimitiveTypeResult<?> primitiveResult = +// (DerivedTypedElementPrimitiveTypeResult<?>) singleResult; +// resultElement = primitiveResult.getResult(); +// } else if (!primitiveType && singleResult instanceof DerivedTypedElementEObjectResult<?>) { +// DerivedTypedElementEObjectResult<?> eObjectResult = (DerivedTypedElementEObjectResult<?>) +// singleResult; +// resultElement = eObjectResult.getResult(); +// } else { +// throw new DerivedTypedElementEvaluationException( +// "Wrong element type at index " + index + " in the result from the evaluator " + collectionEvaluator.getClass().getName()); //$NON-NLS-1$//$NON-NLS-2$ +// } +// checkResult(query, result, evaluator.getCheckResultType()); +// index++; +// } +// } else { +// // otherwise, do multiple evaluation by calling the evaluator's +// // single evaluation multiple times +// List<DerivedTypedElementResult<?>> resultList = new +// ArrayList<DerivedTypedElementResult<?>>(); +// for (EObject eObject : eObjects) { +// DerivedTypedElementResult<Object> singleResult = +// EFacetFactory.eINSTANCE.createDerivedTypedElementResult(); +// Throwable error = null; +// try { +// singleResult.setSource(eObject); +// singleResult.setDerivedTypedElement(derivedTypedElement); +// setParameterValues(singleResult.getParameterValues(), parameterValues); +// checkSourceType(sourceType, query, eObject); +// } catch (Throwable e) { +// error = e; +// } +// if (error != null) { +// singleResult.setException(error); +// } else { +// try { +// Object evaluationResult = evaluator.getValue(derivedTypedElement, eObject, parameterValues); +// checkResult(query, evaluationResult, evaluator.getCheckResultType()); +// singleResult.setResult(evaluationResult); +// } catch (Throwable e) { +// singleResult.setException(e); +// } +// } +// resultList.add(singleResult); +// } +// result = resultList; +// } +// } +// +// return result; +// } + +// private static void checkSourceType(final EClassifier sourceType, final Query query, final EObject eObject) +// throws DerivedTypedElementException { +// if (sourceType != null) { +// // a null value for eObject matches any type +// if (eObject != null && !sourceType.isInstance(eObject)) { +// StringBuffer message = new StringBuffer(); +// message.append("Wrong source type (for " + QueryUtils.getQueryDescription(query) + "): '"); //$NON-NLS-1$ //$NON-NLS-2$ +// message.append(eObject.eClass().getName()); +// message.append("' found; expected '"); //$NON-NLS-1$ +// message.append(sourceType.getName()); +// message.append("'."); //$NON-NLS-1$ +// throw new DerivedTypedElementTypeCheckingException(message.toString()); +// } +// } else { +// if (eObject != null) { +// throw new DerivedTypedElementException("the query's sourceType is null and the source is not null"); //$NON-NLS-1$ +// } +// } +// } +// +// private static void setParameterValues(final EList<ParameterValue> target, final List<ParameterValue> parameterValues) { +// if (parameterValues != null) { +// for (ParameterValue parameterValue : parameterValues) { +// if (parameterValue == null) { +// throw new IllegalArgumentException("null parameter value"); //$NON-NLS-1$ +// } +// // containment link -> we need to copy since we can have the same +// // parameter for several results +// target.add(EcoreUtil.copy(parameterValue)); +// } +// } +// } + + private static final void checkResult(final Query query, final Object result, + final boolean checkResultType, final boolean primitive) throws DerivedTypedElementTypeCheckingException { + if (result != null) { + if (QueryUtils.isMany(query)) { + if (!(result instanceof Collection<?>)) { + final String message = String.format( + "A collection is expected as result. The result is an instance of %s (on %s)", //$NON-NLS-1$ + result.getClass().getName(), + QueryUtils.getQueryDescription(query)); + throw new DerivedTypedElementTypeCheckingException(message); + } + if (checkResultType) { + for (Object collectionElement : (Collection<?>) result) { + if (collectionElement != null + && !(QueryUtils.getReturnType(query) + .isInstance(collectionElement))) { + throw new DerivedTypedElementTypeCheckingException( + "Wrong result collection element type: " + collectionElement.getClass().getName() //$NON-NLS-1$ + + "(" + QueryUtils.getReturnType(query).getName() + " is expected) " //$NON-NLS-1$ //$NON-NLS-2$ + + " on " + QueryUtils.getQueryDescription(query)); //$NON-NLS-1$ + } + } + } else if (!primitive) { + // at least check that EObjects are returned + for (Object collectionElement : (Collection<?>) result) { + if (collectionElement != null && !(collectionElement instanceof EObject)) { + throw new DerivedTypedElementTypeCheckingException( + "Wrong result collection element type: " + collectionElement.getClass().getName() //$NON-NLS-1$ + + "(an instance of " + EObject.class.getName() + " is expected) " //$NON-NLS-1$ //$NON-NLS-2$ + + " on " + QueryUtils.getQueryDescription(query)); //$NON-NLS-1$ + } + } + } + } else { + if (result instanceof Collection<?>) { + throw new DerivedTypedElementTypeCheckingException("A " //$NON-NLS-1$ + + QueryUtils.getSourceType(query).getName() + + " instance is expected as result. The result is: " //$NON-NLS-1$ + + result + " (on " + QueryUtils.getQueryDescription(query) + ")"); //$NON-NLS-1$//$NON-NLS-2$ + } + if (checkResultType) { + if (result != null && !(QueryUtils.getReturnType(query).isInstance(result))) { + throw new DerivedTypedElementTypeCheckingException("Wrong result type: " //$NON-NLS-1$ + + result.getClass().getName() + + " is returned while " //$NON-NLS-1$ + + QueryUtils.getReturnType(query).getInstanceClassName() + + " is expected." + " (on " + QueryUtils.getQueryDescription(query) + ")"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + } + } else if (!primitive) { + // at least check that an EObject is returned + if (result != null && !(result instanceof EObject)) { + throw new DerivedTypedElementTypeCheckingException( + "Wrong result collection element type: " + result.getClass().getName() //$NON-NLS-1$ + + "(an instance of " + EObject.class.getName() + " is expected) " //$NON-NLS-1$ //$NON-NLS-2$ + + " on " + QueryUtils.getQueryDescription(query)); //$NON-NLS-1$ + } + } + } + } + } + + private static boolean isPrimitive(final EClassifier eType) { + final boolean primitiveType; + if (eType instanceof EDataType) { + primitiveType = true; + } else if (eType instanceof EClass) { + primitiveType = false; + } else { + throw new IllegalArgumentException("unhandled derived typed element type: " + eType.getName()); //$NON-NLS-1$ + } + return primitiveType; + } + + /** + * Transform the element in parameter in list (if necessary). + * + * @param element + * the element to transform + * @return a list. + */ + protected static List<Object> setAsList(final Object element) { + List<Object> newList = new LinkedList<Object>(); + if (element instanceof List) { + @SuppressWarnings("unchecked") + //@SuppressWarnings("unchecked") the cast is safe because were + //casting a List to a List<Object> + final List<Object> tmpList = (List<Object>) element; + newList = tmpList; + } else { + newList.add(element); + } + return newList; + } + +}
diff --git a/org.eclipse.modisco.facet.efacet.core/src/org/eclipse/modisco/facet/efacet/core/internal/DerivedTypedElementUtils.java b/org.eclipse.modisco.facet.efacet.core/src/org/eclipse/modisco/facet/efacet/core/internal/DerivedTypedElementUtils.java new file mode 100644 index 0000000..6f6132e --- /dev/null +++ b/org.eclipse.modisco.facet.efacet.core/src/org/eclipse/modisco/facet/efacet/core/internal/DerivedTypedElementUtils.java
@@ -0,0 +1,70 @@ +/******************************************************************************* + * Copyright (c) 2011 Mia-Software + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Emmanuelle Rouillé (Mia-Software) - Bug 352618 - To be able to use non derived facet structural features and save them values. + * Nicolas Bros (Mia-Software) - Bug 361612 - New core for new version of the Facet metamodel + * Grégoire Dupé (Mia-Software) - Bug 361612 - [Restructuring] New core for new version of the Facet metamodel + * Gregoire Dupe (Mia-Software) - Bug 369987 - [Restructuring][Table] Switch to the new customization and facet framework + * Gregoire Dupe (Mia-Software) - Bug 375087 - [Table] ITableWidget.addColumn(List<ETypedElement>, List<FacetSet>) + *******************************************************************************/ +package org.eclipse.modisco.facet.efacet.core.internal; + +import java.util.ArrayList; +import java.util.List; + +import org.eclipse.emf.common.util.EList; +import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.ecore.EOperation; +import org.eclipse.emf.ecore.EParameter; +import org.eclipse.modisco.facet.efacet.core.IDerivedTypedElementManager; +import org.eclipse.modisco.facet.efacet.core.IFacetManager; +import org.eclipse.modisco.facet.efacet.core.exception.DerivedTypedElementException; +import org.eclipse.modisco.facet.efacet.core.internal.exception.UnmatchingExpectedTypeException; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.EFacetFactory; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.FacetOperation; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.ParameterValue; + +public final class DerivedTypedElementUtils { + + private DerivedTypedElementUtils() { + // Must not be used + } + + private static <T> List<ParameterValue> createAndCheckOperationParameterValues(final EOperation operation, + final Object... arguments) throws UnmatchingExpectedTypeException { + final EList<EParameter> operationParameters = operation.getEParameters(); + //Begin precondition checking + if (arguments.length > 0 + && operationParameters.size() != arguments.length) { + throw new IllegalArgumentException("Facet operation '" + operation.getName() + //$NON-NLS-1$ + "' expects " + operationParameters.size() + " parameters. Got " + arguments.length); //$NON-NLS-1$ //$NON-NLS-2$ + } + //End precondition checking + final List<ParameterValue> parameterValues = new ArrayList<ParameterValue>(); + for (int i = 0; i < arguments.length; i++) { + final Object argument = arguments[i]; + final EParameter eParameter = operationParameters.get(i); + //Begin precondition checking + EmfUtils.checkAssignment(argument, eParameter); + //End precondition checking + final ParameterValue parameterValue = EFacetFactory.eINSTANCE.createParameterValue(); + parameterValue.setParameter(eParameter); + parameterValue.setValue(argument); + parameterValues.add(parameterValue); + } + return parameterValues; + } + + public static Object evaluate(final EObject eObject, final EOperation operation, final IFacetManager facetManager, final Object... arguments) throws UnmatchingExpectedTypeException, + DerivedTypedElementException { + Object result; + final List<ParameterValue> parameterValues = DerivedTypedElementUtils.createAndCheckOperationParameterValues(operation, arguments); + result = IDerivedTypedElementManager.INSTANCE.evaluate((FacetOperation) operation, eObject, parameterValues, facetManager); + return result; + } +}
diff --git a/org.eclipse.modisco.facet.efacet.core/src/org/eclipse/modisco/facet/efacet/core/internal/EmfUtils.java b/org.eclipse.modisco.facet.efacet.core/src/org/eclipse/modisco/facet/efacet/core/internal/EmfUtils.java new file mode 100644 index 0000000..a657299 --- /dev/null +++ b/org.eclipse.modisco.facet.efacet.core/src/org/eclipse/modisco/facet/efacet/core/internal/EmfUtils.java
@@ -0,0 +1,105 @@ +/******************************************************************************* + * Copyright (c) 2011, 2016 Mia-Software, and Soft-Maint. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Emmanuelle Rouillé (Mia-Software) - Bug 352618 - To be able to use non derived facet structural features and save them values. + * Nicolas Bros (Mia-Software) - Bug 361612 - New core for new version of the Facet metamodel + * Grégoire Dupé (Mia-Software) - Bug 361612 - [Restructuring] New core for new version of the Facet metamodel + * Gregoire Dupe (Mia-Software) - Bug 375087 - [Table] ITableWidget.addColumn(List<ETypedElement>, List<FacetSet>) + * Gregoire Dupe (Mia-Software) - Bug 372626 - Aggregates + * Jonathan Pepin (Soft-Maint) - Bug 510034 - Null value is wrongly casted in a new list + *******************************************************************************/ +package org.eclipse.modisco.facet.efacet.core.internal; + +import java.lang.reflect.InvocationTargetException; +import java.util.Collection; +import java.util.List; + +import org.eclipse.emf.common.util.BasicEList; +import org.eclipse.emf.ecore.ENamedElement; +import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.ecore.EOperation; +import org.eclipse.emf.ecore.EStructuralFeature; +import org.eclipse.emf.ecore.ETypedElement; +import org.eclipse.emf.ecore.util.EcoreUtil; +import org.eclipse.modisco.facet.efacet.core.internal.exception.UnmatchingExpectedTypeException; + +public final class EmfUtils { + + private EmfUtils() { + //Must not be used + } + + public static void checkAssignment(final Object value, final ETypedElement eTypedElement) + throws UnmatchingExpectedTypeException { + final String typedElementName = getTypeElementDescription(eTypedElement); + //Begin checking precondition + if (eTypedElement.getEType() == null) { + throw new IllegalArgumentException(typedElementName + " has a null type"); //$NON-NLS-1$ + } + //End checking precondition + if (value == null && (eTypedElement.getLowerBound() > 0)) { + throw new IllegalArgumentException( + "The assigned value cannot be null for " + typedElementName + " because multiplicity is " + eTypedElement.getLowerBound() + ".." + eTypedElement.getUpperBound()); //$NON-NLS-1$//$NON-NLS-2$ //$NON-NLS-3$ + } + if (value != null) { + if (eTypedElement.getUpperBound() == 1) { + if (!eTypedElement.getEType().isInstance(value)) { + throw new IllegalArgumentException( + "Type mismatch for " + EcoreUtil.getURI(eTypedElement) + ": expected '" + eTypedElement.getEType().getName() + "' but got '" + value.getClass().getName() + "'."); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ + } + } else { // expect a list for multiplicity-many + if (!(value instanceof List<?>)) { + throw new IllegalArgumentException("Type mismatch for " + typedElementName + "': expected a List because the parameter is multiplicity-many. But got a " + //$NON-NLS-1$ //$NON-NLS-2$ + value.getClass().getName() + "'."); //$NON-NLS-1$ + } + final List<?> argumentList = (List<?>) value; + try { + CastUtils.checkTypeOfAllListElements(argumentList, + eTypedElement.getEType().getInstanceClass(), true); + //FIXME What happens if we use a not generated meta-model ? + } catch (UnmatchingExpectedTypeException e) { + throw new UnmatchingExpectedTypeException( + "Type mismatch for an element of the list value " + typedElementName , e); //$NON-NLS-1$ + } + } + } + } + + private static String getTypeElementDescription(final ETypedElement eTypedElement) { + String containerName = ""; //$NON-NLS-1$ + if (eTypedElement.eContainer() instanceof ENamedElement) { + final ENamedElement namedContainer = (ENamedElement) eTypedElement.eContainer(); + containerName = "the " + namedContainer.eClass().getName() + " named '" + namedContainer.getName() + "'"; //$NON-NLS-1$//$NON-NLS-2$ //$NON-NLS-3$ + } + return "the " + eTypedElement.eClass().getName() + " named '" + eTypedElement.getName() + "' in " + containerName; //$NON-NLS-1$//$NON-NLS-2$ //$NON-NLS-3$ + } + + public static Object ecoreInvoke(final EObject eObject, final EOperation operation, final Object... arguments) throws InvocationTargetException { + // delegate to Ecore + final BasicEList<Object> operationParams = new BasicEList<Object>(); + for (Object param : arguments) { + operationParams.add(param); + } + return eObject.eInvoke(operation, operationParams); + } + + public static <T> T checkAssignment(final EStructuralFeature eStructuralFeature, final Class<T> expectedType, final Object value) + throws UnmatchingExpectedTypeException { + if (eStructuralFeature.isMany() && expectedType != null) { + if (expectedType != Object.class + && !Collection.class.isAssignableFrom(expectedType)) { + throw new UnmatchingExpectedTypeException("The required eStructuralFeature is multi-valued, so expectedType must be a subtype of Collection."); //$NON-NLS-1$ + } + if (!expectedType.isInstance(value)) { + throw new UnmatchingExpectedTypeException("The derived typed element did not evaluate to the expected type", Collection.class, value); //$NON-NLS-1$ + } + } + return CastUtils.castToExpectedType(value, expectedType); + } + +}
diff --git a/org.eclipse.modisco.facet.efacet.core/src/org/eclipse/modisco/facet/efacet/core/internal/FacetActions2Impl.java b/org.eclipse.modisco.facet.efacet.core/src/org/eclipse/modisco/facet/efacet/core/internal/FacetActions2Impl.java new file mode 100644 index 0000000..34ecade --- /dev/null +++ b/org.eclipse.modisco.facet.efacet.core/src/org/eclipse/modisco/facet/efacet/core/internal/FacetActions2Impl.java
@@ -0,0 +1,230 @@ +/** + * Copyright (c) 2011 Mia-Software. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Nicolas Guyomar (Mia-Software) - Bug 338813 - [EMF Facet Framework] basic Facet actions + * Nicolas Bros (Mia-Software) - Bug 361612 - New core for new version of the Facet metamodel + * Gregoire Dupe (Mia-Software) - Bug 362087 - [Deprecated] org.eclipse.emf.facet.util.emf.core.ICatalogSetManager + */ +package org.eclipse.modisco.facet.efacet.core.internal; + +import java.io.IOException; + +import org.eclipse.core.resources.IFile; +import org.eclipse.emf.common.command.Command; +import org.eclipse.emf.common.util.URI; +import org.eclipse.emf.ecore.EParameter; +import org.eclipse.emf.ecore.EcorePackage; +import org.eclipse.emf.ecore.resource.Resource; +import org.eclipse.emf.ecore.resource.ResourceSet; +import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl; +import org.eclipse.emf.edit.command.AddCommand; +import org.eclipse.emf.edit.command.SetCommand; +import org.eclipse.emf.edit.domain.EditingDomain; +import org.eclipse.modisco.facet.efacet.core.internal.incubatingapi.IFacetActions2; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.EFacetPackage; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.Facet; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.FacetAttribute; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.FacetOperation; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.FacetReference; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.FacetSet; +import org.eclipse.modisco.facet.util.core.Logger; +import org.eclipse.modisco.facet.util.emf.core.ICatalogSetManager2; +import org.eclipse.modisco.facet.util.emf.core.exception.InvalidFacetSetException; +import org.eclipse.modisco.facet.util.pde.core.internal.exported.BuildPropertiesUtils; + +public class FacetActions2Impl implements IFacetActions2 { + + public void saveFacetSet(final FacetSet facetSet, final IFile file) throws IOException, + InvalidFacetSetException { + if (facetSet == null) { + throw new IllegalArgumentException("The given FacetSet cannot be null"); //$NON-NLS-1$ + } + if (file == null) { + throw new IllegalArgumentException("The given IFile cannot be null"); //$NON-NLS-1$ + } + if (file.exists()) { + throw new IllegalArgumentException("The given IFile already exists"); //$NON-NLS-1$ + } + + // Create a resource set + ResourceSet resourceSet = new ResourceSetImpl(); + + // Get the URI of the model file. + URI fileURI = URI.createPlatformResourceURI(file.getFullPath().toString(), true); + + // Create a resource for this file. + Resource resource = resourceSet.createResource(fileURI); + + // Add the facetSet the resource contents. + resource.getContents().add(facetSet); + + // Save the contents of the resource to the file system. + resource.save(null); + + try { + BuildPropertiesUtils.addToBuild(file); + } catch (Exception e) { + Logger.logError(e, "Error adding file " + file.getFullPath() //$NON-NLS-1$ + + " to the build.properties", Activator.getDefault()); //$NON-NLS-1$ + } + } + + public Facet createFacetInFacetSet(final FacetSet facetSet, final Facet facet, + final EditingDomain editingDomain) { + Command command = createCreateFacetInFacetSetCommand(facetSet, facet, editingDomain); + // If the current editingDomain's resourceSet does not contain the facetSet resource, then + // we need to add it so that we can edit the facetSet + if (!editingDomain.getResourceSet().getResources().contains(facetSet.eResource())) { + editingDomain.getResourceSet().getResources().add(facetSet.eResource()); + } + editingDomain.getCommandStack().execute(command); + return facet; + } + + public Command createCreateFacetInFacetSetCommand(final FacetSet facetSet, final Facet facet, + final EditingDomain editingDomain) { + if (facetSet == null) { + throw new IllegalArgumentException("The given FacetSet cannot be null"); //$NON-NLS-1$ + } + if (facet == null) { + throw new IllegalArgumentException("The given Facet cannot be null"); //$NON-NLS-1$ + } + if (facet.eResource() != null || facet.eContainer() != null) { + throw new IllegalArgumentException("The given Facet cannot be contained by a resource"); //$NON-NLS-1$ + } + if (editingDomain == null) { + throw new IllegalArgumentException("The given EditingDomain cannot be null"); //$NON-NLS-1$ + } + + return AddCommand.create(editingDomain, facetSet, + EcorePackage.eINSTANCE.getEPackage_EClassifiers(), facet); + } + + public void addAttributeInFacet(final Facet facet, final FacetAttribute facetAttribute, + final EditingDomain editingDomain) { + Command command = createAddAttributeInFacetCommand(facet, facetAttribute, editingDomain); + editingDomain.getCommandStack().execute(command); + } + + public Command createAddAttributeInFacetCommand(final Facet facet, + final FacetAttribute facetAttribute, final EditingDomain editingDomain) { + if (facet == null) { + throw new IllegalArgumentException("The given Facet cannot be null"); //$NON-NLS-1$ + } + if (facetAttribute == null) { + throw new IllegalArgumentException("The given FacetAttribute cannot be null"); //$NON-NLS-1$ + } + if (facetAttribute.eResource() != null || facetAttribute.eContainer() != null) { + throw new IllegalArgumentException( + "The given FacetAttribute cannot be contained by a resource"); //$NON-NLS-1$ + } + if (editingDomain == null) { + throw new IllegalArgumentException("The given EditingDomain cannot be null"); //$NON-NLS-1$ + } + + return AddCommand.create(editingDomain, facet, + EFacetPackage.eINSTANCE.getFacet_FacetElements(), facetAttribute); + } + + public void addReferenceInFacet(final Facet facet, final FacetReference facetReference, + final EditingDomain editingDomain) { + Command command = createAddReferenceInFacetCommand(facet, facetReference, editingDomain); + editingDomain.getCommandStack().execute(command); + } + + public Command createAddReferenceInFacetCommand(final Facet facet, + final FacetReference facetReference, final EditingDomain editingDomain) { + if (facet == null) { + throw new IllegalArgumentException("The given Facet cannot be null."); //$NON-NLS-1$ + } + if (facetReference == null) { + throw new IllegalArgumentException("The given FacetReference cannot be null"); //$NON-NLS-1$ + } + if (facetReference.eResource() != null || facetReference.eContainer() != null) { + throw new IllegalArgumentException( + "The given FacetReference cannot be contained by a resource"); //$NON-NLS-1$ + } + if (editingDomain == null) { + throw new IllegalArgumentException("The given EditingDomain cannot be null."); //$NON-NLS-1$ + } + + return AddCommand.create(editingDomain, facet, + EFacetPackage.eINSTANCE.getFacet_FacetElements(), facetReference); + } + + public void addOperationInFacet(final Facet facet, final FacetOperation facetOperation, + final EditingDomain editingDomain) { + Command command = createAddOperationInFacetCommand(facet, facetOperation, editingDomain); + editingDomain.getCommandStack().execute(command); + } + + public Command createAddOperationInFacetCommand(final Facet facet, + final FacetOperation facetOperation, final EditingDomain editingDomain) { + if (editingDomain == null) { + throw new IllegalArgumentException("The given EditingDomain cannot be null"); //$NON-NLS-1$ + } + if (facetOperation == null) { + throw new IllegalArgumentException("The given FacetOperation cannot be null"); //$NON-NLS-1$ + } + if (facetOperation.eResource() != null || facetOperation.eContainer() != null) { + throw new IllegalArgumentException( + "The given FacetOperation cannot be contained by a resource"); //$NON-NLS-1$ + } + if (facet == null) { + throw new IllegalArgumentException("The given Facet cannot be null"); //$NON-NLS-1$ + } + + return AddCommand.create(editingDomain, facet, + EFacetPackage.eINSTANCE.getFacet_FacetOperations(), facetOperation); + } + + public void addParameterInOperation(final FacetOperation operation, final EParameter parameter, + final EditingDomain editingDomain) { + Command command = createAddParameterInOperationCommand(operation, parameter, editingDomain); + editingDomain.getCommandStack().execute(command); + } + + public Command createAddParameterInOperationCommand(final FacetOperation operation, + final EParameter parameter, final EditingDomain editingDomain) { + if (operation == null) { + throw new IllegalArgumentException("The given FacetOperation cannot be null"); //$NON-NLS-1$ + } + if (parameter == null) { + throw new IllegalArgumentException("The given EParameter cannot be null"); //$NON-NLS-1$ + } + if (parameter.eResource() != null || parameter.eContainer() != null) { + throw new IllegalArgumentException( + "The given EParameter cannot be contained by a resource"); //$NON-NLS-1$ + } + if (editingDomain == null) { + throw new IllegalArgumentException("The given EditingDomain cannot be null"); //$NON-NLS-1$ + } + + return AddCommand.create(editingDomain, operation, + EcorePackage.eINSTANCE.getEOperation_EParameters(), parameter); + } + + public void setFacetSetNsUri(final FacetSet facetSet, final String nsUri, + final EditingDomain editingDomain) { + Command command = createSetFacetSetNsUriCommand(facetSet, nsUri, editingDomain); + editingDomain.getCommandStack().execute(command); + } + + public Command createSetFacetSetNsUriCommand(final FacetSet facetSet, final String nsUri, + final EditingDomain editingDomain) { + if (editingDomain == null) { + throw new IllegalArgumentException("The given EditingDomain cannot be null"); //$NON-NLS-1$ + } + if (facetSet == null) { + throw new IllegalArgumentException("The given FacetSet cannot be null"); //$NON-NLS-1$ + } + return SetCommand.create(editingDomain, facetSet, + EcorePackage.eINSTANCE.getEPackage_NsURI(), nsUri); + } +}
diff --git a/org.eclipse.modisco.facet.efacet.core/src/org/eclipse/modisco/facet/efacet/core/internal/FacetActionsImpl.java b/org.eclipse.modisco.facet.efacet.core/src/org/eclipse/modisco/facet/efacet/core/internal/FacetActionsImpl.java new file mode 100644 index 0000000..e53d55e --- /dev/null +++ b/org.eclipse.modisco.facet.efacet.core/src/org/eclipse/modisco/facet/efacet/core/internal/FacetActionsImpl.java
@@ -0,0 +1,78 @@ +/** + * Copyright (c) 2012 Mia-Software. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Alban Ménager (Soft-Maint) - Bug 387470 - [EFacet][Custom] Editors + */ +package org.eclipse.modisco.facet.efacet.core.internal; + +import java.io.IOException; + +import org.eclipse.core.resources.IFile; +import org.eclipse.emf.common.util.URI; +import org.eclipse.emf.ecore.resource.Resource; +import org.eclipse.emf.ecore.resource.ResourceSet; +import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl; +import org.eclipse.modisco.facet.efacet.core.IFacetActions; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.FacetSet; +import org.eclipse.modisco.facet.util.core.Logger; +import org.eclipse.modisco.facet.util.core.internal.Activator; +import org.eclipse.modisco.facet.util.emf.core.ICatalogSetManager2; +import org.eclipse.modisco.facet.util.emf.core.ICatalogSetManagerFactory; +import org.eclipse.modisco.facet.util.emf.core.exception.InvalidFacetSetException; +import org.eclipse.modisco.facet.util.pde.core.internal.exported.BuildPropertiesUtils; + +/** + * Concrete implementation of {@link IFacetActions}. + */ +public class FacetActionsImpl implements IFacetActions { + + public void saveFacetSet(final FacetSet facetSet, final IFile file) + throws IOException, InvalidFacetSetException { + if (facetSet == null) { + throw new IllegalArgumentException( + "The given FacetSet cannot be null"); //$NON-NLS-1$ + } + if (file == null) { + throw new IllegalArgumentException("The given IFile cannot be null"); //$NON-NLS-1$ + } + if (file.exists()) { + throw new IllegalArgumentException("The given IFile already exists"); //$NON-NLS-1$ + } + + // Create a resource set + final ResourceSet resourceSet = new ResourceSetImpl(); + + // Get the URI of the model file. + final URI fileURI = URI.createPlatformResourceURI(file.getFullPath() + .toString(), true); + + // Create a resource for this file. + final Resource resource = resourceSet.createResource(fileURI); + + // Add the facetSet the resource contents. + resource.getContents().add(facetSet); + + // Save the contents of the resource to the file system. + resource.save(null); + + try { + BuildPropertiesUtils.addToBuild(file); + } catch (final Exception e) { + Logger.logError(e, "Error adding file " + file.getFullPath() //$NON-NLS-1$ + + " to the build.properties", Activator.getDefault()); //$NON-NLS-1$ + } + + final ICatalogSetManager2 catalogSetManager = ICatalogSetManagerFactory.DEFAULT + .createICatalogSetManager(resourceSet); + catalogSetManager.registerModelDeclaration(file); + + // ICatalogSetManager.INSTANCE.registerModelDeclaration(file); + } + +}
diff --git a/org.eclipse.modisco.facet.efacet.core/src/org/eclipse/modisco/facet/efacet/core/internal/FacetCatalogManagerFactory.java b/org.eclipse.modisco.facet.efacet.core/src/org/eclipse/modisco/facet/efacet/core/internal/FacetCatalogManagerFactory.java new file mode 100644 index 0000000..bdad42f --- /dev/null +++ b/org.eclipse.modisco.facet.efacet.core/src/org/eclipse/modisco/facet/efacet/core/internal/FacetCatalogManagerFactory.java
@@ -0,0 +1,28 @@ +/** + * Copyright (c) 2012, 2015 Mia-Software. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Grégoire Dupé (Mia-Software) - Bug 369987 - [Restructuring][Table] Switch to the new customization and facet + * Grégoire Dupé (Mia-Software) - Bug 373078 - API Cleaning + * Grégoire Dupé (Mia-Software) - Bug 477657 - The catalog manager should be able to manage workspace model + */ +package org.eclipse.modisco.facet.efacet.core.internal; + +import org.eclipse.emf.ecore.resource.ResourceSet; +import org.eclipse.modisco.facet.efacet.core.IFacetSetCatalogManager; +import org.eclipse.modisco.facet.efacet.core.IFacetSetCatalogManagerFactory; +import org.eclipse.modisco.facet.efacet.core.internal.catalog.EFacetCatalogManager2; + +public class FacetCatalogManagerFactory implements IFacetSetCatalogManagerFactory { + + public IFacetSetCatalogManager getOrCreateFacetSetCatalogManager( + final ResourceSet resourceSet) { + return new EFacetCatalogManager2(resourceSet); + } + +}
diff --git a/org.eclipse.modisco.facet.efacet.core/src/org/eclipse/modisco/facet/efacet/core/internal/FacetCommandFactoryFactory.java b/org.eclipse.modisco.facet.efacet.core/src/org/eclipse/modisco/facet/efacet/core/internal/FacetCommandFactoryFactory.java new file mode 100644 index 0000000..aefd998 --- /dev/null +++ b/org.eclipse.modisco.facet.efacet.core/src/org/eclipse/modisco/facet/efacet/core/internal/FacetCommandFactoryFactory.java
@@ -0,0 +1,25 @@ +/** + * Copyright (c) 2012 Mia-Software. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Grégoire Dupé (Mia-Software) - Bug 387470 - [EFacet][Custom] Editors + */ +package org.eclipse.modisco.facet.efacet.core.internal; + +import org.eclipse.emf.edit.domain.EditingDomain; +import org.eclipse.modisco.facet.efacet.core.IFacetCommandFactory; +import org.eclipse.modisco.facet.efacet.core.IFacetCommandFactoryFactory; + +public class FacetCommandFactoryFactory implements IFacetCommandFactoryFactory { + + public IFacetCommandFactory createCommandFactory( + final EditingDomain editingDomain) { + return new FacetCommandFactoryImpl(editingDomain); + } + +}
diff --git a/org.eclipse.modisco.facet.efacet.core/src/org/eclipse/modisco/facet/efacet/core/internal/FacetCommandFactoryImpl.java b/org.eclipse.modisco.facet.efacet.core/src/org/eclipse/modisco/facet/efacet/core/internal/FacetCommandFactoryImpl.java new file mode 100644 index 0000000..0b343db --- /dev/null +++ b/org.eclipse.modisco.facet.efacet.core/src/org/eclipse/modisco/facet/efacet/core/internal/FacetCommandFactoryImpl.java
@@ -0,0 +1,511 @@ +/** + * Copyright (c) 2012 Mia-Software. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Alban Ménager (Soft-Maint) - Bug 387470 - [EFacet][Custom] Editors + * Grégoire Dupé (Mia-Software) - Bug 387470 - [EFacet][Custom] Editors + */ +package org.eclipse.modisco.facet.efacet.core.internal; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; + +import org.eclipse.emf.common.command.Command; +import org.eclipse.emf.common.command.CompoundCommand; +import org.eclipse.emf.ecore.EAttribute; +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.EClassifier; +import org.eclipse.emf.ecore.ENamedElement; +import org.eclipse.emf.ecore.EParameter; +import org.eclipse.emf.ecore.EStructuralFeature; +import org.eclipse.emf.ecore.ETypedElement; +import org.eclipse.emf.ecore.EcorePackage; +import org.eclipse.emf.edit.command.AddCommand; +import org.eclipse.emf.edit.command.SetCommand; +import org.eclipse.emf.edit.domain.EditingDomain; +import org.eclipse.modisco.facet.efacet.core.IFacetCommandFactory; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.DerivedTypedElement; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.EFacetPackage; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.Facet; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.FacetAttribute; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.FacetOperation; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.FacetReference; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.FacetSet; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.extensible.Query; +import org.eclipse.modisco.facet.util.emf.core.command.EmfCommandUtils; + +/** + * Concrete implementation of {@link IFacetCommandFactory}. + */ +public class FacetCommandFactoryImpl implements IFacetCommandFactory { + + private static final String VALUE_NOT_NULL = "The given value cannot be null"; //$NON-NLS-1$ + private static final String PARENT_NOT_NULL = "The given parent cannot be null"; //$NON-NLS-1$ + private static final Object NAME = "name"; //$NON-NLS-1$ + private static final Object LOWER_BOUND = "lowerBound"; //$NON-NLS-1$ + private static final Object UPPER_BOUND = "upperBound"; //$NON-NLS-1$ + private static final Object VOLATILE = "volatile"; //$NON-NLS-1$ + private static final Object CHANGEABLE = "changeable"; //$NON-NLS-1$ + private static final Object DERIVED = "derived"; //$NON-NLS-1$ + private static final Object TRANSIENT = "transient"; //$NON-NLS-1$ + private static final Object ORDERED = "ordered"; //$NON-NLS-1$ + private static final Object UNIQUE = "unique"; //$NON-NLS-1$ + private final EditingDomain editingDomain; + + public FacetCommandFactoryImpl(final EditingDomain editingDomain) { + this.editingDomain = editingDomain; + } + + /** + * Create an {@link AddCommand} to add the element to the owner. + * + * @param owner + * the owner. + * @param element + * the element to add. + * @return the command. + */ + private Command createAddCommand(final Object owner, final Object element) { + + if (owner == null) { + throw new IllegalArgumentException("The given owner cannot be null"); //$NON-NLS-1$ + } + + if (element == null) { + throw new IllegalArgumentException( + "The given element cannot be null"); //$NON-NLS-1$ + } + + return AddCommand.create(this.editingDomain, owner, + getEStructuralFeature(element), element); + } + + /** + * Create an {@link SetCommand} to add the element to the owner. + * + * @param initialObject + * the owner. + * @param newObject + * the element to add. + * @return the command. + */ + public Command createSetCommand(final Object initialObject, + final Object feature, final Object newValue) { + + if (initialObject == null) { + throw new IllegalArgumentException("The given owner cannot be null"); //$NON-NLS-1$ + } + + if (feature == null) { + throw new IllegalArgumentException( + "The given feature cannot be null"); //$NON-NLS-1$ + } + + if (newValue == null) { + throw new IllegalArgumentException( + "The given newValue cannot be null"); //$NON-NLS-1$ + } + + return SetCommand.create(this.editingDomain, initialObject, feature, + newValue); + } + + /** + * Return the {@link EStructuralFeature} for a given element. + * + * @param element + * the element. + * @return the eStructuralFeature for the element. + */ + private static EStructuralFeature getEStructuralFeature(final Object element) { + EStructuralFeature result = null; + if (element instanceof FacetSet) { + result = EcorePackage.eINSTANCE.getEPackage_ESubpackages(); + } else if (element instanceof Facet) { + result = EcorePackage.eINSTANCE.getEPackage_EClassifiers(); + } else if ((element instanceof FacetAttribute) + || (element instanceof FacetReference)) { + result = EFacetPackage.eINSTANCE.getFacet_FacetElements(); + } else if (element instanceof FacetOperation) { + result = EFacetPackage.eINSTANCE.getFacet_FacetOperations(); + } + return result; + + } + + public Command createFacetSetInFacetSetCommand(final FacetSet owner, + final FacetSet facetSet) { + return createAddCommand(owner, facetSet); + } + + public Command createFacetInFacetSetCommand(final FacetSet parent, + final Facet facet) { + return createAddCommand(parent, facet); + } + + public Command createEditFacetStructuralFeatureCommand( + final DerivedTypedElement feature, final Facet container, + final String name, final int lowerBound, final int upperBound, + final EClassifier type, final boolean ordered, + final boolean unique, final Query query, final boolean volatilee, + final boolean change, final boolean derived, + final boolean transientt) { + if (feature == null) { + throw new IllegalArgumentException( + "The parameter facetOperation must not be null"); //$NON-NLS-1$ + } + final List<Command> commands = new ArrayList<Command>(); + if (feature.eContainer() != container) { + final Command command = new AddCommand(this.editingDomain, + container, + EFacetPackage.eINSTANCE.getFacet_FacetElements(), feature); + commands.add(command); + } + if (feature instanceof EStructuralFeature) { + final EStructuralFeature structuralFeature = (EStructuralFeature) feature; + if (structuralFeature.isVolatile() != volatilee) { + final Command command = new SetCommand(this.editingDomain, + structuralFeature, + EcorePackage.eINSTANCE.getEStructuralFeature_Volatile(), + Boolean.valueOf(volatilee)); + commands.add(command); + } + if (structuralFeature.isChangeable() != change) { + final Command command = new SetCommand(this.editingDomain, + structuralFeature, + EcorePackage.eINSTANCE + .getEStructuralFeature_Changeable(), + Boolean.valueOf(change)); + commands.add(command); + } + if (structuralFeature.isDerived() != derived) { + final Command command = new SetCommand(this.editingDomain, + structuralFeature, + EcorePackage.eINSTANCE.getEStructuralFeature_Derived(), + Boolean.valueOf(ordered)); + commands.add(command); + } + if (structuralFeature.isTransient() != transientt) { + final Command command = new SetCommand(this.editingDomain, + structuralFeature, + EcorePackage.eINSTANCE + .getEStructuralFeature_Transient(), + Boolean.valueOf(unique)); + commands.add(command); + } + } + commands.add(createEditDerivedTypeElementCommand(feature, + name, lowerBound, upperBound, type, ordered, unique, query)); + return EmfCommandUtils.createResult(commands, + "edit facet structural feature"); //$NON-NLS-1$ + } + + public Command createAddOperationInFacetCommand(final Facet parent, + final FacetOperation facetOperation) { + return createAddCommand(parent, facetOperation); + } + + public Command createAddReferenceInFacetCommand(final Facet parent, + final FacetReference facetReference) { + return createAddCommand(parent, facetReference); + } + + public Command createAddParameterInOperationCommand( + final FacetOperation parent, final EParameter opParameter) { + return createAddCommand(parent, opParameter); + } + + public Command createChangeOwnerCommand(final Object element, + final Object newOwner) { + if (element == null) { + throw new IllegalArgumentException( + "The given element cannot be null"); //$NON-NLS-1$ + } + if (newOwner == null) { + throw new IllegalArgumentException( + "The given element cannot be null"); //$NON-NLS-1$ + } + return createAddCommand(newOwner, element); + } + + public Command createEditFacetSetCommand(final FacetSet editedFacetSet, + final FacetSet container, final String name) { + if (editedFacetSet == null) { + throw new IllegalArgumentException( + "The parameter 'editedFacetSet' must not be null"); //$NON-NLS-1$ + } + final List<Command> commands = new ArrayList<Command>(); + commands.add(createEditENamedElementcommand(editedFacetSet, name)); + if (editedFacetSet.eContainer() != container) { + final Command command = new AddCommand(this.editingDomain, + container, + EcorePackage.eINSTANCE.getEPackage_ESubpackages(), + editedFacetSet); + commands.add(command); + } + return EmfCommandUtils.createResult(commands, "Edit FacetSet"); //$NON-NLS-1$ + } + + public Command createEditFacetCommand(final Facet facet, + final FacetSet container, final String name, + final ETypedElement conformance, final EClass extendMetaclass, + final FacetSet extendedFacetSet) { + final List<Command> commands = new ArrayList<Command>(); + commands.add(createEditENamedElementcommand(facet, name)); + if (facet.eContainer() != container) { + final Command command = new AddCommand(this.editingDomain, + container, + EcorePackage.eINSTANCE.getEPackage_EClassifiers(), facet); + commands.add(command); + } + if (facet.getConformanceTypedElement() != conformance) { + final Command command = new SetCommand(this.editingDomain, facet, + EFacetPackage.eINSTANCE.getFacet_ConformanceTypedElement(), + conformance); + commands.add(command); + } + if (extendedFacetSet != null + && (facet.getExtendedFacets().isEmpty() || facet + .getExtendedFacets().get(0) != extendedFacetSet)) { + final Command command = new SetCommand(this.editingDomain, + facet, + EFacetPackage.eINSTANCE.getFacet_ExtendedFacets(), + Collections.singletonList(extendedFacetSet)); + commands.add(command); + } + if (facet.getExtendedMetaclass() != extendMetaclass) { + final Command command = new SetCommand(this.editingDomain, facet, + EFacetPackage.eINSTANCE.getFacet_ExtendedMetaclass(), + extendMetaclass); + commands.add(command); + } + return EmfCommandUtils.createResult(commands, "Edit Facet"); //$NON-NLS-1$ + } + + private Command createEditENamedElementcommand( + final ENamedElement namedElement, final String name) { + if (namedElement == null) { + throw new IllegalArgumentException( + "The parameter 'editedFacetSet' must not be null"); //$NON-NLS-1$ + } + final List<Command> commands = new ArrayList<Command>(); + if (namedElement.getName() != name) { + final Command command = new SetCommand(this.editingDomain, + namedElement, + EcorePackage.eINSTANCE.getENamedElement_Name(), name); + commands.add(command); + } + return EmfCommandUtils.createResult(commands, "Edit NamedElement"); //$NON-NLS-1$ + } + + public Command createSetFacetAttributeCommand(final Facet initialContainer, + final FacetAttribute initialElement, final FacetAttribute newElement) { + if (initialElement == null) { + throw new IllegalArgumentException(PARENT_NOT_NULL); + } + if (newElement == null) { + throw new IllegalArgumentException(VALUE_NOT_NULL); + } + final CompoundCommand commands = new CompoundCommand(); + final List<EAttribute> facetAttributes = EFacetPackage.eINSTANCE + .getFacetAttribute().getEAllAttributes(); + setEStructuralFeatureAttributes(initialElement, newElement, commands, + facetAttributes); + setETypedElementAttributes(initialElement, newElement, commands, + facetAttributes); + final Command changeOwner = createChangeOwnerCommand(newElement, + initialContainer); + commands.append(changeOwner); + return commands; + } + + public Command createSetFacetReferenceCommand(final Facet initialContainer, + final FacetReference initialElement, final FacetReference newElement) { + if (initialElement == null) { + throw new IllegalArgumentException(PARENT_NOT_NULL); + } + if (newElement == null) { + throw new IllegalArgumentException(VALUE_NOT_NULL); + } + final CompoundCommand commands = new CompoundCommand(); + final List<EAttribute> facetReferences = EFacetPackage.eINSTANCE + .getFacetReference().getEAllAttributes(); + setEStructuralFeatureAttributes(initialElement, newElement, commands, + facetReferences); + setETypedElementAttributes(initialElement, newElement, commands, + facetReferences); + final Command changeOwner = createChangeOwnerCommand(newElement, initialContainer); + commands.append(changeOwner); + return commands; + } + + public Command createEditFacetOperationCommand( + final FacetOperation facetOperation, final Facet container, + final String name, final int lowerBound, final int upperBound, + final EClassifier type, final boolean ordered, + final boolean unique, final Query query) { + if (facetOperation == null) { + throw new IllegalArgumentException( + "The parameter facetOperation must not be null"); //$NON-NLS-1$ + } + final List<Command> commands = new ArrayList<Command>(); + if (facetOperation.eContainer() != container) { + final Command command = new AddCommand(this.editingDomain, + container, + EFacetPackage.eINSTANCE.getFacet_FacetOperations(), + facetOperation); + commands.add(command); + } + commands.add(createEditDerivedTypeElementCommand(facetOperation, name, + lowerBound, upperBound, type, ordered, unique, query)); + return EmfCommandUtils.createResult(commands, "Edit facet operation"); //$NON-NLS-1$ + } + + private Command createEditDerivedTypeElementCommand( + final DerivedTypedElement dte, final String name, + final int lowerBound, final int upperBound, final EClassifier type, + final boolean ordered, final boolean unique, final Query query) { + if (dte == null) { + throw new IllegalArgumentException( + "The parameter facetOperation must not be null"); //$NON-NLS-1$ + } + final List<Command> commands = new ArrayList<Command>(); + commands.add(createEditETypedElementCommand(dte, name, lowerBound, + upperBound, type, ordered, unique)); + if (dte.getQuery() != query) { + final Command command = new SetCommand(this.editingDomain, dte, + EFacetPackage.eINSTANCE.getDerivedTypedElement_Query(), + query); + commands.add(command); + } + return EmfCommandUtils.createResult(commands, + "Edit derived typed element"); //$NON-NLS-1$ + } + + private Command createEditETypedElementCommand( + final ETypedElement typedElement, final String name, + final int lowerBound, final int upperBound, final EClassifier type, + final boolean ordered, final boolean unique) { + final List<Command> commands = new ArrayList<Command>(); + commands.add(createEditENamedElementcommand(typedElement, name)); + if (typedElement.getLowerBound() != lowerBound) { + final Command command = new SetCommand(this.editingDomain, + typedElement, + EcorePackage.eINSTANCE.getETypedElement_LowerBound(), + Integer.valueOf(lowerBound)); + commands.add(command); + } + if (typedElement.getUpperBound() != upperBound) { + final Command command = new SetCommand(this.editingDomain, + typedElement, + EcorePackage.eINSTANCE.getETypedElement_LowerBound(), + Integer.valueOf(upperBound)); + commands.add(command); + } + if (typedElement.isOrdered() != ordered) { + final Command command = new SetCommand(this.editingDomain, + typedElement, + EcorePackage.eINSTANCE.getETypedElement_Ordered(), + Boolean.valueOf(ordered)); + commands.add(command); + } + if (typedElement.isUnique() != unique) { + final Command command = new SetCommand(this.editingDomain, + typedElement, + EcorePackage.eINSTANCE.getETypedElement_Ordered(), + Boolean.valueOf(unique)); + commands.add(command); + } + if (typedElement.getEType() != type) { + final Command command = new SetCommand(this.editingDomain, + typedElement, + EcorePackage.eINSTANCE.getETypedElement_EType(), type); + commands.add(command); + } + return EmfCommandUtils.createResult(commands, "Edit ETypedElement"); //$NON-NLS-1$ + } + + public Command createEditOperationParameterCommand( + final EParameter parameter, final FacetOperation facetOperation, + final String name, final int lowerBound, final int upperBound, + final EClassifier type, final boolean ordered, final boolean unique) { + if (parameter == null) { + throw new IllegalArgumentException( + "The parameter parameter must not be null"); //$NON-NLS-1$ + } + final List<Command> commands = new ArrayList<Command>(); + commands.add(createEditETypedElementCommand(parameter, name, + lowerBound, upperBound, type, ordered, unique)); + return EmfCommandUtils.createResult(commands, + "Edit operation parameter"); //$NON-NLS-1$ + } + + private void setEStructuralFeatureAttributes( + final EStructuralFeature initialElement, + final EStructuralFeature newElement, + final CompoundCommand commands, + final List<EAttribute> facetOperations) { + for (final EAttribute attribute : facetOperations) { + if (attribute.getName().equals(TRANSIENT)) { + commands.append(createSetCommand(initialElement, attribute, + Boolean.valueOf(newElement.isTransient()))); + } + if (attribute.getName().equals(VOLATILE)) { + commands.append(createSetCommand(initialElement, attribute, + Boolean.valueOf(newElement.isVolatile()))); + } + if (attribute.getName().equals(CHANGEABLE)) { + commands.append(createSetCommand(initialElement, attribute, + Boolean.valueOf(newElement.isChangeable()))); + } + if (attribute.getName().equals(DERIVED)) { + commands.append(createSetCommand(initialElement, attribute, + Boolean.valueOf(newElement.isDerived()))); + } + } + } + + private void setETypedElementAttributes(final ETypedElement initialElement, + final ETypedElement newElement, final CompoundCommand commands, + final List<EAttribute> facetOperations) { + for (final EAttribute attribute : facetOperations) { + if (attribute.getName().equals(NAME)) { + commands.append(createSetCommand(initialElement, attribute, + newElement.getName())); + } + if (attribute.getName().equals(LOWER_BOUND)) { + commands.append(createSetCommand(initialElement, attribute, + Integer.valueOf(newElement.getLowerBound()))); + } + if (attribute.getName().equals(UPPER_BOUND)) { + commands.append(createSetCommand(initialElement, attribute, + Integer.valueOf(newElement.getUpperBound()))); + } + if (attribute.getName().equals(ORDERED)) { + commands.append(createSetCommand(initialElement, attribute, + Boolean.valueOf(newElement.isOrdered()))); + } + if (attribute.getName().equals(UNIQUE)) { + commands.append(createSetCommand(initialElement, attribute, + Boolean.valueOf(newElement.isUnique()))); + } + } + } + + + public Command createEditFacetOperationCommand( + final DerivedTypedElement dte, final Facet facetContainer, + final String name, final int lowerBound, final int upperBound, + final EClassifier type, final boolean ordered, + final boolean unique, final Query query) { + // TODO Auto-generated method stub + return null; + } + +}
diff --git a/org.eclipse.modisco.facet.efacet.core/src/org/eclipse/modisco/facet/efacet/core/internal/FacetManager.java b/org.eclipse.modisco.facet.efacet.core/src/org/eclipse/modisco/facet/efacet/core/internal/FacetManager.java new file mode 100644 index 0000000..a09c946 --- /dev/null +++ b/org.eclipse.modisco.facet.efacet.core/src/org/eclipse/modisco/facet/efacet/core/internal/FacetManager.java
@@ -0,0 +1,788 @@ +/******************************************************************************* + * Copyright (c) 2011, 2016 Mia-Software, and Soft-Maint. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Emmanuelle Rouillé (Mia-Software) - Bug 352618 - To be able to use non derived facet structural features and save them values. + * Nicolas Bros (Mia-Software) - Bug 361612 - New core for new version of the Facet metamodel + * Grégoire Dupé (Mia-Software) - Bug 361612 - [Restructuring] New core for new version of the Facet metamodel* + * Olivier Remaud (Soft-Maint) - Bug 361794 - [Restructuring] EMF Facet customization meta-model + * Gregoire Dupe (Mia-Software) - Bug 361794 - [Restructuring] New customization meta-model + * Gregoire Dupe (Mia-Software) - Bug 369987 - [Restructuring][Table] Switch to the new customization and facet framework + * Gregoire Dupe (Mia-Software) - Bug 364325 - [Restructuring] The user must be able to navigate into a model using the Facet. + * Olivier Remaud (Mia-Software) - Bug 374348 - Infinite loop in Facet override resolution + * Gregoire Dupe (Mia-Software) - Bug 373078 - API Cleaning + * Gregoire Dupe (Mia-Software) - Bug 376576 - [EFacet] Change the multiplicity of Facet::extendedFacet + * Nicolas Bros (Mia-Software) - Bug 378475 - unit test failures after table refactoring + * Thomas Cicognani (Soft-Maint) - Bug 416221 - New methods to get references in FacetManager API + * Thomas Cicognani (Soft-Maint) - Bug 420193 - Listener on FacetManager + * Gregoire Dupe (Mia-Software) - Bug 443682 - Access to the super facet + * Jonathan Pepin (Soft-Maint) - Bug 463898 - Create FacetReference not derived, without query and with opposite mechanism + * Jonathan Pepin (Soft-Maint) - Bug 463907 - Command for load and save Facet serialization + * Jonathan Pepin (Soft-Maint) - Bug 464069 - Applying facet inferred from attribute and reference instances contained in facet serialisation model + * Grégoire Dupé (Mia-Software) - Bug 464069 - Applying facet inferred from attribute and reference instances contained in facet serialisation model + * Jonathan Pepin (Soft-Maint) - Bug 473217 - On SerializationManager getMultiValuedStructuralFeature create ExtendedEObjectReference despite empty instances + * Jonathan Pepin (Soft-Maint) - Bug 473673 - Applying facet inferred from fopposite reference + * Grégoire Dupé (Mia-Software) - Bug 476141 - Facet manger can fail with ConcurrentModificationException + * Jonathan Pepin (Soft-Maint) - Bug 510034 - Null value is wrongly casted in a new list + * Jonathan Pepin (Soft-Maint) - Bug 510039 - Facet references many-to-one and one-to-many are not managed + *******************************************************************************/ +package org.eclipse.modisco.facet.efacet.core.internal; + +import java.lang.reflect.InvocationTargetException; +import java.util.ArrayList; +import java.util.Collection; +import java.util.HashSet; +import java.util.LinkedList; +import java.util.List; +import java.util.Set; +import java.util.concurrent.CopyOnWriteArrayList; + +import org.eclipse.emf.common.notify.Adapter; +import org.eclipse.emf.common.notify.Notification; +import org.eclipse.emf.common.notify.Notifier; +import org.eclipse.emf.common.util.EList; +import org.eclipse.emf.ecore.EAttribute; +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.EClassifier; +import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.ecore.EOperation; +import org.eclipse.emf.ecore.EPackage; +import org.eclipse.emf.ecore.EReference; +import org.eclipse.emf.ecore.EStructuralFeature; +import org.eclipse.emf.ecore.ETypedElement; +import org.eclipse.emf.ecore.EcorePackage; +import org.eclipse.emf.ecore.resource.Resource; +import org.eclipse.emf.ecore.resource.ResourceSet; +import org.eclipse.emf.edit.domain.EditingDomain; +import org.eclipse.modisco.facet.efacet.core.FacetUtils; +import org.eclipse.modisco.facet.efacet.core.IDerivedTypedElementManager; +import org.eclipse.modisco.facet.efacet.core.IFacetManager; +import org.eclipse.modisco.facet.efacet.core.IFacetManagerListener; +import org.eclipse.modisco.facet.efacet.core.exception.DerivedTypedElementException; +import org.eclipse.modisco.facet.efacet.core.exception.FacetManagerException; +import org.eclipse.modisco.facet.efacet.core.exception.SuperInvokeException; +import org.eclipse.modisco.facet.efacet.core.internal.exception.FacetConformanceEvaluationException; +import org.eclipse.modisco.facet.efacet.core.internal.exception.UnmatchingExpectedTypeException; +import org.eclipse.modisco.facet.efacet.core.internal.serialization.SerializationManager; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.DerivedTypedElement; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.Facet; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.FacetAttribute; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.FacetOperation; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.FacetReference; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.FacetSet; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.ParameterValue; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.runtime.ETypedElementEObjectListResult; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.runtime.ETypedElementEObjectResult; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.runtime.ETypedElementPrimitiveTypeListResult; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.runtime.ETypedElementPrimitiveTypeResult; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.runtime.ETypedElementResult; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.runtime.RuntimeFactory; +import org.eclipse.modisco.facet.util.core.Logger; + +public class FacetManager implements IFacetManager, Adapter { + + private static final EClassifier EBOOLEAN = EcorePackage.eINSTANCE.getEBoolean(); + private static final EClassifier EBOOLEAN_OBJECT = EcorePackage.eINSTANCE.getEBooleanObject(); + private final FacetManagerContext context; + private final SerializationManager serializationMgr; + private final ResourceSet resourceSet; + private final List<IFacetManagerListener> listeners = new CopyOnWriteArrayList<IFacetManagerListener>(); + + public FacetManager(final Resource resource) { + this.context = new FacetManagerContext(this); + this.serializationMgr = new SerializationManager(resource, this); + this.resourceSet = resource.getResourceSet(); + } + + public FacetManager(final ResourceSet resourceSet) { + this.context = new FacetManagerContext(this); + this.serializationMgr = new SerializationManager(null, this); + this.resourceSet = resourceSet; + } + + public void saveStructuralFeatureInstanceModel() + throws FacetManagerException { + this.serializationMgr.saveStructuralFeatureInstanceModel(); + } + + /** + * Returns whether the given model element conforms to the given Facet + * + * @param eObject + * the model element + * @param facet + * the Facet the applicability of which is being tested + * @return whether the given model element should be seen as an instance of the given Facet + */ + public boolean isConforming(final EObject eObject, final Facet facet) + throws FacetManagerException { + return getConformanceState(eObject, facet) == FacetManager.ConformanceState.Conformant; + } + + public enum ConformanceState { + Conformant, NonConformingMetaclass, NonConformingElement + } + + private void checkConformance(final EObject eObject, final Facet facet) + throws FacetManagerException { + final ConformanceState conformanceState = getConformanceState(eObject, facet); + if (conformanceState == FacetManager.ConformanceState.NonConformingMetaclass) { + throw new FacetManagerException("NonApplicableFacetException"); //$NON-NLS-1$ + } + if (conformanceState == FacetManager.ConformanceState.NonConformingElement) { + throw new FacetManagerException("NonConformingEObjectException"); //$NON-NLS-1$ + } + } + + protected ConformanceState getConformanceState(final EObject eObject, + final Facet facet) throws FacetManagerException { + // Begin of precondition section + if (eObject == null) { + throw new IllegalArgumentException("eObject cannot be null"); //$NON-NLS-1$ + } + if (facet == null) { + throw new IllegalArgumentException("facet cannot be null"); //$NON-NLS-1$ + } + // End of precondition section + ConformanceState result; + final EClass extendedMetaclass = FacetUtils.getExtendedMetaclass(facet); + if (extendedMetaclass != null + && (extendedMetaclass.isSuperTypeOf(eObject.eClass()) || extendedMetaclass == EcorePackage.eINSTANCE.getEObject())) { + final ETypedElement typeElement = facet.getConformanceTypedElement(); + if (typeElement == null) { + result = FacetManager.ConformanceState.Conformant; + } else { + final Boolean isConforming = getConformanceValue(eObject, typeElement); + if (isConforming.booleanValue()) { + result = FacetManager.ConformanceState.Conformant; + } else { + result = FacetManager.ConformanceState.NonConformingElement; + } + } + } else { + result = FacetManager.ConformanceState.NonConformingMetaclass; + } + // The conformance constraint is inherited from the super facet. + if (result == FacetManager.ConformanceState.Conformant) { + for (Facet extFacet : facet.getExtendedFacets()) { + result = getConformanceState(eObject, extFacet); + if (result != FacetManager.ConformanceState.Conformant) { + break; + } + } + } + return result; + } + + private Boolean getConformanceValue(final EObject eObject, + final ETypedElement typeElement) throws FacetManagerException { + // Begin precondition checking + if (typeElement.isMany()) { + throw new FacetManagerException( + "The Facet's conformance typed element must not be multi-valued"); //$NON-NLS-1$ + } + if (typeElement.getEType() != FacetManager.EBOOLEAN && typeElement.getEType() != FacetManager.EBOOLEAN_OBJECT) { + throw new FacetManagerException( + "The Facet conformance typed element evaluated to a wrong type."); //$NON-NLS-1$ + } + // End precondition checking + Boolean result; // conformance typedElement Value + try { + if (typeElement instanceof EStructuralFeature) { + final EStructuralFeature structuralFeature = (EStructuralFeature) typeElement; + // basicGet = true in order to avoid an infinite recursion + result = internalGet(eObject, structuralFeature, Boolean.class, true); + } else if (typeElement instanceof EOperation) { + final EOperation operation = (EOperation) typeElement; + if (operation.getEParameters().size() > 0) { + throw new FacetConformanceEvaluationException("The Facet's conformance operation cannot have parameters"); //$NON-NLS-1$ + } + // basicInvoke = true in order to avoid an infinite recursion, + // ie don't check conformance and don't resolve overrides + result = internalInvoke(eObject, operation, Boolean.class, true); + } else { + throw new FacetConformanceEvaluationException("Unsupported conformance typed element type: " + typeElement.getClass().getName()); //$NON-NLS-1$ + } + } catch (Exception e) { + throw new FacetManagerException(e); + } + if (result == null) { + throw new FacetManagerException( + "The Facet conformance typed element evaluated to null"); //$NON-NLS-1$ + } + return result; + } + + public void set(final EObject eObject, + final EStructuralFeature structuralFeature, final Object newValue, + final EditingDomain editingDomain) throws FacetManagerException { + if (structuralFeature.isMany() && !(newValue instanceof Collection<?>)) { + throw new IllegalArgumentException("newValue should be a Collection because eStructuralFeature is an EReference"); //$NON-NLS-1$ + // TODO: check the type of the elements of the list. + } + final EObject eContainer = structuralFeature.eContainer(); + if (eContainer instanceof Facet) { + final Facet facet = (Facet) eContainer; + checkConformance(eObject, facet); + if (structuralFeature instanceof EAttribute) { + final EAttribute eAttribute = (EAttribute) structuralFeature; + setAttribute(eObject, eAttribute, newValue); + } else if (structuralFeature instanceof EReference) { + final EReference eReference = (EReference) structuralFeature; + setReference(eObject, eReference, newValue); + } else { + final String message = String.format( + "Setting a structural feature of type '%s' is not implemented", //$NON-NLS-1$ + structuralFeature.getClass().getName()); + throw new UnsupportedOperationException(message); + } + } else { + eObject.eSet(structuralFeature, newValue); + } + } + + private void setReference(final EObject eObject, + final EReference eReference, final Object newValue) + throws FacetManagerException { + // Begin precondition + if (eReference.isDerived()) { + if (eReference instanceof FacetReference) { + /* + * TODO We still have to implement the setting of a + * derived facet attribute. Cf. + * https://bugs.eclipse.org/bugs/show_bug.cgi?id=365726 + */ + throw new UnsupportedOperationException( + "Setting a FacetReference is not yet implemented"); //$NON-NLS-1$ + } + throw new IllegalStateException( + "A eReference owned by a Facet must be derived"); //$NON-NLS-1$ + } + // End precondition + manageFOpposite(eObject, newValue, eReference); + this.serializationMgr.setReference(eObject, eReference, newValue); + } + + private void manageFOpposite(final EObject eObject, final Object newValue, + final EReference eReference) throws FacetManagerException { + if (eReference instanceof FacetReference) { + final FacetReference facetReference = (FacetReference) eReference; + final FacetReference fOpposite = facetReference.getFOpposite(); + if (fOpposite != null) { + FacetManagerInternalUtils.loadParentFacetSet(fOpposite, this); + if (newValue instanceof List<?>) { + @SuppressWarnings("unchecked") + final List<EObject> newList = (List<EObject>) newValue; + manageManyFOpposite(eObject, newList, eReference, + fOpposite); + } else if (newValue instanceof EObject) { + final EObject newEObject = (EObject) newValue; + manageOneFOpposite(eObject, newEObject, eReference, fOpposite); + } + } + } + } + + /** + * manage many to one, and one to one + */ + private void manageOneFOpposite(final EObject eObject, + final EObject newObj, final EReference eReference, + final FacetReference fOpposite) throws FacetManagerException { + // prepare old reference + final EObject oldObj = get(eObject, eReference, EObject.class); + // many to one + if (fOpposite.isMany()) { + // Delete old only opposite references + if (oldObj != null) { + removeReferenceToExisting(oldObj, fOpposite, eObject); + } + // Create new only opposite references + addReferenceToExisting(newObj, fOpposite, eObject); + } else { // one to one + if (oldObj != null) { + // Delete old reference + this.serializationMgr.clearReference(oldObj, eReference); + // Delete old opposite reference + this.serializationMgr.clearReference(oldObj, fOpposite); + } + // Create opposite reference + this.serializationMgr.setReference(newObj, fOpposite, eObject); + + } + } + + /** + * manage many to many, and one to many + */ + private void manageManyFOpposite(final EObject eObject, + final List<EObject> newList, final EReference eReference, + final FacetReference fOpposite) throws FacetManagerException { + // prepare old references, difference between old and new values + final List<EObject> oldList = getMultiValued(eObject, eReference, + EObject.class); + if (!oldList.isEmpty()) { + oldList.removeAll(newList); + } + // many to many + if (fOpposite.isMany()) { + // Delete old only opposite references + for (final EObject oldObj : oldList) { + removeReferenceToExisting(oldObj, fOpposite, eObject); + } + // Create new only opposite references + for (final EObject newObj : newList) { + addReferenceToExisting(newObj, fOpposite, eObject); + } + } else { // one to many + // Delete old opposite references + for (final EObject oldObj : oldList) { + this.serializationMgr.clearReference(oldObj, fOpposite); + } + // For new values + for (final EObject newObj : newList) { + final EObject oldOppObj = get(newObj, fOpposite, EObject.class); + // Delete old reference + if (oldOppObj != null) { + this.removeReferenceToExisting(oldOppObj, eReference, newObj); + } + // Create opposite reference + this.serializationMgr.setReference(newObj, fOpposite, eObject); + } + } + } + + /** + * add new to existing references + */ + private void addReferenceToExisting(final EObject newObj, + final EReference eReference, final EObject eObject) + throws FacetManagerException { + final List<EObject> existingList = this.getMultiValued(newObj, + eReference, EObject.class); + // performance of collection created with initial size is better + final List<EObject> newList = new ArrayList<EObject>( + existingList.size() + 1); + newList.addAll(existingList); + newList.add(eObject); + this.serializationMgr.setReference(newObj, eReference, newList); + } + + /** + * remove old from existing references + */ + private void removeReferenceToExisting(final EObject oldObj, + final EReference eReference, final EObject eObject) + throws FacetManagerException { + final List<EObject> existingList = getMultiValued(oldObj, eReference, + EObject.class); + // performance of collection created with initial size is better + final List<EObject> newList = new ArrayList<EObject>( + existingList.size()); + newList.addAll(existingList); + newList.remove(eObject); + this.serializationMgr.setReference(oldObj, eReference, newList); + } + + private void setAttribute(final EObject eObject, + final EAttribute eAttribute, final Object newValue) { + // Begin precondition + if (eAttribute.isDerived()) { + if (eAttribute instanceof FacetAttribute) { + /* + * TODO We still have to implement the setting of a + * derived facet attribute. Cf. + * https://bugs.eclipse.org/bugs/show_bug.cgi?id=365726 + */ + throw new UnsupportedOperationException( + "Setting a FacetAttribute is not yet implemented"); //$NON-NLS-1$ + } + throw new IllegalStateException( + "A eAttribute owned by a Facet must be derived"); //$NON-NLS-1$ + } + // End precondition + this.serializationMgr.setAttribute(eObject, eAttribute, newValue); + } + + public <T> T get(final EObject eObject, + final EStructuralFeature structuralFeature, + final Class<T> expectedType) throws FacetManagerException { + return internalGet(eObject, structuralFeature, expectedType, false); + } + + private <T> T internalGet(final EObject eObject, + final EStructuralFeature structuralFeature, + final Class<T> expectedType, final boolean basicGet) + throws FacetManagerException { + try { + Object value; + if (structuralFeature.eContainer() instanceof Facet) { + + EStructuralFeature baseFeature = structuralFeature; + + if (!basicGet) { + baseFeature = this.context.resolveOverrides(structuralFeature, eObject); + final Facet facet = (Facet) baseFeature.eContainer(); + checkConformance(eObject, facet); + } + if (baseFeature.isDerived()) { + if (!(baseFeature instanceof DerivedTypedElement)) { + throw new UnsupportedOperationException("Cannot evaluate a derived structural feature that is not a DerivedTypedElement : not implemented"); //$NON-NLS-1$ + } + value = IDerivedTypedElementManager.INSTANCE.evaluate((DerivedTypedElement) baseFeature, eObject, null, this); + } else { + value = SerializationManager.getNotDerivedValue(eObject, + baseFeature); + } + } else { // Regular structural feature + if (structuralFeature instanceof DerivedTypedElement) { + throw new IllegalStateException("The given DerivedTypedElement is not contained in a Facet"); //$NON-NLS-1$ + } + value = eObject.eGet(structuralFeature, true); + } + return EmfUtils.checkAssignment(structuralFeature, expectedType, value); + } catch (Exception e) { + throw new FacetManagerException(e); + } + } + + public <T> List<T> getMultiValued(final EObject eObject, + final EStructuralFeature structuralFeature, + final Class<T> expectedType) throws FacetManagerException { + final Object result = internalGet(eObject, structuralFeature, null, false); + // return the original list, which must be modifiable by the caller + try { + return CastUtils.castToExpectedListType(result, expectedType, + !(structuralFeature instanceof EReference)); + } catch (UnmatchingExpectedTypeException e) { + throw new UnmatchingExpectedTypeException("Failed to cast the value of '" + structuralFeature.getName() + "' to a list of " + expectedType.getName(), e); //$NON-NLS-1$//$NON-NLS-2$ + } + } + + public <T> T invoke(final EObject eObject, final EOperation operation, + final Class<T> expectedType, final EditingDomain editingDomain, final Object... arguments) + throws FacetManagerException { + try { + return internalInvoke(eObject, operation, expectedType, false, arguments); + } catch (Exception e) { + throw new FacetManagerException("Error invoking Facet operation '" + operation.getName() + "'", e); //$NON-NLS-1$ //$NON-NLS-2$ + } + } + + public <T> List<T> invokeMultiValued(final EObject eObject, final EOperation operation, + final Class<T> expectedType, final Object... arguments) + throws FacetManagerException { + Object result; + try { + result = internalInvoke(eObject, operation, null, false, arguments); + } catch (Exception e) { + throw new FacetManagerException("Error invoking Facet operation '" + operation.getName() + "'", e); //$NON-NLS-1$ //$NON-NLS-2$ + } + return CastUtils.castToExpectedListType(result, expectedType, true); + } + + private <T> T internalInvoke(final EObject eObject, final EOperation operation, final Class<T> expectedType, + final boolean basicInvoke, final Object... arguments) + throws DerivedTypedElementException, InvocationTargetException, + FacetManagerException { + Object result; + if (operation.eContainer() instanceof Facet) { + final Facet facet = (Facet) operation.eContainer(); + + if (!basicInvoke) { + checkConformance(eObject, facet); + } + if (operation instanceof FacetOperation) { + final FacetOperation facetOperation = (FacetOperation) operation; + FacetOperation baseOperation = facetOperation; + if (!basicInvoke) { + baseOperation = this.context.resolveOverrides(facetOperation, eObject); + } + result = DerivedTypedElementUtils.evaluate(eObject, baseOperation, this, arguments); + } else { + result = EmfUtils.ecoreInvoke(eObject, operation, null, arguments); + } + } else { // Regular eOperation + if (operation instanceof FacetOperation) { + throw new IllegalStateException("The given FacetOperation is not contained in a Facet"); //$NON-NLS-1$ + } + result = EmfUtils.ecoreInvoke(eObject, operation, null, arguments); + } + return CastUtils.castToExpectedType(result, expectedType); + } + + public List<ETypedElementResult> get(final Collection<EObject> eObjects, final EStructuralFeature structuralFeature) { + // TODO Auto-generated method stub + throw new UnsupportedOperationException("not implemented yet"); //$NON-NLS-1$ + } + + public List<ETypedElementResult> batchInvoke( + final Collection<EObject> eObjects, final EOperation operation, + final Object... arguments) throws FacetManagerException { + // TODO Auto-generated method stub + throw new UnsupportedOperationException("not implemented yet"); //$NON-NLS-1$ + } + + public List<FacetSet> getManagedFacetSets() { + return this.context; + } + + public void setManagedFacetSets(final List<FacetSet> facetSets) { + this.context.setManagedFacetSets(facetSets); + } + + public void removeFacetSet(final FacetSet facetSet) { + this.context.removeFacetSet(facetSet); + } + + public ResourceSet getResourceSet() { + return this.resourceSet; + } + + public List<ETypedElement> getAppliedFeatures() { + // TODO Auto-generated method stub + throw new UnsupportedOperationException("not implemented yet"); //$NON-NLS-1$ + } + + public Set<EAttribute> getAttributes(final EObject eObject) + throws FacetManagerException { + return getEStructuralFeatures(eObject, EAttribute.class); + } + + public Set<EStructuralFeature> getStructuralFeature(final EObject eObject) + throws FacetManagerException { + return getEStructuralFeatures(eObject, EStructuralFeature.class); + } + + public <T extends ETypedElement> Set<T> getEStructuralFeatures( + final EObject eObject, final Class<T> classs) + throws FacetManagerException { + final Set<T> result = new HashSet<T>(); + for (FacetSet facetSet : this.context.getManagedFacetSets()) { + result.addAll(getETypedElements(eObject, facetSet, classs)); + } + return result; + } + + private <T extends ETypedElement> Collection<T> getETypedElements( + final EObject eObject, final FacetSet facetSet, + final Class<T> classs) throws FacetManagerException { + final Set<T> result = new HashSet<T>(); + for (EClassifier eClassifier : facetSet.getEClassifiers()) { + if (eClassifier instanceof Facet) { + final Facet facet = (Facet) eClassifier; + if (isConforming(eObject, facet)) { + for (EStructuralFeature eStructuralFeature : getAllEStructuralFeatures(facet)) { + if (classs.isInstance(eStructuralFeature)) { + @SuppressWarnings("unchecked") + // @SuppressWarnings("unchecked") This type has been + // checked using isInstance + final T typedSF = (T) eStructuralFeature; + result.add(typedSF); + } + } + } + } + } + // hierarchical FacetSets + for (EPackage ePackage : facetSet.getESubpackages()) { + if (ePackage instanceof FacetSet) { + final FacetSet subFacetSet = (FacetSet) ePackage; + result.addAll(getETypedElements(eObject, + subFacetSet, classs)); + } + } + // aggregates + for (FacetSet subFacetSet : facetSet.getFacetSets()) { + result.addAll(getETypedElements(eObject, subFacetSet, classs)); + } + return result; + } + + private List<EStructuralFeature> getAllEStructuralFeatures(final Facet facet) { + final List<EStructuralFeature> structFeatures = new LinkedList<EStructuralFeature>(); + structFeatures.addAll(facet.getFacetElements()); + for (Facet extFacet : facet.getExtendedFacets()) { + structFeatures.addAll(getAllEStructuralFeatures(extFacet)); + } + return structFeatures; + } + + public Set<EReference> getReferences(final EObject eObject) + throws FacetManagerException { + return getEStructuralFeatures(eObject, EReference.class); + } + + public Collection<? extends EStructuralFeature> getSF(final EObject eObject) + throws FacetManagerException { + return getEStructuralFeatures(eObject, EStructuralFeature.class); + } + + @Deprecated + public void addFacets(final EList<Facet> facets) { + for (Facet facetToLoad : facets) { + this.context.addFrontManagedFacetSet((FacetSet) facetToLoad + .getEPackage()); + } + } + + @Deprecated + public void unLoadAllFacets() { + removeAllManagedFacetSets(); + } + + public void removeAllManagedFacetSets() { + this.context.clear(); + } + + public <T> List<T> getOrInvokeMultiValued(final EObject eObject, + final ETypedElement eTypedElement, final Class<T> classs) + throws FacetManagerException { + List<T> result = null; + if (eTypedElement instanceof EStructuralFeature) { + final EStructuralFeature structuralFeature = (EStructuralFeature) eTypedElement; + result = getMultiValued(eObject, structuralFeature, classs); + } else if (eTypedElement instanceof EOperation) { + final EOperation eOperation = (EOperation) eTypedElement; + result = invokeMultiValued(eObject, eOperation, classs); + } + return result; + } + + public <T> T getOrInvoke(final EObject eObject, + final ETypedElement eTypedElement, final Class<T> classs) + throws FacetManagerException { + T result = null; + if (eTypedElement instanceof EStructuralFeature) { + final EStructuralFeature structuralFeature = (EStructuralFeature) eTypedElement; + result = get(eObject, structuralFeature, classs); + } else if (eTypedElement instanceof EOperation) { + final EOperation eOperation = (EOperation) eTypedElement; + result = invoke(eObject, eOperation, classs, null); + } + return result; + } + + public List<Facet> getManagedFacets() { + throw new IllegalStateException("Not implemented, and never will since it's deprecated"); //$NON-NLS-1$ + } + + public <T> List<ETypedElementResult> batchGetOrInvoke(final Collection<EObject> sources, final ETypedElement query, final Class<T> classs) + throws FacetManagerException { + final List<ETypedElementResult> results = new LinkedList<ETypedElementResult>(); + for (EObject source : sources) { + ETypedElementResult result = null; + Exception exception = null; + if (query.getEType() instanceof EClass) { + if (query.getUpperBound() == 1) { + final ETypedElementEObjectResult<EObject> eObjectResult = RuntimeFactory.eINSTANCE.createETypedElementEObjectResult(); + try { + eObjectResult.setResult(this.getOrInvoke(source, query, EObject.class)); + } catch (Exception e) { + exception = e; + } + result = eObjectResult; + } else { + final ETypedElementEObjectListResult<EObject> eObjectResultList = RuntimeFactory.eINSTANCE.createETypedElementEObjectListResult(); + try { + eObjectResultList.getResultList().addAll(this.getOrInvokeMultiValued(source, query, EObject.class)); + } catch (Exception e) { + exception = e; + } + result = eObjectResultList; + } + } else { + if (query.getUpperBound() == 1) { + final ETypedElementPrimitiveTypeResult<Object> eObjectResult = RuntimeFactory.eINSTANCE.createETypedElementPrimitiveTypeResult(); + try { + eObjectResult.setResult(this.getOrInvoke(source, query, Collection.class)); + } catch (Exception e) { + exception = e; + } + result = eObjectResult; + } else { + final ETypedElementPrimitiveTypeListResult<Object> eObjectResultList = RuntimeFactory.eINSTANCE.createETypedElementPrimitiveTypeListResult(); + eObjectResultList.getResultList().addAll(this.getOrInvokeMultiValued(source, query, Object.class)); + result = eObjectResultList; + } + } + if (exception != null) { + result.setException(exception); + Logger.logWarning(exception, Activator.getDefault()); + } + result.setDerivedTypedElement(query); + result.setSource(source); + results.add(result); + } + return results; + } + + public void addBackManagedFacetSet(final FacetSet facetSet) { + this.context.addBackManagedFacetSet(facetSet); + } + + public void addFrontManagedFacetSet(final FacetSet facetSet) { + this.context.addFrontManagedFacetSet(facetSet); + } + + public void notifyChanged(final Notification notification) { + // Nothing to do + } + + public Notifier getTarget() { + return null; + } + + public void setTarget(final Notifier newTarget) { + // Nothing to do + } + + public boolean isAdapterForType(final Object type) { + return false; + } + + public void addListener(final IFacetManagerListener listener) { + this.context.addListener(listener); + } + + public void removeListener(final IFacetManagerListener listener) { + this.context.removeListener(listener); + } + + public <T> T getSuperValueOf(final DerivedTypedElement derivedTypedElt, + final EObject source, final List<ParameterValue> parameterValues, + final Class<T> expectedType) throws SuperInvokeException, FacetManagerException { + Object result; + final DerivedTypedElement superDTE = this.context.getSuperOf( + derivedTypedElt, source); + if (superDTE == null) { + throw new SuperInvokeException("No super operation available."); //$NON-NLS-1$ + } + try { + result = IDerivedTypedElementManager.INSTANCE.evaluate(superDTE, + source, parameterValues, this); + } catch (DerivedTypedElementException e) { + throw new FacetManagerException(e); + } + return CastUtils.castToExpectedType(result, expectedType); + } + + public Resource getSerializationResource() { + return this.serializationMgr.getSerializationResource(); + } + + public void setSerializationResource(final Resource resource) { + this.serializationMgr.setSerializationResource(resource); + notifyListeners(); + } + + private void notifyListeners() { + for (IFacetManagerListener listener : this.listeners) { + listener.facetManagerChanged(); + } + } +}
diff --git a/org.eclipse.modisco.facet.efacet.core/src/org/eclipse/modisco/facet/efacet/core/internal/FacetManagerContext.java b/org.eclipse.modisco.facet.efacet.core/src/org/eclipse/modisco/facet/efacet/core/internal/FacetManagerContext.java new file mode 100644 index 0000000..0f1d16d --- /dev/null +++ b/org.eclipse.modisco.facet.efacet.core/src/org/eclipse/modisco/facet/efacet/core/internal/FacetManagerContext.java
@@ -0,0 +1,610 @@ +/******************************************************************************* + * Copyright (c) 2011, 2015 Mia-Software. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Olivier Remaud (Soft-Maint) - Bug 361794 - [Restructuring] EMF Facet customization meta-model + * Gregoire Dupe (Mia-Software) - Bug 364325 - [Restructuring] The user must be able to navigate into a model using the Facet. + * Gregoire Dupe (Mia-Software) - Bug 361794 - [Restructuring] EMF Facet customization meta-model + * Gregoire Dupe (Mia-Software) - Bug 373078 - API Cleaning + * Gregoire Dupe (Mia-Software) - Bug 375087 - [Table] ITableWidget.addColumn(List<ETypedElement>, List<FacetSet>) + * Gregoire Dupe (Mia-Software) - Bug 372626 - Aggregates + * Gregoire Dupe (Mia-Software) - Bug 377178 - [EFacet] infinite recursion in override resolution + * Gregoire Dupe (Mia-software) - Bug 383418 - [Table] FacetManagerContext.getOverrideCandidateFeatures(...) is empty + * Gregoire Dupe (Mia-software) - Bug 420093 - [EFacet] The facetManger list doesn't deal with uniqueness + * Thomas Cicognani (Soft-Maint) - Bug 420193 - Listener on FacetManager + * Fabien Treguer (Soft-Maint) - Bug 423285 - [Table] FacetSets not stored in a resource cause model manager crashes + * Gregoire Dupe (Mia-Software) - Bug 443682 - Access to the super facet + * Grégoire Dupé (Mia-Software) - Bug 476141 - Facet manger can fail with ConcurrentModificationException + *******************************************************************************/ + +package org.eclipse.modisco.facet.efacet.core.internal; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.Collections; +import java.util.HashSet; +import java.util.Iterator; +import java.util.LinkedList; +import java.util.List; +import java.util.ListIterator; +import java.util.Set; + +import org.eclipse.emf.common.util.EList; +import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.ecore.EOperation; +import org.eclipse.emf.ecore.ETypedElement; +import org.eclipse.emf.ecore.resource.Resource; +import org.eclipse.emf.ecore.resource.ResourceSet; +import org.eclipse.emf.ecore.util.EcoreUtil; +import org.eclipse.modisco.facet.efacet.core.FacetUtils; +import org.eclipse.modisco.facet.efacet.core.IFacetManagerListener; +import org.eclipse.modisco.facet.efacet.core.exception.FacetManagerException; +import org.eclipse.modisco.facet.efacet.core.internal.FacetManager.ConformanceState; +import org.eclipse.modisco.facet.efacet.core.internal.exception.UnmatchingExpectedTypeException; +import org.eclipse.modisco.facet.efacet.core.internal.exported.IResolverManager; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.DerivedTypedElement; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.Facet; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.FacetSet; +import org.eclipse.modisco.facet.util.core.DebugUtils; +import org.eclipse.modisco.facet.util.core.Logger; +import org.eclipse.modisco.facet.util.core.internal.exported.ListUtils; +import org.eclipse.modisco.facet.util.emf.core.ModelUtils; + +/** + * @author oremaud + * + * FacetManager Context + * + * Defines which FacetSets will be taken into account, and in which + * order ('front' FacetSets have higher precedence) + * + * Responsible of overrides resolution for Facets and Customs + */ +class FacetManagerContext implements List<FacetSet> { + + private static final String SILENT_OPTION = "org.eclipse.emf.facet.efacet.core.internal.FacetManagerContext.getOverrideCandidateFeatures.silent"; //$NON-NLS-1$ + private static final boolean SILENT = Boolean + .getBoolean(FacetManagerContext.SILENT_OPTION); + private static final boolean DEBUG = DebugUtils.getDebugStatus(Activator.getDefault()); + + // We cannot use the interface (i.e, List) instead because we need to use + // the methods addLast and addFirst + private LinkedList<FacetSet> managedFacetSets = new LinkedList<FacetSet>(); // NOPMD by gdupe on 15/03/12 10:36 + private final transient FacetManager manager; + /** + * This field is used to avoid to have to many error messages in the log. + */ + private final Set<ETypedElement> failingFeatures = new HashSet<ETypedElement>(); + + private final Set<IFacetManagerListener> listeners = new HashSet<IFacetManagerListener>(); + + public FacetManagerContext(final FacetManager manager) { + this.manager = manager; + } + + /** + * + * @param baseFeature + * @param eObject + * @return + * @throws FacetConformanceEvaluationException + * @throws UnmatchingExpectedTypeException + * @throws FacetManagerException + */ + public <T extends ETypedElement> T resolveOverrides(final T baseFeature, + final EObject eObject) throws FacetManagerException { + T result = baseFeature; + if (baseFeature instanceof DerivedTypedElement) { + final DerivedTypedElement derivedResult = resolveOverrides( + (DerivedTypedElement) baseFeature, eObject); + if (derivedResult != null + && !(derivedResult instanceof ETypedElement)) { + throw new UnmatchingExpectedTypeException( + "Type mismatch in override resolution '" + baseFeature.getName() + "'"); //$NON-NLS-1$ //$NON-NLS-2$ + } + result = (T) derivedResult; + } + // If nothing is found, return the original basefeature + if (result == null) { + result = baseFeature; + } + return result; + } + + /** + * + * @param baseFeature + * @param eObject + * @return + * @throws FacetConformanceEvaluationException + * @throws FacetManagerException + */ + public <T extends DerivedTypedElement> T resolveOverrides( + final T baseFeature, final EObject eObject) + throws FacetManagerException { + try { + // -- Find master override + // If the baseFeature overrides another feature, then we follow the + // override chain to find the top feature + // The main idea behind this is that the baseFeature does not really + // represents a specific feature but a + // feature signature (as in java method invocation) + final T signatureFeature = FacetUtils + .getTopOverrideFeature(baseFeature); + + // -- Find all candidates + // Get all Facet referenced by the FacetManager to get all features + // matching this signature + // Note : candidates are searched ine the order provided by the current + // FacetManager, + // so they are already ordered by the wanted priority + // XXX : Debug check that DerivedTypedElement only contained by Facet + final List<T> orderedCandidates = getOverrideCandidateFeatures(eObject, + signatureFeature); + + // -- Find the most specific feature + return findMostSpecificFeature(orderedCandidates); + } catch (Exception e) { + throw new FacetManagerException(e); + } + } + + public <T extends DerivedTypedElement> T getSuperOf( + final T currentFeature, final EObject eObject) + throws FacetManagerException { + try { + // -- Find master override + // If the baseFeature overrides another feature, then we follow the + // override chain to find the top feature + // The main idea behind this is that the baseFeature does not really + // represents a specific feature but a + // feature signature (as in java method invocation) + final T signatureFeature = FacetUtils.getTopOverrideFeature(currentFeature); + // -- Find all candidates + // Get all Facet referenced by the FacetManager to get all features + // matching this signature + // Note : candidates are searched ine the order provided by the current + // FacetManager, + // so they are already ordered by the wanted priority + // XXX : Debug check that DerivedTypedElement only contained by Facet + final List<T> orderedCandidates = getOverrideCandidateFeatures(eObject, + signatureFeature); + // -- Find the most specific feature + final int mostSpecificIndex = orderedCandidates.indexOf(currentFeature); + if (mostSpecificIndex == -1) { + throw new IllegalStateException("\"currentFeature\" must exists in \"orderedCandidates\""); //$NON-NLS-1$ + } + final int lastIndex = orderedCandidates.size() - 1; + T result = null; + if (mostSpecificIndex != lastIndex) { + final int superIndex = mostSpecificIndex + 1; + // -- Find the most specific feature + result = orderedCandidates.get(superIndex); + } + return result; + } catch (Exception e) { + throw new FacetManagerException(e); + } + } + + public List<FacetSet> getManagedFacetSets() { + return Collections.unmodifiableList( + new ArrayList<FacetSet>(this.managedFacetSets) + ); + } + + public void setManagedFacetSets(final List<FacetSet> facetSets) { + this.managedFacetSets = new LinkedList<FacetSet>(facetSets); + notifyListeners(); + } + + public void addBackManagedFacetSet(final FacetSet facetSet) { + // adding an already managed FacetSet again moves it to the right position + this.managedFacetSets.remove(facetSet); + this.managedFacetSets.addLast(facetSet); + notifyListeners(); + } + + public void addFrontManagedFacetSet(final FacetSet facetSet) { + if (this.managedFacetSets == null) { + this.managedFacetSets = new LinkedList<FacetSet>(); + } + // adding an already managed FacetSet again moves it to the right position + this.managedFacetSets.remove(facetSet); + this.managedFacetSets.addFirst(facetSet); + notifyListeners(); + } + + /** + * Find the most specific feature in the candidates list. The most specific + * is the feature that : - is the most specific (in terms of Facet + * inheritance) : the lowest in the inheritance tree (per branch) - is + * encountered first. The order is given by the FacetManager context. + * + * @param candidates + * The list of candidates features. Can be empty. + * @return + */ + private static <T extends DerivedTypedElement> T findMostSpecificFeature( + final List<T> orderedCandidates) { + T result = null; + if (!orderedCandidates.isEmpty()) { + final Iterator<T> candidatesIt = orderedCandidates.iterator(); + result = candidatesIt.next(); + // We have the highest priority feature, we just have to check + // that there is no more specific one in the override chain (from + // top to bottom) + while (candidatesIt.hasNext()) { + final T candidate = candidatesIt.next(); + if (isOverridenBy(candidate, result)) { + result = candidate; + } + } + } + return result; + } + + /** + * Find matching candidates. + * + * @param eObject + * @param baseFeature + * @return A list of candidates, in the right order for conflict resolution + * @throws FacetManagerException + */ + private <T extends DerivedTypedElement> List<T> getOverrideCandidateFeatures( + final EObject eObject, final T baseFeature) + throws FacetManagerException { + final ResourceSet baserFeatureRS = baseFeature.eResource().getResourceSet(); + final List<T> result = new LinkedList<T>(); + // Iterate over all Facets from all facetSets to find conforming + // features + final List<FacetSet> managedFSets = getManagedFacetSets(); + final List<FacetSet> allFacetSets = new ArrayList<FacetSet>(managedFSets); + // add aggregated FacetSets + for (FacetSet facetSet : managedFSets) { + //FIXME Should handle recursive containment. + for (FacetSet subFacetSet : facetSet.getFacetSets()) { + final FacetSet resolvedFacetSet = IResolverManager.DEFAULT + .resolve(subFacetSet, FacetSet.class); + allFacetSets.add(resolvedFacetSet); + } + } + for (FacetSet facetSet : allFacetSets) { + final Resource resource = facetSet.eResource(); + if (resource == null) { + final String message = String.format( + "The facetSet %s (%s) is not stored in a resource.", //$NON-NLS-1$ + facetSet.getName(), facetSet.getNsURI()); + Logger.logWarning(message, Activator.getDefault()); + } else { + final ResourceSet facetSetRS = resource.getResourceSet(); + if (!facetSetRS.equals(baserFeatureRS)) { + Logger.logWarning( + "The facet manager is dealing with more than one resource set.", //$NON-NLS-1$ + Activator.getDefault()); + } + } + for (Facet facet : FacetUtils.getFacets(facetSet)) { + final T matchingFeature = getMatchingFeature(eObject, facet, + baseFeature); + if (matchingFeature != null) { + result.add(matchingFeature); + } + } + } + if (result.isEmpty()) { + if (!this.failingFeatures.contains(baseFeature) + && !FacetManagerContext.SILENT) { + Logger.logWarning( + "The result of " //$NON-NLS-1$ + + this.getClass().getSimpleName() + + ".getOverrideCandidateFeatures(...) is empty! baseFeature=" //$NON-NLS-1$ + + EcoreUtil.getURI(baseFeature) + + " (This message will be sent only once)", //$NON-NLS-1$ + Activator.getDefault()); + // This avoid to have to many error messages in the log. + this.failingFeatures.add(baseFeature); + } + result.add(baseFeature); + } + if (DEBUG) { + final StringBuffer message = new StringBuffer('\n'); + message.append('\n'); + for (T feature : result) { + message.append(" - "); //$NON-NLS-1$ + message.append(FacetUtils.toString(feature)); + message.append('\n'); + } + DebugUtils.debug(message.toString()); + } + return result; + } + + /** + * Test whether a feature is overridden by another (directly or not) + * + * @param targetParent + * @param child + * @return true if child is directly or indirectly overridden by parent, + * false otherwise + */ + private static boolean isOverridenBy(final DerivedTypedElement child, + final DerivedTypedElement targetParent) { + + boolean result = false; + if (child.equals(targetParent)) { + result = true; + } else { + DerivedTypedElement currentParent = child.getOverride(); + while (!result && currentParent != null) { + if (currentParent.equals(targetParent)) { + result = true; + } else { + currentParent = currentParent.getOverride(); + } + } + } + return result; + } + + /** + * Find DerivedTypedElement features that matches the 'signature' + * + * @param eObject + * EObject used to test conformance + * @param facet + * @param signatureFeature + * reference feature that serves as 'signature' + * @throws FacetManagerException + */ + private <T extends DerivedTypedElement> T getMatchingFeature( + final EObject eObject, final Facet facet, final T signatureFeature) + throws FacetManagerException { + T result = null; + EList<? extends ETypedElement> eTypedElements; + if (signatureFeature instanceof EOperation) { + eTypedElements = facet.getFacetOperations(); + } else { + eTypedElements = facet.getFacetElements(); + } + // For each eTypedElement check is it override the signature feature and + // if the eTypedElement is owned by a facet to which the eObject + // conforms. + for (ETypedElement feature : eTypedElements) { + if (isMatchingFeature2(signatureFeature, feature)) { + // The conformance check is done after the check on the override + // to avoid infinite recursion. + final ConformanceState conformanceState = this.manager + .getConformanceState(eObject, facet); + if (conformanceState == ConformanceState.Conformant) { + if (!signatureFeature.getClass().isInstance(feature)) { + throw new FacetManagerException( + ModelUtils.getQualifiedName(feature) + + " overrides " //$NON-NLS-1$ + + ModelUtils + .getQualifiedName(signatureFeature) + + " but both are not of the same kind."); //$NON-NLS-1$ + } + @SuppressWarnings("unchecked") + // @SuppressWarnings("unchecked") check by + // "if (!signatureFeature.getClass().isInstance(feature))" + final T tmpFeature = (T) feature; + result = tmpFeature; + break; + // Two features from the same Facet cannot + // override a feature, so only one can be find + // in this Facet => stop search here. + } + } + } + return result; + } + + private static <T extends DerivedTypedElement> boolean isMatchingFeature2( + final T signatureFeature, final ETypedElement feature) + throws FacetManagerException { + boolean result = false; + // We're focusing on DerivedTypedElements + // ECore native features could not be overridden by Facets + // (EMF facet is supposed to be non intrusive) + + if (signatureFeature.getClass().isInstance(feature)) { + final T element = (T) feature; + // Just check that the top override is the same as the base feature + // i.e. that the current feature matches the 'signature' + final DerivedTypedElement topFeature = FacetUtils + .getTopOverrideFeature(element); + if (topFeature == signatureFeature) { + // found a match + result = true; + } else { + final Resource topResource = topFeature.eResource(); + final Resource signatureResource = signatureFeature.eResource(); + if (topResource == null || signatureResource == null || topFeature.eResource().getResourceSet() != signatureFeature.eResource().getResourceSet()) { + Logger.logWarning( + "topOverrideFeature.eResource().getResourceSet() != signatureFeature.eResource().getResourceSet()", //$NON-NLS-1$ + Activator.getDefault()); + } + } + } + return result; + } + + public void removeFacetSet(final FacetSet facetSet) { + final boolean removed = this.managedFacetSets.remove(facetSet); + if (removed) { + notifyListeners(); + } + } + + public void clear() { + final boolean empty = this.managedFacetSets.isEmpty(); + if (!empty) { + this.managedFacetSets.clear(); + notifyListeners(); + } + } + + public int size() { + return this.managedFacetSets.size(); + } + + public boolean isEmpty() { + return this.managedFacetSets.isEmpty(); + } + + public boolean contains(final Object object) { + return this.managedFacetSets.contains(object); + } + + public Iterator<FacetSet> iterator() { + return new ArrayList<FacetSet>(this.managedFacetSets).iterator(); + } + + public Object[] toArray() { + return this.managedFacetSets.toArray(); + } + + public <T> T[] toArray(final T[] array) { + return this.managedFacetSets.toArray(array); + } + + public boolean add(final FacetSet object) { + boolean result = false; + this.managedFacetSets.remove(object); + if (object != null) { + result = this.managedFacetSets.add(object); + } + if (result) { + notifyListeners(); + } + return result; + } + + public boolean remove(final Object object) { + final boolean isRemoved = this.managedFacetSets.remove(object); + if (isRemoved) { + notifyListeners(); + } + return isRemoved; + } + + public boolean containsAll(final Collection<?> collection) { + return this.managedFacetSets.containsAll(collection); + } + + public boolean addAll(final Collection<? extends FacetSet> collection) { + boolean result = false; + for (FacetSet facetSet : collection) { + this.managedFacetSets.remove(facetSet); + if (facetSet != null) { + final boolean addResult = this.managedFacetSets.add(facetSet); + result = result || addResult; + } + } + if (result) { + notifyListeners(); + } + return result; + } + + public boolean addAll(final int index, + final Collection<? extends FacetSet> collection) { + final List<FacetSet> filtered = new ArrayList<FacetSet>(); + for (FacetSet facetSet : collection) { + if (!filtered.contains(facetSet)) { + filtered.add(facetSet); + } + } + this.managedFacetSets.removeAll(filtered); + final boolean isAdded = this.managedFacetSets.addAll(index, + ListUtils.cleanList(filtered)); + if (isAdded) { + notifyListeners(); + } + return isAdded; + } + + public boolean removeAll(final Collection<?> collection) { + final boolean isRemoved = this.managedFacetSets.removeAll(collection); + if (isRemoved) { + notifyListeners(); + } + return isRemoved; + } + + public boolean retainAll(final Collection<?> collection) { + final boolean isRetained = this.managedFacetSets.retainAll(collection); + if (isRetained) { + notifyListeners(); + } + return isRetained; + } + + public FacetSet get(final int index) { + return this.managedFacetSets.get(index); + } + + public FacetSet set(final int index, final FacetSet element) { + final FacetSet oldElement = this.managedFacetSets.set(index, element); + if (!oldElement.equals(element)) { + notifyListeners(); + } + return oldElement; + } + + public void add(final int index, final FacetSet element) { + this.managedFacetSets.remove(element); + if (element != null) { + this.managedFacetSets.add(index, element); + notifyListeners(); + } + } + + public FacetSet remove(final int index) { + final FacetSet oldElement = this.managedFacetSets.remove(index); + notifyListeners(); + return oldElement; + } + + public int indexOf(final Object object) { + return this.managedFacetSets.indexOf(object); + } + + public int lastIndexOf(final Object object) { + return this.managedFacetSets.lastIndexOf(object); + } + + public ListIterator<FacetSet> listIterator() { + return this.managedFacetSets.listIterator(); + } + + public ListIterator<FacetSet> listIterator(final int index) { + return this.managedFacetSets.listIterator(index); + } + + public List<FacetSet> subList(final int fromIndex, final int toIndex) { + return this.managedFacetSets.subList(fromIndex, toIndex); + } + + public void addListener(final IFacetManagerListener listener) { + this.listeners.add(listener); + } + + public void removeListener(final IFacetManagerListener listener) { + this.listeners.remove(listener); + } + + private void notifyListeners() { + final IFacetManagerListener[] listenersCopy = this.listeners + .toArray(new IFacetManagerListener[this.listeners.size()]); + for (IFacetManagerListener listener : listenersCopy) { + listener.facetManagerChanged(); + } + } +}
diff --git a/org.eclipse.modisco.facet.efacet.core/src/org/eclipse/modisco/facet/efacet/core/internal/FacetManagerFactory.java b/org.eclipse.modisco.facet.efacet.core/src/org/eclipse/modisco/facet/efacet/core/internal/FacetManagerFactory.java new file mode 100644 index 0000000..523da5a --- /dev/null +++ b/org.eclipse.modisco.facet.efacet.core/src/org/eclipse/modisco/facet/efacet/core/internal/FacetManagerFactory.java
@@ -0,0 +1,85 @@ +/** + * Copyright (c) 2011 Mia-Software. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Emmanuelle Rouillé (Mia-Software) - Bug 352618 - To be able to use non derived facet structural features and save them values. + * Nicolas Bros (Mia-Software) - Bug 361612 - New core for new version of the Facet metamodel + * Gregoire Dupe (Mia-Software) - Bug 361794 - [Restructuring] New customization meta-model + * Gregoire Dupe (Mia-Software) - Bug 373078 - API Cleaning + * Thomas Cicognani (Soft-Maint) - Bug 416223 - IFacetManagerFactory.getOrCreateFacetManager should not create an instance per call + * Thomas Cicognani (Soft-Maint) - Bug 463658 - Impossibility to just create a FacetManager + */ +package org.eclipse.modisco.facet.efacet.core.internal; + +import org.eclipse.emf.common.notify.Adapter; +import org.eclipse.emf.ecore.resource.Resource; +import org.eclipse.emf.ecore.resource.ResourceSet; +import org.eclipse.modisco.facet.efacet.core.IFacetManager; +import org.eclipse.modisco.facet.efacet.core.IFacetManagerFactory; + +public class FacetManagerFactory implements IFacetManagerFactory { + + /** + * @deprecated Use + * {@link #getOrCreateDefaultFacetManagerWithSerializationResource(Resource)} + * instead. The new method name is more understandable + */ + @Deprecated + public IFacetManager getOrCreateFacetManager(final Resource resource) { + return getOrCreateDefaultFacetManagerWithSerializationResource(resource); + } + + /** + * @deprecated Use {@link #getOrCreateDefaultFacetManager(ResourceSet)} + * instead. The new method name is more understandable + */ + @Deprecated + public IFacetManager getOrCreateFacetManager(final ResourceSet resourceSet) { + return getOrCreateDefaultFacetManager(resourceSet); + } + + public IFacetManager getOrCreateDefaultFacetManagerWithSerializationResource( + final Resource resource) { + FacetManager result = null; + for (Adapter adapter : resource.eAdapters()) { + if (adapter instanceof FacetManager) { + result = (FacetManager) adapter; + } + } + if (result == null) { + result = new FacetManager(resource); + resource.eAdapters().add(result); + } + return result; + } + + public IFacetManager getOrCreateDefaultFacetManager( + final ResourceSet resourceSet) { + FacetManager result = null; + for (Adapter adapter : resourceSet.eAdapters()) { + if (adapter instanceof FacetManager) { + result = (FacetManager) adapter; + } + } + if (result == null) { + result = new FacetManager(resourceSet); + resourceSet.eAdapters().add(result); + } + return result; + } + + public IFacetManager createFacetManagerWithSerializationResource( + final Resource resource) { + return new FacetManager(resource); + } + + public IFacetManager createFacetManager(final ResourceSet resourceSet) { + return new FacetManager(resourceSet); + } + +}
diff --git a/org.eclipse.modisco.facet.efacet.core/src/org/eclipse/modisco/facet/efacet/core/internal/FacetManagerInternalUtils.java b/org.eclipse.modisco.facet.efacet.core/src/org/eclipse/modisco/facet/efacet/core/internal/FacetManagerInternalUtils.java new file mode 100644 index 0000000..bed68d0 --- /dev/null +++ b/org.eclipse.modisco.facet.efacet.core/src/org/eclipse/modisco/facet/efacet/core/internal/FacetManagerInternalUtils.java
@@ -0,0 +1,33 @@ +/******************************************************************************* + * Copyright (c) 2015 Soft-Maint. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Jonathan Pepin (Soft-Maint) - Bug 473673 - Applying facet inferred from fopposite reference + *******************************************************************************/ + +package org.eclipse.modisco.facet.efacet.core.internal; + +import org.eclipse.emf.ecore.EStructuralFeature; +import org.eclipse.modisco.facet.efacet.core.FacetUtils; +import org.eclipse.modisco.facet.efacet.core.IFacetManager; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.FacetSet; + +public final class FacetManagerInternalUtils { + + private FacetManagerInternalUtils() { + // Must not be used + } + + public static void loadParentFacetSet(final EStructuralFeature sFeature, + final IFacetManager facetManager) { + final FacetSet facetSet = FacetUtils.getFacetSet(sFeature); + if (!facetManager.getManagedFacetSets().contains(facetSet)) { + facetManager.getManagedFacetSets().add(facetSet); + } + } + +}
diff --git a/org.eclipse.modisco.facet.efacet.core/src/org/eclipse/modisco/facet/efacet/core/internal/Messages.java b/org.eclipse.modisco.facet.efacet.core/src/org/eclipse/modisco/facet/efacet/core/internal/Messages.java new file mode 100644 index 0000000..121a351 --- /dev/null +++ b/org.eclipse.modisco.facet.efacet.core/src/org/eclipse/modisco/facet/efacet/core/internal/Messages.java
@@ -0,0 +1,28 @@ +/** + * Copyright (c) 2011 Mia-Software. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Gregoire Dupe (Mia-Software) - Bug 333553 - The user has not to deal with two files to create a facet + */ +package org.eclipse.modisco.facet.efacet.core.internal; + +import org.eclipse.osgi.util.NLS; + +@SuppressWarnings("PMD") +public final class Messages extends NLS { + private static final String BUNDLE_NAME = "org.eclipse.emf.facet.efacet.core.internal.messages"; //$NON-NLS-1$ + public static String EFacetCatalogManager_FacetSetCatalogName; + public static String EFacetCatalogManager_QuerySetCatalogName; + static { + // initialize resource bundle + NLS.initializeMessages(Messages.BUNDLE_NAME, Messages.class); + } + + private Messages() { + } +}
diff --git a/org.eclipse.modisco.facet.efacet.core/src/org/eclipse/modisco/facet/efacet/core/internal/ResolverManager.java b/org.eclipse.modisco.facet.efacet.core/src/org/eclipse/modisco/facet/efacet/core/internal/ResolverManager.java new file mode 100644 index 0000000..8b29b26 --- /dev/null +++ b/org.eclipse.modisco.facet.efacet.core/src/org/eclipse/modisco/facet/efacet/core/internal/ResolverManager.java
@@ -0,0 +1,113 @@ +/** + * Copyright (c) 2012 CEA LIST. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Gregoire Dupe (Mia-Software) - Bug 375087 - [Table] ITableWidget.addColumn(List<ETypedElement>, List<FacetSet>) + * Gregoire Dupe (Mia-Software) - Bug 372626 - Aggregates + */ +package org.eclipse.modisco.facet.efacet.core.internal; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; + +import org.eclipse.core.runtime.CoreException; +import org.eclipse.core.runtime.IConfigurationElement; +import org.eclipse.core.runtime.Platform; +import org.eclipse.modisco.facet.efacet.core.internal.exported.IResolver; +import org.eclipse.modisco.facet.efacet.core.internal.exported.IResolverManager; +import org.eclipse.modisco.facet.util.core.Logger; + +public class ResolverManager implements IResolverManager { + + private static final String ATT_NAME = "class"; //$NON-NLS-1$ + private static final String EXT_POINT_ID = "org.eclipse.emf.facet.efacet.core.internal.resolver"; //$NON-NLS-1$ + private final List<IResolver> resolvers = new ArrayList<IResolver>(); + + public ResolverManager() { + final IConfigurationElement[] configs = Platform.getExtensionRegistry() + .getConfigurationElementsFor(ResolverManager.EXT_POINT_ID); + for (IConfigurationElement config : configs) { + try { + final Object object = config + .createExecutableExtension(ResolverManager.ATT_NAME); + if (object instanceof IResolver) { + final IResolver resolver = (IResolver) object; + this.resolvers.add(resolver); + } + } catch (CoreException e) { + Logger.logError(e, Activator.getDefault()); + } + + } + } + + public <T> T resolve(final Object object, final Class<T> aClass) { + T result = null; + for (IResolver resolver : this.resolvers) { + if (resolver.canHandle(object)) { + try { + result = resolver.resolve(object, aClass); + } catch (ClassCastException e) { + Logger.logWarning(e, Activator.getDefault()); + // Nothing to: we will try with an other resolver or return + // null + } + if (result != null) { + break; + } + } + } + return result; + } + + public <T> List<T> selectionPropagation(final Object selectedObject, + final Class<T> aClass) { + @SuppressWarnings("unchecked") + // @SuppressWarnings("unchecked") The untyped list is an definitely + // empty list. + List<T> result = Collections.EMPTY_LIST; + for (IResolver resolver : this.resolvers) { + if (resolver.canHandle(selectedObject)) { + try { + result = resolver.selectionPropagation(selectedObject, + aClass); + } catch (ClassCastException e) { + Logger.logWarning(e, Activator.getDefault()); + // Nothing to: we will try with an other resolver or return + // null + } + if (result != null) { + break; + } + } + } + return result; + } + + public <T> T selectionRoot(final Object selectedObject, + final Class<T> aClass) { + T result = null; + for (IResolver resolver : this.resolvers) { + if (resolver.canHandle(selectedObject)) { + try { + result = resolver.selectionRoot(selectedObject, + aClass); + } catch (ClassCastException e) { + Logger.logWarning(e, Activator.getDefault()); + // Nothing to: we will try with an other resolver or return + // null + } + if (result != null) { + break; + } + } + } + return result; + } + +}
diff --git a/org.eclipse.modisco.facet.efacet.core/src/org/eclipse/modisco/facet/efacet/core/internal/catalog/EFacetCatalogManager2.java b/org.eclipse.modisco.facet.efacet.core/src/org/eclipse/modisco/facet/efacet/core/internal/catalog/EFacetCatalogManager2.java new file mode 100644 index 0000000..9d6c7d8 --- /dev/null +++ b/org.eclipse.modisco.facet.efacet.core/src/org/eclipse/modisco/facet/efacet/core/internal/catalog/EFacetCatalogManager2.java
@@ -0,0 +1,71 @@ +/******************************************************************************* + * Copyright (c) 2011, 2016 Mia-Software + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Grégoire Dupé (Mia-Software) - Bug 333553 - The user has not to deal with two files to create a facet + * Nicolas Guyomar (Mia-Software) - Bug 333553 - The user has not to deal with two files to create a facet + * Emmanuelle Rouillé (Mia-Software) - Bug 352618 - To be able to use non derived facet structural features and save them values. + * Nicolas Bros (Mia-Software) - Bug 361612 - New core for new version of the Facet metamodel + * Nicolas Bros (Mia-Software) - Bug 361817 - [Restructuring] Dynamic load to the facet catalog + * Nicolas Bros (Mia-Software) - Bug 370110 - Rename efacetcatalog2.ecore + * Grégoire Dupé (Mia-Software) - Bug 369987 - [Restructuring][Table] Switch to the new customization and facet framework + * Grégoire Dupé (Mia-Software) - Bug 373078 - API Cleaning + * Grégoire Dupé (Mia-Software) - Bug 477657 - The catalog manager should be able to manage workspace model + * Grégoire Dupé (Mia-Software) - Bug 482887 - CatalogManager create files with too long name + *******************************************************************************/ +package org.eclipse.modisco.facet.efacet.core.internal.catalog; + +import java.util.Collections; +import java.util.List; + +import org.eclipse.emf.common.util.BasicEList; +import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.ecore.resource.ResourceSet; +import org.eclipse.modisco.facet.efacet.core.IFacetSetCatalogManager; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.FacetSet; +import org.eclipse.modisco.facet.util.emf.core.catalog.ICatalogManager; +import org.eclipse.modisco.facet.util.emf.core.catalog.ICatalogManagerConfiguration; +import org.eclipse.modisco.facet.util.emf.core.catalog.ICatalogManagerFactory; + +public class EFacetCatalogManager2 implements IFacetSetCatalogManager { + + private final ICatalogManager catalogMgr; + + public EFacetCatalogManager2(final ResourceSet resourceSet) { + final ICatalogManagerConfiguration catalogMgrConfig = + new CatalogManagerConfiguration(); + this.catalogMgr = ICatalogManagerFactory.DEFAULT.getOrCreateCatalogManager( + catalogMgrConfig, resourceSet, this.getClass().getName()); + } + + public List<FacetSet> getRegisteredFacetSets() { + final BasicEList<FacetSet> result = new BasicEList<FacetSet>(); + for (EObject eObject : this.catalogMgr.getEntries(EObject.class)) { + if (eObject instanceof FacetSet) { + final FacetSet facetSet = (FacetSet) eObject; + result.add(facetSet); + } + } + return Collections.unmodifiableList(result); + } + + public void registerFacetSet(final FacetSet facetSet) { + this.catalogMgr.addWsEntry(facetSet); + } + + class CatalogManagerConfiguration implements ICatalogManagerConfiguration { + + public boolean canBeManaged(final EObject root) { + return root instanceof FacetSet; + } + + public boolean isValid(final EObject root) { + return true; + } + + } +}
diff --git a/org.eclipse.modisco.facet.efacet.core/src/org/eclipse/modisco/facet/efacet/core/internal/exception/DerivedTypedElementEvaluationException.java b/org.eclipse.modisco.facet.efacet.core/src/org/eclipse/modisco/facet/efacet/core/internal/exception/DerivedTypedElementEvaluationException.java new file mode 100644 index 0000000..48ca8c6 --- /dev/null +++ b/org.eclipse.modisco.facet.efacet.core/src/org/eclipse/modisco/facet/efacet/core/internal/exception/DerivedTypedElementEvaluationException.java
@@ -0,0 +1,44 @@ +/** + * Copyright (c) 2009 Mia-Software. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Gregoire Dupe (Mia-Software) - initial API and implementation + * Nicolas Bros (Mia-Software) - Bug 362191 - [Restructuring] Query mechanism for eFacet2 + */ +package org.eclipse.modisco.facet.efacet.core.internal.exception; + +import org.eclipse.modisco.facet.efacet.core.exception.DerivedTypedElementException; +import org.eclipse.modisco.facet.util.core.internal.ErrorHandlingUtils; + +/** + * This exception occurs when something goes wrong during the execution of a query. + * + * @since 0.2 + */ +public class DerivedTypedElementEvaluationException extends DerivedTypedElementException { + // This class is a copy of + // org.eclipse.emf.facet.infra.query.core.ModelQueryExecutionException + + private static final long serialVersionUID = -8464252257666617685L; + + public DerivedTypedElementEvaluationException(final String message) { + super(message); + } + + public DerivedTypedElementEvaluationException(final String message, final Throwable cause) { + super(message, cause); + } + + public DerivedTypedElementEvaluationException(final Throwable cause) { + super(cause); + } + + /** Constructor for evaluation exception due to wrong type */ + public DerivedTypedElementEvaluationException(final String message, final Class<?> expectedType, final Object resultElement) { + super(ErrorHandlingUtils.buildWrongTypeMessage(message, expectedType, resultElement)); + } +}
diff --git a/org.eclipse.modisco.facet.efacet.core/src/org/eclipse/modisco/facet/efacet/core/internal/exception/DerivedTypedElementTypeCheckingException.java b/org.eclipse.modisco.facet.efacet.core/src/org/eclipse/modisco/facet/efacet/core/internal/exception/DerivedTypedElementTypeCheckingException.java new file mode 100644 index 0000000..a2c63f4 --- /dev/null +++ b/org.eclipse.modisco.facet.efacet.core/src/org/eclipse/modisco/facet/efacet/core/internal/exception/DerivedTypedElementTypeCheckingException.java
@@ -0,0 +1,37 @@ +/** + * Copyright (c) 2009 Mia-Software. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Gregoire Dupe (Mia-Software) - initial API and implementation + * Nicolas Bros (Mia-Software) - Bug 362191 - [Restructuring] Query mechanism for eFacet2 + */ +package org.eclipse.modisco.facet.efacet.core.internal.exception; + +import org.eclipse.modisco.facet.efacet.core.exception.DerivedTypedElementException; + +/** + * This exception occurs when the type of the result of evaluating a derived typed element is not + * the one that was expected + * + * @since 0.2 + */ +public class DerivedTypedElementTypeCheckingException extends DerivedTypedElementException { + + private static final long serialVersionUID = -9064274334817642819L; + + public DerivedTypedElementTypeCheckingException(final String message) { + super(message); + } + + public DerivedTypedElementTypeCheckingException(final String message, final Throwable cause) { + super(message, cause); + } + + public DerivedTypedElementTypeCheckingException(final Throwable cause) { + super(cause); + } +}
diff --git a/org.eclipse.modisco.facet.efacet.core/src/org/eclipse/modisco/facet/efacet/core/internal/exception/FacetConformanceEvaluationException.java b/org.eclipse.modisco.facet.efacet.core/src/org/eclipse/modisco/facet/efacet/core/internal/exception/FacetConformanceEvaluationException.java new file mode 100644 index 0000000..f2b72b2 --- /dev/null +++ b/org.eclipse.modisco.facet.efacet.core/src/org/eclipse/modisco/facet/efacet/core/internal/exception/FacetConformanceEvaluationException.java
@@ -0,0 +1,32 @@ +/******************************************************************************* + * Copyright (c) 2011 Mia-Software + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Nicolas Bros (Mia-Software) - Bug 361612 - New core for new version of the Facet metamodel + *******************************************************************************/ +package org.eclipse.modisco.facet.efacet.core.internal.exception; + +/** + * Happens when there is an error evaluating a Facet's conformance typed element. + * + * @since 0.2 + */ +public class FacetConformanceEvaluationException extends Exception { + private static final long serialVersionUID = -5306430483154103388L; + + public FacetConformanceEvaluationException(final String message) { + super(message); + } + + public FacetConformanceEvaluationException(final String message, final Throwable cause) { + super(message, cause); + } + + public FacetConformanceEvaluationException(final Throwable cause) { + super(cause); + } +}
diff --git a/org.eclipse.modisco.facet.efacet.core/src/org/eclipse/modisco/facet/efacet/core/internal/exception/NonApplicableFacetException.java b/org.eclipse.modisco.facet.efacet.core/src/org/eclipse/modisco/facet/efacet/core/internal/exception/NonApplicableFacetException.java new file mode 100644 index 0000000..f642d26 --- /dev/null +++ b/org.eclipse.modisco.facet.efacet.core/src/org/eclipse/modisco/facet/efacet/core/internal/exception/NonApplicableFacetException.java
@@ -0,0 +1,21 @@ +/******************************************************************************* + * Copyright (c) 2012 Mia-Software + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Nicolas Bros (Mia-Software) - Bug 361612 - New core for new version of the Facet metamodel + *******************************************************************************/ +package org.eclipse.modisco.facet.efacet.core.internal.exception; + +/** + * This exception is raised when an object cannot be extended by a facet because the class of the object does not correspond + * to the extended metaclass of the facet. + * @since 0.2 + */ +public class NonApplicableFacetException extends Exception { + + private static final long serialVersionUID = 2984069177830836577L; +}
diff --git a/org.eclipse.modisco.facet.efacet.core/src/org/eclipse/modisco/facet/efacet/core/internal/exception/NonConformingEObjectException.java b/org.eclipse.modisco.facet.efacet.core/src/org/eclipse/modisco/facet/efacet/core/internal/exception/NonConformingEObjectException.java new file mode 100644 index 0000000..1e17ecc --- /dev/null +++ b/org.eclipse.modisco.facet.efacet.core/src/org/eclipse/modisco/facet/efacet/core/internal/exception/NonConformingEObjectException.java
@@ -0,0 +1,21 @@ +/******************************************************************************* + * Copyright (c) 2012 Mia-Software + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Nicolas Bros (Mia-Software) - Bug 361612 - New core for new version of the Facet metamodel + *******************************************************************************/ +package org.eclipse.modisco.facet.efacet.core.internal.exception; + +/** + * This exception is raised when an object cannot be extended by a facet because it is filtered by the conformance query + * of this facet. + * @since 0.2 + */ +public class NonConformingEObjectException extends Exception { + + private static final long serialVersionUID = -7778081627619345385L; +}
diff --git a/org.eclipse.modisco.facet.efacet.core/src/org/eclipse/modisco/facet/efacet/core/internal/exception/SaveStructuralFeatureInstanceModelException.java b/org.eclipse.modisco.facet.efacet.core/src/org/eclipse/modisco/facet/efacet/core/internal/exception/SaveStructuralFeatureInstanceModelException.java new file mode 100644 index 0000000..8aece1a --- /dev/null +++ b/org.eclipse.modisco.facet.efacet.core/src/org/eclipse/modisco/facet/efacet/core/internal/exception/SaveStructuralFeatureInstanceModelException.java
@@ -0,0 +1,40 @@ +/** + * Copyright (c) 2011 Mia-Software. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Emmanuelle Rouillé (Mia-Software) - Bug 352618 - To be able to use non derived facet structural features and save them values. + */ +package org.eclipse.modisco.facet.efacet.core.internal.exception; + +import org.eclipse.modisco.facet.efacet.core.exception.FacetManagerException; + +/** + * This exception is raised when an IOException is caught when trying to save a structural feature instance model + * @since 0.2 + */ +public class SaveStructuralFeatureInstanceModelException extends + FacetManagerException { + + private static final long serialVersionUID = 7024009106572531846L; + + /** + * Creates a new instance of UnmatchingExpectedTypeException + * with {@link Throwable} the exception at the origin of this exception + */ + public SaveStructuralFeatureInstanceModelException(final Throwable cause) { + super(cause); + } + + /** + * Creates a new instance of UnmatchingExpectedTypeException + * with {@link Throwable} the exception at the origin of this exception + */ + public SaveStructuralFeatureInstanceModelException(final String message) { + super(message); + } +}
diff --git a/org.eclipse.modisco.facet.efacet.core/src/org/eclipse/modisco/facet/efacet/core/internal/exception/UnmatchingExpectedTypeException.java b/org.eclipse.modisco.facet.efacet.core/src/org/eclipse/modisco/facet/efacet/core/internal/exception/UnmatchingExpectedTypeException.java new file mode 100644 index 0000000..ee3159c --- /dev/null +++ b/org.eclipse.modisco.facet.efacet.core/src/org/eclipse/modisco/facet/efacet/core/internal/exception/UnmatchingExpectedTypeException.java
@@ -0,0 +1,45 @@ +/******************************************************************************* + * Copyright (c) 2011 Mia-Software + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Emmanuelle Rouillé (Mia-Software) - Bug 352618 - To be able to use non derived facet structural features and save them values. + * Nicolas Bros (Mia-Software) - Bug 361612 - New core for new version of the Facet metamodel + *******************************************************************************/ +package org.eclipse.modisco.facet.efacet.core.internal.exception; + +import org.eclipse.modisco.facet.efacet.core.exception.FacetManagerException; +import org.eclipse.modisco.facet.util.core.internal.ErrorHandlingUtils; + +/** + * This exception is raised when a value's type does not match with the expected type + * + * @since 0.2 + */ +public class UnmatchingExpectedTypeException extends FacetManagerException { + + private static final long serialVersionUID = 1456802297756942271L; + + public UnmatchingExpectedTypeException() { + super(); + } + + public UnmatchingExpectedTypeException(final String message) { + super(message); + } + + public UnmatchingExpectedTypeException(final String message, final Throwable cause) { + super(message, cause); + } + + public UnmatchingExpectedTypeException(final Throwable cause) { + super(cause); + } + + public UnmatchingExpectedTypeException(final String message, final Class<?> expectedType, final Object resultElement) { + super(ErrorHandlingUtils.buildWrongTypeMessage(message, expectedType, resultElement)); + } +}
diff --git a/org.eclipse.modisco.facet.efacet.core/src/org/eclipse/modisco/facet/efacet/core/internal/exported/IResolver.java b/org.eclipse.modisco.facet.efacet.core/src/org/eclipse/modisco/facet/efacet/core/internal/exported/IResolver.java new file mode 100644 index 0000000..6a0754a --- /dev/null +++ b/org.eclipse.modisco.facet.efacet.core/src/org/eclipse/modisco/facet/efacet/core/internal/exported/IResolver.java
@@ -0,0 +1,61 @@ +/** + * Copyright (c) 2012 CEA LIST. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Gregoire Dupe (Mia-Software) - Bug 375087 - [Table] ITableWidget.addColumn(List<ETypedElement>, List<FacetSet>) + * Gregoire Dupe (Mia-Software) - Bug 372626 - Aggregates + */ +package org.eclipse.modisco.facet.efacet.core.internal.exported; + +import java.util.List; + +/** + * The interface has to be implemented to contribute to the extension point + * 'org.eclipse.emf.facet.efacet.core.internal.resolver'. + */ +public interface IResolver { + + /** + * Return true is the parameter object can be handle by the implementation + * of this interface. + * + * @param object + * @return + */ + boolean canHandle(Object object); + + /** + * If the parameter 'object' is a proxy, this method returns the + * corresponding a resolved object. + * + * @param object + * a proxy + * @param aClass + * the expected resolved object + */ + <T> T resolve(Object object, Class<T> aClass); + + /** + * This method returns the objects that have to be automatically selected + * when the parameter 'selectedObject' is selected. + * + * @param selectedObject + * @param aClass + * the expected list elements type. + */ + <T> List<T> selectionPropagation(Object selectedObject, Class<T> aClass); + + /** + * This method returns the root of the objects that have to be automatically + * selected when the parameter 'selectedObject' is selected. + * + * @param selectedObject + * @param aClass + * the expected list elements type. + */ + <T> T selectionRoot(Object selectedObject, Class<T> aClass); +}
diff --git a/org.eclipse.modisco.facet.efacet.core/src/org/eclipse/modisco/facet/efacet/core/internal/exported/IResolverManager.java b/org.eclipse.modisco.facet.efacet.core/src/org/eclipse/modisco/facet/efacet/core/internal/exported/IResolverManager.java new file mode 100644 index 0000000..9ff2e73 --- /dev/null +++ b/org.eclipse.modisco.facet.efacet.core/src/org/eclipse/modisco/facet/efacet/core/internal/exported/IResolverManager.java
@@ -0,0 +1,28 @@ +/** + * Copyright (c) 2012 CEA LIST. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Gregoire Dupe (Mia-Software) - Bug 375087 - [Table] ITableWidget.addColumn(List<ETypedElement>, List<FacetSet>) + * Gregoire Dupe (Mia-Software) - Bug 372626 - Aggregates + */ +package org.eclipse.modisco.facet.efacet.core.internal.exported; + +import java.util.List; + +import org.eclipse.modisco.facet.efacet.core.internal.ResolverManager; + +public interface IResolverManager { + + IResolverManager DEFAULT = new ResolverManager(); + + <T> T resolve(Object object, Class<T> aClass); + + <T> List<T> selectionPropagation(Object selectedObject, Class<T> aClass); + + <T> T selectionRoot(Object selectedObject, Class<T> aClass); + +}
diff --git a/org.eclipse.modisco.facet.efacet.core/src/org/eclipse/modisco/facet/efacet/core/internal/incubatingapi/IFacetActions2.java b/org.eclipse.modisco.facet.efacet.core/src/org/eclipse/modisco/facet/efacet/core/internal/incubatingapi/IFacetActions2.java new file mode 100644 index 0000000..f4717a5 --- /dev/null +++ b/org.eclipse.modisco.facet.efacet.core/src/org/eclipse/modisco/facet/efacet/core/internal/incubatingapi/IFacetActions2.java
@@ -0,0 +1,208 @@ +/** + * Copyright (c) 2011 Mia-Software. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Nicolas Guyomar (Mia-Software) - Bug 338813 - [EMF Facet Framework] basic Facet actions + * Nicolas Bros (Mia-Software) - Bug 361612 - New core for new version of the Facet metamodel + * Gregoire Dupe (Mia-Software) - Bug 373078 - API Cleaning + */ +package org.eclipse.modisco.facet.efacet.core.internal.incubatingapi; + +import java.io.IOException; + +import org.eclipse.core.resources.IFile; +import org.eclipse.emf.common.command.Command; +import org.eclipse.emf.ecore.EOperation; +import org.eclipse.emf.ecore.EParameter; +import org.eclipse.emf.edit.domain.EditingDomain; +import org.eclipse.modisco.facet.efacet.core.internal.FacetActions2Impl; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.Facet; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.FacetAttribute; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.FacetOperation; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.FacetReference; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.FacetSet; +import org.eclipse.modisco.facet.util.emf.core.exception.InvalidFacetSetException; + +/** + * This interface contains methods to create {@link Facet}s. + * + * @since 0.2 + */ +public interface IFacetActions2 { + + IFacetActions2 INSTANCE = new FacetActions2Impl(); + + /** + * Add the given facetSet to the given facetSet model file, which will be created + * + * @param facetSet + * the facetSet to be created. Cannot be <code>null</code> + * @param project + * the new file in which the facetSet has to be created. Cannot be <code>null</code>, + * and cannot already exist + */ + void saveFacetSet(FacetSet facetSet, IFile file) throws IOException, + InvalidFacetSetException; + + /** + * Add the given {@link Facet} to the given {@link FacetSet} + * + * @param facetSet + * the parent facetSet, cannot be null + * @param facet + * the {@link Facet}, cannot be null, or contained by a resource + * @param editingDomain + * the editing domain needed to perform the Add EMF command, cannot be null + */ + Facet createFacetInFacetSet(FacetSet facetSet, Facet facet, + EditingDomain editingDomain); + + /** + * Create a command to add the given {@link Facet} to the given {@link FacetSet} + * + * @param facetSet + * the parent facetSet, cannot be null + * @param facet + * the {@link Facet}, cannot be null, or contained by a resource + * @param editingDomain + * the editing domain needed to perform the Add EMF command, cannot be null + */ + Command createCreateFacetInFacetSetCommand(FacetSet facetSet, Facet facet, + EditingDomain editingDomain); + + /** + * Add the given {@link FacetAttribute} to the given {@link Facet} + * + * @param facet + * the parent {@link Facet}, cannot be null + * @param facetAttribute + * the {@link FacetAttribute}, cannot be null, or contained by a resource + * @param editingDomain + * the editing domain needed to perform the Add Emf command, cannot be null + */ + void addAttributeInFacet(Facet facet, FacetAttribute facetAttribute, + EditingDomain editingDomain); + + /** + * Create a command to add the given {@link FacetAttribute} to the given {@link Facet} + * + * @param facet + * the parent {@link Facet}, cannot be null + * @param facetAttribute + * the {@link FacetAttribute}, cannot be null, or contained by a resource + * @param editingDomain + * the editing domain needed to perform the Add Emf command, cannot be null + */ + Command createAddAttributeInFacetCommand(Facet facet, FacetAttribute facetAttribute, + EditingDomain editingDomain); + + /** + * Add the given {@link FacetReference} to the given {@link Facet} + * + * @param facet + * the parent {@link Facet}, cannot be null + * @param facetReference + * the {@link FacetReference}, cannot be null, or contained by a resource + * @param editingDomain + * the editing domain needed to perform the Add Emf command, cannot be null + */ + void addReferenceInFacet(Facet facet, FacetReference facetReference, + EditingDomain editingDomain); + + /** + * Create a command to add the given {@link FacetReference} to the given {@link Facet} + * + * @param facet + * the parent {@link Facet}, cannot be null + * @param facetReference + * the {@link FacetReference}, cannot be null, or contained by a resource + * @param editingDomain + * the editing domain needed to perform the Add Emf command, cannot be null + */ + Command createAddReferenceInFacetCommand(Facet facet, + FacetReference facetReference, EditingDomain editingDomain); + + /** + * Add a new {@link FacetOperation} to the given {@link Facet} + * + * @param facet + * the parent {@link Facet}, cannot be null + * @param facetOperation + * the new {@link FacetOperation}, cannot be null, or contained by a resource + * @param editingDomain + * the editing domain needed to perform the Add Emf command, cannot be null + */ + void addOperationInFacet(Facet facet, FacetOperation facetOperation, + EditingDomain editingDomain); + + /** + * Add a new {@link FacetOperation} to the given {@link Facet} + * + * @param facet + * the parent {@link Facet}, cannot be null + * @param facetOperation + * the new {@link FacetOperation}, cannot be null, or contained by a resource + * @param editingDomain + * the editing domain needed to perform the Add Emf command, cannot be null + */ + Command createAddOperationInFacetCommand(Facet facet, + FacetOperation facetOperation, EditingDomain editingDomain); + + /** + * Add a new {@link EParameter} to the given {@link FacetOperation} + * + * @param operation + * the parent {@link EOperation} + * @param parameter + * the new {@link EParameter} + * @param editingDomain + * the editing domain needed to perform the Add Emf command, cannot be null + */ + void addParameterInOperation(FacetOperation operation, + EParameter parameter, EditingDomain editingDomain); + + /** + * Add a new {@link EParameter} to the given {@link FacetOperation} + * + * @param operation + * the parent {@link EOperation} + * @param parameter + * the new {@link EParameter} + * @param editingDomain + * the editing domain needed to perform the Add Emf command, cannot be null + */ + Command createAddParameterInOperationCommand(FacetOperation operation, + EParameter parameter, EditingDomain editingDomain); + + /** + * Set the given URI to the given {@link FacetSet} + * + * @param facetSet + * the {@link FacetSet} to be modified + * @param nsUri + * the Uri + * @param editingDomain + * the editing domain needed to perform the Set Emf command, cannot be null + */ + void setFacetSetNsUri(FacetSet facetSet, String nsUri, + EditingDomain editingDomain); + + /** + * Set the given URI to the given {@link FacetSet} + * + * @param facetSet + * the {@link FacetSet} to be modified + * @param nsUri + * the Uri + * @param editingDomain + * the editing domain needed to perform the Set Emf command, cannot be null + */ + Command createSetFacetSetNsUriCommand(FacetSet facetSet, String nsUri, + EditingDomain editingDomain); + +}
diff --git a/org.eclipse.modisco.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/internal/messages.properties b/org.eclipse.modisco.facet.efacet.core/src/org/eclipse/modisco/facet/efacet/core/internal/messages.properties similarity index 100% rename from org.eclipse.modisco.facet.efacet.core/src/org/eclipse/emf/facet/efacet/core/internal/messages.properties rename to org.eclipse.modisco.facet.efacet.core/src/org/eclipse/modisco/facet/efacet/core/internal/messages.properties
diff --git a/org.eclipse.modisco.facet.efacet.core/src/org/eclipse/modisco/facet/efacet/core/internal/query/EObjectLiteralQueryImplementation.java b/org.eclipse.modisco.facet.efacet.core/src/org/eclipse/modisco/facet/efacet/core/internal/query/EObjectLiteralQueryImplementation.java new file mode 100644 index 0000000..42d17c0 --- /dev/null +++ b/org.eclipse.modisco.facet.efacet.core/src/org/eclipse/modisco/facet/efacet/core/internal/query/EObjectLiteralQueryImplementation.java
@@ -0,0 +1,48 @@ +/******************************************************************************* + * Copyright (c) 2012 CEA LIST. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Nicolas Bros (Mia-Software) - Bug 376941 - [EFacet] Facet operation arguments in Facet model + *******************************************************************************/ +package org.eclipse.modisco.facet.efacet.core.internal.query; + +import java.util.List; + +import org.eclipse.emf.ecore.EObject; +import org.eclipse.modisco.facet.efacet.core.IFacetManager; +import org.eclipse.modisco.facet.efacet.core.exception.DerivedTypedElementException; +import org.eclipse.modisco.facet.efacet.core.internal.exception.DerivedTypedElementEvaluationException; +import org.eclipse.modisco.facet.efacet.core.query.IQueryImplementation; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.DerivedTypedElement; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.ParameterValue; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.extensible.Query; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.query.EObjectLiteralQuery; + +public class EObjectLiteralQueryImplementation implements IQueryImplementation { + + private boolean checkResultType = false; + + public Object getValue(final Query query, final DerivedTypedElement feature, final EObject source, final List<ParameterValue> parameterValues, + final IFacetManager facetManager) + throws DerivedTypedElementException { + return ((EObjectLiteralQuery) query).getElement(); + } + + public void setValue(final Query query, final DerivedTypedElement feature, final EObject source, final List<ParameterValue> parameterValues, + final Object newValue) + throws DerivedTypedElementException { + throw new DerivedTypedElementEvaluationException("Not implemented"); //$NON-NLS-1$ + } + + public boolean isCheckResultType() { + return this.checkResultType; + } + + public void setCheckResultType(final boolean checkResultType) { + this.checkResultType = checkResultType; + } +}
diff --git a/org.eclipse.modisco.facet.efacet.core/src/org/eclipse/modisco/facet/efacet/core/internal/query/EObjectLiteralQueryImplementationFactory.java b/org.eclipse.modisco.facet.efacet.core/src/org/eclipse/modisco/facet/efacet/core/internal/query/EObjectLiteralQueryImplementationFactory.java new file mode 100644 index 0000000..1bbc71a --- /dev/null +++ b/org.eclipse.modisco.facet.efacet.core/src/org/eclipse/modisco/facet/efacet/core/internal/query/EObjectLiteralQueryImplementationFactory.java
@@ -0,0 +1,33 @@ +/******************************************************************************* + * Copyright (c) 2012 CEA LIST. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Nicolas Bros (Mia-Software) - Bug 376941 - [EFacet] Facet operation arguments in Facet model + *******************************************************************************/ +package org.eclipse.modisco.facet.efacet.core.internal.query; + +import org.eclipse.emf.ecore.EClass; +import org.eclipse.modisco.facet.efacet.core.IDerivedTypedElementManager; +import org.eclipse.modisco.facet.efacet.core.exception.DerivedTypedElementException; +import org.eclipse.modisco.facet.efacet.core.query.IQueryImplementation; +import org.eclipse.modisco.facet.efacet.core.query.IQueryImplementationFactory; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.extensible.Query; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.query.QueryPackage; +import org.osgi.framework.Bundle; + +public class EObjectLiteralQueryImplementationFactory implements IQueryImplementationFactory { + + public EClass getManagedQueryType() { + return QueryPackage.eINSTANCE.getEObjectLiteralQuery(); + } + + public IQueryImplementation create(final Query query, final Bundle queryBundle, final IDerivedTypedElementManager manager) throws DerivedTypedElementException { + final EObjectLiteralQueryImplementation evaluator = new EObjectLiteralQueryImplementation(); + evaluator.setCheckResultType(true); + return evaluator; + } +}
diff --git a/org.eclipse.modisco.facet.efacet.core/src/org/eclipse/modisco/facet/efacet/core/internal/query/FalseLiteralQueryImplementation.java b/org.eclipse.modisco.facet.efacet.core/src/org/eclipse/modisco/facet/efacet/core/internal/query/FalseLiteralQueryImplementation.java new file mode 100644 index 0000000..5b68238 --- /dev/null +++ b/org.eclipse.modisco.facet.efacet.core/src/org/eclipse/modisco/facet/efacet/core/internal/query/FalseLiteralQueryImplementation.java
@@ -0,0 +1,46 @@ +/** + * Copyright (c) 2012 Mia-Software. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Gregoire Dupe (Mia-Software) - Bug 369987 - [Restructuring][Table] Switch to the new customization and facet framework + * Nicolas Bros (Mia-Software) - Bug 376941 - [EFacet] Facet operation arguments in Facet model + */ +package org.eclipse.modisco.facet.efacet.core.internal.query; + +import java.util.List; + +import org.eclipse.emf.ecore.EObject; +import org.eclipse.modisco.facet.efacet.core.IFacetManager; +import org.eclipse.modisco.facet.efacet.core.exception.DerivedTypedElementException; +import org.eclipse.modisco.facet.efacet.core.internal.exception.DerivedTypedElementEvaluationException; +import org.eclipse.modisco.facet.efacet.core.query.IQueryImplementation; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.DerivedTypedElement; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.ParameterValue; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.extensible.Query; + +public class FalseLiteralQueryImplementation implements IQueryImplementation { + + private boolean checkResultType = false; + + public Object getValue(final Query query, final DerivedTypedElement feature, final EObject source, final List<ParameterValue> parameterValues, final IFacetManager facetManager) + throws DerivedTypedElementException { + return Boolean.FALSE; + } + + public void setValue(final Query query, final DerivedTypedElement feature, final EObject source, final List<ParameterValue> parameterValues, final Object newValue) + throws DerivedTypedElementException { + throw new DerivedTypedElementEvaluationException("Not implemented"); //$NON-NLS-1$ + } + + public void setCheckResultType(final boolean checkResultType) { + this.checkResultType = checkResultType; + } + + public boolean isCheckResultType() { + return this.checkResultType; + } +}
diff --git a/org.eclipse.modisco.facet.efacet.core/src/org/eclipse/modisco/facet/efacet/core/internal/query/FalseLiteralQueryImplementationFactory.java b/org.eclipse.modisco.facet.efacet.core/src/org/eclipse/modisco/facet/efacet/core/internal/query/FalseLiteralQueryImplementationFactory.java new file mode 100644 index 0000000..454920e --- /dev/null +++ b/org.eclipse.modisco.facet.efacet.core/src/org/eclipse/modisco/facet/efacet/core/internal/query/FalseLiteralQueryImplementationFactory.java
@@ -0,0 +1,35 @@ +/** + * Copyright (c) 2012 Mia-Software. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Grégoire Dupé (Mia-Software) - Bug 369987 - [Restructuring][Table] Switch to the new customization and facet framework + * Nicolas Bros (Mia-Software) - Bug 376941 - [EFacet] Facet operation arguments in Facet model + */ +package org.eclipse.modisco.facet.efacet.core.internal.query; + +import org.eclipse.emf.ecore.EClass; +import org.eclipse.modisco.facet.efacet.core.IDerivedTypedElementManager; +import org.eclipse.modisco.facet.efacet.core.exception.DerivedTypedElementException; +import org.eclipse.modisco.facet.efacet.core.query.IQueryImplementation; +import org.eclipse.modisco.facet.efacet.core.query.IQueryImplementationFactory; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.extensible.Query; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.query.QueryPackage; +import org.osgi.framework.Bundle; + +public class FalseLiteralQueryImplementationFactory implements IQueryImplementationFactory { + + public EClass getManagedQueryType() { + return QueryPackage.eINSTANCE.getFalseLiteralQuery(); + } + + public IQueryImplementation create(final Query query, final Bundle queryBundle, final IDerivedTypedElementManager manager) throws DerivedTypedElementException { + final FalseLiteralQueryImplementation evaluator = new FalseLiteralQueryImplementation(); + evaluator.setCheckResultType(false); + return evaluator; + } + +}
diff --git a/org.eclipse.modisco.facet.efacet.core/src/org/eclipse/modisco/facet/efacet/core/internal/query/FloatLiteralQueryImplementation.java b/org.eclipse.modisco.facet.efacet.core/src/org/eclipse/modisco/facet/efacet/core/internal/query/FloatLiteralQueryImplementation.java new file mode 100644 index 0000000..a1b311b --- /dev/null +++ b/org.eclipse.modisco.facet.efacet.core/src/org/eclipse/modisco/facet/efacet/core/internal/query/FloatLiteralQueryImplementation.java
@@ -0,0 +1,46 @@ +/******************************************************************************* + * Copyright (c) 2012 CEA LIST. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Nicolas Bros (Mia-Software) - Bug 376941 - [EFacet] Facet operation arguments in Facet model + *******************************************************************************/ +package org.eclipse.modisco.facet.efacet.core.internal.query; + +import java.util.List; + +import org.eclipse.emf.ecore.EObject; +import org.eclipse.modisco.facet.efacet.core.IFacetManager; +import org.eclipse.modisco.facet.efacet.core.exception.DerivedTypedElementException; +import org.eclipse.modisco.facet.efacet.core.internal.exception.DerivedTypedElementEvaluationException; +import org.eclipse.modisco.facet.efacet.core.query.IQueryImplementation; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.DerivedTypedElement; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.ParameterValue; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.extensible.Query; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.query.FloatLiteralQuery; + +public class FloatLiteralQueryImplementation implements IQueryImplementation { + + private boolean checkResultType = false; + + public Object getValue(final Query query, final DerivedTypedElement feature, final EObject source, final List<ParameterValue> parameterValues, final IFacetManager facetManager) + throws DerivedTypedElementException { + return Float.valueOf(((FloatLiteralQuery) query).getValue()); + } + + public void setValue(final Query query, final DerivedTypedElement feature, final EObject source, final List<ParameterValue> parameterValues, final Object newValue) + throws DerivedTypedElementException { + throw new DerivedTypedElementEvaluationException("Not implemented"); //$NON-NLS-1$ + } + + public void setCheckResultType(final boolean checkResultType) { + this.checkResultType = checkResultType; + } + + public boolean isCheckResultType() { + return this.checkResultType; + } +}
diff --git a/org.eclipse.modisco.facet.efacet.core/src/org/eclipse/modisco/facet/efacet/core/internal/query/FloatLiteralQueryImplementationFactory.java b/org.eclipse.modisco.facet.efacet.core/src/org/eclipse/modisco/facet/efacet/core/internal/query/FloatLiteralQueryImplementationFactory.java new file mode 100644 index 0000000..56f60b3 --- /dev/null +++ b/org.eclipse.modisco.facet.efacet.core/src/org/eclipse/modisco/facet/efacet/core/internal/query/FloatLiteralQueryImplementationFactory.java
@@ -0,0 +1,33 @@ +/******************************************************************************* + * Copyright (c) 2012 CEA LIST. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Nicolas Bros (Mia-Software) - Bug 376941 - [EFacet] Facet operation arguments in Facet model + *******************************************************************************/ +package org.eclipse.modisco.facet.efacet.core.internal.query; + +import org.eclipse.emf.ecore.EClass; +import org.eclipse.modisco.facet.efacet.core.IDerivedTypedElementManager; +import org.eclipse.modisco.facet.efacet.core.exception.DerivedTypedElementException; +import org.eclipse.modisco.facet.efacet.core.query.IQueryImplementation; +import org.eclipse.modisco.facet.efacet.core.query.IQueryImplementationFactory; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.extensible.Query; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.query.QueryPackage; +import org.osgi.framework.Bundle; + +public class FloatLiteralQueryImplementationFactory implements IQueryImplementationFactory { + + public EClass getManagedQueryType() { + return QueryPackage.eINSTANCE.getFloatLiteralQuery(); + } + + public IQueryImplementation create(final Query query, final Bundle queryBundle, final IDerivedTypedElementManager manager) throws DerivedTypedElementException { + final FloatLiteralQueryImplementation evaluator = new FloatLiteralQueryImplementation(); + evaluator.setCheckResultType(true); + return evaluator; + } +}
diff --git a/org.eclipse.modisco.facet.efacet.core/src/org/eclipse/modisco/facet/efacet/core/internal/query/IntegerLiteralQueryImplementation.java b/org.eclipse.modisco.facet.efacet.core/src/org/eclipse/modisco/facet/efacet/core/internal/query/IntegerLiteralQueryImplementation.java new file mode 100644 index 0000000..a39218b --- /dev/null +++ b/org.eclipse.modisco.facet.efacet.core/src/org/eclipse/modisco/facet/efacet/core/internal/query/IntegerLiteralQueryImplementation.java
@@ -0,0 +1,46 @@ +/******************************************************************************* + * Copyright (c) 2012 CEA LIST. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Nicolas Bros (Mia-Software) - Bug 376941 - [EFacet] Facet operation arguments in Facet model + *******************************************************************************/ +package org.eclipse.modisco.facet.efacet.core.internal.query; + +import java.util.List; + +import org.eclipse.emf.ecore.EObject; +import org.eclipse.modisco.facet.efacet.core.IFacetManager; +import org.eclipse.modisco.facet.efacet.core.exception.DerivedTypedElementException; +import org.eclipse.modisco.facet.efacet.core.internal.exception.DerivedTypedElementEvaluationException; +import org.eclipse.modisco.facet.efacet.core.query.IQueryImplementation; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.DerivedTypedElement; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.ParameterValue; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.extensible.Query; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.query.IntegerLiteralQuery; + +public class IntegerLiteralQueryImplementation implements IQueryImplementation { + + private boolean checkResultType = false; + + public Object getValue(final Query query, final DerivedTypedElement feature, final EObject source, final List<ParameterValue> parameterValues, final IFacetManager facetManager) + throws DerivedTypedElementException { + return Integer.valueOf(((IntegerLiteralQuery) query).getValue()); + } + + public void setValue(final Query query, final DerivedTypedElement feature, final EObject source, final List<ParameterValue> parameterValues, final Object newValue) + throws DerivedTypedElementException { + throw new DerivedTypedElementEvaluationException("Not implemented"); //$NON-NLS-1$ + } + + public void setCheckResultType(final boolean checkResultType) { + this.checkResultType = checkResultType; + } + + public boolean isCheckResultType() { + return this.checkResultType; + } +}
diff --git a/org.eclipse.modisco.facet.efacet.core/src/org/eclipse/modisco/facet/efacet/core/internal/query/IntegerLiteralQueryImplementationFactory.java b/org.eclipse.modisco.facet.efacet.core/src/org/eclipse/modisco/facet/efacet/core/internal/query/IntegerLiteralQueryImplementationFactory.java new file mode 100644 index 0000000..859c082 --- /dev/null +++ b/org.eclipse.modisco.facet.efacet.core/src/org/eclipse/modisco/facet/efacet/core/internal/query/IntegerLiteralQueryImplementationFactory.java
@@ -0,0 +1,33 @@ +/******************************************************************************* + * Copyright (c) 2012 CEA LIST. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Nicolas Bros (Mia-Software) - Bug 376941 - [EFacet] Facet operation arguments in Facet model + *******************************************************************************/ +package org.eclipse.modisco.facet.efacet.core.internal.query; + +import org.eclipse.emf.ecore.EClass; +import org.eclipse.modisco.facet.efacet.core.IDerivedTypedElementManager; +import org.eclipse.modisco.facet.efacet.core.exception.DerivedTypedElementException; +import org.eclipse.modisco.facet.efacet.core.query.IQueryImplementation; +import org.eclipse.modisco.facet.efacet.core.query.IQueryImplementationFactory; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.extensible.Query; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.query.QueryPackage; +import org.osgi.framework.Bundle; + +public class IntegerLiteralQueryImplementationFactory implements IQueryImplementationFactory { + + public EClass getManagedQueryType() { + return QueryPackage.eINSTANCE.getIntegerLiteralQuery(); + } + + public IQueryImplementation create(final Query query, final Bundle queryBundle, final IDerivedTypedElementManager manager) throws DerivedTypedElementException { + final IntegerLiteralQueryImplementation evaluator = new IntegerLiteralQueryImplementation(); + evaluator.setCheckResultType(true); + return evaluator; + } +}
diff --git a/org.eclipse.modisco.facet.efacet.core/src/org/eclipse/modisco/facet/efacet/core/internal/query/IsOneOfQueryImplementation.java b/org.eclipse.modisco.facet.efacet.core/src/org/eclipse/modisco/facet/efacet/core/internal/query/IsOneOfQueryImplementation.java new file mode 100644 index 0000000..ebdaa32 --- /dev/null +++ b/org.eclipse.modisco.facet.efacet.core/src/org/eclipse/modisco/facet/efacet/core/internal/query/IsOneOfQueryImplementation.java
@@ -0,0 +1,52 @@ +/** + * Copyright (c) 2012 Mia-Software. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Gregoire Dupe (Mia-Software) - Bug 369673 - [Facet] IsOneOfQuery + * Gregoire Dupe (Mia-Software) - Bug 369987 - [Restructuring][Table] Switch to the new customization and facet framework + * Nicolas Bros (Mia-Software) - Bug 376941 - [EFacet] Facet operation arguments in Facet model + */ +package org.eclipse.modisco.facet.efacet.core.internal.query; + +import java.util.List; + +import org.eclipse.emf.ecore.EObject; +import org.eclipse.modisco.facet.efacet.core.IFacetManager; +import org.eclipse.modisco.facet.efacet.core.exception.DerivedTypedElementException; +import org.eclipse.modisco.facet.efacet.core.internal.exception.DerivedTypedElementEvaluationException; +import org.eclipse.modisco.facet.efacet.core.query.IQueryImplementation; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.DerivedTypedElement; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.ParameterValue; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.extensible.Query; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.query.IsOneOfQuery; + +public class IsOneOfQueryImplementation implements IQueryImplementation { + + // This class is a modified copy of : + // org.eclipse.emf.facet.infra.query.core.java.internal.JavaModelQueryAdapter + + private boolean checkResultType = false; + + public Object getValue(final Query query, final DerivedTypedElement feature, final EObject source, final List<ParameterValue> parameterValues, final IFacetManager facetManager) + throws DerivedTypedElementException { + return Boolean.valueOf(((IsOneOfQuery) query).getExpectedEObjects().contains(source)); + } + + public void setValue(final Query query, final DerivedTypedElement feature, final EObject source, final List<ParameterValue> parameterValues, final Object newValue) + throws DerivedTypedElementException { + throw new DerivedTypedElementEvaluationException("Not implemented"); //$NON-NLS-1$ + } + + public void setCheckResultType(final boolean checkResultType) { + this.checkResultType = checkResultType; + } + + public boolean isCheckResultType() { + return this.checkResultType; + } + +}
diff --git a/org.eclipse.modisco.facet.efacet.core/src/org/eclipse/modisco/facet/efacet/core/internal/query/IsOneOfQueryImplementationFactory.java b/org.eclipse.modisco.facet.efacet.core/src/org/eclipse/modisco/facet/efacet/core/internal/query/IsOneOfQueryImplementationFactory.java new file mode 100644 index 0000000..4e4ff8e --- /dev/null +++ b/org.eclipse.modisco.facet.efacet.core/src/org/eclipse/modisco/facet/efacet/core/internal/query/IsOneOfQueryImplementationFactory.java
@@ -0,0 +1,36 @@ +/** + * Copyright (c) 2012 Mia-Software. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Grégoire Dupé (Mia-Software) - Bug 369673 - [Facet] IsOneOfQuery + * Gregoire Dupe (Mia-Software) - Bug 369987 - [Restructuring][Table] Switch to the new customization and facet framework + * Nicolas Bros (Mia-Software) - Bug 376941 - [EFacet] Facet operation arguments in Facet model + */ +package org.eclipse.modisco.facet.efacet.core.internal.query; + +import org.eclipse.emf.ecore.EClass; +import org.eclipse.modisco.facet.efacet.core.IDerivedTypedElementManager; +import org.eclipse.modisco.facet.efacet.core.exception.DerivedTypedElementException; +import org.eclipse.modisco.facet.efacet.core.query.IQueryImplementation; +import org.eclipse.modisco.facet.efacet.core.query.IQueryImplementationFactory; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.extensible.Query; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.query.QueryPackage; +import org.osgi.framework.Bundle; + +public class IsOneOfQueryImplementationFactory implements IQueryImplementationFactory { + + public EClass getManagedQueryType() { + return QueryPackage.eINSTANCE.getIsOneOfQuery(); + } + + public IQueryImplementation create(final Query query, final Bundle queryBundle, final IDerivedTypedElementManager manager) throws DerivedTypedElementException { + final IsOneOfQueryImplementation evaluator = new IsOneOfQueryImplementation(); + evaluator.setCheckResultType(false); + return evaluator; + } + +}
diff --git a/org.eclipse.modisco.facet.efacet.core/src/org/eclipse/modisco/facet/efacet/core/internal/query/NavigationQueryImplementation.java b/org.eclipse.modisco.facet.efacet.core/src/org/eclipse/modisco/facet/efacet/core/internal/query/NavigationQueryImplementation.java new file mode 100644 index 0000000..8f3cd8e --- /dev/null +++ b/org.eclipse.modisco.facet.efacet.core/src/org/eclipse/modisco/facet/efacet/core/internal/query/NavigationQueryImplementation.java
@@ -0,0 +1,80 @@ +/** + * Copyright (c) 2011, 2012 Mia-Software. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Gregoire Dupe (Mia-Software) - Bug 366055 - NavigationQuery + * Gregoire Dupe (Mia-Software) - Bug 369987 - [Restructuring][Table] Switch to the new customization and facet framework + * Olivier Remaud (Soft-Maint) - Bug 373087 - [Improvement] Adaptable behavior on error + * Nicolas Bros (Mia-Software) - Bug 376941 - [EFacet] Facet operation arguments in Facet model + */ +package org.eclipse.modisco.facet.efacet.core.internal.query; + +import java.lang.reflect.InvocationTargetException; +import java.util.List; + +import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.ecore.EOperation; +import org.eclipse.emf.ecore.EStructuralFeature; +import org.eclipse.emf.ecore.ETypedElement; +import org.eclipse.modisco.facet.efacet.core.IFacetManager; +import org.eclipse.modisco.facet.efacet.core.exception.DerivedTypedElementException; +import org.eclipse.modisco.facet.efacet.core.internal.exception.DerivedTypedElementEvaluationException; +import org.eclipse.modisco.facet.efacet.core.query.IQueryImplementation; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.DerivedTypedElement; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.ParameterValue; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.extensible.Query; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.query.NavigationQuery; + +public class NavigationQueryImplementation implements IQueryImplementation { + + // This class is a modified copy of : + // org.eclipse.emf.facet.infra.query.core.java.internal.JavaModelQueryAdapter + + private boolean checkResultType = false; + + public Object getValue(final Query query, final DerivedTypedElement feature, final EObject source, final List<ParameterValue> parameterValues, final IFacetManager facetManager) + throws DerivedTypedElementException { + final NavigationQuery navigationQuery = (NavigationQuery) query; + Object current = source; + for (final ETypedElement typedElement : navigationQuery.getPath()) { + if (current instanceof EObject) { + final EObject currentEObject = (EObject) current; + if (typedElement instanceof EOperation) { + final EOperation operation = (EOperation) typedElement; + try { + current = currentEObject.eInvoke(operation, null); + } catch (final InvocationTargetException e) { + throw new DerivedTypedElementEvaluationException("Invocation of " + operation.getName() + " failed.", e); //$NON-NLS-1$//$NON-NLS-2$ + } + } else if (typedElement instanceof EStructuralFeature) { + final EStructuralFeature structuralFeature = (EStructuralFeature) typedElement; + current = currentEObject.eGet(structuralFeature); + } else { + throw new DerivedTypedElementEvaluationException("The " + typedElement.eClass().getName() + " is not supported."); //$NON-NLS-1$//$NON-NLS-2$ + } + } else { + if (current != null || navigationQuery.isFailOnError()) { + throw new DerivedTypedElementEvaluationException("Invalid path"); //$NON-NLS-1$ + } + } + } + return current; + } + + public void setValue(final Query query, final DerivedTypedElement feature, final EObject source, final List<ParameterValue> parameterValues, final Object newValue) + throws DerivedTypedElementException { + throw new DerivedTypedElementEvaluationException("Not implemented"); //$NON-NLS-1$ + } + + public void setCheckResultType(final boolean checkResultType) { + this.checkResultType = checkResultType; + } + + public boolean isCheckResultType() { + return this.checkResultType; + } +}
diff --git a/org.eclipse.modisco.facet.efacet.core/src/org/eclipse/modisco/facet/efacet/core/internal/query/NavigationQueryImplementationFactory.java b/org.eclipse.modisco.facet.efacet.core/src/org/eclipse/modisco/facet/efacet/core/internal/query/NavigationQueryImplementationFactory.java new file mode 100644 index 0000000..e93149d --- /dev/null +++ b/org.eclipse.modisco.facet.efacet.core/src/org/eclipse/modisco/facet/efacet/core/internal/query/NavigationQueryImplementationFactory.java
@@ -0,0 +1,35 @@ +/** + * Copyright (c) 2011, 2012 Mia-Software. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Grégoire Dupé (Mia-Software) - Bug 366055 - NavigationQuery + * Gregoire Dupe (Mia-Software) - Bug 369987 - [Restructuring][Table] Switch to the new customization and facet framework + * Nicolas Bros (Mia-Software) - Bug 376941 - [EFacet] Facet operation arguments in Facet model + */ +package org.eclipse.modisco.facet.efacet.core.internal.query; + +import org.eclipse.emf.ecore.EClass; +import org.eclipse.modisco.facet.efacet.core.IDerivedTypedElementManager; +import org.eclipse.modisco.facet.efacet.core.exception.DerivedTypedElementException; +import org.eclipse.modisco.facet.efacet.core.query.IQueryImplementation; +import org.eclipse.modisco.facet.efacet.core.query.IQueryImplementationFactory; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.extensible.Query; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.query.QueryPackage; +import org.osgi.framework.Bundle; + +public class NavigationQueryImplementationFactory implements IQueryImplementationFactory { + + public EClass getManagedQueryType() { + return QueryPackage.eINSTANCE.getNavigationQuery(); + } + + public IQueryImplementation create(final Query query, final Bundle queryBundle, final IDerivedTypedElementManager manager) throws DerivedTypedElementException { + final NavigationQueryImplementation evaluator = new NavigationQueryImplementation(); + evaluator.setCheckResultType(true); + return evaluator; + } +}
diff --git a/org.eclipse.modisco.facet.efacet.core/src/org/eclipse/modisco/facet/efacet/core/internal/query/NullLiteralQueryImplementation.java b/org.eclipse.modisco.facet.efacet.core/src/org/eclipse/modisco/facet/efacet/core/internal/query/NullLiteralQueryImplementation.java new file mode 100644 index 0000000..cd54f8a --- /dev/null +++ b/org.eclipse.modisco.facet.efacet.core/src/org/eclipse/modisco/facet/efacet/core/internal/query/NullLiteralQueryImplementation.java
@@ -0,0 +1,46 @@ +/** + * Copyright (c) 2012 Mia-Software. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Gregoire Dupe (Mia-Software) - Bug 369987 - [Restructuring][Table] Switch to the new customization and facet framework + * Nicolas Bros (Mia-Software) - Bug 376941 - [EFacet] Facet operation arguments in Facet model + */ +package org.eclipse.modisco.facet.efacet.core.internal.query; + +import java.util.List; + +import org.eclipse.emf.ecore.EObject; +import org.eclipse.modisco.facet.efacet.core.IFacetManager; +import org.eclipse.modisco.facet.efacet.core.exception.DerivedTypedElementException; +import org.eclipse.modisco.facet.efacet.core.internal.exception.DerivedTypedElementEvaluationException; +import org.eclipse.modisco.facet.efacet.core.query.IQueryImplementation; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.DerivedTypedElement; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.ParameterValue; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.extensible.Query; + +public class NullLiteralQueryImplementation implements IQueryImplementation { + + private boolean checkResultType = false; + + public Object getValue(final Query query, final DerivedTypedElement feature, final EObject source, final List<ParameterValue> parameterValues, final IFacetManager facetManager) + throws DerivedTypedElementException { + return null; + } + + public void setValue(final Query query, final DerivedTypedElement feature, final EObject source, final List<ParameterValue> parameterValues, final Object newValue) + throws DerivedTypedElementException { + throw new DerivedTypedElementEvaluationException("Not implemented"); //$NON-NLS-1$ + } + + public void setCheckResultType(final boolean checkResultType) { + this.checkResultType = checkResultType; + } + + public boolean isCheckResultType() { + return this.checkResultType; + } +}
diff --git a/org.eclipse.modisco.facet.efacet.core/src/org/eclipse/modisco/facet/efacet/core/internal/query/NullLiteralQueryImplementationFactory.java b/org.eclipse.modisco.facet.efacet.core/src/org/eclipse/modisco/facet/efacet/core/internal/query/NullLiteralQueryImplementationFactory.java new file mode 100644 index 0000000..9e6985d --- /dev/null +++ b/org.eclipse.modisco.facet.efacet.core/src/org/eclipse/modisco/facet/efacet/core/internal/query/NullLiteralQueryImplementationFactory.java
@@ -0,0 +1,35 @@ +/** + * Copyright (c) 2012 Mia-Software. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Grégoire Dupé (Mia-Software) - Bug 369987 - [Restructuring][Table] Switch to the new customization and facet framework + * Nicolas Bros (Mia-Software) - Bug 376941 - [EFacet] Facet operation arguments in Facet model + */ +package org.eclipse.modisco.facet.efacet.core.internal.query; + +import org.eclipse.emf.ecore.EClass; +import org.eclipse.modisco.facet.efacet.core.IDerivedTypedElementManager; +import org.eclipse.modisco.facet.efacet.core.exception.DerivedTypedElementException; +import org.eclipse.modisco.facet.efacet.core.query.IQueryImplementation; +import org.eclipse.modisco.facet.efacet.core.query.IQueryImplementationFactory; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.extensible.Query; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.query.QueryPackage; +import org.osgi.framework.Bundle; + +public class NullLiteralQueryImplementationFactory implements IQueryImplementationFactory { + + public EClass getManagedQueryType() { + return QueryPackage.eINSTANCE.getNullLiteralQuery(); + } + + public IQueryImplementation create(final Query query, final Bundle queryBundle, final IDerivedTypedElementManager manager) throws DerivedTypedElementException { + final NullLiteralQueryImplementation evaluator = new NullLiteralQueryImplementation(); + evaluator.setCheckResultType(false); + return evaluator; + } + +}
diff --git a/org.eclipse.modisco.facet.efacet.core/src/org/eclipse/modisco/facet/efacet/core/internal/query/OperationCallQueryImplementation.java b/org.eclipse.modisco.facet.efacet.core/src/org/eclipse/modisco/facet/efacet/core/internal/query/OperationCallQueryImplementation.java new file mode 100644 index 0000000..fcc2782 --- /dev/null +++ b/org.eclipse.modisco.facet.efacet.core/src/org/eclipse/modisco/facet/efacet/core/internal/query/OperationCallQueryImplementation.java
@@ -0,0 +1,68 @@ +/******************************************************************************* + * Copyright (c) 2012 CEA LIST. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Nicolas Bros (Mia-Software) - Bug 376941 - [EFacet] Facet operation arguments in Facet model + *******************************************************************************/ +package org.eclipse.modisco.facet.efacet.core.internal.query; + +import java.util.ArrayList; +import java.util.List; + +import org.eclipse.emf.ecore.EObject; +import org.eclipse.modisco.facet.efacet.core.IDerivedTypedElementManager; +import org.eclipse.modisco.facet.efacet.core.IFacetManager; +import org.eclipse.modisco.facet.efacet.core.exception.DerivedTypedElementException; +import org.eclipse.modisco.facet.efacet.core.exception.FacetManagerException; +import org.eclipse.modisco.facet.efacet.core.internal.exception.DerivedTypedElementEvaluationException; +import org.eclipse.modisco.facet.efacet.core.query.IQueryImplementation; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.DerivedTypedElement; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.ParameterValue; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.extensible.Query; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.query.OperationCallQuery; + +public class OperationCallQueryImplementation implements IQueryImplementation { + + private boolean checkResultType = false; + private final IDerivedTypedElementManager derivedTEManager; + + public OperationCallQueryImplementation(final IDerivedTypedElementManager derivedTEManager) { + this.derivedTEManager = derivedTEManager; + } + + public Object getValue(final Query query, final DerivedTypedElement feature, final EObject source, final List<ParameterValue> parameterValues, final IFacetManager facetManager) + throws DerivedTypedElementException { + Object result; + final OperationCallQuery opQuery = (OperationCallQuery) query; + final List<Object> operationArgs = new ArrayList<Object>(); + for (final Query queryArgument : opQuery.getArguments()) { + operationArgs.add(this.derivedTEManager.evaluate(queryArgument, source, parameterValues, facetManager)); + } + + // FIXME: no EditingDomain is available here + try { + result = facetManager.invoke(source, opQuery.getOperation(), null, null, operationArgs.toArray()); + } catch (final FacetManagerException e) { + throw new DerivedTypedElementEvaluationException("Operation call evaluation failed", e); //$NON-NLS-1$ + } + return result; + } + + public void setValue(final Query query, final DerivedTypedElement feature, final EObject source, final List<ParameterValue> parameterValues, final Object newValue) + throws DerivedTypedElementException { + throw new DerivedTypedElementEvaluationException("A set operation cannot be performed through an operation call."); //$NON-NLS-1$ + + } + + public void setCheckResultType(final boolean checkResultType) { + this.checkResultType = checkResultType; + } + + public boolean isCheckResultType() { + return this.checkResultType; + } +}
diff --git a/org.eclipse.modisco.facet.efacet.core/src/org/eclipse/modisco/facet/efacet/core/internal/query/OperationCallQueryImplementationFactory.java b/org.eclipse.modisco.facet.efacet.core/src/org/eclipse/modisco/facet/efacet/core/internal/query/OperationCallQueryImplementationFactory.java new file mode 100644 index 0000000..c9cac50 --- /dev/null +++ b/org.eclipse.modisco.facet.efacet.core/src/org/eclipse/modisco/facet/efacet/core/internal/query/OperationCallQueryImplementationFactory.java
@@ -0,0 +1,32 @@ +/******************************************************************************* + * Copyright (c) 2012 CEA LIST. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Nicolas Bros (Mia-Software) - Bug 376941 - [EFacet] Facet operation arguments in Facet model + *******************************************************************************/ +package org.eclipse.modisco.facet.efacet.core.internal.query; + +import org.eclipse.emf.ecore.EClass; +import org.eclipse.modisco.facet.efacet.core.IDerivedTypedElementManager; +import org.eclipse.modisco.facet.efacet.core.exception.DerivedTypedElementException; +import org.eclipse.modisco.facet.efacet.core.query.IQueryImplementation; +import org.eclipse.modisco.facet.efacet.core.query.IQueryImplementationFactory; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.extensible.Query; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.query.QueryPackage; +import org.osgi.framework.Bundle; + +public class OperationCallQueryImplementationFactory implements IQueryImplementationFactory { + + public EClass getManagedQueryType() { + return QueryPackage.eINSTANCE.getOperationCallQuery(); + } + + public IQueryImplementation create(final Query query, final Bundle queryBundle, final IDerivedTypedElementManager manager) + throws DerivedTypedElementException { + return new OperationCallQueryImplementation(manager); + } +}
diff --git a/org.eclipse.modisco.facet.efacet.core/src/org/eclipse/modisco/facet/efacet/core/internal/query/QueryImplementationFactoryRegistry.java b/org.eclipse.modisco.facet.efacet.core/src/org/eclipse/modisco/facet/efacet/core/internal/query/QueryImplementationFactoryRegistry.java new file mode 100644 index 0000000..6c3f6b4 --- /dev/null +++ b/org.eclipse.modisco.facet.efacet.core/src/org/eclipse/modisco/facet/efacet/core/internal/query/QueryImplementationFactoryRegistry.java
@@ -0,0 +1,114 @@ +/******************************************************************************* + * Copyright (c) 2012 CEA LIST. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Nicolas Bros (Mia-Software) - Bug 376941 - [EFacet] Facet operation arguments in Facet model + *******************************************************************************/ +package org.eclipse.modisco.facet.efacet.core.internal.query; + +import java.util.ArrayList; +import java.util.List; + +import org.eclipse.core.runtime.CoreException; +import org.eclipse.core.runtime.IConfigurationElement; +import org.eclipse.core.runtime.IExtension; +import org.eclipse.core.runtime.IExtensionPoint; +import org.eclipse.core.runtime.IExtensionRegistry; +import org.eclipse.core.runtime.Platform; +import org.eclipse.emf.ecore.resource.Resource; +import org.eclipse.modisco.facet.efacet.core.IDerivedTypedElementManager; +import org.eclipse.modisco.facet.efacet.core.exception.DerivedTypedElementException; +import org.eclipse.modisco.facet.efacet.core.internal.Activator; +import org.eclipse.modisco.facet.efacet.core.query.IQueryImplementation; +import org.eclipse.modisco.facet.efacet.core.query.IQueryImplementationFactory; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.extensible.Query; +import org.eclipse.modisco.facet.util.core.Logger; +import org.eclipse.modisco.facet.util.emf.core.ICatalogSetManagerFactory; +import org.osgi.framework.Bundle; + +public class QueryImplementationFactoryRegistry { + private static final String EXT_ID = "org.eclipse.emf.facet.efacet.core.queryImplementationRegistration"; //$NON-NLS-1$ + private static final String CLASS = "class"; //$NON-NLS-1$ + public static final QueryImplementationFactoryRegistry INSTANCE = new QueryImplementationFactoryRegistry(); + + private final List<IQueryImplementationFactory> factories = new ArrayList<IQueryImplementationFactory>(); + + public QueryImplementationFactoryRegistry() { + initRegisteredEntries(); + } + + private void initRegisteredEntries() { + final IExtensionRegistry registry = Platform.getExtensionRegistry(); + final IExtensionPoint extPoint = registry.getExtensionPoint(QueryImplementationFactoryRegistry.EXT_ID); + if (extPoint != null) { + for (final IExtension ext : extPoint.getExtensions()) { + for (final IConfigurationElement configElt : ext.getConfigurationElements()) { + try { + final Object impl = configElt.createExecutableExtension(QueryImplementationFactoryRegistry.CLASS); + if (impl instanceof IQueryImplementationFactory) { + final IQueryImplementationFactory factory = (IQueryImplementationFactory) impl; + this.factories.add(factory); + } else { + Logger.logError("Invalid extension in " + ext.getNamespaceIdentifier() + "." + //$NON-NLS-1$ //$NON-NLS-2$ + ". The factory must be an instance of " + IQueryImplementationFactory.class.getName(), Activator.getDefault()); //$NON-NLS-1$ + } + } catch (final CoreException e) { + Logger.logError(e, Activator.getDefault()); + } + } + } + } + } + + /** + * Returns the query evaluator that handles the given type of query + * + * @param query + * the type of query for which an {@link IQueryImplementation} is searched + * @return the {@link IQueryImplementation} + * @throws DerivedTypedElementException + * if no factory implementation was registered for the type of the given query + */ + public IQueryImplementation getEvaluatorFor(final Query query, final IDerivedTypedElementManager manager) + throws DerivedTypedElementException { + if (query == null) { + throw new IllegalArgumentException("query cannot be null"); //$NON-NLS-1$ + } + IQueryImplementation queryImpl = null; + boolean factoryFound = false; + for (final IQueryImplementationFactory queryImplFactory : this.factories) { + factoryFound = queryImplFactory.getManagedQueryType() == query.eClass(); + if (factoryFound) { + final Resource queryResource = query.eResource(); + Bundle bundle = null; + if (queryResource != null) { + bundle = ICatalogSetManagerFactory.DEFAULT.createICatalogSetManager(query.eResource().getResourceSet()).getBundleByResource(queryResource); + } + queryImpl = queryImplFactory.create(query, bundle, manager); + break; + } + } + if (!factoryFound) { + final StringBuffer buffer = new StringBuffer(); + buffer.append("No factory implementation found for "); //$NON-NLS-1$ + buffer.append(QueryUtils.getQueryDescription(query)); + buffer.append(".\nA factory should be registered through the "); //$NON-NLS-1$ + buffer.append(QueryImplementationFactoryRegistry.EXT_ID); + buffer.append(" extension point."); //$NON-NLS-1$ // NOPMD: cannot merge with extracted constant string + buffer.append("\nAvailable Query types are: "); //$NON-NLS-1$ + for (int i = 0; i < this.factories.size(); i++) { + if (i > 0) { + buffer.append(", "); //$NON-NLS-1$ + } + final IQueryImplementationFactory factory = this.factories.get(i); + buffer.append(factory.getManagedQueryType().getName()); + } + throw new DerivedTypedElementException(buffer.toString()); + } + return queryImpl; + } +}
diff --git a/org.eclipse.modisco.facet.efacet.core/src/org/eclipse/modisco/facet/efacet/core/internal/query/QueryUtils.java b/org.eclipse.modisco.facet.efacet.core/src/org/eclipse/modisco/facet/efacet/core/internal/query/QueryUtils.java new file mode 100644 index 0000000..a6e4814 --- /dev/null +++ b/org.eclipse.modisco.facet.efacet.core/src/org/eclipse/modisco/facet/efacet/core/internal/query/QueryUtils.java
@@ -0,0 +1,121 @@ +/******************************************************************************* + * Copyright (c) 2011, 2012 Mia-Software + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Nicolas Bros (Mia-Software) - Bug 361612 - New core for new version of the Facet metamodel + * Nicolas Bros (Mia-Software) - Bug 362191 - [Restructuring] Query mechanism for eFacet2 + * Gregoire Dupe (Mia-Software) - Bug 373078 - API Cleaning + * Nicolas Bros (Mia-Software) - Bug 376941 - [EFacet] Facet operation arguments in Facet model + *******************************************************************************/ +package org.eclipse.modisco.facet.efacet.core.internal.query; + +import org.eclipse.emf.ecore.EClassifier; +import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.ecore.ETypedElement; +import org.eclipse.modisco.facet.efacet.core.FacetUtils; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.DerivedTypedElement; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.Facet; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.extensible.Query; + +public final class QueryUtils { + + private QueryUtils() { + // utility class + } + + /** @return a description to help identify this query in error messages */ + public static String getQueryDescription(final Query query) { + StringBuffer sb = new StringBuffer(); + sb.append("[Query eClass:"); //$NON-NLS-1$ + sb.append(query.eClass().getName()); + DerivedTypedElement owningDerivedTypedElement = QueryUtils + .getOwningDerivedTypedElement(query); + if (owningDerivedTypedElement != null) { + sb.append(" defined on "); //$NON-NLS-1$ + sb.append(owningDerivedTypedElement.getClass().getSimpleName()); + EClassifier eType = owningDerivedTypedElement.getEType(); + if (eType != null) { + sb.append(" of type '"); //$NON-NLS-1$ + sb.append(eType.getName()); + sb.append("' named: '"); //$NON-NLS-1$ + } else { + sb.append(" named: '"); //$NON-NLS-1$ + } + sb.append(owningDerivedTypedElement.getName()); + sb.append("'"); //$NON-NLS-1$ + } else { + sb.append(" with a null owning derived typed element"); //$NON-NLS-1$ + } + sb.append("]"); //$NON-NLS-1$ + return sb.toString(); + } + + // Moved from + // org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.extensible.impl.QueryImpl + public static EClassifier getReturnType(final Query query) { + EClassifier result = null; + final DerivedTypedElement owningDTE = QueryUtils + .getOwningDerivedTypedElement(query); + if (owningDTE != null) { + result = owningDTE.getEType(); + } + return result; + } + + // Moved from + // org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.extensible.impl.QueryImpl + public static EClassifier getSourceType(final Query query) { + EClassifier result = null; + final DerivedTypedElement owningDTE = QueryUtils + .getOwningDerivedTypedElement(query); + if (owningDTE != null) { + final EObject eContainer = QueryUtils.getOwningDerivedTypedElement( + query).eContainer(); + if (eContainer instanceof Facet) { + final Facet facet = (Facet) eContainer; + result = FacetUtils.getExtendedMetaclass(facet); + } else if (eContainer instanceof ETypedElement) { + final ETypedElement typedElement = (ETypedElement) eContainer; + result = typedElement.getEType(); + } + } + return result; + } + + // Moved from + // org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.extensible.impl.QueryImpl + public static DerivedTypedElement getOwningDerivedTypedElement( + final Query query) { + DerivedTypedElement result = null; + EObject container = query.eContainer(); + while (container != null) { + if (container instanceof DerivedTypedElement) { + result = (DerivedTypedElement) container; + break; + } + container = container.eContainer(); + } + if (result == null) { + throw new IllegalStateException( + "Query must always be contained by a DerivedTypedElement"); //$NON-NLS-1$ + } + return (DerivedTypedElement) container; + + } + + // Moved from + // org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.extensible.impl.QueryImpl + public static boolean isMany(final Query query) { + boolean result = false; + final DerivedTypedElement owningDTE = QueryUtils + .getOwningDerivedTypedElement(query); + if (owningDTE != null) { + result = owningDTE.isMany(); + } + return result; + } +}
diff --git a/org.eclipse.modisco.facet.efacet.core/src/org/eclipse/modisco/facet/efacet/core/internal/query/StringLiteralQueryImplementation.java b/org.eclipse.modisco.facet.efacet.core/src/org/eclipse/modisco/facet/efacet/core/internal/query/StringLiteralQueryImplementation.java new file mode 100644 index 0000000..abdeca9 --- /dev/null +++ b/org.eclipse.modisco.facet.efacet.core/src/org/eclipse/modisco/facet/efacet/core/internal/query/StringLiteralQueryImplementation.java
@@ -0,0 +1,49 @@ +/** + * Copyright (c) 2011, 2012 Mia-Software. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + Olivier Remaud (Soft-Maint) - Bug 369824 - Add a simple way to return string literal constants from a customization query + Gregoire Dupe (Mia-Software) - Bug 369987 - [Restructuring][Table] Switch to the new customization and facet framework + Nicolas Bros (Mia-Software) - Bug 376941 - [EFacet] Facet operation arguments in Facet model + */ + +package org.eclipse.modisco.facet.efacet.core.internal.query; + +import java.util.List; + +import org.eclipse.emf.ecore.EObject; +import org.eclipse.modisco.facet.efacet.core.IFacetManager; +import org.eclipse.modisco.facet.efacet.core.exception.DerivedTypedElementException; +import org.eclipse.modisco.facet.efacet.core.internal.exception.DerivedTypedElementEvaluationException; +import org.eclipse.modisco.facet.efacet.core.query.IQueryImplementation; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.DerivedTypedElement; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.ParameterValue; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.extensible.Query; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.query.StringLiteralQuery; + +public class StringLiteralQueryImplementation implements IQueryImplementation { + + private boolean checkResultType = false; + + public Object getValue(final Query query, final DerivedTypedElement feature, final EObject source, final List<ParameterValue> parameterValues, final IFacetManager facetManager) + throws DerivedTypedElementException { + return ((StringLiteralQuery) query).getValue(); + } + + public void setValue(final Query query, final DerivedTypedElement feature, final EObject source, final List<ParameterValue> parameterValues, final Object newValue) + throws DerivedTypedElementException { + throw new DerivedTypedElementEvaluationException("Not implemented"); //$NON-NLS-1$ + } + + public void setCheckResultType(final boolean checkResultType) { + this.checkResultType = checkResultType; + } + + public boolean isCheckResultType() { + return this.checkResultType; + } +}
diff --git a/org.eclipse.modisco.facet.efacet.core/src/org/eclipse/modisco/facet/efacet/core/internal/query/StringLiteralQueryImplementationFactory.java b/org.eclipse.modisco.facet.efacet.core/src/org/eclipse/modisco/facet/efacet/core/internal/query/StringLiteralQueryImplementationFactory.java new file mode 100644 index 0000000..b98ca0e --- /dev/null +++ b/org.eclipse.modisco.facet.efacet.core/src/org/eclipse/modisco/facet/efacet/core/internal/query/StringLiteralQueryImplementationFactory.java
@@ -0,0 +1,36 @@ +/** + * Copyright (c) 2011, 2012 Mia-Software. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + Olivier Remaud (Soft-Maint) - Bug 369824 - Add a simple way to return string literal constants from a customization query + Gregoire Dupe (Mia-Software) - Bug 369987 - [Restructuring][Table] Switch to the new customization and facet framework + Nicolas Bros (Mia-Software) - Bug 376941 - [EFacet] Facet operation arguments in Facet model + */ +package org.eclipse.modisco.facet.efacet.core.internal.query; + +import org.eclipse.emf.ecore.EClass; +import org.eclipse.modisco.facet.efacet.core.IDerivedTypedElementManager; +import org.eclipse.modisco.facet.efacet.core.exception.DerivedTypedElementException; +import org.eclipse.modisco.facet.efacet.core.query.IQueryImplementation; +import org.eclipse.modisco.facet.efacet.core.query.IQueryImplementationFactory; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.extensible.Query; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.query.QueryPackage; +import org.osgi.framework.Bundle; + +public class StringLiteralQueryImplementationFactory implements IQueryImplementationFactory { + + public EClass getManagedQueryType() { + return QueryPackage.eINSTANCE.getStringLiteralQuery(); + } + + public IQueryImplementation create(final Query query, final Bundle queryBundle, final IDerivedTypedElementManager manager) throws DerivedTypedElementException { + final StringLiteralQueryImplementation evaluator = new StringLiteralQueryImplementation(); + evaluator.setCheckResultType(true); + return evaluator; + } + +}
diff --git a/org.eclipse.modisco.facet.efacet.core/src/org/eclipse/modisco/facet/efacet/core/internal/query/TrueLiteralQueryImplementation.java b/org.eclipse.modisco.facet.efacet.core/src/org/eclipse/modisco/facet/efacet/core/internal/query/TrueLiteralQueryImplementation.java new file mode 100644 index 0000000..dfdb1ba --- /dev/null +++ b/org.eclipse.modisco.facet.efacet.core/src/org/eclipse/modisco/facet/efacet/core/internal/query/TrueLiteralQueryImplementation.java
@@ -0,0 +1,48 @@ +/** + * Copyright (c) 2012 Mia-Software. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Gregoire Dupe (Mia-Software) - Bug 369987 - [Restructuring][Table] Switch to the new customization and facet framework + * Nicolas Bros (Mia-Software) - Bug 376941 - [EFacet] Facet operation arguments in Facet model + */ +package org.eclipse.modisco.facet.efacet.core.internal.query; + +import java.util.List; + +import org.eclipse.emf.ecore.EObject; +import org.eclipse.modisco.facet.efacet.core.IFacetManager; +import org.eclipse.modisco.facet.efacet.core.exception.DerivedTypedElementException; +import org.eclipse.modisco.facet.efacet.core.internal.exception.DerivedTypedElementEvaluationException; +import org.eclipse.modisco.facet.efacet.core.query.IQueryImplementation; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.DerivedTypedElement; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.ParameterValue; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.extensible.Query; + +public class TrueLiteralQueryImplementation implements IQueryImplementation { + + private boolean checkResultType = false; + + public Object getValue(final Query query, final DerivedTypedElement feature, final EObject source, final List<ParameterValue> parameterValues, + final IFacetManager facetManager) + throws DerivedTypedElementException { + return Boolean.TRUE; + } + + public void setValue(final Query query, final DerivedTypedElement feature, final EObject source, final List<ParameterValue> parameterValues, + final Object newValue) + throws DerivedTypedElementException { + throw new DerivedTypedElementEvaluationException("Not implemented"); //$NON-NLS-1$ + } + + public void setCheckResultType(final boolean checkResultType) { + this.checkResultType = checkResultType; + } + + public boolean isCheckResultType() { + return this.checkResultType; + } +}
diff --git a/org.eclipse.modisco.facet.efacet.core/src/org/eclipse/modisco/facet/efacet/core/internal/query/TrueLiteralQueryImplementationFactory.java b/org.eclipse.modisco.facet.efacet.core/src/org/eclipse/modisco/facet/efacet/core/internal/query/TrueLiteralQueryImplementationFactory.java new file mode 100644 index 0000000..9ed7d17 --- /dev/null +++ b/org.eclipse.modisco.facet.efacet.core/src/org/eclipse/modisco/facet/efacet/core/internal/query/TrueLiteralQueryImplementationFactory.java
@@ -0,0 +1,36 @@ +/** + * Copyright (c) 2012 Mia-Software. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Grégoire Dupé (Mia-Software) - Bug 369987 - [Restructuring][Table] Switch to the new customization and facet framework + * Nicolas Bros (Mia-Software) - Bug 376941 - [EFacet] Facet operation arguments in Facet model + */ +package org.eclipse.modisco.facet.efacet.core.internal.query; + +import org.eclipse.emf.ecore.EClass; +import org.eclipse.modisco.facet.efacet.core.IDerivedTypedElementManager; +import org.eclipse.modisco.facet.efacet.core.exception.DerivedTypedElementException; +import org.eclipse.modisco.facet.efacet.core.query.IQueryImplementation; +import org.eclipse.modisco.facet.efacet.core.query.IQueryImplementationFactory; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.extensible.Query; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.query.QueryPackage; +import org.osgi.framework.Bundle; + +public class TrueLiteralQueryImplementationFactory implements IQueryImplementationFactory { + + public IQueryImplementation create(final Query query, final Bundle bundle, final IDerivedTypedElementManager derivedTEManager) + throws DerivedTypedElementException { + final TrueLiteralQueryImplementation evaluator = new TrueLiteralQueryImplementation(); + evaluator.setCheckResultType(false); + return evaluator; + } + + public EClass getManagedQueryType() { + return QueryPackage.eINSTANCE.getTrueLiteralQuery(); + } + +}
diff --git a/org.eclipse.modisco.facet.efacet.core/src/org/eclipse/modisco/facet/efacet/core/internal/serialization/ILinkToExtendedEObjectReference.java b/org.eclipse.modisco.facet.efacet.core/src/org/eclipse/modisco/facet/efacet/core/internal/serialization/ILinkToExtendedEObjectReference.java new file mode 100644 index 0000000..5d09071 --- /dev/null +++ b/org.eclipse.modisco.facet.efacet.core/src/org/eclipse/modisco/facet/efacet/core/internal/serialization/ILinkToExtendedEObjectReference.java
@@ -0,0 +1,33 @@ +/******************************************************************************* + * Copyright (c) 2011 Mia-Software + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Emmanuelle Rouillé (Mia-Software) - Bug 352618 - To be able to use non derived facet structural features and save them values. + *******************************************************************************/ +package org.eclipse.modisco.facet.efacet.core.internal.serialization; + +import org.eclipse.emf.ecore.EObject; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.serialization.ExtendedEObjectReference; + +/** + * Interface for the adapter that attaches {@link ExtendedEObjectReference} to {@link EObject}s. + * + * @since 0.2 + */ +public interface ILinkToExtendedEObjectReference { + + /** + * @return the current {@link ExtendedEObjectReference}. + */ + public ExtendedEObjectReference getExtendedEObjectReference(); + + /** + * Replace the current ExtendedEObjectReference by {@link ExtendedEObjectReference}. + */ + public void setExtendedEObjectReference(ExtendedEObjectReference extendedEObjectReference); + +}
diff --git a/org.eclipse.modisco.facet.efacet.core/src/org/eclipse/modisco/facet/efacet/core/internal/serialization/ILinkToExtendedEObjectReferenceAdapterFactory.java b/org.eclipse.modisco.facet.efacet.core/src/org/eclipse/modisco/facet/efacet/core/internal/serialization/ILinkToExtendedEObjectReferenceAdapterFactory.java new file mode 100644 index 0000000..6444f64 --- /dev/null +++ b/org.eclipse.modisco.facet.efacet.core/src/org/eclipse/modisco/facet/efacet/core/internal/serialization/ILinkToExtendedEObjectReferenceAdapterFactory.java
@@ -0,0 +1,40 @@ +/** + * Copyright (c) 2011 Mia-Software. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Emmanuelle Rouillé (Mia-Software) - Bug 352618 - To be able to use non derived facet structural features and save them values. + */ +package org.eclipse.modisco.facet.efacet.core.internal.serialization; + +import org.eclipse.emf.common.notify.Adapter; +import org.eclipse.emf.common.notify.AdapterFactory; +import org.eclipse.emf.common.notify.Notifier; + +/** + * Factory to create {@link ILinkToExtendedEObjectReference} adapters. + * + */ +public interface ILinkToExtendedEObjectReferenceAdapterFactory extends AdapterFactory { + + /** + * Singleton {@link LinkToExtendedEObjectReferenceAdapterFactory} + */ + public static ILinkToExtendedEObjectReferenceAdapterFactory INSTANCE = new LinkToExtendedEObjectReferenceAdapterFactory(); + + /** + * This method returns <code>true</code> if this factory is a factory for the given type + * {@link Object}, or <code>false</code> otherwise + */ + public boolean isFactoryForType(final Object type); + + /** + * Creates a new instance of Adapter for the given {@link Notifier} + */ + public Adapter createAdapter(final Notifier target); + +}
diff --git a/org.eclipse.modisco.facet.efacet.core/src/org/eclipse/modisco/facet/efacet/core/internal/serialization/LinkToExtendedEObjectReferenceAdapter.java b/org.eclipse.modisco.facet.efacet.core/src/org/eclipse/modisco/facet/efacet/core/internal/serialization/LinkToExtendedEObjectReferenceAdapter.java new file mode 100644 index 0000000..242dd12 --- /dev/null +++ b/org.eclipse.modisco.facet.efacet.core/src/org/eclipse/modisco/facet/efacet/core/internal/serialization/LinkToExtendedEObjectReferenceAdapter.java
@@ -0,0 +1,34 @@ +/******************************************************************************* + * Copyright (c) 2011 Mia-Software + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Emmanuelle Rouillé (Mia-Software) - Bug 352618 - To be able to use non derived facet structural features and save them values. + *******************************************************************************/ +package org.eclipse.modisco.facet.efacet.core.internal.serialization; + +import org.eclipse.emf.common.notify.impl.AdapterImpl; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.serialization.ExtendedEObjectReference; + +public class LinkToExtendedEObjectReferenceAdapter extends AdapterImpl implements + ILinkToExtendedEObjectReference { + + private ExtendedEObjectReference extendedEObjectReference; + + public ExtendedEObjectReference getExtendedEObjectReference() { + return this.extendedEObjectReference; + } + + public void setExtendedEObjectReference(final ExtendedEObjectReference extendedEObjectReference) { + this.extendedEObjectReference = extendedEObjectReference; + } + + @Override + public boolean isAdapterForType(final Object type) { + return type == ILinkToExtendedEObjectReference.class; + } + +}
diff --git a/org.eclipse.modisco.facet.efacet.core/src/org/eclipse/modisco/facet/efacet/core/internal/serialization/LinkToExtendedEObjectReferenceAdapterFactory.java b/org.eclipse.modisco.facet.efacet.core/src/org/eclipse/modisco/facet/efacet/core/internal/serialization/LinkToExtendedEObjectReferenceAdapterFactory.java new file mode 100644 index 0000000..5564600 --- /dev/null +++ b/org.eclipse.modisco.facet.efacet.core/src/org/eclipse/modisco/facet/efacet/core/internal/serialization/LinkToExtendedEObjectReferenceAdapterFactory.java
@@ -0,0 +1,29 @@ +/******************************************************************************* + * Copyright (c) 2011 Mia-Software + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Emmanuelle Rouillé (Mia-Software) - Bug 352618 - To be able to use non derived facet structural features and save them values. + *******************************************************************************/ +package org.eclipse.modisco.facet.efacet.core.internal.serialization; + +import org.eclipse.emf.common.notify.Adapter; +import org.eclipse.emf.common.notify.Notifier; +import org.eclipse.emf.common.notify.impl.AdapterFactoryImpl; + +public class LinkToExtendedEObjectReferenceAdapterFactory extends AdapterFactoryImpl implements ILinkToExtendedEObjectReferenceAdapterFactory { + + @Override + public boolean isFactoryForType(final Object type) { + return type == ILinkToExtendedEObjectReference.class; + } + + @Override + public Adapter createAdapter(final Notifier target) { + return new LinkToExtendedEObjectReferenceAdapter(); + } + +}
diff --git a/org.eclipse.modisco.facet.efacet.core/src/org/eclipse/modisco/facet/efacet/core/internal/serialization/SerializationManager.java b/org.eclipse.modisco.facet.efacet.core/src/org/eclipse/modisco/facet/efacet/core/internal/serialization/SerializationManager.java new file mode 100644 index 0000000..219b24e --- /dev/null +++ b/org.eclipse.modisco.facet.efacet.core/src/org/eclipse/modisco/facet/efacet/core/internal/serialization/SerializationManager.java
@@ -0,0 +1,576 @@ +/******************************************************************************* + * Copyright (c) 2011, 2016 Mia-Software, and Soft-Maint. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Emmanuelle Rouillé (Mia-Software) - Bug 352618 - To be able to use non derived facet structural features and save them values. + * Nicolas Bros (Mia-Software) - Bug 361612 - New core for new version of the Facet metamodel + * Grégoire Dupé (Mia-Software) - Bug 361612 - [Restructuring] New core for new version of the Facet metamodel + * Jonathan Pepin (Soft-Maint) - Bug 463898 - Create FacetReference not derived, without query and with opposite mechanism + * Jonathan Pepin (Soft-Maint) - Bug 463907 - Command for load and save Facet serialization + * Jonathan Pepin (Soft-Maint) - Bug 464069 - Applying facet inferred from attribute and reference instances contained in facet serialisation model + * Grégoire Dupé (Mia-Software) - Bug 464069 - Applying facet inferred from attribute and reference instances contained in facet serialisation model + * Jonathan Pepin (Soft-Maint) - Bug 473217 - On SerializationManager getMultiValuedStructuralFeature create ExtendedEObjectReference despite empty instances + * Jonathan Pepin (Soft-Maint) - Bug 473673 - Applying facet inferred from fopposite reference + * Jonathan Pepin (Soft-Maint) - Bug 509427 - Facet attribute always returned null instead of default value + * Jonathan Pepin (Soft-Maint) - Bug 509605 - NullPointerException on SerializationManager getSingleValuedStructuralFeature + * Jonathan Pepin (Soft-Maint) - Bug 510034 - Null value is wrongly casted in a new list + *******************************************************************************/ +package org.eclipse.modisco.facet.efacet.core.internal.serialization; + +import java.io.IOException; +import java.util.Collection; +import java.util.Collections; +import java.util.List; + +import org.eclipse.emf.common.notify.Adapter; +import org.eclipse.emf.common.util.EList; +import org.eclipse.emf.ecore.EAttribute; +import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.ecore.EReference; +import org.eclipse.emf.ecore.EStructuralFeature; +import org.eclipse.emf.ecore.resource.Resource; +import org.eclipse.modisco.facet.efacet.core.IFacetManager; +import org.eclipse.modisco.facet.efacet.core.internal.CastUtils; +import org.eclipse.modisco.facet.efacet.core.internal.FacetManagerInternalUtils; +import org.eclipse.modisco.facet.efacet.core.internal.exception.SaveStructuralFeatureInstanceModelException; +import org.eclipse.modisco.facet.efacet.core.internal.exception.UnmatchingExpectedTypeException; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.serialization.AbstractAttributeInstance; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.serialization.AbstractReferenceInstance; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.serialization.ExtendedEObjectReference; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.serialization.MultiValuedAttributeInstance; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.serialization.MultiValuedContainmentReferenceInstance; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.serialization.MultiValuedReferenceInstance; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.serialization.SerializationFactory; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.serialization.SingleValuedAttributeInstance; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.serialization.SingleValuedContainmentReferenceInstance; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.serialization.SingleValuedReferenceInstance; + +public class SerializationManager { + + private Resource sfInstResource; + private final IFacetManager facetManager; + + public SerializationManager( + final Resource sfInstResource, + final IFacetManager facetManager) { + this.facetManager = facetManager; + setSerializationResource(sfInstResource); + } + + /** + * This method creates a ReferenceInstance in the given {@link ExtendedEObjectReference} with + * the reference {@link EStructuralFeature} and the value {@link Object}. + */ + private static MultiValuedContainmentReferenceInstance createMultiValuedContainmentReferenceInstance(final EReference reference, + final List<EObject> values, + final ExtendedEObjectReference extendedEObjRef) { + final MultiValuedContainmentReferenceInstance containmentRI = SerializationFactory.eINSTANCE + .createMultiValuedContainmentReferenceInstance(); + containmentRI.setEReference(reference); + if (values != null) { + containmentRI.getOwnedElements().addAll(values); + } + extendedEObjRef.getReferenceInstances().add(containmentRI); + return containmentRI; + } + + /** + * This method returns the {@link ExtendedEObjectReference} associated with the given + * {@link EObject} if it exists or <code>null</code> if it does not exist. + */ + private static ExtendedEObjectReference getExtendedEObjectReference(final EObject eObject) { + ExtendedEObjectReference result = null; + for (final Adapter adapter : eObject.eAdapters()) { + if (adapter.isAdapterForType(ILinkToExtendedEObjectReference.class)) { + final LinkToExtendedEObjectReferenceAdapter castedAdapter = (LinkToExtendedEObjectReferenceAdapter) adapter; + result = castedAdapter.getExtendedEObjectReference(); + break; + } + } + return result; + } + + /** + * This method creates an AttributeInstance in the given {@link ExtendedEObjectReference} with + * the attribute {@link EStructuralFeature} and the value {@link Object}. + */ + private static MultiValuedAttributeInstance createMultiValuedAttributeInstance(final EAttribute attribute, final List<Object> values, + final ExtendedEObjectReference extendedEObjRef) { + final MultiValuedAttributeInstance attributeInstance = SerializationFactory.eINSTANCE.createMultiValuedAttributeInstance(); + attributeInstance.setEAttribute(attribute); + if (values != null) { + attributeInstance.getValues().addAll(values); + } + final EList<AbstractAttributeInstance> attInstances = extendedEObjRef + .getAttributeInstances(); + attInstances.add(attributeInstance); + return attributeInstance; + } + + /** + * This method creates a ReferenceInstance in the given {@link ExtendedEObjectReference} with + * the reference {@link EStructuralFeature} and the value {@link Object}. + */ + private static MultiValuedReferenceInstance createMultiValuedReferenceInstance( + final EReference reference, final Collection<EObject> values, + final ExtendedEObjectReference extendedEObjRef) { + final MultiValuedReferenceInstance referenceInstance = SerializationFactory.eINSTANCE + .createMultiValuedReferenceInstance(); + referenceInstance.setEReference(reference); + if (values != null) { + referenceInstance.getReferencedElements().addAll(values); + } + extendedEObjRef.getReferenceInstances().add(referenceInstance); + return referenceInstance; + } + + private static SingleValuedAttributeInstance getSingleValuedAttributeInstance( + final ExtendedEObjectReference extendedEObjRef, + final EAttribute eAttribute) { + SingleValuedAttributeInstance result = null; + final EList<AbstractAttributeInstance> attInstances = extendedEObjRef.getAttributeInstances(); + for (final AbstractAttributeInstance attributeInstance : attInstances) { + if (eAttribute.equals(attributeInstance.getEAttribute())) { + if (attributeInstance instanceof SingleValuedAttributeInstance) { + result = (SingleValuedAttributeInstance) attributeInstance; + break; + } + throw new IllegalStateException("single valued attribute should be associated to an instance of SingleValuedAttributeInstance"); //$NON-NLS-1$ + } + } + return result; + } + + private static MultiValuedAttributeInstance getMultiValuedAttributeInstance( + final ExtendedEObjectReference extendedEObjRef, + final EAttribute eAttribute) { + MultiValuedAttributeInstance result = null; + final EList<AbstractAttributeInstance> attInstances = extendedEObjRef.getAttributeInstances(); + for (final AbstractAttributeInstance attributeInstance : attInstances) { + if (eAttribute.equals(attributeInstance.getEAttribute())) { + if (attributeInstance instanceof MultiValuedAttributeInstance) { + result = (MultiValuedAttributeInstance) attributeInstance; + break; + } + throw new IllegalStateException("multi valued attribute should be associated to an instance of MultiValuedAttributeInstance"); //$NON-NLS-1$ + + } + } + return result; + } + + private static SingleValuedReferenceInstance getSingleValuedReferenceInstance( + final ExtendedEObjectReference extendedEObjRef, + final EReference eReference) { + SingleValuedReferenceInstance result = null; + final EList<AbstractReferenceInstance> refInstances = extendedEObjRef.getReferenceInstances(); + for (final AbstractReferenceInstance referenceInstance : refInstances) { + if (eReference.equals(referenceInstance.getEReference())) { + if (referenceInstance instanceof SingleValuedReferenceInstance) { + result = (SingleValuedReferenceInstance) referenceInstance; + break; + } + throw new IllegalStateException( + "a single valued non-containment reference should be associated to an instance of SingleValuedReferenceInstance"); //$NON-NLS-1$ + } + } + return result; + } + + private static SingleValuedContainmentReferenceInstance getSingleValuedContainmentReferenceInstance( + final ExtendedEObjectReference extendedEObjRef, + final EReference eReference) { + SingleValuedContainmentReferenceInstance result = null; + final EList<AbstractReferenceInstance> refInstances = extendedEObjRef.getReferenceInstances(); + for (final AbstractReferenceInstance referenceInstance : refInstances) { + if (eReference.equals(referenceInstance.getEReference())) { + if (referenceInstance instanceof SingleValuedContainmentReferenceInstance) { + result = (SingleValuedContainmentReferenceInstance) referenceInstance; + break; + } + throw new IllegalStateException( + "a single valued containment reference should be associated to an instance of SingleValuedContainmentReferenceInstance"); //$NON-NLS-1$ + } + } + return result; + } + + private static MultiValuedReferenceInstance getMultiValuedReferenceInstance( + final ExtendedEObjectReference extendedEObjRef, + final EReference eReference) { + MultiValuedReferenceInstance result = null; + final EList<AbstractReferenceInstance> refInstances = extendedEObjRef + .getReferenceInstances(); + for (final AbstractReferenceInstance referenceInstance : refInstances) { + if (eReference.equals(referenceInstance.getEReference())) { + if (referenceInstance instanceof MultiValuedReferenceInstance) { + result = (MultiValuedReferenceInstance) referenceInstance; + break; + } + throw new IllegalStateException( + "a multi valued non-containment reference should be associated to an instance of MultiValuedReferenceInstance"); //$NON-NLS-1$ + } + } + return result; + } + + private static MultiValuedContainmentReferenceInstance getMultiValuedContainmentReferenceInstance( + final ExtendedEObjectReference extendedEObjRef, + final EReference eReference) { + MultiValuedContainmentReferenceInstance result = null; + final EList<AbstractReferenceInstance> refInstances = extendedEObjRef.getReferenceInstances(); + for (final AbstractReferenceInstance referenceInstance : refInstances) { + if (eReference.equals(referenceInstance.getEReference())) { + if (referenceInstance instanceof MultiValuedContainmentReferenceInstance) { + result = (MultiValuedContainmentReferenceInstance) referenceInstance; + break; + } + throw new IllegalStateException( + "a multi valued containment reference should be associated to an instance of MultiValuedContainmentReferenceInstance"); //$NON-NLS-1$ + } + } + return result; + } + + public void saveStructuralFeatureInstanceModel() + throws SaveStructuralFeatureInstanceModelException { + if (this.sfInstResource == null) { + throw new SaveStructuralFeatureInstanceModelException("This facet manager has been initailized with a null structural feature instances resource"); //$NON-NLS-1$ + } + try { + this.sfInstResource.save(Collections.EMPTY_MAP); + } catch (final IOException e) { + throw new SaveStructuralFeatureInstanceModelException(e); + } + } + + /** + * This method returns the ExtendedEObjectReference associated with the given {@link EObject} if + * it exists or creates it if it does not exist. + */ + private ExtendedEObjectReference getOrCreateExtendedEObjectReference(final EObject eObject) { + ExtendedEObjectReference extendedEObjRef = SerializationManager + .getExtendedEObjectReference(eObject); + if (extendedEObjRef == null) { + extendedEObjRef = SerializationFactory.eINSTANCE.createExtendedEObjectReference(); + extendedEObjRef.setExtendedEObject(eObject); + if (this.sfInstResource != null) { + this.sfInstResource.getContents().add(extendedEObjRef); + } + final LinkToExtendedEObjectReferenceAdapter adapter = (LinkToExtendedEObjectReferenceAdapter) ILinkToExtendedEObjectReferenceAdapterFactory.INSTANCE + .adapt(eObject, ILinkToExtendedEObjectReference.class); + adapter.setExtendedEObjectReference(extendedEObjRef); + } + return extendedEObjRef; + } + + public void setAttribute(final EObject eObject, final EAttribute attribute, + final Object newValue) { + final ExtendedEObjectReference extendedEObjRef = this + .getOrCreateExtendedEObjectReference(eObject); + if (attribute.isMany()) { + if (newValue instanceof List) { + // safe to cast + @SuppressWarnings("unchecked") + final List<Object> list = (List<Object>) newValue; + final MultiValuedAttributeInstance attributeInstance = SerializationManager + .getMultiValuedAttributeInstance(extendedEObjRef, + attribute); + if (attributeInstance == null) { + SerializationManager.createMultiValuedAttributeInstance( + attribute, list, extendedEObjRef); + } else { + attributeInstance.getValues().clear(); + attributeInstance.getValues().addAll(list); + } + } else { + throw new IllegalArgumentException("The given FacetAttribute is multiplicity-many, so the value must be a List"); //$NON-NLS-1$ + } + } else { + final SingleValuedAttributeInstance attributeInstance = SerializationManager + .getSingleValuedAttributeInstance(extendedEObjRef, + attribute); + if (attributeInstance == null) { + createSingleValuedAttributeInstance(attribute, newValue, + extendedEObjRef); + } else { + attributeInstance.setValue(newValue); + } + } + + } + + + /** + * This method creates an AttributeInstance in the given {@link ExtendedEObjectReference} with + * the attribute {@link EStructuralFeature} and the value {@link Object}. + */ + private static SingleValuedAttributeInstance createSingleValuedAttributeInstance(final EAttribute attribute, final Object value, + final ExtendedEObjectReference extendedEObjRef) { + final SingleValuedAttributeInstance attributeInstance = SerializationFactory.eINSTANCE + .createSingleValuedAttributeInstance(); + attributeInstance.setEAttribute(attribute); + attributeInstance.setValue(value); + extendedEObjRef.getAttributeInstances().add(attributeInstance); + return attributeInstance; + } + + /** + * This method creates a ReferenceInstance in the given {@link ExtendedEObjectReference} with + * the reference {@link EStructuralFeature} and the value {@link Object}. + */ + private static SingleValuedReferenceInstance createSingleValuedReferenceInstance(final EReference reference, final EObject value, + final ExtendedEObjectReference extendedEObjRef) { + final SingleValuedReferenceInstance referenceInstance = SerializationFactory.eINSTANCE + .createSingleValuedReferenceInstance(); + referenceInstance.setEReference(reference); + referenceInstance.setReferencedElement(value); + final EList<AbstractReferenceInstance> refInstances = extendedEObjRef + .getReferenceInstances(); + refInstances.add(referenceInstance); + return referenceInstance; + } + + public void clearReference(final EObject eObject, final EReference reference) { + final ExtendedEObjectReference extendedEObjRef = this + .getOrCreateExtendedEObjectReference(eObject); + if (reference.isMany()) { + final MultiValuedReferenceInstance mValuedRefInst = getMultiValuedReferenceInstance( + extendedEObjRef, reference); + if (mValuedRefInst != null) { + mValuedRefInst.getReferencedElements().clear(); + } + } else { + if (reference.isContainment()) { + final SingleValuedContainmentReferenceInstance referenceInstance = SerializationManager + .getSingleValuedContainmentReferenceInstance( + extendedEObjRef, reference); + if (referenceInstance != null) { + referenceInstance.setOwnedElement(null); + } + } else { + final SingleValuedReferenceInstance referenceInstance = SerializationManager + .getSingleValuedReferenceInstance(extendedEObjRef, + reference); + if (referenceInstance != null) { + referenceInstance.setReferencedElement(null); + } + } + } + } + + public void setReference(final EObject eObject, final EReference reference, final Object newValue) { + final ExtendedEObjectReference extendedEObjRef = this + .getOrCreateExtendedEObjectReference(eObject); + if (reference.isMany()) { + Collection<EObject> newList; + try { + newList = CastUtils.castToExpectedListType( + newValue, EObject.class, false); + } catch (UnmatchingExpectedTypeException e) { + final String message = String.format( + "The reference %s.%s is multivaluted, that's why the new value must be a list of EObjet.", //$NON-NLS-1$ + reference.getName(), + reference.getEContainingClass().getName()); + throw new IllegalArgumentException(message, e); + } + final MultiValuedReferenceInstance mValuedRefInst = + getMultiValuedReferenceInstance( + extendedEObjRef, + reference); + if (mValuedRefInst == null) { + createMultiValuedReferenceInstance(reference, newList, extendedEObjRef); + } else { + mValuedRefInst.getReferencedElements().clear(); + mValuedRefInst.getReferencedElements().addAll(newList); + } + } else { + if (newValue != null && !(newValue instanceof EObject)) { + throw new IllegalArgumentException("newValue should be an EObject because eStructuralFeature is an EReference"); //$NON-NLS-1$ + } + final EObject newEObjectValue = (EObject) newValue; + if (reference.isContainment()) { + final SingleValuedContainmentReferenceInstance referenceInstance = + SerializationManager.getSingleValuedContainmentReferenceInstance( + extendedEObjRef, + reference); + if (referenceInstance == null) { + createSingleValuedContainmentReferenceInstance( + reference, newEObjectValue, extendedEObjRef); + } else { + referenceInstance.setOwnedElement(newEObjectValue); + } + } else { + final SingleValuedReferenceInstance referenceInstance = + SerializationManager.getSingleValuedReferenceInstance( + extendedEObjRef, reference); + if (referenceInstance == null) { + createSingleValuedReferenceInstance( + reference, newEObjectValue, extendedEObjRef); + } else { + referenceInstance.setReferencedElement(newEObjectValue); + } + } + } + } + + /** + * This method creates a ReferenceInstance in the given {@link ExtendedEObjectReference} with + * the reference {@link EStructuralFeature} and the value {@link Object}. + */ + private static SingleValuedContainmentReferenceInstance createSingleValuedContainmentReferenceInstance(final EReference reference, + final EObject value, + final ExtendedEObjectReference extendedEObjRef) { + final SingleValuedContainmentReferenceInstance containmentRefI = SerializationFactory.eINSTANCE + .createSingleValuedContainmentReferenceInstance(); + containmentRefI.setEReference(reference); + containmentRefI.setOwnedElement(value); + extendedEObjRef.getReferenceInstances().add(containmentRefI); + return containmentRefI; + } + + private static List<?> getMultiValuedStructuralFeature( + final EObject eObject, final EStructuralFeature structuralFeature) { + List<?> result = null; + final ExtendedEObjectReference extendedEObjRef = SerializationManager.getExtendedEObjectReference(eObject); + if (extendedEObjRef == null) { + result = Collections.emptyList(); + } else { + if (structuralFeature instanceof EAttribute) { + final EAttribute eAttribute = (EAttribute) structuralFeature; + final MultiValuedAttributeInstance attributeInstance = SerializationManager + .getMultiValuedAttributeInstance(extendedEObjRef, + eAttribute); + if (attributeInstance != null) { + result = attributeInstance.getValues(); + } + } else if (structuralFeature instanceof EReference) { + final EReference eReference = (EReference) structuralFeature; + if (eReference.isContainment()) { + MultiValuedContainmentReferenceInstance referenceInstance = SerializationManager + .getMultiValuedContainmentReferenceInstance( + extendedEObjRef, eReference); + if (referenceInstance == null) { + referenceInstance = SerializationManager + .createMultiValuedContainmentReferenceInstance( + eReference, null, extendedEObjRef); + result = referenceInstance.getOwnedElements(); + } else { + result = referenceInstance.getOwnedElements(); + } + } else { + MultiValuedReferenceInstance referenceInstance = SerializationManager + .getMultiValuedReferenceInstance(extendedEObjRef, + eReference); + if (referenceInstance == null) { + referenceInstance = SerializationManager + .createMultiValuedReferenceInstance(eReference, + null, extendedEObjRef); + result = referenceInstance.getReferencedElements(); + } else { + result = referenceInstance.getReferencedElements(); + } + } + } else { + final String message = String.format( + "Getting a structural feature of type '%s' is not implemented", //$NON-NLS-1$ + structuralFeature.getClass().getName()); + throw new UnsupportedOperationException(message); + } + } + return result; + } + + private static Object getSingleValuedStructuralFeature(final EObject eObject, final EStructuralFeature structuralFeature) { + Object result = structuralFeature.getDefaultValue(); + final ExtendedEObjectReference extendedEObjRef = SerializationManager + .getExtendedEObjectReference(eObject); + if (extendedEObjRef != null) { + if (structuralFeature instanceof EAttribute) { + final EAttribute eAttribute = (EAttribute) structuralFeature; + final SingleValuedAttributeInstance attributeInstance = SerializationManager + .getSingleValuedAttributeInstance(extendedEObjRef, + eAttribute); + if (attributeInstance != null) { + result = attributeInstance.getValue(); + } + } else if (structuralFeature instanceof EReference) { + final EReference eReference = (EReference) structuralFeature; + if (eReference.isContainment()) { + final SingleValuedContainmentReferenceInstance referenceInstance = SerializationManager + .getSingleValuedContainmentReferenceInstance( + extendedEObjRef, eReference); + if (referenceInstance != null) { + result = referenceInstance.getOwnedElement(); + } + } else { + final SingleValuedReferenceInstance referenceInstance = SerializationManager + .getSingleValuedReferenceInstance(extendedEObjRef, + eReference); + if (referenceInstance != null) { + result = referenceInstance.getReferencedElement(); + } + } + } else { + throw new IllegalArgumentException("Unexpected structuralFeature kind"); //$NON-NLS-1$ + } + } + return result; + } + + public static Object getNotDerivedValue(final EObject eObject, + final EStructuralFeature structuralFeature) { + Object result; + if (structuralFeature.isMany()) { + result = SerializationManager.getMultiValuedStructuralFeature( + eObject, structuralFeature); + } else { + result = SerializationManager.getSingleValuedStructuralFeature(eObject, structuralFeature); + } + return result; + } + + public Resource getSerializationResource() { + return this.sfInstResource; + } + + public final void setSerializationResource(final Resource resource) { + this.sfInstResource = resource; + if (this.sfInstResource != null) { + final EList<EObject> contents = this.sfInstResource.getContents(); + for (EObject eObject : contents) { + if (eObject instanceof ExtendedEObjectReference) { + final ExtendedEObjectReference extendedEObjRef = (ExtendedEObjectReference) eObject; + final EObject extendedEObject = extendedEObjRef.getExtendedEObject(); + final LinkToExtendedEObjectReferenceAdapter adapter = + (LinkToExtendedEObjectReferenceAdapter) ILinkToExtendedEObjectReferenceAdapterFactory + .INSTANCE.adapt( + extendedEObject, + ILinkToExtendedEObjectReference.class); + adapter.setExtendedEObjectReference(extendedEObjRef); + final EList<AbstractAttributeInstance> attInstances = extendedEObjRef + .getAttributeInstances(); + for (final AbstractAttributeInstance attributeInstance : attInstances) { + final EAttribute attribute = attributeInstance + .getEAttribute(); + FacetManagerInternalUtils.loadParentFacetSet(attribute, + this.facetManager); + } + final EList<AbstractReferenceInstance> refInstances = extendedEObjRef + .getReferenceInstances(); + for (final AbstractReferenceInstance referenceInstance : refInstances) { + final EReference reference = referenceInstance + .getEReference(); + FacetManagerInternalUtils.loadParentFacetSet(reference, + this.facetManager); + } + } + } + } + } + +}
diff --git a/org.eclipse.modisco.facet.efacet.core/src/org/eclipse/modisco/facet/efacet/core/query/IQueryCollectionImplementation.java b/org.eclipse.modisco.facet.efacet.core/src/org/eclipse/modisco/facet/efacet/core/query/IQueryCollectionImplementation.java new file mode 100644 index 0000000..530aaae --- /dev/null +++ b/org.eclipse.modisco.facet.efacet.core/src/org/eclipse/modisco/facet/efacet/core/query/IQueryCollectionImplementation.java
@@ -0,0 +1,97 @@ +/******************************************************************************* + * Copyright (c) 2012 CEA LIST. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Nicolas Bros (Mia-Software) - Bug 376941 - [EFacet] Facet operation arguments in Facet model + *******************************************************************************/ +package org.eclipse.modisco.facet.efacet.core.query; + +import java.util.Collection; +import java.util.List; + +import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.ecore.ETypedElement; +import org.eclipse.modisco.facet.efacet.core.exception.DerivedTypedElementException; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.DerivedTypedElement; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.FacetOperation; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.ParameterValue; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.extensible.Query; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.runtime.ETypedElementEObjectListResult; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.runtime.ETypedElementEObjectResult; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.runtime.ETypedElementPrimitiveTypeListResult; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.runtime.ETypedElementPrimitiveTypeResult; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.runtime.ETypedElementResult; + +/** + * This interface can be implemented by EMF Facet query implementations that want to handle multiple evaluation + * themselves, presumably to improve the performance of the evaluation. + * <p> + * If only {@link IQueryImplementation} is implemented, then the framework will perform multiple-evaluation by calling + * the single evaluation multiple times, which may be slow in the case of high-latency implementations. + * + * @since 0.2 + */ +public interface IQueryCollectionImplementation extends IQueryImplementation { + + /** + * This method must be implemented by each sub-class to evaluate a query on a collection of elements. The query + * should be evaluated on each of the elements in the given collection. + * <p> + * This method should throw a {@link DerivedTypedElementException} only if the eTypedElement is an incorrect + * {@link DerivedTypedElement}. But it must not throw an exception if the evaluation of one element fails. Instead, + * it must set the exception on the corresponding result ({@link ETypedElementResult#setException(Throwable)}). + * + * @param query + * The query to evaluate + * @param eTypedElement + * The feature or operation to get on the sources + * @param sources + * The model elements on which the feature or operation is evaluated using the query + * @param arguments + * The parameter values for the eTypedElement (in the case of a {@link FacetOperation}); can be + * <code>null</code> + * @return the result : + * <ul> + * <li> a list of {@link ETypedElementPrimitiveTypeResult} if the eTypedElement is single-valued and returns + * a primitive type <li> a list of {@link ETypedElementPrimitiveTypeListResult} if the eTypedElement is + * multi-valued and returns a primitive type <li> a list of {@link ETypedElementEObjectResult} if the + * eTypedElement is single-valued and returns a model element <li> a list of + * {@link ETypedElementEObjectListResult} if the eTypedElement is multi-valued and returns model elements + * </ul> + * @throws DerivedTypedElementException + * if the given derivedTypedElement is incorrect + */ + List<? extends ETypedElementResult> getValues(Query query, ETypedElement eTypedElement, Collection<? extends EObject> sources, + List<ParameterValue> arguments) + throws DerivedTypedElementException; + + /** + * This method must be implemented by each sub-class to set the values of a collection of elements. The query should + * be used to set the value of each of the elements in the given collection. + * + * @param query + * The query to evaluate + * @param feature + * The derived typed element to set + * @param sources + * The model elements on which the query is evaluated + * @param arguments + * The parameter values for the derived typed element (in the case of a {@link FacetOperation}); can be + * <code>null</code> + * @param newValues + * the new values for the sources; the size of this list must match the size of the list of sources + * @throws DerivedTypedElementException + * if the given derivedTypedElement is incorrect + * @throws DerivedTypedElementEvaluationException + * if the query could not be evaluated correctly + * @throws IllegalArgumentException + * if the given list of values does not match the list of sources + */ + void setValues(Query query, DerivedTypedElement feature, Collection<? extends EObject> sources, List<ParameterValue> arguments, + List<? extends Object> newValues) + throws DerivedTypedElementException; +}
diff --git a/org.eclipse.modisco.facet.efacet.core/src/org/eclipse/modisco/facet/efacet/core/query/IQueryImplementation.java b/org.eclipse.modisco.facet.efacet.core/src/org/eclipse/modisco/facet/efacet/core/query/IQueryImplementation.java new file mode 100644 index 0000000..a1daedd --- /dev/null +++ b/org.eclipse.modisco.facet.efacet.core/src/org/eclipse/modisco/facet/efacet/core/query/IQueryImplementation.java
@@ -0,0 +1,85 @@ +/******************************************************************************* + * Copyright (c) 2012 CEA LIST. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Nicolas Bros (Mia-Software) - Bug 376941 - [EFacet] Facet operation arguments in Facet model + *******************************************************************************/ +package org.eclipse.modisco.facet.efacet.core.query; + +import java.util.List; + +import org.eclipse.emf.ecore.EObject; +import org.eclipse.modisco.facet.efacet.core.IFacetManager; +import org.eclipse.modisco.facet.efacet.core.exception.DerivedTypedElementException; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.DerivedTypedElement; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.FacetOperation; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.ParameterValue; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.extensible.Query; + +/** + * Interface implemented by all EMF Facet query evaluators. + * <p> + * A query evaluator may choose to implement {@link IQueryCollectionImplementation} instead if it wants to improve the + * performance of evaluation on collections of elements. + * + * @since 0.2 + */ +public interface IQueryImplementation { + + /** + * This method must be implemented by each sub class to evaluate a query + * + * @param query + * The query to evaluate + * @param feature + * The feature or operation to get on the source + * @param source + * The model element on which the query is evaluated + * @param parameterValues + * The derived typed element's query parameter values (in the case of a {@link FacetOperation}); can be + * <code>null</code> + * @return the result, which can be either a single object or a collection of values depending on the multiplicity + * of the given derived typed element + * @throws DerivedTypedElementException + * if the query could not be evaluated correctly to get the value + */ + Object getValue(Query query, DerivedTypedElement feature, EObject source, + List<ParameterValue> parameterValues, IFacetManager facetManager) + throws DerivedTypedElementException; + + /** + * This method must be implemented by each sub class that allows to set the value of a derivedTypedElement using a + * query + * + * @param query + * The query that sets the value + * @param feature + * The derived typed element to set + * @param source + * The model element on which the derived typed element must be set + * @param parameterValues + * The query parameter values (in the case of a {@link FacetOperation}); can be <code>null</code> + * @param newValue + * the value to set on the derived typed element + * @throws DerivedTypedElementException + * if the query could not be evaluated correctly to set the value + */ + void setValue(Query query, DerivedTypedElement feature, EObject source, + List<ParameterValue> parameterValues, Object newValue) + throws DerivedTypedElementException; + + /** + * Return whether to check the type of the query result after its evaluation + * <p> + * Normally, this is <code>true</code>, but the query evaluator can choose to skip the check, for example if the + * return type of the query can't be loaded. + * + * @return whether to check the type of the query result after its evaluation + */ + boolean isCheckResultType(); + +}
diff --git a/org.eclipse.modisco.facet.efacet.core/src/org/eclipse/modisco/facet/efacet/core/query/IQueryImplementationFactory.java b/org.eclipse.modisco.facet.efacet.core/src/org/eclipse/modisco/facet/efacet/core/query/IQueryImplementationFactory.java new file mode 100644 index 0000000..d8b622c --- /dev/null +++ b/org.eclipse.modisco.facet.efacet.core/src/org/eclipse/modisco/facet/efacet/core/query/IQueryImplementationFactory.java
@@ -0,0 +1,45 @@ +/******************************************************************************* + * Copyright (c) 2012 CEA LIST. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Nicolas Bros (Mia-Software) - Bug 376941 - [EFacet] Facet operation arguments in Facet model + *******************************************************************************/ +package org.eclipse.modisco.facet.efacet.core.query; + +import org.eclipse.emf.ecore.EClass; +import org.eclipse.modisco.facet.efacet.core.IDerivedTypedElementManager; +import org.eclipse.modisco.facet.efacet.core.exception.DerivedTypedElementException; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.extensible.Query; +import org.osgi.framework.Bundle; + +/** + * This factory allows clients to create a {@link IQueryImplementation} for queries corresponding to this type of + * factory. + * + * @since 0.2 + */ +public interface IQueryImplementationFactory { + + /** + * Create a query implementation for the given query. + * + * @param query + * the query to create an implementation for + * @param queryBundle + * the bundle in which the query is defined. May be <code>null</code> if the query is not defined in a + * {@link Bundle}. + */ + IQueryImplementation create(Query query, Bundle queryBundle, IDerivedTypedElementManager manager) + throws DerivedTypedElementException; + + /** + * Return the type of query handled by this implementation. + * + * @return the type of query this implementation handles. + */ + EClass getManagedQueryType(); +}
diff --git a/org.eclipse.modisco.facet.efacet.edit.core/.settings/org.eclipse.core.resources.prefs b/org.eclipse.modisco.facet.efacet.edit.core/.settings/org.eclipse.core.resources.prefs index c1b62f7..6d919b1 100644 --- a/org.eclipse.modisco.facet.efacet.edit.core/.settings/org.eclipse.core.resources.prefs +++ b/org.eclipse.modisco.facet.efacet.edit.core/.settings/org.eclipse.core.resources.prefs
@@ -1,15 +1,3 @@ -############################################################################### -# Copyright (c) 2015 Soft-Maint. -# All rights reserved. This program and the accompanying materials -# are made available under the terms of the Eclipse Public License v1.0 -# which accompanies this distribution, and is available at -# http://www.eclipse.org/legal/epl-v10.html -# -# Contributors: -# Jonathan Pepin (Soft-Maint) - Bug 474418 - Edit Facet features with Properties View and Commands -# Grégoire Dupé (Mia-Software) - Bug 474418 - Edit Facet features with Properties View and Commands -############################################################################### - eclipse.preferences.version=1 -encoding//src/org/eclipse/emf/facet/efacet/edit/core/internal/messages.properties=UTF-8 +encoding//src/org/eclipse/modisco/facet/efacet/edit/core/internal/messages.properties=UTF-8 encoding/<project>=UTF-8
diff --git a/org.eclipse.modisco.facet.efacet.edit.core/META-INF/MANIFEST.MF b/org.eclipse.modisco.facet.efacet.edit.core/META-INF/MANIFEST.MF index 1650eb5..fae4fd8 100644 --- a/org.eclipse.modisco.facet.efacet.edit.core/META-INF/MANIFEST.MF +++ b/org.eclipse.modisco.facet.efacet.edit.core/META-INF/MANIFEST.MF
@@ -3,7 +3,7 @@ Bundle-Name: %Bundle-Name Bundle-SymbolicName: org.eclipse.emf.facet.efacet.edit.core;singleton:=true Bundle-Version: 1.3.0.qualifier -Bundle-Activator: org.eclipse.emf.facet.efacet.edit.core.internal.Activator +Bundle-Activator: org.eclipse.modisco.facet.efacet.edit.core.internal.Activator Require-Bundle: org.eclipse.core.runtime;bundle-version="3.6.0", org.eclipse.emf.edit;bundle-version="2.6.0", org.eclipse.emf.facet.efacet.core;bundle-version="1.1.0", @@ -11,5 +11,5 @@ Bundle-RequiredExecutionEnvironment: JavaSE-1.8 Bundle-ActivationPolicy: lazy Bundle-Vendor: %Bundle-Vendor -Export-Package: org.eclipse.emf.facet.efacet.edit.core +Export-Package: org.eclipse.modisco.facet.efacet.edit.core Automatic-Module-Name: org.eclipse.emf.facet.efacet.edit.core
diff --git a/org.eclipse.modisco.facet.efacet.edit.core/src/org/eclipse/emf/facet/efacet/edit/core/FacetCommandException.java b/org.eclipse.modisco.facet.efacet.edit.core/src/org/eclipse/emf/facet/efacet/edit/core/FacetCommandException.java deleted file mode 100644 index 993a9c6..0000000 --- a/org.eclipse.modisco.facet.efacet.edit.core/src/org/eclipse/emf/facet/efacet/edit/core/FacetCommandException.java +++ /dev/null
@@ -1,39 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2015 Soft-Maint. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Jonathan Pepin (Soft-Maint) - Bug 474418 - Edit Facet features with Properties View and Commands - *******************************************************************************/ - -package org.eclipse.emf.facet.efacet.edit.core; - -/** - * @noextend This class is not intended to be extended by clients. - * @noinstantiate This class is not intended to be instantiated by clients. - */ - -public class FacetCommandException extends Exception { - - private static final long serialVersionUID = -733596720669335025L; - - public FacetCommandException() { - super(); - } - - public FacetCommandException(final String message, final Throwable cause) { - super(message, cause); - } - - public FacetCommandException(final String message) { - super(message); - } - - public FacetCommandException(final Throwable cause) { - super(cause); - } - -}
diff --git a/org.eclipse.modisco.facet.efacet.edit.core/src/org/eclipse/emf/facet/efacet/edit/core/IFacetCommandFactory.java b/org.eclipse.modisco.facet.efacet.edit.core/src/org/eclipse/emf/facet/efacet/edit/core/IFacetCommandFactory.java deleted file mode 100644 index 9636560..0000000 --- a/org.eclipse.modisco.facet.efacet.edit.core/src/org/eclipse/emf/facet/efacet/edit/core/IFacetCommandFactory.java +++ /dev/null
@@ -1,83 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2015 Soft-Maint. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Jonathan Pepin (Soft-Maint) - Bug 474418 - Edit Facet features with Properties View and Commands - *******************************************************************************/ - -package org.eclipse.emf.facet.efacet.edit.core; - -import java.util.Collection; - -import org.eclipse.emf.common.command.Command; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.EStructuralFeature; -import org.eclipse.emf.edit.domain.EditingDomain; -import org.eclipse.emf.facet.efacet.core.IFacetManager; -import org.eclipse.emf.facet.efacet.edit.core.internal.command.FacetCommandFactory; - -/** - * @noimplement This interface is not intended to be implemented by clients. - * @noextend This interface is not intended to be extended by clients. - */ -public interface IFacetCommandFactory { - - IFacetCommandFactory DEFAULT = new FacetCommandFactory(); - - /** - * @param feature - * must be multi-valued - * @throws FacetCommandException - * @throws IllegalArgumentException - * if the parameter 'feature' is not multi-valued - */ - Command createAddCommand(EObject owner, EStructuralFeature feature, - Object newValue, EditingDomain domain, IFacetManager facetManager) - throws FacetCommandException; - - /** - * @param feature - * must be multi-valued - * @throws FacetCommandException - * @throws IllegalArgumentException - * if the parameter 'feature' is not multi-valued - */ - Command createAddAllCommand(EObject owner, EStructuralFeature feature, - Collection<? extends Object> newValues, EditingDomain domain, - IFacetManager facetManager) throws FacetCommandException; - - /** - * @param feature - * must be multi-valued - * @throws FacetCommandException - * @throws IllegalArgumentException - * if the parameter 'feature' is not multi-valued - */ - Command createRemoveCommand(EObject owner, EStructuralFeature feature, - Object value, EditingDomain domain, IFacetManager facetManager) - throws FacetCommandException; - - /** - * @param feature - * must be multi-valued - * @throws FacetCommandException - * @throws IllegalArgumentException - * if the parameter 'feature' is not multi-valued - */ - Command createRemoveAllCommand(EObject owner, EStructuralFeature feature, - Collection<? extends Object> values, EditingDomain domain, - IFacetManager facetManager) throws FacetCommandException; - - Command createSetCommand(EObject owner, EStructuralFeature feature, - Object newValue, EditingDomain domain, IFacetManager facetManager) - throws FacetCommandException; - - Command createUnSetCommand(EObject owner, EStructuralFeature feature, - EditingDomain domain, IFacetManager facetManager) - throws FacetCommandException; - -}
diff --git a/org.eclipse.modisco.facet.efacet.edit.core/src/org/eclipse/emf/facet/efacet/edit/core/internal/Activator.java b/org.eclipse.modisco.facet.efacet.edit.core/src/org/eclipse/emf/facet/efacet/edit/core/internal/Activator.java deleted file mode 100644 index 64e6491..0000000 --- a/org.eclipse.modisco.facet.efacet.edit.core/src/org/eclipse/emf/facet/efacet/edit/core/internal/Activator.java +++ /dev/null
@@ -1,51 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2015 Soft-Maint. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Jonathan Pepin (Soft-Maint) - Bug 474418 - Edit Facet features with Properties View and Commands - *******************************************************************************/ - -package org.eclipse.emf.facet.efacet.edit.core.internal; - -import org.eclipse.core.runtime.Plugin; -import org.osgi.framework.BundleContext; - -@SuppressWarnings("PMD.UseSingleton") -// @SuppressWarnings("PMD.UseSingleton") We cannot conforms to this rule because -// this class is an Eclipse plug-in activator which will be instantiated by the -// Eclipse framework. -public class Activator extends Plugin { - - private static Activator plugin; - - @Override - @SuppressWarnings("PMD.SignatureDeclareThrowsException") - // @SuppressWarnings("PMD.SignatureDeclareThrowsException") We have to use - // this signature because this is an override of an Eclipse framework's - // method. - public void start(final BundleContext bundleContext) throws Exception { - super.start(bundleContext); - Activator.plugin = this; - } - - @Override - @SuppressWarnings("PMD.SignatureDeclareThrowsException") - // @SuppressWarnings("PMD.SignatureDeclareThrowsException") We have to use - // this signature because this is an override of an Eclipse framework's - // method. - public void stop(final BundleContext bundleContext) throws Exception { - // NOPMD: PMD say "Assigning an Object to null is a code smell." - // No choice to right it in another way : this is an Eclipse pattern. - Activator.plugin = null; // NOPMD by gdupe on 30/03/12 10:19 - super.stop(bundleContext); - } - - public static Plugin getDefault() { - return Activator.plugin; - } - -}
diff --git a/org.eclipse.modisco.facet.efacet.edit.core/src/org/eclipse/emf/facet/efacet/edit/core/internal/FacetCommandRuntimeException.java b/org.eclipse.modisco.facet.efacet.edit.core/src/org/eclipse/emf/facet/efacet/edit/core/internal/FacetCommandRuntimeException.java deleted file mode 100644 index d17f1ba..0000000 --- a/org.eclipse.modisco.facet.efacet.edit.core/src/org/eclipse/emf/facet/efacet/edit/core/internal/FacetCommandRuntimeException.java +++ /dev/null
@@ -1,35 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2015 Soft-Maint. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Jonathan Pepin (Soft-Maint) - Bug 474418 - Edit Facet features with Properties View and Commands - *******************************************************************************/ - -package org.eclipse.emf.facet.efacet.edit.core.internal; - -public class FacetCommandRuntimeException extends RuntimeException { - - private static final long serialVersionUID = 5723089148270269294L; - - public FacetCommandRuntimeException() { - super(); - } - - public FacetCommandRuntimeException(final String message, - final Throwable cause) { - super(message, cause); - } - - public FacetCommandRuntimeException(final String message) { - super(message); - } - - public FacetCommandRuntimeException(final Throwable cause) { - super(cause); - } - -}
diff --git a/org.eclipse.modisco.facet.efacet.edit.core/src/org/eclipse/emf/facet/efacet/edit/core/internal/Messages.java b/org.eclipse.modisco.facet.efacet.edit.core/src/org/eclipse/emf/facet/efacet/edit/core/internal/Messages.java deleted file mode 100644 index 3c235a1..0000000 --- a/org.eclipse.modisco.facet.efacet.edit.core/src/org/eclipse/emf/facet/efacet/edit/core/internal/Messages.java +++ /dev/null
@@ -1,37 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2015 Soft-Maint. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Jonathan Pepin (Soft-Maint) - Bug 474418 - Edit Facet features with Properties View and Commands - *******************************************************************************/ - -package org.eclipse.emf.facet.efacet.edit.core.internal; - -import org.eclipse.osgi.util.NLS; - -public class Messages extends NLS { - private static final String BUNDLE_NAME = "org.eclipse.emf.facet.efacet.edit.core.internal.messages"; //$NON-NLS-1$ - public static String FacetAddAllCommand_Descriptor; - public static String FacetAddAllCommand_Label; - public static String FacetAddCommand_Description; - public static String FacetAddCommand_Label; - public static String FacetRemoveAllCommand_Description; - public static String FacetRemoveAllCommand_Label; - public static String FacetRemoveCommand_Description; - public static String FacetRemoveCommand_Label; - public static String FacetSetCommand_Description; - public static String FacetSetCommand_Label; - public static String FacetUnSetCommand_Description; - public static String FacetUnSetCommand_Label; - static { - // initialize resource bundle - NLS.initializeMessages(BUNDLE_NAME, Messages.class); - } - - private Messages() { - } -}
diff --git a/org.eclipse.modisco.facet.efacet.edit.core/src/org/eclipse/emf/facet/efacet/edit/core/internal/command/AbstractFacetCommand.java b/org.eclipse.modisco.facet.efacet.edit.core/src/org/eclipse/emf/facet/efacet/edit/core/internal/command/AbstractFacetCommand.java deleted file mode 100644 index ed5c6a6..0000000 --- a/org.eclipse.modisco.facet.efacet.edit.core/src/org/eclipse/emf/facet/efacet/edit/core/internal/command/AbstractFacetCommand.java +++ /dev/null
@@ -1,114 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2015 Soft-Maint. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Jonathan Pepin (Soft-Maint) - Bug 474418 - Edit Facet features with Properties View and Commands - *******************************************************************************/ - -package org.eclipse.emf.facet.efacet.edit.core.internal.command; - -import java.util.List; -import java.util.Set; - -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.EStructuralFeature; -import org.eclipse.emf.edit.command.AbstractOverrideableCommand; -import org.eclipse.emf.edit.domain.EditingDomain; -import org.eclipse.emf.facet.efacet.core.FacetUtils; -import org.eclipse.emf.facet.efacet.core.IFacetManager; -import org.eclipse.emf.facet.efacet.core.exception.FacetManagerException; -import org.eclipse.emf.facet.efacet.edit.core.FacetCommandException; -import org.eclipse.emf.facet.efacet.edit.core.internal.Activator; -import org.eclipse.emf.facet.efacet.edit.core.internal.FacetCommandRuntimeException; -import org.eclipse.emf.facet.util.core.Logger; - -public abstract class AbstractFacetCommand extends AbstractOverrideableCommand { - - private final EObject owner; - private final EStructuralFeature feature; - - private final IFacetManager facetManager; - - public AbstractFacetCommand(final EObject owner, - final EStructuralFeature feature, final EditingDomain domain, - final IFacetManager facetManager, final String label, - final String description) { - super(domain, label, description); - this.owner = owner; - this.feature = feature; - this.facetManager = facetManager; - } - - /** - * check if facet structurual feature exist in owner - */ - @Override - public boolean doCanExecute() { - boolean result = false; - try { - final Set<EStructuralFeature> features = FacetUtils - .getETypedElements(this.owner, EStructuralFeature.class, - this.facetManager); - result = features.contains(this.feature); - } catch (final FacetManagerException e) { - final String msg = String.format( -" When evaluation doCanExecute on %s.%s, the facetManager called return error.", //$NON-NLS-1$ - this.owner, this.feature); - Logger.logError(e, msg, Activator.getDefault()); - } - return result; - } - - protected Object getCurrentValue() throws FacetCommandException { - Object result = null; - if (doCanExecute()) { - try { - if (!this.feature.isMany()) { - result = this.facetManager.getOrInvoke(this.owner, - this.feature, Object.class); - } - } catch (final FacetManagerException e) { - throw new FacetCommandException( - "When getCurrentValue method invoked, the facetManager called return error", e); //$NON-NLS-1$ - } - } - return result; - } - - protected List<Object> getCurrentValues() throws FacetCommandException { - List<Object> result = null; - if (doCanExecute()) { - try { - if (this.feature.isMany()) { - result = this.facetManager.getOrInvokeMultiValued( - this.owner, this.feature, Object.class); - } - } catch (final FacetManagerException e) { - throw new FacetCommandException( - "When getCurrentValues method invoked, the facetManager return error", e); //$NON-NLS-1$ - } - } - return result; - } - - protected void set(final Object value) { - try { - this.facetManager.set(this.owner, this.feature, value, this.domain); - } catch (final FacetManagerException e) { - final String msg = String.format( - "Can set value %s in the facet, the facetManager return error", //$NON-NLS-1$ - value.toString()); - Logger.logError(e, msg, Activator.getDefault()); - throw new FacetCommandRuntimeException(msg, e); - } - } - - protected EStructuralFeature getFeature() { - return this.feature; - } - -}
diff --git a/org.eclipse.modisco.facet.efacet.edit.core/src/org/eclipse/emf/facet/efacet/edit/core/internal/command/FacetAddAllCommand.java b/org.eclipse.modisco.facet.efacet.edit.core/src/org/eclipse/emf/facet/efacet/edit/core/internal/command/FacetAddAllCommand.java deleted file mode 100644 index e64195f..0000000 --- a/org.eclipse.modisco.facet.efacet.edit.core/src/org/eclipse/emf/facet/efacet/edit/core/internal/command/FacetAddAllCommand.java +++ /dev/null
@@ -1,71 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2015 Soft-Maint. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Jonathan Pepin (Soft-Maint) - Bug 474418 - Edit Facet features with Properties View and Commands - *******************************************************************************/ - -package org.eclipse.emf.facet.efacet.edit.core.internal.command; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.List; - -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.EStructuralFeature; -import org.eclipse.emf.edit.domain.EditingDomain; -import org.eclipse.emf.facet.efacet.core.IFacetManager; -import org.eclipse.emf.facet.efacet.edit.core.FacetCommandException; -import org.eclipse.emf.facet.efacet.edit.core.internal.Messages; - -/** - * The add all command logically acts upon an owner object that has a - * collection-based feature to which other objects can be added. - * - */ -public class FacetAddAllCommand extends AbstractFacetCommand { - - private static final String LABEL = Messages.FacetAddAllCommand_Label; - private static final String DESCRIPTION = Messages.FacetAddAllCommand_Descriptor; - - private final List<Object> oldValues; - private List<Object> newValues; - private final Collection<? extends Object> newValuesToAdd; - - public FacetAddAllCommand(final EObject owner, - final EStructuralFeature feature, - final Collection<? extends Object> newValues, - final EditingDomain domain, final IFacetManager facetManager) - throws FacetCommandException { - super(owner, feature, domain, facetManager, LABEL, DESCRIPTION); - this.newValuesToAdd = newValues; - this.oldValues = getCurrentValues(); - } - - @Override - public boolean doCanExecute() { - return super.doCanExecute() && getFeature().isMany(); - } - - @Override - public void doExecute() { - this.newValues = new ArrayList<Object>(this.oldValues); - this.newValues.addAll(this.newValuesToAdd); - set(this.newValues); - } - - @Override - public void doUndo() { - set(this.oldValues); - } - - @Override - public void doRedo() { - set(this.newValues); - } - -}
diff --git a/org.eclipse.modisco.facet.efacet.edit.core/src/org/eclipse/emf/facet/efacet/edit/core/internal/command/FacetAddCommand.java b/org.eclipse.modisco.facet.efacet.edit.core/src/org/eclipse/emf/facet/efacet/edit/core/internal/command/FacetAddCommand.java deleted file mode 100644 index 86d8021..0000000 --- a/org.eclipse.modisco.facet.efacet.edit.core/src/org/eclipse/emf/facet/efacet/edit/core/internal/command/FacetAddCommand.java +++ /dev/null
@@ -1,69 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2015 Soft-Maint. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Jonathan Pepin (Soft-Maint) - Bug 474418 - Edit Facet features with Properties View and Commands - *******************************************************************************/ - -package org.eclipse.emf.facet.efacet.edit.core.internal.command; - -import java.util.ArrayList; -import java.util.List; - -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.EStructuralFeature; -import org.eclipse.emf.edit.domain.EditingDomain; -import org.eclipse.emf.facet.efacet.core.IFacetManager; -import org.eclipse.emf.facet.efacet.edit.core.FacetCommandException; -import org.eclipse.emf.facet.efacet.edit.core.internal.Messages; - -/** - * The add command logically acts upon an owner object that has a - * collection-based feature to which other objects can be added. - * - */ -public class FacetAddCommand extends AbstractFacetCommand { - - private static final String LABEL = Messages.FacetAddCommand_Label; - private static final String DESCRIPTION = Messages.FacetAddCommand_Description; - - private final Object newValue; - private final List<Object> oldValues; - private List<Object> newValues; - - public FacetAddCommand(final EObject owner, - final EStructuralFeature feature, final Object newValue, - final EditingDomain domain, final IFacetManager facetManager) - throws FacetCommandException { - super(owner, feature, domain, facetManager, LABEL, DESCRIPTION); - this.newValue = newValue; - this.oldValues = getCurrentValues(); - } - - @Override - public boolean doCanExecute() { - return super.doCanExecute() && getFeature().isMany(); - } - - @Override - public void doExecute() { - this.newValues = new ArrayList<Object>(this.oldValues); - this.newValues.add(this.newValue); - set(this.newValues); - } - - @Override - public void doUndo() { - set(this.oldValues); - } - - @Override - public void doRedo() { - set(this.newValues); - } - -}
diff --git a/org.eclipse.modisco.facet.efacet.edit.core/src/org/eclipse/emf/facet/efacet/edit/core/internal/command/FacetCommandFactory.java b/org.eclipse.modisco.facet.efacet.edit.core/src/org/eclipse/emf/facet/efacet/edit/core/internal/command/FacetCommandFactory.java deleted file mode 100644 index f3499da..0000000 --- a/org.eclipse.modisco.facet.efacet.edit.core/src/org/eclipse/emf/facet/efacet/edit/core/internal/command/FacetCommandFactory.java +++ /dev/null
@@ -1,98 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2015 Soft-Maint. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Jonathan Pepin (Soft-Maint) - Bug 474418 - Edit Facet features with Properties View and Commands - *******************************************************************************/ - -package org.eclipse.emf.facet.efacet.edit.core.internal.command; - -import java.util.Collection; - -import org.eclipse.emf.common.command.Command; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.EStructuralFeature; -import org.eclipse.emf.edit.domain.EditingDomain; -import org.eclipse.emf.facet.efacet.core.IFacetManager; -import org.eclipse.emf.facet.efacet.edit.core.FacetCommandException; -import org.eclipse.emf.facet.efacet.edit.core.IFacetCommandFactory; - -public class FacetCommandFactory implements IFacetCommandFactory { - - public Command createAddCommand(final EObject owner, - final EStructuralFeature feature, final Object newValue, - final EditingDomain domain, final IFacetManager facetManager) - throws FacetCommandException { - if (!feature.isMany()) { - final String msg = String.format( - "On createAddCommand feature %s must be multi-valued !", //$NON-NLS-1$ - feature.getName()); - throw new IllegalArgumentException(msg); - } - return new FacetAddCommand(owner, feature, newValue, domain, - facetManager); - } - - public Command createAddAllCommand(final EObject owner, - final EStructuralFeature feature, - final Collection<? extends Object> newValues, - final EditingDomain domain, final IFacetManager facetManager) - throws FacetCommandException { - if (!feature.isMany()) { - final String msg = String.format( - "On createAddAllCommand feature %s must be multi-valued !", //$NON-NLS-1$ - feature.getName()); - throw new IllegalArgumentException(msg); - } - return new FacetAddAllCommand(owner, feature, newValues, domain, - facetManager); - } - - public Command createRemoveCommand(final EObject owner, - final EStructuralFeature feature, final Object value, - final EditingDomain domain, final IFacetManager facetManager) - throws FacetCommandException { - if (!feature.isMany()) { - final String msg = String.format( - "On createRemoveCommand feature %s must be multi-valued !", //$NON-NLS-1$ - feature.getName()); - throw new IllegalArgumentException(msg); - } - return new FacetRemoveCommand(owner, feature, value, domain, - facetManager); - } - - public Command createRemoveAllCommand(final EObject owner, - final EStructuralFeature feature, - final Collection<? extends Object> values, - final EditingDomain domain, final IFacetManager facetManager) - throws FacetCommandException { - if (!feature.isMany()) { - final String msg = String.format( - "On createRemoveAllCommand feature %s must be multi-valued !", //$NON-NLS-1$ - feature.getName()); - throw new IllegalArgumentException(msg); - } - return new FacetRemoveAllCommand(owner, feature, values, domain, - facetManager); - } - - public Command createSetCommand(final EObject owner, - final EStructuralFeature feature, final Object newValue, - final EditingDomain domain, final IFacetManager facetManager) - throws FacetCommandException { - return new FacetSetCommand(owner, feature, newValue, domain, - facetManager); - } - - public Command createUnSetCommand(final EObject owner, - final EStructuralFeature feature, final EditingDomain domain, - final IFacetManager facetManager) throws FacetCommandException { - return new FacetUnSetCommand(owner, feature, domain, facetManager); - } - -}
diff --git a/org.eclipse.modisco.facet.efacet.edit.core/src/org/eclipse/emf/facet/efacet/edit/core/internal/command/FacetRemoveAllCommand.java b/org.eclipse.modisco.facet.efacet.edit.core/src/org/eclipse/emf/facet/efacet/edit/core/internal/command/FacetRemoveAllCommand.java deleted file mode 100644 index e3d981e..0000000 --- a/org.eclipse.modisco.facet.efacet.edit.core/src/org/eclipse/emf/facet/efacet/edit/core/internal/command/FacetRemoveAllCommand.java +++ /dev/null
@@ -1,66 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2015 Soft-Maint. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Jonathan Pepin (Soft-Maint) - Bug 474418 - Edit Facet features with Properties View and Commands - *******************************************************************************/ - -package org.eclipse.emf.facet.efacet.edit.core.internal.command; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.List; - -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.EStructuralFeature; -import org.eclipse.emf.edit.domain.EditingDomain; -import org.eclipse.emf.facet.efacet.core.IFacetManager; -import org.eclipse.emf.facet.efacet.edit.core.FacetCommandException; -import org.eclipse.emf.facet.efacet.edit.core.internal.Messages; - -/** - * The remove all command logically acts upon an owner object that has a - * collection-based feature to which other objects can be removed. - * - */ -public class FacetRemoveAllCommand extends AbstractFacetCommand { - - private static final String LABEL = Messages.FacetRemoveAllCommand_Label; - private static final String DESCRIPTION = Messages.FacetRemoveAllCommand_Description; - - private final List<Object> oldValues; - private List<Object> newValues; - private final Collection<? extends Object> valuesToRemove; - - public FacetRemoveAllCommand(final EObject owner, - final EStructuralFeature feature, - final Collection<? extends Object> values, - final EditingDomain domain, final IFacetManager facetManager) - throws FacetCommandException { - super(owner, feature, domain, facetManager, LABEL, DESCRIPTION); - this.oldValues = getCurrentValues(); - this.valuesToRemove = values; - } - - @Override - public void doExecute() { - this.newValues = new ArrayList<Object>(this.oldValues); - this.newValues.removeAll(this.valuesToRemove); - set(this.newValues); - } - - @Override - public void doUndo() { - set(this.oldValues); - } - - @Override - public void doRedo() { - set(this.newValues); - } - -}
diff --git a/org.eclipse.modisco.facet.efacet.edit.core/src/org/eclipse/emf/facet/efacet/edit/core/internal/command/FacetRemoveCommand.java b/org.eclipse.modisco.facet.efacet.edit.core/src/org/eclipse/emf/facet/efacet/edit/core/internal/command/FacetRemoveCommand.java deleted file mode 100644 index 239b46d..0000000 --- a/org.eclipse.modisco.facet.efacet.edit.core/src/org/eclipse/emf/facet/efacet/edit/core/internal/command/FacetRemoveCommand.java +++ /dev/null
@@ -1,64 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2015 Soft-Maint. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Jonathan Pepin (Soft-Maint) - Bug 474418 - Edit Facet features with Properties View and Commands - *******************************************************************************/ - -package org.eclipse.emf.facet.efacet.edit.core.internal.command; - -import java.util.ArrayList; -import java.util.List; - -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.EStructuralFeature; -import org.eclipse.emf.edit.domain.EditingDomain; -import org.eclipse.emf.facet.efacet.core.IFacetManager; -import org.eclipse.emf.facet.efacet.edit.core.FacetCommandException; -import org.eclipse.emf.facet.efacet.edit.core.internal.Messages; - -/** - * The remove command logically acts upon an owner object that has a - * collection-based feature to which other objects can be removed. - * - */ -public class FacetRemoveCommand extends AbstractFacetCommand { - - private static final String LABEL = Messages.FacetRemoveCommand_Label; - private static final String DESCRIPTION = Messages.FacetRemoveCommand_Description; - - private final List<Object> oldValues; - private List<Object> newValues; - private final Object valueToRemove; - - public FacetRemoveCommand(final EObject owner, - final EStructuralFeature feature, final Object value, - final EditingDomain domain, final IFacetManager facetManager) - throws FacetCommandException { - super(owner, feature, domain, facetManager, LABEL, DESCRIPTION); - this.oldValues = getCurrentValues(); - this.valueToRemove = value; - } - - @Override - public void doExecute() { - this.newValues = new ArrayList<Object>(this.oldValues); - this.newValues.remove(this.valueToRemove); - set(this.newValues); - } - - @Override - public void doUndo() { - set(this.oldValues); - } - - @Override - public void doRedo() { - set(this.newValues); - } - -}
diff --git a/org.eclipse.modisco.facet.efacet.edit.core/src/org/eclipse/emf/facet/efacet/edit/core/internal/command/FacetSetCommand.java b/org.eclipse.modisco.facet.efacet.edit.core/src/org/eclipse/emf/facet/efacet/edit/core/internal/command/FacetSetCommand.java deleted file mode 100644 index cfd8d6c..0000000 --- a/org.eclipse.modisco.facet.efacet.edit.core/src/org/eclipse/emf/facet/efacet/edit/core/internal/command/FacetSetCommand.java +++ /dev/null
@@ -1,57 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2015 Soft-Maint. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Jonathan Pepin (Soft-Maint) - Bug 474418 - Edit Facet features with Properties View and Commands - *******************************************************************************/ - -package org.eclipse.emf.facet.efacet.edit.core.internal.command; - -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.EStructuralFeature; -import org.eclipse.emf.edit.domain.EditingDomain; -import org.eclipse.emf.facet.efacet.core.IFacetManager; -import org.eclipse.emf.facet.efacet.edit.core.FacetCommandException; -import org.eclipse.emf.facet.efacet.edit.core.internal.Messages; - -/** - * The set command logically acts upon an owner object to set a particular - * feature to a specified value. - */ -public class FacetSetCommand extends AbstractFacetCommand { - - private static final String LABEL = Messages.FacetSetCommand_Label; - private static final String DESCRIPTION = Messages.FacetSetCommand_Description; - - private final Object newValue; - private final Object oldValue; - - public FacetSetCommand(final EObject owner, - final EStructuralFeature feature, final Object newValue, - final EditingDomain domain, final IFacetManager facetManager) - throws FacetCommandException { - super(owner, feature, domain, facetManager, LABEL, DESCRIPTION); - this.newValue = newValue; - this.oldValue = getCurrentValue(); - } - - @Override - public void doExecute() { - set(this.newValue); - } - - @Override - public void doUndo() { - set(this.oldValue); - } - - @Override - public void doRedo() { - set(this.newValue); - } - -}
diff --git a/org.eclipse.modisco.facet.efacet.edit.core/src/org/eclipse/emf/facet/efacet/edit/core/internal/command/FacetUnSetCommand.java b/org.eclipse.modisco.facet.efacet.edit.core/src/org/eclipse/emf/facet/efacet/edit/core/internal/command/FacetUnSetCommand.java deleted file mode 100644 index 622edc0..0000000 --- a/org.eclipse.modisco.facet.efacet.edit.core/src/org/eclipse/emf/facet/efacet/edit/core/internal/command/FacetUnSetCommand.java +++ /dev/null
@@ -1,66 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2015 Soft-Maint. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Jonathan Pepin (Soft-Maint) - Bug 474418 - Edit Facet features with Properties View and Commands - *******************************************************************************/ - -package org.eclipse.emf.facet.efacet.edit.core.internal.command; - -import java.util.ArrayList; -import java.util.List; - -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.EStructuralFeature; -import org.eclipse.emf.edit.domain.EditingDomain; -import org.eclipse.emf.facet.efacet.core.IFacetManager; -import org.eclipse.emf.facet.efacet.edit.core.FacetCommandException; -import org.eclipse.emf.facet.efacet.edit.core.internal.Messages; - -/** - * The unset command logically acts upon an owner object to unset a particular - * feature. - */ -public class FacetUnSetCommand extends AbstractFacetCommand { - - private static final String LABEL = Messages.FacetUnSetCommand_Label; - private static final String DESCRIPTION = Messages.FacetUnSetCommand_Description; - - private List<Object> oldValues; - private Object oldValue; - - public FacetUnSetCommand(final EObject owner, - final EStructuralFeature feature, final EditingDomain domain, - final IFacetManager facetManager) throws FacetCommandException { - super(owner, feature, domain, facetManager, LABEL, DESCRIPTION); - if (getFeature().isMany()) { - this.oldValues = new ArrayList<Object>(getCurrentValues()); - } else { - this.oldValue = getCurrentValue(); - } - } - - @Override - public void doExecute() { - set(null); - } - - @Override - public void doUndo() { - if (getFeature().isMany()) { - set(this.oldValues); - } else { - set(this.oldValue); - } - } - - @Override - public void doRedo() { - set(null); - } - -}
diff --git a/org.eclipse.modisco.facet.efacet.edit.core/src/org/eclipse/modisco/facet/efacet/edit/core/FacetCommandException.java b/org.eclipse.modisco.facet.efacet.edit.core/src/org/eclipse/modisco/facet/efacet/edit/core/FacetCommandException.java new file mode 100644 index 0000000..e84e56f --- /dev/null +++ b/org.eclipse.modisco.facet.efacet.edit.core/src/org/eclipse/modisco/facet/efacet/edit/core/FacetCommandException.java
@@ -0,0 +1,39 @@ +/******************************************************************************* + * Copyright (c) 2015 Soft-Maint. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Jonathan Pepin (Soft-Maint) - Bug 474418 - Edit Facet features with Properties View and Commands + *******************************************************************************/ + +package org.eclipse.modisco.facet.efacet.edit.core; + +/** + * @noextend This class is not intended to be extended by clients. + * @noinstantiate This class is not intended to be instantiated by clients. + */ + +public class FacetCommandException extends Exception { + + private static final long serialVersionUID = -733596720669335025L; + + public FacetCommandException() { + super(); + } + + public FacetCommandException(final String message, final Throwable cause) { + super(message, cause); + } + + public FacetCommandException(final String message) { + super(message); + } + + public FacetCommandException(final Throwable cause) { + super(cause); + } + +}
diff --git a/org.eclipse.modisco.facet.efacet.edit.core/src/org/eclipse/modisco/facet/efacet/edit/core/IFacetCommandFactory.java b/org.eclipse.modisco.facet.efacet.edit.core/src/org/eclipse/modisco/facet/efacet/edit/core/IFacetCommandFactory.java new file mode 100644 index 0000000..c10bdf5 --- /dev/null +++ b/org.eclipse.modisco.facet.efacet.edit.core/src/org/eclipse/modisco/facet/efacet/edit/core/IFacetCommandFactory.java
@@ -0,0 +1,83 @@ +/******************************************************************************* + * Copyright (c) 2015 Soft-Maint. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Jonathan Pepin (Soft-Maint) - Bug 474418 - Edit Facet features with Properties View and Commands + *******************************************************************************/ + +package org.eclipse.modisco.facet.efacet.edit.core; + +import java.util.Collection; + +import org.eclipse.emf.common.command.Command; +import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.ecore.EStructuralFeature; +import org.eclipse.emf.edit.domain.EditingDomain; +import org.eclipse.modisco.facet.efacet.core.IFacetManager; +import org.eclipse.modisco.facet.efacet.edit.core.internal.command.FacetCommandFactory; + +/** + * @noimplement This interface is not intended to be implemented by clients. + * @noextend This interface is not intended to be extended by clients. + */ +public interface IFacetCommandFactory { + + IFacetCommandFactory DEFAULT = new FacetCommandFactory(); + + /** + * @param feature + * must be multi-valued + * @throws FacetCommandException + * @throws IllegalArgumentException + * if the parameter 'feature' is not multi-valued + */ + Command createAddCommand(EObject owner, EStructuralFeature feature, + Object newValue, EditingDomain domain, IFacetManager facetManager) + throws FacetCommandException; + + /** + * @param feature + * must be multi-valued + * @throws FacetCommandException + * @throws IllegalArgumentException + * if the parameter 'feature' is not multi-valued + */ + Command createAddAllCommand(EObject owner, EStructuralFeature feature, + Collection<? extends Object> newValues, EditingDomain domain, + IFacetManager facetManager) throws FacetCommandException; + + /** + * @param feature + * must be multi-valued + * @throws FacetCommandException + * @throws IllegalArgumentException + * if the parameter 'feature' is not multi-valued + */ + Command createRemoveCommand(EObject owner, EStructuralFeature feature, + Object value, EditingDomain domain, IFacetManager facetManager) + throws FacetCommandException; + + /** + * @param feature + * must be multi-valued + * @throws FacetCommandException + * @throws IllegalArgumentException + * if the parameter 'feature' is not multi-valued + */ + Command createRemoveAllCommand(EObject owner, EStructuralFeature feature, + Collection<? extends Object> values, EditingDomain domain, + IFacetManager facetManager) throws FacetCommandException; + + Command createSetCommand(EObject owner, EStructuralFeature feature, + Object newValue, EditingDomain domain, IFacetManager facetManager) + throws FacetCommandException; + + Command createUnSetCommand(EObject owner, EStructuralFeature feature, + EditingDomain domain, IFacetManager facetManager) + throws FacetCommandException; + +}
diff --git a/org.eclipse.modisco.facet.efacet.edit.core/src/org/eclipse/modisco/facet/efacet/edit/core/internal/Activator.java b/org.eclipse.modisco.facet.efacet.edit.core/src/org/eclipse/modisco/facet/efacet/edit/core/internal/Activator.java new file mode 100644 index 0000000..2966b98 --- /dev/null +++ b/org.eclipse.modisco.facet.efacet.edit.core/src/org/eclipse/modisco/facet/efacet/edit/core/internal/Activator.java
@@ -0,0 +1,51 @@ +/******************************************************************************* + * Copyright (c) 2015 Soft-Maint. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Jonathan Pepin (Soft-Maint) - Bug 474418 - Edit Facet features with Properties View and Commands + *******************************************************************************/ + +package org.eclipse.modisco.facet.efacet.edit.core.internal; + +import org.eclipse.core.runtime.Plugin; +import org.osgi.framework.BundleContext; + +@SuppressWarnings("PMD.UseSingleton") +// @SuppressWarnings("PMD.UseSingleton") We cannot conforms to this rule because +// this class is an Eclipse plug-in activator which will be instantiated by the +// Eclipse framework. +public class Activator extends Plugin { + + private static Activator plugin; + + @Override + @SuppressWarnings("PMD.SignatureDeclareThrowsException") + // @SuppressWarnings("PMD.SignatureDeclareThrowsException") We have to use + // this signature because this is an override of an Eclipse framework's + // method. + public void start(final BundleContext bundleContext) throws Exception { + super.start(bundleContext); + Activator.plugin = this; + } + + @Override + @SuppressWarnings("PMD.SignatureDeclareThrowsException") + // @SuppressWarnings("PMD.SignatureDeclareThrowsException") We have to use + // this signature because this is an override of an Eclipse framework's + // method. + public void stop(final BundleContext bundleContext) throws Exception { + // NOPMD: PMD say "Assigning an Object to null is a code smell." + // No choice to right it in another way : this is an Eclipse pattern. + Activator.plugin = null; // NOPMD by gdupe on 30/03/12 10:19 + super.stop(bundleContext); + } + + public static Plugin getDefault() { + return Activator.plugin; + } + +}
diff --git a/org.eclipse.modisco.facet.efacet.edit.core/src/org/eclipse/modisco/facet/efacet/edit/core/internal/FacetCommandRuntimeException.java b/org.eclipse.modisco.facet.efacet.edit.core/src/org/eclipse/modisco/facet/efacet/edit/core/internal/FacetCommandRuntimeException.java new file mode 100644 index 0000000..9a09dd0 --- /dev/null +++ b/org.eclipse.modisco.facet.efacet.edit.core/src/org/eclipse/modisco/facet/efacet/edit/core/internal/FacetCommandRuntimeException.java
@@ -0,0 +1,35 @@ +/******************************************************************************* + * Copyright (c) 2015 Soft-Maint. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Jonathan Pepin (Soft-Maint) - Bug 474418 - Edit Facet features with Properties View and Commands + *******************************************************************************/ + +package org.eclipse.modisco.facet.efacet.edit.core.internal; + +public class FacetCommandRuntimeException extends RuntimeException { + + private static final long serialVersionUID = 5723089148270269294L; + + public FacetCommandRuntimeException() { + super(); + } + + public FacetCommandRuntimeException(final String message, + final Throwable cause) { + super(message, cause); + } + + public FacetCommandRuntimeException(final String message) { + super(message); + } + + public FacetCommandRuntimeException(final Throwable cause) { + super(cause); + } + +}
diff --git a/org.eclipse.modisco.facet.efacet.edit.core/src/org/eclipse/modisco/facet/efacet/edit/core/internal/Messages.java b/org.eclipse.modisco.facet.efacet.edit.core/src/org/eclipse/modisco/facet/efacet/edit/core/internal/Messages.java new file mode 100644 index 0000000..04e65e7 --- /dev/null +++ b/org.eclipse.modisco.facet.efacet.edit.core/src/org/eclipse/modisco/facet/efacet/edit/core/internal/Messages.java
@@ -0,0 +1,37 @@ +/******************************************************************************* + * Copyright (c) 2015 Soft-Maint. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Jonathan Pepin (Soft-Maint) - Bug 474418 - Edit Facet features with Properties View and Commands + *******************************************************************************/ + +package org.eclipse.modisco.facet.efacet.edit.core.internal; + +import org.eclipse.osgi.util.NLS; + +public class Messages extends NLS { + private static final String BUNDLE_NAME = "org.eclipse.emf.facet.efacet.edit.core.internal.messages"; //$NON-NLS-1$ + public static String FacetAddAllCommand_Descriptor; + public static String FacetAddAllCommand_Label; + public static String FacetAddCommand_Description; + public static String FacetAddCommand_Label; + public static String FacetRemoveAllCommand_Description; + public static String FacetRemoveAllCommand_Label; + public static String FacetRemoveCommand_Description; + public static String FacetRemoveCommand_Label; + public static String FacetSetCommand_Description; + public static String FacetSetCommand_Label; + public static String FacetUnSetCommand_Description; + public static String FacetUnSetCommand_Label; + static { + // initialize resource bundle + NLS.initializeMessages(BUNDLE_NAME, Messages.class); + } + + private Messages() { + } +}
diff --git a/org.eclipse.modisco.facet.efacet.edit.core/src/org/eclipse/modisco/facet/efacet/edit/core/internal/command/AbstractFacetCommand.java b/org.eclipse.modisco.facet.efacet.edit.core/src/org/eclipse/modisco/facet/efacet/edit/core/internal/command/AbstractFacetCommand.java new file mode 100644 index 0000000..6c7900e --- /dev/null +++ b/org.eclipse.modisco.facet.efacet.edit.core/src/org/eclipse/modisco/facet/efacet/edit/core/internal/command/AbstractFacetCommand.java
@@ -0,0 +1,114 @@ +/******************************************************************************* + * Copyright (c) 2015 Soft-Maint. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Jonathan Pepin (Soft-Maint) - Bug 474418 - Edit Facet features with Properties View and Commands + *******************************************************************************/ + +package org.eclipse.modisco.facet.efacet.edit.core.internal.command; + +import java.util.List; +import java.util.Set; + +import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.ecore.EStructuralFeature; +import org.eclipse.emf.edit.command.AbstractOverrideableCommand; +import org.eclipse.emf.edit.domain.EditingDomain; +import org.eclipse.modisco.facet.efacet.core.FacetUtils; +import org.eclipse.modisco.facet.efacet.core.IFacetManager; +import org.eclipse.modisco.facet.efacet.core.exception.FacetManagerException; +import org.eclipse.modisco.facet.efacet.edit.core.FacetCommandException; +import org.eclipse.modisco.facet.efacet.edit.core.internal.Activator; +import org.eclipse.modisco.facet.efacet.edit.core.internal.FacetCommandRuntimeException; +import org.eclipse.modisco.facet.util.core.Logger; + +public abstract class AbstractFacetCommand extends AbstractOverrideableCommand { + + private final EObject owner; + private final EStructuralFeature feature; + + private final IFacetManager facetManager; + + public AbstractFacetCommand(final EObject owner, + final EStructuralFeature feature, final EditingDomain domain, + final IFacetManager facetManager, final String label, + final String description) { + super(domain, label, description); + this.owner = owner; + this.feature = feature; + this.facetManager = facetManager; + } + + /** + * check if facet structurual feature exist in owner + */ + @Override + public boolean doCanExecute() { + boolean result = false; + try { + final Set<EStructuralFeature> features = FacetUtils + .getETypedElements(this.owner, EStructuralFeature.class, + this.facetManager); + result = features.contains(this.feature); + } catch (final FacetManagerException e) { + final String msg = String.format( +" When evaluation doCanExecute on %s.%s, the facetManager called return error.", //$NON-NLS-1$ + this.owner, this.feature); + Logger.logError(e, msg, Activator.getDefault()); + } + return result; + } + + protected Object getCurrentValue() throws FacetCommandException { + Object result = null; + if (doCanExecute()) { + try { + if (!this.feature.isMany()) { + result = this.facetManager.getOrInvoke(this.owner, + this.feature, Object.class); + } + } catch (final FacetManagerException e) { + throw new FacetCommandException( + "When getCurrentValue method invoked, the facetManager called return error", e); //$NON-NLS-1$ + } + } + return result; + } + + protected List<Object> getCurrentValues() throws FacetCommandException { + List<Object> result = null; + if (doCanExecute()) { + try { + if (this.feature.isMany()) { + result = this.facetManager.getOrInvokeMultiValued( + this.owner, this.feature, Object.class); + } + } catch (final FacetManagerException e) { + throw new FacetCommandException( + "When getCurrentValues method invoked, the facetManager return error", e); //$NON-NLS-1$ + } + } + return result; + } + + protected void set(final Object value) { + try { + this.facetManager.set(this.owner, this.feature, value, this.domain); + } catch (final FacetManagerException e) { + final String msg = String.format( + "Can set value %s in the facet, the facetManager return error", //$NON-NLS-1$ + value.toString()); + Logger.logError(e, msg, Activator.getDefault()); + throw new FacetCommandRuntimeException(msg, e); + } + } + + protected EStructuralFeature getFeature() { + return this.feature; + } + +}
diff --git a/org.eclipse.modisco.facet.efacet.edit.core/src/org/eclipse/modisco/facet/efacet/edit/core/internal/command/FacetAddAllCommand.java b/org.eclipse.modisco.facet.efacet.edit.core/src/org/eclipse/modisco/facet/efacet/edit/core/internal/command/FacetAddAllCommand.java new file mode 100644 index 0000000..6994375 --- /dev/null +++ b/org.eclipse.modisco.facet.efacet.edit.core/src/org/eclipse/modisco/facet/efacet/edit/core/internal/command/FacetAddAllCommand.java
@@ -0,0 +1,71 @@ +/******************************************************************************* + * Copyright (c) 2015 Soft-Maint. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Jonathan Pepin (Soft-Maint) - Bug 474418 - Edit Facet features with Properties View and Commands + *******************************************************************************/ + +package org.eclipse.modisco.facet.efacet.edit.core.internal.command; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.List; + +import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.ecore.EStructuralFeature; +import org.eclipse.emf.edit.domain.EditingDomain; +import org.eclipse.modisco.facet.efacet.core.IFacetManager; +import org.eclipse.modisco.facet.efacet.edit.core.FacetCommandException; +import org.eclipse.modisco.facet.efacet.edit.core.internal.Messages; + +/** + * The add all command logically acts upon an owner object that has a + * collection-based feature to which other objects can be added. + * + */ +public class FacetAddAllCommand extends AbstractFacetCommand { + + private static final String LABEL = Messages.FacetAddAllCommand_Label; + private static final String DESCRIPTION = Messages.FacetAddAllCommand_Descriptor; + + private final List<Object> oldValues; + private List<Object> newValues; + private final Collection<? extends Object> newValuesToAdd; + + public FacetAddAllCommand(final EObject owner, + final EStructuralFeature feature, + final Collection<? extends Object> newValues, + final EditingDomain domain, final IFacetManager facetManager) + throws FacetCommandException { + super(owner, feature, domain, facetManager, LABEL, DESCRIPTION); + this.newValuesToAdd = newValues; + this.oldValues = getCurrentValues(); + } + + @Override + public boolean doCanExecute() { + return super.doCanExecute() && getFeature().isMany(); + } + + @Override + public void doExecute() { + this.newValues = new ArrayList<Object>(this.oldValues); + this.newValues.addAll(this.newValuesToAdd); + set(this.newValues); + } + + @Override + public void doUndo() { + set(this.oldValues); + } + + @Override + public void doRedo() { + set(this.newValues); + } + +}
diff --git a/org.eclipse.modisco.facet.efacet.edit.core/src/org/eclipse/modisco/facet/efacet/edit/core/internal/command/FacetAddCommand.java b/org.eclipse.modisco.facet.efacet.edit.core/src/org/eclipse/modisco/facet/efacet/edit/core/internal/command/FacetAddCommand.java new file mode 100644 index 0000000..e82ba60 --- /dev/null +++ b/org.eclipse.modisco.facet.efacet.edit.core/src/org/eclipse/modisco/facet/efacet/edit/core/internal/command/FacetAddCommand.java
@@ -0,0 +1,69 @@ +/******************************************************************************* + * Copyright (c) 2015 Soft-Maint. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Jonathan Pepin (Soft-Maint) - Bug 474418 - Edit Facet features with Properties View and Commands + *******************************************************************************/ + +package org.eclipse.modisco.facet.efacet.edit.core.internal.command; + +import java.util.ArrayList; +import java.util.List; + +import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.ecore.EStructuralFeature; +import org.eclipse.emf.edit.domain.EditingDomain; +import org.eclipse.modisco.facet.efacet.core.IFacetManager; +import org.eclipse.modisco.facet.efacet.edit.core.FacetCommandException; +import org.eclipse.modisco.facet.efacet.edit.core.internal.Messages; + +/** + * The add command logically acts upon an owner object that has a + * collection-based feature to which other objects can be added. + * + */ +public class FacetAddCommand extends AbstractFacetCommand { + + private static final String LABEL = Messages.FacetAddCommand_Label; + private static final String DESCRIPTION = Messages.FacetAddCommand_Description; + + private final Object newValue; + private final List<Object> oldValues; + private List<Object> newValues; + + public FacetAddCommand(final EObject owner, + final EStructuralFeature feature, final Object newValue, + final EditingDomain domain, final IFacetManager facetManager) + throws FacetCommandException { + super(owner, feature, domain, facetManager, LABEL, DESCRIPTION); + this.newValue = newValue; + this.oldValues = getCurrentValues(); + } + + @Override + public boolean doCanExecute() { + return super.doCanExecute() && getFeature().isMany(); + } + + @Override + public void doExecute() { + this.newValues = new ArrayList<Object>(this.oldValues); + this.newValues.add(this.newValue); + set(this.newValues); + } + + @Override + public void doUndo() { + set(this.oldValues); + } + + @Override + public void doRedo() { + set(this.newValues); + } + +}
diff --git a/org.eclipse.modisco.facet.efacet.edit.core/src/org/eclipse/modisco/facet/efacet/edit/core/internal/command/FacetCommandFactory.java b/org.eclipse.modisco.facet.efacet.edit.core/src/org/eclipse/modisco/facet/efacet/edit/core/internal/command/FacetCommandFactory.java new file mode 100644 index 0000000..3339143 --- /dev/null +++ b/org.eclipse.modisco.facet.efacet.edit.core/src/org/eclipse/modisco/facet/efacet/edit/core/internal/command/FacetCommandFactory.java
@@ -0,0 +1,98 @@ +/******************************************************************************* + * Copyright (c) 2015 Soft-Maint. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Jonathan Pepin (Soft-Maint) - Bug 474418 - Edit Facet features with Properties View and Commands + *******************************************************************************/ + +package org.eclipse.modisco.facet.efacet.edit.core.internal.command; + +import java.util.Collection; + +import org.eclipse.emf.common.command.Command; +import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.ecore.EStructuralFeature; +import org.eclipse.emf.edit.domain.EditingDomain; +import org.eclipse.modisco.facet.efacet.core.IFacetManager; +import org.eclipse.modisco.facet.efacet.edit.core.FacetCommandException; +import org.eclipse.modisco.facet.efacet.edit.core.IFacetCommandFactory; + +public class FacetCommandFactory implements IFacetCommandFactory { + + public Command createAddCommand(final EObject owner, + final EStructuralFeature feature, final Object newValue, + final EditingDomain domain, final IFacetManager facetManager) + throws FacetCommandException { + if (!feature.isMany()) { + final String msg = String.format( + "On createAddCommand feature %s must be multi-valued !", //$NON-NLS-1$ + feature.getName()); + throw new IllegalArgumentException(msg); + } + return new FacetAddCommand(owner, feature, newValue, domain, + facetManager); + } + + public Command createAddAllCommand(final EObject owner, + final EStructuralFeature feature, + final Collection<? extends Object> newValues, + final EditingDomain domain, final IFacetManager facetManager) + throws FacetCommandException { + if (!feature.isMany()) { + final String msg = String.format( + "On createAddAllCommand feature %s must be multi-valued !", //$NON-NLS-1$ + feature.getName()); + throw new IllegalArgumentException(msg); + } + return new FacetAddAllCommand(owner, feature, newValues, domain, + facetManager); + } + + public Command createRemoveCommand(final EObject owner, + final EStructuralFeature feature, final Object value, + final EditingDomain domain, final IFacetManager facetManager) + throws FacetCommandException { + if (!feature.isMany()) { + final String msg = String.format( + "On createRemoveCommand feature %s must be multi-valued !", //$NON-NLS-1$ + feature.getName()); + throw new IllegalArgumentException(msg); + } + return new FacetRemoveCommand(owner, feature, value, domain, + facetManager); + } + + public Command createRemoveAllCommand(final EObject owner, + final EStructuralFeature feature, + final Collection<? extends Object> values, + final EditingDomain domain, final IFacetManager facetManager) + throws FacetCommandException { + if (!feature.isMany()) { + final String msg = String.format( + "On createRemoveAllCommand feature %s must be multi-valued !", //$NON-NLS-1$ + feature.getName()); + throw new IllegalArgumentException(msg); + } + return new FacetRemoveAllCommand(owner, feature, values, domain, + facetManager); + } + + public Command createSetCommand(final EObject owner, + final EStructuralFeature feature, final Object newValue, + final EditingDomain domain, final IFacetManager facetManager) + throws FacetCommandException { + return new FacetSetCommand(owner, feature, newValue, domain, + facetManager); + } + + public Command createUnSetCommand(final EObject owner, + final EStructuralFeature feature, final EditingDomain domain, + final IFacetManager facetManager) throws FacetCommandException { + return new FacetUnSetCommand(owner, feature, domain, facetManager); + } + +}
diff --git a/org.eclipse.modisco.facet.efacet.edit.core/src/org/eclipse/modisco/facet/efacet/edit/core/internal/command/FacetRemoveAllCommand.java b/org.eclipse.modisco.facet.efacet.edit.core/src/org/eclipse/modisco/facet/efacet/edit/core/internal/command/FacetRemoveAllCommand.java new file mode 100644 index 0000000..f167987 --- /dev/null +++ b/org.eclipse.modisco.facet.efacet.edit.core/src/org/eclipse/modisco/facet/efacet/edit/core/internal/command/FacetRemoveAllCommand.java
@@ -0,0 +1,66 @@ +/******************************************************************************* + * Copyright (c) 2015 Soft-Maint. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Jonathan Pepin (Soft-Maint) - Bug 474418 - Edit Facet features with Properties View and Commands + *******************************************************************************/ + +package org.eclipse.modisco.facet.efacet.edit.core.internal.command; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.List; + +import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.ecore.EStructuralFeature; +import org.eclipse.emf.edit.domain.EditingDomain; +import org.eclipse.modisco.facet.efacet.core.IFacetManager; +import org.eclipse.modisco.facet.efacet.edit.core.FacetCommandException; +import org.eclipse.modisco.facet.efacet.edit.core.internal.Messages; + +/** + * The remove all command logically acts upon an owner object that has a + * collection-based feature to which other objects can be removed. + * + */ +public class FacetRemoveAllCommand extends AbstractFacetCommand { + + private static final String LABEL = Messages.FacetRemoveAllCommand_Label; + private static final String DESCRIPTION = Messages.FacetRemoveAllCommand_Description; + + private final List<Object> oldValues; + private List<Object> newValues; + private final Collection<? extends Object> valuesToRemove; + + public FacetRemoveAllCommand(final EObject owner, + final EStructuralFeature feature, + final Collection<? extends Object> values, + final EditingDomain domain, final IFacetManager facetManager) + throws FacetCommandException { + super(owner, feature, domain, facetManager, LABEL, DESCRIPTION); + this.oldValues = getCurrentValues(); + this.valuesToRemove = values; + } + + @Override + public void doExecute() { + this.newValues = new ArrayList<Object>(this.oldValues); + this.newValues.removeAll(this.valuesToRemove); + set(this.newValues); + } + + @Override + public void doUndo() { + set(this.oldValues); + } + + @Override + public void doRedo() { + set(this.newValues); + } + +}
diff --git a/org.eclipse.modisco.facet.efacet.edit.core/src/org/eclipse/modisco/facet/efacet/edit/core/internal/command/FacetRemoveCommand.java b/org.eclipse.modisco.facet.efacet.edit.core/src/org/eclipse/modisco/facet/efacet/edit/core/internal/command/FacetRemoveCommand.java new file mode 100644 index 0000000..3687d06 --- /dev/null +++ b/org.eclipse.modisco.facet.efacet.edit.core/src/org/eclipse/modisco/facet/efacet/edit/core/internal/command/FacetRemoveCommand.java
@@ -0,0 +1,64 @@ +/******************************************************************************* + * Copyright (c) 2015 Soft-Maint. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Jonathan Pepin (Soft-Maint) - Bug 474418 - Edit Facet features with Properties View and Commands + *******************************************************************************/ + +package org.eclipse.modisco.facet.efacet.edit.core.internal.command; + +import java.util.ArrayList; +import java.util.List; + +import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.ecore.EStructuralFeature; +import org.eclipse.emf.edit.domain.EditingDomain; +import org.eclipse.modisco.facet.efacet.core.IFacetManager; +import org.eclipse.modisco.facet.efacet.edit.core.FacetCommandException; +import org.eclipse.modisco.facet.efacet.edit.core.internal.Messages; + +/** + * The remove command logically acts upon an owner object that has a + * collection-based feature to which other objects can be removed. + * + */ +public class FacetRemoveCommand extends AbstractFacetCommand { + + private static final String LABEL = Messages.FacetRemoveCommand_Label; + private static final String DESCRIPTION = Messages.FacetRemoveCommand_Description; + + private final List<Object> oldValues; + private List<Object> newValues; + private final Object valueToRemove; + + public FacetRemoveCommand(final EObject owner, + final EStructuralFeature feature, final Object value, + final EditingDomain domain, final IFacetManager facetManager) + throws FacetCommandException { + super(owner, feature, domain, facetManager, LABEL, DESCRIPTION); + this.oldValues = getCurrentValues(); + this.valueToRemove = value; + } + + @Override + public void doExecute() { + this.newValues = new ArrayList<Object>(this.oldValues); + this.newValues.remove(this.valueToRemove); + set(this.newValues); + } + + @Override + public void doUndo() { + set(this.oldValues); + } + + @Override + public void doRedo() { + set(this.newValues); + } + +}
diff --git a/org.eclipse.modisco.facet.efacet.edit.core/src/org/eclipse/modisco/facet/efacet/edit/core/internal/command/FacetSetCommand.java b/org.eclipse.modisco.facet.efacet.edit.core/src/org/eclipse/modisco/facet/efacet/edit/core/internal/command/FacetSetCommand.java new file mode 100644 index 0000000..90dc100 --- /dev/null +++ b/org.eclipse.modisco.facet.efacet.edit.core/src/org/eclipse/modisco/facet/efacet/edit/core/internal/command/FacetSetCommand.java
@@ -0,0 +1,57 @@ +/******************************************************************************* + * Copyright (c) 2015 Soft-Maint. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Jonathan Pepin (Soft-Maint) - Bug 474418 - Edit Facet features with Properties View and Commands + *******************************************************************************/ + +package org.eclipse.modisco.facet.efacet.edit.core.internal.command; + +import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.ecore.EStructuralFeature; +import org.eclipse.emf.edit.domain.EditingDomain; +import org.eclipse.modisco.facet.efacet.core.IFacetManager; +import org.eclipse.modisco.facet.efacet.edit.core.FacetCommandException; +import org.eclipse.modisco.facet.efacet.edit.core.internal.Messages; + +/** + * The set command logically acts upon an owner object to set a particular + * feature to a specified value. + */ +public class FacetSetCommand extends AbstractFacetCommand { + + private static final String LABEL = Messages.FacetSetCommand_Label; + private static final String DESCRIPTION = Messages.FacetSetCommand_Description; + + private final Object newValue; + private final Object oldValue; + + public FacetSetCommand(final EObject owner, + final EStructuralFeature feature, final Object newValue, + final EditingDomain domain, final IFacetManager facetManager) + throws FacetCommandException { + super(owner, feature, domain, facetManager, LABEL, DESCRIPTION); + this.newValue = newValue; + this.oldValue = getCurrentValue(); + } + + @Override + public void doExecute() { + set(this.newValue); + } + + @Override + public void doUndo() { + set(this.oldValue); + } + + @Override + public void doRedo() { + set(this.newValue); + } + +}
diff --git a/org.eclipse.modisco.facet.efacet.edit.core/src/org/eclipse/modisco/facet/efacet/edit/core/internal/command/FacetUnSetCommand.java b/org.eclipse.modisco.facet.efacet.edit.core/src/org/eclipse/modisco/facet/efacet/edit/core/internal/command/FacetUnSetCommand.java new file mode 100644 index 0000000..df9262a --- /dev/null +++ b/org.eclipse.modisco.facet.efacet.edit.core/src/org/eclipse/modisco/facet/efacet/edit/core/internal/command/FacetUnSetCommand.java
@@ -0,0 +1,66 @@ +/******************************************************************************* + * Copyright (c) 2015 Soft-Maint. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Jonathan Pepin (Soft-Maint) - Bug 474418 - Edit Facet features with Properties View and Commands + *******************************************************************************/ + +package org.eclipse.modisco.facet.efacet.edit.core.internal.command; + +import java.util.ArrayList; +import java.util.List; + +import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.ecore.EStructuralFeature; +import org.eclipse.emf.edit.domain.EditingDomain; +import org.eclipse.modisco.facet.efacet.core.IFacetManager; +import org.eclipse.modisco.facet.efacet.edit.core.FacetCommandException; +import org.eclipse.modisco.facet.efacet.edit.core.internal.Messages; + +/** + * The unset command logically acts upon an owner object to unset a particular + * feature. + */ +public class FacetUnSetCommand extends AbstractFacetCommand { + + private static final String LABEL = Messages.FacetUnSetCommand_Label; + private static final String DESCRIPTION = Messages.FacetUnSetCommand_Description; + + private List<Object> oldValues; + private Object oldValue; + + public FacetUnSetCommand(final EObject owner, + final EStructuralFeature feature, final EditingDomain domain, + final IFacetManager facetManager) throws FacetCommandException { + super(owner, feature, domain, facetManager, LABEL, DESCRIPTION); + if (getFeature().isMany()) { + this.oldValues = new ArrayList<Object>(getCurrentValues()); + } else { + this.oldValue = getCurrentValue(); + } + } + + @Override + public void doExecute() { + set(null); + } + + @Override + public void doUndo() { + if (getFeature().isMany()) { + set(this.oldValues); + } else { + set(this.oldValue); + } + } + + @Override + public void doRedo() { + set(null); + } + +}
diff --git a/org.eclipse.modisco.facet.efacet.edit.core/src/org/eclipse/emf/facet/efacet/edit/core/internal/messages.properties b/org.eclipse.modisco.facet.efacet.edit.core/src/org/eclipse/modisco/facet/efacet/edit/core/internal/messages.properties similarity index 100% rename from org.eclipse.modisco.facet.efacet.edit.core/src/org/eclipse/emf/facet/efacet/edit/core/internal/messages.properties rename to org.eclipse.modisco.facet.efacet.edit.core/src/org/eclipse/modisco/facet/efacet/edit/core/internal/messages.properties
diff --git a/org.eclipse.modisco.facet.efacet.metamodel/META-INF/MANIFEST.MF b/org.eclipse.modisco.facet.efacet.metamodel/META-INF/MANIFEST.MF index 3361e89..f483594 100644 --- a/org.eclipse.modisco.facet.efacet.metamodel/META-INF/MANIFEST.MF +++ b/org.eclipse.modisco.facet.efacet.metamodel/META-INF/MANIFEST.MF
@@ -10,22 +10,22 @@ org.eclipse.emf.ecore, org.eclipse.emf.facet.util.emf.core;bundle-version="0.2.0" Bundle-ActivationPolicy: lazy -Export-Package: org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet, - org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.extensible, - org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.extensible.impl, - org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.extensible.util;x-friends:="org.eclipse.emf.facet.efacet.metamodel.edit", - org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.impl;x-friends:="org.eclipse.emf.facet.custom.metamodel", - org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.query, - org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.query.impl;x-internal:=true, - org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.query.util;x-friends:="org.eclipse.emf.facet.efacet.metamodel.edit", - org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.runtime, - org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.runtime.impl;x-internal:=true, - org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.runtime.util;x-friends:="org.eclipse.emf.facet.efacet.metamodel.edit", - org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.serialization, - org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.serialization.impl;x-internal:=true, - org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.serialization.util;x-friends:="org.eclipse.emf.facet.efacet.metamodel.edit", - org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.util;x-friends:="org.eclipse.emf.facet.efacet.metamodel.edit", - org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacetcatalog, - org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacetcatalog.impl;x-internal:=true, - org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacetcatalog.util;x-internal:=true +Export-Package: org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet, + org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.extensible, + org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.extensible.impl, + org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.extensible.util;x-friends:="org.eclipse.emf.facet.efacet.metamodel.edit", + org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.impl;x-friends:="org.eclipse.emf.facet.custom.metamodel", + org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.query, + org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.query.impl;x-internal:=true, + org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.query.util;x-friends:="org.eclipse.emf.facet.efacet.metamodel.edit", + org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.runtime, + org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.runtime.impl;x-internal:=true, + org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.runtime.util;x-friends:="org.eclipse.emf.facet.efacet.metamodel.edit", + org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.serialization, + org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.serialization.impl;x-internal:=true, + org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.serialization.util;x-friends:="org.eclipse.emf.facet.efacet.metamodel.edit", + org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.util;x-friends:="org.eclipse.emf.facet.efacet.metamodel.edit", + org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacetcatalog, + org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacetcatalog.impl;x-internal:=true, + org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacetcatalog.util;x-internal:=true Automatic-Module-Name: org.eclipse.emf.facet.efacet.metamodel
diff --git a/org.eclipse.modisco.facet.efacet.metamodel/plugin.xml b/org.eclipse.modisco.facet.efacet.metamodel/plugin.xml index b25fc37..7ff3a3f 100644 --- a/org.eclipse.modisco.facet.efacet.metamodel/plugin.xml +++ b/org.eclipse.modisco.facet.efacet.metamodel/plugin.xml
@@ -21,11 +21,11 @@ <extension point="org.eclipse.emf.ecore.generated_package"> <package uri="http://www.eclipse.org/emf/facet/efacet/0.2.incubation/efacet" - class="org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.EFacetPackage" + class="org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.EFacetPackage" genModel="model/efacet-0.2.0.genmodel"/> <package uri="http://www.eclipse.org/emf/facet/eFacetCatalog/0.2.incubation" - class="org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacetcatalog.EfacetcatalogPackage" + class="org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacetcatalog.EfacetcatalogPackage" genModel="model/efacetcatalog-0.2.0.genmodel"/> </extension> @@ -33,28 +33,28 @@ <!-- @generated efacet-0.2.0 --> <package uri="http://www.eclipse.org/emf/facet/efacet/0.2.incubation/efacet/serialization" - class="org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.serialization.SerializationPackage"/> + class="org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.serialization.SerializationPackage"/> </extension> <extension point="org.eclipse.emf.ecore.generated_package"> <!-- @generated efacet-0.2.0 --> <package uri="http://www.eclipse.org/emf/facet/efacet/0.2.incubation/efacet/extensible" - class="org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.extensible.ExtensiblePackage"/> + class="org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.extensible.ExtensiblePackage"/> </extension> <extension point="org.eclipse.emf.ecore.generated_package"> <!-- @generated efacet-0.2.0 --> <package uri="http://www.eclipse.org/emf/facet/efacet/0.2.incubation/efacet/query" - class="org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.query.QueryPackage"/> + class="org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.query.QueryPackage"/> </extension> <extension point="org.eclipse.emf.ecore.generated_package"> <!-- @generated efacet-0.2.0 --> <package uri="http://www.eclipse.org/emf/facet/efacet/0.2.incubation/efacet/runtime" - class="org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.runtime.RuntimePackage"/> + class="org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.runtime.RuntimePackage"/> </extension> </plugin>
diff --git a/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/emf/facet/efacet/metamodel/v0_2_0/efacet/Category.java b/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/emf/facet/efacet/metamodel/v0_2_0/efacet/Category.java deleted file mode 100644 index 091ce22..0000000 --- a/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/emf/facet/efacet/metamodel/v0_2_0/efacet/Category.java +++ /dev/null
@@ -1,34 +0,0 @@ -/** - * Copyright (c) 2011 Mia-Software. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Gregoire Dupe (Mia-Software) - Design - * Nicolas Guyomar (Mia-Software) - Implementation - * Emmanuelle Rouillé (Mia-Software) - Bug 352618 - To be able to use non derived facet structural features and save them values. - * Nicolas Bros (Mia-Software) - Bug 361823 - [Restructuring] eFacet2 meta-model - */ -package org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet; - -import org.eclipse.emf.ecore.ENamedElement; - -/** - * <!-- begin-user-doc --> - * A representation of the model object '<em><b>Category</b></em>'. - * <!-- end-user-doc --> - * - * <!-- begin-model-doc --> - * A Category is used to group related elements. - * <!-- end-model-doc --> - * - * - * @see org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.EFacetPackage#getCategory() - * @model - * @generated - */ -public interface Category extends ENamedElement, DocumentedElement { -} // Category
diff --git a/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/emf/facet/efacet/metamodel/v0_2_0/efacet/DerivedTypedElement.java b/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/emf/facet/efacet/metamodel/v0_2_0/efacet/DerivedTypedElement.java deleted file mode 100644 index f9ea082..0000000 --- a/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/emf/facet/efacet/metamodel/v0_2_0/efacet/DerivedTypedElement.java +++ /dev/null
@@ -1,103 +0,0 @@ -/** - * Copyright (c) 2011, 2015 Mia-Software, and Soft-Maint. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Gregoire Dupe (Mia-Software) - Design - * Nicolas Guyomar (Mia-Software) - Implementation - * Emmanuelle Rouillé (Mia-Software) - Bug 352618 - To be able to use non derived facet structural features and save them values. - * Nicolas Bros (Mia-Software) - Bug 361823 - [Restructuring] eFacet2 meta-model - * Gregoire Dupe (Mia-Software) - Bug 366055 - NavigationQuery - * Gregoire Dupe (Mia-Software) - Bug 369673 - [Facet] IsOneOfQuery - * Olivier Remaud (Soft-Maint) - Bug 369824 - Add a simple way to return string literal constants from a customization query - * Gregoire Dupe (Mia-Software) - Bug 369987 - [Restructuring][Table] Switch to the new customization and facet framework - * Gregoire Dupe (Mia-software) - Bug 364325 - [Restructuring] The user must be able to navigate into a model using the Facet. - * Nicolas Bros (Mia-Software) - Bug 372626 - [Facet] Aggregates - * Nicolas Bros (Mia-Software) - Bug 376941 - [EFacet] Facet operation arguments in Facet model - * Gregoire Dupe (Mia-Software) - Bug 376576 - [EFacet] Change the multiplicity of Facet::extendedFacet - * Jonathan Pepin (Soft-Maint) - Bug 463898 - Create FacetReference not derived, without query and with opposite mechanism - */ -package org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet; - -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.extensible.Query; - -/** - * <!-- begin-user-doc --> - * A representation of the model object '<em><b>Derived Typed Element</b></em>'. - * <!-- end-user-doc --> - * - * <!-- begin-model-doc --> - * A derivable typed element is a structural feature that the value can be computed by using a query. - * - * NB: DerivedTypeElement must be named "DerivableTypeElement". Old definition: A derived typed element is a virtual structural feature the value of which is computed using a query. - * <!-- end-model-doc --> - * - * <p> - * The following features are supported: - * <ul> - * <li>{@link org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.DerivedTypedElement#getQuery <em>Query</em>}</li> - * <li>{@link org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.DerivedTypedElement#getOverride <em>Override</em>}</li> - * </ul> - * </p> - * - * @see org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.EFacetPackage#getDerivedTypedElement() - * @model abstract="true" - * @generated - */ -public interface DerivedTypedElement extends FacetElement { - /** - * Returns the value of the '<em><b>Query</b></em>' containment reference. - * <!-- begin-user-doc --> - * <p> - * If the meaning of the '<em>Query</em>' containment reference isn't clear, - * there really should be more of a description here... - * </p> - * <!-- end-user-doc --> - * @return the value of the '<em>Query</em>' containment reference. - * @see #setQuery(Query) - * @see org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.EFacetPackage#getDerivedTypedElement_Query() - * @model containment="true" - * @generated - */ - Query getQuery(); - - /** - * Sets the value of the '{@link org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.DerivedTypedElement#getQuery <em>Query</em>}' containment reference. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @param value the new value of the '<em>Query</em>' containment reference. - * @see #getQuery() - * @generated - */ - void setQuery(Query value); - - /** - * Returns the value of the '<em><b>Override</b></em>' reference. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * <!-- begin-model-doc --> - * If it exists a facet A which extends a facet B then a derived typed element of A can override a typed element of B; if the both typed elements have the same name, same multiplicity, and same type. - * <!-- end-model-doc --> - * @return the value of the '<em>Override</em>' reference. - * @see #setOverride(DerivedTypedElement) - * @see org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.EFacetPackage#getDerivedTypedElement_Override() - * @model - * @generated - */ - DerivedTypedElement getOverride(); - - /** - * Sets the value of the '{@link org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.DerivedTypedElement#getOverride <em>Override</em>}' reference. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @param value the new value of the '<em>Override</em>' reference. - * @see #getOverride() - * @generated - */ - void setOverride(DerivedTypedElement value); - -} // DerivedTypedElement
diff --git a/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/emf/facet/efacet/metamodel/v0_2_0/efacet/DocumentedElement.java b/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/emf/facet/efacet/metamodel/v0_2_0/efacet/DocumentedElement.java deleted file mode 100644 index 6f4ece0..0000000 --- a/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/emf/facet/efacet/metamodel/v0_2_0/efacet/DocumentedElement.java +++ /dev/null
@@ -1,62 +0,0 @@ -/** - * Copyright (c) 2011 Mia-Software. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Gregoire Dupe (Mia-Software) - Design - * Nicolas Guyomar (Mia-Software) - Implementation - * Emmanuelle Rouillé (Mia-Software) - Bug 352618 - To be able to use non derived facet structural features and save them values. - * Nicolas Bros (Mia-Software) - Bug 361823 - [Restructuring] eFacet2 meta-model - */ -package org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet; - -import org.eclipse.emf.ecore.EObject; - -/** - * <!-- begin-user-doc --> - * A representation of the model object '<em><b>Documented Element</b></em>'. - * <!-- end-user-doc --> - * - * <p> - * The following features are supported: - * <ul> - * <li>{@link org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.DocumentedElement#getDocumentation <em>Documentation</em>}</li> - * </ul> - * </p> - * - * @see org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.EFacetPackage#getDocumentedElement() - * @model - * @generated - */ -public interface DocumentedElement extends EObject { - /** - * Returns the value of the '<em><b>Documentation</b></em>' attribute. - * <!-- begin-user-doc --> - * <p> - * If the meaning of the '<em>Documentation</em>' attribute isn't clear, - * there really should be more of a description here... - * </p> - * <!-- end-user-doc --> - * @return the value of the '<em>Documentation</em>' attribute. - * @see #setDocumentation(String) - * @see org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.EFacetPackage#getDocumentedElement_Documentation() - * @model - * @generated - */ - String getDocumentation(); - - /** - * Sets the value of the '{@link org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.DocumentedElement#getDocumentation <em>Documentation</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @param value the new value of the '<em>Documentation</em>' attribute. - * @see #getDocumentation() - * @generated - */ - void setDocumentation(String value); - -} // DocumentedElement
diff --git a/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/emf/facet/efacet/metamodel/v0_2_0/efacet/EFacetFactory.java b/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/emf/facet/efacet/metamodel/v0_2_0/efacet/EFacetFactory.java deleted file mode 100644 index d8df618..0000000 --- a/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/emf/facet/efacet/metamodel/v0_2_0/efacet/EFacetFactory.java +++ /dev/null
@@ -1,119 +0,0 @@ -/** - * Copyright (c) 2011, 2012 Mia-Software. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Gregoire Dupe (Mia-Software) - Design - * Nicolas Guyomar (Mia-Software) - Implementation - * Emmanuelle Rouillé (Mia-Software) - Bug 352618 - To be able to use non derived facet structural features and save them values. - * Nicolas Bros (Mia-Software) - Bug 361823 - [Restructuring] eFacet2 meta-model - * Gregoire Dupe (Mia-Software) - Bug 364325 - [Restructuring] The user must be able to navigate into a model using the Facet. - * Gregoire Dupe (Mia-Software) - Bug 373078 - API Cleaning - */ -package org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet; - -import org.eclipse.emf.ecore.EFactory; - -/** - * <!-- begin-user-doc --> - * The <b>Factory</b> for the model. - * It provides a create method for each non-abstract class of the model. - * <!-- end-user-doc --> - * @see org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.EFacetPackage - * @generated - */ -public interface EFacetFactory extends EFactory { - /** - * The singleton instance of the factory. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - EFacetFactory eINSTANCE = org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.impl.EFacetFactoryImpl.init(); - - /** - * Returns a new object of class '<em>Facet Attribute</em>'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return a new object of class '<em>Facet Attribute</em>'. - * @generated - */ - FacetAttribute createFacetAttribute(); - - /** - * Returns a new object of class '<em>Facet Reference</em>'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return a new object of class '<em>Facet Reference</em>'. - * @generated - */ - FacetReference createFacetReference(); - - /** - * Returns a new object of class '<em>Facet Operation</em>'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return a new object of class '<em>Facet Operation</em>'. - * @generated - */ - FacetOperation createFacetOperation(); - - /** - * Returns a new object of class '<em>Facet Set</em>'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return a new object of class '<em>Facet Set</em>'. - * @generated - */ - FacetSet createFacetSet(); - - /** - * Returns a new object of class '<em>Facet</em>'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return a new object of class '<em>Facet</em>'. - * @generated - */ - Facet createFacet(); - - /** - * Returns a new object of class '<em>Category</em>'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return a new object of class '<em>Category</em>'. - * @generated - */ - Category createCategory(); - - /** - * Returns a new object of class '<em>Parameter Value</em>'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return a new object of class '<em>Parameter Value</em>'. - * @generated - */ - ParameterValue createParameterValue(); - - /** - * Returns a new object of class '<em>Documented Element</em>'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return a new object of class '<em>Documented Element</em>'. - * @generated - */ - DocumentedElement createDocumentedElement(); - - /** - * Returns the package supported by this factory. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the package supported by this factory. - * @generated - */ - EFacetPackage getEFacetPackage(); - -} //EFacetFactory
diff --git a/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/emf/facet/efacet/metamodel/v0_2_0/efacet/EFacetPackage.java b/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/emf/facet/efacet/metamodel/v0_2_0/efacet/EFacetPackage.java deleted file mode 100644 index ab99f92..0000000 --- a/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/emf/facet/efacet/metamodel/v0_2_0/efacet/EFacetPackage.java +++ /dev/null
@@ -1,1933 +0,0 @@ -/** - * Copyright (c) 2011, 2015 Mia-Software, and Soft-Maint. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Gregoire Dupe (Mia-Software) - Design - * Nicolas Guyomar (Mia-Software) - Implementation - * Emmanuelle Rouillé (Mia-Software) - Bug 352618 - To be able to use non derived facet structural features and save them values. - * Nicolas Bros (Mia-Software) - Bug 361823 - [Restructuring] eFacet2 meta-model - * Gregoire Dupe (Mia-Software) - Bug 366055 - NavigationQuery - * Gregoire Dupe (Mia-Software) - Bug 369673 - [Facet] IsOneOfQuery - * Olivier Remaud (Soft-Maint) - Bug 369824 - Add a simple way to return string literal constants from a customization query - * Gregoire Dupe (Mia-Software) - Bug 369987 - [Restructuring][Table] Switch to the new customization and facet framework - * Gregoire Dupe (Mia-software) - Bug 364325 - [Restructuring] The user must be able to navigate into a model using the Facet. - * Nicolas Bros (Mia-Software) - Bug 372626 - [Facet] Aggregates - * Nicolas Bros (Mia-Software) - Bug 376941 - [EFacet] Facet operation arguments in Facet model - * Gregoire Dupe (Mia-Software) - Bug 376576 - [EFacet] Change the multiplicity of Facet::extendedFacet - * Jonathan Pepin (Soft-Maint) - Bug 463898 - Create FacetReference not derived, without query and with opposite mechanism - */ -package org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet; - -import org.eclipse.emf.ecore.EAttribute; -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.ecore.EDataType; -import org.eclipse.emf.ecore.EPackage; -import org.eclipse.emf.ecore.EReference; -import org.eclipse.emf.ecore.EcorePackage; - -/** - * <!-- begin-user-doc --> - * The <b>Package</b> for the model. - * It contains accessors for the meta objects to represent - * <ul> - * <li>each class,</li> - * <li>each feature of each class,</li> - * <li>each enum,</li> - * <li>and each data type</li> - * </ul> - * <!-- end-user-doc --> - * @see org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.EFacetFactory - * @model kind="package" - * annotation="http://www.eclipse.org/emf/2002/Ecore validationDelegates='org.eclipse.ocl.ecore.OCL'" - * @generated - */ -public interface EFacetPackage extends EPackage { - /** - * The package name. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - String eNAME = "efacet"; //$NON-NLS-1$ - - /** - * The package namespace URI. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - String eNS_URI = "http://www.eclipse.org/emf/facet/efacet/0.2.incubation/efacet"; //$NON-NLS-1$ - - /** - * The package namespace name. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - String eNS_PREFIX = "efacet"; //$NON-NLS-1$ - - /** - * The singleton instance of the package. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - EFacetPackage eINSTANCE = org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.impl.EFacetPackageImpl.init(); - - /** - * The meta object id for the '{@link org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.impl.FacetAttributeImpl <em>Facet Attribute</em>}' class. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.impl.FacetAttributeImpl - * @see org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.impl.EFacetPackageImpl#getFacetAttribute() - * @generated - */ - int FACET_ATTRIBUTE = 0; - - /** - * The feature id for the '<em><b>EAnnotations</b></em>' containment reference list. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int FACET_ATTRIBUTE__EANNOTATIONS = EcorePackage.EATTRIBUTE__EANNOTATIONS; - - /** - * The feature id for the '<em><b>Name</b></em>' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int FACET_ATTRIBUTE__NAME = EcorePackage.EATTRIBUTE__NAME; - - /** - * The feature id for the '<em><b>Ordered</b></em>' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int FACET_ATTRIBUTE__ORDERED = EcorePackage.EATTRIBUTE__ORDERED; - - /** - * The feature id for the '<em><b>Unique</b></em>' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int FACET_ATTRIBUTE__UNIQUE = EcorePackage.EATTRIBUTE__UNIQUE; - - /** - * The feature id for the '<em><b>Lower Bound</b></em>' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int FACET_ATTRIBUTE__LOWER_BOUND = EcorePackage.EATTRIBUTE__LOWER_BOUND; - - /** - * The feature id for the '<em><b>Upper Bound</b></em>' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int FACET_ATTRIBUTE__UPPER_BOUND = EcorePackage.EATTRIBUTE__UPPER_BOUND; - - /** - * The feature id for the '<em><b>Many</b></em>' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int FACET_ATTRIBUTE__MANY = EcorePackage.EATTRIBUTE__MANY; - - /** - * The feature id for the '<em><b>Required</b></em>' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int FACET_ATTRIBUTE__REQUIRED = EcorePackage.EATTRIBUTE__REQUIRED; - - /** - * The feature id for the '<em><b>EType</b></em>' reference. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int FACET_ATTRIBUTE__ETYPE = EcorePackage.EATTRIBUTE__ETYPE; - - /** - * The feature id for the '<em><b>EGeneric Type</b></em>' containment reference. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int FACET_ATTRIBUTE__EGENERIC_TYPE = EcorePackage.EATTRIBUTE__EGENERIC_TYPE; - - /** - * The feature id for the '<em><b>Changeable</b></em>' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int FACET_ATTRIBUTE__CHANGEABLE = EcorePackage.EATTRIBUTE__CHANGEABLE; - - /** - * The feature id for the '<em><b>Volatile</b></em>' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int FACET_ATTRIBUTE__VOLATILE = EcorePackage.EATTRIBUTE__VOLATILE; - - /** - * The feature id for the '<em><b>Transient</b></em>' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int FACET_ATTRIBUTE__TRANSIENT = EcorePackage.EATTRIBUTE__TRANSIENT; - - /** - * The feature id for the '<em><b>Default Value Literal</b></em>' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int FACET_ATTRIBUTE__DEFAULT_VALUE_LITERAL = EcorePackage.EATTRIBUTE__DEFAULT_VALUE_LITERAL; - - /** - * The feature id for the '<em><b>Default Value</b></em>' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int FACET_ATTRIBUTE__DEFAULT_VALUE = EcorePackage.EATTRIBUTE__DEFAULT_VALUE; - - /** - * The feature id for the '<em><b>Unsettable</b></em>' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int FACET_ATTRIBUTE__UNSETTABLE = EcorePackage.EATTRIBUTE__UNSETTABLE; - - /** - * The feature id for the '<em><b>Derived</b></em>' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int FACET_ATTRIBUTE__DERIVED = EcorePackage.EATTRIBUTE__DERIVED; - - /** - * The feature id for the '<em><b>EContaining Class</b></em>' container reference. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int FACET_ATTRIBUTE__ECONTAINING_CLASS = EcorePackage.EATTRIBUTE__ECONTAINING_CLASS; - - /** - * The feature id for the '<em><b>ID</b></em>' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int FACET_ATTRIBUTE__ID = EcorePackage.EATTRIBUTE__ID; - - /** - * The feature id for the '<em><b>EAttribute Type</b></em>' reference. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int FACET_ATTRIBUTE__EATTRIBUTE_TYPE = EcorePackage.EATTRIBUTE__EATTRIBUTE_TYPE; - - /** - * The feature id for the '<em><b>Documentation</b></em>' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int FACET_ATTRIBUTE__DOCUMENTATION = EcorePackage.EATTRIBUTE_FEATURE_COUNT + 0; - - /** - * The feature id for the '<em><b>Categories</b></em>' reference list. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int FACET_ATTRIBUTE__CATEGORIES = EcorePackage.EATTRIBUTE_FEATURE_COUNT + 1; - - /** - * The feature id for the '<em><b>Query</b></em>' containment reference. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int FACET_ATTRIBUTE__QUERY = EcorePackage.EATTRIBUTE_FEATURE_COUNT + 2; - - /** - * The feature id for the '<em><b>Override</b></em>' reference. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int FACET_ATTRIBUTE__OVERRIDE = EcorePackage.EATTRIBUTE_FEATURE_COUNT + 3; - - /** - * The number of structural features of the '<em>Facet Attribute</em>' class. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int FACET_ATTRIBUTE_FEATURE_COUNT = EcorePackage.EATTRIBUTE_FEATURE_COUNT + 4; - - /** - * The meta object id for the '{@link org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.impl.FacetReferenceImpl <em>Facet Reference</em>}' class. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.impl.FacetReferenceImpl - * @see org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.impl.EFacetPackageImpl#getFacetReference() - * @generated - */ - int FACET_REFERENCE = 1; - - /** - * The feature id for the '<em><b>EAnnotations</b></em>' containment reference list. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int FACET_REFERENCE__EANNOTATIONS = EcorePackage.EREFERENCE__EANNOTATIONS; - - /** - * The feature id for the '<em><b>Name</b></em>' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int FACET_REFERENCE__NAME = EcorePackage.EREFERENCE__NAME; - - /** - * The feature id for the '<em><b>Ordered</b></em>' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int FACET_REFERENCE__ORDERED = EcorePackage.EREFERENCE__ORDERED; - - /** - * The feature id for the '<em><b>Unique</b></em>' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int FACET_REFERENCE__UNIQUE = EcorePackage.EREFERENCE__UNIQUE; - - /** - * The feature id for the '<em><b>Lower Bound</b></em>' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int FACET_REFERENCE__LOWER_BOUND = EcorePackage.EREFERENCE__LOWER_BOUND; - - /** - * The feature id for the '<em><b>Upper Bound</b></em>' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int FACET_REFERENCE__UPPER_BOUND = EcorePackage.EREFERENCE__UPPER_BOUND; - - /** - * The feature id for the '<em><b>Many</b></em>' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int FACET_REFERENCE__MANY = EcorePackage.EREFERENCE__MANY; - - /** - * The feature id for the '<em><b>Required</b></em>' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int FACET_REFERENCE__REQUIRED = EcorePackage.EREFERENCE__REQUIRED; - - /** - * The feature id for the '<em><b>EType</b></em>' reference. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int FACET_REFERENCE__ETYPE = EcorePackage.EREFERENCE__ETYPE; - - /** - * The feature id for the '<em><b>EGeneric Type</b></em>' containment reference. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int FACET_REFERENCE__EGENERIC_TYPE = EcorePackage.EREFERENCE__EGENERIC_TYPE; - - /** - * The feature id for the '<em><b>Changeable</b></em>' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int FACET_REFERENCE__CHANGEABLE = EcorePackage.EREFERENCE__CHANGEABLE; - - /** - * The feature id for the '<em><b>Volatile</b></em>' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int FACET_REFERENCE__VOLATILE = EcorePackage.EREFERENCE__VOLATILE; - - /** - * The feature id for the '<em><b>Transient</b></em>' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int FACET_REFERENCE__TRANSIENT = EcorePackage.EREFERENCE__TRANSIENT; - - /** - * The feature id for the '<em><b>Default Value Literal</b></em>' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int FACET_REFERENCE__DEFAULT_VALUE_LITERAL = EcorePackage.EREFERENCE__DEFAULT_VALUE_LITERAL; - - /** - * The feature id for the '<em><b>Default Value</b></em>' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int FACET_REFERENCE__DEFAULT_VALUE = EcorePackage.EREFERENCE__DEFAULT_VALUE; - - /** - * The feature id for the '<em><b>Unsettable</b></em>' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int FACET_REFERENCE__UNSETTABLE = EcorePackage.EREFERENCE__UNSETTABLE; - - /** - * The feature id for the '<em><b>Derived</b></em>' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int FACET_REFERENCE__DERIVED = EcorePackage.EREFERENCE__DERIVED; - - /** - * The feature id for the '<em><b>EContaining Class</b></em>' container reference. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int FACET_REFERENCE__ECONTAINING_CLASS = EcorePackage.EREFERENCE__ECONTAINING_CLASS; - - /** - * The feature id for the '<em><b>Containment</b></em>' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int FACET_REFERENCE__CONTAINMENT = EcorePackage.EREFERENCE__CONTAINMENT; - - /** - * The feature id for the '<em><b>Container</b></em>' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int FACET_REFERENCE__CONTAINER = EcorePackage.EREFERENCE__CONTAINER; - - /** - * The feature id for the '<em><b>Resolve Proxies</b></em>' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int FACET_REFERENCE__RESOLVE_PROXIES = EcorePackage.EREFERENCE__RESOLVE_PROXIES; - - /** - * The feature id for the '<em><b>EOpposite</b></em>' reference. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int FACET_REFERENCE__EOPPOSITE = EcorePackage.EREFERENCE__EOPPOSITE; - - /** - * The feature id for the '<em><b>EReference Type</b></em>' reference. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int FACET_REFERENCE__EREFERENCE_TYPE = EcorePackage.EREFERENCE__EREFERENCE_TYPE; - - /** - * The feature id for the '<em><b>EKeys</b></em>' reference list. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int FACET_REFERENCE__EKEYS = EcorePackage.EREFERENCE__EKEYS; - - /** - * The feature id for the '<em><b>Documentation</b></em>' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int FACET_REFERENCE__DOCUMENTATION = EcorePackage.EREFERENCE_FEATURE_COUNT + 0; - - /** - * The feature id for the '<em><b>Categories</b></em>' reference list. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int FACET_REFERENCE__CATEGORIES = EcorePackage.EREFERENCE_FEATURE_COUNT + 1; - - /** - * The feature id for the '<em><b>Query</b></em>' containment reference. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int FACET_REFERENCE__QUERY = EcorePackage.EREFERENCE_FEATURE_COUNT + 2; - - /** - * The feature id for the '<em><b>Override</b></em>' reference. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int FACET_REFERENCE__OVERRIDE = EcorePackage.EREFERENCE_FEATURE_COUNT + 3; - - /** - * The feature id for the '<em><b>FOpposite</b></em>' reference. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - * @since 1.0 - */ - int FACET_REFERENCE__FOPPOSITE = EcorePackage.EREFERENCE_FEATURE_COUNT + 4; - - /** - * The number of structural features of the '<em>Facet Reference</em>' class. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int FACET_REFERENCE_FEATURE_COUNT = EcorePackage.EREFERENCE_FEATURE_COUNT + 5; - - /** - * The meta object id for the '{@link org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.impl.FacetOperationImpl <em>Facet Operation</em>}' class. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.impl.FacetOperationImpl - * @see org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.impl.EFacetPackageImpl#getFacetOperation() - * @generated - */ - int FACET_OPERATION = 2; - - /** - * The feature id for the '<em><b>EAnnotations</b></em>' containment reference list. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int FACET_OPERATION__EANNOTATIONS = EcorePackage.EOPERATION__EANNOTATIONS; - - /** - * The feature id for the '<em><b>Name</b></em>' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int FACET_OPERATION__NAME = EcorePackage.EOPERATION__NAME; - - /** - * The feature id for the '<em><b>Ordered</b></em>' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int FACET_OPERATION__ORDERED = EcorePackage.EOPERATION__ORDERED; - - /** - * The feature id for the '<em><b>Unique</b></em>' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int FACET_OPERATION__UNIQUE = EcorePackage.EOPERATION__UNIQUE; - - /** - * The feature id for the '<em><b>Lower Bound</b></em>' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int FACET_OPERATION__LOWER_BOUND = EcorePackage.EOPERATION__LOWER_BOUND; - - /** - * The feature id for the '<em><b>Upper Bound</b></em>' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int FACET_OPERATION__UPPER_BOUND = EcorePackage.EOPERATION__UPPER_BOUND; - - /** - * The feature id for the '<em><b>Many</b></em>' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int FACET_OPERATION__MANY = EcorePackage.EOPERATION__MANY; - - /** - * The feature id for the '<em><b>Required</b></em>' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int FACET_OPERATION__REQUIRED = EcorePackage.EOPERATION__REQUIRED; - - /** - * The feature id for the '<em><b>EType</b></em>' reference. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int FACET_OPERATION__ETYPE = EcorePackage.EOPERATION__ETYPE; - - /** - * The feature id for the '<em><b>EGeneric Type</b></em>' containment reference. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int FACET_OPERATION__EGENERIC_TYPE = EcorePackage.EOPERATION__EGENERIC_TYPE; - - /** - * The feature id for the '<em><b>EContaining Class</b></em>' container reference. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int FACET_OPERATION__ECONTAINING_CLASS = EcorePackage.EOPERATION__ECONTAINING_CLASS; - - /** - * The feature id for the '<em><b>EType Parameters</b></em>' containment reference list. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int FACET_OPERATION__ETYPE_PARAMETERS = EcorePackage.EOPERATION__ETYPE_PARAMETERS; - - /** - * The feature id for the '<em><b>EParameters</b></em>' containment reference list. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int FACET_OPERATION__EPARAMETERS = EcorePackage.EOPERATION__EPARAMETERS; - - /** - * The feature id for the '<em><b>EExceptions</b></em>' reference list. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int FACET_OPERATION__EEXCEPTIONS = EcorePackage.EOPERATION__EEXCEPTIONS; - - /** - * The feature id for the '<em><b>EGeneric Exceptions</b></em>' containment reference list. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int FACET_OPERATION__EGENERIC_EXCEPTIONS = EcorePackage.EOPERATION__EGENERIC_EXCEPTIONS; - - /** - * The feature id for the '<em><b>Documentation</b></em>' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int FACET_OPERATION__DOCUMENTATION = EcorePackage.EOPERATION_FEATURE_COUNT + 0; - - /** - * The feature id for the '<em><b>Categories</b></em>' reference list. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int FACET_OPERATION__CATEGORIES = EcorePackage.EOPERATION_FEATURE_COUNT + 1; - - /** - * The feature id for the '<em><b>Query</b></em>' containment reference. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int FACET_OPERATION__QUERY = EcorePackage.EOPERATION_FEATURE_COUNT + 2; - - /** - * The feature id for the '<em><b>Override</b></em>' reference. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int FACET_OPERATION__OVERRIDE = EcorePackage.EOPERATION_FEATURE_COUNT + 3; - - /** - * The number of structural features of the '<em>Facet Operation</em>' class. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int FACET_OPERATION_FEATURE_COUNT = EcorePackage.EOPERATION_FEATURE_COUNT + 4; - - /** - * The meta object id for the '{@link org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.impl.FacetSetImpl <em>Facet Set</em>}' class. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.impl.FacetSetImpl - * @see org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.impl.EFacetPackageImpl#getFacetSet() - * @generated - */ - int FACET_SET = 3; - - /** - * The feature id for the '<em><b>EAnnotations</b></em>' containment reference list. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int FACET_SET__EANNOTATIONS = EcorePackage.EPACKAGE__EANNOTATIONS; - - /** - * The feature id for the '<em><b>Name</b></em>' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int FACET_SET__NAME = EcorePackage.EPACKAGE__NAME; - - /** - * The feature id for the '<em><b>Ns URI</b></em>' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int FACET_SET__NS_URI = EcorePackage.EPACKAGE__NS_URI; - - /** - * The feature id for the '<em><b>Ns Prefix</b></em>' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int FACET_SET__NS_PREFIX = EcorePackage.EPACKAGE__NS_PREFIX; - - /** - * The feature id for the '<em><b>EFactory Instance</b></em>' reference. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int FACET_SET__EFACTORY_INSTANCE = EcorePackage.EPACKAGE__EFACTORY_INSTANCE; - - /** - * The feature id for the '<em><b>EClassifiers</b></em>' containment reference list. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int FACET_SET__ECLASSIFIERS = EcorePackage.EPACKAGE__ECLASSIFIERS; - - /** - * The feature id for the '<em><b>ESubpackages</b></em>' containment reference list. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int FACET_SET__ESUBPACKAGES = EcorePackage.EPACKAGE__ESUBPACKAGES; - - /** - * The feature id for the '<em><b>ESuper Package</b></em>' container reference. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int FACET_SET__ESUPER_PACKAGE = EcorePackage.EPACKAGE__ESUPER_PACKAGE; - - /** - * The feature id for the '<em><b>Documentation</b></em>' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int FACET_SET__DOCUMENTATION = EcorePackage.EPACKAGE_FEATURE_COUNT + 0; - - /** - * The feature id for the '<em><b>Categories</b></em>' containment reference list. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int FACET_SET__CATEGORIES = EcorePackage.EPACKAGE_FEATURE_COUNT + 1; - - /** - * The number of structural features of the '<em>Facet Set</em>' class. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int FACET_SET_FEATURE_COUNT = EcorePackage.EPACKAGE_FEATURE_COUNT + 2; - - /** - * The meta object id for the '{@link org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.impl.FacetImpl <em>Facet</em>}' class. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.impl.FacetImpl - * @see org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.impl.EFacetPackageImpl#getFacet() - * @generated - */ - int FACET = 4; - - /** - * The feature id for the '<em><b>EAnnotations</b></em>' containment reference list. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int FACET__EANNOTATIONS = EcorePackage.ECLASSIFIER__EANNOTATIONS; - - /** - * The feature id for the '<em><b>Name</b></em>' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int FACET__NAME = EcorePackage.ECLASSIFIER__NAME; - - /** - * The feature id for the '<em><b>Instance Class Name</b></em>' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int FACET__INSTANCE_CLASS_NAME = EcorePackage.ECLASSIFIER__INSTANCE_CLASS_NAME; - - /** - * The feature id for the '<em><b>Instance Class</b></em>' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int FACET__INSTANCE_CLASS = EcorePackage.ECLASSIFIER__INSTANCE_CLASS; - - /** - * The feature id for the '<em><b>Default Value</b></em>' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int FACET__DEFAULT_VALUE = EcorePackage.ECLASSIFIER__DEFAULT_VALUE; - - /** - * The feature id for the '<em><b>Instance Type Name</b></em>' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int FACET__INSTANCE_TYPE_NAME = EcorePackage.ECLASSIFIER__INSTANCE_TYPE_NAME; - - /** - * The feature id for the '<em><b>EPackage</b></em>' container reference. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int FACET__EPACKAGE = EcorePackage.ECLASSIFIER__EPACKAGE; - - /** - * The feature id for the '<em><b>EType Parameters</b></em>' containment reference list. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int FACET__ETYPE_PARAMETERS = EcorePackage.ECLASSIFIER__ETYPE_PARAMETERS; - - /** - * The feature id for the '<em><b>Documentation</b></em>' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int FACET__DOCUMENTATION = EcorePackage.ECLASSIFIER_FEATURE_COUNT + 0; - - /** - * The feature id for the '<em><b>Extended Metaclass</b></em>' reference. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int FACET__EXTENDED_METACLASS = EcorePackage.ECLASSIFIER_FEATURE_COUNT + 1; - - /** - * The feature id for the '<em><b>Facet Elements</b></em>' containment reference list. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int FACET__FACET_ELEMENTS = EcorePackage.ECLASSIFIER_FEATURE_COUNT + 2; - - /** - * The feature id for the '<em><b>Facet Operations</b></em>' containment reference list. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int FACET__FACET_OPERATIONS = EcorePackage.ECLASSIFIER_FEATURE_COUNT + 3; - - /** - * The feature id for the '<em><b>Conformance Typed Element</b></em>' reference. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int FACET__CONFORMANCE_TYPED_ELEMENT = EcorePackage.ECLASSIFIER_FEATURE_COUNT + 4; - - /** - * The feature id for the '<em><b>Extended Facets</b></em>' reference list. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - * @since 0.2 - */ - int FACET__EXTENDED_FACETS = EcorePackage.ECLASSIFIER_FEATURE_COUNT + 5; - - /** - * The number of structural features of the '<em>Facet</em>' class. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int FACET_FEATURE_COUNT = EcorePackage.ECLASSIFIER_FEATURE_COUNT + 6; - - /** - * The meta object id for the '{@link org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.impl.CategoryImpl <em>Category</em>}' class. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.impl.CategoryImpl - * @see org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.impl.EFacetPackageImpl#getCategory() - * @generated - */ - int CATEGORY = 5; - - /** - * The feature id for the '<em><b>EAnnotations</b></em>' containment reference list. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int CATEGORY__EANNOTATIONS = EcorePackage.ENAMED_ELEMENT__EANNOTATIONS; - - /** - * The feature id for the '<em><b>Name</b></em>' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int CATEGORY__NAME = EcorePackage.ENAMED_ELEMENT__NAME; - - /** - * The feature id for the '<em><b>Documentation</b></em>' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int CATEGORY__DOCUMENTATION = EcorePackage.ENAMED_ELEMENT_FEATURE_COUNT + 0; - - /** - * The number of structural features of the '<em>Category</em>' class. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int CATEGORY_FEATURE_COUNT = EcorePackage.ENAMED_ELEMENT_FEATURE_COUNT + 1; - - /** - * The meta object id for the '{@link org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.impl.FacetElementImpl <em>Facet Element</em>}' class. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.impl.FacetElementImpl - * @see org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.impl.EFacetPackageImpl#getFacetElement() - * @generated - */ - int FACET_ELEMENT = 6; - - /** - * The feature id for the '<em><b>EAnnotations</b></em>' containment reference list. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int FACET_ELEMENT__EANNOTATIONS = EcorePackage.ETYPED_ELEMENT__EANNOTATIONS; - - /** - * The feature id for the '<em><b>Name</b></em>' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int FACET_ELEMENT__NAME = EcorePackage.ETYPED_ELEMENT__NAME; - - /** - * The feature id for the '<em><b>Ordered</b></em>' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int FACET_ELEMENT__ORDERED = EcorePackage.ETYPED_ELEMENT__ORDERED; - - /** - * The feature id for the '<em><b>Unique</b></em>' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int FACET_ELEMENT__UNIQUE = EcorePackage.ETYPED_ELEMENT__UNIQUE; - - /** - * The feature id for the '<em><b>Lower Bound</b></em>' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int FACET_ELEMENT__LOWER_BOUND = EcorePackage.ETYPED_ELEMENT__LOWER_BOUND; - - /** - * The feature id for the '<em><b>Upper Bound</b></em>' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int FACET_ELEMENT__UPPER_BOUND = EcorePackage.ETYPED_ELEMENT__UPPER_BOUND; - - /** - * The feature id for the '<em><b>Many</b></em>' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int FACET_ELEMENT__MANY = EcorePackage.ETYPED_ELEMENT__MANY; - - /** - * The feature id for the '<em><b>Required</b></em>' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int FACET_ELEMENT__REQUIRED = EcorePackage.ETYPED_ELEMENT__REQUIRED; - - /** - * The feature id for the '<em><b>EType</b></em>' reference. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int FACET_ELEMENT__ETYPE = EcorePackage.ETYPED_ELEMENT__ETYPE; - - /** - * The feature id for the '<em><b>EGeneric Type</b></em>' containment reference. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int FACET_ELEMENT__EGENERIC_TYPE = EcorePackage.ETYPED_ELEMENT__EGENERIC_TYPE; - - /** - * The feature id for the '<em><b>Documentation</b></em>' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int FACET_ELEMENT__DOCUMENTATION = EcorePackage.ETYPED_ELEMENT_FEATURE_COUNT + 0; - - /** - * The feature id for the '<em><b>Categories</b></em>' reference list. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int FACET_ELEMENT__CATEGORIES = EcorePackage.ETYPED_ELEMENT_FEATURE_COUNT + 1; - - /** - * The number of structural features of the '<em>Facet Element</em>' class. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int FACET_ELEMENT_FEATURE_COUNT = EcorePackage.ETYPED_ELEMENT_FEATURE_COUNT + 2; - - /** - * The meta object id for the '{@link org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.impl.DerivedTypedElementImpl <em>Derived Typed Element</em>}' class. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.impl.DerivedTypedElementImpl - * @see org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.impl.EFacetPackageImpl#getDerivedTypedElement() - * @generated - */ - int DERIVED_TYPED_ELEMENT = 7; - - /** - * The feature id for the '<em><b>EAnnotations</b></em>' containment reference list. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int DERIVED_TYPED_ELEMENT__EANNOTATIONS = FACET_ELEMENT__EANNOTATIONS; - - /** - * The feature id for the '<em><b>Name</b></em>' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int DERIVED_TYPED_ELEMENT__NAME = FACET_ELEMENT__NAME; - - /** - * The feature id for the '<em><b>Ordered</b></em>' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int DERIVED_TYPED_ELEMENT__ORDERED = FACET_ELEMENT__ORDERED; - - /** - * The feature id for the '<em><b>Unique</b></em>' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int DERIVED_TYPED_ELEMENT__UNIQUE = FACET_ELEMENT__UNIQUE; - - /** - * The feature id for the '<em><b>Lower Bound</b></em>' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int DERIVED_TYPED_ELEMENT__LOWER_BOUND = FACET_ELEMENT__LOWER_BOUND; - - /** - * The feature id for the '<em><b>Upper Bound</b></em>' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int DERIVED_TYPED_ELEMENT__UPPER_BOUND = FACET_ELEMENT__UPPER_BOUND; - - /** - * The feature id for the '<em><b>Many</b></em>' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int DERIVED_TYPED_ELEMENT__MANY = FACET_ELEMENT__MANY; - - /** - * The feature id for the '<em><b>Required</b></em>' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int DERIVED_TYPED_ELEMENT__REQUIRED = FACET_ELEMENT__REQUIRED; - - /** - * The feature id for the '<em><b>EType</b></em>' reference. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int DERIVED_TYPED_ELEMENT__ETYPE = FACET_ELEMENT__ETYPE; - - /** - * The feature id for the '<em><b>EGeneric Type</b></em>' containment reference. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int DERIVED_TYPED_ELEMENT__EGENERIC_TYPE = FACET_ELEMENT__EGENERIC_TYPE; - - /** - * The feature id for the '<em><b>Documentation</b></em>' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int DERIVED_TYPED_ELEMENT__DOCUMENTATION = FACET_ELEMENT__DOCUMENTATION; - - /** - * The feature id for the '<em><b>Categories</b></em>' reference list. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int DERIVED_TYPED_ELEMENT__CATEGORIES = FACET_ELEMENT__CATEGORIES; - - /** - * The feature id for the '<em><b>Query</b></em>' containment reference. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int DERIVED_TYPED_ELEMENT__QUERY = FACET_ELEMENT_FEATURE_COUNT + 0; - - /** - * The feature id for the '<em><b>Override</b></em>' reference. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int DERIVED_TYPED_ELEMENT__OVERRIDE = FACET_ELEMENT_FEATURE_COUNT + 1; - - /** - * The number of structural features of the '<em>Derived Typed Element</em>' class. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int DERIVED_TYPED_ELEMENT_FEATURE_COUNT = FACET_ELEMENT_FEATURE_COUNT + 2; - - /** - * The meta object id for the '{@link org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.impl.ParameterValueImpl <em>Parameter Value</em>}' class. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.impl.ParameterValueImpl - * @see org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.impl.EFacetPackageImpl#getParameterValue() - * @generated - */ - int PARAMETER_VALUE = 8; - - /** - * The feature id for the '<em><b>Parameter</b></em>' reference. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int PARAMETER_VALUE__PARAMETER = 0; - - /** - * The feature id for the '<em><b>Value</b></em>' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int PARAMETER_VALUE__VALUE = 1; - - /** - * The number of structural features of the '<em>Parameter Value</em>' class. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int PARAMETER_VALUE_FEATURE_COUNT = 2; - - /** - * The meta object id for the '{@link org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.impl.DocumentedElementImpl <em>Documented Element</em>}' class. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.impl.DocumentedElementImpl - * @see org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.impl.EFacetPackageImpl#getDocumentedElement() - * @generated - */ - int DOCUMENTED_ELEMENT = 9; - - /** - * The feature id for the '<em><b>Documentation</b></em>' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int DOCUMENTED_ELEMENT__DOCUMENTATION = 0; - - /** - * The number of structural features of the '<em>Documented Element</em>' class. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int DOCUMENTED_ELEMENT_FEATURE_COUNT = 1; - - /** - * The meta object id for the '<em>Resource</em>' data type. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see org.eclipse.emf.ecore.resource.Resource - * @see org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.impl.EFacetPackageImpl#getResource() - * @generated - */ - int RESOURCE = 10; - - - /** - * Returns the meta object for class '{@link org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.FacetAttribute <em>Facet Attribute</em>}'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the meta object for class '<em>Facet Attribute</em>'. - * @see org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.FacetAttribute - * @generated - */ - EClass getFacetAttribute(); - - /** - * Returns the meta object for class '{@link org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.FacetReference <em>Facet Reference</em>}'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the meta object for class '<em>Facet Reference</em>'. - * @see org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.FacetReference - * @generated - */ - EClass getFacetReference(); - - /** - * Returns the meta object for the reference '{@link org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.FacetReference#getFOpposite <em>FOpposite</em>}'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the meta object for the reference '<em>FOpposite</em>'. - * @see org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.FacetReference#getFOpposite() - * @see #getFacetReference() - * @generated - * @since 1.0 - */ - EReference getFacetReference_FOpposite(); - - /** - * Returns the meta object for class '{@link org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.FacetOperation <em>Facet Operation</em>}'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the meta object for class '<em>Facet Operation</em>'. - * @see org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.FacetOperation - * @generated - */ - EClass getFacetOperation(); - - /** - * Returns the meta object for class '{@link org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.FacetSet <em>Facet Set</em>}'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the meta object for class '<em>Facet Set</em>'. - * @see org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.FacetSet - * @generated - */ - EClass getFacetSet(); - - /** - * Returns the meta object for the containment reference list '{@link org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.FacetSet#getCategories <em>Categories</em>}'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the meta object for the containment reference list '<em>Categories</em>'. - * @see org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.FacetSet#getCategories() - * @see #getFacetSet() - * @generated - */ - EReference getFacetSet_Categories(); - - /** - * Returns the meta object for class '{@link org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.Facet <em>Facet</em>}'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the meta object for class '<em>Facet</em>'. - * @see org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.Facet - * @generated - */ - EClass getFacet(); - - /** - * Returns the meta object for the reference '{@link org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.Facet#getExtendedMetaclass <em>Extended Metaclass</em>}'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the meta object for the reference '<em>Extended Metaclass</em>'. - * @see org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.Facet#getExtendedMetaclass() - * @see #getFacet() - * @generated - */ - EReference getFacet_ExtendedMetaclass(); - - /** - * Returns the meta object for the containment reference list '{@link org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.Facet#getFacetElements <em>Facet Elements</em>}'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the meta object for the containment reference list '<em>Facet Elements</em>'. - * @see org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.Facet#getFacetElements() - * @see #getFacet() - * @generated - */ - EReference getFacet_FacetElements(); - - /** - * Returns the meta object for the containment reference list '{@link org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.Facet#getFacetOperations <em>Facet Operations</em>}'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the meta object for the containment reference list '<em>Facet Operations</em>'. - * @see org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.Facet#getFacetOperations() - * @see #getFacet() - * @generated - */ - EReference getFacet_FacetOperations(); - - /** - * Returns the meta object for the reference '{@link org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.Facet#getConformanceTypedElement <em>Conformance Typed Element</em>}'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the meta object for the reference '<em>Conformance Typed Element</em>'. - * @see org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.Facet#getConformanceTypedElement() - * @see #getFacet() - * @generated - */ - EReference getFacet_ConformanceTypedElement(); - - /** - * Returns the meta object for the reference list '{@link org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.Facet#getExtendedFacets <em>Extended Facets</em>}'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the meta object for the reference list '<em>Extended Facets</em>'. - * @see org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.Facet#getExtendedFacets() - * @see #getFacet() - * @generated - * @since 0.2 - */ - EReference getFacet_ExtendedFacets(); - - /** - * Returns the meta object for class '{@link org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.Category <em>Category</em>}'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the meta object for class '<em>Category</em>'. - * @see org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.Category - * @generated - */ - EClass getCategory(); - - /** - * Returns the meta object for class '{@link org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.FacetElement <em>Facet Element</em>}'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the meta object for class '<em>Facet Element</em>'. - * @see org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.FacetElement - * @generated - */ - EClass getFacetElement(); - - /** - * Returns the meta object for the reference list '{@link org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.FacetElement#getCategories <em>Categories</em>}'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the meta object for the reference list '<em>Categories</em>'. - * @see org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.FacetElement#getCategories() - * @see #getFacetElement() - * @generated - */ - EReference getFacetElement_Categories(); - - /** - * Returns the meta object for class '{@link org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.DerivedTypedElement <em>Derived Typed Element</em>}'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the meta object for class '<em>Derived Typed Element</em>'. - * @see org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.DerivedTypedElement - * @generated - */ - EClass getDerivedTypedElement(); - - /** - * Returns the meta object for the containment reference '{@link org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.DerivedTypedElement#getQuery <em>Query</em>}'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the meta object for the containment reference '<em>Query</em>'. - * @see org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.DerivedTypedElement#getQuery() - * @see #getDerivedTypedElement() - * @generated - */ - EReference getDerivedTypedElement_Query(); - - /** - * Returns the meta object for the reference '{@link org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.DerivedTypedElement#getOverride <em>Override</em>}'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the meta object for the reference '<em>Override</em>'. - * @see org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.DerivedTypedElement#getOverride() - * @see #getDerivedTypedElement() - * @generated - */ - EReference getDerivedTypedElement_Override(); - - /** - * Returns the meta object for class '{@link org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.ParameterValue <em>Parameter Value</em>}'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the meta object for class '<em>Parameter Value</em>'. - * @see org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.ParameterValue - * @generated - */ - EClass getParameterValue(); - - /** - * Returns the meta object for the reference '{@link org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.ParameterValue#getParameter <em>Parameter</em>}'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the meta object for the reference '<em>Parameter</em>'. - * @see org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.ParameterValue#getParameter() - * @see #getParameterValue() - * @generated - */ - EReference getParameterValue_Parameter(); - - /** - * Returns the meta object for the attribute '{@link org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.ParameterValue#getValue <em>Value</em>}'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the meta object for the attribute '<em>Value</em>'. - * @see org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.ParameterValue#getValue() - * @see #getParameterValue() - * @generated - */ - EAttribute getParameterValue_Value(); - - /** - * Returns the meta object for class '{@link org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.DocumentedElement <em>Documented Element</em>}'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the meta object for class '<em>Documented Element</em>'. - * @see org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.DocumentedElement - * @generated - */ - EClass getDocumentedElement(); - - /** - * Returns the meta object for the attribute '{@link org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.DocumentedElement#getDocumentation <em>Documentation</em>}'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the meta object for the attribute '<em>Documentation</em>'. - * @see org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.DocumentedElement#getDocumentation() - * @see #getDocumentedElement() - * @generated - */ - EAttribute getDocumentedElement_Documentation(); - - /** - * Returns the meta object for data type '{@link org.eclipse.emf.ecore.resource.Resource <em>Resource</em>}'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the meta object for data type '<em>Resource</em>'. - * @see org.eclipse.emf.ecore.resource.Resource - * @model instanceClass="org.eclipse.emf.ecore.resource.Resource" - * @generated - */ - EDataType getResource(); - - /** - * Returns the factory that creates the instances of the model. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the factory that creates the instances of the model. - * @generated - */ - EFacetFactory getEFacetFactory(); - - /** - * <!-- begin-user-doc --> - * Defines literals for the meta objects that represent - * <ul> - * <li>each class,</li> - * <li>each feature of each class,</li> - * <li>each enum,</li> - * <li>and each data type</li> - * </ul> - * <!-- end-user-doc --> - * @generated - */ - interface Literals { - /** - * The meta object literal for the '{@link org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.impl.FacetAttributeImpl <em>Facet Attribute</em>}' class. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.impl.FacetAttributeImpl - * @see org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.impl.EFacetPackageImpl#getFacetAttribute() - * @generated - */ - EClass FACET_ATTRIBUTE = eINSTANCE.getFacetAttribute(); - - /** - * The meta object literal for the '{@link org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.impl.FacetReferenceImpl <em>Facet Reference</em>}' class. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.impl.FacetReferenceImpl - * @see org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.impl.EFacetPackageImpl#getFacetReference() - * @generated - */ - EClass FACET_REFERENCE = eINSTANCE.getFacetReference(); - - /** - * The meta object literal for the '<em><b>FOpposite</b></em>' reference feature. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @since 1.0 - */ - EReference FACET_REFERENCE__FOPPOSITE = eINSTANCE.getFacetReference_FOpposite(); - - /** - * The meta object literal for the '{@link org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.impl.FacetOperationImpl <em>Facet Operation</em>}' class. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.impl.FacetOperationImpl - * @see org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.impl.EFacetPackageImpl#getFacetOperation() - * @generated - */ - EClass FACET_OPERATION = eINSTANCE.getFacetOperation(); - - /** - * The meta object literal for the '{@link org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.impl.FacetSetImpl <em>Facet Set</em>}' class. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.impl.FacetSetImpl - * @see org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.impl.EFacetPackageImpl#getFacetSet() - * @generated - */ - EClass FACET_SET = eINSTANCE.getFacetSet(); - - /** - * The meta object literal for the '<em><b>Categories</b></em>' containment reference list feature. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - EReference FACET_SET__CATEGORIES = eINSTANCE.getFacetSet_Categories(); - - /** - * The meta object literal for the '{@link org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.impl.FacetImpl <em>Facet</em>}' class. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.impl.FacetImpl - * @see org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.impl.EFacetPackageImpl#getFacet() - * @generated - */ - EClass FACET = eINSTANCE.getFacet(); - - /** - * The meta object literal for the '<em><b>Extended Metaclass</b></em>' reference feature. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - EReference FACET__EXTENDED_METACLASS = eINSTANCE.getFacet_ExtendedMetaclass(); - - /** - * The meta object literal for the '<em><b>Facet Elements</b></em>' containment reference list feature. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - EReference FACET__FACET_ELEMENTS = eINSTANCE.getFacet_FacetElements(); - - /** - * The meta object literal for the '<em><b>Facet Operations</b></em>' containment reference list feature. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - EReference FACET__FACET_OPERATIONS = eINSTANCE.getFacet_FacetOperations(); - - /** - * The meta object literal for the '<em><b>Conformance Typed Element</b></em>' reference feature. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - EReference FACET__CONFORMANCE_TYPED_ELEMENT = eINSTANCE.getFacet_ConformanceTypedElement(); - - /** - * The meta object literal for the '<em><b>Extended Facets</b></em>' reference list feature. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @since 0.2 - */ - EReference FACET__EXTENDED_FACETS = eINSTANCE.getFacet_ExtendedFacets(); - - /** - * The meta object literal for the '{@link org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.impl.CategoryImpl <em>Category</em>}' class. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.impl.CategoryImpl - * @see org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.impl.EFacetPackageImpl#getCategory() - * @generated - */ - EClass CATEGORY = eINSTANCE.getCategory(); - - /** - * The meta object literal for the '{@link org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.impl.FacetElementImpl <em>Facet Element</em>}' class. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.impl.FacetElementImpl - * @see org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.impl.EFacetPackageImpl#getFacetElement() - * @generated - */ - EClass FACET_ELEMENT = eINSTANCE.getFacetElement(); - - /** - * The meta object literal for the '<em><b>Categories</b></em>' reference list feature. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - EReference FACET_ELEMENT__CATEGORIES = eINSTANCE.getFacetElement_Categories(); - - /** - * The meta object literal for the '{@link org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.impl.DerivedTypedElementImpl <em>Derived Typed Element</em>}' class. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.impl.DerivedTypedElementImpl - * @see org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.impl.EFacetPackageImpl#getDerivedTypedElement() - * @generated - */ - EClass DERIVED_TYPED_ELEMENT = eINSTANCE.getDerivedTypedElement(); - - /** - * The meta object literal for the '<em><b>Query</b></em>' containment reference feature. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - EReference DERIVED_TYPED_ELEMENT__QUERY = eINSTANCE.getDerivedTypedElement_Query(); - - /** - * The meta object literal for the '<em><b>Override</b></em>' reference feature. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - EReference DERIVED_TYPED_ELEMENT__OVERRIDE = eINSTANCE.getDerivedTypedElement_Override(); - - /** - * The meta object literal for the '{@link org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.impl.ParameterValueImpl <em>Parameter Value</em>}' class. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.impl.ParameterValueImpl - * @see org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.impl.EFacetPackageImpl#getParameterValue() - * @generated - */ - EClass PARAMETER_VALUE = eINSTANCE.getParameterValue(); - - /** - * The meta object literal for the '<em><b>Parameter</b></em>' reference feature. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - EReference PARAMETER_VALUE__PARAMETER = eINSTANCE.getParameterValue_Parameter(); - - /** - * The meta object literal for the '<em><b>Value</b></em>' attribute feature. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - EAttribute PARAMETER_VALUE__VALUE = eINSTANCE.getParameterValue_Value(); - - /** - * The meta object literal for the '{@link org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.impl.DocumentedElementImpl <em>Documented Element</em>}' class. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.impl.DocumentedElementImpl - * @see org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.impl.EFacetPackageImpl#getDocumentedElement() - * @generated - */ - EClass DOCUMENTED_ELEMENT = eINSTANCE.getDocumentedElement(); - - /** - * The meta object literal for the '<em><b>Documentation</b></em>' attribute feature. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - EAttribute DOCUMENTED_ELEMENT__DOCUMENTATION = eINSTANCE.getDocumentedElement_Documentation(); - - /** - * The meta object literal for the '<em>Resource</em>' data type. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see org.eclipse.emf.ecore.resource.Resource - * @see org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.impl.EFacetPackageImpl#getResource() - * @generated - */ - EDataType RESOURCE = eINSTANCE.getResource(); - - } - -} //EFacetPackage
diff --git a/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/emf/facet/efacet/metamodel/v0_2_0/efacet/Facet.java b/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/emf/facet/efacet/metamodel/v0_2_0/efacet/Facet.java deleted file mode 100644 index 6cba38e..0000000 --- a/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/emf/facet/efacet/metamodel/v0_2_0/efacet/Facet.java +++ /dev/null
@@ -1,153 +0,0 @@ -/** - * Copyright (c) 2011 Mia-Software. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Gregoire Dupe (Mia-Software) - Design - * Nicolas Guyomar (Mia-Software) - Implementation - * Emmanuelle Rouillé (Mia-Software) - Bug 352618 - To be able to use non derived facet structural features and save them values. - * Nicolas Bros (Mia-Software) - Bug 361823 - [Restructuring] eFacet2 meta-model - * Gregoire Dupe (Mia-Software) - Bug 369987 - [Restructuring][Table] Switch to the new customization and facet framework - * Gregoire Dupe (Mia-Software) - Bug 373078 - API Cleaning - * Gregoire Dupe (Mia-Software) - Bug 376576 - [EFacet] Change the multiplicity of Facet::extendedFacet - */ -package org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet; - -import org.eclipse.emf.common.util.EList; -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.ecore.EClassifier; -import org.eclipse.emf.ecore.EStructuralFeature; -import org.eclipse.emf.ecore.ETypedElement; - -/** - * <!-- begin-user-doc --> - * A representation of the model object '<em><b>Facet</b></em>'. - * <!-- end-user-doc --> - * - * <!-- begin-model-doc --> - * A Facet is a virtual sub-type of an existing EClass. A Facet cannot be instantiated. - * <!-- end-model-doc --> - * - * <p> - * The following features are supported: - * <ul> - * <li>{@link org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.Facet#getExtendedMetaclass <em>Extended Metaclass</em>}</li> - * <li>{@link org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.Facet#getFacetElements <em>Facet Elements</em>}</li> - * <li>{@link org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.Facet#getFacetOperations <em>Facet Operations</em>}</li> - * <li>{@link org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.Facet#getConformanceTypedElement <em>Conformance Typed Element</em>}</li> - * <li>{@link org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.Facet#getExtendedFacets <em>Extended Facets</em>}</li> - * </ul> - * </p> - * - * @see org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.EFacetPackage#getFacet() - * @model annotation="http://www.eclipse.org/emf/2002/Ecore validationDelegates='( self.query.scope = self.facet.extendedMetaClass ) and ( self.query.name = self.name )'" - * annotation="http://www.eclipse.org/emf/2002/Ecore validationDelegates='self.conformanceQuery.scope = self.extendedMetaClass'" - * annotation="org.eclipse.ocl.ecore.OCL body='not(self.container().oclCastAs(FacetSet).facets->exists(f|f.extendedMetaClass.container() <> self.extendedMetaClass.container() ))'" - * @generated - */ -public interface Facet extends EClassifier, DocumentedElement { - /** - * Returns the value of the '<em><b>Extended Metaclass</b></em>' reference. - * <!-- begin-user-doc --> - * <p> - * If the meaning of the '<em>Extended Metaclass</em>' reference isn't clear, - * there really should be more of a description here... - * </p> - * <!-- end-user-doc --> - * @return the value of the '<em>Extended Metaclass</em>' reference. - * @see #setExtendedMetaclass(EClass) - * @see org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.EFacetPackage#getFacet_ExtendedMetaclass() - * @model annotation="GenModel documentation='The \"extendedMetaclass\" reference references the virtually subtyped EClass.'" - * @generated - */ - EClass getExtendedMetaclass(); - - /** - * Sets the value of the '{@link org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.Facet#getExtendedMetaclass <em>Extended Metaclass</em>}' reference. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @param value the new value of the '<em>Extended Metaclass</em>' reference. - * @see #getExtendedMetaclass() - * @generated - */ - void setExtendedMetaclass(EClass value); - - /** - * Returns the value of the '<em><b>Facet Elements</b></em>' containment reference list. - * The list contents are of type {@link org.eclipse.emf.ecore.EStructuralFeature}. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * <!-- begin-model-doc --> - * This composite reference contains virtual attributes, references and operations. - * <!-- end-model-doc --> - * @return the value of the '<em>Facet Elements</em>' containment reference list. - * @see org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.EFacetPackage#getFacet_FacetElements() - * @model containment="true" - * @generated - */ - EList<EStructuralFeature> getFacetElements(); - - /** - * Returns the value of the '<em><b>Facet Operations</b></em>' containment reference list. - * The list contents are of type {@link org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.FacetOperation}. - * <!-- begin-user-doc --> - * <p> - * If the meaning of the '<em>Facet Operations</em>' containment reference list isn't clear, - * there really should be more of a description here... - * </p> - * <!-- end-user-doc --> - * @return the value of the '<em>Facet Operations</em>' containment reference list. - * @see org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.EFacetPackage#getFacet_FacetOperations() - * @model containment="true" - * @generated - */ - EList<FacetOperation> getFacetOperations(); - - /** - * Returns the value of the '<em><b>Conformance Typed Element</b></em>' reference. - * <!-- begin-user-doc --> - * <p> - * If the meaning of the '<em>Conformance Typed Element</em>' reference isn't clear, - * there really should be more of a description here... - * </p> - * <!-- end-user-doc --> - * @return the value of the '<em>Conformance Typed Element</em>' reference. - * @see #setConformanceTypedElement(ETypedElement) - * @see org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.EFacetPackage#getFacet_ConformanceTypedElement() - * @model - * @generated - */ - ETypedElement getConformanceTypedElement(); - - /** - * Sets the value of the '{@link org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.Facet#getConformanceTypedElement <em>Conformance Typed Element</em>}' reference. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @param value the new value of the '<em>Conformance Typed Element</em>' reference. - * @see #getConformanceTypedElement() - * @generated - */ - void setConformanceTypedElement(ETypedElement value); - - /** - * Returns the value of the '<em><b>Extended Facets</b></em>' reference list. - * The list contents are of type {@link org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.Facet}. - * <!-- begin-user-doc --> - * <p> - * If the meaning of the '<em>Extended Facets</em>' reference list isn't clear, - * there really should be more of a description here... - * </p> - * <!-- end-user-doc --> - * @return the value of the '<em>Extended Facets</em>' reference list. - * @see org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.EFacetPackage#getFacet_ExtendedFacets() - * @model annotation="GenModel documentation='A facet can extend other facets. If A facet A can extend a facet B. In this case an eObject conforms to the facet A if it matches conformance evaluation of A and B. '" - * @generated - * @since 0.2 - */ - EList<Facet> getExtendedFacets(); - -} // Facet
diff --git a/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/emf/facet/efacet/metamodel/v0_2_0/efacet/FacetAttribute.java b/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/emf/facet/efacet/metamodel/v0_2_0/efacet/FacetAttribute.java deleted file mode 100644 index 352ad47..0000000 --- a/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/emf/facet/efacet/metamodel/v0_2_0/efacet/FacetAttribute.java +++ /dev/null
@@ -1,34 +0,0 @@ -/** - * Copyright (c) 2011 Mia-Software. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Gregoire Dupe (Mia-Software) - Design - * Nicolas Guyomar (Mia-Software) - Implementation - * Emmanuelle Rouillé (Mia-Software) - Bug 352618 - To be able to use non derived facet structural features and save them values. - * Nicolas Bros (Mia-Software) - Bug 361823 - [Restructuring] eFacet2 meta-model - */ -package org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet; - -import org.eclipse.emf.ecore.EAttribute; - -/** - * <!-- begin-user-doc --> - * A representation of the model object '<em><b>Facet Attribute</b></em>'. - * <!-- end-user-doc --> - * - * <!-- begin-model-doc --> - * A FacetAttribute is a virtual attribute added to all the eObjects which conform to the Facet owning the FacetAttribute. - * <!-- end-model-doc --> - * - * - * @see org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.EFacetPackage#getFacetAttribute() - * @model - * @generated - */ -public interface FacetAttribute extends EAttribute, DerivedTypedElement { -} // FacetAttribute
diff --git a/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/emf/facet/efacet/metamodel/v0_2_0/efacet/FacetElement.java b/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/emf/facet/efacet/metamodel/v0_2_0/efacet/FacetElement.java deleted file mode 100644 index b161eb0..0000000 --- a/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/emf/facet/efacet/metamodel/v0_2_0/efacet/FacetElement.java +++ /dev/null
@@ -1,57 +0,0 @@ -/** - * Copyright (c) 2011 Mia-Software. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Gregoire Dupe (Mia-Software) - Design - * Nicolas Guyomar (Mia-Software) - Implementation - * Emmanuelle Rouillé (Mia-Software) - Bug 352618 - To be able to use non derived facet structural features and save them values. - * Nicolas Bros (Mia-Software) - Bug 361823 - [Restructuring] eFacet2 meta-model - */ -package org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet; - -import org.eclipse.emf.common.util.EList; -import org.eclipse.emf.ecore.ETypedElement; - -/** - * <!-- begin-user-doc --> - * A representation of the model object '<em><b>Facet Element</b></em>'. - * <!-- end-user-doc --> - * - * <!-- begin-model-doc --> - * A facet element is owned by a facet. It can be a facet reference, a facet attribute or a facet operation. - * <!-- end-model-doc --> - * - * <p> - * The following features are supported: - * <ul> - * <li>{@link org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.FacetElement#getCategories <em>Categories</em>}</li> - * </ul> - * </p> - * - * @see org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.EFacetPackage#getFacetElement() - * @model abstract="true" - * @generated - */ -public interface FacetElement extends ETypedElement, DocumentedElement { - /** - * Returns the value of the '<em><b>Categories</b></em>' reference list. - * The list contents are of type {@link org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.Category}. - * <!-- begin-user-doc --> - * <p> - * If the meaning of the '<em>Categories</em>' reference list isn't clear, - * there really should be more of a description here... - * </p> - * <!-- end-user-doc --> - * @return the value of the '<em>Categories</em>' reference list. - * @see org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.EFacetPackage#getFacetElement_Categories() - * @model - * @generated - */ - EList<Category> getCategories(); - -} // FacetElement
diff --git a/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/emf/facet/efacet/metamodel/v0_2_0/efacet/FacetOperation.java b/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/emf/facet/efacet/metamodel/v0_2_0/efacet/FacetOperation.java deleted file mode 100644 index dbbf147..0000000 --- a/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/emf/facet/efacet/metamodel/v0_2_0/efacet/FacetOperation.java +++ /dev/null
@@ -1,34 +0,0 @@ -/** - * Copyright (c) 2011 Mia-Software. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Gregoire Dupe (Mia-Software) - Design - * Nicolas Guyomar (Mia-Software) - Implementation - * Emmanuelle Rouillé (Mia-Software) - Bug 352618 - To be able to use non derived facet structural features and save them values. - * Nicolas Bros (Mia-Software) - Bug 361823 - [Restructuring] eFacet2 meta-model - */ -package org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet; - -import org.eclipse.emf.ecore.EOperation; - -/** - * <!-- begin-user-doc --> - * A representation of the model object '<em><b>Facet Operation</b></em>'. - * <!-- end-user-doc --> - * - * <!-- begin-model-doc --> - * A FacetOperation is a virtual operation added to all the eObjects which conform to the Facet owning the FacetOperation. - * <!-- end-model-doc --> - * - * - * @see org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.EFacetPackage#getFacetOperation() - * @model - * @generated - */ -public interface FacetOperation extends EOperation, DerivedTypedElement { -} // FacetOperation
diff --git a/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/emf/facet/efacet/metamodel/v0_2_0/efacet/FacetReference.java b/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/emf/facet/efacet/metamodel/v0_2_0/efacet/FacetReference.java deleted file mode 100644 index e2b19e6..0000000 --- a/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/emf/facet/efacet/metamodel/v0_2_0/efacet/FacetReference.java +++ /dev/null
@@ -1,77 +0,0 @@ -/** - * Copyright (c) 2011, 2015 Mia-Software, and Soft-Maint. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Gregoire Dupe (Mia-Software) - Design - * Nicolas Guyomar (Mia-Software) - Implementation - * Emmanuelle Rouillé (Mia-Software) - Bug 352618 - To be able to use non derived facet structural features and save them values. - * Nicolas Bros (Mia-Software) - Bug 361823 - [Restructuring] eFacet2 meta-model - * Gregoire Dupe (Mia-Software) - Bug 366055 - NavigationQuery - * Gregoire Dupe (Mia-Software) - Bug 369673 - [Facet] IsOneOfQuery - * Olivier Remaud (Soft-Maint) - Bug 369824 - Add a simple way to return string literal constants from a customization query - * Gregoire Dupe (Mia-Software) - Bug 369987 - [Restructuring][Table] Switch to the new customization and facet framework - * Gregoire Dupe (Mia-software) - Bug 364325 - [Restructuring] The user must be able to navigate into a model using the Facet. - * Nicolas Bros (Mia-Software) - Bug 372626 - [Facet] Aggregates - * Nicolas Bros (Mia-Software) - Bug 376941 - [EFacet] Facet operation arguments in Facet model - * Gregoire Dupe (Mia-Software) - Bug 376576 - [EFacet] Change the multiplicity of Facet::extendedFacet - * Jonathan Pepin (Soft-Maint) - Bug 463898 - Create FacetReference not derived, without query and with opposite mechanism - */ -package org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet; - -import org.eclipse.emf.ecore.EReference; - -/** - * <!-- begin-user-doc --> - * A representation of the model object '<em><b>Facet Reference</b></em>'. - * <!-- end-user-doc --> - * - * <!-- begin-model-doc --> - * A FacetReference is a virtual reference added to all the eObjects which conform to the Facet owning the FacetReference. - * <!-- end-model-doc --> - * - * <p> - * The following features are supported: - * <ul> - * <li>{@link org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.FacetReference#getFOpposite <em>FOpposite</em>}</li> - * </ul> - * </p> - * - * @see org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.EFacetPackage#getFacetReference() - * @model - * @generated - */ -public interface FacetReference extends EReference, DerivedTypedElement { - - /** - * Returns the value of the '<em><b>FOpposite</b></em>' reference. - * <!-- begin-user-doc --> - * <p> - * If the meaning of the '<em>FOpposite</em>' reference isn't clear, - * there really should be more of a description here... - * </p> - * <!-- end-user-doc --> - * @return the value of the '<em>FOpposite</em>' reference. - * @see #setFOpposite(FacetReference) - * @see org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.EFacetPackage#getFacetReference_FOpposite() - * @model - * @generated - * @since 1.0 - */ - FacetReference getFOpposite(); - - /** - * Sets the value of the '{@link org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.FacetReference#getFOpposite <em>FOpposite</em>}' reference. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @param value the new value of the '<em>FOpposite</em>' reference. - * @see #getFOpposite() - * @generated - * @since 1.0 - */ - void setFOpposite(FacetReference value); -} // FacetReference
diff --git a/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/emf/facet/efacet/metamodel/v0_2_0/efacet/FacetSet.java b/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/emf/facet/efacet/metamodel/v0_2_0/efacet/FacetSet.java deleted file mode 100644 index d2e4140..0000000 --- a/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/emf/facet/efacet/metamodel/v0_2_0/efacet/FacetSet.java +++ /dev/null
@@ -1,63 +0,0 @@ -/** - * Copyright (c) 2011 Mia-Software. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Gregoire Dupe (Mia-Software) - Design - * Nicolas Guyomar (Mia-Software) - Implementation - * Emmanuelle Rouillé (Mia-Software) - Bug 352618 - To be able to use non derived facet structural features and save them values. - * Nicolas Bros (Mia-Software) - Bug 361823 - [Restructuring] eFacet2 meta-model - * Gregoire Dupe (Mia-Software) - Bug 373078 - API Cleaning - */ -package org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet; - -import org.eclipse.emf.common.util.EList; -import org.eclipse.emf.ecore.EPackage; - -/** - * <!-- begin-user-doc --> - * A representation of the model object '<em><b>Facet Set</b></em>'. - * <!-- end-user-doc --> - * - * <p> - * The following features are supported: - * <ul> - * <li>{@link org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.FacetSet#getCategories <em>Categories</em>}</li> - * </ul> - * </p> - * - * @see org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.EFacetPackage#getFacetSet() - * @model annotation="GenModel documentation='A \"FacetSet\" is the root element of a facet model. It contains a list of \"Facet\".'" - * @generated - */ -public interface FacetSet extends EPackage, DocumentedElement { - /** - * Returns the value of the '<em><b>Categories</b></em>' containment reference list. - * The list contents are of type {@link org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.Category}. - * <!-- begin-user-doc --> - * <p> - * If the meaning of the '<em>Categories</em>' containment reference list isn't clear, - * there really should be more of a description here... - * </p> - * <!-- end-user-doc --> - * @return the value of the '<em>Categories</em>' containment reference list. - * @see org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.EFacetPackage#getFacetSet_Categories() - * @model containment="true" - * @generated - */ - EList<Category> getCategories(); - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @model kind="operation" - * annotation="GenModel documentation='The FacetSets aggregated by this FacetSet (this operation is overridden in Aggregate in the aggregate metamodel).'" - * @generated - */ - EList<FacetSet> getFacetSets(); - -} // FacetSet
diff --git a/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/emf/facet/efacet/metamodel/v0_2_0/efacet/ParameterValue.java b/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/emf/facet/efacet/metamodel/v0_2_0/efacet/ParameterValue.java deleted file mode 100644 index 7c45039..0000000 --- a/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/emf/facet/efacet/metamodel/v0_2_0/efacet/ParameterValue.java +++ /dev/null
@@ -1,94 +0,0 @@ -/** - * Copyright (c) 2011 Mia-Software. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Gregoire Dupe (Mia-Software) - Design - * Nicolas Guyomar (Mia-Software) - Implementation - * Emmanuelle Rouillé (Mia-Software) - Bug 352618 - To be able to use non derived facet structural features and save them values. - * Nicolas Bros (Mia-Software) - Bug 361823 - [Restructuring] eFacet2 meta-model - */ -package org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet; - -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.EParameter; - -/** - * <!-- begin-user-doc --> - * A representation of the model object '<em><b>Parameter Value</b></em>'. - * <!-- end-user-doc --> - * - * <!-- begin-model-doc --> - * This is the value given as a parameter to execute a query for an operation. - * <!-- end-model-doc --> - * - * <p> - * The following features are supported: - * <ul> - * <li>{@link org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.ParameterValue#getParameter <em>Parameter</em>}</li> - * <li>{@link org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.ParameterValue#getValue <em>Value</em>}</li> - * </ul> - * </p> - * - * @see org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.EFacetPackage#getParameterValue() - * @model - * @generated - */ -public interface ParameterValue extends EObject { - /** - * Returns the value of the '<em><b>Parameter</b></em>' reference. - * <!-- begin-user-doc --> - * <p> - * If the meaning of the '<em>Parameter</em>' reference isn't clear, - * there really should be more of a description here... - * </p> - * <!-- end-user-doc --> - * @return the value of the '<em>Parameter</em>' reference. - * @see #setParameter(EParameter) - * @see org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.EFacetPackage#getParameterValue_Parameter() - * @model required="true" - * @generated - */ - EParameter getParameter(); - - /** - * Sets the value of the '{@link org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.ParameterValue#getParameter <em>Parameter</em>}' reference. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @param value the new value of the '<em>Parameter</em>' reference. - * @see #getParameter() - * @generated - */ - void setParameter(EParameter value); - - /** - * Returns the value of the '<em><b>Value</b></em>' attribute. - * <!-- begin-user-doc --> - * <p> - * If the meaning of the '<em>Value</em>' attribute isn't clear, - * there really should be more of a description here... - * </p> - * <!-- end-user-doc --> - * @return the value of the '<em>Value</em>' attribute. - * @see #setValue(Object) - * @see org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.EFacetPackage#getParameterValue_Value() - * @model - * @generated - */ - Object getValue(); - - /** - * Sets the value of the '{@link org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.ParameterValue#getValue <em>Value</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @param value the new value of the '<em>Value</em>' attribute. - * @see #getValue() - * @generated - */ - void setValue(Object value); - -} // ParameterValue
diff --git a/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/emf/facet/efacet/metamodel/v0_2_0/efacet/extensible/ExtensibleFactory.java b/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/emf/facet/efacet/metamodel/v0_2_0/efacet/extensible/ExtensibleFactory.java deleted file mode 100644 index 253db73..0000000 --- a/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/emf/facet/efacet/metamodel/v0_2_0/efacet/extensible/ExtensibleFactory.java +++ /dev/null
@@ -1,46 +0,0 @@ -/** - * Copyright (c) 2011 Mia-Software. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Gregoire Dupe (Mia-Software) - Design - * Nicolas Guyomar (Mia-Software) - Implementation - * Emmanuelle Rouillé (Mia-Software) - Bug 352618 - To be able to use non derived facet structural features and save them values. - * Nicolas Bros (Mia-Software) - Bug 361823 - [Restructuring] eFacet2 meta-model - * Gregoire Dupe (Mia-Software) - Bug 373078 - API Cleaning - */ -package org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.extensible; - -import org.eclipse.emf.ecore.EFactory; - -/** - * <!-- begin-user-doc --> - * The <b>Factory</b> for the model. - * It provides a create method for each non-abstract class of the model. - * <!-- end-user-doc --> - * @see org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.extensible.ExtensiblePackage - * @generated - */ -public interface ExtensibleFactory extends EFactory { - /** - * The singleton instance of the factory. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - ExtensibleFactory eINSTANCE = org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.extensible.impl.ExtensibleFactoryImpl.init(); - - /** - * Returns the package supported by this factory. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the package supported by this factory. - * @generated - */ - ExtensiblePackage getExtensiblePackage(); - -} //ExtensibleFactory
diff --git a/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/emf/facet/efacet/metamodel/v0_2_0/efacet/extensible/ExtensiblePackage.java b/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/emf/facet/efacet/metamodel/v0_2_0/efacet/extensible/ExtensiblePackage.java deleted file mode 100644 index 5db0e50..0000000 --- a/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/emf/facet/efacet/metamodel/v0_2_0/efacet/extensible/ExtensiblePackage.java +++ /dev/null
@@ -1,191 +0,0 @@ -/** - * Copyright (c) 2011 Mia-Software. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Gregoire Dupe (Mia-Software) - Design - * Nicolas Guyomar (Mia-Software) - Implementation - * Emmanuelle Rouillé (Mia-Software) - Bug 352618 - To be able to use non derived facet structural features and save them values. - * Nicolas Bros (Mia-Software) - Bug 361823 - [Restructuring] eFacet2 meta-model - * Gregoire Dupe (Mia-Software) - Bug 373078 - API Cleaning - */ -package org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.extensible; - -import org.eclipse.emf.ecore.EAttribute; -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.ecore.EPackage; -import org.eclipse.emf.ecore.EReference; - -/** - * <!-- begin-user-doc --> - * The <b>Package</b> for the model. - * It contains accessors for the meta objects to represent - * <ul> - * <li>each class,</li> - * <li>each feature of each class,</li> - * <li>each enum,</li> - * <li>and each data type</li> - * </ul> - * <!-- end-user-doc --> - * @see org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.extensible.ExtensibleFactory - * @model kind="package" - * @generated - */ -public interface ExtensiblePackage extends EPackage { - /** - * The package name. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - String eNAME = "extensible"; //$NON-NLS-1$ - - /** - * The package namespace URI. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - String eNS_URI = "http://www.eclipse.org/emf/facet/efacet/0.2.incubation/efacet/extensible"; //$NON-NLS-1$ - - /** - * The package namespace name. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - String eNS_PREFIX = "extensible"; //$NON-NLS-1$ - - /** - * The singleton instance of the package. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - ExtensiblePackage eINSTANCE = org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.extensible.impl.ExtensiblePackageImpl.init(); - - /** - * The meta object id for the '{@link org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.extensible.impl.QueryImpl <em>Query</em>}' class. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.extensible.impl.QueryImpl - * @see org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.extensible.impl.ExtensiblePackageImpl#getQuery() - * @generated - */ - int QUERY = 0; - - /** - * The feature id for the '<em><b>Can Have Side Effects</b></em>' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int QUERY__CAN_HAVE_SIDE_EFFECTS = 0; - - /** - * The feature id for the '<em><b>Can Be Cached</b></em>' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int QUERY__CAN_BE_CACHED = 1; - - /** - * The number of structural features of the '<em>Query</em>' class. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int QUERY_FEATURE_COUNT = 2; - - - /** - * Returns the meta object for class '{@link org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.extensible.Query <em>Query</em>}'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the meta object for class '<em>Query</em>'. - * @see org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.extensible.Query - * @generated - */ - EClass getQuery(); - - /** - * Returns the meta object for the attribute '{@link org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.extensible.Query#isCanHaveSideEffects <em>Can Have Side Effects</em>}'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the meta object for the attribute '<em>Can Have Side Effects</em>'. - * @see org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.extensible.Query#isCanHaveSideEffects() - * @see #getQuery() - * @generated - */ - EAttribute getQuery_CanHaveSideEffects(); - - /** - * Returns the meta object for the attribute '{@link org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.extensible.Query#isCanBeCached <em>Can Be Cached</em>}'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the meta object for the attribute '<em>Can Be Cached</em>'. - * @see org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.extensible.Query#isCanBeCached() - * @see #getQuery() - * @generated - */ - EAttribute getQuery_CanBeCached(); - - /** - * Returns the factory that creates the instances of the model. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the factory that creates the instances of the model. - * @generated - */ - ExtensibleFactory getExtensibleFactory(); - - /** - * <!-- begin-user-doc --> - * Defines literals for the meta objects that represent - * <ul> - * <li>each class,</li> - * <li>each feature of each class,</li> - * <li>each enum,</li> - * <li>and each data type</li> - * </ul> - * <!-- end-user-doc --> - * @generated - */ - interface Literals { - /** - * The meta object literal for the '{@link org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.extensible.impl.QueryImpl <em>Query</em>}' class. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.extensible.impl.QueryImpl - * @see org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.extensible.impl.ExtensiblePackageImpl#getQuery() - * @generated - */ - EClass QUERY = eINSTANCE.getQuery(); - - /** - * The meta object literal for the '<em><b>Can Have Side Effects</b></em>' attribute feature. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - EAttribute QUERY__CAN_HAVE_SIDE_EFFECTS = eINSTANCE.getQuery_CanHaveSideEffects(); - - /** - * The meta object literal for the '<em><b>Can Be Cached</b></em>' attribute feature. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - EAttribute QUERY__CAN_BE_CACHED = eINSTANCE.getQuery_CanBeCached(); - - } - -} //ExtensiblePackage
diff --git a/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/emf/facet/efacet/metamodel/v0_2_0/efacet/extensible/Query.java b/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/emf/facet/efacet/metamodel/v0_2_0/efacet/extensible/Query.java deleted file mode 100644 index c062ad7..0000000 --- a/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/emf/facet/efacet/metamodel/v0_2_0/efacet/extensible/Query.java +++ /dev/null
@@ -1,98 +0,0 @@ -/** - * Copyright (c) 2011 Mia-Software. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Gregoire Dupe (Mia-Software) - Design - * Nicolas Guyomar (Mia-Software) - Implementation - * Emmanuelle Rouillé (Mia-Software) - Bug 352618 - To be able to use non derived facet structural features and save them values. - * Nicolas Bros (Mia-Software) - Bug 361823 - [Restructuring] eFacet2 meta-model - * Gregoire Dupe (Mia-Software) - Bug 373078 - API Cleaning - */ -package org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.extensible; - -import org.eclipse.emf.common.util.EList; -import org.eclipse.emf.ecore.EClassifier; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.EParameter; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.DerivedTypedElement; - -/** - * <!-- begin-user-doc --> - * A representation of the model object '<em><b>Query</b></em>'. - * <!-- end-user-doc --> - * - * <!-- begin-model-doc --> - * Query is the abstract representation of the concept of query. This class has to be sub-classed for each existing query language (Java, OCL, etc.) - * <!-- end-model-doc --> - * - * <p> - * The following features are supported: - * <ul> - * <li>{@link org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.extensible.Query#isCanHaveSideEffects <em>Can Have Side Effects</em>}</li> - * <li>{@link org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.extensible.Query#isCanBeCached <em>Can Be Cached</em>}</li> - * </ul> - * </p> - * - * @see org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.extensible.ExtensiblePackage#getQuery() - * @model abstract="true" - * @generated - */ -public interface Query extends EObject { - /** - * Returns the value of the '<em><b>Can Have Side Effects</b></em>' attribute. - * <!-- begin-user-doc --> - * <p> - * If the meaning of the '<em>Can Have Side Effects</em>' attribute isn't clear, - * there really should be more of a description here... - * </p> - * <!-- end-user-doc --> - * @return the value of the '<em>Can Have Side Effects</em>' attribute. - * @see #setCanHaveSideEffects(boolean) - * @see org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.extensible.ExtensiblePackage#getQuery_CanHaveSideEffects() - * @model - * @generated - */ - boolean isCanHaveSideEffects(); - - /** - * Sets the value of the '{@link org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.extensible.Query#isCanHaveSideEffects <em>Can Have Side Effects</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @param value the new value of the '<em>Can Have Side Effects</em>' attribute. - * @see #isCanHaveSideEffects() - * @generated - */ - void setCanHaveSideEffects(boolean value); - - /** - * Returns the value of the '<em><b>Can Be Cached</b></em>' attribute. - * <!-- begin-user-doc --> - * <p> - * If the meaning of the '<em>Can Be Cached</em>' attribute isn't clear, - * there really should be more of a description here... - * </p> - * <!-- end-user-doc --> - * @return the value of the '<em>Can Be Cached</em>' attribute. - * @see #setCanBeCached(boolean) - * @see org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.extensible.ExtensiblePackage#getQuery_CanBeCached() - * @model - * @generated - */ - boolean isCanBeCached(); - - /** - * Sets the value of the '{@link org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.extensible.Query#isCanBeCached <em>Can Be Cached</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @param value the new value of the '<em>Can Be Cached</em>' attribute. - * @see #isCanBeCached() - * @generated - */ - void setCanBeCached(boolean value); - -} // Query
diff --git a/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/emf/facet/efacet/metamodel/v0_2_0/efacet/extensible/impl/ExtensibleFactoryImpl.java b/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/emf/facet/efacet/metamodel/v0_2_0/efacet/extensible/impl/ExtensibleFactoryImpl.java deleted file mode 100644 index 863748b..0000000 --- a/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/emf/facet/efacet/metamodel/v0_2_0/efacet/extensible/impl/ExtensibleFactoryImpl.java +++ /dev/null
@@ -1,104 +0,0 @@ -/** - * Copyright (c) 2011, 2015 Mia-Software, and Soft-Maint. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Gregoire Dupe (Mia-Software) - Design - * Nicolas Guyomar (Mia-Software) - Implementation - * Emmanuelle Rouillé (Mia-Software) - Bug 352618 - To be able to use non derived facet structural features and save them values. - * Nicolas Bros (Mia-Software) - Bug 361823 - [Restructuring] eFacet2 meta-model - * Gregoire Dupe (Mia-Software) - Bug 366055 - NavigationQuery - * Gregoire Dupe (Mia-Software) - Bug 369673 - [Facet] IsOneOfQuery - * Olivier Remaud (Soft-Maint) - Bug 369824 - Add a simple way to return string literal constants from a customization query - * Gregoire Dupe (Mia-Software) - Bug 369987 - [Restructuring][Table] Switch to the new customization and facet framework - * Gregoire Dupe (Mia-software) - Bug 364325 - [Restructuring] The user must be able to navigate into a model using the Facet. - * Nicolas Bros (Mia-Software) - Bug 372626 - [Facet] Aggregates - * Nicolas Bros (Mia-Software) - Bug 376941 - [EFacet] Facet operation arguments in Facet model - * Gregoire Dupe (Mia-Software) - Bug 376576 - [EFacet] Change the multiplicity of Facet::extendedFacet - * Jonathan Pepin (Soft-Maint) - Bug 463898 - Create FacetReference not derived, without query and with opposite mechanism - */ -package org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.extensible.impl; - -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.EPackage; -import org.eclipse.emf.ecore.impl.EFactoryImpl; -import org.eclipse.emf.ecore.plugin.EcorePlugin; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.extensible.*; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.extensible.ExtensibleFactory; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.extensible.ExtensiblePackage; - -/** - * <!-- begin-user-doc --> - * An implementation of the model <b>Factory</b>. - * <!-- end-user-doc --> - * @generated - */ -public class ExtensibleFactoryImpl extends EFactoryImpl implements ExtensibleFactory { - /** - * Creates the default factory implementation. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public static ExtensibleFactory init() { - try { - ExtensibleFactory theExtensibleFactory = (ExtensibleFactory)EPackage.Registry.INSTANCE.getEFactory(ExtensiblePackage.eNS_URI); - if (theExtensibleFactory != null) { - return theExtensibleFactory; - } - } - catch (Exception exception) { - EcorePlugin.INSTANCE.log(exception); - } - return new ExtensibleFactoryImpl(); - } - - /** - * Creates an instance of the factory. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public ExtensibleFactoryImpl() { - super(); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public EObject create(EClass eClass) { - switch (eClass.getClassifierID()) { - default: - throw new IllegalArgumentException("The class '" + eClass.getName() + "' is not a valid classifier"); //$NON-NLS-1$ //$NON-NLS-2$ - } - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public ExtensiblePackage getExtensiblePackage() { - return (ExtensiblePackage)getEPackage(); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @deprecated - * @generated - */ - @Deprecated - public static ExtensiblePackage getPackage() { - return ExtensiblePackage.eINSTANCE; - } - -} //ExtensibleFactoryImpl
diff --git a/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/emf/facet/efacet/metamodel/v0_2_0/efacet/extensible/impl/ExtensiblePackageImpl.java b/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/emf/facet/efacet/metamodel/v0_2_0/efacet/extensible/impl/ExtensiblePackageImpl.java deleted file mode 100644 index 48168c4..0000000 --- a/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/emf/facet/efacet/metamodel/v0_2_0/efacet/extensible/impl/ExtensiblePackageImpl.java +++ /dev/null
@@ -1,225 +0,0 @@ -/** - * Copyright (c) 2011, 2012 Mia-Software. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Gregoire Dupe (Mia-Software) - Design - * Nicolas Guyomar (Mia-Software) - Implementation - * Emmanuelle Rouillé (Mia-Software) - Bug 352618 - To be able to use non derived facet structural features and save them values. - * Nicolas Bros (Mia-Software) - Bug 361823 - [Restructuring] eFacet2 meta-model - * Gregoire Dupe (Mia-Software) - Bug 369987 - [Restructuring][Table] Switch to the new customization and facet framework - * Gregoire Dupe (Mia-Software) - Bug 364325 - [Restructuring] The user must be able to navigate into a model using the Facet. - * Gregoire Dupe (Mia-Software) - Bug 373078 - API Cleaning - */ -package org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.extensible.impl; - -import org.eclipse.emf.ecore.EAttribute; -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.ecore.EPackage; -import org.eclipse.emf.ecore.EReference; -import org.eclipse.emf.ecore.EcorePackage; -import org.eclipse.emf.ecore.impl.EPackageImpl; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.EFacetPackage; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.extensible.ExtensibleFactory; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.extensible.ExtensiblePackage; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.extensible.Query; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.impl.EFacetPackageImpl; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.query.QueryPackage; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.query.impl.QueryPackageImpl; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.runtime.RuntimePackage; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.runtime.impl.RuntimePackageImpl; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.serialization.SerializationPackage; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.serialization.impl.SerializationPackageImpl; - -/** - * <!-- begin-user-doc --> - * An implementation of the model <b>Package</b>. - * <!-- end-user-doc --> - * @generated - */ -public class ExtensiblePackageImpl extends EPackageImpl implements ExtensiblePackage { - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - private EClass queryEClass = null; - - /** - * Creates an instance of the model <b>Package</b>, registered with - * {@link org.eclipse.emf.ecore.EPackage.Registry EPackage.Registry} by the package - * package URI value. - * <p>Note: the correct way to create the package is via the static - * factory method {@link #init init()}, which also performs - * initialization of the package, or returns the registered package, - * if one already exists. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see org.eclipse.emf.ecore.EPackage.Registry - * @see org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.extensible.ExtensiblePackage#eNS_URI - * @see #init() - * @generated - */ - private ExtensiblePackageImpl() { - super(eNS_URI, ExtensibleFactory.eINSTANCE); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - private static boolean isInited = false; - - /** - * Creates, registers, and initializes the <b>Package</b> for this model, and for any others upon which it depends. - * - * <p>This method is used to initialize {@link ExtensiblePackage#eINSTANCE} when that field is accessed. - * Clients should not invoke it directly. Instead, they should simply access that field to obtain the package. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #eNS_URI - * @see #createPackageContents() - * @see #initializePackageContents() - * @generated - */ - public static ExtensiblePackage init() { - if (isInited) return (ExtensiblePackage)EPackage.Registry.INSTANCE.getEPackage(ExtensiblePackage.eNS_URI); - - // Obtain or create and register package - ExtensiblePackageImpl theExtensiblePackage = (ExtensiblePackageImpl)(EPackage.Registry.INSTANCE.get(eNS_URI) instanceof ExtensiblePackageImpl ? EPackage.Registry.INSTANCE.get(eNS_URI) : new ExtensiblePackageImpl()); - - isInited = true; - - // Initialize simple dependencies - EcorePackage.eINSTANCE.eClass(); - - // Obtain or create and register interdependencies - EFacetPackageImpl theEFacetPackage = (EFacetPackageImpl)(EPackage.Registry.INSTANCE.getEPackage(EFacetPackage.eNS_URI) instanceof EFacetPackageImpl ? EPackage.Registry.INSTANCE.getEPackage(EFacetPackage.eNS_URI) : EFacetPackage.eINSTANCE); - SerializationPackageImpl theSerializationPackage = (SerializationPackageImpl)(EPackage.Registry.INSTANCE.getEPackage(SerializationPackage.eNS_URI) instanceof SerializationPackageImpl ? EPackage.Registry.INSTANCE.getEPackage(SerializationPackage.eNS_URI) : SerializationPackage.eINSTANCE); - QueryPackageImpl theQueryPackage = (QueryPackageImpl)(EPackage.Registry.INSTANCE.getEPackage(QueryPackage.eNS_URI) instanceof QueryPackageImpl ? EPackage.Registry.INSTANCE.getEPackage(QueryPackage.eNS_URI) : QueryPackage.eINSTANCE); - RuntimePackageImpl theRuntimePackage = (RuntimePackageImpl)(EPackage.Registry.INSTANCE.getEPackage(RuntimePackage.eNS_URI) instanceof RuntimePackageImpl ? EPackage.Registry.INSTANCE.getEPackage(RuntimePackage.eNS_URI) : RuntimePackage.eINSTANCE); - - // Create package meta-data objects - theExtensiblePackage.createPackageContents(); - theEFacetPackage.createPackageContents(); - theSerializationPackage.createPackageContents(); - theQueryPackage.createPackageContents(); - theRuntimePackage.createPackageContents(); - - // Initialize created meta-data - theExtensiblePackage.initializePackageContents(); - theEFacetPackage.initializePackageContents(); - theSerializationPackage.initializePackageContents(); - theQueryPackage.initializePackageContents(); - theRuntimePackage.initializePackageContents(); - - // Mark meta-data to indicate it can't be changed - theExtensiblePackage.freeze(); - - - // Update the registry and return the package - EPackage.Registry.INSTANCE.put(ExtensiblePackage.eNS_URI, theExtensiblePackage); - return theExtensiblePackage; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EClass getQuery() { - return queryEClass; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EAttribute getQuery_CanHaveSideEffects() { - return (EAttribute)queryEClass.getEStructuralFeatures().get(0); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EAttribute getQuery_CanBeCached() { - return (EAttribute)queryEClass.getEStructuralFeatures().get(1); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public ExtensibleFactory getExtensibleFactory() { - return (ExtensibleFactory)getEFactoryInstance(); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - private boolean isCreated = false; - - /** - * Creates the meta-model objects for the package. This method is - * guarded to have no affect on any invocation but its first. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public void createPackageContents() { - if (isCreated) return; - isCreated = true; - - // Create classes and their features - queryEClass = createEClass(QUERY); - createEAttribute(queryEClass, QUERY__CAN_HAVE_SIDE_EFFECTS); - createEAttribute(queryEClass, QUERY__CAN_BE_CACHED); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - private boolean isInitialized = false; - - /** - * Complete the initialization of the package and its meta-model. This - * method is guarded to have no affect on any invocation but its first. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public void initializePackageContents() { - if (isInitialized) return; - isInitialized = true; - - // Initialize package - setName(eNAME); - setNsPrefix(eNS_PREFIX); - setNsURI(eNS_URI); - - // Create type parameters - - // Set bounds for type parameters - - // Add supertypes to classes - - // Initialize classes and features; add operations and parameters - initEClass(queryEClass, Query.class, "Query", IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); //$NON-NLS-1$ - initEAttribute(getQuery_CanHaveSideEffects(), ecorePackage.getEBoolean(), "canHaveSideEffects", null, 0, 1, Query.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); //$NON-NLS-1$ - initEAttribute(getQuery_CanBeCached(), ecorePackage.getEBoolean(), "canBeCached", null, 0, 1, Query.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); //$NON-NLS-1$ - } - -} //ExtensiblePackageImpl
diff --git a/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/emf/facet/efacet/metamodel/v0_2_0/efacet/extensible/impl/QueryImpl.java b/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/emf/facet/efacet/metamodel/v0_2_0/efacet/extensible/impl/QueryImpl.java deleted file mode 100644 index 0ae4f2f..0000000 --- a/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/emf/facet/efacet/metamodel/v0_2_0/efacet/extensible/impl/QueryImpl.java +++ /dev/null
@@ -1,249 +0,0 @@ -/** - * Copyright (c) 2011 Mia-Software. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Gregoire Dupe (Mia-Software) - Design - * Nicolas Guyomar (Mia-Software) - Implementation - * Emmanuelle Rouillé (Mia-Software) - Bug 352618 - To be able to use non derived facet structural features and save them values. - * Nicolas Bros (Mia-Software) - Bug 361823 - [Restructuring] eFacet2 meta-model - * Gregoire Dupe (Mia-Software) - Bug 373078 - API Cleaning - */ -package org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.extensible.impl; - -import org.eclipse.emf.common.notify.Notification; -import org.eclipse.emf.common.util.EList; -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.ecore.EClassifier; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.EOperation; -import org.eclipse.emf.ecore.EParameter; -import org.eclipse.emf.ecore.ETypedElement; -import org.eclipse.emf.ecore.InternalEObject; -import org.eclipse.emf.ecore.impl.ENotificationImpl; -import org.eclipse.emf.ecore.impl.EObjectImpl; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.DerivedTypedElement; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.Facet; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.extensible.ExtensiblePackage; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.extensible.Query; - -/** - * <!-- begin-user-doc --> - * An implementation of the model object '<em><b>Query</b></em>'. - * <!-- end-user-doc --> - * <p> - * The following features are implemented: - * <ul> - * <li>{@link org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.extensible.impl.QueryImpl#isCanHaveSideEffects <em>Can Have Side Effects</em>}</li> - * <li>{@link org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.extensible.impl.QueryImpl#isCanBeCached <em>Can Be Cached</em>}</li> - * </ul> - * </p> - * - * @generated - */ -public abstract class QueryImpl extends EObjectImpl implements Query { - /** - * The default value of the '{@link #isCanHaveSideEffects() <em>Can Have Side Effects</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #isCanHaveSideEffects() - * @generated - * @ordered - */ - protected static final boolean CAN_HAVE_SIDE_EFFECTS_EDEFAULT = false; - - /** - * The cached value of the '{@link #isCanHaveSideEffects() <em>Can Have Side Effects</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #isCanHaveSideEffects() - * @generated - * @ordered - */ - protected boolean canHaveSideEffects = CAN_HAVE_SIDE_EFFECTS_EDEFAULT; - - /** - * The default value of the '{@link #isCanBeCached() <em>Can Be Cached</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #isCanBeCached() - * @generated - * @ordered - */ - protected static final boolean CAN_BE_CACHED_EDEFAULT = false; - - /** - * The cached value of the '{@link #isCanBeCached() <em>Can Be Cached</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #isCanBeCached() - * @generated - * @ordered - */ - protected boolean canBeCached = CAN_BE_CACHED_EDEFAULT; - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected QueryImpl() { - super(); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - protected EClass eStaticClass() { - return ExtensiblePackage.Literals.QUERY; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated NOT - */ - public DerivedTypedElement basicGetOwningDerivedTypedElement() { - EObject container = eContainer(); - if (container instanceof DerivedTypedElement) { - return (DerivedTypedElement) container; - } - throw new IllegalStateException("Query must always be contained by a DerivedTypedElement"); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public boolean isCanHaveSideEffects() { - return canHaveSideEffects; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public void setCanHaveSideEffects(boolean newCanHaveSideEffects) { - boolean oldCanHaveSideEffects = canHaveSideEffects; - canHaveSideEffects = newCanHaveSideEffects; - if (eNotificationRequired()) - eNotify(new ENotificationImpl(this, Notification.SET, ExtensiblePackage.QUERY__CAN_HAVE_SIDE_EFFECTS, oldCanHaveSideEffects, canHaveSideEffects)); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public boolean isCanBeCached() { - return canBeCached; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public void setCanBeCached(boolean newCanBeCached) { - boolean oldCanBeCached = canBeCached; - canBeCached = newCanBeCached; - if (eNotificationRequired()) - eNotify(new ENotificationImpl(this, Notification.SET, ExtensiblePackage.QUERY__CAN_BE_CACHED, oldCanBeCached, canBeCached)); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public Object eGet(int featureID, boolean resolve, boolean coreType) { - switch (featureID) { - case ExtensiblePackage.QUERY__CAN_HAVE_SIDE_EFFECTS: - return isCanHaveSideEffects(); - case ExtensiblePackage.QUERY__CAN_BE_CACHED: - return isCanBeCached(); - } - return super.eGet(featureID, resolve, coreType); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public void eSet(int featureID, Object newValue) { - switch (featureID) { - case ExtensiblePackage.QUERY__CAN_HAVE_SIDE_EFFECTS: - setCanHaveSideEffects((Boolean)newValue); - return; - case ExtensiblePackage.QUERY__CAN_BE_CACHED: - setCanBeCached((Boolean)newValue); - return; - } - super.eSet(featureID, newValue); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public void eUnset(int featureID) { - switch (featureID) { - case ExtensiblePackage.QUERY__CAN_HAVE_SIDE_EFFECTS: - setCanHaveSideEffects(CAN_HAVE_SIDE_EFFECTS_EDEFAULT); - return; - case ExtensiblePackage.QUERY__CAN_BE_CACHED: - setCanBeCached(CAN_BE_CACHED_EDEFAULT); - return; - } - super.eUnset(featureID); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public boolean eIsSet(int featureID) { - switch (featureID) { - case ExtensiblePackage.QUERY__CAN_HAVE_SIDE_EFFECTS: - return canHaveSideEffects != CAN_HAVE_SIDE_EFFECTS_EDEFAULT; - case ExtensiblePackage.QUERY__CAN_BE_CACHED: - return canBeCached != CAN_BE_CACHED_EDEFAULT; - } - return super.eIsSet(featureID); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public String toString() { - if (eIsProxy()) return super.toString(); - - StringBuffer result = new StringBuffer(super.toString()); - result.append(" (canHaveSideEffects: "); //$NON-NLS-1$ - result.append(canHaveSideEffects); - result.append(", canBeCached: "); //$NON-NLS-1$ - result.append(canBeCached); - result.append(')'); - return result.toString(); - } - -} //QueryImpl
diff --git a/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/emf/facet/efacet/metamodel/v0_2_0/efacet/extensible/util/ExtensibleAdapterFactory.java b/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/emf/facet/efacet/metamodel/v0_2_0/efacet/extensible/util/ExtensibleAdapterFactory.java deleted file mode 100644 index a0710c8..0000000 --- a/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/emf/facet/efacet/metamodel/v0_2_0/efacet/extensible/util/ExtensibleAdapterFactory.java +++ /dev/null
@@ -1,131 +0,0 @@ -/** - * Copyright (c) 2011 Mia-Software. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Gregoire Dupe (Mia-Software) - Design - * Nicolas Guyomar (Mia-Software) - Implementation - * Emmanuelle Rouillé (Mia-Software) - Bug 352618 - To be able to use non derived facet structural features and save them values. - * Nicolas Bros (Mia-Software) - Bug 361823 - [Restructuring] eFacet2 meta-model - */ -package org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.extensible.util; - -import org.eclipse.emf.common.notify.Adapter; -import org.eclipse.emf.common.notify.Notifier; -import org.eclipse.emf.common.notify.impl.AdapterFactoryImpl; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.extensible.*; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.extensible.ExtensiblePackage; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.extensible.Query; - -/** - * <!-- begin-user-doc --> - * The <b>Adapter Factory</b> for the model. - * It provides an adapter <code>createXXX</code> method for each class of the model. - * <!-- end-user-doc --> - * @see org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.extensible.ExtensiblePackage - * @generated - */ -public class ExtensibleAdapterFactory extends AdapterFactoryImpl { - /** - * The cached model package. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected static ExtensiblePackage modelPackage; - - /** - * Creates an instance of the adapter factory. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public ExtensibleAdapterFactory() { - if (modelPackage == null) { - modelPackage = ExtensiblePackage.eINSTANCE; - } - } - - /** - * Returns whether this factory is applicable for the type of the object. - * <!-- begin-user-doc --> - * This implementation returns <code>true</code> if the object is either the model's package or is an instance object of the model. - * <!-- end-user-doc --> - * @return whether this factory is applicable for the type of the object. - * @generated - */ - @Override - public boolean isFactoryForType(Object object) { - if (object == modelPackage) { - return true; - } - if (object instanceof EObject) { - return ((EObject)object).eClass().getEPackage() == modelPackage; - } - return false; - } - - /** - * The switch that delegates to the <code>createXXX</code> methods. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected ExtensibleSwitch<Adapter> modelSwitch = - new ExtensibleSwitch<Adapter>() { - @Override - public Adapter caseQuery(Query object) { - return createQueryAdapter(); - } - @Override - public Adapter defaultCase(EObject object) { - return createEObjectAdapter(); - } - }; - - /** - * Creates an adapter for the <code>target</code>. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @param target the object to adapt. - * @return the adapter for the <code>target</code>. - * @generated - */ - @Override - public Adapter createAdapter(Notifier target) { - return modelSwitch.doSwitch((EObject)target); - } - - - /** - * Creates a new adapter for an object of class '{@link org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.extensible.Query <em>Query</em>}'. - * <!-- begin-user-doc --> - * This default implementation returns null so that we can easily ignore cases; - * it's useful to ignore a case when inheritance will catch all the cases anyway. - * <!-- end-user-doc --> - * @return the new adapter. - * @see org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.extensible.Query - * @generated - */ - public Adapter createQueryAdapter() { - return null; - } - - /** - * Creates a new adapter for the default case. - * <!-- begin-user-doc --> - * This default implementation returns null. - * <!-- end-user-doc --> - * @return the new adapter. - * @generated - */ - public Adapter createEObjectAdapter() { - return null; - } - -} //ExtensibleAdapterFactory
diff --git a/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/emf/facet/efacet/metamodel/v0_2_0/efacet/extensible/util/ExtensibleSwitch.java b/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/emf/facet/efacet/metamodel/v0_2_0/efacet/extensible/util/ExtensibleSwitch.java deleted file mode 100644 index 4aaffcf..0000000 --- a/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/emf/facet/efacet/metamodel/v0_2_0/efacet/extensible/util/ExtensibleSwitch.java +++ /dev/null
@@ -1,143 +0,0 @@ -/** - * Copyright (c) 2011 Mia-Software. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Gregoire Dupe (Mia-Software) - Design - * Nicolas Guyomar (Mia-Software) - Implementation - * Emmanuelle Rouillé (Mia-Software) - Bug 352618 - To be able to use non derived facet structural features and save them values. - * Nicolas Bros (Mia-Software) - Bug 361823 - [Restructuring] eFacet2 meta-model - * Gregoire Dupe (Mia-Software) - Bug 366055 - NavigationQuery - * Gregoire Dupe (Mia-Software) - Bug 369673 - [Facet] IsOneOfQuery - * Olivier Remaud (Soft-Maint) - Bug 369824 - Add a simple way to return string literal constants from a customization query - * Gregoire Dupe (Mia-software) - Bug 369987 - [Restructuring][Table] Switch to the new customization and facet framework - */ -package org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.extensible.util; - -import java.util.List; - -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.extensible.*; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.extensible.ExtensiblePackage; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.extensible.Query; - -/** - * <!-- begin-user-doc --> - * The <b>Switch</b> for the model's inheritance hierarchy. - * It supports the call {@link #doSwitch(EObject) doSwitch(object)} - * to invoke the <code>caseXXX</code> method for each class of the model, - * starting with the actual class of the object - * and proceeding up the inheritance hierarchy - * until a non-null result is returned, - * which is the result of the switch. - * <!-- end-user-doc --> - * @see org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.extensible.ExtensiblePackage - * @generated - */ -public class ExtensibleSwitch<T> { - /** - * The cached model package - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected static ExtensiblePackage modelPackage; - - /** - * Creates an instance of the switch. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public ExtensibleSwitch() { - if (modelPackage == null) { - modelPackage = ExtensiblePackage.eINSTANCE; - } - } - - /** - * Calls <code>caseXXX</code> for each class of the model until one returns a non null result; it yields that result. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the first non-null result returned by a <code>caseXXX</code> call. - * @generated - */ - public T doSwitch(EObject theEObject) { - return doSwitch(theEObject.eClass(), theEObject); - } - - /** - * Calls <code>caseXXX</code> for each class of the model until one returns a non null result; it yields that result. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the first non-null result returned by a <code>caseXXX</code> call. - * @generated - */ - protected T doSwitch(EClass theEClass, EObject theEObject) { - if (theEClass.eContainer() == modelPackage) { - return doSwitch(theEClass.getClassifierID(), theEObject); - } - else { - List<EClass> eSuperTypes = theEClass.getESuperTypes(); - return - eSuperTypes.isEmpty() ? - defaultCase(theEObject) : - doSwitch(eSuperTypes.get(0), theEObject); - } - } - - /** - * Calls <code>caseXXX</code> for each class of the model until one returns a non null result; it yields that result. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the first non-null result returned by a <code>caseXXX</code> call. - * @generated - */ - protected T doSwitch(int classifierID, EObject theEObject) { - switch (classifierID) { - case ExtensiblePackage.QUERY: { - Query query = (Query)theEObject; - T result = caseQuery(query); - if (result == null) result = defaultCase(theEObject); - return result; - } - default: return defaultCase(theEObject); - } - } - - /** - * Returns the result of interpreting the object as an instance of '<em>Query</em>'. - * <!-- begin-user-doc --> - * This implementation returns null; - * returning a non-null result will terminate the switch. - * <!-- end-user-doc --> - * @param object the target of the switch. - * @return the result of interpreting the object as an instance of '<em>Query</em>'. - * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) - * @generated - */ - public T caseQuery(Query object) { - return null; - } - - /** - * Returns the result of interpreting the object as an instance of '<em>EObject</em>'. - * <!-- begin-user-doc --> - * This implementation returns null; - * returning a non-null result will terminate the switch, but this is the last case anyway. - * <!-- end-user-doc --> - * @param object the target of the switch. - * @return the result of interpreting the object as an instance of '<em>EObject</em>'. - * @see #doSwitch(org.eclipse.emf.ecore.EObject) - * @generated - */ - public T defaultCase(EObject object) { - return null; - } - -} //ExtensibleSwitch
diff --git a/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/emf/facet/efacet/metamodel/v0_2_0/efacet/impl/CategoryImpl.java b/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/emf/facet/efacet/metamodel/v0_2_0/efacet/impl/CategoryImpl.java deleted file mode 100644 index 2e8527a..0000000 --- a/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/emf/facet/efacet/metamodel/v0_2_0/efacet/impl/CategoryImpl.java +++ /dev/null
@@ -1,205 +0,0 @@ -/** - * Copyright (c) 2011 Mia-Software. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Gregoire Dupe (Mia-Software) - Design - * Nicolas Guyomar (Mia-Software) - Implementation - * Emmanuelle Rouillé (Mia-Software) - Bug 352618 - To be able to use non derived facet structural features and save them values. - * Nicolas Bros (Mia-Software) - Bug 361823 - [Restructuring] eFacet2 meta-model - */ -package org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.impl; - -import org.eclipse.emf.common.notify.Notification; -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.ecore.impl.ENamedElementImpl; -import org.eclipse.emf.ecore.impl.ENotificationImpl; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.Category; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.DocumentedElement; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.EFacetPackage; - -/** - * <!-- begin-user-doc --> - * An implementation of the model object '<em><b>Category</b></em>'. - * <!-- end-user-doc --> - * <p> - * The following features are implemented: - * <ul> - * <li>{@link org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.impl.CategoryImpl#getDocumentation <em>Documentation</em>}</li> - * </ul> - * </p> - * - * @generated - */ -public class CategoryImpl extends ENamedElementImpl implements Category { - /** - * The default value of the '{@link #getDocumentation() <em>Documentation</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #getDocumentation() - * @generated - * @ordered - */ - protected static final String DOCUMENTATION_EDEFAULT = null; - - /** - * The cached value of the '{@link #getDocumentation() <em>Documentation</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #getDocumentation() - * @generated - * @ordered - */ - protected String documentation = DOCUMENTATION_EDEFAULT; - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected CategoryImpl() { - super(); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - protected EClass eStaticClass() { - return EFacetPackage.Literals.CATEGORY; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public String getDocumentation() { - return documentation; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public void setDocumentation(String newDocumentation) { - String oldDocumentation = documentation; - documentation = newDocumentation; - if (eNotificationRequired()) - eNotify(new ENotificationImpl(this, Notification.SET, EFacetPackage.CATEGORY__DOCUMENTATION, oldDocumentation, documentation)); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public Object eGet(int featureID, boolean resolve, boolean coreType) { - switch (featureID) { - case EFacetPackage.CATEGORY__DOCUMENTATION: - return getDocumentation(); - } - return super.eGet(featureID, resolve, coreType); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public void eSet(int featureID, Object newValue) { - switch (featureID) { - case EFacetPackage.CATEGORY__DOCUMENTATION: - setDocumentation((String)newValue); - return; - } - super.eSet(featureID, newValue); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public void eUnset(int featureID) { - switch (featureID) { - case EFacetPackage.CATEGORY__DOCUMENTATION: - setDocumentation(DOCUMENTATION_EDEFAULT); - return; - } - super.eUnset(featureID); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public boolean eIsSet(int featureID) { - switch (featureID) { - case EFacetPackage.CATEGORY__DOCUMENTATION: - return DOCUMENTATION_EDEFAULT == null ? documentation != null : !DOCUMENTATION_EDEFAULT.equals(documentation); - } - return super.eIsSet(featureID); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public int eBaseStructuralFeatureID(int derivedFeatureID, Class<?> baseClass) { - if (baseClass == DocumentedElement.class) { - switch (derivedFeatureID) { - case EFacetPackage.CATEGORY__DOCUMENTATION: return EFacetPackage.DOCUMENTED_ELEMENT__DOCUMENTATION; - default: return -1; - } - } - return super.eBaseStructuralFeatureID(derivedFeatureID, baseClass); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public int eDerivedStructuralFeatureID(int baseFeatureID, Class<?> baseClass) { - if (baseClass == DocumentedElement.class) { - switch (baseFeatureID) { - case EFacetPackage.DOCUMENTED_ELEMENT__DOCUMENTATION: return EFacetPackage.CATEGORY__DOCUMENTATION; - default: return -1; - } - } - return super.eDerivedStructuralFeatureID(baseFeatureID, baseClass); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public String toString() { - if (eIsProxy()) return super.toString(); - - StringBuffer result = new StringBuffer(super.toString()); - result.append(" (documentation: "); //$NON-NLS-1$ - result.append(documentation); - result.append(')'); - return result.toString(); - } - -} //CategoryImpl
diff --git a/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/emf/facet/efacet/metamodel/v0_2_0/efacet/impl/DerivedTypedElementImpl.java b/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/emf/facet/efacet/metamodel/v0_2_0/efacet/impl/DerivedTypedElementImpl.java deleted file mode 100644 index 267e335..0000000 --- a/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/emf/facet/efacet/metamodel/v0_2_0/efacet/impl/DerivedTypedElementImpl.java +++ /dev/null
@@ -1,244 +0,0 @@ -/** - * Copyright (c) 2011 Mia-Software. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Gregoire Dupe (Mia-Software) - Design - * Nicolas Guyomar (Mia-Software) - Implementation - * Emmanuelle Rouillé (Mia-Software) - Bug 352618 - To be able to use non derived facet structural features and save them values. - * Nicolas Bros (Mia-Software) - Bug 361823 - [Restructuring] eFacet2 meta-model - */ -package org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.impl; - -import org.eclipse.emf.common.notify.Notification; -import org.eclipse.emf.common.notify.NotificationChain; -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.ecore.InternalEObject; -import org.eclipse.emf.ecore.impl.ENotificationImpl; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.DerivedTypedElement; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.EFacetPackage; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.extensible.Query; - -/** - * <!-- begin-user-doc --> - * An implementation of the model object '<em><b>Derived Typed Element</b></em>'. - * <!-- end-user-doc --> - * <p> - * The following features are implemented: - * <ul> - * <li>{@link org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.impl.DerivedTypedElementImpl#getQuery <em>Query</em>}</li> - * <li>{@link org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.impl.DerivedTypedElementImpl#getOverride <em>Override</em>}</li> - * </ul> - * </p> - * - * @generated - */ -public abstract class DerivedTypedElementImpl extends FacetElementImpl implements DerivedTypedElement { - /** - * The cached value of the '{@link #getQuery() <em>Query</em>}' containment reference. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #getQuery() - * @generated - * @ordered - */ - protected Query query; - - /** - * The cached value of the '{@link #getOverride() <em>Override</em>}' reference. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #getOverride() - * @generated - * @ordered - */ - protected DerivedTypedElement override; - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected DerivedTypedElementImpl() { - super(); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - protected EClass eStaticClass() { - return EFacetPackage.Literals.DERIVED_TYPED_ELEMENT; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public Query getQuery() { - return query; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public NotificationChain basicSetQuery(Query newQuery, NotificationChain msgs) { - Query oldQuery = query; - query = newQuery; - if (eNotificationRequired()) { - ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, EFacetPackage.DERIVED_TYPED_ELEMENT__QUERY, oldQuery, newQuery); - if (msgs == null) msgs = notification; else msgs.add(notification); - } - return msgs; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public void setQuery(Query newQuery) { - if (newQuery != query) { - NotificationChain msgs = null; - if (query != null) - msgs = ((InternalEObject)query).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - EFacetPackage.DERIVED_TYPED_ELEMENT__QUERY, null, msgs); - if (newQuery != null) - msgs = ((InternalEObject)newQuery).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - EFacetPackage.DERIVED_TYPED_ELEMENT__QUERY, null, msgs); - msgs = basicSetQuery(newQuery, msgs); - if (msgs != null) msgs.dispatch(); - } - else if (eNotificationRequired()) - eNotify(new ENotificationImpl(this, Notification.SET, EFacetPackage.DERIVED_TYPED_ELEMENT__QUERY, newQuery, newQuery)); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public DerivedTypedElement getOverride() { - if (override != null && override.eIsProxy()) { - InternalEObject oldOverride = (InternalEObject)override; - override = (DerivedTypedElement)eResolveProxy(oldOverride); - if (override != oldOverride) { - if (eNotificationRequired()) - eNotify(new ENotificationImpl(this, Notification.RESOLVE, EFacetPackage.DERIVED_TYPED_ELEMENT__OVERRIDE, oldOverride, override)); - } - } - return override; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public DerivedTypedElement basicGetOverride() { - return override; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public void setOverride(DerivedTypedElement newOverride) { - DerivedTypedElement oldOverride = override; - override = newOverride; - if (eNotificationRequired()) - eNotify(new ENotificationImpl(this, Notification.SET, EFacetPackage.DERIVED_TYPED_ELEMENT__OVERRIDE, oldOverride, override)); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { - switch (featureID) { - case EFacetPackage.DERIVED_TYPED_ELEMENT__QUERY: - return basicSetQuery(null, msgs); - } - return super.eInverseRemove(otherEnd, featureID, msgs); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public Object eGet(int featureID, boolean resolve, boolean coreType) { - switch (featureID) { - case EFacetPackage.DERIVED_TYPED_ELEMENT__QUERY: - return getQuery(); - case EFacetPackage.DERIVED_TYPED_ELEMENT__OVERRIDE: - if (resolve) return getOverride(); - return basicGetOverride(); - } - return super.eGet(featureID, resolve, coreType); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public void eSet(int featureID, Object newValue) { - switch (featureID) { - case EFacetPackage.DERIVED_TYPED_ELEMENT__QUERY: - setQuery((Query)newValue); - return; - case EFacetPackage.DERIVED_TYPED_ELEMENT__OVERRIDE: - setOverride((DerivedTypedElement)newValue); - return; - } - super.eSet(featureID, newValue); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public void eUnset(int featureID) { - switch (featureID) { - case EFacetPackage.DERIVED_TYPED_ELEMENT__QUERY: - setQuery((Query)null); - return; - case EFacetPackage.DERIVED_TYPED_ELEMENT__OVERRIDE: - setOverride((DerivedTypedElement)null); - return; - } - super.eUnset(featureID); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public boolean eIsSet(int featureID) { - switch (featureID) { - case EFacetPackage.DERIVED_TYPED_ELEMENT__QUERY: - return query != null; - case EFacetPackage.DERIVED_TYPED_ELEMENT__OVERRIDE: - return override != null; - } - return super.eIsSet(featureID); - } - -} //DerivedTypedElementImpl
diff --git a/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/emf/facet/efacet/metamodel/v0_2_0/efacet/impl/DocumentedElementImpl.java b/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/emf/facet/efacet/metamodel/v0_2_0/efacet/impl/DocumentedElementImpl.java deleted file mode 100644 index f4ef7c9..0000000 --- a/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/emf/facet/efacet/metamodel/v0_2_0/efacet/impl/DocumentedElementImpl.java +++ /dev/null
@@ -1,172 +0,0 @@ -/** - * Copyright (c) 2011 Mia-Software. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Gregoire Dupe (Mia-Software) - Design - * Nicolas Guyomar (Mia-Software) - Implementation - * Emmanuelle Rouillé (Mia-Software) - Bug 352618 - To be able to use non derived facet structural features and save them values. - * Nicolas Bros (Mia-Software) - Bug 361823 - [Restructuring] eFacet2 meta-model - */ -package org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.impl; - -import org.eclipse.emf.common.notify.Notification; -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.ecore.impl.ENotificationImpl; -import org.eclipse.emf.ecore.impl.EObjectImpl; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.DocumentedElement; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.EFacetPackage; - -/** - * <!-- begin-user-doc --> - * An implementation of the model object '<em><b>Documented Element</b></em>'. - * <!-- end-user-doc --> - * <p> - * The following features are implemented: - * <ul> - * <li>{@link org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.impl.DocumentedElementImpl#getDocumentation <em>Documentation</em>}</li> - * </ul> - * </p> - * - * @generated - */ -public class DocumentedElementImpl extends EObjectImpl implements DocumentedElement { - /** - * The default value of the '{@link #getDocumentation() <em>Documentation</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #getDocumentation() - * @generated - * @ordered - */ - protected static final String DOCUMENTATION_EDEFAULT = null; - - /** - * The cached value of the '{@link #getDocumentation() <em>Documentation</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #getDocumentation() - * @generated - * @ordered - */ - protected String documentation = DOCUMENTATION_EDEFAULT; - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected DocumentedElementImpl() { - super(); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - protected EClass eStaticClass() { - return EFacetPackage.Literals.DOCUMENTED_ELEMENT; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public String getDocumentation() { - return documentation; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public void setDocumentation(String newDocumentation) { - String oldDocumentation = documentation; - documentation = newDocumentation; - if (eNotificationRequired()) - eNotify(new ENotificationImpl(this, Notification.SET, EFacetPackage.DOCUMENTED_ELEMENT__DOCUMENTATION, oldDocumentation, documentation)); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public Object eGet(int featureID, boolean resolve, boolean coreType) { - switch (featureID) { - case EFacetPackage.DOCUMENTED_ELEMENT__DOCUMENTATION: - return getDocumentation(); - } - return super.eGet(featureID, resolve, coreType); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public void eSet(int featureID, Object newValue) { - switch (featureID) { - case EFacetPackage.DOCUMENTED_ELEMENT__DOCUMENTATION: - setDocumentation((String)newValue); - return; - } - super.eSet(featureID, newValue); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public void eUnset(int featureID) { - switch (featureID) { - case EFacetPackage.DOCUMENTED_ELEMENT__DOCUMENTATION: - setDocumentation(DOCUMENTATION_EDEFAULT); - return; - } - super.eUnset(featureID); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public boolean eIsSet(int featureID) { - switch (featureID) { - case EFacetPackage.DOCUMENTED_ELEMENT__DOCUMENTATION: - return DOCUMENTATION_EDEFAULT == null ? documentation != null : !DOCUMENTATION_EDEFAULT.equals(documentation); - } - return super.eIsSet(featureID); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public String toString() { - if (eIsProxy()) return super.toString(); - - StringBuffer result = new StringBuffer(super.toString()); - result.append(" (documentation: "); //$NON-NLS-1$ - result.append(documentation); - result.append(')'); - return result.toString(); - } - -} //DocumentedElementImpl
diff --git a/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/emf/facet/efacet/metamodel/v0_2_0/efacet/impl/EFacetFactoryImpl.java b/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/emf/facet/efacet/metamodel/v0_2_0/efacet/impl/EFacetFactoryImpl.java deleted file mode 100644 index defb6c0..0000000 --- a/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/emf/facet/efacet/metamodel/v0_2_0/efacet/impl/EFacetFactoryImpl.java +++ /dev/null
@@ -1,250 +0,0 @@ -/** - * Copyright (c) 2011, 2015 Mia-Software, and Soft-Maint. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Gregoire Dupe (Mia-Software) - Design - * Nicolas Guyomar (Mia-Software) - Implementation - * Emmanuelle Rouillé (Mia-Software) - Bug 352618 - To be able to use non derived facet structural features and save them values. - * Nicolas Bros (Mia-Software) - Bug 361823 - [Restructuring] eFacet2 meta-model - * Gregoire Dupe (Mia-Software) - Bug 366055 - NavigationQuery - * Gregoire Dupe (Mia-Software) - Bug 369673 - [Facet] IsOneOfQuery - * Olivier Remaud (Soft-Maint) - Bug 369824 - Add a simple way to return string literal constants from a customization query - * Gregoire Dupe (Mia-Software) - Bug 369987 - [Restructuring][Table] Switch to the new customization and facet framework - * Gregoire Dupe (Mia-software) - Bug 364325 - [Restructuring] The user must be able to navigate into a model using the Facet. - * Nicolas Bros (Mia-Software) - Bug 372626 - [Facet] Aggregates - * Nicolas Bros (Mia-Software) - Bug 376941 - [EFacet] Facet operation arguments in Facet model - * Gregoire Dupe (Mia-Software) - Bug 376576 - [EFacet] Change the multiplicity of Facet::extendedFacet - * Jonathan Pepin (Soft-Maint) - Bug 463898 - Create FacetReference not derived, without query and with opposite mechanism - */ -package org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.impl; - -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.ecore.EDataType; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.EPackage; -import org.eclipse.emf.ecore.impl.EFactoryImpl; -import org.eclipse.emf.ecore.plugin.EcorePlugin; -import org.eclipse.emf.ecore.resource.Resource; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.*; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.Category; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.DocumentedElement; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.EFacetFactory; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.EFacetPackage; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.Facet; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.FacetAttribute; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.FacetOperation; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.FacetReference; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.FacetSet; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.ParameterValue; - -/** - * <!-- begin-user-doc --> - * An implementation of the model <b>Factory</b>. - * <!-- end-user-doc --> - * @generated - */ -public class EFacetFactoryImpl extends EFactoryImpl implements EFacetFactory { - /** - * Creates the default factory implementation. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public static EFacetFactory init() { - try { - EFacetFactory theEFacetFactory = (EFacetFactory)EPackage.Registry.INSTANCE.getEFactory(EFacetPackage.eNS_URI); - if (theEFacetFactory != null) { - return theEFacetFactory; - } - } - catch (Exception exception) { - EcorePlugin.INSTANCE.log(exception); - } - return new EFacetFactoryImpl(); - } - - /** - * Creates an instance of the factory. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EFacetFactoryImpl() { - super(); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public EObject create(EClass eClass) { - switch (eClass.getClassifierID()) { - case EFacetPackage.FACET_ATTRIBUTE: return createFacetAttribute(); - case EFacetPackage.FACET_REFERENCE: return createFacetReference(); - case EFacetPackage.FACET_OPERATION: return createFacetOperation(); - case EFacetPackage.FACET_SET: return createFacetSet(); - case EFacetPackage.FACET: return createFacet(); - case EFacetPackage.CATEGORY: return createCategory(); - case EFacetPackage.PARAMETER_VALUE: return createParameterValue(); - case EFacetPackage.DOCUMENTED_ELEMENT: return createDocumentedElement(); - default: - throw new IllegalArgumentException("The class '" + eClass.getName() + "' is not a valid classifier"); //$NON-NLS-1$ //$NON-NLS-2$ - } - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public Object createFromString(EDataType eDataType, String initialValue) { - switch (eDataType.getClassifierID()) { - case EFacetPackage.RESOURCE: - return createResourceFromString(eDataType, initialValue); - default: - throw new IllegalArgumentException("The datatype '" + eDataType.getName() + "' is not a valid classifier"); //$NON-NLS-1$ //$NON-NLS-2$ - } - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public String convertToString(EDataType eDataType, Object instanceValue) { - switch (eDataType.getClassifierID()) { - case EFacetPackage.RESOURCE: - return convertResourceToString(eDataType, instanceValue); - default: - throw new IllegalArgumentException("The datatype '" + eDataType.getName() + "' is not a valid classifier"); //$NON-NLS-1$ //$NON-NLS-2$ - } - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public FacetAttribute createFacetAttribute() { - FacetAttributeImpl facetAttribute = new FacetAttributeImpl(); - return facetAttribute; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public FacetReference createFacetReference() { - FacetReferenceImpl facetReference = new FacetReferenceImpl(); - return facetReference; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public FacetOperation createFacetOperation() { - FacetOperationImpl facetOperation = new FacetOperationImpl(); - return facetOperation; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public FacetSet createFacetSet() { - FacetSetImpl facetSet = new FacetSetImpl(); - return facetSet; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public Facet createFacet() { - FacetImpl facet = new FacetImpl(); - return facet; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public Category createCategory() { - CategoryImpl category = new CategoryImpl(); - return category; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public ParameterValue createParameterValue() { - ParameterValueImpl parameterValue = new ParameterValueImpl(); - return parameterValue; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public DocumentedElement createDocumentedElement() { - DocumentedElementImpl documentedElement = new DocumentedElementImpl(); - return documentedElement; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public Resource createResourceFromString(EDataType eDataType, String initialValue) { - return (Resource)super.createFromString(eDataType, initialValue); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public String convertResourceToString(EDataType eDataType, Object instanceValue) { - return super.convertToString(eDataType, instanceValue); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EFacetPackage getEFacetPackage() { - return (EFacetPackage)getEPackage(); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @deprecated - * @generated - */ - @Deprecated - public static EFacetPackage getPackage() { - return EFacetPackage.eINSTANCE; - } - -} //EFacetFactoryImpl
diff --git a/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/emf/facet/efacet/metamodel/v0_2_0/efacet/impl/EFacetPackageImpl.java b/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/emf/facet/efacet/metamodel/v0_2_0/efacet/impl/EFacetPackageImpl.java deleted file mode 100644 index 54f00da..0000000 --- a/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/emf/facet/efacet/metamodel/v0_2_0/efacet/impl/EFacetPackageImpl.java +++ /dev/null
@@ -1,685 +0,0 @@ -/** - * Copyright (c) 2011, 2015 Mia-Software, and Soft-Maint. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Gregoire Dupe (Mia-Software) - Design - * Nicolas Guyomar (Mia-Software) - Implementation - * Emmanuelle Rouillé (Mia-Software) - Bug 352618 - To be able to use non derived facet structural features and save them values. - * Nicolas Bros (Mia-Software) - Bug 361823 - [Restructuring] eFacet2 meta-model - * Gregoire Dupe (Mia-Software) - Bug 366055 - NavigationQuery - * Gregoire Dupe (Mia-Software) - Bug 369673 - [Facet] IsOneOfQuery - * Olivier Remaud (Soft-Maint) - Bug 369824 - Add a simple way to return string literal constants from a customization query - * Gregoire Dupe (Mia-Software) - Bug 369987 - [Restructuring][Table] Switch to the new customization and facet framework - * Gregoire Dupe (Mia-software) - Bug 364325 - [Restructuring] The user must be able to navigate into a model using the Facet. - * Nicolas Bros (Mia-Software) - Bug 372626 - [Facet] Aggregates - * Nicolas Bros (Mia-Software) - Bug 376941 - [EFacet] Facet operation arguments in Facet model - * Gregoire Dupe (Mia-Software) - Bug 376576 - [EFacet] Change the multiplicity of Facet::extendedFacet - * Jonathan Pepin (Soft-Maint) - Bug 463898 - Create FacetReference not derived, without query and with opposite mechanism - */ -package org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.impl; - -import static org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.EFacetPackage.RESOURCE; - -import org.eclipse.emf.ecore.EAttribute; -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.ecore.EDataType; -import org.eclipse.emf.ecore.EPackage; -import org.eclipse.emf.ecore.EReference; -import org.eclipse.emf.ecore.EcorePackage; -import org.eclipse.emf.ecore.impl.EPackageImpl; -import org.eclipse.emf.ecore.resource.Resource; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.Category; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.DerivedTypedElement; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.DocumentedElement; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.EFacetFactory; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.EFacetPackage; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.Facet; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.FacetAttribute; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.FacetElement; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.FacetOperation; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.FacetReference; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.FacetSet; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.ParameterValue; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.extensible.ExtensiblePackage; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.extensible.impl.ExtensiblePackageImpl; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.query.QueryPackage; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.query.impl.QueryPackageImpl; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.runtime.RuntimePackage; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.runtime.impl.RuntimePackageImpl; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.serialization.SerializationPackage; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.serialization.impl.SerializationPackageImpl; - -/** - * <!-- begin-user-doc --> - * An implementation of the model <b>Package</b>. - * <!-- end-user-doc --> - * @generated - */ -public class EFacetPackageImpl extends EPackageImpl implements EFacetPackage { - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - private EClass facetAttributeEClass = null; - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - private EClass facetReferenceEClass = null; - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - private EClass facetOperationEClass = null; - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - private EClass facetSetEClass = null; - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - private EClass facetEClass = null; - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - private EClass categoryEClass = null; - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - private EClass facetElementEClass = null; - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - private EClass derivedTypedElementEClass = null; - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - private EClass parameterValueEClass = null; - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - private EClass documentedElementEClass = null; - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - private EDataType resourceEDataType = null; - - /** - * Creates an instance of the model <b>Package</b>, registered with - * {@link org.eclipse.emf.ecore.EPackage.Registry EPackage.Registry} by the package - * package URI value. - * <p>Note: the correct way to create the package is via the static - * factory method {@link #init init()}, which also performs - * initialization of the package, or returns the registered package, - * if one already exists. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see org.eclipse.emf.ecore.EPackage.Registry - * @see org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.EFacetPackage#eNS_URI - * @see #init() - * @generated - */ - private EFacetPackageImpl() { - super(eNS_URI, EFacetFactory.eINSTANCE); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - private static boolean isInited = false; - - /** - * Creates, registers, and initializes the <b>Package</b> for this model, and for any others upon which it depends. - * - * <p>This method is used to initialize {@link EFacetPackage#eINSTANCE} when that field is accessed. - * Clients should not invoke it directly. Instead, they should simply access that field to obtain the package. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #eNS_URI - * @see #createPackageContents() - * @see #initializePackageContents() - * @generated - */ - public static EFacetPackage init() { - if (isInited) return (EFacetPackage)EPackage.Registry.INSTANCE.getEPackage(EFacetPackage.eNS_URI); - - // Obtain or create and register package - EFacetPackageImpl theEFacetPackage = (EFacetPackageImpl)(EPackage.Registry.INSTANCE.get(eNS_URI) instanceof EFacetPackageImpl ? EPackage.Registry.INSTANCE.get(eNS_URI) : new EFacetPackageImpl()); - - isInited = true; - - // Initialize simple dependencies - EcorePackage.eINSTANCE.eClass(); - - // Obtain or create and register interdependencies - SerializationPackageImpl theSerializationPackage = (SerializationPackageImpl)(EPackage.Registry.INSTANCE.getEPackage(SerializationPackage.eNS_URI) instanceof SerializationPackageImpl ? EPackage.Registry.INSTANCE.getEPackage(SerializationPackage.eNS_URI) : SerializationPackage.eINSTANCE); - ExtensiblePackageImpl theExtensiblePackage = (ExtensiblePackageImpl)(EPackage.Registry.INSTANCE.getEPackage(ExtensiblePackage.eNS_URI) instanceof ExtensiblePackageImpl ? EPackage.Registry.INSTANCE.getEPackage(ExtensiblePackage.eNS_URI) : ExtensiblePackage.eINSTANCE); - QueryPackageImpl theQueryPackage = (QueryPackageImpl)(EPackage.Registry.INSTANCE.getEPackage(QueryPackage.eNS_URI) instanceof QueryPackageImpl ? EPackage.Registry.INSTANCE.getEPackage(QueryPackage.eNS_URI) : QueryPackage.eINSTANCE); - RuntimePackageImpl theRuntimePackage = (RuntimePackageImpl)(EPackage.Registry.INSTANCE.getEPackage(RuntimePackage.eNS_URI) instanceof RuntimePackageImpl ? EPackage.Registry.INSTANCE.getEPackage(RuntimePackage.eNS_URI) : RuntimePackage.eINSTANCE); - - // Create package meta-data objects - theEFacetPackage.createPackageContents(); - theSerializationPackage.createPackageContents(); - theExtensiblePackage.createPackageContents(); - theQueryPackage.createPackageContents(); - theRuntimePackage.createPackageContents(); - - // Initialize created meta-data - theEFacetPackage.initializePackageContents(); - theSerializationPackage.initializePackageContents(); - theExtensiblePackage.initializePackageContents(); - theQueryPackage.initializePackageContents(); - theRuntimePackage.initializePackageContents(); - - // Mark meta-data to indicate it can't be changed - theEFacetPackage.freeze(); - - - // Update the registry and return the package - EPackage.Registry.INSTANCE.put(EFacetPackage.eNS_URI, theEFacetPackage); - return theEFacetPackage; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EClass getFacetAttribute() { - return facetAttributeEClass; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EClass getFacetReference() { - return facetReferenceEClass; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EReference getFacetReference_FOpposite() { - return (EReference)facetReferenceEClass.getEStructuralFeatures().get(0); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EClass getFacetOperation() { - return facetOperationEClass; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EClass getFacetSet() { - return facetSetEClass; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EReference getFacetSet_Categories() { - return (EReference)facetSetEClass.getEStructuralFeatures().get(0); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EClass getFacet() { - return facetEClass; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EReference getFacet_ExtendedMetaclass() { - return (EReference)facetEClass.getEStructuralFeatures().get(0); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EReference getFacet_FacetElements() { - return (EReference)facetEClass.getEStructuralFeatures().get(1); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EReference getFacet_FacetOperations() { - return (EReference)facetEClass.getEStructuralFeatures().get(2); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EReference getFacet_ConformanceTypedElement() { - return (EReference)facetEClass.getEStructuralFeatures().get(3); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EReference getFacet_ExtendedFacets() { - return (EReference)facetEClass.getEStructuralFeatures().get(4); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EClass getCategory() { - return categoryEClass; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EClass getFacetElement() { - return facetElementEClass; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EReference getFacetElement_Categories() { - return (EReference)facetElementEClass.getEStructuralFeatures().get(0); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EClass getDerivedTypedElement() { - return derivedTypedElementEClass; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EReference getDerivedTypedElement_Query() { - return (EReference)derivedTypedElementEClass.getEStructuralFeatures().get(0); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EReference getDerivedTypedElement_Override() { - return (EReference)derivedTypedElementEClass.getEStructuralFeatures().get(1); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EClass getParameterValue() { - return parameterValueEClass; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EReference getParameterValue_Parameter() { - return (EReference)parameterValueEClass.getEStructuralFeatures().get(0); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EAttribute getParameterValue_Value() { - return (EAttribute)parameterValueEClass.getEStructuralFeatures().get(1); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EClass getDocumentedElement() { - return documentedElementEClass; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EAttribute getDocumentedElement_Documentation() { - return (EAttribute)documentedElementEClass.getEStructuralFeatures().get(0); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EDataType getResource() { - return resourceEDataType; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EFacetFactory getEFacetFactory() { - return (EFacetFactory)getEFactoryInstance(); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - private boolean isCreated = false; - - /** - * Creates the meta-model objects for the package. This method is - * guarded to have no affect on any invocation but its first. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public void createPackageContents() { - if (isCreated) return; - isCreated = true; - - // Create classes and their features - facetAttributeEClass = createEClass(FACET_ATTRIBUTE); - - facetReferenceEClass = createEClass(FACET_REFERENCE); - createEReference(facetReferenceEClass, FACET_REFERENCE__FOPPOSITE); - - facetOperationEClass = createEClass(FACET_OPERATION); - - facetSetEClass = createEClass(FACET_SET); - createEReference(facetSetEClass, FACET_SET__CATEGORIES); - - facetEClass = createEClass(FACET); - createEReference(facetEClass, FACET__EXTENDED_METACLASS); - createEReference(facetEClass, FACET__FACET_ELEMENTS); - createEReference(facetEClass, FACET__FACET_OPERATIONS); - createEReference(facetEClass, FACET__CONFORMANCE_TYPED_ELEMENT); - createEReference(facetEClass, FACET__EXTENDED_FACETS); - - categoryEClass = createEClass(CATEGORY); - - facetElementEClass = createEClass(FACET_ELEMENT); - createEReference(facetElementEClass, FACET_ELEMENT__CATEGORIES); - - derivedTypedElementEClass = createEClass(DERIVED_TYPED_ELEMENT); - createEReference(derivedTypedElementEClass, DERIVED_TYPED_ELEMENT__QUERY); - createEReference(derivedTypedElementEClass, DERIVED_TYPED_ELEMENT__OVERRIDE); - - parameterValueEClass = createEClass(PARAMETER_VALUE); - createEReference(parameterValueEClass, PARAMETER_VALUE__PARAMETER); - createEAttribute(parameterValueEClass, PARAMETER_VALUE__VALUE); - - documentedElementEClass = createEClass(DOCUMENTED_ELEMENT); - createEAttribute(documentedElementEClass, DOCUMENTED_ELEMENT__DOCUMENTATION); - - // Create data types - resourceEDataType = createEDataType(RESOURCE); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - private boolean isInitialized = false; - - /** - * Complete the initialization of the package and its meta-model. This - * method is guarded to have no affect on any invocation but its first. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public void initializePackageContents() { - if (isInitialized) return; - isInitialized = true; - - // Initialize package - setName(eNAME); - setNsPrefix(eNS_PREFIX); - setNsURI(eNS_URI); - - // Obtain other dependent packages - SerializationPackage theSerializationPackage = (SerializationPackage)EPackage.Registry.INSTANCE.getEPackage(SerializationPackage.eNS_URI); - ExtensiblePackage theExtensiblePackage = (ExtensiblePackage)EPackage.Registry.INSTANCE.getEPackage(ExtensiblePackage.eNS_URI); - QueryPackage theQueryPackage = (QueryPackage)EPackage.Registry.INSTANCE.getEPackage(QueryPackage.eNS_URI); - RuntimePackage theRuntimePackage = (RuntimePackage)EPackage.Registry.INSTANCE.getEPackage(RuntimePackage.eNS_URI); - - // Add subpackages - getESubpackages().add(theSerializationPackage); - getESubpackages().add(theExtensiblePackage); - getESubpackages().add(theQueryPackage); - getESubpackages().add(theRuntimePackage); - - // Create type parameters - - // Set bounds for type parameters - - // Add supertypes to classes - facetAttributeEClass.getESuperTypes().add(ecorePackage.getEAttribute()); - facetAttributeEClass.getESuperTypes().add(this.getDerivedTypedElement()); - facetReferenceEClass.getESuperTypes().add(ecorePackage.getEReference()); - facetReferenceEClass.getESuperTypes().add(this.getDerivedTypedElement()); - facetOperationEClass.getESuperTypes().add(ecorePackage.getEOperation()); - facetOperationEClass.getESuperTypes().add(this.getDerivedTypedElement()); - facetSetEClass.getESuperTypes().add(ecorePackage.getEPackage()); - facetSetEClass.getESuperTypes().add(this.getDocumentedElement()); - facetEClass.getESuperTypes().add(ecorePackage.getEClassifier()); - facetEClass.getESuperTypes().add(this.getDocumentedElement()); - categoryEClass.getESuperTypes().add(ecorePackage.getENamedElement()); - categoryEClass.getESuperTypes().add(this.getDocumentedElement()); - facetElementEClass.getESuperTypes().add(ecorePackage.getETypedElement()); - facetElementEClass.getESuperTypes().add(this.getDocumentedElement()); - derivedTypedElementEClass.getESuperTypes().add(this.getFacetElement()); - - // Initialize classes and features; add operations and parameters - initEClass(facetAttributeEClass, FacetAttribute.class, "FacetAttribute", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); //$NON-NLS-1$ - - initEClass(facetReferenceEClass, FacetReference.class, "FacetReference", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); //$NON-NLS-1$ - initEReference(getFacetReference_FOpposite(), this.getFacetReference(), null, "fOpposite", null, 0, 1, FacetReference.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); //$NON-NLS-1$ - - initEClass(facetOperationEClass, FacetOperation.class, "FacetOperation", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); //$NON-NLS-1$ - - initEClass(facetSetEClass, FacetSet.class, "FacetSet", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); //$NON-NLS-1$ - initEReference(getFacetSet_Categories(), this.getCategory(), null, "categories", null, 0, -1, FacetSet.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); //$NON-NLS-1$ - - addEOperation(facetSetEClass, this.getFacetSet(), "getFacetSets", 0, -1, IS_UNIQUE, IS_ORDERED); //$NON-NLS-1$ - - initEClass(facetEClass, Facet.class, "Facet", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); //$NON-NLS-1$ - initEReference(getFacet_ExtendedMetaclass(), ecorePackage.getEClass(), null, "extendedMetaclass", null, 0, 1, Facet.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); //$NON-NLS-1$ - initEReference(getFacet_FacetElements(), ecorePackage.getEStructuralFeature(), null, "facetElements", null, 0, -1, Facet.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); //$NON-NLS-1$ - initEReference(getFacet_FacetOperations(), this.getFacetOperation(), null, "facetOperations", null, 0, -1, Facet.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); //$NON-NLS-1$ - initEReference(getFacet_ConformanceTypedElement(), ecorePackage.getETypedElement(), null, "conformanceTypedElement", null, 0, 1, Facet.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); //$NON-NLS-1$ - initEReference(getFacet_ExtendedFacets(), this.getFacet(), null, "extendedFacets", null, 0, -1, Facet.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); //$NON-NLS-1$ - - initEClass(categoryEClass, Category.class, "Category", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); //$NON-NLS-1$ - - initEClass(facetElementEClass, FacetElement.class, "FacetElement", IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); //$NON-NLS-1$ - initEReference(getFacetElement_Categories(), this.getCategory(), null, "categories", null, 0, -1, FacetElement.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); //$NON-NLS-1$ - - initEClass(derivedTypedElementEClass, DerivedTypedElement.class, "DerivedTypedElement", IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); //$NON-NLS-1$ - initEReference(getDerivedTypedElement_Query(), theExtensiblePackage.getQuery(), null, "query", null, 0, 1, DerivedTypedElement.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); //$NON-NLS-1$ - initEReference(getDerivedTypedElement_Override(), this.getDerivedTypedElement(), null, "override", null, 0, 1, DerivedTypedElement.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); //$NON-NLS-1$ - - initEClass(parameterValueEClass, ParameterValue.class, "ParameterValue", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); //$NON-NLS-1$ - initEReference(getParameterValue_Parameter(), ecorePackage.getEParameter(), null, "parameter", null, 1, 1, ParameterValue.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); //$NON-NLS-1$ - initEAttribute(getParameterValue_Value(), ecorePackage.getEJavaObject(), "value", null, 0, 1, ParameterValue.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); //$NON-NLS-1$ - - initEClass(documentedElementEClass, DocumentedElement.class, "DocumentedElement", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); //$NON-NLS-1$ - initEAttribute(getDocumentedElement_Documentation(), ecorePackage.getEString(), "documentation", null, 0, 1, DocumentedElement.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); //$NON-NLS-1$ - - // Initialize data types - initEDataType(resourceEDataType, Resource.class, "Resource", IS_SERIALIZABLE, !IS_GENERATED_INSTANCE_CLASS); //$NON-NLS-1$ - - // Create resource - createResource(eNS_URI); - - // Create annotations - // http://www.eclipse.org/emf/2002/Ecore - createEcoreAnnotations(); - // GenModel - createGenModel_1Annotations(); - // org.eclipse.ocl.ecore.OCL - createOrgAnnotations(); - } - - /** - * Initializes the annotations for <b>http://www.eclipse.org/emf/2002/Ecore</b>. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected void createEcoreAnnotations() { - String source = "http://www.eclipse.org/emf/2002/Ecore"; //$NON-NLS-1$ - addAnnotation - (this, - source, - new String[] { - "validationDelegates", "org.eclipse.ocl.ecore.OCL" //$NON-NLS-1$ //$NON-NLS-2$ - }); - addAnnotation - (facetEClass, - source, - new String[] { - "validationDelegates", "( self.query.scope = self.facet.extendedMetaClass ) and ( self.query.name = self.name )" //$NON-NLS-1$ //$NON-NLS-2$ - }); - addAnnotation - (facetEClass, - source, - new String[] { - "validationDelegates", "self.conformanceQuery.scope = self.extendedMetaClass" //$NON-NLS-1$ //$NON-NLS-2$ - }); - } - - /** - * Initializes the annotations for <b>GenModel</b>. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected void createGenModel_1Annotations() { - String source = "GenModel"; //$NON-NLS-1$ - addAnnotation - (facetSetEClass, - source, - new String[] { - "documentation", "A \"FacetSet\" is the root element of a facet model. It contains a list of \"Facet\"." //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - }); - addAnnotation - (facetSetEClass.getEOperations().get(0), - source, - new String[] { - "documentation", "The FacetSets aggregated by this FacetSet (this operation is overridden in Aggregate in the aggregate metamodel)." //$NON-NLS-1$ //$NON-NLS-2$ - }); - addAnnotation - (getFacet_ExtendedMetaclass(), - source, - new String[] { - "documentation", "The \"extendedMetaclass\" reference references the virtually subtyped EClass." //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ - }); - addAnnotation - (getFacet_ExtendedFacets(), - source, - new String[] { - "documentation", "A facet can extend other facets. If A facet A can extend a facet B. In this case an eObject conforms to the facet A if it matches conformance evaluation of A and B. " //$NON-NLS-1$ //$NON-NLS-2$ - }); - } - - /** - * Initializes the annotations for <b>org.eclipse.ocl.ecore.OCL</b>. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected void createOrgAnnotations() { - String source = "org.eclipse.ocl.ecore.OCL"; //$NON-NLS-1$ - addAnnotation - (facetEClass, - source, - new String[] { - "body", "not(self.container().oclCastAs(FacetSet).facets->exists(f|f.extendedMetaClass.container() <> self.extendedMetaClass.container() ))" //$NON-NLS-1$ //$NON-NLS-2$ - }); - } - -} //EFacetPackageImpl
diff --git a/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/emf/facet/efacet/metamodel/v0_2_0/efacet/impl/FacetAttributeImpl.java b/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/emf/facet/efacet/metamodel/v0_2_0/efacet/impl/FacetAttributeImpl.java deleted file mode 100644 index c0ab0fe..0000000 --- a/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/emf/facet/efacet/metamodel/v0_2_0/efacet/impl/FacetAttributeImpl.java +++ /dev/null
@@ -1,414 +0,0 @@ -/** - * Copyright (c) 2011 Mia-Software. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Gregoire Dupe (Mia-Software) - Design - * Nicolas Guyomar (Mia-Software) - Implementation - * Emmanuelle Rouillé (Mia-Software) - Bug 352618 - To be able to use non derived facet structural features and save them values. - * Nicolas Bros (Mia-Software) - Bug 361823 - [Restructuring] eFacet2 meta-model - */ -package org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.impl; - -import java.util.Collection; - -import org.eclipse.emf.common.notify.Notification; -import org.eclipse.emf.common.notify.NotificationChain; -import org.eclipse.emf.common.util.EList; -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.ecore.InternalEObject; -import org.eclipse.emf.ecore.impl.EAttributeImpl; -import org.eclipse.emf.ecore.impl.ENotificationImpl; -import org.eclipse.emf.ecore.util.EObjectResolvingEList; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.Category; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.DerivedTypedElement; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.DocumentedElement; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.EFacetPackage; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.FacetAttribute; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.FacetElement; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.extensible.Query; - -/** - * <!-- begin-user-doc --> - * An implementation of the model object '<em><b>Facet Attribute</b></em>'. - * <!-- end-user-doc --> - * <p> - * The following features are implemented: - * <ul> - * <li>{@link org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.impl.FacetAttributeImpl#getDocumentation <em>Documentation</em>}</li> - * <li>{@link org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.impl.FacetAttributeImpl#getCategories <em>Categories</em>}</li> - * <li>{@link org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.impl.FacetAttributeImpl#getQuery <em>Query</em>}</li> - * <li>{@link org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.impl.FacetAttributeImpl#getOverride <em>Override</em>}</li> - * </ul> - * </p> - * - * @generated - */ -public class FacetAttributeImpl extends EAttributeImpl implements FacetAttribute { - /** - * The default value of the '{@link #getDocumentation() <em>Documentation</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #getDocumentation() - * @generated - * @ordered - */ - protected static final String DOCUMENTATION_EDEFAULT = null; - - /** - * The cached value of the '{@link #getDocumentation() <em>Documentation</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #getDocumentation() - * @generated - * @ordered - */ - protected String documentation = DOCUMENTATION_EDEFAULT; - - /** - * The cached value of the '{@link #getCategories() <em>Categories</em>}' reference list. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #getCategories() - * @generated - * @ordered - */ - protected EList<Category> categories; - - /** - * The cached value of the '{@link #getQuery() <em>Query</em>}' containment reference. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #getQuery() - * @generated - * @ordered - */ - protected Query query; - - /** - * The cached value of the '{@link #getOverride() <em>Override</em>}' reference. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #getOverride() - * @generated - * @ordered - */ - protected DerivedTypedElement override; - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected FacetAttributeImpl() { - super(); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - protected EClass eStaticClass() { - return EFacetPackage.Literals.FACET_ATTRIBUTE; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public String getDocumentation() { - return documentation; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public void setDocumentation(String newDocumentation) { - String oldDocumentation = documentation; - documentation = newDocumentation; - if (eNotificationRequired()) - eNotify(new ENotificationImpl(this, Notification.SET, EFacetPackage.FACET_ATTRIBUTE__DOCUMENTATION, oldDocumentation, documentation)); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EList<Category> getCategories() { - if (categories == null) { - categories = new EObjectResolvingEList<Category>(Category.class, this, EFacetPackage.FACET_ATTRIBUTE__CATEGORIES); - } - return categories; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public Query getQuery() { - return query; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public NotificationChain basicSetQuery(Query newQuery, NotificationChain msgs) { - Query oldQuery = query; - query = newQuery; - if (eNotificationRequired()) { - ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, EFacetPackage.FACET_ATTRIBUTE__QUERY, oldQuery, newQuery); - if (msgs == null) msgs = notification; else msgs.add(notification); - } - return msgs; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public void setQuery(Query newQuery) { - if (newQuery != query) { - NotificationChain msgs = null; - if (query != null) - msgs = ((InternalEObject)query).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - EFacetPackage.FACET_ATTRIBUTE__QUERY, null, msgs); - if (newQuery != null) - msgs = ((InternalEObject)newQuery).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - EFacetPackage.FACET_ATTRIBUTE__QUERY, null, msgs); - msgs = basicSetQuery(newQuery, msgs); - if (msgs != null) msgs.dispatch(); - } - else if (eNotificationRequired()) - eNotify(new ENotificationImpl(this, Notification.SET, EFacetPackage.FACET_ATTRIBUTE__QUERY, newQuery, newQuery)); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public DerivedTypedElement getOverride() { - if (override != null && override.eIsProxy()) { - InternalEObject oldOverride = (InternalEObject)override; - override = (DerivedTypedElement)eResolveProxy(oldOverride); - if (override != oldOverride) { - if (eNotificationRequired()) - eNotify(new ENotificationImpl(this, Notification.RESOLVE, EFacetPackage.FACET_ATTRIBUTE__OVERRIDE, oldOverride, override)); - } - } - return override; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public DerivedTypedElement basicGetOverride() { - return override; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public void setOverride(DerivedTypedElement newOverride) { - DerivedTypedElement oldOverride = override; - override = newOverride; - if (eNotificationRequired()) - eNotify(new ENotificationImpl(this, Notification.SET, EFacetPackage.FACET_ATTRIBUTE__OVERRIDE, oldOverride, override)); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { - switch (featureID) { - case EFacetPackage.FACET_ATTRIBUTE__QUERY: - return basicSetQuery(null, msgs); - } - return super.eInverseRemove(otherEnd, featureID, msgs); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public Object eGet(int featureID, boolean resolve, boolean coreType) { - switch (featureID) { - case EFacetPackage.FACET_ATTRIBUTE__DOCUMENTATION: - return getDocumentation(); - case EFacetPackage.FACET_ATTRIBUTE__CATEGORIES: - return getCategories(); - case EFacetPackage.FACET_ATTRIBUTE__QUERY: - return getQuery(); - case EFacetPackage.FACET_ATTRIBUTE__OVERRIDE: - if (resolve) return getOverride(); - return basicGetOverride(); - } - return super.eGet(featureID, resolve, coreType); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @SuppressWarnings("unchecked") - @Override - public void eSet(int featureID, Object newValue) { - switch (featureID) { - case EFacetPackage.FACET_ATTRIBUTE__DOCUMENTATION: - setDocumentation((String)newValue); - return; - case EFacetPackage.FACET_ATTRIBUTE__CATEGORIES: - getCategories().clear(); - getCategories().addAll((Collection<? extends Category>)newValue); - return; - case EFacetPackage.FACET_ATTRIBUTE__QUERY: - setQuery((Query)newValue); - return; - case EFacetPackage.FACET_ATTRIBUTE__OVERRIDE: - setOverride((DerivedTypedElement)newValue); - return; - } - super.eSet(featureID, newValue); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public void eUnset(int featureID) { - switch (featureID) { - case EFacetPackage.FACET_ATTRIBUTE__DOCUMENTATION: - setDocumentation(DOCUMENTATION_EDEFAULT); - return; - case EFacetPackage.FACET_ATTRIBUTE__CATEGORIES: - getCategories().clear(); - return; - case EFacetPackage.FACET_ATTRIBUTE__QUERY: - setQuery((Query)null); - return; - case EFacetPackage.FACET_ATTRIBUTE__OVERRIDE: - setOverride((DerivedTypedElement)null); - return; - } - super.eUnset(featureID); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public boolean eIsSet(int featureID) { - switch (featureID) { - case EFacetPackage.FACET_ATTRIBUTE__DOCUMENTATION: - return DOCUMENTATION_EDEFAULT == null ? documentation != null : !DOCUMENTATION_EDEFAULT.equals(documentation); - case EFacetPackage.FACET_ATTRIBUTE__CATEGORIES: - return categories != null && !categories.isEmpty(); - case EFacetPackage.FACET_ATTRIBUTE__QUERY: - return query != null; - case EFacetPackage.FACET_ATTRIBUTE__OVERRIDE: - return override != null; - } - return super.eIsSet(featureID); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public int eBaseStructuralFeatureID(int derivedFeatureID, Class<?> baseClass) { - if (baseClass == DocumentedElement.class) { - switch (derivedFeatureID) { - case EFacetPackage.FACET_ATTRIBUTE__DOCUMENTATION: return EFacetPackage.DOCUMENTED_ELEMENT__DOCUMENTATION; - default: return -1; - } - } - if (baseClass == FacetElement.class) { - switch (derivedFeatureID) { - case EFacetPackage.FACET_ATTRIBUTE__CATEGORIES: return EFacetPackage.FACET_ELEMENT__CATEGORIES; - default: return -1; - } - } - if (baseClass == DerivedTypedElement.class) { - switch (derivedFeatureID) { - case EFacetPackage.FACET_ATTRIBUTE__QUERY: return EFacetPackage.DERIVED_TYPED_ELEMENT__QUERY; - case EFacetPackage.FACET_ATTRIBUTE__OVERRIDE: return EFacetPackage.DERIVED_TYPED_ELEMENT__OVERRIDE; - default: return -1; - } - } - return super.eBaseStructuralFeatureID(derivedFeatureID, baseClass); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public int eDerivedStructuralFeatureID(int baseFeatureID, Class<?> baseClass) { - if (baseClass == DocumentedElement.class) { - switch (baseFeatureID) { - case EFacetPackage.DOCUMENTED_ELEMENT__DOCUMENTATION: return EFacetPackage.FACET_ATTRIBUTE__DOCUMENTATION; - default: return -1; - } - } - if (baseClass == FacetElement.class) { - switch (baseFeatureID) { - case EFacetPackage.FACET_ELEMENT__CATEGORIES: return EFacetPackage.FACET_ATTRIBUTE__CATEGORIES; - default: return -1; - } - } - if (baseClass == DerivedTypedElement.class) { - switch (baseFeatureID) { - case EFacetPackage.DERIVED_TYPED_ELEMENT__QUERY: return EFacetPackage.FACET_ATTRIBUTE__QUERY; - case EFacetPackage.DERIVED_TYPED_ELEMENT__OVERRIDE: return EFacetPackage.FACET_ATTRIBUTE__OVERRIDE; - default: return -1; - } - } - return super.eDerivedStructuralFeatureID(baseFeatureID, baseClass); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public String toString() { - if (eIsProxy()) return super.toString(); - - StringBuffer result = new StringBuffer(super.toString()); - result.append(" (documentation: "); //$NON-NLS-1$ - result.append(documentation); - result.append(')'); - return result.toString(); - } - -} //FacetAttributeImpl
diff --git a/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/emf/facet/efacet/metamodel/v0_2_0/efacet/impl/FacetElementImpl.java b/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/emf/facet/efacet/metamodel/v0_2_0/efacet/impl/FacetElementImpl.java deleted file mode 100644 index c02a858..0000000 --- a/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/emf/facet/efacet/metamodel/v0_2_0/efacet/impl/FacetElementImpl.java +++ /dev/null
@@ -1,245 +0,0 @@ -/** - * Copyright (c) 2011 Mia-Software. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Gregoire Dupe (Mia-Software) - Design - * Nicolas Guyomar (Mia-Software) - Implementation - * Emmanuelle Rouillé (Mia-Software) - Bug 352618 - To be able to use non derived facet structural features and save them values. - * Nicolas Bros (Mia-Software) - Bug 361823 - [Restructuring] eFacet2 meta-model - */ -package org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.impl; - -import java.util.Collection; - -import org.eclipse.emf.common.notify.Notification; -import org.eclipse.emf.common.util.EList; -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.ecore.impl.ENotificationImpl; -import org.eclipse.emf.ecore.impl.ETypedElementImpl; -import org.eclipse.emf.ecore.util.EObjectResolvingEList; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.Category; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.DocumentedElement; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.EFacetPackage; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.FacetElement; - -/** - * <!-- begin-user-doc --> - * An implementation of the model object '<em><b>Facet Element</b></em>'. - * <!-- end-user-doc --> - * <p> - * The following features are implemented: - * <ul> - * <li>{@link org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.impl.FacetElementImpl#getDocumentation <em>Documentation</em>}</li> - * <li>{@link org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.impl.FacetElementImpl#getCategories <em>Categories</em>}</li> - * </ul> - * </p> - * - * @generated - */ -public abstract class FacetElementImpl extends ETypedElementImpl implements FacetElement { - /** - * The default value of the '{@link #getDocumentation() <em>Documentation</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #getDocumentation() - * @generated - * @ordered - */ - protected static final String DOCUMENTATION_EDEFAULT = null; - - /** - * The cached value of the '{@link #getDocumentation() <em>Documentation</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #getDocumentation() - * @generated - * @ordered - */ - protected String documentation = DOCUMENTATION_EDEFAULT; - - /** - * The cached value of the '{@link #getCategories() <em>Categories</em>}' reference list. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #getCategories() - * @generated - * @ordered - */ - protected EList<Category> categories; - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected FacetElementImpl() { - super(); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - protected EClass eStaticClass() { - return EFacetPackage.Literals.FACET_ELEMENT; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public String getDocumentation() { - return documentation; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public void setDocumentation(String newDocumentation) { - String oldDocumentation = documentation; - documentation = newDocumentation; - if (eNotificationRequired()) - eNotify(new ENotificationImpl(this, Notification.SET, EFacetPackage.FACET_ELEMENT__DOCUMENTATION, oldDocumentation, documentation)); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EList<Category> getCategories() { - if (categories == null) { - categories = new EObjectResolvingEList<Category>(Category.class, this, EFacetPackage.FACET_ELEMENT__CATEGORIES); - } - return categories; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public Object eGet(int featureID, boolean resolve, boolean coreType) { - switch (featureID) { - case EFacetPackage.FACET_ELEMENT__DOCUMENTATION: - return getDocumentation(); - case EFacetPackage.FACET_ELEMENT__CATEGORIES: - return getCategories(); - } - return super.eGet(featureID, resolve, coreType); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @SuppressWarnings("unchecked") - @Override - public void eSet(int featureID, Object newValue) { - switch (featureID) { - case EFacetPackage.FACET_ELEMENT__DOCUMENTATION: - setDocumentation((String)newValue); - return; - case EFacetPackage.FACET_ELEMENT__CATEGORIES: - getCategories().clear(); - getCategories().addAll((Collection<? extends Category>)newValue); - return; - } - super.eSet(featureID, newValue); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public void eUnset(int featureID) { - switch (featureID) { - case EFacetPackage.FACET_ELEMENT__DOCUMENTATION: - setDocumentation(DOCUMENTATION_EDEFAULT); - return; - case EFacetPackage.FACET_ELEMENT__CATEGORIES: - getCategories().clear(); - return; - } - super.eUnset(featureID); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public boolean eIsSet(int featureID) { - switch (featureID) { - case EFacetPackage.FACET_ELEMENT__DOCUMENTATION: - return DOCUMENTATION_EDEFAULT == null ? documentation != null : !DOCUMENTATION_EDEFAULT.equals(documentation); - case EFacetPackage.FACET_ELEMENT__CATEGORIES: - return categories != null && !categories.isEmpty(); - } - return super.eIsSet(featureID); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public int eBaseStructuralFeatureID(int derivedFeatureID, Class<?> baseClass) { - if (baseClass == DocumentedElement.class) { - switch (derivedFeatureID) { - case EFacetPackage.FACET_ELEMENT__DOCUMENTATION: return EFacetPackage.DOCUMENTED_ELEMENT__DOCUMENTATION; - default: return -1; - } - } - return super.eBaseStructuralFeatureID(derivedFeatureID, baseClass); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public int eDerivedStructuralFeatureID(int baseFeatureID, Class<?> baseClass) { - if (baseClass == DocumentedElement.class) { - switch (baseFeatureID) { - case EFacetPackage.DOCUMENTED_ELEMENT__DOCUMENTATION: return EFacetPackage.FACET_ELEMENT__DOCUMENTATION; - default: return -1; - } - } - return super.eDerivedStructuralFeatureID(baseFeatureID, baseClass); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public String toString() { - if (eIsProxy()) return super.toString(); - - StringBuffer result = new StringBuffer(super.toString()); - result.append(" (documentation: "); //$NON-NLS-1$ - result.append(documentation); - result.append(')'); - return result.toString(); - } - -} //FacetElementImpl
diff --git a/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/emf/facet/efacet/metamodel/v0_2_0/efacet/impl/FacetImpl.java b/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/emf/facet/efacet/metamodel/v0_2_0/efacet/impl/FacetImpl.java deleted file mode 100644 index d4d86d3..0000000 --- a/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/emf/facet/efacet/metamodel/v0_2_0/efacet/impl/FacetImpl.java +++ /dev/null
@@ -1,490 +0,0 @@ -/** - * Copyright (c) 2011 Mia-Software. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Gregoire Dupe (Mia-Software) - Design - * Nicolas Guyomar (Mia-Software) - Implementation - * Emmanuelle Rouillé (Mia-Software) - Bug 352618 - To be able to use non derived facet structural features and save them values. - * Nicolas Bros (Mia-Software) - Bug 361823 - [Restructuring] eFacet2 meta-model - * Gregoire Dupe (Mia-Software) - Bug 369987 - [Restructuring][Table] Switch to the new customization and facet framework - * Gregoire Dupe (Mia-Software) - Bug 373078 - API Cleaning - * Gregoire Dupe (Mia-Software) - Bug 376576 - [EFacet] Change the multiplicity of Facet::extendedFacet - */ -package org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.impl; - -import java.util.Collection; - -import org.eclipse.emf.common.notify.Notification; -import org.eclipse.emf.common.notify.NotificationChain; -import org.eclipse.emf.common.util.EList; -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.ecore.EStructuralFeature; -import org.eclipse.emf.ecore.ETypedElement; -import org.eclipse.emf.ecore.InternalEObject; -import org.eclipse.emf.ecore.impl.EClassifierImpl; -import org.eclipse.emf.ecore.impl.ENotificationImpl; -import org.eclipse.emf.ecore.util.EObjectContainmentEList; -import org.eclipse.emf.ecore.util.EObjectResolvingEList; -import org.eclipse.emf.ecore.util.InternalEList; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.DocumentedElement; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.EFacetPackage; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.Facet; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.FacetOperation; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.FacetSet; - -/** - * <!-- begin-user-doc --> - * An implementation of the model object '<em><b>Facet</b></em>'. - * <!-- end-user-doc --> - * <p> - * The following features are implemented: - * <ul> - * <li>{@link org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.impl.FacetImpl#getDocumentation <em>Documentation</em>}</li> - * <li>{@link org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.impl.FacetImpl#getExtendedMetaclass <em>Extended Metaclass</em>}</li> - * <li>{@link org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.impl.FacetImpl#getFacetElements <em>Facet Elements</em>}</li> - * <li>{@link org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.impl.FacetImpl#getFacetOperations <em>Facet Operations</em>}</li> - * <li>{@link org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.impl.FacetImpl#getConformanceTypedElement <em>Conformance Typed Element</em>}</li> - * <li>{@link org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.impl.FacetImpl#getExtendedFacets <em>Extended Facets</em>}</li> - * </ul> - * </p> - * - * @generated - */ -public class FacetImpl extends EClassifierImpl implements Facet { - /** - * The default value of the '{@link #getDocumentation() <em>Documentation</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #getDocumentation() - * @generated - * @ordered - */ - protected static final String DOCUMENTATION_EDEFAULT = null; - - /** - * The cached value of the '{@link #getDocumentation() <em>Documentation</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #getDocumentation() - * @generated - * @ordered - */ - protected String documentation = DOCUMENTATION_EDEFAULT; - - /** - * The cached value of the '{@link #getExtendedMetaclass() <em>Extended Metaclass</em>}' reference. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #getExtendedMetaclass() - * @generated - * @ordered - */ - protected EClass extendedMetaclass; - - /** - * The cached value of the '{@link #getFacetElements() <em>Facet Elements</em>}' containment reference list. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #getFacetElements() - * @generated - * @ordered - */ - protected EList<EStructuralFeature> facetElements; - - /** - * The cached value of the '{@link #getFacetOperations() <em>Facet Operations</em>}' containment reference list. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #getFacetOperations() - * @generated - * @ordered - */ - protected EList<FacetOperation> facetOperations; - - /** - * The cached value of the '{@link #getConformanceTypedElement() <em>Conformance Typed Element</em>}' reference. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #getConformanceTypedElement() - * @generated - * @ordered - */ - protected ETypedElement conformanceTypedElement; - - /** - * The cached value of the '{@link #getExtendedFacets() <em>Extended Facets</em>}' reference list. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #getExtendedFacets() - * @generated - * @ordered - */ - protected EList<Facet> extendedFacets; - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected FacetImpl() { - super(); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - protected EClass eStaticClass() { - return EFacetPackage.Literals.FACET; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public String getDocumentation() { - return documentation; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public void setDocumentation(String newDocumentation) { - String oldDocumentation = documentation; - documentation = newDocumentation; - if (eNotificationRequired()) - eNotify(new ENotificationImpl(this, Notification.SET, EFacetPackage.FACET__DOCUMENTATION, oldDocumentation, documentation)); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated NOT - */ - public FacetSet basicGetFacetSet() { - if (getEPackage() instanceof FacetSet) { - FacetSet facetSet = (FacetSet) getEPackage(); - return facetSet; - } - return null; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated NOT - */ - public void setFacetSet(final FacetSet newFacetSet) { - newFacetSet.getEClassifiers().add(this); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EClass getExtendedMetaclass() { - if (extendedMetaclass != null && extendedMetaclass.eIsProxy()) { - InternalEObject oldExtendedMetaclass = (InternalEObject)extendedMetaclass; - extendedMetaclass = (EClass)eResolveProxy(oldExtendedMetaclass); - if (extendedMetaclass != oldExtendedMetaclass) { - if (eNotificationRequired()) - eNotify(new ENotificationImpl(this, Notification.RESOLVE, EFacetPackage.FACET__EXTENDED_METACLASS, oldExtendedMetaclass, extendedMetaclass)); - } - } - return extendedMetaclass; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated NOT - */ - public EClass basicGetExtendedMetaclass() { - if (this.extendedMetaclass != null && this.extendedMetaclass.eIsProxy()) { - InternalEObject oldExtendedMetaclass = (InternalEObject)this.extendedMetaclass; - this.extendedMetaclass = (EClass)eResolveProxy(oldExtendedMetaclass); - if (this.extendedMetaclass != oldExtendedMetaclass) { - if (eNotificationRequired()) { - eNotify(new ENotificationImpl(this, Notification.RESOLVE, EFacetPackage.FACET__EXTENDED_METACLASS, oldExtendedMetaclass, this.extendedMetaclass)); - } - } - } - return this.extendedMetaclass; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public void setExtendedMetaclass(EClass newExtendedMetaclass) { - EClass oldExtendedMetaclass = extendedMetaclass; - extendedMetaclass = newExtendedMetaclass; - if (eNotificationRequired()) - eNotify(new ENotificationImpl(this, Notification.SET, EFacetPackage.FACET__EXTENDED_METACLASS, oldExtendedMetaclass, extendedMetaclass)); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EList<EStructuralFeature> getFacetElements() { - if (facetElements == null) { - facetElements = new EObjectContainmentEList<EStructuralFeature>(EStructuralFeature.class, this, EFacetPackage.FACET__FACET_ELEMENTS); - } - return facetElements; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EList<FacetOperation> getFacetOperations() { - if (facetOperations == null) { - facetOperations = new EObjectContainmentEList<FacetOperation>(FacetOperation.class, this, EFacetPackage.FACET__FACET_OPERATIONS); - } - return facetOperations; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public ETypedElement getConformanceTypedElement() { - if (conformanceTypedElement != null && conformanceTypedElement.eIsProxy()) { - InternalEObject oldConformanceTypedElement = (InternalEObject)conformanceTypedElement; - conformanceTypedElement = (ETypedElement)eResolveProxy(oldConformanceTypedElement); - if (conformanceTypedElement != oldConformanceTypedElement) { - if (eNotificationRequired()) - eNotify(new ENotificationImpl(this, Notification.RESOLVE, EFacetPackage.FACET__CONFORMANCE_TYPED_ELEMENT, oldConformanceTypedElement, conformanceTypedElement)); - } - } - return conformanceTypedElement; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public ETypedElement basicGetConformanceTypedElement() { - return conformanceTypedElement; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public void setConformanceTypedElement(ETypedElement newConformanceTypedElement) { - ETypedElement oldConformanceTypedElement = conformanceTypedElement; - conformanceTypedElement = newConformanceTypedElement; - if (eNotificationRequired()) - eNotify(new ENotificationImpl(this, Notification.SET, EFacetPackage.FACET__CONFORMANCE_TYPED_ELEMENT, oldConformanceTypedElement, conformanceTypedElement)); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EList<Facet> getExtendedFacets() { - if (extendedFacets == null) { - extendedFacets = new EObjectResolvingEList<Facet>(Facet.class, this, EFacetPackage.FACET__EXTENDED_FACETS); - } - return extendedFacets; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { - switch (featureID) { - case EFacetPackage.FACET__FACET_ELEMENTS: - return ((InternalEList<?>)getFacetElements()).basicRemove(otherEnd, msgs); - case EFacetPackage.FACET__FACET_OPERATIONS: - return ((InternalEList<?>)getFacetOperations()).basicRemove(otherEnd, msgs); - } - return super.eInverseRemove(otherEnd, featureID, msgs); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public Object eGet(int featureID, boolean resolve, boolean coreType) { - switch (featureID) { - case EFacetPackage.FACET__DOCUMENTATION: - return getDocumentation(); - case EFacetPackage.FACET__EXTENDED_METACLASS: - if (resolve) return getExtendedMetaclass(); - return basicGetExtendedMetaclass(); - case EFacetPackage.FACET__FACET_ELEMENTS: - return getFacetElements(); - case EFacetPackage.FACET__FACET_OPERATIONS: - return getFacetOperations(); - case EFacetPackage.FACET__CONFORMANCE_TYPED_ELEMENT: - if (resolve) return getConformanceTypedElement(); - return basicGetConformanceTypedElement(); - case EFacetPackage.FACET__EXTENDED_FACETS: - return getExtendedFacets(); - } - return super.eGet(featureID, resolve, coreType); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @SuppressWarnings("unchecked") - @Override - public void eSet(int featureID, Object newValue) { - switch (featureID) { - case EFacetPackage.FACET__DOCUMENTATION: - setDocumentation((String)newValue); - return; - case EFacetPackage.FACET__EXTENDED_METACLASS: - setExtendedMetaclass((EClass)newValue); - return; - case EFacetPackage.FACET__FACET_ELEMENTS: - getFacetElements().clear(); - getFacetElements().addAll((Collection<? extends EStructuralFeature>)newValue); - return; - case EFacetPackage.FACET__FACET_OPERATIONS: - getFacetOperations().clear(); - getFacetOperations().addAll((Collection<? extends FacetOperation>)newValue); - return; - case EFacetPackage.FACET__CONFORMANCE_TYPED_ELEMENT: - setConformanceTypedElement((ETypedElement)newValue); - return; - case EFacetPackage.FACET__EXTENDED_FACETS: - getExtendedFacets().clear(); - getExtendedFacets().addAll((Collection<? extends Facet>)newValue); - return; - } - super.eSet(featureID, newValue); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public void eUnset(int featureID) { - switch (featureID) { - case EFacetPackage.FACET__DOCUMENTATION: - setDocumentation(DOCUMENTATION_EDEFAULT); - return; - case EFacetPackage.FACET__EXTENDED_METACLASS: - setExtendedMetaclass((EClass)null); - return; - case EFacetPackage.FACET__FACET_ELEMENTS: - getFacetElements().clear(); - return; - case EFacetPackage.FACET__FACET_OPERATIONS: - getFacetOperations().clear(); - return; - case EFacetPackage.FACET__CONFORMANCE_TYPED_ELEMENT: - setConformanceTypedElement((ETypedElement)null); - return; - case EFacetPackage.FACET__EXTENDED_FACETS: - getExtendedFacets().clear(); - return; - } - super.eUnset(featureID); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public boolean eIsSet(int featureID) { - switch (featureID) { - case EFacetPackage.FACET__DOCUMENTATION: - return DOCUMENTATION_EDEFAULT == null ? documentation != null : !DOCUMENTATION_EDEFAULT.equals(documentation); - case EFacetPackage.FACET__EXTENDED_METACLASS: - return extendedMetaclass != null; - case EFacetPackage.FACET__FACET_ELEMENTS: - return facetElements != null && !facetElements.isEmpty(); - case EFacetPackage.FACET__FACET_OPERATIONS: - return facetOperations != null && !facetOperations.isEmpty(); - case EFacetPackage.FACET__CONFORMANCE_TYPED_ELEMENT: - return conformanceTypedElement != null; - case EFacetPackage.FACET__EXTENDED_FACETS: - return extendedFacets != null && !extendedFacets.isEmpty(); - } - return super.eIsSet(featureID); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public int eBaseStructuralFeatureID(int derivedFeatureID, Class<?> baseClass) { - if (baseClass == DocumentedElement.class) { - switch (derivedFeatureID) { - case EFacetPackage.FACET__DOCUMENTATION: return EFacetPackage.DOCUMENTED_ELEMENT__DOCUMENTATION; - default: return -1; - } - } - return super.eBaseStructuralFeatureID(derivedFeatureID, baseClass); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public int eDerivedStructuralFeatureID(int baseFeatureID, Class<?> baseClass) { - if (baseClass == DocumentedElement.class) { - switch (baseFeatureID) { - case EFacetPackage.DOCUMENTED_ELEMENT__DOCUMENTATION: return EFacetPackage.FACET__DOCUMENTATION; - default: return -1; - } - } - return super.eDerivedStructuralFeatureID(baseFeatureID, baseClass); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public String toString() { - if (eIsProxy()) return super.toString(); - - StringBuffer result = new StringBuffer(super.toString()); - result.append(" (documentation: "); //$NON-NLS-1$ - result.append(documentation); - result.append(')'); - return result.toString(); - } - -} //FacetImpl
diff --git a/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/emf/facet/efacet/metamodel/v0_2_0/efacet/impl/FacetOperationImpl.java b/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/emf/facet/efacet/metamodel/v0_2_0/efacet/impl/FacetOperationImpl.java deleted file mode 100644 index f1914bc..0000000 --- a/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/emf/facet/efacet/metamodel/v0_2_0/efacet/impl/FacetOperationImpl.java +++ /dev/null
@@ -1,414 +0,0 @@ -/** - * Copyright (c) 2011 Mia-Software. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Gregoire Dupe (Mia-Software) - Design - * Nicolas Guyomar (Mia-Software) - Implementation - * Emmanuelle Rouillé (Mia-Software) - Bug 352618 - To be able to use non derived facet structural features and save them values. - * Nicolas Bros (Mia-Software) - Bug 361823 - [Restructuring] eFacet2 meta-model - */ -package org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.impl; - -import java.util.Collection; - -import org.eclipse.emf.common.notify.Notification; -import org.eclipse.emf.common.notify.NotificationChain; -import org.eclipse.emf.common.util.EList; -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.ecore.InternalEObject; -import org.eclipse.emf.ecore.impl.ENotificationImpl; -import org.eclipse.emf.ecore.impl.EOperationImpl; -import org.eclipse.emf.ecore.util.EObjectResolvingEList; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.Category; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.DerivedTypedElement; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.DocumentedElement; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.EFacetPackage; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.FacetElement; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.FacetOperation; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.extensible.Query; - -/** - * <!-- begin-user-doc --> - * An implementation of the model object '<em><b>Facet Operation</b></em>'. - * <!-- end-user-doc --> - * <p> - * The following features are implemented: - * <ul> - * <li>{@link org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.impl.FacetOperationImpl#getDocumentation <em>Documentation</em>}</li> - * <li>{@link org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.impl.FacetOperationImpl#getCategories <em>Categories</em>}</li> - * <li>{@link org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.impl.FacetOperationImpl#getQuery <em>Query</em>}</li> - * <li>{@link org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.impl.FacetOperationImpl#getOverride <em>Override</em>}</li> - * </ul> - * </p> - * - * @generated - */ -public class FacetOperationImpl extends EOperationImpl implements FacetOperation { - /** - * The default value of the '{@link #getDocumentation() <em>Documentation</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #getDocumentation() - * @generated - * @ordered - */ - protected static final String DOCUMENTATION_EDEFAULT = null; - - /** - * The cached value of the '{@link #getDocumentation() <em>Documentation</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #getDocumentation() - * @generated - * @ordered - */ - protected String documentation = DOCUMENTATION_EDEFAULT; - - /** - * The cached value of the '{@link #getCategories() <em>Categories</em>}' reference list. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #getCategories() - * @generated - * @ordered - */ - protected EList<Category> categories; - - /** - * The cached value of the '{@link #getQuery() <em>Query</em>}' containment reference. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #getQuery() - * @generated - * @ordered - */ - protected Query query; - - /** - * The cached value of the '{@link #getOverride() <em>Override</em>}' reference. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #getOverride() - * @generated - * @ordered - */ - protected DerivedTypedElement override; - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected FacetOperationImpl() { - super(); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - protected EClass eStaticClass() { - return EFacetPackage.Literals.FACET_OPERATION; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public String getDocumentation() { - return documentation; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public void setDocumentation(String newDocumentation) { - String oldDocumentation = documentation; - documentation = newDocumentation; - if (eNotificationRequired()) - eNotify(new ENotificationImpl(this, Notification.SET, EFacetPackage.FACET_OPERATION__DOCUMENTATION, oldDocumentation, documentation)); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EList<Category> getCategories() { - if (categories == null) { - categories = new EObjectResolvingEList<Category>(Category.class, this, EFacetPackage.FACET_OPERATION__CATEGORIES); - } - return categories; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public Query getQuery() { - return query; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public NotificationChain basicSetQuery(Query newQuery, NotificationChain msgs) { - Query oldQuery = query; - query = newQuery; - if (eNotificationRequired()) { - ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, EFacetPackage.FACET_OPERATION__QUERY, oldQuery, newQuery); - if (msgs == null) msgs = notification; else msgs.add(notification); - } - return msgs; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public void setQuery(Query newQuery) { - if (newQuery != query) { - NotificationChain msgs = null; - if (query != null) - msgs = ((InternalEObject)query).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - EFacetPackage.FACET_OPERATION__QUERY, null, msgs); - if (newQuery != null) - msgs = ((InternalEObject)newQuery).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - EFacetPackage.FACET_OPERATION__QUERY, null, msgs); - msgs = basicSetQuery(newQuery, msgs); - if (msgs != null) msgs.dispatch(); - } - else if (eNotificationRequired()) - eNotify(new ENotificationImpl(this, Notification.SET, EFacetPackage.FACET_OPERATION__QUERY, newQuery, newQuery)); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public DerivedTypedElement getOverride() { - if (override != null && override.eIsProxy()) { - InternalEObject oldOverride = (InternalEObject)override; - override = (DerivedTypedElement)eResolveProxy(oldOverride); - if (override != oldOverride) { - if (eNotificationRequired()) - eNotify(new ENotificationImpl(this, Notification.RESOLVE, EFacetPackage.FACET_OPERATION__OVERRIDE, oldOverride, override)); - } - } - return override; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public DerivedTypedElement basicGetOverride() { - return override; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public void setOverride(DerivedTypedElement newOverride) { - DerivedTypedElement oldOverride = override; - override = newOverride; - if (eNotificationRequired()) - eNotify(new ENotificationImpl(this, Notification.SET, EFacetPackage.FACET_OPERATION__OVERRIDE, oldOverride, override)); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { - switch (featureID) { - case EFacetPackage.FACET_OPERATION__QUERY: - return basicSetQuery(null, msgs); - } - return super.eInverseRemove(otherEnd, featureID, msgs); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public Object eGet(int featureID, boolean resolve, boolean coreType) { - switch (featureID) { - case EFacetPackage.FACET_OPERATION__DOCUMENTATION: - return getDocumentation(); - case EFacetPackage.FACET_OPERATION__CATEGORIES: - return getCategories(); - case EFacetPackage.FACET_OPERATION__QUERY: - return getQuery(); - case EFacetPackage.FACET_OPERATION__OVERRIDE: - if (resolve) return getOverride(); - return basicGetOverride(); - } - return super.eGet(featureID, resolve, coreType); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @SuppressWarnings("unchecked") - @Override - public void eSet(int featureID, Object newValue) { - switch (featureID) { - case EFacetPackage.FACET_OPERATION__DOCUMENTATION: - setDocumentation((String)newValue); - return; - case EFacetPackage.FACET_OPERATION__CATEGORIES: - getCategories().clear(); - getCategories().addAll((Collection<? extends Category>)newValue); - return; - case EFacetPackage.FACET_OPERATION__QUERY: - setQuery((Query)newValue); - return; - case EFacetPackage.FACET_OPERATION__OVERRIDE: - setOverride((DerivedTypedElement)newValue); - return; - } - super.eSet(featureID, newValue); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public void eUnset(int featureID) { - switch (featureID) { - case EFacetPackage.FACET_OPERATION__DOCUMENTATION: - setDocumentation(DOCUMENTATION_EDEFAULT); - return; - case EFacetPackage.FACET_OPERATION__CATEGORIES: - getCategories().clear(); - return; - case EFacetPackage.FACET_OPERATION__QUERY: - setQuery((Query)null); - return; - case EFacetPackage.FACET_OPERATION__OVERRIDE: - setOverride((DerivedTypedElement)null); - return; - } - super.eUnset(featureID); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public boolean eIsSet(int featureID) { - switch (featureID) { - case EFacetPackage.FACET_OPERATION__DOCUMENTATION: - return DOCUMENTATION_EDEFAULT == null ? documentation != null : !DOCUMENTATION_EDEFAULT.equals(documentation); - case EFacetPackage.FACET_OPERATION__CATEGORIES: - return categories != null && !categories.isEmpty(); - case EFacetPackage.FACET_OPERATION__QUERY: - return query != null; - case EFacetPackage.FACET_OPERATION__OVERRIDE: - return override != null; - } - return super.eIsSet(featureID); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public int eBaseStructuralFeatureID(int derivedFeatureID, Class<?> baseClass) { - if (baseClass == DocumentedElement.class) { - switch (derivedFeatureID) { - case EFacetPackage.FACET_OPERATION__DOCUMENTATION: return EFacetPackage.DOCUMENTED_ELEMENT__DOCUMENTATION; - default: return -1; - } - } - if (baseClass == FacetElement.class) { - switch (derivedFeatureID) { - case EFacetPackage.FACET_OPERATION__CATEGORIES: return EFacetPackage.FACET_ELEMENT__CATEGORIES; - default: return -1; - } - } - if (baseClass == DerivedTypedElement.class) { - switch (derivedFeatureID) { - case EFacetPackage.FACET_OPERATION__QUERY: return EFacetPackage.DERIVED_TYPED_ELEMENT__QUERY; - case EFacetPackage.FACET_OPERATION__OVERRIDE: return EFacetPackage.DERIVED_TYPED_ELEMENT__OVERRIDE; - default: return -1; - } - } - return super.eBaseStructuralFeatureID(derivedFeatureID, baseClass); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public int eDerivedStructuralFeatureID(int baseFeatureID, Class<?> baseClass) { - if (baseClass == DocumentedElement.class) { - switch (baseFeatureID) { - case EFacetPackage.DOCUMENTED_ELEMENT__DOCUMENTATION: return EFacetPackage.FACET_OPERATION__DOCUMENTATION; - default: return -1; - } - } - if (baseClass == FacetElement.class) { - switch (baseFeatureID) { - case EFacetPackage.FACET_ELEMENT__CATEGORIES: return EFacetPackage.FACET_OPERATION__CATEGORIES; - default: return -1; - } - } - if (baseClass == DerivedTypedElement.class) { - switch (baseFeatureID) { - case EFacetPackage.DERIVED_TYPED_ELEMENT__QUERY: return EFacetPackage.FACET_OPERATION__QUERY; - case EFacetPackage.DERIVED_TYPED_ELEMENT__OVERRIDE: return EFacetPackage.FACET_OPERATION__OVERRIDE; - default: return -1; - } - } - return super.eDerivedStructuralFeatureID(baseFeatureID, baseClass); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public String toString() { - if (eIsProxy()) return super.toString(); - - StringBuffer result = new StringBuffer(super.toString()); - result.append(" (documentation: "); //$NON-NLS-1$ - result.append(documentation); - result.append(')'); - return result.toString(); - } - -} //FacetOperationImpl
diff --git a/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/emf/facet/efacet/metamodel/v0_2_0/efacet/impl/FacetReferenceImpl.java b/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/emf/facet/efacet/metamodel/v0_2_0/efacet/impl/FacetReferenceImpl.java deleted file mode 100644 index 2992833..0000000 --- a/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/emf/facet/efacet/metamodel/v0_2_0/efacet/impl/FacetReferenceImpl.java +++ /dev/null
@@ -1,483 +0,0 @@ -/** - * Copyright (c) 2011, 2015 Mia-Software, and Soft-Maint. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Gregoire Dupe (Mia-Software) - Design - * Nicolas Guyomar (Mia-Software) - Implementation - * Emmanuelle Rouillé (Mia-Software) - Bug 352618 - To be able to use non derived facet structural features and save them values. - * Nicolas Bros (Mia-Software) - Bug 361823 - [Restructuring] eFacet2 meta-model - * Gregoire Dupe (Mia-Software) - Bug 366055 - NavigationQuery - * Gregoire Dupe (Mia-Software) - Bug 369673 - [Facet] IsOneOfQuery - * Olivier Remaud (Soft-Maint) - Bug 369824 - Add a simple way to return string literal constants from a customization query - * Gregoire Dupe (Mia-Software) - Bug 369987 - [Restructuring][Table] Switch to the new customization and facet framework - * Gregoire Dupe (Mia-software) - Bug 364325 - [Restructuring] The user must be able to navigate into a model using the Facet. - * Nicolas Bros (Mia-Software) - Bug 372626 - [Facet] Aggregates - * Nicolas Bros (Mia-Software) - Bug 376941 - [EFacet] Facet operation arguments in Facet model - * Gregoire Dupe (Mia-Software) - Bug 376576 - [EFacet] Change the multiplicity of Facet::extendedFacet - * Jonathan Pepin (Soft-Maint) - Bug 463898 - Create FacetReference not derived, without query and with opposite mechanism - */ -package org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.impl; - -import java.util.Collection; - -import org.eclipse.emf.common.notify.Notification; -import org.eclipse.emf.common.notify.NotificationChain; -import org.eclipse.emf.common.util.EList; -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.ecore.InternalEObject; -import org.eclipse.emf.ecore.impl.ENotificationImpl; -import org.eclipse.emf.ecore.impl.EReferenceImpl; -import org.eclipse.emf.ecore.util.EObjectResolvingEList; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.Category; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.DerivedTypedElement; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.DocumentedElement; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.EFacetPackage; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.FacetElement; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.FacetReference; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.extensible.Query; - -/** - * <!-- begin-user-doc --> - * An implementation of the model object '<em><b>Facet Reference</b></em>'. - * <!-- end-user-doc --> - * <p> - * The following features are implemented: - * <ul> - * <li>{@link org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.impl.FacetReferenceImpl#getDocumentation <em>Documentation</em>}</li> - * <li>{@link org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.impl.FacetReferenceImpl#getCategories <em>Categories</em>}</li> - * <li>{@link org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.impl.FacetReferenceImpl#getQuery <em>Query</em>}</li> - * <li>{@link org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.impl.FacetReferenceImpl#getOverride <em>Override</em>}</li> - * <li>{@link org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.impl.FacetReferenceImpl#getFOpposite <em>FOpposite</em>}</li> - * </ul> - * </p> - * - * @generated - */ -public class FacetReferenceImpl extends EReferenceImpl implements FacetReference { - /** - * The default value of the '{@link #getDocumentation() <em>Documentation</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #getDocumentation() - * @generated - * @ordered - */ - protected static final String DOCUMENTATION_EDEFAULT = null; - - /** - * The cached value of the '{@link #getDocumentation() <em>Documentation</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #getDocumentation() - * @generated - * @ordered - */ - protected String documentation = DOCUMENTATION_EDEFAULT; - - /** - * The cached value of the '{@link #getCategories() <em>Categories</em>}' reference list. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #getCategories() - * @generated - * @ordered - */ - protected EList<Category> categories; - - /** - * The cached value of the '{@link #getQuery() <em>Query</em>}' containment reference. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #getQuery() - * @generated - * @ordered - */ - protected Query query; - - /** - * The cached value of the '{@link #getOverride() <em>Override</em>}' reference. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #getOverride() - * @generated - * @ordered - */ - protected DerivedTypedElement override; - - /** - * The cached value of the '{@link #getFOpposite() <em>FOpposite</em>}' reference. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #getFOpposite() - * @generated - * @ordered - */ - protected FacetReference fOpposite; - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected FacetReferenceImpl() { - super(); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - protected EClass eStaticClass() { - return EFacetPackage.Literals.FACET_REFERENCE; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public String getDocumentation() { - return documentation; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public void setDocumentation(String newDocumentation) { - String oldDocumentation = documentation; - documentation = newDocumentation; - if (eNotificationRequired()) - eNotify(new ENotificationImpl(this, Notification.SET, EFacetPackage.FACET_REFERENCE__DOCUMENTATION, oldDocumentation, documentation)); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EList<Category> getCategories() { - if (categories == null) { - categories = new EObjectResolvingEList<Category>(Category.class, this, EFacetPackage.FACET_REFERENCE__CATEGORIES); - } - return categories; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public Query getQuery() { - return query; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public NotificationChain basicSetQuery(Query newQuery, NotificationChain msgs) { - Query oldQuery = query; - query = newQuery; - if (eNotificationRequired()) { - ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, EFacetPackage.FACET_REFERENCE__QUERY, oldQuery, newQuery); - if (msgs == null) msgs = notification; else msgs.add(notification); - } - return msgs; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public void setQuery(Query newQuery) { - if (newQuery != query) { - NotificationChain msgs = null; - if (query != null) - msgs = ((InternalEObject)query).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - EFacetPackage.FACET_REFERENCE__QUERY, null, msgs); - if (newQuery != null) - msgs = ((InternalEObject)newQuery).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - EFacetPackage.FACET_REFERENCE__QUERY, null, msgs); - msgs = basicSetQuery(newQuery, msgs); - if (msgs != null) msgs.dispatch(); - } - else if (eNotificationRequired()) - eNotify(new ENotificationImpl(this, Notification.SET, EFacetPackage.FACET_REFERENCE__QUERY, newQuery, newQuery)); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public DerivedTypedElement getOverride() { - if (override != null && override.eIsProxy()) { - InternalEObject oldOverride = (InternalEObject)override; - override = (DerivedTypedElement)eResolveProxy(oldOverride); - if (override != oldOverride) { - if (eNotificationRequired()) - eNotify(new ENotificationImpl(this, Notification.RESOLVE, EFacetPackage.FACET_REFERENCE__OVERRIDE, oldOverride, override)); - } - } - return override; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public DerivedTypedElement basicGetOverride() { - return override; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public void setOverride(DerivedTypedElement newOverride) { - DerivedTypedElement oldOverride = override; - override = newOverride; - if (eNotificationRequired()) - eNotify(new ENotificationImpl(this, Notification.SET, EFacetPackage.FACET_REFERENCE__OVERRIDE, oldOverride, override)); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public FacetReference getFOpposite() { - if (fOpposite != null && fOpposite.eIsProxy()) { - InternalEObject oldFOpposite = (InternalEObject)fOpposite; - fOpposite = (FacetReference)eResolveProxy(oldFOpposite); - if (fOpposite != oldFOpposite) { - if (eNotificationRequired()) - eNotify(new ENotificationImpl(this, Notification.RESOLVE, EFacetPackage.FACET_REFERENCE__FOPPOSITE, oldFOpposite, fOpposite)); - } - } - return fOpposite; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public FacetReference basicGetFOpposite() { - return fOpposite; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public void setFOpposite(FacetReference newFOpposite) { - FacetReference oldFOpposite = fOpposite; - fOpposite = newFOpposite; - if (eNotificationRequired()) - eNotify(new ENotificationImpl(this, Notification.SET, EFacetPackage.FACET_REFERENCE__FOPPOSITE, oldFOpposite, fOpposite)); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { - switch (featureID) { - case EFacetPackage.FACET_REFERENCE__QUERY: - return basicSetQuery(null, msgs); - } - return super.eInverseRemove(otherEnd, featureID, msgs); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public Object eGet(int featureID, boolean resolve, boolean coreType) { - switch (featureID) { - case EFacetPackage.FACET_REFERENCE__DOCUMENTATION: - return getDocumentation(); - case EFacetPackage.FACET_REFERENCE__CATEGORIES: - return getCategories(); - case EFacetPackage.FACET_REFERENCE__QUERY: - return getQuery(); - case EFacetPackage.FACET_REFERENCE__OVERRIDE: - if (resolve) return getOverride(); - return basicGetOverride(); - case EFacetPackage.FACET_REFERENCE__FOPPOSITE: - if (resolve) return getFOpposite(); - return basicGetFOpposite(); - } - return super.eGet(featureID, resolve, coreType); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @SuppressWarnings("unchecked") - @Override - public void eSet(int featureID, Object newValue) { - switch (featureID) { - case EFacetPackage.FACET_REFERENCE__DOCUMENTATION: - setDocumentation((String)newValue); - return; - case EFacetPackage.FACET_REFERENCE__CATEGORIES: - getCategories().clear(); - getCategories().addAll((Collection<? extends Category>)newValue); - return; - case EFacetPackage.FACET_REFERENCE__QUERY: - setQuery((Query)newValue); - return; - case EFacetPackage.FACET_REFERENCE__OVERRIDE: - setOverride((DerivedTypedElement)newValue); - return; - case EFacetPackage.FACET_REFERENCE__FOPPOSITE: - setFOpposite((FacetReference)newValue); - return; - } - super.eSet(featureID, newValue); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public void eUnset(int featureID) { - switch (featureID) { - case EFacetPackage.FACET_REFERENCE__DOCUMENTATION: - setDocumentation(DOCUMENTATION_EDEFAULT); - return; - case EFacetPackage.FACET_REFERENCE__CATEGORIES: - getCategories().clear(); - return; - case EFacetPackage.FACET_REFERENCE__QUERY: - setQuery((Query)null); - return; - case EFacetPackage.FACET_REFERENCE__OVERRIDE: - setOverride((DerivedTypedElement)null); - return; - case EFacetPackage.FACET_REFERENCE__FOPPOSITE: - setFOpposite((FacetReference)null); - return; - } - super.eUnset(featureID); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public boolean eIsSet(int featureID) { - switch (featureID) { - case EFacetPackage.FACET_REFERENCE__DOCUMENTATION: - return DOCUMENTATION_EDEFAULT == null ? documentation != null : !DOCUMENTATION_EDEFAULT.equals(documentation); - case EFacetPackage.FACET_REFERENCE__CATEGORIES: - return categories != null && !categories.isEmpty(); - case EFacetPackage.FACET_REFERENCE__QUERY: - return query != null; - case EFacetPackage.FACET_REFERENCE__OVERRIDE: - return override != null; - case EFacetPackage.FACET_REFERENCE__FOPPOSITE: - return fOpposite != null; - } - return super.eIsSet(featureID); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public int eBaseStructuralFeatureID(int derivedFeatureID, Class<?> baseClass) { - if (baseClass == DocumentedElement.class) { - switch (derivedFeatureID) { - case EFacetPackage.FACET_REFERENCE__DOCUMENTATION: return EFacetPackage.DOCUMENTED_ELEMENT__DOCUMENTATION; - default: return -1; - } - } - if (baseClass == FacetElement.class) { - switch (derivedFeatureID) { - case EFacetPackage.FACET_REFERENCE__CATEGORIES: return EFacetPackage.FACET_ELEMENT__CATEGORIES; - default: return -1; - } - } - if (baseClass == DerivedTypedElement.class) { - switch (derivedFeatureID) { - case EFacetPackage.FACET_REFERENCE__QUERY: return EFacetPackage.DERIVED_TYPED_ELEMENT__QUERY; - case EFacetPackage.FACET_REFERENCE__OVERRIDE: return EFacetPackage.DERIVED_TYPED_ELEMENT__OVERRIDE; - default: return -1; - } - } - return super.eBaseStructuralFeatureID(derivedFeatureID, baseClass); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public int eDerivedStructuralFeatureID(int baseFeatureID, Class<?> baseClass) { - if (baseClass == DocumentedElement.class) { - switch (baseFeatureID) { - case EFacetPackage.DOCUMENTED_ELEMENT__DOCUMENTATION: return EFacetPackage.FACET_REFERENCE__DOCUMENTATION; - default: return -1; - } - } - if (baseClass == FacetElement.class) { - switch (baseFeatureID) { - case EFacetPackage.FACET_ELEMENT__CATEGORIES: return EFacetPackage.FACET_REFERENCE__CATEGORIES; - default: return -1; - } - } - if (baseClass == DerivedTypedElement.class) { - switch (baseFeatureID) { - case EFacetPackage.DERIVED_TYPED_ELEMENT__QUERY: return EFacetPackage.FACET_REFERENCE__QUERY; - case EFacetPackage.DERIVED_TYPED_ELEMENT__OVERRIDE: return EFacetPackage.FACET_REFERENCE__OVERRIDE; - default: return -1; - } - } - return super.eDerivedStructuralFeatureID(baseFeatureID, baseClass); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public String toString() { - if (eIsProxy()) return super.toString(); - - StringBuffer result = new StringBuffer(super.toString()); - result.append(" (documentation: "); //$NON-NLS-1$ - result.append(documentation); - result.append(')'); - return result.toString(); - } - -} //FacetReferenceImpl
diff --git a/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/emf/facet/efacet/metamodel/v0_2_0/efacet/impl/FacetSetImpl.java b/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/emf/facet/efacet/metamodel/v0_2_0/efacet/impl/FacetSetImpl.java deleted file mode 100644 index 360ef7b..0000000 --- a/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/emf/facet/efacet/metamodel/v0_2_0/efacet/impl/FacetSetImpl.java +++ /dev/null
@@ -1,318 +0,0 @@ -/** - * Copyright (c) 2011 Mia-Software. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Gregoire Dupe (Mia-Software) - Design - * Nicolas Guyomar (Mia-Software) - Implementation - * Emmanuelle Rouillé (Mia-Software) - Bug 352618 - To be able to use non derived facet structural features and save them values. - * Nicolas Bros (Mia-Software) - Bug 361823 - [Restructuring] eFacet2 meta-model - * Gregoire Dupe (Mia-Software) - Bug 369987 - [Restructuring][Table] Switch to the new customization and facet framework - * Gregoire Dupe (Mia-Software) - Bug 373078 - API Cleaning - */ -package org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.impl; - -import java.util.Collection; -import java.util.Collections; - -import org.eclipse.emf.common.notify.Notification; -import org.eclipse.emf.common.notify.NotificationChain; -import org.eclipse.emf.common.util.BasicEList; -import org.eclipse.emf.common.util.EList; -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.ecore.EClassifier; -import org.eclipse.emf.ecore.EPackage; -import org.eclipse.emf.ecore.InternalEObject; -import org.eclipse.emf.ecore.impl.ENotificationImpl; -import org.eclipse.emf.ecore.impl.EPackageImpl; -import org.eclipse.emf.ecore.util.EObjectContainmentEList; -import org.eclipse.emf.ecore.util.InternalEList; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.Category; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.DocumentedElement; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.EFacetPackage; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.Facet; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.FacetSet; - -/** - * <!-- begin-user-doc --> - * An implementation of the model object '<em><b>Facet Set</b></em>'. - * <!-- end-user-doc --> - * <p> - * The following features are implemented: - * <ul> - * <li>{@link org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.impl.FacetSetImpl#getDocumentation <em>Documentation</em>}</li> - * <li>{@link org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.impl.FacetSetImpl#getCategories <em>Categories</em>}</li> - * </ul> - * </p> - * - * @generated - */ -public class FacetSetImpl extends EPackageImpl implements FacetSet { - /** - * The default value of the '{@link #getDocumentation() <em>Documentation</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #getDocumentation() - * @generated - * @ordered - */ - protected static final String DOCUMENTATION_EDEFAULT = null; - - /** - * The cached value of the '{@link #getDocumentation() <em>Documentation</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #getDocumentation() - * @generated - * @ordered - */ - protected String documentation = DOCUMENTATION_EDEFAULT; - - /** - * The cached value of the '{@link #getCategories() <em>Categories</em>}' containment reference list. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #getCategories() - * @generated - * @ordered - */ - protected EList<Category> categories; - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected FacetSetImpl() { - super(); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - protected EClass eStaticClass() { - return EFacetPackage.Literals.FACET_SET; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public String getDocumentation() { - return documentation; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public void setDocumentation(String newDocumentation) { - String oldDocumentation = documentation; - documentation = newDocumentation; - if (eNotificationRequired()) - eNotify(new ENotificationImpl(this, Notification.SET, EFacetPackage.FACET_SET__DOCUMENTATION, oldDocumentation, documentation)); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated NOT - */ - public EList<Facet> getFacets() { - EList<Facet> facets = new BasicEList<Facet>(); - for(EClassifier eClassifier : this.getEClassifiers()){ - if (eClassifier instanceof Facet) { - Facet facet = (Facet) eClassifier; - facets.add(facet); - } - } - return facets; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EList<Category> getCategories() { - if (categories == null) { - categories = new EObjectContainmentEList<Category>(Category.class, this, EFacetPackage.FACET_SET__CATEGORIES); - } - return categories; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * - * @generated NOT - */ - public EPackage basicGetExtendedEPackage() { - EList<Facet> facets = getFacets(); - EPackage result = null; - for (Facet facet : facets) { - EClass extendedMetaclass = facet.getExtendedMetaclass(); - if (extendedMetaclass != null) { - EPackage ePackage = extendedMetaclass.getEPackage(); - if (ePackage != null) { - if (result != null && ePackage != result) { - throw new IllegalStateException("The Facets in a FacetSet must all extend EClasses from the same EPackage"); - } - result = ePackage; - } - } - } - return result; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated NOT - */ - public EList<FacetSet> getFacetSets() { - return new BasicEList<FacetSet>(); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { - switch (featureID) { - case EFacetPackage.FACET_SET__CATEGORIES: - return ((InternalEList<?>)getCategories()).basicRemove(otherEnd, msgs); - } - return super.eInverseRemove(otherEnd, featureID, msgs); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public Object eGet(int featureID, boolean resolve, boolean coreType) { - switch (featureID) { - case EFacetPackage.FACET_SET__DOCUMENTATION: - return getDocumentation(); - case EFacetPackage.FACET_SET__CATEGORIES: - return getCategories(); - } - return super.eGet(featureID, resolve, coreType); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @SuppressWarnings("unchecked") - @Override - public void eSet(int featureID, Object newValue) { - switch (featureID) { - case EFacetPackage.FACET_SET__DOCUMENTATION: - setDocumentation((String)newValue); - return; - case EFacetPackage.FACET_SET__CATEGORIES: - getCategories().clear(); - getCategories().addAll((Collection<? extends Category>)newValue); - return; - } - super.eSet(featureID, newValue); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public void eUnset(int featureID) { - switch (featureID) { - case EFacetPackage.FACET_SET__DOCUMENTATION: - setDocumentation(DOCUMENTATION_EDEFAULT); - return; - case EFacetPackage.FACET_SET__CATEGORIES: - getCategories().clear(); - return; - } - super.eUnset(featureID); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public boolean eIsSet(int featureID) { - switch (featureID) { - case EFacetPackage.FACET_SET__DOCUMENTATION: - return DOCUMENTATION_EDEFAULT == null ? documentation != null : !DOCUMENTATION_EDEFAULT.equals(documentation); - case EFacetPackage.FACET_SET__CATEGORIES: - return categories != null && !categories.isEmpty(); - } - return super.eIsSet(featureID); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public int eBaseStructuralFeatureID(int derivedFeatureID, Class<?> baseClass) { - if (baseClass == DocumentedElement.class) { - switch (derivedFeatureID) { - case EFacetPackage.FACET_SET__DOCUMENTATION: return EFacetPackage.DOCUMENTED_ELEMENT__DOCUMENTATION; - default: return -1; - } - } - return super.eBaseStructuralFeatureID(derivedFeatureID, baseClass); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public int eDerivedStructuralFeatureID(int baseFeatureID, Class<?> baseClass) { - if (baseClass == DocumentedElement.class) { - switch (baseFeatureID) { - case EFacetPackage.DOCUMENTED_ELEMENT__DOCUMENTATION: return EFacetPackage.FACET_SET__DOCUMENTATION; - default: return -1; - } - } - return super.eDerivedStructuralFeatureID(baseFeatureID, baseClass); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public String toString() { - if (eIsProxy()) return super.toString(); - - StringBuffer result = new StringBuffer(super.toString()); - result.append(" (documentation: "); //$NON-NLS-1$ - result.append(documentation); - result.append(')'); - return result.toString(); - } - -} //FacetSetImpl
diff --git a/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/emf/facet/efacet/metamodel/v0_2_0/efacet/impl/ParameterValueImpl.java b/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/emf/facet/efacet/metamodel/v0_2_0/efacet/impl/ParameterValueImpl.java deleted file mode 100644 index 3942b28..0000000 --- a/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/emf/facet/efacet/metamodel/v0_2_0/efacet/impl/ParameterValueImpl.java +++ /dev/null
@@ -1,234 +0,0 @@ -/** - * Copyright (c) 2011 Mia-Software. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Gregoire Dupe (Mia-Software) - Design - * Nicolas Guyomar (Mia-Software) - Implementation - * Emmanuelle Rouillé (Mia-Software) - Bug 352618 - To be able to use non derived facet structural features and save them values. - * Nicolas Bros (Mia-Software) - Bug 361823 - [Restructuring] eFacet2 meta-model - */ -package org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.impl; - -import org.eclipse.emf.common.notify.Notification; -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.ecore.EParameter; -import org.eclipse.emf.ecore.InternalEObject; -import org.eclipse.emf.ecore.impl.ENotificationImpl; -import org.eclipse.emf.ecore.impl.EObjectImpl; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.EFacetPackage; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.ParameterValue; - -/** - * <!-- begin-user-doc --> - * An implementation of the model object '<em><b>Parameter Value</b></em>'. - * <!-- end-user-doc --> - * <p> - * The following features are implemented: - * <ul> - * <li>{@link org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.impl.ParameterValueImpl#getParameter <em>Parameter</em>}</li> - * <li>{@link org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.impl.ParameterValueImpl#getValue <em>Value</em>}</li> - * </ul> - * </p> - * - * @generated - */ -public class ParameterValueImpl extends EObjectImpl implements ParameterValue { - /** - * The cached value of the '{@link #getParameter() <em>Parameter</em>}' reference. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #getParameter() - * @generated - * @ordered - */ - protected EParameter parameter; - - /** - * The default value of the '{@link #getValue() <em>Value</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #getValue() - * @generated - * @ordered - */ - protected static final Object VALUE_EDEFAULT = null; - - /** - * The cached value of the '{@link #getValue() <em>Value</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #getValue() - * @generated - * @ordered - */ - protected Object value = VALUE_EDEFAULT; - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected ParameterValueImpl() { - super(); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - protected EClass eStaticClass() { - return EFacetPackage.Literals.PARAMETER_VALUE; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EParameter getParameter() { - if (parameter != null && parameter.eIsProxy()) { - InternalEObject oldParameter = (InternalEObject)parameter; - parameter = (EParameter)eResolveProxy(oldParameter); - if (parameter != oldParameter) { - if (eNotificationRequired()) - eNotify(new ENotificationImpl(this, Notification.RESOLVE, EFacetPackage.PARAMETER_VALUE__PARAMETER, oldParameter, parameter)); - } - } - return parameter; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EParameter basicGetParameter() { - return parameter; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public void setParameter(EParameter newParameter) { - EParameter oldParameter = parameter; - parameter = newParameter; - if (eNotificationRequired()) - eNotify(new ENotificationImpl(this, Notification.SET, EFacetPackage.PARAMETER_VALUE__PARAMETER, oldParameter, parameter)); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public Object getValue() { - return value; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public void setValue(Object newValue) { - Object oldValue = value; - value = newValue; - if (eNotificationRequired()) - eNotify(new ENotificationImpl(this, Notification.SET, EFacetPackage.PARAMETER_VALUE__VALUE, oldValue, value)); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public Object eGet(int featureID, boolean resolve, boolean coreType) { - switch (featureID) { - case EFacetPackage.PARAMETER_VALUE__PARAMETER: - if (resolve) return getParameter(); - return basicGetParameter(); - case EFacetPackage.PARAMETER_VALUE__VALUE: - return getValue(); - } - return super.eGet(featureID, resolve, coreType); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public void eSet(int featureID, Object newValue) { - switch (featureID) { - case EFacetPackage.PARAMETER_VALUE__PARAMETER: - setParameter((EParameter)newValue); - return; - case EFacetPackage.PARAMETER_VALUE__VALUE: - setValue(newValue); - return; - } - super.eSet(featureID, newValue); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public void eUnset(int featureID) { - switch (featureID) { - case EFacetPackage.PARAMETER_VALUE__PARAMETER: - setParameter((EParameter)null); - return; - case EFacetPackage.PARAMETER_VALUE__VALUE: - setValue(VALUE_EDEFAULT); - return; - } - super.eUnset(featureID); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public boolean eIsSet(int featureID) { - switch (featureID) { - case EFacetPackage.PARAMETER_VALUE__PARAMETER: - return parameter != null; - case EFacetPackage.PARAMETER_VALUE__VALUE: - return VALUE_EDEFAULT == null ? value != null : !VALUE_EDEFAULT.equals(value); - } - return super.eIsSet(featureID); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public String toString() { - if (eIsProxy()) return super.toString(); - - StringBuffer result = new StringBuffer(super.toString()); - result.append(" (value: "); //$NON-NLS-1$ - result.append(value); - result.append(')'); - return result.toString(); - } - -} //ParameterValueImpl
diff --git a/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/emf/facet/efacet/metamodel/v0_2_0/efacet/query/EObjectLiteralQuery.java b/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/emf/facet/efacet/metamodel/v0_2_0/efacet/query/EObjectLiteralQuery.java deleted file mode 100644 index d088b54..0000000 --- a/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/emf/facet/efacet/metamodel/v0_2_0/efacet/query/EObjectLiteralQuery.java +++ /dev/null
@@ -1,73 +0,0 @@ -/** - * Copyright (c) 2011-2012 Mia-Software. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Gregoire Dupe (Mia-Software) - Design - * Nicolas Guyomar (Mia-Software) - Implementation - * Emmanuelle Rouillé (Mia-Software) - Bug 352618 - To be able to use non derived facet structural features and save them values. - * Nicolas Bros (Mia-Software) - Bug 361823 - [Restructuring] eFacet2 meta-model - * Gregoire Dupe (Mia-Software) - Bug 366055 - NavigationQuery - * Gregoire Dupe (Mia-Software) - Bug 369673 - [Facet] IsOneOfQuery - * Olivier Remaud (Soft-Maint) - Bug 369824 - Add a simple way to return string literal constants from a customization query - * Gregoire Dupe (Mia-Software) - Bug 369987 - [Restructuring][Table] Switch to the new customization and facet framework - * Gregoire Dupe (Mia-software) - Bug 364325 - [Restructuring] The user must be able to navigate into a model using the Facet. - * Nicolas Bros (Mia-Software) - Bug 372626 - [Facet] Aggregates - * Nicolas Bros (Mia-Software) - Bug 376941 - [EFacet] Facet operation arguments in Facet model - * - */ -package org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.query; - -import org.eclipse.emf.ecore.EObject; - -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.extensible.Query; - -/** - * <!-- begin-user-doc --> - * A representation of the model object '<em><b>EObject Literal Query</b></em>'. - * <!-- end-user-doc --> - * - * <p> - * The following features are supported: - * <ul> - * <li>{@link org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.query.EObjectLiteralQuery#getElement <em>Element</em>}</li> - * </ul> - * </p> - * - * @see org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.query.QueryPackage#getEObjectLiteralQuery() - * @model - * @generated - * @since 0.2 - */ -public interface EObjectLiteralQuery extends Query { - /** - * Returns the value of the '<em><b>Element</b></em>' reference. - * <!-- begin-user-doc --> - * <p> - * If the meaning of the '<em>Element</em>' reference isn't clear, - * there really should be more of a description here... - * </p> - * <!-- end-user-doc --> - * @return the value of the '<em>Element</em>' reference. - * @see #setElement(EObject) - * @see org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.query.QueryPackage#getEObjectLiteralQuery_Element() - * @model - * @generated - */ - EObject getElement(); - - /** - * Sets the value of the '{@link org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.query.EObjectLiteralQuery#getElement <em>Element</em>}' reference. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @param value the new value of the '<em>Element</em>' reference. - * @see #getElement() - * @generated - */ - void setElement(EObject value); - -} // EObjectLiteralQuery
diff --git a/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/emf/facet/efacet/metamodel/v0_2_0/efacet/query/FalseLiteralQuery.java b/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/emf/facet/efacet/metamodel/v0_2_0/efacet/query/FalseLiteralQuery.java deleted file mode 100644 index b63024b..0000000 --- a/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/emf/facet/efacet/metamodel/v0_2_0/efacet/query/FalseLiteralQuery.java +++ /dev/null
@@ -1,38 +0,0 @@ -/** - * Copyright (c) 2011 Mia-Software. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Gregoire Dupe (Mia-Software) - Design - * Nicolas Guyomar (Mia-Software) - Implementation - * Emmanuelle Rouillé (Mia-Software) - Bug 352618 - To be able to use non derived facet structural features and save them values. - * Nicolas Bros (Mia-Software) - Bug 361823 - [Restructuring] eFacet2 meta-model - * Gregoire Dupe (Mia-Software) - Bug 366055 - NavigationQuery - * Gregoire Dupe (Mia-Software) - Bug 369673 - [Facet] IsOneOfQuery - * Olivier Remaud (Soft-Maint) - Bug 369824 - Add a simple way to return string literal constants from a customization query - * Gregoire Dupe (Mia-software) - Bug 369987 - [Restructuring][Table] Switch to the new customization and facet framework - */ -package org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.query; - -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.extensible.Query; - -/** - * <!-- begin-user-doc --> - * A representation of the model object '<em><b>False Literal Query</b></em>'. - * <!-- end-user-doc --> - * - * <!-- begin-model-doc --> - * This query retrun false. - * <!-- end-model-doc --> - * - * - * @see org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.query.QueryPackage#getFalseLiteralQuery() - * @model - * @generated - */ -public interface FalseLiteralQuery extends Query { -} // FalseLiteralQuery
diff --git a/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/emf/facet/efacet/metamodel/v0_2_0/efacet/query/FloatLiteralQuery.java b/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/emf/facet/efacet/metamodel/v0_2_0/efacet/query/FloatLiteralQuery.java deleted file mode 100644 index 505016f..0000000 --- a/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/emf/facet/efacet/metamodel/v0_2_0/efacet/query/FloatLiteralQuery.java +++ /dev/null
@@ -1,71 +0,0 @@ -/** - * Copyright (c) 2011-2012 Mia-Software. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Gregoire Dupe (Mia-Software) - Design - * Nicolas Guyomar (Mia-Software) - Implementation - * Emmanuelle Rouillé (Mia-Software) - Bug 352618 - To be able to use non derived facet structural features and save them values. - * Nicolas Bros (Mia-Software) - Bug 361823 - [Restructuring] eFacet2 meta-model - * Gregoire Dupe (Mia-Software) - Bug 366055 - NavigationQuery - * Gregoire Dupe (Mia-Software) - Bug 369673 - [Facet] IsOneOfQuery - * Olivier Remaud (Soft-Maint) - Bug 369824 - Add a simple way to return string literal constants from a customization query - * Gregoire Dupe (Mia-Software) - Bug 369987 - [Restructuring][Table] Switch to the new customization and facet framework - * Gregoire Dupe (Mia-software) - Bug 364325 - [Restructuring] The user must be able to navigate into a model using the Facet. - * Nicolas Bros (Mia-Software) - Bug 372626 - [Facet] Aggregates - * Nicolas Bros (Mia-Software) - Bug 376941 - [EFacet] Facet operation arguments in Facet model - * - */ -package org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.query; - -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.extensible.Query; - -/** - * <!-- begin-user-doc --> - * A representation of the model object '<em><b>Float Literal Query</b></em>'. - * <!-- end-user-doc --> - * - * <p> - * The following features are supported: - * <ul> - * <li>{@link org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.query.FloatLiteralQuery#getValue <em>Value</em>}</li> - * </ul> - * </p> - * - * @see org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.query.QueryPackage#getFloatLiteralQuery() - * @model - * @generated - * @since 0.2 - */ -public interface FloatLiteralQuery extends Query { - /** - * Returns the value of the '<em><b>Value</b></em>' attribute. - * <!-- begin-user-doc --> - * <p> - * If the meaning of the '<em>Value</em>' attribute isn't clear, - * there really should be more of a description here... - * </p> - * <!-- end-user-doc --> - * @return the value of the '<em>Value</em>' attribute. - * @see #setValue(float) - * @see org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.query.QueryPackage#getFloatLiteralQuery_Value() - * @model - * @generated - */ - float getValue(); - - /** - * Sets the value of the '{@link org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.query.FloatLiteralQuery#getValue <em>Value</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @param value the new value of the '<em>Value</em>' attribute. - * @see #getValue() - * @generated - */ - void setValue(float value); - -} // FloatLiteralQuery
diff --git a/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/emf/facet/efacet/metamodel/v0_2_0/efacet/query/IntegerLiteralQuery.java b/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/emf/facet/efacet/metamodel/v0_2_0/efacet/query/IntegerLiteralQuery.java deleted file mode 100644 index 3685eec..0000000 --- a/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/emf/facet/efacet/metamodel/v0_2_0/efacet/query/IntegerLiteralQuery.java +++ /dev/null
@@ -1,71 +0,0 @@ -/** - * Copyright (c) 2011-2012 Mia-Software. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Gregoire Dupe (Mia-Software) - Design - * Nicolas Guyomar (Mia-Software) - Implementation - * Emmanuelle Rouillé (Mia-Software) - Bug 352618 - To be able to use non derived facet structural features and save them values. - * Nicolas Bros (Mia-Software) - Bug 361823 - [Restructuring] eFacet2 meta-model - * Gregoire Dupe (Mia-Software) - Bug 366055 - NavigationQuery - * Gregoire Dupe (Mia-Software) - Bug 369673 - [Facet] IsOneOfQuery - * Olivier Remaud (Soft-Maint) - Bug 369824 - Add a simple way to return string literal constants from a customization query - * Gregoire Dupe (Mia-Software) - Bug 369987 - [Restructuring][Table] Switch to the new customization and facet framework - * Gregoire Dupe (Mia-software) - Bug 364325 - [Restructuring] The user must be able to navigate into a model using the Facet. - * Nicolas Bros (Mia-Software) - Bug 372626 - [Facet] Aggregates - * Nicolas Bros (Mia-Software) - Bug 376941 - [EFacet] Facet operation arguments in Facet model - * - */ -package org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.query; - -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.extensible.Query; - -/** - * <!-- begin-user-doc --> - * A representation of the model object '<em><b>Integer Literal Query</b></em>'. - * <!-- end-user-doc --> - * - * <p> - * The following features are supported: - * <ul> - * <li>{@link org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.query.IntegerLiteralQuery#getValue <em>Value</em>}</li> - * </ul> - * </p> - * - * @see org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.query.QueryPackage#getIntegerLiteralQuery() - * @model - * @generated - * @since 0.2 - */ -public interface IntegerLiteralQuery extends Query { - /** - * Returns the value of the '<em><b>Value</b></em>' attribute. - * <!-- begin-user-doc --> - * <p> - * If the meaning of the '<em>Value</em>' attribute isn't clear, - * there really should be more of a description here... - * </p> - * <!-- end-user-doc --> - * @return the value of the '<em>Value</em>' attribute. - * @see #setValue(int) - * @see org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.query.QueryPackage#getIntegerLiteralQuery_Value() - * @model - * @generated - */ - int getValue(); - - /** - * Sets the value of the '{@link org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.query.IntegerLiteralQuery#getValue <em>Value</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @param value the new value of the '<em>Value</em>' attribute. - * @see #getValue() - * @generated - */ - void setValue(int value); - -} // IntegerLiteralQuery
diff --git a/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/emf/facet/efacet/metamodel/v0_2_0/efacet/query/IsOneOfQuery.java b/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/emf/facet/efacet/metamodel/v0_2_0/efacet/query/IsOneOfQuery.java deleted file mode 100644 index 7d6581f..0000000 --- a/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/emf/facet/efacet/metamodel/v0_2_0/efacet/query/IsOneOfQuery.java +++ /dev/null
@@ -1,61 +0,0 @@ -/** - * Copyright (c) 2012 Mia-Software. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Gregoire Dupe (Mia-Software) - Design - * Nicolas Guyomar (Mia-Software) - Implementation - * Emmanuelle Rouillé (Mia-Software) - Bug 352618 - To be able to use non derived facet structural features and save them values. - * Nicolas Bros (Mia-Software) - Bug 361823 - [Restructuring] eFacet2 meta-model - * Gregoire Dupe (Mia-Software) - Bug 366055 - NavigationQuery - * Gregoire Dupe (Mia-Software) - Bug 369673 - [Facet] IsOneOfQuery - * Gregoire Dupe (Mia-Software) - Bug 369987 - [Restructuring][Table] Switch to the new customization and facet framework - */ -package org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.query; - -import org.eclipse.emf.common.util.EList; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.extensible.Query; - -/** - * <!-- begin-user-doc --> - * A representation of the model object '<em><b>Is One Of Query</b></em>'. - * <!-- end-user-doc --> - * - * <!-- begin-model-doc --> - * This query returns true if the source of the query is contained in a list of eObject handled by the referennce 'expectedEObjects'. - * <!-- end-model-doc --> - * - * <p> - * The following features are supported: - * <ul> - * <li>{@link org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.query.IsOneOfQuery#getExpectedEObjects <em>Expected EObjects</em>}</li> - * </ul> - * </p> - * - * @see org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.query.QueryPackage#getIsOneOfQuery() - * @model - * @generated - */ -public interface IsOneOfQuery extends Query { - /** - * Returns the value of the '<em><b>Expected EObjects</b></em>' reference list. - * The list contents are of type {@link org.eclipse.emf.ecore.EObject}. - * <!-- begin-user-doc --> - * <p> - * If the meaning of the '<em>Expected EObjects</em>' reference list isn't clear, - * there really should be more of a description here... - * </p> - * <!-- end-user-doc --> - * @return the value of the '<em>Expected EObjects</em>' reference list. - * @see org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.query.QueryPackage#getIsOneOfQuery_ExpectedEObjects() - * @model - * @generated - */ - EList<EObject> getExpectedEObjects(); - -} // IsOneOfQuery
diff --git a/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/emf/facet/efacet/metamodel/v0_2_0/efacet/query/NavigationQuery.java b/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/emf/facet/efacet/metamodel/v0_2_0/efacet/query/NavigationQuery.java deleted file mode 100644 index 29dde84..0000000 --- a/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/emf/facet/efacet/metamodel/v0_2_0/efacet/query/NavigationQuery.java +++ /dev/null
@@ -1,87 +0,0 @@ -/** - * Copyright (c) 2011 Mia-Software. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Gregoire Dupe (Mia-Software) - Design - * Nicolas Guyomar (Mia-Software) - Implementation - * Emmanuelle Rouillé (Mia-Software) - Bug 352618 - To be able to use non derived facet structural features and save them values. - * Nicolas Bros (Mia-Software) - Bug 361823 - [Restructuring] eFacet2 meta-model - * Gregoire Dupe (Mia-Software) - Bug 366055 - NavigationQuery - */ -package org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.query; - -import org.eclipse.emf.common.util.EList; -import org.eclipse.emf.ecore.ETypedElement; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.extensible.Query; - -/** - * <!-- begin-user-doc --> - * A representation of the model object '<em><b>Navigation Query</b></em>'. - * <!-- end-user-doc --> - * - * <!-- begin-model-doc --> - * This query points to a typed element (another attribute, reference or operation for example) that lends it value to the query. - * <!-- end-model-doc --> - * - * <p> - * The following features are supported: - * <ul> - * <li>{@link org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.query.NavigationQuery#getPath <em>Path</em>}</li> - * <li>{@link org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.query.NavigationQuery#isFailOnError <em>Fail On Error</em>}</li> - * </ul> - * </p> - * - * @see org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.query.QueryPackage#getNavigationQuery() - * @model - * @generated - */ -public interface NavigationQuery extends Query { - /** - * Returns the value of the '<em><b>Path</b></em>' reference list. - * The list contents are of type {@link org.eclipse.emf.ecore.ETypedElement}. - * <!-- begin-user-doc --> - * <p> - * If the meaning of the '<em>Path</em>' reference list isn't clear, - * there really should be more of a description here... - * </p> - * <!-- end-user-doc --> - * @return the value of the '<em>Path</em>' reference list. - * @see org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.query.QueryPackage#getNavigationQuery_Path() - * @model required="true" - * @generated - */ - EList<ETypedElement> getPath(); - - /** - * Returns the value of the '<em><b>Fail On Error</b></em>' attribute. - * The default value is <code>"true"</code>. - * <!-- begin-user-doc --> - * <p> - * If the meaning of the '<em>Fail On Error</em>' attribute isn't clear, - * there really should be more of a description here... - * </p> - * <!-- end-user-doc --> - * @return the value of the '<em>Fail On Error</em>' attribute. - * @see #setFailOnError(boolean) - * @see org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.query.QueryPackage#getNavigationQuery_FailOnError() - * @model default="true" - * @generated - */ - boolean isFailOnError(); - - /** - * Sets the value of the '{@link org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.query.NavigationQuery#isFailOnError <em>Fail On Error</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @param value the new value of the '<em>Fail On Error</em>' attribute. - * @see #isFailOnError() - * @generated - */ - void setFailOnError(boolean value); - -} // NavigationQuery
diff --git a/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/emf/facet/efacet/metamodel/v0_2_0/efacet/query/NullLiteralQuery.java b/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/emf/facet/efacet/metamodel/v0_2_0/efacet/query/NullLiteralQuery.java deleted file mode 100644 index efcabf6..0000000 --- a/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/emf/facet/efacet/metamodel/v0_2_0/efacet/query/NullLiteralQuery.java +++ /dev/null
@@ -1,39 +0,0 @@ -/** - * Copyright (c) 2011 Mia-Software. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Gregoire Dupe (Mia-Software) - Design - * Nicolas Guyomar (Mia-Software) - Implementation - * Emmanuelle Rouillé (Mia-Software) - Bug 352618 - To be able to use non derived facet structural features and save them values. - * Nicolas Bros (Mia-Software) - Bug 361823 - [Restructuring] eFacet2 meta-model - * Gregoire Dupe (Mia-Software) - Bug 366055 - NavigationQuery - * Gregoire Dupe (Mia-Software) - Bug 369673 - [Facet] IsOneOfQuery - * Olivier Remaud (Soft-Maint) - Bug 369824 - Add a simple way to return string literal constants from a customization query - * Gregoire Dupe (Mia-software) - Bug 369987 - [Restructuring][Table] Switch to the new customization and facet framework - * Gregoire Dupe (Mia-Software) - Bug 369987 - [Restructuring][Table] Switch to the new customization and facet framework - */ -package org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.query; - -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.extensible.Query; - -/** - * <!-- begin-user-doc --> - * A representation of the model object '<em><b>Null Literal Query</b></em>'. - * <!-- end-user-doc --> - * - * <!-- begin-model-doc --> - * This query retrun null. - * <!-- end-model-doc --> - * - * - * @see org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.query.QueryPackage#getNullLiteralQuery() - * @model - * @generated - */ -public interface NullLiteralQuery extends Query { -} // NullLiteralQuery
diff --git a/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/emf/facet/efacet/metamodel/v0_2_0/efacet/query/OperationCallQuery.java b/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/emf/facet/efacet/metamodel/v0_2_0/efacet/query/OperationCallQuery.java deleted file mode 100644 index 6a0d4cd..0000000 --- a/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/emf/facet/efacet/metamodel/v0_2_0/efacet/query/OperationCallQuery.java +++ /dev/null
@@ -1,93 +0,0 @@ -/** - * Copyright (c) 2011-2012 Mia-Software. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Gregoire Dupe (Mia-Software) - Design - * Nicolas Guyomar (Mia-Software) - Implementation - * Emmanuelle Rouillé (Mia-Software) - Bug 352618 - To be able to use non derived facet structural features and save them values. - * Nicolas Bros (Mia-Software) - Bug 361823 - [Restructuring] eFacet2 meta-model - * Gregoire Dupe (Mia-Software) - Bug 366055 - NavigationQuery - * Gregoire Dupe (Mia-Software) - Bug 369673 - [Facet] IsOneOfQuery - * Olivier Remaud (Soft-Maint) - Bug 369824 - Add a simple way to return string literal constants from a customization query - * Gregoire Dupe (Mia-Software) - Bug 369987 - [Restructuring][Table] Switch to the new customization and facet framework - * Gregoire Dupe (Mia-software) - Bug 364325 - [Restructuring] The user must be able to navigate into a model using the Facet. - * Nicolas Bros (Mia-Software) - Bug 372626 - [Facet] Aggregates - * Nicolas Bros (Mia-Software) - Bug 376941 - [EFacet] Facet operation arguments in Facet model - * - */ -package org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.query; - -import org.eclipse.emf.common.util.EList; - -import org.eclipse.emf.ecore.EOperation; - -import org.eclipse.emf.ecore.ETypedElement; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.extensible.Query; - -/** - * <!-- begin-user-doc --> - * A representation of the model object '<em><b>Operation Call Query</b></em>'. - * <!-- end-user-doc --> - * - * <p> - * The following features are supported: - * <ul> - * <li>{@link org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.query.OperationCallQuery#getOperation <em>Operation</em>}</li> - * <li>{@link org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.query.OperationCallQuery#getArguments <em>Arguments</em>}</li> - * </ul> - * </p> - * - * @see org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.query.QueryPackage#getOperationCallQuery() - * @model - * @generated - * @since 0.2 - */ -public interface OperationCallQuery extends Query { - /** - * Returns the value of the '<em><b>Operation</b></em>' reference. - * <!-- begin-user-doc --> - * <p> - * If the meaning of the '<em>Operation</em>' reference isn't clear, - * there really should be more of a description here... - * </p> - * <!-- end-user-doc --> - * @return the value of the '<em>Operation</em>' reference. - * @see #setOperation(EOperation) - * @see org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.query.QueryPackage#getOperationCallQuery_Operation() - * @model - * @generated - */ - EOperation getOperation(); - - /** - * Sets the value of the '{@link org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.query.OperationCallQuery#getOperation <em>Operation</em>}' reference. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @param value the new value of the '<em>Operation</em>' reference. - * @see #getOperation() - * @generated - */ - void setOperation(EOperation value); - - /** - * Returns the value of the '<em><b>Arguments</b></em>' containment reference list. - * The list contents are of type {@link org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.extensible.Query}. - * <!-- begin-user-doc --> - * <p> - * If the meaning of the '<em>Arguments</em>' containment reference list isn't clear, - * there really should be more of a description here... - * </p> - * <!-- end-user-doc --> - * @return the value of the '<em>Arguments</em>' containment reference list. - * @see org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.query.QueryPackage#getOperationCallQuery_Arguments() - * @model containment="true" - * @generated - */ - EList<Query> getArguments(); - -} // OperationCallQuery
diff --git a/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/emf/facet/efacet/metamodel/v0_2_0/efacet/query/QueryFactory.java b/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/emf/facet/efacet/metamodel/v0_2_0/efacet/query/QueryFactory.java deleted file mode 100644 index 980ce51..0000000 --- a/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/emf/facet/efacet/metamodel/v0_2_0/efacet/query/QueryFactory.java +++ /dev/null
@@ -1,146 +0,0 @@ -/** - * Copyright (c) 2011 Mia-Software. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Gregoire Dupe (Mia-Software) - Design - * Nicolas Guyomar (Mia-Software) - Implementation - * Emmanuelle Rouillé (Mia-Software) - Bug 352618 - To be able to use non derived facet structural features and save them values. - * Nicolas Bros (Mia-Software) - Bug 361823 - [Restructuring] eFacet2 meta-model - * Gregoire Dupe (Mia-Software) - Bug 366055 - NavigationQuery - * Gregoire Dupe (Mia-Software) - Bug 369987 - [Restructuring][Table] Switch to the new customization and facet framework - * Gregoire Dupe (Mia-Software) - Bug 373078 - API Cleaning - */ -package org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.query; - -import org.eclipse.emf.ecore.EFactory; - -/** - * <!-- begin-user-doc --> - * The <b>Factory</b> for the model. - * It provides a create method for each non-abstract class of the model. - * <!-- end-user-doc --> - * - * @see org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.query.QueryPackage - * @generated - * @noextend This interface is not intended to be extended by clients. - * @noimplement This interface is not intended to be implemented by clients. - */ -public interface QueryFactory extends EFactory { - /** - * The singleton instance of the factory. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - QueryFactory eINSTANCE = org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.query.impl.QueryFactoryImpl.init(); - - /** - * Returns a new object of class '<em>Navigation Query</em>'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return a new object of class '<em>Navigation Query</em>'. - * @generated - */ - NavigationQuery createNavigationQuery(); - - /** - * Returns a new object of class '<em>Is One Of Query</em>'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return a new object of class '<em>Is One Of Query</em>'. - * @generated - */ - IsOneOfQuery createIsOneOfQuery(); - - /** - * Returns a new object of class '<em>String Literal Query</em>'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return a new object of class '<em>String Literal Query</em>'. - * @generated - */ - StringLiteralQuery createStringLiteralQuery(); - - /** - * Returns a new object of class '<em>True Literal Query</em>'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return a new object of class '<em>True Literal Query</em>'. - * @generated - */ - TrueLiteralQuery createTrueLiteralQuery(); - - /** - * Returns a new object of class '<em>False Literal Query</em>'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return a new object of class '<em>False Literal Query</em>'. - * @generated - */ - FalseLiteralQuery createFalseLiteralQuery(); - - /** - * Returns a new object of class '<em>Null Literal Query</em>'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return a new object of class '<em>Null Literal Query</em>'. - * @generated - */ - NullLiteralQuery createNullLiteralQuery(); - - /** - * Returns a new object of class '<em>Integer Literal Query</em>'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return a new object of class '<em>Integer Literal Query</em>'. - * @generated - * @since 0.2 - */ - IntegerLiteralQuery createIntegerLiteralQuery(); - - /** - * Returns a new object of class '<em>Float Literal Query</em>'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * - * @return a new object of class '<em>Float Literal Query</em>'. - * @generated - * @since 0.2 - */ - FloatLiteralQuery createFloatLiteralQuery(); - - /** - * Returns a new object of class '<em>EObject Literal Query</em>'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return a new object of class '<em>EObject Literal Query</em>'. - * @generated - * @since 0.2 - */ - EObjectLiteralQuery createEObjectLiteralQuery(); - - /** - * Returns a new object of class '<em>Operation Call Query</em>'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return a new object of class '<em>Operation Call Query</em>'. - * @generated - * @since 0.2 - */ - OperationCallQuery createOperationCallQuery(); - - /** - * Returns the package supported by this factory. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the package supported by this factory. - * @generated - */ - QueryPackage getQueryPackage(); - -} //QueryFactory
diff --git a/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/emf/facet/efacet/metamodel/v0_2_0/efacet/query/QueryPackage.java b/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/emf/facet/efacet/metamodel/v0_2_0/efacet/query/QueryPackage.java deleted file mode 100644 index d0a6de0..0000000 --- a/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/emf/facet/efacet/metamodel/v0_2_0/efacet/query/QueryPackage.java +++ /dev/null
@@ -1,967 +0,0 @@ -/** - * Copyright (c) 2011 Mia-Software. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Gregoire Dupe (Mia-Software) - Design - * Nicolas Guyomar (Mia-Software) - Implementation - * Emmanuelle Rouillé (Mia-Software) - Bug 352618 - To be able to use non derived facet structural features and save them values. - * Nicolas Bros (Mia-Software) - Bug 361823 - [Restructuring] eFacet2 meta-model - * Gregoire Dupe (Mia-Software) - Bug 366055 - NavigationQuery - * Gregoire Dupe (Mia-Software) - Bug 369987 - [Restructuring][Table] Switch to the new customization and facet framework - * Gregoire Dupe (Mia-Software) - Bug 373078 - API Cleaning - */ -package org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.query; - -import org.eclipse.emf.ecore.EAttribute; -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.ecore.EPackage; -import org.eclipse.emf.ecore.EReference; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.extensible.ExtensiblePackage; - -/** - * <!-- begin-user-doc --> - * The <b>Package</b> for the model. - * It contains accessors for the meta objects to represent - * <ul> - * <li>each class,</li> - * <li>each feature of each class,</li> - * <li>each enum,</li> - * <li>and each data type</li> - * </ul> - * <!-- end-user-doc --> - * @see org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.query.QueryFactory - * @model kind="package" - * @generated - * @noextend This interface is not intended to be extended by clients. - * @noimplement This interface is not intended to be implemented by clients. - */ -public interface QueryPackage extends EPackage { - /** - * The package name. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - String eNAME = "query"; //$NON-NLS-1$ - - /** - * The package namespace URI. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - String eNS_URI = "http://www.eclipse.org/emf/facet/efacet/0.2.incubation/efacet/query"; //$NON-NLS-1$ - - /** - * The package namespace name. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - String eNS_PREFIX = "query"; //$NON-NLS-1$ - - /** - * The singleton instance of the package. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - QueryPackage eINSTANCE = org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.query.impl.QueryPackageImpl.init(); - - /** - * The meta object id for the '{@link org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.query.impl.NavigationQueryImpl <em>Navigation Query</em>}' class. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.query.impl.NavigationQueryImpl - * @see org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.query.impl.QueryPackageImpl#getNavigationQuery() - * @generated - */ - int NAVIGATION_QUERY = 0; - - /** - * The feature id for the '<em><b>Can Have Side Effects</b></em>' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int NAVIGATION_QUERY__CAN_HAVE_SIDE_EFFECTS = ExtensiblePackage.QUERY__CAN_HAVE_SIDE_EFFECTS; - - /** - * The feature id for the '<em><b>Can Be Cached</b></em>' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int NAVIGATION_QUERY__CAN_BE_CACHED = ExtensiblePackage.QUERY__CAN_BE_CACHED; - - /** - * The feature id for the '<em><b>Path</b></em>' reference list. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int NAVIGATION_QUERY__PATH = ExtensiblePackage.QUERY_FEATURE_COUNT + 0; - - /** - * The feature id for the '<em><b>Fail On Error</b></em>' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int NAVIGATION_QUERY__FAIL_ON_ERROR = ExtensiblePackage.QUERY_FEATURE_COUNT + 1; - - /** - * The number of structural features of the '<em>Navigation Query</em>' class. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int NAVIGATION_QUERY_FEATURE_COUNT = ExtensiblePackage.QUERY_FEATURE_COUNT + 2; - - - /** - * The meta object id for the '{@link org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.query.impl.IsOneOfQueryImpl <em>Is One Of Query</em>}' class. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.query.impl.IsOneOfQueryImpl - * @see org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.query.impl.QueryPackageImpl#getIsOneOfQuery() - * @generated - */ - int IS_ONE_OF_QUERY = 1; - - /** - * The feature id for the '<em><b>Can Have Side Effects</b></em>' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int IS_ONE_OF_QUERY__CAN_HAVE_SIDE_EFFECTS = ExtensiblePackage.QUERY__CAN_HAVE_SIDE_EFFECTS; - - /** - * The feature id for the '<em><b>Can Be Cached</b></em>' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int IS_ONE_OF_QUERY__CAN_BE_CACHED = ExtensiblePackage.QUERY__CAN_BE_CACHED; - - /** - * The feature id for the '<em><b>Expected EObjects</b></em>' reference list. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int IS_ONE_OF_QUERY__EXPECTED_EOBJECTS = ExtensiblePackage.QUERY_FEATURE_COUNT + 0; - - /** - * The number of structural features of the '<em>Is One Of Query</em>' class. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int IS_ONE_OF_QUERY_FEATURE_COUNT = ExtensiblePackage.QUERY_FEATURE_COUNT + 1; - - - /** - * The meta object id for the '{@link org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.query.impl.StringLiteralQueryImpl <em>String Literal Query</em>}' class. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.query.impl.StringLiteralQueryImpl - * @see org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.query.impl.QueryPackageImpl#getStringLiteralQuery() - * @generated - */ - int STRING_LITERAL_QUERY = 2; - - /** - * The feature id for the '<em><b>Can Have Side Effects</b></em>' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int STRING_LITERAL_QUERY__CAN_HAVE_SIDE_EFFECTS = ExtensiblePackage.QUERY__CAN_HAVE_SIDE_EFFECTS; - - /** - * The feature id for the '<em><b>Can Be Cached</b></em>' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int STRING_LITERAL_QUERY__CAN_BE_CACHED = ExtensiblePackage.QUERY__CAN_BE_CACHED; - - /** - * The feature id for the '<em><b>Value</b></em>' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int STRING_LITERAL_QUERY__VALUE = ExtensiblePackage.QUERY_FEATURE_COUNT + 0; - - /** - * The number of structural features of the '<em>String Literal Query</em>' class. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int STRING_LITERAL_QUERY_FEATURE_COUNT = ExtensiblePackage.QUERY_FEATURE_COUNT + 1; - - - /** - * The meta object id for the '{@link org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.query.impl.TrueLiteralQueryImpl <em>True Literal Query</em>}' class. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.query.impl.TrueLiteralQueryImpl - * @see org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.query.impl.QueryPackageImpl#getTrueLiteralQuery() - * @generated - */ - int TRUE_LITERAL_QUERY = 3; - - /** - * The feature id for the '<em><b>Can Have Side Effects</b></em>' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int TRUE_LITERAL_QUERY__CAN_HAVE_SIDE_EFFECTS = ExtensiblePackage.QUERY__CAN_HAVE_SIDE_EFFECTS; - - /** - * The feature id for the '<em><b>Can Be Cached</b></em>' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int TRUE_LITERAL_QUERY__CAN_BE_CACHED = ExtensiblePackage.QUERY__CAN_BE_CACHED; - - /** - * The number of structural features of the '<em>True Literal Query</em>' class. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int TRUE_LITERAL_QUERY_FEATURE_COUNT = ExtensiblePackage.QUERY_FEATURE_COUNT + 0; - - /** - * The meta object id for the '{@link org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.query.impl.FalseLiteralQueryImpl <em>False Literal Query</em>}' class. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.query.impl.FalseLiteralQueryImpl - * @see org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.query.impl.QueryPackageImpl#getFalseLiteralQuery() - * @generated - */ - int FALSE_LITERAL_QUERY = 4; - - /** - * The feature id for the '<em><b>Can Have Side Effects</b></em>' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int FALSE_LITERAL_QUERY__CAN_HAVE_SIDE_EFFECTS = ExtensiblePackage.QUERY__CAN_HAVE_SIDE_EFFECTS; - - /** - * The feature id for the '<em><b>Can Be Cached</b></em>' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int FALSE_LITERAL_QUERY__CAN_BE_CACHED = ExtensiblePackage.QUERY__CAN_BE_CACHED; - - /** - * The number of structural features of the '<em>False Literal Query</em>' class. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int FALSE_LITERAL_QUERY_FEATURE_COUNT = ExtensiblePackage.QUERY_FEATURE_COUNT + 0; - - - /** - * The meta object id for the '{@link org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.query.impl.NullLiteralQueryImpl <em>Null Literal Query</em>}' class. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.query.impl.NullLiteralQueryImpl - * @see org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.query.impl.QueryPackageImpl#getNullLiteralQuery() - * @generated - */ - int NULL_LITERAL_QUERY = 5; - - /** - * The feature id for the '<em><b>Can Have Side Effects</b></em>' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int NULL_LITERAL_QUERY__CAN_HAVE_SIDE_EFFECTS = ExtensiblePackage.QUERY__CAN_HAVE_SIDE_EFFECTS; - - /** - * The feature id for the '<em><b>Can Be Cached</b></em>' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int NULL_LITERAL_QUERY__CAN_BE_CACHED = ExtensiblePackage.QUERY__CAN_BE_CACHED; - - /** - * The number of structural features of the '<em>Null Literal Query</em>' class. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int NULL_LITERAL_QUERY_FEATURE_COUNT = ExtensiblePackage.QUERY_FEATURE_COUNT + 0; - - - /** - * The meta object id for the '{@link org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.query.impl.IntegerLiteralQueryImpl <em>Integer Literal Query</em>}' class. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.query.impl.IntegerLiteralQueryImpl - * @see org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.query.impl.QueryPackageImpl#getIntegerLiteralQuery() - * @generated - * @since 0.2 - */ - int INTEGER_LITERAL_QUERY = 6; - - /** - * The feature id for the '<em><b>Can Have Side Effects</b></em>' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - * @since 0.2 - */ - int INTEGER_LITERAL_QUERY__CAN_HAVE_SIDE_EFFECTS = ExtensiblePackage.QUERY__CAN_HAVE_SIDE_EFFECTS; - - /** - * The feature id for the '<em><b>Can Be Cached</b></em>' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - * @since 0.2 - */ - int INTEGER_LITERAL_QUERY__CAN_BE_CACHED = ExtensiblePackage.QUERY__CAN_BE_CACHED; - - /** - * The feature id for the '<em><b>Value</b></em>' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - * @since 0.2 - */ - int INTEGER_LITERAL_QUERY__VALUE = ExtensiblePackage.QUERY_FEATURE_COUNT + 0; - - /** - * The number of structural features of the '<em>Integer Literal Query</em>' class. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - * @since 0.2 - */ - int INTEGER_LITERAL_QUERY_FEATURE_COUNT = ExtensiblePackage.QUERY_FEATURE_COUNT + 1; - - /** - * The meta object id for the '{@link org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.query.impl.FloatLiteralQueryImpl <em>Float Literal Query</em>}' class. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.query.impl.FloatLiteralQueryImpl - * @see org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.query.impl.QueryPackageImpl#getFloatLiteralQuery() - * @generated - * @since 0.2 - */ - int FLOAT_LITERAL_QUERY = 7; - - /** - * The feature id for the '<em><b>Can Have Side Effects</b></em>' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - * @since 0.2 - */ - int FLOAT_LITERAL_QUERY__CAN_HAVE_SIDE_EFFECTS = ExtensiblePackage.QUERY__CAN_HAVE_SIDE_EFFECTS; - - /** - * The feature id for the '<em><b>Can Be Cached</b></em>' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - * @since 0.2 - */ - int FLOAT_LITERAL_QUERY__CAN_BE_CACHED = ExtensiblePackage.QUERY__CAN_BE_CACHED; - - /** - * The feature id for the '<em><b>Value</b></em>' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - * @since 0.2 - */ - int FLOAT_LITERAL_QUERY__VALUE = ExtensiblePackage.QUERY_FEATURE_COUNT + 0; - - /** - * The number of structural features of the '<em>Float Literal Query</em>' class. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - * @since 0.2 - */ - int FLOAT_LITERAL_QUERY_FEATURE_COUNT = ExtensiblePackage.QUERY_FEATURE_COUNT + 1; - - /** - * The meta object id for the '{@link org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.query.impl.EObjectLiteralQueryImpl <em>EObject Literal Query</em>}' class. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.query.impl.EObjectLiteralQueryImpl - * @see org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.query.impl.QueryPackageImpl#getEObjectLiteralQuery() - * @generated - * @since 0.2 - */ - int EOBJECT_LITERAL_QUERY = 8; - - /** - * The feature id for the '<em><b>Can Have Side Effects</b></em>' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - * @since 0.2 - */ - int EOBJECT_LITERAL_QUERY__CAN_HAVE_SIDE_EFFECTS = ExtensiblePackage.QUERY__CAN_HAVE_SIDE_EFFECTS; - - /** - * The feature id for the '<em><b>Can Be Cached</b></em>' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - * @since 0.2 - */ - int EOBJECT_LITERAL_QUERY__CAN_BE_CACHED = ExtensiblePackage.QUERY__CAN_BE_CACHED; - - /** - * The feature id for the '<em><b>Element</b></em>' reference. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - * @since 0.2 - */ - int EOBJECT_LITERAL_QUERY__ELEMENT = ExtensiblePackage.QUERY_FEATURE_COUNT + 0; - - /** - * The number of structural features of the '<em>EObject Literal Query</em>' class. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - * @since 0.2 - */ - int EOBJECT_LITERAL_QUERY_FEATURE_COUNT = ExtensiblePackage.QUERY_FEATURE_COUNT + 1; - - /** - * The meta object id for the '{@link org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.query.impl.OperationCallQueryImpl <em>Operation Call Query</em>}' class. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.query.impl.OperationCallQueryImpl - * @see org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.query.impl.QueryPackageImpl#getOperationCallQuery() - * @generated - * @since 0.2 - */ - int OPERATION_CALL_QUERY = 9; - - /** - * The feature id for the '<em><b>Can Have Side Effects</b></em>' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - * @since 0.2 - */ - int OPERATION_CALL_QUERY__CAN_HAVE_SIDE_EFFECTS = ExtensiblePackage.QUERY__CAN_HAVE_SIDE_EFFECTS; - - /** - * The feature id for the '<em><b>Can Be Cached</b></em>' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - * @since 0.2 - */ - int OPERATION_CALL_QUERY__CAN_BE_CACHED = ExtensiblePackage.QUERY__CAN_BE_CACHED; - - /** - * The feature id for the '<em><b>Operation</b></em>' reference. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - * @since 0.2 - */ - int OPERATION_CALL_QUERY__OPERATION = ExtensiblePackage.QUERY_FEATURE_COUNT + 0; - - /** - * The feature id for the '<em><b>Arguments</b></em>' containment reference list. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - * @since 0.2 - */ - int OPERATION_CALL_QUERY__ARGUMENTS = ExtensiblePackage.QUERY_FEATURE_COUNT + 1; - - /** - * The number of structural features of the '<em>Operation Call Query</em>' class. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - * @since 0.2 - */ - int OPERATION_CALL_QUERY_FEATURE_COUNT = ExtensiblePackage.QUERY_FEATURE_COUNT + 2; - - - /** - * Returns the meta object for class '{@link org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.query.NavigationQuery <em>Navigation Query</em>}'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the meta object for class '<em>Navigation Query</em>'. - * @see org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.query.NavigationQuery - * @generated - */ - EClass getNavigationQuery(); - - /** - * Returns the meta object for the reference list '{@link org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.query.NavigationQuery#getPath <em>Path</em>}'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the meta object for the reference list '<em>Path</em>'. - * @see org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.query.NavigationQuery#getPath() - * @see #getNavigationQuery() - * @generated - */ - EReference getNavigationQuery_Path(); - - /** - * Returns the meta object for the attribute '{@link org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.query.NavigationQuery#isFailOnError <em>Fail On Error</em>}'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the meta object for the attribute '<em>Fail On Error</em>'. - * @see org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.query.NavigationQuery#isFailOnError() - * @see #getNavigationQuery() - * @generated - */ - EAttribute getNavigationQuery_FailOnError(); - - /** - * Returns the meta object for class '{@link org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.query.IsOneOfQuery <em>Is One Of Query</em>}'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the meta object for class '<em>Is One Of Query</em>'. - * @see org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.query.IsOneOfQuery - * @generated - */ - EClass getIsOneOfQuery(); - - /** - * Returns the meta object for the reference list '{@link org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.query.IsOneOfQuery#getExpectedEObjects <em>Expected EObjects</em>}'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the meta object for the reference list '<em>Expected EObjects</em>'. - * @see org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.query.IsOneOfQuery#getExpectedEObjects() - * @see #getIsOneOfQuery() - * @generated - */ - EReference getIsOneOfQuery_ExpectedEObjects(); - - /** - * Returns the meta object for class '{@link org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.query.StringLiteralQuery <em>String Literal Query</em>}'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the meta object for class '<em>String Literal Query</em>'. - * @see org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.query.StringLiteralQuery - * @generated - */ - EClass getStringLiteralQuery(); - - /** - * Returns the meta object for the attribute '{@link org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.query.StringLiteralQuery#getValue <em>Value</em>}'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the meta object for the attribute '<em>Value</em>'. - * @see org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.query.StringLiteralQuery#getValue() - * @see #getStringLiteralQuery() - * @generated - */ - EAttribute getStringLiteralQuery_Value(); - - /** - * Returns the meta object for class '{@link org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.query.TrueLiteralQuery <em>True Literal Query</em>}'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the meta object for class '<em>True Literal Query</em>'. - * @see org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.query.TrueLiteralQuery - * @generated - */ - EClass getTrueLiteralQuery(); - - /** - * Returns the meta object for class '{@link org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.query.FalseLiteralQuery <em>False Literal Query</em>}'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the meta object for class '<em>False Literal Query</em>'. - * @see org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.query.FalseLiteralQuery - * @generated - */ - EClass getFalseLiteralQuery(); - - /** - * Returns the meta object for class '{@link org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.query.NullLiteralQuery <em>Null Literal Query</em>}'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the meta object for class '<em>Null Literal Query</em>'. - * @see org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.query.NullLiteralQuery - * @generated - */ - EClass getNullLiteralQuery(); - - /** - * Returns the meta object for class '{@link org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.query.IntegerLiteralQuery <em>Integer Literal Query</em>}'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the meta object for class '<em>Integer Literal Query</em>'. - * @see org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.query.IntegerLiteralQuery - * @generated - * @since 0.2 - */ - EClass getIntegerLiteralQuery(); - - /** - * Returns the meta object for the attribute '{@link org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.query.IntegerLiteralQuery#getValue <em>Value</em>}'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the meta object for the attribute '<em>Value</em>'. - * @see org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.query.IntegerLiteralQuery#getValue() - * @see #getIntegerLiteralQuery() - * @generated - * @since 0.2 - */ - EAttribute getIntegerLiteralQuery_Value(); - - /** - * Returns the meta object for class '{@link org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.query.FloatLiteralQuery <em>Float Literal Query</em>}'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the meta object for class '<em>Float Literal Query</em>'. - * @see org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.query.FloatLiteralQuery - * @generated - * @since 0.2 - */ - EClass getFloatLiteralQuery(); - - /** - * Returns the meta object for the attribute '{@link org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.query.FloatLiteralQuery#getValue <em>Value</em>}'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the meta object for the attribute '<em>Value</em>'. - * @see org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.query.FloatLiteralQuery#getValue() - * @see #getFloatLiteralQuery() - * @generated - * @since 0.2 - */ - EAttribute getFloatLiteralQuery_Value(); - - /** - * Returns the meta object for class '{@link org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.query.EObjectLiteralQuery <em>EObject Literal Query</em>}'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the meta object for class '<em>EObject Literal Query</em>'. - * @see org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.query.EObjectLiteralQuery - * @generated - * @since 0.2 - */ - EClass getEObjectLiteralQuery(); - - /** - * Returns the meta object for the reference '{@link org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.query.EObjectLiteralQuery#getElement <em>Element</em>}'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the meta object for the reference '<em>Element</em>'. - * @see org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.query.EObjectLiteralQuery#getElement() - * @see #getEObjectLiteralQuery() - * @generated - * @since 0.2 - */ - EReference getEObjectLiteralQuery_Element(); - - /** - * Returns the meta object for class '{@link org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.query.OperationCallQuery <em>Operation Call Query</em>}'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the meta object for class '<em>Operation Call Query</em>'. - * @see org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.query.OperationCallQuery - * @generated - * @since 0.2 - */ - EClass getOperationCallQuery(); - - /** - * Returns the meta object for the reference '{@link org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.query.OperationCallQuery#getOperation <em>Operation</em>}'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the meta object for the reference '<em>Operation</em>'. - * @see org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.query.OperationCallQuery#getOperation() - * @see #getOperationCallQuery() - * @generated - * @since 0.2 - */ - EReference getOperationCallQuery_Operation(); - - /** - * Returns the meta object for the containment reference list '{@link org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.query.OperationCallQuery#getArguments <em>Arguments</em>}'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the meta object for the containment reference list '<em>Arguments</em>'. - * @see org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.query.OperationCallQuery#getArguments() - * @see #getOperationCallQuery() - * @generated - * @since 0.2 - */ - EReference getOperationCallQuery_Arguments(); - - /** - * Returns the factory that creates the instances of the model. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the factory that creates the instances of the model. - * @generated - */ - QueryFactory getQueryFactory(); - - /** - * <!-- begin-user-doc --> - * Defines literals for the meta objects that represent - * <ul> - * <li>each class,</li> - * <li>each feature of each class,</li> - * <li>each enum,</li> - * <li>and each data type</li> - * </ul> - * <!-- end-user-doc --> - * @generated - */ - interface Literals { - /** - * The meta object literal for the '{@link org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.query.impl.NavigationQueryImpl <em>Navigation Query</em>}' class. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.query.impl.NavigationQueryImpl - * @see org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.query.impl.QueryPackageImpl#getNavigationQuery() - * @generated - */ - EClass NAVIGATION_QUERY = eINSTANCE.getNavigationQuery(); - - /** - * The meta object literal for the '<em><b>Path</b></em>' reference list feature. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - EReference NAVIGATION_QUERY__PATH = eINSTANCE.getNavigationQuery_Path(); - - /** - * The meta object literal for the '<em><b>Fail On Error</b></em>' attribute feature. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - EAttribute NAVIGATION_QUERY__FAIL_ON_ERROR = eINSTANCE.getNavigationQuery_FailOnError(); - - /** - * The meta object literal for the '{@link org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.query.impl.IsOneOfQueryImpl <em>Is One Of Query</em>}' class. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.query.impl.IsOneOfQueryImpl - * @see org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.query.impl.QueryPackageImpl#getIsOneOfQuery() - * @generated - */ - EClass IS_ONE_OF_QUERY = eINSTANCE.getIsOneOfQuery(); - - /** - * The meta object literal for the '<em><b>Expected EObjects</b></em>' reference list feature. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - EReference IS_ONE_OF_QUERY__EXPECTED_EOBJECTS = eINSTANCE.getIsOneOfQuery_ExpectedEObjects(); - - /** - * The meta object literal for the '{@link org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.query.impl.StringLiteralQueryImpl <em>String Literal Query</em>}' class. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.query.impl.StringLiteralQueryImpl - * @see org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.query.impl.QueryPackageImpl#getStringLiteralQuery() - * @generated - */ - EClass STRING_LITERAL_QUERY = eINSTANCE.getStringLiteralQuery(); - - /** - * The meta object literal for the '<em><b>Value</b></em>' attribute feature. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - EAttribute STRING_LITERAL_QUERY__VALUE = eINSTANCE.getStringLiteralQuery_Value(); - - /** - * The meta object literal for the '{@link org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.query.impl.TrueLiteralQueryImpl <em>True Literal Query</em>}' class. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.query.impl.TrueLiteralQueryImpl - * @see org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.query.impl.QueryPackageImpl#getTrueLiteralQuery() - * @generated - */ - EClass TRUE_LITERAL_QUERY = eINSTANCE.getTrueLiteralQuery(); - - /** - * The meta object literal for the '{@link org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.query.impl.FalseLiteralQueryImpl <em>False Literal Query</em>}' class. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.query.impl.FalseLiteralQueryImpl - * @see org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.query.impl.QueryPackageImpl#getFalseLiteralQuery() - * @generated - */ - EClass FALSE_LITERAL_QUERY = eINSTANCE.getFalseLiteralQuery(); - - /** - * The meta object literal for the '{@link org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.query.impl.NullLiteralQueryImpl <em>Null Literal Query</em>}' class. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.query.impl.NullLiteralQueryImpl - * @see org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.query.impl.QueryPackageImpl#getNullLiteralQuery() - * @generated - */ - EClass NULL_LITERAL_QUERY = eINSTANCE.getNullLiteralQuery(); - - /** - * The meta object literal for the '{@link org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.query.impl.IntegerLiteralQueryImpl <em>Integer Literal Query</em>}' class. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.query.impl.IntegerLiteralQueryImpl - * @see org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.query.impl.QueryPackageImpl#getIntegerLiteralQuery() - * @generated - * @since 0.2 - */ - EClass INTEGER_LITERAL_QUERY = eINSTANCE.getIntegerLiteralQuery(); - - /** - * The meta object literal for the '<em><b>Value</b></em>' attribute feature. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @since 0.2 - */ - EAttribute INTEGER_LITERAL_QUERY__VALUE = eINSTANCE.getIntegerLiteralQuery_Value(); - - /** - * The meta object literal for the '{@link org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.query.impl.FloatLiteralQueryImpl <em>Float Literal Query</em>}' class. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.query.impl.FloatLiteralQueryImpl - * @see org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.query.impl.QueryPackageImpl#getFloatLiteralQuery() - * @generated - * @since 0.2 - */ - EClass FLOAT_LITERAL_QUERY = eINSTANCE.getFloatLiteralQuery(); - - /** - * The meta object literal for the '<em><b>Value</b></em>' attribute feature. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @since 0.2 - */ - EAttribute FLOAT_LITERAL_QUERY__VALUE = eINSTANCE.getFloatLiteralQuery_Value(); - - /** - * The meta object literal for the '{@link org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.query.impl.EObjectLiteralQueryImpl <em>EObject Literal Query</em>}' class. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.query.impl.EObjectLiteralQueryImpl - * @see org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.query.impl.QueryPackageImpl#getEObjectLiteralQuery() - * @generated - * @since 0.2 - */ - EClass EOBJECT_LITERAL_QUERY = eINSTANCE.getEObjectLiteralQuery(); - - /** - * The meta object literal for the '<em><b>Element</b></em>' reference feature. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @since 0.2 - */ - EReference EOBJECT_LITERAL_QUERY__ELEMENT = eINSTANCE.getEObjectLiteralQuery_Element(); - - /** - * The meta object literal for the '{@link org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.query.impl.OperationCallQueryImpl <em>Operation Call Query</em>}' class. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.query.impl.OperationCallQueryImpl - * @see org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.query.impl.QueryPackageImpl#getOperationCallQuery() - * @generated - * @since 0.2 - */ - EClass OPERATION_CALL_QUERY = eINSTANCE.getOperationCallQuery(); - - /** - * The meta object literal for the '<em><b>Operation</b></em>' reference feature. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @since 0.2 - */ - EReference OPERATION_CALL_QUERY__OPERATION = eINSTANCE.getOperationCallQuery_Operation(); - - /** - * The meta object literal for the '<em><b>Arguments</b></em>' containment reference list feature. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @since 0.2 - */ - EReference OPERATION_CALL_QUERY__ARGUMENTS = eINSTANCE.getOperationCallQuery_Arguments(); - - } - -} //QueryPackage
diff --git a/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/emf/facet/efacet/metamodel/v0_2_0/efacet/query/StringLiteralQuery.java b/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/emf/facet/efacet/metamodel/v0_2_0/efacet/query/StringLiteralQuery.java deleted file mode 100644 index cc65f88..0000000 --- a/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/emf/facet/efacet/metamodel/v0_2_0/efacet/query/StringLiteralQuery.java +++ /dev/null
@@ -1,65 +0,0 @@ -/** - * Copyright (c) 2011 Mia-Software. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Gregoire Dupe (Mia-Software) - Design - * Nicolas Guyomar (Mia-Software) - Implementation - * Emmanuelle Rouillé (Mia-Software) - Bug 352618 - To be able to use non derived facet structural features and save them values. - * Nicolas Bros (Mia-Software) - Bug 361823 - [Restructuring] eFacet2 meta-model - * Gregoire Dupe (Mia-Software) - Bug 366055 - NavigationQuery - * Gregoire Dupe (Mia-Software) - Bug 369673 - [Facet] IsOneOfQuery - * Olivier Remaud (Soft-Maint) - Bug 369824 - Add a simple way to return string literal constants from a customization query - */ -package org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.query; - -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.extensible.Query; - -/** - * <!-- begin-user-doc --> - * A representation of the model object '<em><b>String Literal Query</b></em>'. - * <!-- end-user-doc --> - * - * <p> - * The following features are supported: - * <ul> - * <li>{@link org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.query.StringLiteralQuery#getValue <em>Value</em>}</li> - * </ul> - * </p> - * - * @see org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.query.QueryPackage#getStringLiteralQuery() - * @model - * @generated - */ -public interface StringLiteralQuery extends Query { - /** - * Returns the value of the '<em><b>Value</b></em>' attribute. - * <!-- begin-user-doc --> - * <p> - * If the meaning of the '<em>Value</em>' attribute isn't clear, - * there really should be more of a description here... - * </p> - * <!-- end-user-doc --> - * @return the value of the '<em>Value</em>' attribute. - * @see #setValue(String) - * @see org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.query.QueryPackage#getStringLiteralQuery_Value() - * @model - * @generated - */ - String getValue(); - - /** - * Sets the value of the '{@link org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.query.StringLiteralQuery#getValue <em>Value</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @param value the new value of the '<em>Value</em>' attribute. - * @see #getValue() - * @generated - */ - void setValue(String value); - -} // StringLiteralQuery
diff --git a/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/emf/facet/efacet/metamodel/v0_2_0/efacet/query/TrueLiteralQuery.java b/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/emf/facet/efacet/metamodel/v0_2_0/efacet/query/TrueLiteralQuery.java deleted file mode 100644 index d00d375..0000000 --- a/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/emf/facet/efacet/metamodel/v0_2_0/efacet/query/TrueLiteralQuery.java +++ /dev/null
@@ -1,38 +0,0 @@ -/** - * Copyright (c) 2011 Mia-Software. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Gregoire Dupe (Mia-Software) - Design - * Nicolas Guyomar (Mia-Software) - Implementation - * Emmanuelle Rouillé (Mia-Software) - Bug 352618 - To be able to use non derived facet structural features and save them values. - * Nicolas Bros (Mia-Software) - Bug 361823 - [Restructuring] eFacet2 meta-model - * Gregoire Dupe (Mia-Software) - Bug 366055 - NavigationQuery - * Gregoire Dupe (Mia-Software) - Bug 369673 - [Facet] IsOneOfQuery - * Olivier Remaud (Soft-Maint) - Bug 369824 - Add a simple way to return string literal constants from a customization query - * Gregoire Dupe (Mia-software) - Bug 369987 - [Restructuring][Table] Switch to the new customization and facet framework - */ -package org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.query; - -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.extensible.Query; - -/** - * <!-- begin-user-doc --> - * A representation of the model object '<em><b>True Literal Query</b></em>'. - * <!-- end-user-doc --> - * - * <!-- begin-model-doc --> - * This query retrun true. - * <!-- end-model-doc --> - * - * - * @see org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.query.QueryPackage#getTrueLiteralQuery() - * @model - * @generated - */ -public interface TrueLiteralQuery extends Query { -} // TrueLiteralQuery
diff --git a/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/emf/facet/efacet/metamodel/v0_2_0/efacet/query/impl/EObjectLiteralQueryImpl.java b/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/emf/facet/efacet/metamodel/v0_2_0/efacet/query/impl/EObjectLiteralQueryImpl.java deleted file mode 100644 index 2e71aa7..0000000 --- a/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/emf/facet/efacet/metamodel/v0_2_0/efacet/query/impl/EObjectLiteralQueryImpl.java +++ /dev/null
@@ -1,178 +0,0 @@ -/** - * Copyright (c) 2011-2012 Mia-Software. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Gregoire Dupe (Mia-Software) - Design - * Nicolas Guyomar (Mia-Software) - Implementation - * Emmanuelle Rouillé (Mia-Software) - Bug 352618 - To be able to use non derived facet structural features and save them values. - * Nicolas Bros (Mia-Software) - Bug 361823 - [Restructuring] eFacet2 meta-model - * Gregoire Dupe (Mia-Software) - Bug 366055 - NavigationQuery - * Gregoire Dupe (Mia-Software) - Bug 369673 - [Facet] IsOneOfQuery - * Olivier Remaud (Soft-Maint) - Bug 369824 - Add a simple way to return string literal constants from a customization query - * Gregoire Dupe (Mia-Software) - Bug 369987 - [Restructuring][Table] Switch to the new customization and facet framework - * Gregoire Dupe (Mia-software) - Bug 364325 - [Restructuring] The user must be able to navigate into a model using the Facet. - * Nicolas Bros (Mia-Software) - Bug 372626 - [Facet] Aggregates - * Nicolas Bros (Mia-Software) - Bug 376941 - [EFacet] Facet operation arguments in Facet model - * - */ -package org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.query.impl; - -import org.eclipse.emf.common.notify.Notification; - -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.InternalEObject; - -import org.eclipse.emf.ecore.impl.ENotificationImpl; - -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.extensible.impl.QueryImpl; - -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.query.EObjectLiteralQuery; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.query.QueryPackage; - -/** - * <!-- begin-user-doc --> - * An implementation of the model object '<em><b>EObject Literal Query</b></em>'. - * <!-- end-user-doc --> - * <p> - * The following features are implemented: - * <ul> - * <li>{@link org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.query.impl.EObjectLiteralQueryImpl#getElement <em>Element</em>}</li> - * </ul> - * </p> - * - * @generated - */ -public class EObjectLiteralQueryImpl extends QueryImpl implements EObjectLiteralQuery { - /** - * The cached value of the '{@link #getElement() <em>Element</em>}' reference. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #getElement() - * @generated - * @ordered - */ - protected EObject element; - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected EObjectLiteralQueryImpl() { - super(); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - protected EClass eStaticClass() { - return QueryPackage.Literals.EOBJECT_LITERAL_QUERY; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EObject getElement() { - if (element != null && element.eIsProxy()) { - InternalEObject oldElement = (InternalEObject)element; - element = eResolveProxy(oldElement); - if (element != oldElement) { - if (eNotificationRequired()) - eNotify(new ENotificationImpl(this, Notification.RESOLVE, QueryPackage.EOBJECT_LITERAL_QUERY__ELEMENT, oldElement, element)); - } - } - return element; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EObject basicGetElement() { - return element; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public void setElement(EObject newElement) { - EObject oldElement = element; - element = newElement; - if (eNotificationRequired()) - eNotify(new ENotificationImpl(this, Notification.SET, QueryPackage.EOBJECT_LITERAL_QUERY__ELEMENT, oldElement, element)); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public Object eGet(int featureID, boolean resolve, boolean coreType) { - switch (featureID) { - case QueryPackage.EOBJECT_LITERAL_QUERY__ELEMENT: - if (resolve) return getElement(); - return basicGetElement(); - } - return super.eGet(featureID, resolve, coreType); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public void eSet(int featureID, Object newValue) { - switch (featureID) { - case QueryPackage.EOBJECT_LITERAL_QUERY__ELEMENT: - setElement((EObject)newValue); - return; - } - super.eSet(featureID, newValue); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public void eUnset(int featureID) { - switch (featureID) { - case QueryPackage.EOBJECT_LITERAL_QUERY__ELEMENT: - setElement((EObject)null); - return; - } - super.eUnset(featureID); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public boolean eIsSet(int featureID) { - switch (featureID) { - case QueryPackage.EOBJECT_LITERAL_QUERY__ELEMENT: - return element != null; - } - return super.eIsSet(featureID); - } - -} //EObjectLiteralQueryImpl
diff --git a/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/emf/facet/efacet/metamodel/v0_2_0/efacet/query/impl/FalseLiteralQueryImpl.java b/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/emf/facet/efacet/metamodel/v0_2_0/efacet/query/impl/FalseLiteralQueryImpl.java deleted file mode 100644 index 211e380..0000000 --- a/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/emf/facet/efacet/metamodel/v0_2_0/efacet/query/impl/FalseLiteralQueryImpl.java +++ /dev/null
@@ -1,55 +0,0 @@ -/** - * Copyright (c) 2011 Mia-Software. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Gregoire Dupe (Mia-Software) - Design - * Nicolas Guyomar (Mia-Software) - Implementation - * Emmanuelle Rouillé (Mia-Software) - Bug 352618 - To be able to use non derived facet structural features and save them values. - * Nicolas Bros (Mia-Software) - Bug 361823 - [Restructuring] eFacet2 meta-model - * Gregoire Dupe (Mia-Software) - Bug 366055 - NavigationQuery - * Gregoire Dupe (Mia-Software) - Bug 369673 - [Facet] IsOneOfQuery - * Olivier Remaud (Soft-Maint) - Bug 369824 - Add a simple way to return string literal constants from a customization query - * Gregoire Dupe (Mia-software) - Bug 369987 - [Restructuring][Table] Switch to the new customization and facet framework - */ -package org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.query.impl; - -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.extensible.impl.QueryImpl; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.query.FalseLiteralQuery; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.query.QueryPackage; - -/** - * <!-- begin-user-doc --> - * An implementation of the model object '<em><b>False Literal Query</b></em>'. - * <!-- end-user-doc --> - * <p> - * </p> - * - * @generated - */ -public class FalseLiteralQueryImpl extends QueryImpl implements FalseLiteralQuery { - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected FalseLiteralQueryImpl() { - super(); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - protected EClass eStaticClass() { - return QueryPackage.Literals.FALSE_LITERAL_QUERY; - } - -} //FalseLiteralQueryImpl
diff --git a/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/emf/facet/efacet/metamodel/v0_2_0/efacet/query/impl/FloatLiteralQueryImpl.java b/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/emf/facet/efacet/metamodel/v0_2_0/efacet/query/impl/FloatLiteralQueryImpl.java deleted file mode 100644 index 6929c50..0000000 --- a/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/emf/facet/efacet/metamodel/v0_2_0/efacet/query/impl/FloatLiteralQueryImpl.java +++ /dev/null
@@ -1,184 +0,0 @@ -/** - * Copyright (c) 2011-2012 Mia-Software. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Gregoire Dupe (Mia-Software) - Design - * Nicolas Guyomar (Mia-Software) - Implementation - * Emmanuelle Rouillé (Mia-Software) - Bug 352618 - To be able to use non derived facet structural features and save them values. - * Nicolas Bros (Mia-Software) - Bug 361823 - [Restructuring] eFacet2 meta-model - * Gregoire Dupe (Mia-Software) - Bug 366055 - NavigationQuery - * Gregoire Dupe (Mia-Software) - Bug 369673 - [Facet] IsOneOfQuery - * Olivier Remaud (Soft-Maint) - Bug 369824 - Add a simple way to return string literal constants from a customization query - * Gregoire Dupe (Mia-Software) - Bug 369987 - [Restructuring][Table] Switch to the new customization and facet framework - * Gregoire Dupe (Mia-software) - Bug 364325 - [Restructuring] The user must be able to navigate into a model using the Facet. - * Nicolas Bros (Mia-Software) - Bug 372626 - [Facet] Aggregates - * Nicolas Bros (Mia-Software) - Bug 376941 - [EFacet] Facet operation arguments in Facet model - * - */ -package org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.query.impl; - -import org.eclipse.emf.common.notify.Notification; - -import org.eclipse.emf.ecore.EClass; - -import org.eclipse.emf.ecore.impl.ENotificationImpl; - -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.extensible.impl.QueryImpl; - -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.query.FloatLiteralQuery; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.query.QueryPackage; - -/** - * <!-- begin-user-doc --> - * An implementation of the model object '<em><b>Float Literal Query</b></em>'. - * <!-- end-user-doc --> - * <p> - * The following features are implemented: - * <ul> - * <li>{@link org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.query.impl.FloatLiteralQueryImpl#getValue <em>Value</em>}</li> - * </ul> - * </p> - * - * @generated - */ -public class FloatLiteralQueryImpl extends QueryImpl implements FloatLiteralQuery { - /** - * The default value of the '{@link #getValue() <em>Value</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #getValue() - * @generated - * @ordered - */ - protected static final float VALUE_EDEFAULT = 0.0F; - - /** - * The cached value of the '{@link #getValue() <em>Value</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #getValue() - * @generated - * @ordered - */ - protected float value = VALUE_EDEFAULT; - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected FloatLiteralQueryImpl() { - super(); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - protected EClass eStaticClass() { - return QueryPackage.Literals.FLOAT_LITERAL_QUERY; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public float getValue() { - return value; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public void setValue(float newValue) { - float oldValue = value; - value = newValue; - if (eNotificationRequired()) - eNotify(new ENotificationImpl(this, Notification.SET, QueryPackage.FLOAT_LITERAL_QUERY__VALUE, oldValue, value)); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public Object eGet(int featureID, boolean resolve, boolean coreType) { - switch (featureID) { - case QueryPackage.FLOAT_LITERAL_QUERY__VALUE: - return getValue(); - } - return super.eGet(featureID, resolve, coreType); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public void eSet(int featureID, Object newValue) { - switch (featureID) { - case QueryPackage.FLOAT_LITERAL_QUERY__VALUE: - setValue((Float)newValue); - return; - } - super.eSet(featureID, newValue); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public void eUnset(int featureID) { - switch (featureID) { - case QueryPackage.FLOAT_LITERAL_QUERY__VALUE: - setValue(VALUE_EDEFAULT); - return; - } - super.eUnset(featureID); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public boolean eIsSet(int featureID) { - switch (featureID) { - case QueryPackage.FLOAT_LITERAL_QUERY__VALUE: - return value != VALUE_EDEFAULT; - } - return super.eIsSet(featureID); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public String toString() { - if (eIsProxy()) return super.toString(); - - StringBuffer result = new StringBuffer(super.toString()); - result.append(" (value: "); //$NON-NLS-1$ - result.append(value); - result.append(')'); - return result.toString(); - } - -} //FloatLiteralQueryImpl
diff --git a/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/emf/facet/efacet/metamodel/v0_2_0/efacet/query/impl/IntegerLiteralQueryImpl.java b/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/emf/facet/efacet/metamodel/v0_2_0/efacet/query/impl/IntegerLiteralQueryImpl.java deleted file mode 100644 index 1ad0569..0000000 --- a/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/emf/facet/efacet/metamodel/v0_2_0/efacet/query/impl/IntegerLiteralQueryImpl.java +++ /dev/null
@@ -1,184 +0,0 @@ -/** - * Copyright (c) 2011-2012 Mia-Software. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Gregoire Dupe (Mia-Software) - Design - * Nicolas Guyomar (Mia-Software) - Implementation - * Emmanuelle Rouillé (Mia-Software) - Bug 352618 - To be able to use non derived facet structural features and save them values. - * Nicolas Bros (Mia-Software) - Bug 361823 - [Restructuring] eFacet2 meta-model - * Gregoire Dupe (Mia-Software) - Bug 366055 - NavigationQuery - * Gregoire Dupe (Mia-Software) - Bug 369673 - [Facet] IsOneOfQuery - * Olivier Remaud (Soft-Maint) - Bug 369824 - Add a simple way to return string literal constants from a customization query - * Gregoire Dupe (Mia-Software) - Bug 369987 - [Restructuring][Table] Switch to the new customization and facet framework - * Gregoire Dupe (Mia-software) - Bug 364325 - [Restructuring] The user must be able to navigate into a model using the Facet. - * Nicolas Bros (Mia-Software) - Bug 372626 - [Facet] Aggregates - * Nicolas Bros (Mia-Software) - Bug 376941 - [EFacet] Facet operation arguments in Facet model - * - */ -package org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.query.impl; - -import org.eclipse.emf.common.notify.Notification; - -import org.eclipse.emf.ecore.EClass; - -import org.eclipse.emf.ecore.impl.ENotificationImpl; - -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.extensible.impl.QueryImpl; - -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.query.IntegerLiteralQuery; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.query.QueryPackage; - -/** - * <!-- begin-user-doc --> - * An implementation of the model object '<em><b>Integer Literal Query</b></em>'. - * <!-- end-user-doc --> - * <p> - * The following features are implemented: - * <ul> - * <li>{@link org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.query.impl.IntegerLiteralQueryImpl#getValue <em>Value</em>}</li> - * </ul> - * </p> - * - * @generated - */ -public class IntegerLiteralQueryImpl extends QueryImpl implements IntegerLiteralQuery { - /** - * The default value of the '{@link #getValue() <em>Value</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #getValue() - * @generated - * @ordered - */ - protected static final int VALUE_EDEFAULT = 0; - - /** - * The cached value of the '{@link #getValue() <em>Value</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #getValue() - * @generated - * @ordered - */ - protected int value = VALUE_EDEFAULT; - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected IntegerLiteralQueryImpl() { - super(); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - protected EClass eStaticClass() { - return QueryPackage.Literals.INTEGER_LITERAL_QUERY; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public int getValue() { - return value; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public void setValue(int newValue) { - int oldValue = value; - value = newValue; - if (eNotificationRequired()) - eNotify(new ENotificationImpl(this, Notification.SET, QueryPackage.INTEGER_LITERAL_QUERY__VALUE, oldValue, value)); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public Object eGet(int featureID, boolean resolve, boolean coreType) { - switch (featureID) { - case QueryPackage.INTEGER_LITERAL_QUERY__VALUE: - return getValue(); - } - return super.eGet(featureID, resolve, coreType); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public void eSet(int featureID, Object newValue) { - switch (featureID) { - case QueryPackage.INTEGER_LITERAL_QUERY__VALUE: - setValue((Integer)newValue); - return; - } - super.eSet(featureID, newValue); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public void eUnset(int featureID) { - switch (featureID) { - case QueryPackage.INTEGER_LITERAL_QUERY__VALUE: - setValue(VALUE_EDEFAULT); - return; - } - super.eUnset(featureID); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public boolean eIsSet(int featureID) { - switch (featureID) { - case QueryPackage.INTEGER_LITERAL_QUERY__VALUE: - return value != VALUE_EDEFAULT; - } - return super.eIsSet(featureID); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public String toString() { - if (eIsProxy()) return super.toString(); - - StringBuffer result = new StringBuffer(super.toString()); - result.append(" (value: "); //$NON-NLS-1$ - result.append(value); - result.append(')'); - return result.toString(); - } - -} //IntegerLiteralQueryImpl
diff --git a/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/emf/facet/efacet/metamodel/v0_2_0/efacet/query/impl/IsOneOfQueryImpl.java b/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/emf/facet/efacet/metamodel/v0_2_0/efacet/query/impl/IsOneOfQueryImpl.java deleted file mode 100644 index 16eebd5..0000000 --- a/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/emf/facet/efacet/metamodel/v0_2_0/efacet/query/impl/IsOneOfQueryImpl.java +++ /dev/null
@@ -1,144 +0,0 @@ -/** - * Copyright (c) 2012 Mia-Software. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Gregoire Dupe (Mia-Software) - Design - * Nicolas Guyomar (Mia-Software) - Implementation - * Emmanuelle Rouillé (Mia-Software) - Bug 352618 - To be able to use non derived facet structural features and save them values. - * Nicolas Bros (Mia-Software) - Bug 361823 - [Restructuring] eFacet2 meta-model - * Gregoire Dupe (Mia-Software) - Bug 366055 - NavigationQuery - * Gregoire Dupe (Mia-Software) - Bug 369673 - [Facet] IsOneOfQuery - */ -package org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.query.impl; - -import java.util.Collection; - -import org.eclipse.emf.common.util.EList; -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.util.EObjectResolvingEList; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.extensible.impl.QueryImpl; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.query.IsOneOfQuery; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.query.QueryPackage; - -/** - * <!-- begin-user-doc --> - * An implementation of the model object '<em><b>Is One Of Query</b></em>'. - * <!-- end-user-doc --> - * <p> - * The following features are implemented: - * <ul> - * <li>{@link org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.query.impl.IsOneOfQueryImpl#getExpectedEObjects <em>Expected EObjects</em>}</li> - * </ul> - * </p> - * - * @generated - */ -public class IsOneOfQueryImpl extends QueryImpl implements IsOneOfQuery { - /** - * The cached value of the '{@link #getExpectedEObjects() <em>Expected EObjects</em>}' reference list. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #getExpectedEObjects() - * @generated - * @ordered - */ - protected EList<EObject> expectedEObjects; - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected IsOneOfQueryImpl() { - super(); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - protected EClass eStaticClass() { - return QueryPackage.Literals.IS_ONE_OF_QUERY; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EList<EObject> getExpectedEObjects() { - if (expectedEObjects == null) { - expectedEObjects = new EObjectResolvingEList<EObject>(EObject.class, this, QueryPackage.IS_ONE_OF_QUERY__EXPECTED_EOBJECTS); - } - return expectedEObjects; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public Object eGet(int featureID, boolean resolve, boolean coreType) { - switch (featureID) { - case QueryPackage.IS_ONE_OF_QUERY__EXPECTED_EOBJECTS: - return getExpectedEObjects(); - } - return super.eGet(featureID, resolve, coreType); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @SuppressWarnings("unchecked") - @Override - public void eSet(int featureID, Object newValue) { - switch (featureID) { - case QueryPackage.IS_ONE_OF_QUERY__EXPECTED_EOBJECTS: - getExpectedEObjects().clear(); - getExpectedEObjects().addAll((Collection<? extends EObject>)newValue); - return; - } - super.eSet(featureID, newValue); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public void eUnset(int featureID) { - switch (featureID) { - case QueryPackage.IS_ONE_OF_QUERY__EXPECTED_EOBJECTS: - getExpectedEObjects().clear(); - return; - } - super.eUnset(featureID); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public boolean eIsSet(int featureID) { - switch (featureID) { - case QueryPackage.IS_ONE_OF_QUERY__EXPECTED_EOBJECTS: - return expectedEObjects != null && !expectedEObjects.isEmpty(); - } - return super.eIsSet(featureID); - } - -} //IsOneOfQueryImpl
diff --git a/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/emf/facet/efacet/metamodel/v0_2_0/efacet/query/impl/NavigationQueryImpl.java b/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/emf/facet/efacet/metamodel/v0_2_0/efacet/query/impl/NavigationQueryImpl.java deleted file mode 100644 index f411e0b..0000000 --- a/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/emf/facet/efacet/metamodel/v0_2_0/efacet/query/impl/NavigationQueryImpl.java +++ /dev/null
@@ -1,212 +0,0 @@ -/** - * Copyright (c) 2011 Mia-Software. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Gregoire Dupe (Mia-Software) - Design - * Nicolas Guyomar (Mia-Software) - Implementation - * Emmanuelle Rouillé (Mia-Software) - Bug 352618 - To be able to use non derived facet structural features and save them values. - * Nicolas Bros (Mia-Software) - Bug 361823 - [Restructuring] eFacet2 meta-model - * Gregoire Dupe (Mia-Software) - Bug 366055 - NavigationQuery - */ -package org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.query.impl; - -import java.util.Collection; - -import org.eclipse.emf.common.notify.Notification; -import org.eclipse.emf.common.util.EList; -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.ecore.ETypedElement; -import org.eclipse.emf.ecore.impl.ENotificationImpl; -import org.eclipse.emf.ecore.util.EObjectResolvingEList; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.extensible.impl.QueryImpl; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.query.NavigationQuery; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.query.QueryPackage; - -/** - * <!-- begin-user-doc --> - * An implementation of the model object '<em><b>Navigation Query</b></em>'. - * <!-- end-user-doc --> - * <p> - * The following features are implemented: - * <ul> - * <li>{@link org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.query.impl.NavigationQueryImpl#getPath <em>Path</em>}</li> - * <li>{@link org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.query.impl.NavigationQueryImpl#isFailOnError <em>Fail On Error</em>}</li> - * </ul> - * </p> - * - * @generated - */ -public class NavigationQueryImpl extends QueryImpl implements NavigationQuery { - /** - * The cached value of the '{@link #getPath() <em>Path</em>}' reference list. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #getPath() - * @generated - * @ordered - */ - protected EList<ETypedElement> path; - - /** - * The default value of the '{@link #isFailOnError() <em>Fail On Error</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #isFailOnError() - * @generated - * @ordered - */ - protected static final boolean FAIL_ON_ERROR_EDEFAULT = true; - /** - * The cached value of the '{@link #isFailOnError() <em>Fail On Error</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #isFailOnError() - * @generated - * @ordered - */ - protected boolean failOnError = FAIL_ON_ERROR_EDEFAULT; - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected NavigationQueryImpl() { - super(); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - protected EClass eStaticClass() { - return QueryPackage.Literals.NAVIGATION_QUERY; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EList<ETypedElement> getPath() { - if (path == null) { - path = new EObjectResolvingEList<ETypedElement>(ETypedElement.class, this, QueryPackage.NAVIGATION_QUERY__PATH); - } - return path; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public boolean isFailOnError() { - return failOnError; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public void setFailOnError(boolean newFailOnError) { - boolean oldFailOnError = failOnError; - failOnError = newFailOnError; - if (eNotificationRequired()) - eNotify(new ENotificationImpl(this, Notification.SET, QueryPackage.NAVIGATION_QUERY__FAIL_ON_ERROR, oldFailOnError, failOnError)); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public Object eGet(int featureID, boolean resolve, boolean coreType) { - switch (featureID) { - case QueryPackage.NAVIGATION_QUERY__PATH: - return getPath(); - case QueryPackage.NAVIGATION_QUERY__FAIL_ON_ERROR: - return isFailOnError(); - } - return super.eGet(featureID, resolve, coreType); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @SuppressWarnings("unchecked") - @Override - public void eSet(int featureID, Object newValue) { - switch (featureID) { - case QueryPackage.NAVIGATION_QUERY__PATH: - getPath().clear(); - getPath().addAll((Collection<? extends ETypedElement>)newValue); - return; - case QueryPackage.NAVIGATION_QUERY__FAIL_ON_ERROR: - setFailOnError((Boolean)newValue); - return; - } - super.eSet(featureID, newValue); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public void eUnset(int featureID) { - switch (featureID) { - case QueryPackage.NAVIGATION_QUERY__PATH: - getPath().clear(); - return; - case QueryPackage.NAVIGATION_QUERY__FAIL_ON_ERROR: - setFailOnError(FAIL_ON_ERROR_EDEFAULT); - return; - } - super.eUnset(featureID); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public boolean eIsSet(int featureID) { - switch (featureID) { - case QueryPackage.NAVIGATION_QUERY__PATH: - return path != null && !path.isEmpty(); - case QueryPackage.NAVIGATION_QUERY__FAIL_ON_ERROR: - return failOnError != FAIL_ON_ERROR_EDEFAULT; - } - return super.eIsSet(featureID); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public String toString() { - if (eIsProxy()) return super.toString(); - - StringBuffer result = new StringBuffer(super.toString()); - result.append(" (failOnError: "); //$NON-NLS-1$ - result.append(failOnError); - result.append(')'); - return result.toString(); - } - -} //NavigationQueryImpl
diff --git a/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/emf/facet/efacet/metamodel/v0_2_0/efacet/query/impl/NullLiteralQueryImpl.java b/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/emf/facet/efacet/metamodel/v0_2_0/efacet/query/impl/NullLiteralQueryImpl.java deleted file mode 100644 index ab2c893..0000000 --- a/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/emf/facet/efacet/metamodel/v0_2_0/efacet/query/impl/NullLiteralQueryImpl.java +++ /dev/null
@@ -1,55 +0,0 @@ -/** - * Copyright (c) 2011 Mia-Software. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Gregoire Dupe (Mia-Software) - Design - * Nicolas Guyomar (Mia-Software) - Implementation - * Emmanuelle Rouillé (Mia-Software) - Bug 352618 - To be able to use non derived facet structural features and save them values. - * Nicolas Bros (Mia-Software) - Bug 361823 - [Restructuring] eFacet2 meta-model - * Gregoire Dupe (Mia-Software) - Bug 366055 - NavigationQuery - * Gregoire Dupe (Mia-Software) - Bug 369673 - [Facet] IsOneOfQuery - * Olivier Remaud (Soft-Maint) - Bug 369824 - Add a simple way to return string literal constants from a customization query - * Gregoire Dupe (Mia-software) - Bug 369987 - [Restructuring][Table] Switch to the new customization and facet framework - */ -package org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.query.impl; - -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.extensible.impl.QueryImpl; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.query.NullLiteralQuery; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.query.QueryPackage; - -/** - * <!-- begin-user-doc --> - * An implementation of the model object '<em><b>Null Literal Query</b></em>'. - * <!-- end-user-doc --> - * <p> - * </p> - * - * @generated - */ -public class NullLiteralQueryImpl extends QueryImpl implements NullLiteralQuery { - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected NullLiteralQueryImpl() { - super(); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - protected EClass eStaticClass() { - return QueryPackage.Literals.NULL_LITERAL_QUERY; - } - -} //NullLiteralQueryImpl
diff --git a/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/emf/facet/efacet/metamodel/v0_2_0/efacet/query/impl/OperationCallQueryImpl.java b/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/emf/facet/efacet/metamodel/v0_2_0/efacet/query/impl/OperationCallQueryImpl.java deleted file mode 100644 index 0493f7a..0000000 --- a/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/emf/facet/efacet/metamodel/v0_2_0/efacet/query/impl/OperationCallQueryImpl.java +++ /dev/null
@@ -1,239 +0,0 @@ -/** - * Copyright (c) 2011-2012 Mia-Software. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Gregoire Dupe (Mia-Software) - Design - * Nicolas Guyomar (Mia-Software) - Implementation - * Emmanuelle Rouillé (Mia-Software) - Bug 352618 - To be able to use non derived facet structural features and save them values. - * Nicolas Bros (Mia-Software) - Bug 361823 - [Restructuring] eFacet2 meta-model - * Gregoire Dupe (Mia-Software) - Bug 366055 - NavigationQuery - * Gregoire Dupe (Mia-Software) - Bug 369673 - [Facet] IsOneOfQuery - * Olivier Remaud (Soft-Maint) - Bug 369824 - Add a simple way to return string literal constants from a customization query - * Gregoire Dupe (Mia-Software) - Bug 369987 - [Restructuring][Table] Switch to the new customization and facet framework - * Gregoire Dupe (Mia-software) - Bug 364325 - [Restructuring] The user must be able to navigate into a model using the Facet. - * Nicolas Bros (Mia-Software) - Bug 372626 - [Facet] Aggregates - * Nicolas Bros (Mia-Software) - Bug 376941 - [EFacet] Facet operation arguments in Facet model - * - */ -package org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.query.impl; - -import java.util.Collection; - -import org.eclipse.emf.common.notify.Notification; -import org.eclipse.emf.common.notify.NotificationChain; - -import org.eclipse.emf.common.util.EList; - -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.ecore.EOperation; -import org.eclipse.emf.ecore.ETypedElement; -import org.eclipse.emf.ecore.InternalEObject; - -import org.eclipse.emf.ecore.impl.ENotificationImpl; - -import org.eclipse.emf.ecore.util.EObjectResolvingEList; -import org.eclipse.emf.ecore.util.EObjectContainmentEList; -import org.eclipse.emf.ecore.util.InternalEList; - -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.extensible.Query; - -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.extensible.impl.QueryImpl; - -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.query.OperationCallQuery; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.query.QueryPackage; - -/** - * <!-- begin-user-doc --> - * An implementation of the model object '<em><b>Operation Call Query</b></em>'. - * <!-- end-user-doc --> - * <p> - * The following features are implemented: - * <ul> - * <li>{@link org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.query.impl.OperationCallQueryImpl#getOperation <em>Operation</em>}</li> - * <li>{@link org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.query.impl.OperationCallQueryImpl#getArguments <em>Arguments</em>}</li> - * </ul> - * </p> - * - * @generated - */ -public class OperationCallQueryImpl extends QueryImpl implements OperationCallQuery { - /** - * The cached value of the '{@link #getOperation() <em>Operation</em>}' reference. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #getOperation() - * @generated - * @ordered - */ - protected EOperation operation; - - /** - * The cached value of the '{@link #getArguments() <em>Arguments</em>}' containment reference list. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #getArguments() - * @generated - * @ordered - */ - protected EList<Query> arguments; - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected OperationCallQueryImpl() { - super(); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - protected EClass eStaticClass() { - return QueryPackage.Literals.OPERATION_CALL_QUERY; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EOperation getOperation() { - if (operation != null && operation.eIsProxy()) { - InternalEObject oldOperation = (InternalEObject)operation; - operation = (EOperation)eResolveProxy(oldOperation); - if (operation != oldOperation) { - if (eNotificationRequired()) - eNotify(new ENotificationImpl(this, Notification.RESOLVE, QueryPackage.OPERATION_CALL_QUERY__OPERATION, oldOperation, operation)); - } - } - return operation; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EOperation basicGetOperation() { - return operation; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public void setOperation(EOperation newOperation) { - EOperation oldOperation = operation; - operation = newOperation; - if (eNotificationRequired()) - eNotify(new ENotificationImpl(this, Notification.SET, QueryPackage.OPERATION_CALL_QUERY__OPERATION, oldOperation, operation)); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EList<Query> getArguments() { - if (arguments == null) { - arguments = new EObjectContainmentEList<Query>(Query.class, this, QueryPackage.OPERATION_CALL_QUERY__ARGUMENTS); - } - return arguments; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { - switch (featureID) { - case QueryPackage.OPERATION_CALL_QUERY__ARGUMENTS: - return ((InternalEList<?>)getArguments()).basicRemove(otherEnd, msgs); - } - return super.eInverseRemove(otherEnd, featureID, msgs); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public Object eGet(int featureID, boolean resolve, boolean coreType) { - switch (featureID) { - case QueryPackage.OPERATION_CALL_QUERY__OPERATION: - if (resolve) return getOperation(); - return basicGetOperation(); - case QueryPackage.OPERATION_CALL_QUERY__ARGUMENTS: - return getArguments(); - } - return super.eGet(featureID, resolve, coreType); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @SuppressWarnings("unchecked") - @Override - public void eSet(int featureID, Object newValue) { - switch (featureID) { - case QueryPackage.OPERATION_CALL_QUERY__OPERATION: - setOperation((EOperation)newValue); - return; - case QueryPackage.OPERATION_CALL_QUERY__ARGUMENTS: - getArguments().clear(); - getArguments().addAll((Collection<? extends Query>)newValue); - return; - } - super.eSet(featureID, newValue); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public void eUnset(int featureID) { - switch (featureID) { - case QueryPackage.OPERATION_CALL_QUERY__OPERATION: - setOperation((EOperation)null); - return; - case QueryPackage.OPERATION_CALL_QUERY__ARGUMENTS: - getArguments().clear(); - return; - } - super.eUnset(featureID); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public boolean eIsSet(int featureID) { - switch (featureID) { - case QueryPackage.OPERATION_CALL_QUERY__OPERATION: - return operation != null; - case QueryPackage.OPERATION_CALL_QUERY__ARGUMENTS: - return arguments != null && !arguments.isEmpty(); - } - return super.eIsSet(featureID); - } - -} //OperationCallQueryImpl
diff --git a/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/emf/facet/efacet/metamodel/v0_2_0/efacet/query/impl/QueryFactoryImpl.java b/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/emf/facet/efacet/metamodel/v0_2_0/efacet/query/impl/QueryFactoryImpl.java deleted file mode 100644 index d617ec8..0000000 --- a/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/emf/facet/efacet/metamodel/v0_2_0/efacet/query/impl/QueryFactoryImpl.java +++ /dev/null
@@ -1,220 +0,0 @@ -/** - * Copyright (c) 2011, 2015 Mia-Software, and Soft-Maint. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Gregoire Dupe (Mia-Software) - Design - * Nicolas Guyomar (Mia-Software) - Implementation - * Emmanuelle Rouillé (Mia-Software) - Bug 352618 - To be able to use non derived facet structural features and save them values. - * Nicolas Bros (Mia-Software) - Bug 361823 - [Restructuring] eFacet2 meta-model - * Gregoire Dupe (Mia-Software) - Bug 366055 - NavigationQuery - * Gregoire Dupe (Mia-Software) - Bug 369673 - [Facet] IsOneOfQuery - * Olivier Remaud (Soft-Maint) - Bug 369824 - Add a simple way to return string literal constants from a customization query - * Gregoire Dupe (Mia-Software) - Bug 369987 - [Restructuring][Table] Switch to the new customization and facet framework - * Gregoire Dupe (Mia-software) - Bug 364325 - [Restructuring] The user must be able to navigate into a model using the Facet. - * Nicolas Bros (Mia-Software) - Bug 372626 - [Facet] Aggregates - * Nicolas Bros (Mia-Software) - Bug 376941 - [EFacet] Facet operation arguments in Facet model - * Gregoire Dupe (Mia-Software) - Bug 376576 - [EFacet] Change the multiplicity of Facet::extendedFacet - * Jonathan Pepin (Soft-Maint) - Bug 463898 - Create FacetReference not derived, without query and with opposite mechanism - */ -package org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.query.impl; - -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.EPackage; -import org.eclipse.emf.ecore.impl.EFactoryImpl; -import org.eclipse.emf.ecore.plugin.EcorePlugin; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.query.*; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.query.FalseLiteralQuery; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.query.IsOneOfQuery; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.query.NavigationQuery; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.query.NullLiteralQuery; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.query.QueryFactory; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.query.QueryPackage; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.query.StringLiteralQuery; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.query.TrueLiteralQuery; - -/** - * <!-- begin-user-doc --> - * An implementation of the model <b>Factory</b>. - * <!-- end-user-doc --> - * @generated - */ -public class QueryFactoryImpl extends EFactoryImpl implements QueryFactory { - /** - * Creates the default factory implementation. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public static QueryFactory init() { - try { - QueryFactory theQueryFactory = (QueryFactory)EPackage.Registry.INSTANCE.getEFactory(QueryPackage.eNS_URI); - if (theQueryFactory != null) { - return theQueryFactory; - } - } - catch (Exception exception) { - EcorePlugin.INSTANCE.log(exception); - } - return new QueryFactoryImpl(); - } - - /** - * Creates an instance of the factory. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public QueryFactoryImpl() { - super(); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public EObject create(EClass eClass) { - switch (eClass.getClassifierID()) { - case QueryPackage.NAVIGATION_QUERY: return createNavigationQuery(); - case QueryPackage.IS_ONE_OF_QUERY: return createIsOneOfQuery(); - case QueryPackage.STRING_LITERAL_QUERY: return createStringLiteralQuery(); - case QueryPackage.TRUE_LITERAL_QUERY: return createTrueLiteralQuery(); - case QueryPackage.FALSE_LITERAL_QUERY: return createFalseLiteralQuery(); - case QueryPackage.NULL_LITERAL_QUERY: return createNullLiteralQuery(); - case QueryPackage.INTEGER_LITERAL_QUERY: return createIntegerLiteralQuery(); - case QueryPackage.FLOAT_LITERAL_QUERY: return createFloatLiteralQuery(); - case QueryPackage.EOBJECT_LITERAL_QUERY: return createEObjectLiteralQuery(); - case QueryPackage.OPERATION_CALL_QUERY: return createOperationCallQuery(); - default: - throw new IllegalArgumentException("The class '" + eClass.getName() + "' is not a valid classifier"); //$NON-NLS-1$ //$NON-NLS-2$ - } - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public NavigationQuery createNavigationQuery() { - NavigationQueryImpl navigationQuery = new NavigationQueryImpl(); - return navigationQuery; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public IsOneOfQuery createIsOneOfQuery() { - IsOneOfQueryImpl isOneOfQuery = new IsOneOfQueryImpl(); - return isOneOfQuery; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public StringLiteralQuery createStringLiteralQuery() { - StringLiteralQueryImpl stringLiteralQuery = new StringLiteralQueryImpl(); - return stringLiteralQuery; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public TrueLiteralQuery createTrueLiteralQuery() { - TrueLiteralQueryImpl trueLiteralQuery = new TrueLiteralQueryImpl(); - return trueLiteralQuery; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public FalseLiteralQuery createFalseLiteralQuery() { - FalseLiteralQueryImpl falseLiteralQuery = new FalseLiteralQueryImpl(); - return falseLiteralQuery; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public NullLiteralQuery createNullLiteralQuery() { - NullLiteralQueryImpl nullLiteralQuery = new NullLiteralQueryImpl(); - return nullLiteralQuery; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public IntegerLiteralQuery createIntegerLiteralQuery() { - IntegerLiteralQueryImpl integerLiteralQuery = new IntegerLiteralQueryImpl(); - return integerLiteralQuery; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public FloatLiteralQuery createFloatLiteralQuery() { - FloatLiteralQueryImpl floatLiteralQuery = new FloatLiteralQueryImpl(); - return floatLiteralQuery; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EObjectLiteralQuery createEObjectLiteralQuery() { - EObjectLiteralQueryImpl eObjectLiteralQuery = new EObjectLiteralQueryImpl(); - return eObjectLiteralQuery; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public OperationCallQuery createOperationCallQuery() { - OperationCallQueryImpl operationCallQuery = new OperationCallQueryImpl(); - return operationCallQuery; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public QueryPackage getQueryPackage() { - return (QueryPackage)getEPackage(); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @deprecated - * @generated - */ - @Deprecated - public static QueryPackage getPackage() { - return QueryPackage.eINSTANCE; - } - -} //QueryFactoryImpl
diff --git a/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/emf/facet/efacet/metamodel/v0_2_0/efacet/query/impl/QueryPackageImpl.java b/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/emf/facet/efacet/metamodel/v0_2_0/efacet/query/impl/QueryPackageImpl.java deleted file mode 100644 index 28cda61..0000000 --- a/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/emf/facet/efacet/metamodel/v0_2_0/efacet/query/impl/QueryPackageImpl.java +++ /dev/null
@@ -1,504 +0,0 @@ -/** - * Copyright (c) 2011, 2012 Mia-Software. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Gregoire Dupe (Mia-Software) - Design - * Nicolas Guyomar (Mia-Software) - Implementation - * Emmanuelle Rouillé (Mia-Software) - Bug 352618 - To be able to use non derived facet structural features and save them values. - * Nicolas Bros (Mia-Software) - Bug 361823 - [Restructuring] eFacet2 meta-model - * Gregoire Dupe (Mia-Software) - Bug 366055 - NavigationQuery - * Gregoire Dupe (Mia-Software) - Bug 369987 - [Restructuring][Table] Switch to the new customization and facet framework - * Gregoire Dupe (Mia-Software) - Bug 364325 - [Restructuring] The user must be able to navigate into a model using the Facet. - */ -package org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.query.impl; - -import org.eclipse.emf.ecore.EAttribute; -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.ecore.EPackage; -import org.eclipse.emf.ecore.EReference; -import org.eclipse.emf.ecore.EcorePackage; -import org.eclipse.emf.ecore.impl.EPackageImpl; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.EFacetPackage; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.extensible.ExtensiblePackage; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.extensible.impl.ExtensiblePackageImpl; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.impl.EFacetPackageImpl; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.query.EObjectLiteralQuery; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.query.FalseLiteralQuery; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.query.FloatLiteralQuery; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.query.IntegerLiteralQuery; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.query.IsOneOfQuery; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.query.NavigationQuery; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.query.NullLiteralQuery; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.query.OperationCallQuery; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.query.QueryFactory; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.query.QueryPackage; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.query.StringLiteralQuery; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.query.TrueLiteralQuery; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.runtime.RuntimePackage; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.runtime.impl.RuntimePackageImpl; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.serialization.SerializationPackage; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.serialization.impl.SerializationPackageImpl; - -/** - * <!-- begin-user-doc --> - * An implementation of the model <b>Package</b>. - * <!-- end-user-doc --> - * @generated - */ -public class QueryPackageImpl extends EPackageImpl implements QueryPackage { - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - private EClass navigationQueryEClass = null; - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - private EClass isOneOfQueryEClass = null; - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - private EClass stringLiteralQueryEClass = null; - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - private EClass trueLiteralQueryEClass = null; - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - private EClass falseLiteralQueryEClass = null; - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - private EClass nullLiteralQueryEClass = null; - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - private EClass integerLiteralQueryEClass = null; - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - private EClass floatLiteralQueryEClass = null; - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - private EClass eObjectLiteralQueryEClass = null; - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - private EClass operationCallQueryEClass = null; - - /** - * Creates an instance of the model <b>Package</b>, registered with - * {@link org.eclipse.emf.ecore.EPackage.Registry EPackage.Registry} by the package - * package URI value. - * <p>Note: the correct way to create the package is via the static - * factory method {@link #init init()}, which also performs - * initialization of the package, or returns the registered package, - * if one already exists. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see org.eclipse.emf.ecore.EPackage.Registry - * @see org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.query.QueryPackage#eNS_URI - * @see #init() - * @generated - */ - private QueryPackageImpl() { - super(eNS_URI, QueryFactory.eINSTANCE); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - private static boolean isInited = false; - - /** - * Creates, registers, and initializes the <b>Package</b> for this model, and for any others upon which it depends. - * - * <p>This method is used to initialize {@link QueryPackage#eINSTANCE} when that field is accessed. - * Clients should not invoke it directly. Instead, they should simply access that field to obtain the package. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #eNS_URI - * @see #createPackageContents() - * @see #initializePackageContents() - * @generated - */ - public static QueryPackage init() { - if (isInited) return (QueryPackage)EPackage.Registry.INSTANCE.getEPackage(QueryPackage.eNS_URI); - - // Obtain or create and register package - QueryPackageImpl theQueryPackage = (QueryPackageImpl)(EPackage.Registry.INSTANCE.get(eNS_URI) instanceof QueryPackageImpl ? EPackage.Registry.INSTANCE.get(eNS_URI) : new QueryPackageImpl()); - - isInited = true; - - // Initialize simple dependencies - EcorePackage.eINSTANCE.eClass(); - - // Obtain or create and register interdependencies - EFacetPackageImpl theEFacetPackage = (EFacetPackageImpl)(EPackage.Registry.INSTANCE.getEPackage(EFacetPackage.eNS_URI) instanceof EFacetPackageImpl ? EPackage.Registry.INSTANCE.getEPackage(EFacetPackage.eNS_URI) : EFacetPackage.eINSTANCE); - SerializationPackageImpl theSerializationPackage = (SerializationPackageImpl)(EPackage.Registry.INSTANCE.getEPackage(SerializationPackage.eNS_URI) instanceof SerializationPackageImpl ? EPackage.Registry.INSTANCE.getEPackage(SerializationPackage.eNS_URI) : SerializationPackage.eINSTANCE); - ExtensiblePackageImpl theExtensiblePackage = (ExtensiblePackageImpl)(EPackage.Registry.INSTANCE.getEPackage(ExtensiblePackage.eNS_URI) instanceof ExtensiblePackageImpl ? EPackage.Registry.INSTANCE.getEPackage(ExtensiblePackage.eNS_URI) : ExtensiblePackage.eINSTANCE); - RuntimePackageImpl theRuntimePackage = (RuntimePackageImpl)(EPackage.Registry.INSTANCE.getEPackage(RuntimePackage.eNS_URI) instanceof RuntimePackageImpl ? EPackage.Registry.INSTANCE.getEPackage(RuntimePackage.eNS_URI) : RuntimePackage.eINSTANCE); - - // Create package meta-data objects - theQueryPackage.createPackageContents(); - theEFacetPackage.createPackageContents(); - theSerializationPackage.createPackageContents(); - theExtensiblePackage.createPackageContents(); - theRuntimePackage.createPackageContents(); - - // Initialize created meta-data - theQueryPackage.initializePackageContents(); - theEFacetPackage.initializePackageContents(); - theSerializationPackage.initializePackageContents(); - theExtensiblePackage.initializePackageContents(); - theRuntimePackage.initializePackageContents(); - - // Mark meta-data to indicate it can't be changed - theQueryPackage.freeze(); - - - // Update the registry and return the package - EPackage.Registry.INSTANCE.put(QueryPackage.eNS_URI, theQueryPackage); - return theQueryPackage; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EClass getNavigationQuery() { - return navigationQueryEClass; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EReference getNavigationQuery_Path() { - return (EReference)navigationQueryEClass.getEStructuralFeatures().get(0); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EAttribute getNavigationQuery_FailOnError() { - return (EAttribute)navigationQueryEClass.getEStructuralFeatures().get(1); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EClass getIsOneOfQuery() { - return isOneOfQueryEClass; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EReference getIsOneOfQuery_ExpectedEObjects() { - return (EReference)isOneOfQueryEClass.getEStructuralFeatures().get(0); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EClass getStringLiteralQuery() { - return stringLiteralQueryEClass; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EAttribute getStringLiteralQuery_Value() { - return (EAttribute)stringLiteralQueryEClass.getEStructuralFeatures().get(0); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EClass getTrueLiteralQuery() { - return trueLiteralQueryEClass; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EClass getFalseLiteralQuery() { - return falseLiteralQueryEClass; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EClass getNullLiteralQuery() { - return nullLiteralQueryEClass; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EClass getIntegerLiteralQuery() { - return integerLiteralQueryEClass; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EAttribute getIntegerLiteralQuery_Value() { - return (EAttribute)integerLiteralQueryEClass.getEStructuralFeatures().get(0); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EClass getFloatLiteralQuery() { - return floatLiteralQueryEClass; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EAttribute getFloatLiteralQuery_Value() { - return (EAttribute)floatLiteralQueryEClass.getEStructuralFeatures().get(0); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EClass getEObjectLiteralQuery() { - return eObjectLiteralQueryEClass; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EReference getEObjectLiteralQuery_Element() { - return (EReference)eObjectLiteralQueryEClass.getEStructuralFeatures().get(0); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EClass getOperationCallQuery() { - return operationCallQueryEClass; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EReference getOperationCallQuery_Operation() { - return (EReference)operationCallQueryEClass.getEStructuralFeatures().get(0); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EReference getOperationCallQuery_Arguments() { - return (EReference)operationCallQueryEClass.getEStructuralFeatures().get(1); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public QueryFactory getQueryFactory() { - return (QueryFactory)getEFactoryInstance(); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - private boolean isCreated = false; - - /** - * Creates the meta-model objects for the package. This method is - * guarded to have no affect on any invocation but its first. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public void createPackageContents() { - if (isCreated) return; - isCreated = true; - - // Create classes and their features - navigationQueryEClass = createEClass(NAVIGATION_QUERY); - createEReference(navigationQueryEClass, NAVIGATION_QUERY__PATH); - createEAttribute(navigationQueryEClass, NAVIGATION_QUERY__FAIL_ON_ERROR); - - isOneOfQueryEClass = createEClass(IS_ONE_OF_QUERY); - createEReference(isOneOfQueryEClass, IS_ONE_OF_QUERY__EXPECTED_EOBJECTS); - - stringLiteralQueryEClass = createEClass(STRING_LITERAL_QUERY); - createEAttribute(stringLiteralQueryEClass, STRING_LITERAL_QUERY__VALUE); - - trueLiteralQueryEClass = createEClass(TRUE_LITERAL_QUERY); - - falseLiteralQueryEClass = createEClass(FALSE_LITERAL_QUERY); - - nullLiteralQueryEClass = createEClass(NULL_LITERAL_QUERY); - - integerLiteralQueryEClass = createEClass(INTEGER_LITERAL_QUERY); - createEAttribute(integerLiteralQueryEClass, INTEGER_LITERAL_QUERY__VALUE); - - floatLiteralQueryEClass = createEClass(FLOAT_LITERAL_QUERY); - createEAttribute(floatLiteralQueryEClass, FLOAT_LITERAL_QUERY__VALUE); - - eObjectLiteralQueryEClass = createEClass(EOBJECT_LITERAL_QUERY); - createEReference(eObjectLiteralQueryEClass, EOBJECT_LITERAL_QUERY__ELEMENT); - - operationCallQueryEClass = createEClass(OPERATION_CALL_QUERY); - createEReference(operationCallQueryEClass, OPERATION_CALL_QUERY__OPERATION); - createEReference(operationCallQueryEClass, OPERATION_CALL_QUERY__ARGUMENTS); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - private boolean isInitialized = false; - - /** - * Complete the initialization of the package and its meta-model. This - * method is guarded to have no affect on any invocation but its first. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public void initializePackageContents() { - if (isInitialized) return; - isInitialized = true; - - // Initialize package - setName(eNAME); - setNsPrefix(eNS_PREFIX); - setNsURI(eNS_URI); - - // Obtain other dependent packages - ExtensiblePackage theExtensiblePackage = (ExtensiblePackage)EPackage.Registry.INSTANCE.getEPackage(ExtensiblePackage.eNS_URI); - - // Create type parameters - - // Set bounds for type parameters - - // Add supertypes to classes - navigationQueryEClass.getESuperTypes().add(theExtensiblePackage.getQuery()); - isOneOfQueryEClass.getESuperTypes().add(theExtensiblePackage.getQuery()); - stringLiteralQueryEClass.getESuperTypes().add(theExtensiblePackage.getQuery()); - trueLiteralQueryEClass.getESuperTypes().add(theExtensiblePackage.getQuery()); - falseLiteralQueryEClass.getESuperTypes().add(theExtensiblePackage.getQuery()); - nullLiteralQueryEClass.getESuperTypes().add(theExtensiblePackage.getQuery()); - integerLiteralQueryEClass.getESuperTypes().add(theExtensiblePackage.getQuery()); - floatLiteralQueryEClass.getESuperTypes().add(theExtensiblePackage.getQuery()); - eObjectLiteralQueryEClass.getESuperTypes().add(theExtensiblePackage.getQuery()); - operationCallQueryEClass.getESuperTypes().add(theExtensiblePackage.getQuery()); - - // Initialize classes and features; add operations and parameters - initEClass(navigationQueryEClass, NavigationQuery.class, "NavigationQuery", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); //$NON-NLS-1$ - initEReference(getNavigationQuery_Path(), ecorePackage.getETypedElement(), null, "path", null, 1, -1, NavigationQuery.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); //$NON-NLS-1$ - initEAttribute(getNavigationQuery_FailOnError(), ecorePackage.getEBoolean(), "failOnError", "true", 0, 1, NavigationQuery.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); //$NON-NLS-1$ //$NON-NLS-2$ - - initEClass(isOneOfQueryEClass, IsOneOfQuery.class, "IsOneOfQuery", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); //$NON-NLS-1$ - initEReference(getIsOneOfQuery_ExpectedEObjects(), ecorePackage.getEObject(), null, "expectedEObjects", null, 0, -1, IsOneOfQuery.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); //$NON-NLS-1$ - - initEClass(stringLiteralQueryEClass, StringLiteralQuery.class, "StringLiteralQuery", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); //$NON-NLS-1$ - initEAttribute(getStringLiteralQuery_Value(), ecorePackage.getEString(), "value", null, 0, 1, StringLiteralQuery.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); //$NON-NLS-1$ - - initEClass(trueLiteralQueryEClass, TrueLiteralQuery.class, "TrueLiteralQuery", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); //$NON-NLS-1$ - - initEClass(falseLiteralQueryEClass, FalseLiteralQuery.class, "FalseLiteralQuery", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); //$NON-NLS-1$ - - initEClass(nullLiteralQueryEClass, NullLiteralQuery.class, "NullLiteralQuery", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); //$NON-NLS-1$ - - initEClass(integerLiteralQueryEClass, IntegerLiteralQuery.class, "IntegerLiteralQuery", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); //$NON-NLS-1$ - initEAttribute(getIntegerLiteralQuery_Value(), ecorePackage.getEInt(), "value", null, 0, 1, IntegerLiteralQuery.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); //$NON-NLS-1$ - - initEClass(floatLiteralQueryEClass, FloatLiteralQuery.class, "FloatLiteralQuery", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); //$NON-NLS-1$ - initEAttribute(getFloatLiteralQuery_Value(), ecorePackage.getEFloat(), "value", null, 0, 1, FloatLiteralQuery.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); //$NON-NLS-1$ - - initEClass(eObjectLiteralQueryEClass, EObjectLiteralQuery.class, "EObjectLiteralQuery", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); //$NON-NLS-1$ - initEReference(getEObjectLiteralQuery_Element(), ecorePackage.getEObject(), null, "element", null, 0, 1, EObjectLiteralQuery.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); //$NON-NLS-1$ - - initEClass(operationCallQueryEClass, OperationCallQuery.class, "OperationCallQuery", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); //$NON-NLS-1$ - initEReference(getOperationCallQuery_Operation(), ecorePackage.getEOperation(), null, "operation", null, 0, 1, OperationCallQuery.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); //$NON-NLS-1$ - initEReference(getOperationCallQuery_Arguments(), theExtensiblePackage.getQuery(), null, "arguments", null, 0, -1, OperationCallQuery.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); //$NON-NLS-1$ - } - -} //QueryPackageImpl
diff --git a/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/emf/facet/efacet/metamodel/v0_2_0/efacet/query/impl/StringLiteralQueryImpl.java b/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/emf/facet/efacet/metamodel/v0_2_0/efacet/query/impl/StringLiteralQueryImpl.java deleted file mode 100644 index 563c576..0000000 --- a/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/emf/facet/efacet/metamodel/v0_2_0/efacet/query/impl/StringLiteralQueryImpl.java +++ /dev/null
@@ -1,175 +0,0 @@ -/** - * Copyright (c) 2011 Mia-Software. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Gregoire Dupe (Mia-Software) - Design - * Nicolas Guyomar (Mia-Software) - Implementation - * Emmanuelle Rouillé (Mia-Software) - Bug 352618 - To be able to use non derived facet structural features and save them values. - * Nicolas Bros (Mia-Software) - Bug 361823 - [Restructuring] eFacet2 meta-model - * Gregoire Dupe (Mia-Software) - Bug 366055 - NavigationQuery - * Gregoire Dupe (Mia-Software) - Bug 369673 - [Facet] IsOneOfQuery - * Olivier Remaud (Soft-Maint) - Bug 369824 - Add a simple way to return string literal constants from a customization query - */ -package org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.query.impl; - -import org.eclipse.emf.common.notify.Notification; -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.ecore.impl.ENotificationImpl; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.extensible.impl.QueryImpl; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.query.QueryPackage; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.query.StringLiteralQuery; - -/** - * <!-- begin-user-doc --> - * An implementation of the model object '<em><b>String Literal Query</b></em>'. - * <!-- end-user-doc --> - * <p> - * The following features are implemented: - * <ul> - * <li>{@link org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.query.impl.StringLiteralQueryImpl#getValue <em>Value</em>}</li> - * </ul> - * </p> - * - * @generated - */ -public class StringLiteralQueryImpl extends QueryImpl implements StringLiteralQuery { - /** - * The default value of the '{@link #getValue() <em>Value</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #getValue() - * @generated - * @ordered - */ - protected static final String VALUE_EDEFAULT = null; - - /** - * The cached value of the '{@link #getValue() <em>Value</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #getValue() - * @generated - * @ordered - */ - protected String value = VALUE_EDEFAULT; - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected StringLiteralQueryImpl() { - super(); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - protected EClass eStaticClass() { - return QueryPackage.Literals.STRING_LITERAL_QUERY; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public String getValue() { - return value; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public void setValue(String newValue) { - String oldValue = value; - value = newValue; - if (eNotificationRequired()) - eNotify(new ENotificationImpl(this, Notification.SET, QueryPackage.STRING_LITERAL_QUERY__VALUE, oldValue, value)); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public Object eGet(int featureID, boolean resolve, boolean coreType) { - switch (featureID) { - case QueryPackage.STRING_LITERAL_QUERY__VALUE: - return getValue(); - } - return super.eGet(featureID, resolve, coreType); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public void eSet(int featureID, Object newValue) { - switch (featureID) { - case QueryPackage.STRING_LITERAL_QUERY__VALUE: - setValue((String)newValue); - return; - } - super.eSet(featureID, newValue); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public void eUnset(int featureID) { - switch (featureID) { - case QueryPackage.STRING_LITERAL_QUERY__VALUE: - setValue(VALUE_EDEFAULT); - return; - } - super.eUnset(featureID); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public boolean eIsSet(int featureID) { - switch (featureID) { - case QueryPackage.STRING_LITERAL_QUERY__VALUE: - return VALUE_EDEFAULT == null ? value != null : !VALUE_EDEFAULT.equals(value); - } - return super.eIsSet(featureID); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public String toString() { - if (eIsProxy()) return super.toString(); - - StringBuffer result = new StringBuffer(super.toString()); - result.append(" (value: "); //$NON-NLS-1$ - result.append(value); - result.append(')'); - return result.toString(); - } - -} //StringLiteralQueryImpl
diff --git a/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/emf/facet/efacet/metamodel/v0_2_0/efacet/query/impl/TrueLiteralQueryImpl.java b/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/emf/facet/efacet/metamodel/v0_2_0/efacet/query/impl/TrueLiteralQueryImpl.java deleted file mode 100644 index d9f41c9..0000000 --- a/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/emf/facet/efacet/metamodel/v0_2_0/efacet/query/impl/TrueLiteralQueryImpl.java +++ /dev/null
@@ -1,56 +0,0 @@ -/** - * Copyright (c) 2011 Mia-Software. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Gregoire Dupe (Mia-Software) - Design - * Nicolas Guyomar (Mia-Software) - Implementation - * Emmanuelle Rouillé (Mia-Software) - Bug 352618 - To be able to use non derived facet structural features and save them values. - * Nicolas Bros (Mia-Software) - Bug 361823 - [Restructuring] eFacet2 meta-model - * Gregoire Dupe (Mia-Software) - Bug 366055 - NavigationQuery - * Gregoire Dupe (Mia-Software) - Bug 369673 - [Facet] IsOneOfQuery - * Olivier Remaud (Soft-Maint) - Bug 369824 - Add a simple way to return string literal constants from a customization query - * Gregoire Dupe (Mia-software) - Bug 369987 - [Restructuring][Table] Switch to the new customization and facet framework - * Gregoire Dupe (Mia-Software) - Bug 369987 - [Restructuring][Table] Switch to the new customization and facet framework - */ -package org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.query.impl; - -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.extensible.impl.QueryImpl; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.query.QueryPackage; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.query.TrueLiteralQuery; - -/** - * <!-- begin-user-doc --> - * An implementation of the model object '<em><b>True Literal Query</b></em>'. - * <!-- end-user-doc --> - * <p> - * </p> - * - * @generated - */ -public class TrueLiteralQueryImpl extends QueryImpl implements TrueLiteralQuery { - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected TrueLiteralQueryImpl() { - super(); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - protected EClass eStaticClass() { - return QueryPackage.Literals.TRUE_LITERAL_QUERY; - } - -} //TrueLiteralQueryImpl
diff --git a/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/emf/facet/efacet/metamodel/v0_2_0/efacet/query/util/QueryAdapterFactory.java b/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/emf/facet/efacet/metamodel/v0_2_0/efacet/query/util/QueryAdapterFactory.java deleted file mode 100644 index 5129236..0000000 --- a/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/emf/facet/efacet/metamodel/v0_2_0/efacet/query/util/QueryAdapterFactory.java +++ /dev/null
@@ -1,319 +0,0 @@ -/** - * Copyright (c) 2011 Mia-Software. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Gregoire Dupe (Mia-Software) - Design - * Nicolas Guyomar (Mia-Software) - Implementation - * Emmanuelle Rouillé (Mia-Software) - Bug 352618 - To be able to use non derived facet structural features and save them values. - * Nicolas Bros (Mia-Software) - Bug 361823 - [Restructuring] eFacet2 meta-model - * Gregoire Dupe (Mia-Software) - Bug 366055 - NavigationQuery - * Gregoire Dupe (Mia-Software) - Bug 369987 - [Restructuring][Table] Switch to the new customization and facet framework - */ -package org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.query.util; - -import org.eclipse.emf.common.notify.Adapter; -import org.eclipse.emf.common.notify.Notifier; -import org.eclipse.emf.common.notify.impl.AdapterFactoryImpl; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.extensible.Query; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.query.*; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.query.FalseLiteralQuery; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.query.IsOneOfQuery; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.query.NavigationQuery; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.query.NullLiteralQuery; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.query.QueryPackage; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.query.StringLiteralQuery; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.query.TrueLiteralQuery; - -/** - * <!-- begin-user-doc --> - * The <b>Adapter Factory</b> for the model. - * It provides an adapter <code>createXXX</code> method for each class of the model. - * <!-- end-user-doc --> - * @see org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.query.QueryPackage - * @generated - */ -public class QueryAdapterFactory extends AdapterFactoryImpl { - /** - * The cached model package. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected static QueryPackage modelPackage; - - /** - * Creates an instance of the adapter factory. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public QueryAdapterFactory() { - if (modelPackage == null) { - modelPackage = QueryPackage.eINSTANCE; - } - } - - /** - * Returns whether this factory is applicable for the type of the object. - * <!-- begin-user-doc --> - * This implementation returns <code>true</code> if the object is either the model's package or is an instance object of the model. - * <!-- end-user-doc --> - * @return whether this factory is applicable for the type of the object. - * @generated - */ - @Override - public boolean isFactoryForType(Object object) { - if (object == modelPackage) { - return true; - } - if (object instanceof EObject) { - return ((EObject)object).eClass().getEPackage() == modelPackage; - } - return false; - } - - /** - * The switch that delegates to the <code>createXXX</code> methods. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected QuerySwitch<Adapter> modelSwitch = - new QuerySwitch<Adapter>() { - @Override - public Adapter caseNavigationQuery(NavigationQuery object) { - return createNavigationQueryAdapter(); - } - @Override - public Adapter caseIsOneOfQuery(IsOneOfQuery object) { - return createIsOneOfQueryAdapter(); - } - @Override - public Adapter caseStringLiteralQuery(StringLiteralQuery object) { - return createStringLiteralQueryAdapter(); - } - @Override - public Adapter caseTrueLiteralQuery(TrueLiteralQuery object) { - return createTrueLiteralQueryAdapter(); - } - @Override - public Adapter caseFalseLiteralQuery(FalseLiteralQuery object) { - return createFalseLiteralQueryAdapter(); - } - @Override - public Adapter caseNullLiteralQuery(NullLiteralQuery object) { - return createNullLiteralQueryAdapter(); - } - @Override - public Adapter caseIntegerLiteralQuery(IntegerLiteralQuery object) { - return createIntegerLiteralQueryAdapter(); - } - @Override - public Adapter caseFloatLiteralQuery(FloatLiteralQuery object) { - return createFloatLiteralQueryAdapter(); - } - @Override - public Adapter caseEObjectLiteralQuery(EObjectLiteralQuery object) { - return createEObjectLiteralQueryAdapter(); - } - @Override - public Adapter caseOperationCallQuery(OperationCallQuery object) { - return createOperationCallQueryAdapter(); - } - @Override - public Adapter caseQuery(Query object) { - return createQueryAdapter(); - } - @Override - public Adapter defaultCase(EObject object) { - return createEObjectAdapter(); - } - }; - - /** - * Creates an adapter for the <code>target</code>. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @param target the object to adapt. - * @return the adapter for the <code>target</code>. - * @generated - */ - @Override - public Adapter createAdapter(Notifier target) { - return modelSwitch.doSwitch((EObject)target); - } - - - /** - * Creates a new adapter for an object of class '{@link org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.query.NavigationQuery <em>Navigation Query</em>}'. - * <!-- begin-user-doc --> - * This default implementation returns null so that we can easily ignore cases; - * it's useful to ignore a case when inheritance will catch all the cases anyway. - * <!-- end-user-doc --> - * @return the new adapter. - * @see org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.query.NavigationQuery - * @generated - */ - public Adapter createNavigationQueryAdapter() { - return null; - } - - /** - * Creates a new adapter for an object of class '{@link org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.query.IsOneOfQuery <em>Is One Of Query</em>}'. - * <!-- begin-user-doc --> - * This default implementation returns null so that we can easily ignore cases; - * it's useful to ignore a case when inheritance will catch all the cases anyway. - * <!-- end-user-doc --> - * @return the new adapter. - * @see org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.query.IsOneOfQuery - * @generated - */ - public Adapter createIsOneOfQueryAdapter() { - return null; - } - - /** - * Creates a new adapter for an object of class '{@link org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.query.StringLiteralQuery <em>String Literal Query</em>}'. - * <!-- begin-user-doc --> - * This default implementation returns null so that we can easily ignore cases; - * it's useful to ignore a case when inheritance will catch all the cases anyway. - * <!-- end-user-doc --> - * @return the new adapter. - * @see org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.query.StringLiteralQuery - * @generated - */ - public Adapter createStringLiteralQueryAdapter() { - return null; - } - - /** - * Creates a new adapter for an object of class '{@link org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.query.TrueLiteralQuery <em>True Literal Query</em>}'. - * <!-- begin-user-doc --> - * This default implementation returns null so that we can easily ignore cases; - * it's useful to ignore a case when inheritance will catch all the cases anyway. - * <!-- end-user-doc --> - * @return the new adapter. - * @see org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.query.TrueLiteralQuery - * @generated - */ - public Adapter createTrueLiteralQueryAdapter() { - return null; - } - - /** - * Creates a new adapter for an object of class '{@link org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.query.FalseLiteralQuery <em>False Literal Query</em>}'. - * <!-- begin-user-doc --> - * This default implementation returns null so that we can easily ignore cases; - * it's useful to ignore a case when inheritance will catch all the cases anyway. - * <!-- end-user-doc --> - * @return the new adapter. - * @see org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.query.FalseLiteralQuery - * @generated - */ - public Adapter createFalseLiteralQueryAdapter() { - return null; - } - - /** - * Creates a new adapter for an object of class '{@link org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.query.NullLiteralQuery <em>Null Literal Query</em>}'. - * <!-- begin-user-doc --> - * This default implementation returns null so that we can easily ignore cases; - * it's useful to ignore a case when inheritance will catch all the cases anyway. - * <!-- end-user-doc --> - * @return the new adapter. - * @see org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.query.NullLiteralQuery - * @generated - */ - public Adapter createNullLiteralQueryAdapter() { - return null; - } - - /** - * Creates a new adapter for an object of class '{@link org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.query.IntegerLiteralQuery <em>Integer Literal Query</em>}'. - * <!-- begin-user-doc --> - * This default implementation returns null so that we can easily ignore cases; - * it's useful to ignore a case when inheritance will catch all the cases anyway. - * <!-- end-user-doc --> - * @return the new adapter. - * @see org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.query.IntegerLiteralQuery - * @generated - */ - public Adapter createIntegerLiteralQueryAdapter() { - return null; - } - - /** - * Creates a new adapter for an object of class '{@link org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.query.FloatLiteralQuery <em>Float Literal Query</em>}'. - * <!-- begin-user-doc --> - * This default implementation returns null so that we can easily ignore cases; - * it's useful to ignore a case when inheritance will catch all the cases anyway. - * <!-- end-user-doc --> - * @return the new adapter. - * @see org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.query.FloatLiteralQuery - * @generated - */ - public Adapter createFloatLiteralQueryAdapter() { - return null; - } - - /** - * Creates a new adapter for an object of class '{@link org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.query.EObjectLiteralQuery <em>EObject Literal Query</em>}'. - * <!-- begin-user-doc --> - * This default implementation returns null so that we can easily ignore cases; - * it's useful to ignore a case when inheritance will catch all the cases anyway. - * <!-- end-user-doc --> - * @return the new adapter. - * @see org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.query.EObjectLiteralQuery - * @generated - */ - public Adapter createEObjectLiteralQueryAdapter() { - return null; - } - - /** - * Creates a new adapter for an object of class '{@link org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.query.OperationCallQuery <em>Operation Call Query</em>}'. - * <!-- begin-user-doc --> - * This default implementation returns null so that we can easily ignore cases; - * it's useful to ignore a case when inheritance will catch all the cases anyway. - * <!-- end-user-doc --> - * @return the new adapter. - * @see org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.query.OperationCallQuery - * @generated - */ - public Adapter createOperationCallQueryAdapter() { - return null; - } - - /** - * Creates a new adapter for an object of class '{@link org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.extensible.Query <em>Query</em>}'. - * <!-- begin-user-doc --> - * This default implementation returns null so that we can easily ignore cases; - * it's useful to ignore a case when inheritance will catch all the cases anyway. - * <!-- end-user-doc --> - * @return the new adapter. - * @see org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.extensible.Query - * @generated - */ - public Adapter createQueryAdapter() { - return null; - } - - /** - * Creates a new adapter for the default case. - * <!-- begin-user-doc --> - * This default implementation returns null. - * <!-- end-user-doc --> - * @return the new adapter. - * @generated - */ - public Adapter createEObjectAdapter() { - return null; - } - -} //QueryAdapterFactory
diff --git a/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/emf/facet/efacet/metamodel/v0_2_0/efacet/query/util/QuerySwitch.java b/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/emf/facet/efacet/metamodel/v0_2_0/efacet/query/util/QuerySwitch.java deleted file mode 100644 index c1673dd..0000000 --- a/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/emf/facet/efacet/metamodel/v0_2_0/efacet/query/util/QuerySwitch.java +++ /dev/null
@@ -1,363 +0,0 @@ -/** - * Copyright (c) 2011 Mia-Software. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Gregoire Dupe (Mia-Software) - Design - * Nicolas Guyomar (Mia-Software) - Implementation - * Emmanuelle Rouillé (Mia-Software) - Bug 352618 - To be able to use non derived facet structural features and save them values. - * Nicolas Bros (Mia-Software) - Bug 361823 - [Restructuring] eFacet2 meta-model - * Gregoire Dupe (Mia-Software) - Bug 366055 - NavigationQuery - * Gregoire Dupe (Mia-Software) - Bug 369673 - [Facet] IsOneOfQuery - * Olivier Remaud (Soft-Maint) - Bug 369824 - Add a simple way to return string literal constants from a customization query - * Gregoire Dupe (Mia-software) - Bug 369987 - [Restructuring][Table] Switch to the new customization and facet framework - */ -package org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.query.util; - -import java.util.List; - -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.extensible.Query; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.query.*; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.query.FalseLiteralQuery; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.query.IsOneOfQuery; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.query.NavigationQuery; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.query.NullLiteralQuery; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.query.QueryPackage; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.query.StringLiteralQuery; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.query.TrueLiteralQuery; - -/** - * <!-- begin-user-doc --> - * The <b>Switch</b> for the model's inheritance hierarchy. - * It supports the call {@link #doSwitch(EObject) doSwitch(object)} - * to invoke the <code>caseXXX</code> method for each class of the model, - * starting with the actual class of the object - * and proceeding up the inheritance hierarchy - * until a non-null result is returned, - * which is the result of the switch. - * <!-- end-user-doc --> - * @see org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.query.QueryPackage - * @generated - */ -public class QuerySwitch<T> { - /** - * The cached model package - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected static QueryPackage modelPackage; - - /** - * Creates an instance of the switch. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public QuerySwitch() { - if (modelPackage == null) { - modelPackage = QueryPackage.eINSTANCE; - } - } - - /** - * Calls <code>caseXXX</code> for each class of the model until one returns a non null result; it yields that result. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the first non-null result returned by a <code>caseXXX</code> call. - * @generated - */ - public T doSwitch(EObject theEObject) { - return doSwitch(theEObject.eClass(), theEObject); - } - - /** - * Calls <code>caseXXX</code> for each class of the model until one returns a non null result; it yields that result. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the first non-null result returned by a <code>caseXXX</code> call. - * @generated - */ - protected T doSwitch(EClass theEClass, EObject theEObject) { - if (theEClass.eContainer() == modelPackage) { - return doSwitch(theEClass.getClassifierID(), theEObject); - } - else { - List<EClass> eSuperTypes = theEClass.getESuperTypes(); - return - eSuperTypes.isEmpty() ? - defaultCase(theEObject) : - doSwitch(eSuperTypes.get(0), theEObject); - } - } - - /** - * Calls <code>caseXXX</code> for each class of the model until one returns a non null result; it yields that result. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the first non-null result returned by a <code>caseXXX</code> call. - * @generated - */ - protected T doSwitch(int classifierID, EObject theEObject) { - switch (classifierID) { - case QueryPackage.NAVIGATION_QUERY: { - NavigationQuery navigationQuery = (NavigationQuery)theEObject; - T result = caseNavigationQuery(navigationQuery); - if (result == null) result = caseQuery(navigationQuery); - if (result == null) result = defaultCase(theEObject); - return result; - } - case QueryPackage.IS_ONE_OF_QUERY: { - IsOneOfQuery isOneOfQuery = (IsOneOfQuery)theEObject; - T result = caseIsOneOfQuery(isOneOfQuery); - if (result == null) result = caseQuery(isOneOfQuery); - if (result == null) result = defaultCase(theEObject); - return result; - } - case QueryPackage.STRING_LITERAL_QUERY: { - StringLiteralQuery stringLiteralQuery = (StringLiteralQuery)theEObject; - T result = caseStringLiteralQuery(stringLiteralQuery); - if (result == null) result = caseQuery(stringLiteralQuery); - if (result == null) result = defaultCase(theEObject); - return result; - } - case QueryPackage.TRUE_LITERAL_QUERY: { - TrueLiteralQuery trueLiteralQuery = (TrueLiteralQuery)theEObject; - T result = caseTrueLiteralQuery(trueLiteralQuery); - if (result == null) result = caseQuery(trueLiteralQuery); - if (result == null) result = defaultCase(theEObject); - return result; - } - case QueryPackage.FALSE_LITERAL_QUERY: { - FalseLiteralQuery falseLiteralQuery = (FalseLiteralQuery)theEObject; - T result = caseFalseLiteralQuery(falseLiteralQuery); - if (result == null) result = caseQuery(falseLiteralQuery); - if (result == null) result = defaultCase(theEObject); - return result; - } - case QueryPackage.NULL_LITERAL_QUERY: { - NullLiteralQuery nullLiteralQuery = (NullLiteralQuery)theEObject; - T result = caseNullLiteralQuery(nullLiteralQuery); - if (result == null) result = caseQuery(nullLiteralQuery); - if (result == null) result = defaultCase(theEObject); - return result; - } - case QueryPackage.INTEGER_LITERAL_QUERY: { - IntegerLiteralQuery integerLiteralQuery = (IntegerLiteralQuery)theEObject; - T result = caseIntegerLiteralQuery(integerLiteralQuery); - if (result == null) result = caseQuery(integerLiteralQuery); - if (result == null) result = defaultCase(theEObject); - return result; - } - case QueryPackage.FLOAT_LITERAL_QUERY: { - FloatLiteralQuery floatLiteralQuery = (FloatLiteralQuery)theEObject; - T result = caseFloatLiteralQuery(floatLiteralQuery); - if (result == null) result = caseQuery(floatLiteralQuery); - if (result == null) result = defaultCase(theEObject); - return result; - } - case QueryPackage.EOBJECT_LITERAL_QUERY: { - EObjectLiteralQuery eObjectLiteralQuery = (EObjectLiteralQuery)theEObject; - T result = caseEObjectLiteralQuery(eObjectLiteralQuery); - if (result == null) result = caseQuery(eObjectLiteralQuery); - if (result == null) result = defaultCase(theEObject); - return result; - } - case QueryPackage.OPERATION_CALL_QUERY: { - OperationCallQuery operationCallQuery = (OperationCallQuery)theEObject; - T result = caseOperationCallQuery(operationCallQuery); - if (result == null) result = caseQuery(operationCallQuery); - if (result == null) result = defaultCase(theEObject); - return result; - } - default: return defaultCase(theEObject); - } - } - - /** - * Returns the result of interpreting the object as an instance of '<em>Navigation Query</em>'. - * <!-- begin-user-doc --> - * This implementation returns null; - * returning a non-null result will terminate the switch. - * <!-- end-user-doc --> - * @param object the target of the switch. - * @return the result of interpreting the object as an instance of '<em>Navigation Query</em>'. - * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) - * @generated - */ - public T caseNavigationQuery(NavigationQuery object) { - return null; - } - - /** - * Returns the result of interpreting the object as an instance of '<em>Is One Of Query</em>'. - * <!-- begin-user-doc --> - * This implementation returns null; - * returning a non-null result will terminate the switch. - * <!-- end-user-doc --> - * @param object the target of the switch. - * @return the result of interpreting the object as an instance of '<em>Is One Of Query</em>'. - * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) - * @generated - */ - public T caseIsOneOfQuery(IsOneOfQuery object) { - return null; - } - - /** - * Returns the result of interpreting the object as an instance of '<em>String Literal Query</em>'. - * <!-- begin-user-doc --> - * This implementation returns null; - * returning a non-null result will terminate the switch. - * <!-- end-user-doc --> - * @param object the target of the switch. - * @return the result of interpreting the object as an instance of '<em>String Literal Query</em>'. - * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) - * @generated - */ - public T caseStringLiteralQuery(StringLiteralQuery object) { - return null; - } - - /** - * Returns the result of interpreting the object as an instance of '<em>True Literal Query</em>'. - * <!-- begin-user-doc --> - * This implementation returns null; - * returning a non-null result will terminate the switch. - * <!-- end-user-doc --> - * @param object the target of the switch. - * @return the result of interpreting the object as an instance of '<em>True Literal Query</em>'. - * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) - * @generated - */ - public T caseTrueLiteralQuery(TrueLiteralQuery object) { - return null; - } - - /** - * Returns the result of interpreting the object as an instance of '<em>False Literal Query</em>'. - * <!-- begin-user-doc --> - * This implementation returns null; - * returning a non-null result will terminate the switch. - * <!-- end-user-doc --> - * @param object the target of the switch. - * @return the result of interpreting the object as an instance of '<em>False Literal Query</em>'. - * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) - * @generated - */ - public T caseFalseLiteralQuery(FalseLiteralQuery object) { - return null; - } - - /** - * Returns the result of interpreting the object as an instance of '<em>Null Literal Query</em>'. - * <!-- begin-user-doc --> - * This implementation returns null; - * returning a non-null result will terminate the switch. - * <!-- end-user-doc --> - * @param object the target of the switch. - * @return the result of interpreting the object as an instance of '<em>Null Literal Query</em>'. - * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) - * @generated - */ - public T caseNullLiteralQuery(NullLiteralQuery object) { - return null; - } - - /** - * Returns the result of interpreting the object as an instance of '<em>Integer Literal Query</em>'. - * <!-- begin-user-doc --> - * This implementation returns null; - * returning a non-null result will terminate the switch. - * <!-- end-user-doc --> - * @param object the target of the switch. - * @return the result of interpreting the object as an instance of '<em>Integer Literal Query</em>'. - * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) - * @generated - */ - public T caseIntegerLiteralQuery(IntegerLiteralQuery object) { - return null; - } - - /** - * Returns the result of interpreting the object as an instance of '<em>Float Literal Query</em>'. - * <!-- begin-user-doc --> - * This implementation returns null; - * returning a non-null result will terminate the switch. - * <!-- end-user-doc --> - * @param object the target of the switch. - * @return the result of interpreting the object as an instance of '<em>Float Literal Query</em>'. - * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) - * @generated - */ - public T caseFloatLiteralQuery(FloatLiteralQuery object) { - return null; - } - - /** - * Returns the result of interpreting the object as an instance of '<em>EObject Literal Query</em>'. - * <!-- begin-user-doc --> - * This implementation returns null; - * returning a non-null result will terminate the switch. - * <!-- end-user-doc --> - * @param object the target of the switch. - * @return the result of interpreting the object as an instance of '<em>EObject Literal Query</em>'. - * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) - * @generated - */ - public T caseEObjectLiteralQuery(EObjectLiteralQuery object) { - return null; - } - - /** - * Returns the result of interpreting the object as an instance of '<em>Operation Call Query</em>'. - * <!-- begin-user-doc --> - * This implementation returns null; - * returning a non-null result will terminate the switch. - * <!-- end-user-doc --> - * @param object the target of the switch. - * @return the result of interpreting the object as an instance of '<em>Operation Call Query</em>'. - * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) - * @generated - */ - public T caseOperationCallQuery(OperationCallQuery object) { - return null; - } - - /** - * Returns the result of interpreting the object as an instance of '<em>Query</em>'. - * <!-- begin-user-doc --> - * This implementation returns null; - * returning a non-null result will terminate the switch. - * <!-- end-user-doc --> - * @param object the target of the switch. - * @return the result of interpreting the object as an instance of '<em>Query</em>'. - * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) - * @generated - */ - public T caseQuery(Query object) { - return null; - } - - /** - * Returns the result of interpreting the object as an instance of '<em>EObject</em>'. - * <!-- begin-user-doc --> - * This implementation returns null; - * returning a non-null result will terminate the switch, but this is the last case anyway. - * <!-- end-user-doc --> - * @param object the target of the switch. - * @return the result of interpreting the object as an instance of '<em>EObject</em>'. - * @see #doSwitch(org.eclipse.emf.ecore.EObject) - * @generated - */ - public T defaultCase(EObject object) { - return null; - } - -} //QuerySwitch
diff --git a/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/emf/facet/efacet/metamodel/v0_2_0/efacet/runtime/ETypedElementEObjectListResult.java b/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/emf/facet/efacet/metamodel/v0_2_0/efacet/runtime/ETypedElementEObjectListResult.java deleted file mode 100644 index 8f93860..0000000 --- a/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/emf/facet/efacet/metamodel/v0_2_0/efacet/runtime/ETypedElementEObjectListResult.java +++ /dev/null
@@ -1,62 +0,0 @@ -/** - * Copyright (c) 2011, 2012 Mia-Software. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Gregoire Dupe (Mia-Software) - Design - * Nicolas Guyomar (Mia-Software) - Implementation - * Emmanuelle Rouillé (Mia-Software) - Bug 352618 - To be able to use non derived facet structural features and save them values. - * Nicolas Bros (Mia-Software) - Bug 361823 - [Restructuring] eFacet2 meta-model - * Gregoire Dupe (Mia-Software) - Bug 366055 - NavigationQuery - * Gregoire Dupe (Mia-Software) - Bug 369673 - [Facet] IsOneOfQuery - * Olivier Remaud (Soft-Maint) - Bug 369824 - Add a simple way to return string literal constants from a customization query - * Gregoire Dupe (Mia-software) - Bug 369987 - [Restructuring][Table] Switch to the new customization and facet framework - * Gregoire Dupe (Mia-software) - Bug 364325 - [Restructuring] The user must be able to navigate into a model using the Facet. - */ -package org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.runtime; - -import org.eclipse.emf.common.util.EList; -import org.eclipse.emf.ecore.EObject; - -/** - * <!-- begin-user-doc --> - * A representation of the model object '<em><b>ETyped Element EObject List Result</b></em>'. - * <!-- end-user-doc --> - * - * <!-- begin-model-doc --> - * This class represents the result of evaluating the value of a multiplicity-many DerivedTypedElement by means of a multi-valued query . - * <!-- end-model-doc --> - * - * <p> - * The following features are supported: - * <ul> - * <li>{@link org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.runtime.ETypedElementEObjectListResult#getResultList <em>Result List</em>}</li> - * </ul> - * </p> - * - * @see org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.runtime.RuntimePackage#getETypedElementEObjectListResult() - * @model - * @generated - */ -public interface ETypedElementEObjectListResult<T extends EObject> extends ETypedElementResult { - /** - * Returns the value of the '<em><b>Result List</b></em>' reference list. - * The list contents are of type {@link T}. - * <!-- begin-user-doc --> - * <p> - * If the meaning of the '<em>Result List</em>' reference list isn't clear, - * there really should be more of a description here... - * </p> - * <!-- end-user-doc --> - * @return the value of the '<em>Result List</em>' reference list. - * @see org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.runtime.RuntimePackage#getETypedElementEObjectListResult_ResultList() - * @model - * @generated - */ - EList<T> getResultList(); - -} // ETypedElementEObjectListResult
diff --git a/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/emf/facet/efacet/metamodel/v0_2_0/efacet/runtime/ETypedElementEObjectResult.java b/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/emf/facet/efacet/metamodel/v0_2_0/efacet/runtime/ETypedElementEObjectResult.java deleted file mode 100644 index bc4f14d..0000000 --- a/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/emf/facet/efacet/metamodel/v0_2_0/efacet/runtime/ETypedElementEObjectResult.java +++ /dev/null
@@ -1,71 +0,0 @@ -/** - * Copyright (c) 2011, 2012 Mia-Software. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Gregoire Dupe (Mia-Software) - Design - * Nicolas Guyomar (Mia-Software) - Implementation - * Emmanuelle Rouillé (Mia-Software) - Bug 352618 - To be able to use non derived facet structural features and save them values. - * Nicolas Bros (Mia-Software) - Bug 361823 - [Restructuring] eFacet2 meta-model - * Gregoire Dupe (Mia-Software) - Bug 366055 - NavigationQuery - * Gregoire Dupe (Mia-Software) - Bug 369673 - [Facet] IsOneOfQuery - * Olivier Remaud (Soft-Maint) - Bug 369824 - Add a simple way to return string literal constants from a customization query - * Gregoire Dupe (Mia-software) - Bug 369987 - [Restructuring][Table] Switch to the new customization and facet framework - * Gregoire Dupe (Mia-software) - Bug 364325 - [Restructuring] The user must be able to navigate into a model using the Facet. - */ -package org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.runtime; - -import org.eclipse.emf.ecore.EObject; - -/** - * <!-- begin-user-doc --> - * A representation of the model object '<em><b>ETyped Element EObject Result</b></em>'. - * <!-- end-user-doc --> - * - * <!-- begin-model-doc --> - * This class represents the result of evaluating the value of a multiplicity-one DerivedTypedElement by means of a single-valued query . - * <!-- end-model-doc --> - * - * <p> - * The following features are supported: - * <ul> - * <li>{@link org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.runtime.ETypedElementEObjectResult#getResult <em>Result</em>}</li> - * </ul> - * </p> - * - * @see org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.runtime.RuntimePackage#getETypedElementEObjectResult() - * @model - * @generated - */ -public interface ETypedElementEObjectResult<T extends EObject> extends ETypedElementResult { - /** - * Returns the value of the '<em><b>Result</b></em>' reference. - * <!-- begin-user-doc --> - * <p> - * If the meaning of the '<em>Result</em>' reference isn't clear, - * there really should be more of a description here... - * </p> - * <!-- end-user-doc --> - * @return the value of the '<em>Result</em>' reference. - * @see #setResult(EObject) - * @see org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.runtime.RuntimePackage#getETypedElementEObjectResult_Result() - * @model - * @generated - */ - T getResult(); - - /** - * Sets the value of the '{@link org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.runtime.ETypedElementEObjectResult#getResult <em>Result</em>}' reference. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @param value the new value of the '<em>Result</em>' reference. - * @see #getResult() - * @generated - */ - void setResult(T value); - -} // ETypedElementEObjectResult
diff --git a/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/emf/facet/efacet/metamodel/v0_2_0/efacet/runtime/ETypedElementPrimitiveTypeListResult.java b/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/emf/facet/efacet/metamodel/v0_2_0/efacet/runtime/ETypedElementPrimitiveTypeListResult.java deleted file mode 100644 index df72549..0000000 --- a/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/emf/facet/efacet/metamodel/v0_2_0/efacet/runtime/ETypedElementPrimitiveTypeListResult.java +++ /dev/null
@@ -1,61 +0,0 @@ -/** - * Copyright (c) 2011, 2012 Mia-Software. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Gregoire Dupe (Mia-Software) - Design - * Nicolas Guyomar (Mia-Software) - Implementation - * Emmanuelle Rouillé (Mia-Software) - Bug 352618 - To be able to use non derived facet structural features and save them values. - * Nicolas Bros (Mia-Software) - Bug 361823 - [Restructuring] eFacet2 meta-model - * Gregoire Dupe (Mia-Software) - Bug 366055 - NavigationQuery - * Gregoire Dupe (Mia-Software) - Bug 369673 - [Facet] IsOneOfQuery - * Olivier Remaud (Soft-Maint) - Bug 369824 - Add a simple way to return string literal constants from a customization query - * Gregoire Dupe (Mia-software) - Bug 369987 - [Restructuring][Table] Switch to the new customization and facet framework - * Gregoire Dupe (Mia-software) - Bug 364325 - [Restructuring] The user must be able to navigate into a model using the Facet. - */ -package org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.runtime; - -import org.eclipse.emf.common.util.EList; - -/** - * <!-- begin-user-doc --> - * A representation of the model object '<em><b>ETyped Element Primitive Type List Result</b></em>'. - * <!-- end-user-doc --> - * - * <!-- begin-model-doc --> - * This class represents the result of evaluating the value of a multiplicity-many DerivedTypedElement by means of a multi-valued query . - * <!-- end-model-doc --> - * - * <p> - * The following features are supported: - * <ul> - * <li>{@link org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.runtime.ETypedElementPrimitiveTypeListResult#getResultList <em>Result List</em>}</li> - * </ul> - * </p> - * - * @see org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.runtime.RuntimePackage#getETypedElementPrimitiveTypeListResult() - * @model - * @generated - */ -public interface ETypedElementPrimitiveTypeListResult<T> extends ETypedElementResult { - /** - * Returns the value of the '<em><b>Result List</b></em>' attribute list. - * The list contents are of type {@link T}. - * <!-- begin-user-doc --> - * <p> - * If the meaning of the '<em>Result List</em>' attribute list isn't clear, - * there really should be more of a description here... - * </p> - * <!-- end-user-doc --> - * @return the value of the '<em>Result List</em>' attribute list. - * @see org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.runtime.RuntimePackage#getETypedElementPrimitiveTypeListResult_ResultList() - * @model - * @generated - */ - EList<T> getResultList(); - -} // ETypedElementPrimitiveTypeListResult
diff --git a/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/emf/facet/efacet/metamodel/v0_2_0/efacet/runtime/ETypedElementPrimitiveTypeResult.java b/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/emf/facet/efacet/metamodel/v0_2_0/efacet/runtime/ETypedElementPrimitiveTypeResult.java deleted file mode 100644 index 5c68115..0000000 --- a/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/emf/facet/efacet/metamodel/v0_2_0/efacet/runtime/ETypedElementPrimitiveTypeResult.java +++ /dev/null
@@ -1,70 +0,0 @@ -/** - * Copyright (c) 2011, 2012 Mia-Software. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Gregoire Dupe (Mia-Software) - Design - * Nicolas Guyomar (Mia-Software) - Implementation - * Emmanuelle Rouillé (Mia-Software) - Bug 352618 - To be able to use non derived facet structural features and save them values. - * Nicolas Bros (Mia-Software) - Bug 361823 - [Restructuring] eFacet2 meta-model - * Gregoire Dupe (Mia-Software) - Bug 366055 - NavigationQuery - * Gregoire Dupe (Mia-Software) - Bug 369673 - [Facet] IsOneOfQuery - * Olivier Remaud (Soft-Maint) - Bug 369824 - Add a simple way to return string literal constants from a customization query - * Gregoire Dupe (Mia-software) - Bug 369987 - [Restructuring][Table] Switch to the new customization and facet framework - * Gregoire Dupe (Mia-software) - Bug 364325 - [Restructuring] The user must be able to navigate into a model using the Facet. - */ -package org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.runtime; - - -/** - * <!-- begin-user-doc --> - * A representation of the model object '<em><b>ETyped Element Primitive Type Result</b></em>'. - * <!-- end-user-doc --> - * - * <!-- begin-model-doc --> - * This class represents the result of evaluating the value of a multiplicity-one DerivedTypedElement by means of a single-valued query . - * <!-- end-model-doc --> - * - * <p> - * The following features are supported: - * <ul> - * <li>{@link org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.runtime.ETypedElementPrimitiveTypeResult#getResult <em>Result</em>}</li> - * </ul> - * </p> - * - * @see org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.runtime.RuntimePackage#getETypedElementPrimitiveTypeResult() - * @model - * @generated - */ -public interface ETypedElementPrimitiveTypeResult<T> extends ETypedElementResult { - /** - * Returns the value of the '<em><b>Result</b></em>' attribute. - * <!-- begin-user-doc --> - * <p> - * If the meaning of the '<em>Result</em>' attribute isn't clear, - * there really should be more of a description here... - * </p> - * <!-- end-user-doc --> - * @return the value of the '<em>Result</em>' attribute. - * @see #setResult(Object) - * @see org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.runtime.RuntimePackage#getETypedElementPrimitiveTypeResult_Result() - * @model - * @generated - */ - T getResult(); - - /** - * Sets the value of the '{@link org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.runtime.ETypedElementPrimitiveTypeResult#getResult <em>Result</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @param value the new value of the '<em>Result</em>' attribute. - * @see #getResult() - * @generated - */ - void setResult(T value); - -} // ETypedElementPrimitiveTypeResult
diff --git a/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/emf/facet/efacet/metamodel/v0_2_0/efacet/runtime/ETypedElementResult.java b/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/emf/facet/efacet/metamodel/v0_2_0/efacet/runtime/ETypedElementResult.java deleted file mode 100644 index 5a6e43c..0000000 --- a/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/emf/facet/efacet/metamodel/v0_2_0/efacet/runtime/ETypedElementResult.java +++ /dev/null
@@ -1,143 +0,0 @@ -/** - * Copyright (c) 2011, 2012 Mia-Software. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Gregoire Dupe (Mia-Software) - Design - * Nicolas Guyomar (Mia-Software) - Implementation - * Emmanuelle Rouillé (Mia-Software) - Bug 352618 - To be able to use non derived facet structural features and save them values. - * Nicolas Bros (Mia-Software) - Bug 361823 - [Restructuring] eFacet2 meta-model - * Gregoire Dupe (Mia-Software) - Bug 366055 - NavigationQuery - * Gregoire Dupe (Mia-Software) - Bug 369673 - [Facet] IsOneOfQuery - * Olivier Remaud (Soft-Maint) - Bug 369824 - Add a simple way to return string literal constants from a customization query - * Gregoire Dupe (Mia-software) - Bug 369987 - [Restructuring][Table] Switch to the new customization and facet framework - * Gregoire Dupe (Mia-software) - Bug 364325 - [Restructuring] The user must be able to navigate into a model using the Facet. - */ -package org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.runtime; - -import org.eclipse.emf.common.util.EList; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.ETypedElement; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.ParameterValue; - -/** - * <!-- begin-user-doc --> - * A representation of the model object '<em><b>ETyped Element Result</b></em>'. - * <!-- end-user-doc --> - * - * <!-- begin-model-doc --> - * This class represents the result of evaluating the value of a DerivedTypedElement by means of a query . - * <!-- end-model-doc --> - * - * <p> - * The following features are supported: - * <ul> - * <li>{@link org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.runtime.ETypedElementResult#getDerivedTypedElement <em>Derived Typed Element</em>}</li> - * <li>{@link org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.runtime.ETypedElementResult#getParameterValues <em>Parameter Values</em>}</li> - * <li>{@link org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.runtime.ETypedElementResult#getSource <em>Source</em>}</li> - * <li>{@link org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.runtime.ETypedElementResult#getException <em>Exception</em>}</li> - * </ul> - * </p> - * - * @see org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.runtime.RuntimePackage#getETypedElementResult() - * @model abstract="true" - * @generated - */ -public interface ETypedElementResult extends EObject { - /** - * Returns the value of the '<em><b>Derived Typed Element</b></em>' reference. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * <!-- begin-model-doc --> - * The reference "query" references the executed query. - * <!-- end-model-doc --> - * @return the value of the '<em>Derived Typed Element</em>' reference. - * @see #setDerivedTypedElement(ETypedElement) - * @see org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.runtime.RuntimePackage#getETypedElementResult_DerivedTypedElement() - * @model required="true" - * @generated - */ - ETypedElement getDerivedTypedElement(); - - /** - * Sets the value of the '{@link org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.runtime.ETypedElementResult#getDerivedTypedElement <em>Derived Typed Element</em>}' reference. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @param value the new value of the '<em>Derived Typed Element</em>' reference. - * @see #getDerivedTypedElement() - * @generated - */ - void setDerivedTypedElement(ETypedElement value); - - /** - * Returns the value of the '<em><b>Parameter Values</b></em>' containment reference list. - * The list contents are of type {@link org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.ParameterValue}. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * <!-- begin-model-doc --> - * This is the list of the values given as parameters for the query execution. - * <!-- end-model-doc --> - * @return the value of the '<em>Parameter Values</em>' containment reference list. - * @see org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.runtime.RuntimePackage#getETypedElementResult_ParameterValues() - * @model containment="true" - * @generated - */ - EList<ParameterValue> getParameterValues(); - - /** - * Returns the value of the '<em><b>Source</b></em>' reference. - * <!-- begin-user-doc --> - * <p> - * If the meaning of the '<em>Source</em>' reference isn't clear, - * there really should be more of a description here... - * </p> - * <!-- end-user-doc --> - * @return the value of the '<em>Source</em>' reference. - * @see #setSource(EObject) - * @see org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.runtime.RuntimePackage#getETypedElementResult_Source() - * @model required="true" - * @generated - */ - EObject getSource(); - - /** - * Sets the value of the '{@link org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.runtime.ETypedElementResult#getSource <em>Source</em>}' reference. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @param value the new value of the '<em>Source</em>' reference. - * @see #getSource() - * @generated - */ - void setSource(EObject value); - - /** - * Returns the value of the '<em><b>Exception</b></em>' attribute. - * <!-- begin-user-doc --> - * <p> - * If the meaning of the '<em>Exception</em>' attribute isn't clear, - * there really should be more of a description here... - * </p> - * <!-- end-user-doc --> - * @return the value of the '<em>Exception</em>' attribute. - * @see #setException(Throwable) - * @see org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.runtime.RuntimePackage#getETypedElementResult_Exception() - * @model dataType="org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.runtime.JavaException" transient="true" - * @generated - */ - Throwable getException(); - - /** - * Sets the value of the '{@link org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.runtime.ETypedElementResult#getException <em>Exception</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @param value the new value of the '<em>Exception</em>' attribute. - * @see #getException() - * @generated - */ - void setException(Throwable value); - -} // ETypedElementResult
diff --git a/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/emf/facet/efacet/metamodel/v0_2_0/efacet/runtime/RuntimeFactory.java b/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/emf/facet/efacet/metamodel/v0_2_0/efacet/runtime/RuntimeFactory.java deleted file mode 100644 index af1f93d..0000000 --- a/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/emf/facet/efacet/metamodel/v0_2_0/efacet/runtime/RuntimeFactory.java +++ /dev/null
@@ -1,88 +0,0 @@ -/** - * Copyright (c) 2011, 2012 Mia-Software. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Gregoire Dupe (Mia-Software) - Design - * Nicolas Guyomar (Mia-Software) - Implementation - * Emmanuelle Rouillé (Mia-Software) - Bug 352618 - To be able to use non derived facet structural features and save them values. - * Nicolas Bros (Mia-Software) - Bug 361823 - [Restructuring] eFacet2 meta-model - * Gregoire Dupe (Mia-Software) - Bug 366055 - NavigationQuery - * Gregoire Dupe (Mia-Software) - Bug 369673 - [Facet] IsOneOfQuery - * Olivier Remaud (Soft-Maint) - Bug 369824 - Add a simple way to return string literal constants from a customization query - * Gregoire Dupe (Mia-software) - Bug 369987 - [Restructuring][Table] Switch to the new customization and facet framework - * Gregoire Dupe (Mia-software) - Bug 364325 - [Restructuring] The user must be able to navigate into a model using the Facet. - * Gregoire Dupe (Mia-Software) - Bug 373078 - API Cleaning - */ -package org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.runtime; - -import org.eclipse.emf.ecore.EFactory; -import org.eclipse.emf.ecore.EObject; - -/** - * <!-- begin-user-doc --> - * The <b>Factory</b> for the model. - * It provides a create method for each non-abstract class of the model. - * <!-- end-user-doc --> - * @see org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.runtime.RuntimePackage - * @generated - */ -public interface RuntimeFactory extends EFactory { - /** - * The singleton instance of the factory. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - RuntimeFactory eINSTANCE = org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.runtime.impl.RuntimeFactoryImpl.init(); - - /** - * Returns a new object of class '<em>ETyped Element Primitive Type Result</em>'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return a new object of class '<em>ETyped Element Primitive Type Result</em>'. - * @generated - */ - <T> ETypedElementPrimitiveTypeResult<T> createETypedElementPrimitiveTypeResult(); - - /** - * Returns a new object of class '<em>ETyped Element EObject Result</em>'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return a new object of class '<em>ETyped Element EObject Result</em>'. - * @generated - */ - <T extends EObject> ETypedElementEObjectResult<T> createETypedElementEObjectResult(); - - /** - * Returns a new object of class '<em>ETyped Element Primitive Type List Result</em>'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return a new object of class '<em>ETyped Element Primitive Type List Result</em>'. - * @generated - */ - <T> ETypedElementPrimitiveTypeListResult<T> createETypedElementPrimitiveTypeListResult(); - - /** - * Returns a new object of class '<em>ETyped Element EObject List Result</em>'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return a new object of class '<em>ETyped Element EObject List Result</em>'. - * @generated - */ - <T extends EObject> ETypedElementEObjectListResult<T> createETypedElementEObjectListResult(); - - /** - * Returns the package supported by this factory. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the package supported by this factory. - * @generated - */ - RuntimePackage getRuntimePackage(); - -} //RuntimeFactory
diff --git a/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/emf/facet/efacet/metamodel/v0_2_0/efacet/runtime/RuntimePackage.java b/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/emf/facet/efacet/metamodel/v0_2_0/efacet/runtime/RuntimePackage.java deleted file mode 100644 index 5223e7b..0000000 --- a/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/emf/facet/efacet/metamodel/v0_2_0/efacet/runtime/RuntimePackage.java +++ /dev/null
@@ -1,696 +0,0 @@ -/** - * Copyright (c) 2011, 2012 Mia-Software. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Gregoire Dupe (Mia-Software) - Design - * Nicolas Guyomar (Mia-Software) - Implementation - * Emmanuelle Rouillé (Mia-Software) - Bug 352618 - To be able to use non derived facet structural features and save them values. - * Nicolas Bros (Mia-Software) - Bug 361823 - [Restructuring] eFacet2 meta-model - * Gregoire Dupe (Mia-Software) - Bug 366055 - NavigationQuery - * Gregoire Dupe (Mia-Software) - Bug 369673 - [Facet] IsOneOfQuery - * Olivier Remaud (Soft-Maint) - Bug 369824 - Add a simple way to return string literal constants from a customization query - * Gregoire Dupe (Mia-software) - Bug 369987 - [Restructuring][Table] Switch to the new customization and facet framework - * Gregoire Dupe (Mia-software) - Bug 364325 - [Restructuring] The user must be able to navigate into a model using the Facet. - * Gregoire Dupe (Mia-Software) - Bug 373078 - API Cleaning - */ -package org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.runtime; - -import org.eclipse.emf.ecore.EAttribute; -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.ecore.EDataType; -import org.eclipse.emf.ecore.EPackage; -import org.eclipse.emf.ecore.EReference; - -/** - * <!-- begin-user-doc --> - * The <b>Package</b> for the model. - * It contains accessors for the meta objects to represent - * <ul> - * <li>each class,</li> - * <li>each feature of each class,</li> - * <li>each enum,</li> - * <li>and each data type</li> - * </ul> - * <!-- end-user-doc --> - * @see org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.runtime.RuntimeFactory - * @model kind="package" - * @generated - */ -public interface RuntimePackage extends EPackage { - /** - * The package name. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - String eNAME = "runtime"; //$NON-NLS-1$ - - /** - * The package namespace URI. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - String eNS_URI = "http://www.eclipse.org/emf/facet/efacet/0.2.incubation/efacet/runtime"; //$NON-NLS-1$ - - /** - * The package namespace name. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - String eNS_PREFIX = "runtime"; //$NON-NLS-1$ - - /** - * The singleton instance of the package. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - RuntimePackage eINSTANCE = org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.runtime.impl.RuntimePackageImpl.init(); - - /** - * The meta object id for the '{@link org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.runtime.impl.ETypedElementResultImpl <em>ETyped Element Result</em>}' class. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.runtime.impl.ETypedElementResultImpl - * @see org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.runtime.impl.RuntimePackageImpl#getETypedElementResult() - * @generated - */ - int ETYPED_ELEMENT_RESULT = 4; - - /** - * The feature id for the '<em><b>Derived Typed Element</b></em>' reference. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int ETYPED_ELEMENT_RESULT__DERIVED_TYPED_ELEMENT = 0; - - /** - * The feature id for the '<em><b>Parameter Values</b></em>' containment reference list. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int ETYPED_ELEMENT_RESULT__PARAMETER_VALUES = 1; - - /** - * The feature id for the '<em><b>Source</b></em>' reference. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int ETYPED_ELEMENT_RESULT__SOURCE = 2; - - /** - * The feature id for the '<em><b>Exception</b></em>' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int ETYPED_ELEMENT_RESULT__EXCEPTION = 3; - - /** - * The number of structural features of the '<em>ETyped Element Result</em>' class. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int ETYPED_ELEMENT_RESULT_FEATURE_COUNT = 4; - - /** - * The meta object id for the '{@link org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.runtime.impl.ETypedElementPrimitiveTypeResultImpl <em>ETyped Element Primitive Type Result</em>}' class. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.runtime.impl.ETypedElementPrimitiveTypeResultImpl - * @see org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.runtime.impl.RuntimePackageImpl#getETypedElementPrimitiveTypeResult() - * @generated - */ - int ETYPED_ELEMENT_PRIMITIVE_TYPE_RESULT = 0; - - /** - * The feature id for the '<em><b>Derived Typed Element</b></em>' reference. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int ETYPED_ELEMENT_PRIMITIVE_TYPE_RESULT__DERIVED_TYPED_ELEMENT = ETYPED_ELEMENT_RESULT__DERIVED_TYPED_ELEMENT; - - /** - * The feature id for the '<em><b>Parameter Values</b></em>' containment reference list. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int ETYPED_ELEMENT_PRIMITIVE_TYPE_RESULT__PARAMETER_VALUES = ETYPED_ELEMENT_RESULT__PARAMETER_VALUES; - - /** - * The feature id for the '<em><b>Source</b></em>' reference. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int ETYPED_ELEMENT_PRIMITIVE_TYPE_RESULT__SOURCE = ETYPED_ELEMENT_RESULT__SOURCE; - - /** - * The feature id for the '<em><b>Exception</b></em>' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int ETYPED_ELEMENT_PRIMITIVE_TYPE_RESULT__EXCEPTION = ETYPED_ELEMENT_RESULT__EXCEPTION; - - /** - * The feature id for the '<em><b>Result</b></em>' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int ETYPED_ELEMENT_PRIMITIVE_TYPE_RESULT__RESULT = ETYPED_ELEMENT_RESULT_FEATURE_COUNT + 0; - - /** - * The number of structural features of the '<em>ETyped Element Primitive Type Result</em>' class. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int ETYPED_ELEMENT_PRIMITIVE_TYPE_RESULT_FEATURE_COUNT = ETYPED_ELEMENT_RESULT_FEATURE_COUNT + 1; - - /** - * The meta object id for the '{@link org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.runtime.impl.ETypedElementEObjectResultImpl <em>ETyped Element EObject Result</em>}' class. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.runtime.impl.ETypedElementEObjectResultImpl - * @see org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.runtime.impl.RuntimePackageImpl#getETypedElementEObjectResult() - * @generated - */ - int ETYPED_ELEMENT_EOBJECT_RESULT = 1; - - /** - * The feature id for the '<em><b>Derived Typed Element</b></em>' reference. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int ETYPED_ELEMENT_EOBJECT_RESULT__DERIVED_TYPED_ELEMENT = ETYPED_ELEMENT_RESULT__DERIVED_TYPED_ELEMENT; - - /** - * The feature id for the '<em><b>Parameter Values</b></em>' containment reference list. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int ETYPED_ELEMENT_EOBJECT_RESULT__PARAMETER_VALUES = ETYPED_ELEMENT_RESULT__PARAMETER_VALUES; - - /** - * The feature id for the '<em><b>Source</b></em>' reference. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int ETYPED_ELEMENT_EOBJECT_RESULT__SOURCE = ETYPED_ELEMENT_RESULT__SOURCE; - - /** - * The feature id for the '<em><b>Exception</b></em>' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int ETYPED_ELEMENT_EOBJECT_RESULT__EXCEPTION = ETYPED_ELEMENT_RESULT__EXCEPTION; - - /** - * The feature id for the '<em><b>Result</b></em>' reference. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int ETYPED_ELEMENT_EOBJECT_RESULT__RESULT = ETYPED_ELEMENT_RESULT_FEATURE_COUNT + 0; - - /** - * The number of structural features of the '<em>ETyped Element EObject Result</em>' class. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int ETYPED_ELEMENT_EOBJECT_RESULT_FEATURE_COUNT = ETYPED_ELEMENT_RESULT_FEATURE_COUNT + 1; - - /** - * The meta object id for the '{@link org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.runtime.impl.ETypedElementPrimitiveTypeListResultImpl <em>ETyped Element Primitive Type List Result</em>}' class. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.runtime.impl.ETypedElementPrimitiveTypeListResultImpl - * @see org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.runtime.impl.RuntimePackageImpl#getETypedElementPrimitiveTypeListResult() - * @generated - */ - int ETYPED_ELEMENT_PRIMITIVE_TYPE_LIST_RESULT = 2; - - /** - * The feature id for the '<em><b>Derived Typed Element</b></em>' reference. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int ETYPED_ELEMENT_PRIMITIVE_TYPE_LIST_RESULT__DERIVED_TYPED_ELEMENT = ETYPED_ELEMENT_RESULT__DERIVED_TYPED_ELEMENT; - - /** - * The feature id for the '<em><b>Parameter Values</b></em>' containment reference list. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int ETYPED_ELEMENT_PRIMITIVE_TYPE_LIST_RESULT__PARAMETER_VALUES = ETYPED_ELEMENT_RESULT__PARAMETER_VALUES; - - /** - * The feature id for the '<em><b>Source</b></em>' reference. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int ETYPED_ELEMENT_PRIMITIVE_TYPE_LIST_RESULT__SOURCE = ETYPED_ELEMENT_RESULT__SOURCE; - - /** - * The feature id for the '<em><b>Exception</b></em>' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int ETYPED_ELEMENT_PRIMITIVE_TYPE_LIST_RESULT__EXCEPTION = ETYPED_ELEMENT_RESULT__EXCEPTION; - - /** - * The feature id for the '<em><b>Result List</b></em>' attribute list. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int ETYPED_ELEMENT_PRIMITIVE_TYPE_LIST_RESULT__RESULT_LIST = ETYPED_ELEMENT_RESULT_FEATURE_COUNT + 0; - - /** - * The number of structural features of the '<em>ETyped Element Primitive Type List Result</em>' class. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int ETYPED_ELEMENT_PRIMITIVE_TYPE_LIST_RESULT_FEATURE_COUNT = ETYPED_ELEMENT_RESULT_FEATURE_COUNT + 1; - - /** - * The meta object id for the '{@link org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.runtime.impl.ETypedElementEObjectListResultImpl <em>ETyped Element EObject List Result</em>}' class. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.runtime.impl.ETypedElementEObjectListResultImpl - * @see org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.runtime.impl.RuntimePackageImpl#getETypedElementEObjectListResult() - * @generated - */ - int ETYPED_ELEMENT_EOBJECT_LIST_RESULT = 3; - - /** - * The feature id for the '<em><b>Derived Typed Element</b></em>' reference. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int ETYPED_ELEMENT_EOBJECT_LIST_RESULT__DERIVED_TYPED_ELEMENT = ETYPED_ELEMENT_RESULT__DERIVED_TYPED_ELEMENT; - - /** - * The feature id for the '<em><b>Parameter Values</b></em>' containment reference list. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int ETYPED_ELEMENT_EOBJECT_LIST_RESULT__PARAMETER_VALUES = ETYPED_ELEMENT_RESULT__PARAMETER_VALUES; - - /** - * The feature id for the '<em><b>Source</b></em>' reference. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int ETYPED_ELEMENT_EOBJECT_LIST_RESULT__SOURCE = ETYPED_ELEMENT_RESULT__SOURCE; - - /** - * The feature id for the '<em><b>Exception</b></em>' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int ETYPED_ELEMENT_EOBJECT_LIST_RESULT__EXCEPTION = ETYPED_ELEMENT_RESULT__EXCEPTION; - - /** - * The feature id for the '<em><b>Result List</b></em>' reference list. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int ETYPED_ELEMENT_EOBJECT_LIST_RESULT__RESULT_LIST = ETYPED_ELEMENT_RESULT_FEATURE_COUNT + 0; - - /** - * The number of structural features of the '<em>ETyped Element EObject List Result</em>' class. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int ETYPED_ELEMENT_EOBJECT_LIST_RESULT_FEATURE_COUNT = ETYPED_ELEMENT_RESULT_FEATURE_COUNT + 1; - - /** - * The meta object id for the '<em>Java Exception</em>' data type. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see java.lang.Throwable - * @see org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.runtime.impl.RuntimePackageImpl#getJavaException() - * @generated - */ - int JAVA_EXCEPTION = 5; - - - /** - * Returns the meta object for class '{@link org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.runtime.ETypedElementPrimitiveTypeResult <em>ETyped Element Primitive Type Result</em>}'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the meta object for class '<em>ETyped Element Primitive Type Result</em>'. - * @see org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.runtime.ETypedElementPrimitiveTypeResult - * @generated - */ - EClass getETypedElementPrimitiveTypeResult(); - - /** - * Returns the meta object for the attribute '{@link org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.runtime.ETypedElementPrimitiveTypeResult#getResult <em>Result</em>}'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the meta object for the attribute '<em>Result</em>'. - * @see org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.runtime.ETypedElementPrimitiveTypeResult#getResult() - * @see #getETypedElementPrimitiveTypeResult() - * @generated - */ - EAttribute getETypedElementPrimitiveTypeResult_Result(); - - /** - * Returns the meta object for class '{@link org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.runtime.ETypedElementEObjectResult <em>ETyped Element EObject Result</em>}'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the meta object for class '<em>ETyped Element EObject Result</em>'. - * @see org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.runtime.ETypedElementEObjectResult - * @generated - */ - EClass getETypedElementEObjectResult(); - - /** - * Returns the meta object for the reference '{@link org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.runtime.ETypedElementEObjectResult#getResult <em>Result</em>}'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the meta object for the reference '<em>Result</em>'. - * @see org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.runtime.ETypedElementEObjectResult#getResult() - * @see #getETypedElementEObjectResult() - * @generated - */ - EReference getETypedElementEObjectResult_Result(); - - /** - * Returns the meta object for class '{@link org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.runtime.ETypedElementPrimitiveTypeListResult <em>ETyped Element Primitive Type List Result</em>}'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the meta object for class '<em>ETyped Element Primitive Type List Result</em>'. - * @see org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.runtime.ETypedElementPrimitiveTypeListResult - * @generated - */ - EClass getETypedElementPrimitiveTypeListResult(); - - /** - * Returns the meta object for the attribute list '{@link org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.runtime.ETypedElementPrimitiveTypeListResult#getResultList <em>Result List</em>}'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the meta object for the attribute list '<em>Result List</em>'. - * @see org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.runtime.ETypedElementPrimitiveTypeListResult#getResultList() - * @see #getETypedElementPrimitiveTypeListResult() - * @generated - */ - EAttribute getETypedElementPrimitiveTypeListResult_ResultList(); - - /** - * Returns the meta object for class '{@link org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.runtime.ETypedElementEObjectListResult <em>ETyped Element EObject List Result</em>}'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the meta object for class '<em>ETyped Element EObject List Result</em>'. - * @see org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.runtime.ETypedElementEObjectListResult - * @generated - */ - EClass getETypedElementEObjectListResult(); - - /** - * Returns the meta object for the reference list '{@link org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.runtime.ETypedElementEObjectListResult#getResultList <em>Result List</em>}'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the meta object for the reference list '<em>Result List</em>'. - * @see org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.runtime.ETypedElementEObjectListResult#getResultList() - * @see #getETypedElementEObjectListResult() - * @generated - */ - EReference getETypedElementEObjectListResult_ResultList(); - - /** - * Returns the meta object for class '{@link org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.runtime.ETypedElementResult <em>ETyped Element Result</em>}'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the meta object for class '<em>ETyped Element Result</em>'. - * @see org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.runtime.ETypedElementResult - * @generated - */ - EClass getETypedElementResult(); - - /** - * Returns the meta object for the reference '{@link org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.runtime.ETypedElementResult#getDerivedTypedElement <em>Derived Typed Element</em>}'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the meta object for the reference '<em>Derived Typed Element</em>'. - * @see org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.runtime.ETypedElementResult#getDerivedTypedElement() - * @see #getETypedElementResult() - * @generated - */ - EReference getETypedElementResult_DerivedTypedElement(); - - /** - * Returns the meta object for the containment reference list '{@link org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.runtime.ETypedElementResult#getParameterValues <em>Parameter Values</em>}'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the meta object for the containment reference list '<em>Parameter Values</em>'. - * @see org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.runtime.ETypedElementResult#getParameterValues() - * @see #getETypedElementResult() - * @generated - */ - EReference getETypedElementResult_ParameterValues(); - - /** - * Returns the meta object for the reference '{@link org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.runtime.ETypedElementResult#getSource <em>Source</em>}'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the meta object for the reference '<em>Source</em>'. - * @see org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.runtime.ETypedElementResult#getSource() - * @see #getETypedElementResult() - * @generated - */ - EReference getETypedElementResult_Source(); - - /** - * Returns the meta object for the attribute '{@link org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.runtime.ETypedElementResult#getException <em>Exception</em>}'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the meta object for the attribute '<em>Exception</em>'. - * @see org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.runtime.ETypedElementResult#getException() - * @see #getETypedElementResult() - * @generated - */ - EAttribute getETypedElementResult_Exception(); - - /** - * Returns the meta object for data type '{@link java.lang.Throwable <em>Java Exception</em>}'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the meta object for data type '<em>Java Exception</em>'. - * @see java.lang.Throwable - * @model instanceClass="java.lang.Throwable" - * @generated - */ - EDataType getJavaException(); - - /** - * Returns the factory that creates the instances of the model. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the factory that creates the instances of the model. - * @generated - */ - RuntimeFactory getRuntimeFactory(); - - /** - * <!-- begin-user-doc --> - * Defines literals for the meta objects that represent - * <ul> - * <li>each class,</li> - * <li>each feature of each class,</li> - * <li>each enum,</li> - * <li>and each data type</li> - * </ul> - * <!-- end-user-doc --> - * @generated - */ - interface Literals { - /** - * The meta object literal for the '{@link org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.runtime.impl.ETypedElementPrimitiveTypeResultImpl <em>ETyped Element Primitive Type Result</em>}' class. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.runtime.impl.ETypedElementPrimitiveTypeResultImpl - * @see org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.runtime.impl.RuntimePackageImpl#getETypedElementPrimitiveTypeResult() - * @generated - */ - EClass ETYPED_ELEMENT_PRIMITIVE_TYPE_RESULT = eINSTANCE.getETypedElementPrimitiveTypeResult(); - - /** - * The meta object literal for the '<em><b>Result</b></em>' attribute feature. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - EAttribute ETYPED_ELEMENT_PRIMITIVE_TYPE_RESULT__RESULT = eINSTANCE.getETypedElementPrimitiveTypeResult_Result(); - - /** - * The meta object literal for the '{@link org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.runtime.impl.ETypedElementEObjectResultImpl <em>ETyped Element EObject Result</em>}' class. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.runtime.impl.ETypedElementEObjectResultImpl - * @see org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.runtime.impl.RuntimePackageImpl#getETypedElementEObjectResult() - * @generated - */ - EClass ETYPED_ELEMENT_EOBJECT_RESULT = eINSTANCE.getETypedElementEObjectResult(); - - /** - * The meta object literal for the '<em><b>Result</b></em>' reference feature. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - EReference ETYPED_ELEMENT_EOBJECT_RESULT__RESULT = eINSTANCE.getETypedElementEObjectResult_Result(); - - /** - * The meta object literal for the '{@link org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.runtime.impl.ETypedElementPrimitiveTypeListResultImpl <em>ETyped Element Primitive Type List Result</em>}' class. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.runtime.impl.ETypedElementPrimitiveTypeListResultImpl - * @see org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.runtime.impl.RuntimePackageImpl#getETypedElementPrimitiveTypeListResult() - * @generated - */ - EClass ETYPED_ELEMENT_PRIMITIVE_TYPE_LIST_RESULT = eINSTANCE.getETypedElementPrimitiveTypeListResult(); - - /** - * The meta object literal for the '<em><b>Result List</b></em>' attribute list feature. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - EAttribute ETYPED_ELEMENT_PRIMITIVE_TYPE_LIST_RESULT__RESULT_LIST = eINSTANCE.getETypedElementPrimitiveTypeListResult_ResultList(); - - /** - * The meta object literal for the '{@link org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.runtime.impl.ETypedElementEObjectListResultImpl <em>ETyped Element EObject List Result</em>}' class. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.runtime.impl.ETypedElementEObjectListResultImpl - * @see org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.runtime.impl.RuntimePackageImpl#getETypedElementEObjectListResult() - * @generated - */ - EClass ETYPED_ELEMENT_EOBJECT_LIST_RESULT = eINSTANCE.getETypedElementEObjectListResult(); - - /** - * The meta object literal for the '<em><b>Result List</b></em>' reference list feature. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - EReference ETYPED_ELEMENT_EOBJECT_LIST_RESULT__RESULT_LIST = eINSTANCE.getETypedElementEObjectListResult_ResultList(); - - /** - * The meta object literal for the '{@link org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.runtime.impl.ETypedElementResultImpl <em>ETyped Element Result</em>}' class. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.runtime.impl.ETypedElementResultImpl - * @see org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.runtime.impl.RuntimePackageImpl#getETypedElementResult() - * @generated - */ - EClass ETYPED_ELEMENT_RESULT = eINSTANCE.getETypedElementResult(); - - /** - * The meta object literal for the '<em><b>Derived Typed Element</b></em>' reference feature. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - EReference ETYPED_ELEMENT_RESULT__DERIVED_TYPED_ELEMENT = eINSTANCE.getETypedElementResult_DerivedTypedElement(); - - /** - * The meta object literal for the '<em><b>Parameter Values</b></em>' containment reference list feature. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - EReference ETYPED_ELEMENT_RESULT__PARAMETER_VALUES = eINSTANCE.getETypedElementResult_ParameterValues(); - - /** - * The meta object literal for the '<em><b>Source</b></em>' reference feature. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - EReference ETYPED_ELEMENT_RESULT__SOURCE = eINSTANCE.getETypedElementResult_Source(); - - /** - * The meta object literal for the '<em><b>Exception</b></em>' attribute feature. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - EAttribute ETYPED_ELEMENT_RESULT__EXCEPTION = eINSTANCE.getETypedElementResult_Exception(); - - /** - * The meta object literal for the '<em>Java Exception</em>' data type. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see java.lang.Throwable - * @see org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.runtime.impl.RuntimePackageImpl#getJavaException() - * @generated - */ - EDataType JAVA_EXCEPTION = eINSTANCE.getJavaException(); - - } - -} //RuntimePackage
diff --git a/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/emf/facet/efacet/metamodel/v0_2_0/efacet/runtime/impl/ETypedElementEObjectListResultImpl.java b/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/emf/facet/efacet/metamodel/v0_2_0/efacet/runtime/impl/ETypedElementEObjectListResultImpl.java deleted file mode 100644 index f2357eb..0000000 --- a/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/emf/facet/efacet/metamodel/v0_2_0/efacet/runtime/impl/ETypedElementEObjectListResultImpl.java +++ /dev/null
@@ -1,146 +0,0 @@ -/** - * Copyright (c) 2011, 2012 Mia-Software. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Gregoire Dupe (Mia-Software) - Design - * Nicolas Guyomar (Mia-Software) - Implementation - * Emmanuelle Rouillé (Mia-Software) - Bug 352618 - To be able to use non derived facet structural features and save them values. - * Nicolas Bros (Mia-Software) - Bug 361823 - [Restructuring] eFacet2 meta-model - * Gregoire Dupe (Mia-Software) - Bug 366055 - NavigationQuery - * Gregoire Dupe (Mia-Software) - Bug 369673 - [Facet] IsOneOfQuery - * Olivier Remaud (Soft-Maint) - Bug 369824 - Add a simple way to return string literal constants from a customization query - * Gregoire Dupe (Mia-software) - Bug 369987 - [Restructuring][Table] Switch to the new customization and facet framework - * Gregoire Dupe (Mia-software) - Bug 364325 - [Restructuring] The user must be able to navigate into a model using the Facet. - */ -package org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.runtime.impl; - -import java.util.Collection; - -import org.eclipse.emf.common.util.EList; -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.util.EObjectResolvingEList; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.runtime.ETypedElementEObjectListResult; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.runtime.RuntimePackage; - -/** - * <!-- begin-user-doc --> - * An implementation of the model object '<em><b>ETyped Element EObject List Result</b></em>'. - * <!-- end-user-doc --> - * <p> - * The following features are implemented: - * <ul> - * <li>{@link org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.runtime.impl.ETypedElementEObjectListResultImpl#getResultList <em>Result List</em>}</li> - * </ul> - * </p> - * - * @generated - */ -public class ETypedElementEObjectListResultImpl<T extends EObject> extends ETypedElementResultImpl implements ETypedElementEObjectListResult<T> { - /** - * The cached value of the '{@link #getResultList() <em>Result List</em>}' reference list. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #getResultList() - * @generated - * @ordered - */ - protected EList<T> resultList; - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected ETypedElementEObjectListResultImpl() { - super(); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - protected EClass eStaticClass() { - return RuntimePackage.Literals.ETYPED_ELEMENT_EOBJECT_LIST_RESULT; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EList<T> getResultList() { - if (resultList == null) { - resultList = new EObjectResolvingEList<T>(EObject.class, this, RuntimePackage.ETYPED_ELEMENT_EOBJECT_LIST_RESULT__RESULT_LIST); - } - return resultList; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public Object eGet(int featureID, boolean resolve, boolean coreType) { - switch (featureID) { - case RuntimePackage.ETYPED_ELEMENT_EOBJECT_LIST_RESULT__RESULT_LIST: - return getResultList(); - } - return super.eGet(featureID, resolve, coreType); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @SuppressWarnings("unchecked") - @Override - public void eSet(int featureID, Object newValue) { - switch (featureID) { - case RuntimePackage.ETYPED_ELEMENT_EOBJECT_LIST_RESULT__RESULT_LIST: - getResultList().clear(); - getResultList().addAll((Collection<? extends T>)newValue); - return; - } - super.eSet(featureID, newValue); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public void eUnset(int featureID) { - switch (featureID) { - case RuntimePackage.ETYPED_ELEMENT_EOBJECT_LIST_RESULT__RESULT_LIST: - getResultList().clear(); - return; - } - super.eUnset(featureID); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public boolean eIsSet(int featureID) { - switch (featureID) { - case RuntimePackage.ETYPED_ELEMENT_EOBJECT_LIST_RESULT__RESULT_LIST: - return resultList != null && !resultList.isEmpty(); - } - return super.eIsSet(featureID); - } - -} //ETypedElementEObjectListResultImpl
diff --git a/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/emf/facet/efacet/metamodel/v0_2_0/efacet/runtime/impl/ETypedElementEObjectResultImpl.java b/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/emf/facet/efacet/metamodel/v0_2_0/efacet/runtime/impl/ETypedElementEObjectResultImpl.java deleted file mode 100644 index d37ff03..0000000 --- a/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/emf/facet/efacet/metamodel/v0_2_0/efacet/runtime/impl/ETypedElementEObjectResultImpl.java +++ /dev/null
@@ -1,172 +0,0 @@ -/** - * Copyright (c) 2011, 2012 Mia-Software. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Gregoire Dupe (Mia-Software) - Design - * Nicolas Guyomar (Mia-Software) - Implementation - * Emmanuelle Rouillé (Mia-Software) - Bug 352618 - To be able to use non derived facet structural features and save them values. - * Nicolas Bros (Mia-Software) - Bug 361823 - [Restructuring] eFacet2 meta-model - * Gregoire Dupe (Mia-Software) - Bug 366055 - NavigationQuery - * Gregoire Dupe (Mia-Software) - Bug 369673 - [Facet] IsOneOfQuery - * Olivier Remaud (Soft-Maint) - Bug 369824 - Add a simple way to return string literal constants from a customization query - * Gregoire Dupe (Mia-software) - Bug 369987 - [Restructuring][Table] Switch to the new customization and facet framework - * Gregoire Dupe (Mia-software) - Bug 364325 - [Restructuring] The user must be able to navigate into a model using the Facet. - */ -package org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.runtime.impl; - -import org.eclipse.emf.common.notify.Notification; -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.InternalEObject; -import org.eclipse.emf.ecore.impl.ENotificationImpl; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.runtime.ETypedElementEObjectResult; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.runtime.RuntimePackage; - -/** - * <!-- begin-user-doc --> - * An implementation of the model object '<em><b>ETyped Element EObject Result</b></em>'. - * <!-- end-user-doc --> - * <p> - * The following features are implemented: - * <ul> - * <li>{@link org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.runtime.impl.ETypedElementEObjectResultImpl#getResult <em>Result</em>}</li> - * </ul> - * </p> - * - * @generated - */ -public class ETypedElementEObjectResultImpl<T extends EObject> extends ETypedElementResultImpl implements ETypedElementEObjectResult<T> { - /** - * The cached value of the '{@link #getResult() <em>Result</em>}' reference. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #getResult() - * @generated - * @ordered - */ - protected T result; - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected ETypedElementEObjectResultImpl() { - super(); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - protected EClass eStaticClass() { - return RuntimePackage.Literals.ETYPED_ELEMENT_EOBJECT_RESULT; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @SuppressWarnings("unchecked") - public T getResult() { - if (result != null && result.eIsProxy()) { - InternalEObject oldResult = (InternalEObject)result; - result = (T)eResolveProxy(oldResult); - if (result != oldResult) { - if (eNotificationRequired()) - eNotify(new ENotificationImpl(this, Notification.RESOLVE, RuntimePackage.ETYPED_ELEMENT_EOBJECT_RESULT__RESULT, oldResult, result)); - } - } - return result; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public T basicGetResult() { - return result; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public void setResult(T newResult) { - T oldResult = result; - result = newResult; - if (eNotificationRequired()) - eNotify(new ENotificationImpl(this, Notification.SET, RuntimePackage.ETYPED_ELEMENT_EOBJECT_RESULT__RESULT, oldResult, result)); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public Object eGet(int featureID, boolean resolve, boolean coreType) { - switch (featureID) { - case RuntimePackage.ETYPED_ELEMENT_EOBJECT_RESULT__RESULT: - if (resolve) return getResult(); - return basicGetResult(); - } - return super.eGet(featureID, resolve, coreType); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @SuppressWarnings("unchecked") - @Override - public void eSet(int featureID, Object newValue) { - switch (featureID) { - case RuntimePackage.ETYPED_ELEMENT_EOBJECT_RESULT__RESULT: - setResult((T)newValue); - return; - } - super.eSet(featureID, newValue); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public void eUnset(int featureID) { - switch (featureID) { - case RuntimePackage.ETYPED_ELEMENT_EOBJECT_RESULT__RESULT: - setResult((T)null); - return; - } - super.eUnset(featureID); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public boolean eIsSet(int featureID) { - switch (featureID) { - case RuntimePackage.ETYPED_ELEMENT_EOBJECT_RESULT__RESULT: - return result != null; - } - return super.eIsSet(featureID); - } - -} //ETypedElementEObjectResultImpl
diff --git a/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/emf/facet/efacet/metamodel/v0_2_0/efacet/runtime/impl/ETypedElementPrimitiveTypeListResultImpl.java b/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/emf/facet/efacet/metamodel/v0_2_0/efacet/runtime/impl/ETypedElementPrimitiveTypeListResultImpl.java deleted file mode 100644 index c320f85..0000000 --- a/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/emf/facet/efacet/metamodel/v0_2_0/efacet/runtime/impl/ETypedElementPrimitiveTypeListResultImpl.java +++ /dev/null
@@ -1,161 +0,0 @@ -/** - * Copyright (c) 2011, 2012 Mia-Software. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Gregoire Dupe (Mia-Software) - Design - * Nicolas Guyomar (Mia-Software) - Implementation - * Emmanuelle Rouillé (Mia-Software) - Bug 352618 - To be able to use non derived facet structural features and save them values. - * Nicolas Bros (Mia-Software) - Bug 361823 - [Restructuring] eFacet2 meta-model - * Gregoire Dupe (Mia-Software) - Bug 366055 - NavigationQuery - * Gregoire Dupe (Mia-Software) - Bug 369673 - [Facet] IsOneOfQuery - * Olivier Remaud (Soft-Maint) - Bug 369824 - Add a simple way to return string literal constants from a customization query - * Gregoire Dupe (Mia-software) - Bug 369987 - [Restructuring][Table] Switch to the new customization and facet framework - * Gregoire Dupe (Mia-software) - Bug 364325 - [Restructuring] The user must be able to navigate into a model using the Facet. - */ -package org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.runtime.impl; - -import java.util.Collection; - -import org.eclipse.emf.common.util.EList; -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.ecore.util.EDataTypeUniqueEList; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.runtime.ETypedElementPrimitiveTypeListResult; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.runtime.RuntimePackage; - -/** - * <!-- begin-user-doc --> - * An implementation of the model object '<em><b>ETyped Element Primitive Type List Result</b></em>'. - * <!-- end-user-doc --> - * <p> - * The following features are implemented: - * <ul> - * <li>{@link org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.runtime.impl.ETypedElementPrimitiveTypeListResultImpl#getResultList <em>Result List</em>}</li> - * </ul> - * </p> - * - * @generated - */ -public class ETypedElementPrimitiveTypeListResultImpl<T> extends ETypedElementResultImpl implements ETypedElementPrimitiveTypeListResult<T> { - /** - * The cached value of the '{@link #getResultList() <em>Result List</em>}' attribute list. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #getResultList() - * @generated - * @ordered - */ - protected EList<T> resultList; - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected ETypedElementPrimitiveTypeListResultImpl() { - super(); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - protected EClass eStaticClass() { - return RuntimePackage.Literals.ETYPED_ELEMENT_PRIMITIVE_TYPE_LIST_RESULT; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EList<T> getResultList() { - if (resultList == null) { - resultList = new EDataTypeUniqueEList<T>(Object.class, this, RuntimePackage.ETYPED_ELEMENT_PRIMITIVE_TYPE_LIST_RESULT__RESULT_LIST); - } - return resultList; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public Object eGet(int featureID, boolean resolve, boolean coreType) { - switch (featureID) { - case RuntimePackage.ETYPED_ELEMENT_PRIMITIVE_TYPE_LIST_RESULT__RESULT_LIST: - return getResultList(); - } - return super.eGet(featureID, resolve, coreType); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @SuppressWarnings("unchecked") - @Override - public void eSet(int featureID, Object newValue) { - switch (featureID) { - case RuntimePackage.ETYPED_ELEMENT_PRIMITIVE_TYPE_LIST_RESULT__RESULT_LIST: - getResultList().clear(); - getResultList().addAll((Collection<? extends T>)newValue); - return; - } - super.eSet(featureID, newValue); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public void eUnset(int featureID) { - switch (featureID) { - case RuntimePackage.ETYPED_ELEMENT_PRIMITIVE_TYPE_LIST_RESULT__RESULT_LIST: - getResultList().clear(); - return; - } - super.eUnset(featureID); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public boolean eIsSet(int featureID) { - switch (featureID) { - case RuntimePackage.ETYPED_ELEMENT_PRIMITIVE_TYPE_LIST_RESULT__RESULT_LIST: - return resultList != null && !resultList.isEmpty(); - } - return super.eIsSet(featureID); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public String toString() { - if (eIsProxy()) return super.toString(); - - StringBuffer result = new StringBuffer(super.toString()); - result.append(" (resultList: "); //$NON-NLS-1$ - result.append(resultList); - result.append(')'); - return result.toString(); - } - -} //ETypedElementPrimitiveTypeListResultImpl
diff --git a/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/emf/facet/efacet/metamodel/v0_2_0/efacet/runtime/impl/ETypedElementPrimitiveTypeResultImpl.java b/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/emf/facet/efacet/metamodel/v0_2_0/efacet/runtime/impl/ETypedElementPrimitiveTypeResultImpl.java deleted file mode 100644 index c5c01ca..0000000 --- a/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/emf/facet/efacet/metamodel/v0_2_0/efacet/runtime/impl/ETypedElementPrimitiveTypeResultImpl.java +++ /dev/null
@@ -1,167 +0,0 @@ -/** - * Copyright (c) 2011, 2012 Mia-Software. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Gregoire Dupe (Mia-Software) - Design - * Nicolas Guyomar (Mia-Software) - Implementation - * Emmanuelle Rouillé (Mia-Software) - Bug 352618 - To be able to use non derived facet structural features and save them values. - * Nicolas Bros (Mia-Software) - Bug 361823 - [Restructuring] eFacet2 meta-model - * Gregoire Dupe (Mia-Software) - Bug 366055 - NavigationQuery - * Gregoire Dupe (Mia-Software) - Bug 369673 - [Facet] IsOneOfQuery - * Olivier Remaud (Soft-Maint) - Bug 369824 - Add a simple way to return string literal constants from a customization query - * Gregoire Dupe (Mia-software) - Bug 369987 - [Restructuring][Table] Switch to the new customization and facet framework - * Gregoire Dupe (Mia-software) - Bug 364325 - [Restructuring] The user must be able to navigate into a model using the Facet. - */ -package org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.runtime.impl; - -import org.eclipse.emf.common.notify.Notification; -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.ecore.impl.ENotificationImpl; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.runtime.ETypedElementPrimitiveTypeResult; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.runtime.RuntimePackage; - -/** - * <!-- begin-user-doc --> - * An implementation of the model object '<em><b>ETyped Element Primitive Type Result</b></em>'. - * <!-- end-user-doc --> - * <p> - * The following features are implemented: - * <ul> - * <li>{@link org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.runtime.impl.ETypedElementPrimitiveTypeResultImpl#getResult <em>Result</em>}</li> - * </ul> - * </p> - * - * @generated - */ -public class ETypedElementPrimitiveTypeResultImpl<T> extends ETypedElementResultImpl implements ETypedElementPrimitiveTypeResult<T> { - /** - * The cached value of the '{@link #getResult() <em>Result</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #getResult() - * @generated - * @ordered - */ - protected T result; - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected ETypedElementPrimitiveTypeResultImpl() { - super(); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - protected EClass eStaticClass() { - return RuntimePackage.Literals.ETYPED_ELEMENT_PRIMITIVE_TYPE_RESULT; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public T getResult() { - return result; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public void setResult(T newResult) { - T oldResult = result; - result = newResult; - if (eNotificationRequired()) - eNotify(new ENotificationImpl(this, Notification.SET, RuntimePackage.ETYPED_ELEMENT_PRIMITIVE_TYPE_RESULT__RESULT, oldResult, result)); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public Object eGet(int featureID, boolean resolve, boolean coreType) { - switch (featureID) { - case RuntimePackage.ETYPED_ELEMENT_PRIMITIVE_TYPE_RESULT__RESULT: - return getResult(); - } - return super.eGet(featureID, resolve, coreType); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @SuppressWarnings("unchecked") - @Override - public void eSet(int featureID, Object newValue) { - switch (featureID) { - case RuntimePackage.ETYPED_ELEMENT_PRIMITIVE_TYPE_RESULT__RESULT: - setResult((T)newValue); - return; - } - super.eSet(featureID, newValue); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public void eUnset(int featureID) { - switch (featureID) { - case RuntimePackage.ETYPED_ELEMENT_PRIMITIVE_TYPE_RESULT__RESULT: - setResult((T)null); - return; - } - super.eUnset(featureID); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public boolean eIsSet(int featureID) { - switch (featureID) { - case RuntimePackage.ETYPED_ELEMENT_PRIMITIVE_TYPE_RESULT__RESULT: - return result != null; - } - return super.eIsSet(featureID); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public String toString() { - if (eIsProxy()) return super.toString(); - - StringBuffer result = new StringBuffer(super.toString()); - result.append(" (result: "); //$NON-NLS-1$ - result.append(result); - result.append(')'); - return result.toString(); - } - -} //ETypedElementPrimitiveTypeResultImpl
diff --git a/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/emf/facet/efacet/metamodel/v0_2_0/efacet/runtime/impl/ETypedElementResultImpl.java b/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/emf/facet/efacet/metamodel/v0_2_0/efacet/runtime/impl/ETypedElementResultImpl.java deleted file mode 100644 index cf42a90..0000000 --- a/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/emf/facet/efacet/metamodel/v0_2_0/efacet/runtime/impl/ETypedElementResultImpl.java +++ /dev/null
@@ -1,356 +0,0 @@ -/** - * Copyright (c) 2011, 2012 Mia-Software. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Gregoire Dupe (Mia-Software) - Design - * Nicolas Guyomar (Mia-Software) - Implementation - * Emmanuelle Rouillé (Mia-Software) - Bug 352618 - To be able to use non derived facet structural features and save them values. - * Nicolas Bros (Mia-Software) - Bug 361823 - [Restructuring] eFacet2 meta-model - * Gregoire Dupe (Mia-Software) - Bug 366055 - NavigationQuery - * Gregoire Dupe (Mia-Software) - Bug 369673 - [Facet] IsOneOfQuery - * Olivier Remaud (Soft-Maint) - Bug 369824 - Add a simple way to return string literal constants from a customization query - * Gregoire Dupe (Mia-software) - Bug 369987 - [Restructuring][Table] Switch to the new customization and facet framework - * Gregoire Dupe (Mia-software) - Bug 364325 - [Restructuring] The user must be able to navigate into a model using the Facet. - */ -package org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.runtime.impl; - -import java.util.Collection; - -import org.eclipse.emf.common.notify.Notification; -import org.eclipse.emf.common.notify.NotificationChain; -import org.eclipse.emf.common.util.EList; -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.ETypedElement; -import org.eclipse.emf.ecore.InternalEObject; -import org.eclipse.emf.ecore.impl.ENotificationImpl; -import org.eclipse.emf.ecore.impl.EObjectImpl; -import org.eclipse.emf.ecore.util.EObjectContainmentEList; -import org.eclipse.emf.ecore.util.InternalEList; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.ParameterValue; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.runtime.ETypedElementResult; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.runtime.RuntimePackage; - -/** - * <!-- begin-user-doc --> - * An implementation of the model object '<em><b>ETyped Element Result</b></em>'. - * <!-- end-user-doc --> - * <p> - * The following features are implemented: - * <ul> - * <li>{@link org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.runtime.impl.ETypedElementResultImpl#getDerivedTypedElement <em>Derived Typed Element</em>}</li> - * <li>{@link org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.runtime.impl.ETypedElementResultImpl#getParameterValues <em>Parameter Values</em>}</li> - * <li>{@link org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.runtime.impl.ETypedElementResultImpl#getSource <em>Source</em>}</li> - * <li>{@link org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.runtime.impl.ETypedElementResultImpl#getException <em>Exception</em>}</li> - * </ul> - * </p> - * - * @generated - */ -public abstract class ETypedElementResultImpl extends EObjectImpl implements ETypedElementResult { - /** - * The cached value of the '{@link #getDerivedTypedElement() <em>Derived Typed Element</em>}' reference. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #getDerivedTypedElement() - * @generated - * @ordered - */ - protected ETypedElement derivedTypedElement; - - /** - * The cached value of the '{@link #getParameterValues() <em>Parameter Values</em>}' containment reference list. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #getParameterValues() - * @generated - * @ordered - */ - protected EList<ParameterValue> parameterValues; - - /** - * The cached value of the '{@link #getSource() <em>Source</em>}' reference. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #getSource() - * @generated - * @ordered - */ - protected EObject source; - - /** - * The default value of the '{@link #getException() <em>Exception</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #getException() - * @generated - * @ordered - */ - protected static final Throwable EXCEPTION_EDEFAULT = null; - - /** - * The cached value of the '{@link #getException() <em>Exception</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #getException() - * @generated - * @ordered - */ - protected Throwable exception = EXCEPTION_EDEFAULT; - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected ETypedElementResultImpl() { - super(); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - protected EClass eStaticClass() { - return RuntimePackage.Literals.ETYPED_ELEMENT_RESULT; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public ETypedElement getDerivedTypedElement() { - if (derivedTypedElement != null && derivedTypedElement.eIsProxy()) { - InternalEObject oldDerivedTypedElement = (InternalEObject)derivedTypedElement; - derivedTypedElement = (ETypedElement)eResolveProxy(oldDerivedTypedElement); - if (derivedTypedElement != oldDerivedTypedElement) { - if (eNotificationRequired()) - eNotify(new ENotificationImpl(this, Notification.RESOLVE, RuntimePackage.ETYPED_ELEMENT_RESULT__DERIVED_TYPED_ELEMENT, oldDerivedTypedElement, derivedTypedElement)); - } - } - return derivedTypedElement; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public ETypedElement basicGetDerivedTypedElement() { - return derivedTypedElement; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public void setDerivedTypedElement(ETypedElement newDerivedTypedElement) { - ETypedElement oldDerivedTypedElement = derivedTypedElement; - derivedTypedElement = newDerivedTypedElement; - if (eNotificationRequired()) - eNotify(new ENotificationImpl(this, Notification.SET, RuntimePackage.ETYPED_ELEMENT_RESULT__DERIVED_TYPED_ELEMENT, oldDerivedTypedElement, derivedTypedElement)); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EList<ParameterValue> getParameterValues() { - if (parameterValues == null) { - parameterValues = new EObjectContainmentEList<ParameterValue>(ParameterValue.class, this, RuntimePackage.ETYPED_ELEMENT_RESULT__PARAMETER_VALUES); - } - return parameterValues; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EObject getSource() { - if (source != null && source.eIsProxy()) { - InternalEObject oldSource = (InternalEObject)source; - source = eResolveProxy(oldSource); - if (source != oldSource) { - if (eNotificationRequired()) - eNotify(new ENotificationImpl(this, Notification.RESOLVE, RuntimePackage.ETYPED_ELEMENT_RESULT__SOURCE, oldSource, source)); - } - } - return source; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EObject basicGetSource() { - return source; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public void setSource(EObject newSource) { - EObject oldSource = source; - source = newSource; - if (eNotificationRequired()) - eNotify(new ENotificationImpl(this, Notification.SET, RuntimePackage.ETYPED_ELEMENT_RESULT__SOURCE, oldSource, source)); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public Throwable getException() { - return exception; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public void setException(Throwable newException) { - Throwable oldException = exception; - exception = newException; - if (eNotificationRequired()) - eNotify(new ENotificationImpl(this, Notification.SET, RuntimePackage.ETYPED_ELEMENT_RESULT__EXCEPTION, oldException, exception)); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { - switch (featureID) { - case RuntimePackage.ETYPED_ELEMENT_RESULT__PARAMETER_VALUES: - return ((InternalEList<?>)getParameterValues()).basicRemove(otherEnd, msgs); - } - return super.eInverseRemove(otherEnd, featureID, msgs); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public Object eGet(int featureID, boolean resolve, boolean coreType) { - switch (featureID) { - case RuntimePackage.ETYPED_ELEMENT_RESULT__DERIVED_TYPED_ELEMENT: - if (resolve) return getDerivedTypedElement(); - return basicGetDerivedTypedElement(); - case RuntimePackage.ETYPED_ELEMENT_RESULT__PARAMETER_VALUES: - return getParameterValues(); - case RuntimePackage.ETYPED_ELEMENT_RESULT__SOURCE: - if (resolve) return getSource(); - return basicGetSource(); - case RuntimePackage.ETYPED_ELEMENT_RESULT__EXCEPTION: - return getException(); - } - return super.eGet(featureID, resolve, coreType); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @SuppressWarnings("unchecked") - @Override - public void eSet(int featureID, Object newValue) { - switch (featureID) { - case RuntimePackage.ETYPED_ELEMENT_RESULT__DERIVED_TYPED_ELEMENT: - setDerivedTypedElement((ETypedElement)newValue); - return; - case RuntimePackage.ETYPED_ELEMENT_RESULT__PARAMETER_VALUES: - getParameterValues().clear(); - getParameterValues().addAll((Collection<? extends ParameterValue>)newValue); - return; - case RuntimePackage.ETYPED_ELEMENT_RESULT__SOURCE: - setSource((EObject)newValue); - return; - case RuntimePackage.ETYPED_ELEMENT_RESULT__EXCEPTION: - setException((Throwable)newValue); - return; - } - super.eSet(featureID, newValue); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public void eUnset(int featureID) { - switch (featureID) { - case RuntimePackage.ETYPED_ELEMENT_RESULT__DERIVED_TYPED_ELEMENT: - setDerivedTypedElement((ETypedElement)null); - return; - case RuntimePackage.ETYPED_ELEMENT_RESULT__PARAMETER_VALUES: - getParameterValues().clear(); - return; - case RuntimePackage.ETYPED_ELEMENT_RESULT__SOURCE: - setSource((EObject)null); - return; - case RuntimePackage.ETYPED_ELEMENT_RESULT__EXCEPTION: - setException(EXCEPTION_EDEFAULT); - return; - } - super.eUnset(featureID); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public boolean eIsSet(int featureID) { - switch (featureID) { - case RuntimePackage.ETYPED_ELEMENT_RESULT__DERIVED_TYPED_ELEMENT: - return derivedTypedElement != null; - case RuntimePackage.ETYPED_ELEMENT_RESULT__PARAMETER_VALUES: - return parameterValues != null && !parameterValues.isEmpty(); - case RuntimePackage.ETYPED_ELEMENT_RESULT__SOURCE: - return source != null; - case RuntimePackage.ETYPED_ELEMENT_RESULT__EXCEPTION: - return EXCEPTION_EDEFAULT == null ? exception != null : !EXCEPTION_EDEFAULT.equals(exception); - } - return super.eIsSet(featureID); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public String toString() { - if (eIsProxy()) return super.toString(); - - StringBuffer result = new StringBuffer(super.toString()); - result.append(" (exception: "); //$NON-NLS-1$ - result.append(exception); - result.append(')'); - return result.toString(); - } - -} //ETypedElementResultImpl
diff --git a/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/emf/facet/efacet/metamodel/v0_2_0/efacet/runtime/impl/RuntimeFactoryImpl.java b/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/emf/facet/efacet/metamodel/v0_2_0/efacet/runtime/impl/RuntimeFactoryImpl.java deleted file mode 100644 index 2101e56..0000000 --- a/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/emf/facet/efacet/metamodel/v0_2_0/efacet/runtime/impl/RuntimeFactoryImpl.java +++ /dev/null
@@ -1,201 +0,0 @@ -/** - * Copyright (c) 2011, 2015 Mia-Software, and Soft-Maint. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Gregoire Dupe (Mia-Software) - Design - * Nicolas Guyomar (Mia-Software) - Implementation - * Emmanuelle Rouillé (Mia-Software) - Bug 352618 - To be able to use non derived facet structural features and save them values. - * Nicolas Bros (Mia-Software) - Bug 361823 - [Restructuring] eFacet2 meta-model - * Gregoire Dupe (Mia-Software) - Bug 366055 - NavigationQuery - * Gregoire Dupe (Mia-Software) - Bug 369673 - [Facet] IsOneOfQuery - * Olivier Remaud (Soft-Maint) - Bug 369824 - Add a simple way to return string literal constants from a customization query - * Gregoire Dupe (Mia-Software) - Bug 369987 - [Restructuring][Table] Switch to the new customization and facet framework - * Gregoire Dupe (Mia-software) - Bug 364325 - [Restructuring] The user must be able to navigate into a model using the Facet. - * Nicolas Bros (Mia-Software) - Bug 372626 - [Facet] Aggregates - * Nicolas Bros (Mia-Software) - Bug 376941 - [EFacet] Facet operation arguments in Facet model - * Gregoire Dupe (Mia-Software) - Bug 376576 - [EFacet] Change the multiplicity of Facet::extendedFacet - * Jonathan Pepin (Soft-Maint) - Bug 463898 - Create FacetReference not derived, without query and with opposite mechanism - */ -package org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.runtime.impl; - -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.ecore.EDataType; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.EPackage; -import org.eclipse.emf.ecore.impl.EFactoryImpl; -import org.eclipse.emf.ecore.plugin.EcorePlugin; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.runtime.*; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.runtime.ETypedElementEObjectListResult; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.runtime.ETypedElementEObjectResult; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.runtime.ETypedElementPrimitiveTypeListResult; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.runtime.ETypedElementPrimitiveTypeResult; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.runtime.RuntimeFactory; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.runtime.RuntimePackage; - -/** - * <!-- begin-user-doc --> - * An implementation of the model <b>Factory</b>. - * <!-- end-user-doc --> - * @generated - */ -public class RuntimeFactoryImpl extends EFactoryImpl implements RuntimeFactory { - /** - * Creates the default factory implementation. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public static RuntimeFactory init() { - try { - RuntimeFactory theRuntimeFactory = (RuntimeFactory)EPackage.Registry.INSTANCE.getEFactory(RuntimePackage.eNS_URI); - if (theRuntimeFactory != null) { - return theRuntimeFactory; - } - } - catch (Exception exception) { - EcorePlugin.INSTANCE.log(exception); - } - return new RuntimeFactoryImpl(); - } - - /** - * Creates an instance of the factory. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public RuntimeFactoryImpl() { - super(); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public EObject create(EClass eClass) { - switch (eClass.getClassifierID()) { - case RuntimePackage.ETYPED_ELEMENT_PRIMITIVE_TYPE_RESULT: return createETypedElementPrimitiveTypeResult(); - case RuntimePackage.ETYPED_ELEMENT_EOBJECT_RESULT: return createETypedElementEObjectResult(); - case RuntimePackage.ETYPED_ELEMENT_PRIMITIVE_TYPE_LIST_RESULT: return createETypedElementPrimitiveTypeListResult(); - case RuntimePackage.ETYPED_ELEMENT_EOBJECT_LIST_RESULT: return createETypedElementEObjectListResult(); - default: - throw new IllegalArgumentException("The class '" + eClass.getName() + "' is not a valid classifier"); //$NON-NLS-1$ //$NON-NLS-2$ - } - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public Object createFromString(EDataType eDataType, String initialValue) { - switch (eDataType.getClassifierID()) { - case RuntimePackage.JAVA_EXCEPTION: - return createJavaExceptionFromString(eDataType, initialValue); - default: - throw new IllegalArgumentException("The datatype '" + eDataType.getName() + "' is not a valid classifier"); //$NON-NLS-1$ //$NON-NLS-2$ - } - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public String convertToString(EDataType eDataType, Object instanceValue) { - switch (eDataType.getClassifierID()) { - case RuntimePackage.JAVA_EXCEPTION: - return convertJavaExceptionToString(eDataType, instanceValue); - default: - throw new IllegalArgumentException("The datatype '" + eDataType.getName() + "' is not a valid classifier"); //$NON-NLS-1$ //$NON-NLS-2$ - } - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public <T> ETypedElementPrimitiveTypeResult<T> createETypedElementPrimitiveTypeResult() { - ETypedElementPrimitiveTypeResultImpl<T> eTypedElementPrimitiveTypeResult = new ETypedElementPrimitiveTypeResultImpl<T>(); - return eTypedElementPrimitiveTypeResult; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public <T extends EObject> ETypedElementEObjectResult<T> createETypedElementEObjectResult() { - ETypedElementEObjectResultImpl<T> eTypedElementEObjectResult = new ETypedElementEObjectResultImpl<T>(); - return eTypedElementEObjectResult; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public <T> ETypedElementPrimitiveTypeListResult<T> createETypedElementPrimitiveTypeListResult() { - ETypedElementPrimitiveTypeListResultImpl<T> eTypedElementPrimitiveTypeListResult = new ETypedElementPrimitiveTypeListResultImpl<T>(); - return eTypedElementPrimitiveTypeListResult; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public <T extends EObject> ETypedElementEObjectListResult<T> createETypedElementEObjectListResult() { - ETypedElementEObjectListResultImpl<T> eTypedElementEObjectListResult = new ETypedElementEObjectListResultImpl<T>(); - return eTypedElementEObjectListResult; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public Throwable createJavaExceptionFromString(EDataType eDataType, String initialValue) { - return (Throwable)super.createFromString(eDataType, initialValue); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public String convertJavaExceptionToString(EDataType eDataType, Object instanceValue) { - return super.convertToString(eDataType, instanceValue); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public RuntimePackage getRuntimePackage() { - return (RuntimePackage)getEPackage(); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @deprecated - * @generated - */ - @Deprecated - public static RuntimePackage getPackage() { - return RuntimePackage.eINSTANCE; - } - -} //RuntimeFactoryImpl
diff --git a/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/emf/facet/efacet/metamodel/v0_2_0/efacet/runtime/impl/RuntimePackageImpl.java b/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/emf/facet/efacet/metamodel/v0_2_0/efacet/runtime/impl/RuntimePackageImpl.java deleted file mode 100644 index 25d6875..0000000 --- a/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/emf/facet/efacet/metamodel/v0_2_0/efacet/runtime/impl/RuntimePackageImpl.java +++ /dev/null
@@ -1,421 +0,0 @@ -/** - * Copyright (c) 2011, 2012 Mia-Software. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Gregoire Dupe (Mia-Software) - Design - * Nicolas Guyomar (Mia-Software) - Implementation - * Emmanuelle Rouillé (Mia-Software) - Bug 352618 - To be able to use non derived facet structural features and save them values. - * Nicolas Bros (Mia-Software) - Bug 361823 - [Restructuring] eFacet2 meta-model - * Gregoire Dupe (Mia-Software) - Bug 366055 - NavigationQuery - * Gregoire Dupe (Mia-Software) - Bug 369673 - [Facet] IsOneOfQuery - * Olivier Remaud (Soft-Maint) - Bug 369824 - Add a simple way to return string literal constants from a customization query - * Gregoire Dupe (Mia-software) - Bug 369987 - [Restructuring][Table] Switch to the new customization and facet framework - * Gregoire Dupe (Mia-software) - Bug 364325 - [Restructuring] The user must be able to navigate into a model using the Facet. - */ -package org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.runtime.impl; - -import org.eclipse.emf.ecore.EAttribute; -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.ecore.EDataType; -import org.eclipse.emf.ecore.EGenericType; -import org.eclipse.emf.ecore.EPackage; -import org.eclipse.emf.ecore.EReference; -import org.eclipse.emf.ecore.ETypeParameter; -import org.eclipse.emf.ecore.EcorePackage; -import org.eclipse.emf.ecore.impl.EPackageImpl; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.EFacetPackage; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.extensible.ExtensiblePackage; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.extensible.impl.ExtensiblePackageImpl; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.impl.EFacetPackageImpl; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.query.QueryPackage; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.query.impl.QueryPackageImpl; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.runtime.ETypedElementEObjectListResult; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.runtime.ETypedElementEObjectResult; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.runtime.ETypedElementPrimitiveTypeListResult; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.runtime.ETypedElementPrimitiveTypeResult; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.runtime.ETypedElementResult; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.runtime.RuntimeFactory; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.runtime.RuntimePackage; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.serialization.SerializationPackage; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.serialization.impl.SerializationPackageImpl; - -/** - * <!-- begin-user-doc --> - * An implementation of the model <b>Package</b>. - * <!-- end-user-doc --> - * @generated - */ -public class RuntimePackageImpl extends EPackageImpl implements RuntimePackage { - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - private EClass eTypedElementPrimitiveTypeResultEClass = null; - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - private EClass eTypedElementEObjectResultEClass = null; - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - private EClass eTypedElementPrimitiveTypeListResultEClass = null; - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - private EClass eTypedElementEObjectListResultEClass = null; - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - private EClass eTypedElementResultEClass = null; - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - private EDataType javaExceptionEDataType = null; - - /** - * Creates an instance of the model <b>Package</b>, registered with - * {@link org.eclipse.emf.ecore.EPackage.Registry EPackage.Registry} by the package - * package URI value. - * <p>Note: the correct way to create the package is via the static - * factory method {@link #init init()}, which also performs - * initialization of the package, or returns the registered package, - * if one already exists. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see org.eclipse.emf.ecore.EPackage.Registry - * @see org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.runtime.RuntimePackage#eNS_URI - * @see #init() - * @generated - */ - private RuntimePackageImpl() { - super(eNS_URI, RuntimeFactory.eINSTANCE); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - private static boolean isInited = false; - - /** - * Creates, registers, and initializes the <b>Package</b> for this model, and for any others upon which it depends. - * - * <p>This method is used to initialize {@link RuntimePackage#eINSTANCE} when that field is accessed. - * Clients should not invoke it directly. Instead, they should simply access that field to obtain the package. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #eNS_URI - * @see #createPackageContents() - * @see #initializePackageContents() - * @generated - */ - public static RuntimePackage init() { - if (isInited) return (RuntimePackage)EPackage.Registry.INSTANCE.getEPackage(RuntimePackage.eNS_URI); - - // Obtain or create and register package - RuntimePackageImpl theRuntimePackage = (RuntimePackageImpl)(EPackage.Registry.INSTANCE.get(eNS_URI) instanceof RuntimePackageImpl ? EPackage.Registry.INSTANCE.get(eNS_URI) : new RuntimePackageImpl()); - - isInited = true; - - // Initialize simple dependencies - EcorePackage.eINSTANCE.eClass(); - - // Obtain or create and register interdependencies - EFacetPackageImpl theEFacetPackage = (EFacetPackageImpl)(EPackage.Registry.INSTANCE.getEPackage(EFacetPackage.eNS_URI) instanceof EFacetPackageImpl ? EPackage.Registry.INSTANCE.getEPackage(EFacetPackage.eNS_URI) : EFacetPackage.eINSTANCE); - SerializationPackageImpl theSerializationPackage = (SerializationPackageImpl)(EPackage.Registry.INSTANCE.getEPackage(SerializationPackage.eNS_URI) instanceof SerializationPackageImpl ? EPackage.Registry.INSTANCE.getEPackage(SerializationPackage.eNS_URI) : SerializationPackage.eINSTANCE); - ExtensiblePackageImpl theExtensiblePackage = (ExtensiblePackageImpl)(EPackage.Registry.INSTANCE.getEPackage(ExtensiblePackage.eNS_URI) instanceof ExtensiblePackageImpl ? EPackage.Registry.INSTANCE.getEPackage(ExtensiblePackage.eNS_URI) : ExtensiblePackage.eINSTANCE); - QueryPackageImpl theQueryPackage = (QueryPackageImpl)(EPackage.Registry.INSTANCE.getEPackage(QueryPackage.eNS_URI) instanceof QueryPackageImpl ? EPackage.Registry.INSTANCE.getEPackage(QueryPackage.eNS_URI) : QueryPackage.eINSTANCE); - - // Create package meta-data objects - theRuntimePackage.createPackageContents(); - theEFacetPackage.createPackageContents(); - theSerializationPackage.createPackageContents(); - theExtensiblePackage.createPackageContents(); - theQueryPackage.createPackageContents(); - - // Initialize created meta-data - theRuntimePackage.initializePackageContents(); - theEFacetPackage.initializePackageContents(); - theSerializationPackage.initializePackageContents(); - theExtensiblePackage.initializePackageContents(); - theQueryPackage.initializePackageContents(); - - // Mark meta-data to indicate it can't be changed - theRuntimePackage.freeze(); - - - // Update the registry and return the package - EPackage.Registry.INSTANCE.put(RuntimePackage.eNS_URI, theRuntimePackage); - return theRuntimePackage; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EClass getETypedElementPrimitiveTypeResult() { - return eTypedElementPrimitiveTypeResultEClass; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EAttribute getETypedElementPrimitiveTypeResult_Result() { - return (EAttribute)eTypedElementPrimitiveTypeResultEClass.getEStructuralFeatures().get(0); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EClass getETypedElementEObjectResult() { - return eTypedElementEObjectResultEClass; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EReference getETypedElementEObjectResult_Result() { - return (EReference)eTypedElementEObjectResultEClass.getEStructuralFeatures().get(0); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EClass getETypedElementPrimitiveTypeListResult() { - return eTypedElementPrimitiveTypeListResultEClass; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EAttribute getETypedElementPrimitiveTypeListResult_ResultList() { - return (EAttribute)eTypedElementPrimitiveTypeListResultEClass.getEStructuralFeatures().get(0); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EClass getETypedElementEObjectListResult() { - return eTypedElementEObjectListResultEClass; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EReference getETypedElementEObjectListResult_ResultList() { - return (EReference)eTypedElementEObjectListResultEClass.getEStructuralFeatures().get(0); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EClass getETypedElementResult() { - return eTypedElementResultEClass; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EReference getETypedElementResult_DerivedTypedElement() { - return (EReference)eTypedElementResultEClass.getEStructuralFeatures().get(0); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EReference getETypedElementResult_ParameterValues() { - return (EReference)eTypedElementResultEClass.getEStructuralFeatures().get(1); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EReference getETypedElementResult_Source() { - return (EReference)eTypedElementResultEClass.getEStructuralFeatures().get(2); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EAttribute getETypedElementResult_Exception() { - return (EAttribute)eTypedElementResultEClass.getEStructuralFeatures().get(3); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EDataType getJavaException() { - return javaExceptionEDataType; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public RuntimeFactory getRuntimeFactory() { - return (RuntimeFactory)getEFactoryInstance(); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - private boolean isCreated = false; - - /** - * Creates the meta-model objects for the package. This method is - * guarded to have no affect on any invocation but its first. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public void createPackageContents() { - if (isCreated) return; - isCreated = true; - - // Create classes and their features - eTypedElementPrimitiveTypeResultEClass = createEClass(ETYPED_ELEMENT_PRIMITIVE_TYPE_RESULT); - createEAttribute(eTypedElementPrimitiveTypeResultEClass, ETYPED_ELEMENT_PRIMITIVE_TYPE_RESULT__RESULT); - - eTypedElementEObjectResultEClass = createEClass(ETYPED_ELEMENT_EOBJECT_RESULT); - createEReference(eTypedElementEObjectResultEClass, ETYPED_ELEMENT_EOBJECT_RESULT__RESULT); - - eTypedElementPrimitiveTypeListResultEClass = createEClass(ETYPED_ELEMENT_PRIMITIVE_TYPE_LIST_RESULT); - createEAttribute(eTypedElementPrimitiveTypeListResultEClass, ETYPED_ELEMENT_PRIMITIVE_TYPE_LIST_RESULT__RESULT_LIST); - - eTypedElementEObjectListResultEClass = createEClass(ETYPED_ELEMENT_EOBJECT_LIST_RESULT); - createEReference(eTypedElementEObjectListResultEClass, ETYPED_ELEMENT_EOBJECT_LIST_RESULT__RESULT_LIST); - - eTypedElementResultEClass = createEClass(ETYPED_ELEMENT_RESULT); - createEReference(eTypedElementResultEClass, ETYPED_ELEMENT_RESULT__DERIVED_TYPED_ELEMENT); - createEReference(eTypedElementResultEClass, ETYPED_ELEMENT_RESULT__PARAMETER_VALUES); - createEReference(eTypedElementResultEClass, ETYPED_ELEMENT_RESULT__SOURCE); - createEAttribute(eTypedElementResultEClass, ETYPED_ELEMENT_RESULT__EXCEPTION); - - // Create data types - javaExceptionEDataType = createEDataType(JAVA_EXCEPTION); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - private boolean isInitialized = false; - - /** - * Complete the initialization of the package and its meta-model. This - * method is guarded to have no affect on any invocation but its first. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public void initializePackageContents() { - if (isInitialized) return; - isInitialized = true; - - // Initialize package - setName(eNAME); - setNsPrefix(eNS_PREFIX); - setNsURI(eNS_URI); - - // Obtain other dependent packages - EFacetPackage theEFacetPackage = (EFacetPackage)EPackage.Registry.INSTANCE.getEPackage(EFacetPackage.eNS_URI); - - // Create type parameters - ETypeParameter eTypedElementPrimitiveTypeResultEClass_T = addETypeParameter(eTypedElementPrimitiveTypeResultEClass, "T"); //$NON-NLS-1$ - ETypeParameter eTypedElementEObjectResultEClass_T = addETypeParameter(eTypedElementEObjectResultEClass, "T"); //$NON-NLS-1$ - ETypeParameter eTypedElementPrimitiveTypeListResultEClass_T = addETypeParameter(eTypedElementPrimitiveTypeListResultEClass, "T"); //$NON-NLS-1$ - ETypeParameter eTypedElementEObjectListResultEClass_T = addETypeParameter(eTypedElementEObjectListResultEClass, "T"); //$NON-NLS-1$ - - // Set bounds for type parameters - EGenericType g1 = createEGenericType(ecorePackage.getEObject()); - eTypedElementEObjectResultEClass_T.getEBounds().add(g1); - g1 = createEGenericType(ecorePackage.getEObject()); - eTypedElementEObjectListResultEClass_T.getEBounds().add(g1); - - // Add supertypes to classes - eTypedElementPrimitiveTypeResultEClass.getESuperTypes().add(this.getETypedElementResult()); - eTypedElementEObjectResultEClass.getESuperTypes().add(this.getETypedElementResult()); - eTypedElementPrimitiveTypeListResultEClass.getESuperTypes().add(this.getETypedElementResult()); - eTypedElementEObjectListResultEClass.getESuperTypes().add(this.getETypedElementResult()); - - // Initialize classes and features; add operations and parameters - initEClass(eTypedElementPrimitiveTypeResultEClass, ETypedElementPrimitiveTypeResult.class, "ETypedElementPrimitiveTypeResult", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); //$NON-NLS-1$ - g1 = createEGenericType(eTypedElementPrimitiveTypeResultEClass_T); - initEAttribute(getETypedElementPrimitiveTypeResult_Result(), g1, "result", null, 0, 1, ETypedElementPrimitiveTypeResult.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); //$NON-NLS-1$ - - initEClass(eTypedElementEObjectResultEClass, ETypedElementEObjectResult.class, "ETypedElementEObjectResult", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); //$NON-NLS-1$ - g1 = createEGenericType(eTypedElementEObjectResultEClass_T); - initEReference(getETypedElementEObjectResult_Result(), g1, null, "result", null, 0, 1, ETypedElementEObjectResult.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); //$NON-NLS-1$ - - initEClass(eTypedElementPrimitiveTypeListResultEClass, ETypedElementPrimitiveTypeListResult.class, "ETypedElementPrimitiveTypeListResult", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); //$NON-NLS-1$ - g1 = createEGenericType(eTypedElementPrimitiveTypeListResultEClass_T); - initEAttribute(getETypedElementPrimitiveTypeListResult_ResultList(), g1, "resultList", null, 0, -1, ETypedElementPrimitiveTypeListResult.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); //$NON-NLS-1$ - - initEClass(eTypedElementEObjectListResultEClass, ETypedElementEObjectListResult.class, "ETypedElementEObjectListResult", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); //$NON-NLS-1$ - g1 = createEGenericType(eTypedElementEObjectListResultEClass_T); - initEReference(getETypedElementEObjectListResult_ResultList(), g1, null, "resultList", null, 0, -1, ETypedElementEObjectListResult.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); //$NON-NLS-1$ - - initEClass(eTypedElementResultEClass, ETypedElementResult.class, "ETypedElementResult", IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); //$NON-NLS-1$ - initEReference(getETypedElementResult_DerivedTypedElement(), ecorePackage.getETypedElement(), null, "derivedTypedElement", null, 1, 1, ETypedElementResult.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); //$NON-NLS-1$ - initEReference(getETypedElementResult_ParameterValues(), theEFacetPackage.getParameterValue(), null, "parameterValues", null, 0, -1, ETypedElementResult.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); //$NON-NLS-1$ - initEReference(getETypedElementResult_Source(), ecorePackage.getEObject(), null, "source", null, 1, 1, ETypedElementResult.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); //$NON-NLS-1$ - initEAttribute(getETypedElementResult_Exception(), this.getJavaException(), "exception", null, 0, 1, ETypedElementResult.class, IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); //$NON-NLS-1$ - - // Initialize data types - initEDataType(javaExceptionEDataType, Throwable.class, "JavaException", IS_SERIALIZABLE, !IS_GENERATED_INSTANCE_CLASS); //$NON-NLS-1$ - } - -} //RuntimePackageImpl
diff --git a/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/emf/facet/efacet/metamodel/v0_2_0/efacet/runtime/util/RuntimeAdapterFactory.java b/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/emf/facet/efacet/metamodel/v0_2_0/efacet/runtime/util/RuntimeAdapterFactory.java deleted file mode 100644 index 0a89532..0000000 --- a/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/emf/facet/efacet/metamodel/v0_2_0/efacet/runtime/util/RuntimeAdapterFactory.java +++ /dev/null
@@ -1,212 +0,0 @@ -/** - * Copyright (c) 2011, 2012 Mia-Software. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Gregoire Dupe (Mia-Software) - Design - * Nicolas Guyomar (Mia-Software) - Implementation - * Emmanuelle Rouillé (Mia-Software) - Bug 352618 - To be able to use non derived facet structural features and save them values. - * Nicolas Bros (Mia-Software) - Bug 361823 - [Restructuring] eFacet2 meta-model - * Gregoire Dupe (Mia-Software) - Bug 366055 - NavigationQuery - * Gregoire Dupe (Mia-Software) - Bug 369673 - [Facet] IsOneOfQuery - * Olivier Remaud (Soft-Maint) - Bug 369824 - Add a simple way to return string literal constants from a customization query - * Gregoire Dupe (Mia-software) - Bug 369987 - [Restructuring][Table] Switch to the new customization and facet framework - * Gregoire Dupe (Mia-software) - Bug 364325 - [Restructuring] The user must be able to navigate into a model using the Facet. - */ -package org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.runtime.util; - -import org.eclipse.emf.common.notify.Adapter; -import org.eclipse.emf.common.notify.Notifier; -import org.eclipse.emf.common.notify.impl.AdapterFactoryImpl; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.runtime.*; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.runtime.ETypedElementEObjectListResult; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.runtime.ETypedElementEObjectResult; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.runtime.ETypedElementPrimitiveTypeListResult; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.runtime.ETypedElementPrimitiveTypeResult; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.runtime.ETypedElementResult; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.runtime.RuntimePackage; - -/** - * <!-- begin-user-doc --> - * The <b>Adapter Factory</b> for the model. - * It provides an adapter <code>createXXX</code> method for each class of the model. - * <!-- end-user-doc --> - * @see org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.runtime.RuntimePackage - * @generated - */ -public class RuntimeAdapterFactory extends AdapterFactoryImpl { - /** - * The cached model package. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected static RuntimePackage modelPackage; - - /** - * Creates an instance of the adapter factory. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public RuntimeAdapterFactory() { - if (modelPackage == null) { - modelPackage = RuntimePackage.eINSTANCE; - } - } - - /** - * Returns whether this factory is applicable for the type of the object. - * <!-- begin-user-doc --> - * This implementation returns <code>true</code> if the object is either the model's package or is an instance object of the model. - * <!-- end-user-doc --> - * @return whether this factory is applicable for the type of the object. - * @generated - */ - @Override - public boolean isFactoryForType(Object object) { - if (object == modelPackage) { - return true; - } - if (object instanceof EObject) { - return ((EObject)object).eClass().getEPackage() == modelPackage; - } - return false; - } - - /** - * The switch that delegates to the <code>createXXX</code> methods. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected RuntimeSwitch<Adapter> modelSwitch = - new RuntimeSwitch<Adapter>() { - @Override - public <T> Adapter caseETypedElementPrimitiveTypeResult(ETypedElementPrimitiveTypeResult<T> object) { - return createETypedElementPrimitiveTypeResultAdapter(); - } - @Override - public <T extends EObject> Adapter caseETypedElementEObjectResult(ETypedElementEObjectResult<T> object) { - return createETypedElementEObjectResultAdapter(); - } - @Override - public <T> Adapter caseETypedElementPrimitiveTypeListResult(ETypedElementPrimitiveTypeListResult<T> object) { - return createETypedElementPrimitiveTypeListResultAdapter(); - } - @Override - public <T extends EObject> Adapter caseETypedElementEObjectListResult(ETypedElementEObjectListResult<T> object) { - return createETypedElementEObjectListResultAdapter(); - } - @Override - public Adapter caseETypedElementResult(ETypedElementResult object) { - return createETypedElementResultAdapter(); - } - @Override - public Adapter defaultCase(EObject object) { - return createEObjectAdapter(); - } - }; - - /** - * Creates an adapter for the <code>target</code>. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @param target the object to adapt. - * @return the adapter for the <code>target</code>. - * @generated - */ - @Override - public Adapter createAdapter(Notifier target) { - return modelSwitch.doSwitch((EObject)target); - } - - - /** - * Creates a new adapter for an object of class '{@link org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.runtime.ETypedElementPrimitiveTypeResult <em>ETyped Element Primitive Type Result</em>}'. - * <!-- begin-user-doc --> - * This default implementation returns null so that we can easily ignore cases; - * it's useful to ignore a case when inheritance will catch all the cases anyway. - * <!-- end-user-doc --> - * @return the new adapter. - * @see org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.runtime.ETypedElementPrimitiveTypeResult - * @generated - */ - public Adapter createETypedElementPrimitiveTypeResultAdapter() { - return null; - } - - /** - * Creates a new adapter for an object of class '{@link org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.runtime.ETypedElementEObjectResult <em>ETyped Element EObject Result</em>}'. - * <!-- begin-user-doc --> - * This default implementation returns null so that we can easily ignore cases; - * it's useful to ignore a case when inheritance will catch all the cases anyway. - * <!-- end-user-doc --> - * @return the new adapter. - * @see org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.runtime.ETypedElementEObjectResult - * @generated - */ - public Adapter createETypedElementEObjectResultAdapter() { - return null; - } - - /** - * Creates a new adapter for an object of class '{@link org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.runtime.ETypedElementPrimitiveTypeListResult <em>ETyped Element Primitive Type List Result</em>}'. - * <!-- begin-user-doc --> - * This default implementation returns null so that we can easily ignore cases; - * it's useful to ignore a case when inheritance will catch all the cases anyway. - * <!-- end-user-doc --> - * @return the new adapter. - * @see org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.runtime.ETypedElementPrimitiveTypeListResult - * @generated - */ - public Adapter createETypedElementPrimitiveTypeListResultAdapter() { - return null; - } - - /** - * Creates a new adapter for an object of class '{@link org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.runtime.ETypedElementEObjectListResult <em>ETyped Element EObject List Result</em>}'. - * <!-- begin-user-doc --> - * This default implementation returns null so that we can easily ignore cases; - * it's useful to ignore a case when inheritance will catch all the cases anyway. - * <!-- end-user-doc --> - * @return the new adapter. - * @see org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.runtime.ETypedElementEObjectListResult - * @generated - */ - public Adapter createETypedElementEObjectListResultAdapter() { - return null; - } - - /** - * Creates a new adapter for an object of class '{@link org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.runtime.ETypedElementResult <em>ETyped Element Result</em>}'. - * <!-- begin-user-doc --> - * This default implementation returns null so that we can easily ignore cases; - * it's useful to ignore a case when inheritance will catch all the cases anyway. - * <!-- end-user-doc --> - * @return the new adapter. - * @see org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.runtime.ETypedElementResult - * @generated - */ - public Adapter createETypedElementResultAdapter() { - return null; - } - - /** - * Creates a new adapter for the default case. - * <!-- begin-user-doc --> - * This default implementation returns null. - * <!-- end-user-doc --> - * @return the new adapter. - * @generated - */ - public Adapter createEObjectAdapter() { - return null; - } - -} //RuntimeAdapterFactory
diff --git a/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/emf/facet/efacet/metamodel/v0_2_0/efacet/runtime/util/RuntimeSwitch.java b/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/emf/facet/efacet/metamodel/v0_2_0/efacet/runtime/util/RuntimeSwitch.java deleted file mode 100644 index 574a3da..0000000 --- a/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/emf/facet/efacet/metamodel/v0_2_0/efacet/runtime/util/RuntimeSwitch.java +++ /dev/null
@@ -1,236 +0,0 @@ -/** - * Copyright (c) 2011, 2012 Mia-Software. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Gregoire Dupe (Mia-Software) - Design - * Nicolas Guyomar (Mia-Software) - Implementation - * Emmanuelle Rouillé (Mia-Software) - Bug 352618 - To be able to use non derived facet structural features and save them values. - * Nicolas Bros (Mia-Software) - Bug 361823 - [Restructuring] eFacet2 meta-model - * Gregoire Dupe (Mia-Software) - Bug 366055 - NavigationQuery - * Gregoire Dupe (Mia-Software) - Bug 369673 - [Facet] IsOneOfQuery - * Olivier Remaud (Soft-Maint) - Bug 369824 - Add a simple way to return string literal constants from a customization query - * Gregoire Dupe (Mia-software) - Bug 369987 - [Restructuring][Table] Switch to the new customization and facet framework - * Gregoire Dupe (Mia-software) - Bug 364325 - [Restructuring] The user must be able to navigate into a model using the Facet. - */ -package org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.runtime.util; - -import java.util.List; - -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.runtime.*; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.runtime.ETypedElementEObjectListResult; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.runtime.ETypedElementEObjectResult; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.runtime.ETypedElementPrimitiveTypeListResult; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.runtime.ETypedElementPrimitiveTypeResult; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.runtime.ETypedElementResult; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.runtime.RuntimePackage; - -/** - * <!-- begin-user-doc --> - * The <b>Switch</b> for the model's inheritance hierarchy. - * It supports the call {@link #doSwitch(EObject) doSwitch(object)} - * to invoke the <code>caseXXX</code> method for each class of the model, - * starting with the actual class of the object - * and proceeding up the inheritance hierarchy - * until a non-null result is returned, - * which is the result of the switch. - * <!-- end-user-doc --> - * @see org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.runtime.RuntimePackage - * @generated - */ -public class RuntimeSwitch<T1> { - /** - * The cached model package - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected static RuntimePackage modelPackage; - - /** - * Creates an instance of the switch. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public RuntimeSwitch() { - if (modelPackage == null) { - modelPackage = RuntimePackage.eINSTANCE; - } - } - - /** - * Calls <code>caseXXX</code> for each class of the model until one returns a non null result; it yields that result. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the first non-null result returned by a <code>caseXXX</code> call. - * @generated - */ - public T1 doSwitch(EObject theEObject) { - return doSwitch(theEObject.eClass(), theEObject); - } - - /** - * Calls <code>caseXXX</code> for each class of the model until one returns a non null result; it yields that result. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the first non-null result returned by a <code>caseXXX</code> call. - * @generated - */ - protected T1 doSwitch(EClass theEClass, EObject theEObject) { - if (theEClass.eContainer() == modelPackage) { - return doSwitch(theEClass.getClassifierID(), theEObject); - } - else { - List<EClass> eSuperTypes = theEClass.getESuperTypes(); - return - eSuperTypes.isEmpty() ? - defaultCase(theEObject) : - doSwitch(eSuperTypes.get(0), theEObject); - } - } - - /** - * Calls <code>caseXXX</code> for each class of the model until one returns a non null result; it yields that result. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the first non-null result returned by a <code>caseXXX</code> call. - * @generated - */ - protected T1 doSwitch(int classifierID, EObject theEObject) { - switch (classifierID) { - case RuntimePackage.ETYPED_ELEMENT_PRIMITIVE_TYPE_RESULT: { - ETypedElementPrimitiveTypeResult<?> eTypedElementPrimitiveTypeResult = (ETypedElementPrimitiveTypeResult<?>)theEObject; - T1 result = caseETypedElementPrimitiveTypeResult(eTypedElementPrimitiveTypeResult); - if (result == null) result = caseETypedElementResult(eTypedElementPrimitiveTypeResult); - if (result == null) result = defaultCase(theEObject); - return result; - } - case RuntimePackage.ETYPED_ELEMENT_EOBJECT_RESULT: { - ETypedElementEObjectResult<?> eTypedElementEObjectResult = (ETypedElementEObjectResult<?>)theEObject; - T1 result = caseETypedElementEObjectResult(eTypedElementEObjectResult); - if (result == null) result = caseETypedElementResult(eTypedElementEObjectResult); - if (result == null) result = defaultCase(theEObject); - return result; - } - case RuntimePackage.ETYPED_ELEMENT_PRIMITIVE_TYPE_LIST_RESULT: { - ETypedElementPrimitiveTypeListResult<?> eTypedElementPrimitiveTypeListResult = (ETypedElementPrimitiveTypeListResult<?>)theEObject; - T1 result = caseETypedElementPrimitiveTypeListResult(eTypedElementPrimitiveTypeListResult); - if (result == null) result = caseETypedElementResult(eTypedElementPrimitiveTypeListResult); - if (result == null) result = defaultCase(theEObject); - return result; - } - case RuntimePackage.ETYPED_ELEMENT_EOBJECT_LIST_RESULT: { - ETypedElementEObjectListResult<?> eTypedElementEObjectListResult = (ETypedElementEObjectListResult<?>)theEObject; - T1 result = caseETypedElementEObjectListResult(eTypedElementEObjectListResult); - if (result == null) result = caseETypedElementResult(eTypedElementEObjectListResult); - if (result == null) result = defaultCase(theEObject); - return result; - } - case RuntimePackage.ETYPED_ELEMENT_RESULT: { - ETypedElementResult eTypedElementResult = (ETypedElementResult)theEObject; - T1 result = caseETypedElementResult(eTypedElementResult); - if (result == null) result = defaultCase(theEObject); - return result; - } - default: return defaultCase(theEObject); - } - } - - /** - * Returns the result of interpreting the object as an instance of '<em>ETyped Element Primitive Type Result</em>'. - * <!-- begin-user-doc --> - * This implementation returns null; - * returning a non-null result will terminate the switch. - * <!-- end-user-doc --> - * @param object the target of the switch. - * @return the result of interpreting the object as an instance of '<em>ETyped Element Primitive Type Result</em>'. - * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) - * @generated - */ - public <T> T1 caseETypedElementPrimitiveTypeResult(ETypedElementPrimitiveTypeResult<T> object) { - return null; - } - - /** - * Returns the result of interpreting the object as an instance of '<em>ETyped Element EObject Result</em>'. - * <!-- begin-user-doc --> - * This implementation returns null; - * returning a non-null result will terminate the switch. - * <!-- end-user-doc --> - * @param object the target of the switch. - * @return the result of interpreting the object as an instance of '<em>ETyped Element EObject Result</em>'. - * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) - * @generated - */ - public <T extends EObject> T1 caseETypedElementEObjectResult(ETypedElementEObjectResult<T> object) { - return null; - } - - /** - * Returns the result of interpreting the object as an instance of '<em>ETyped Element Primitive Type List Result</em>'. - * <!-- begin-user-doc --> - * This implementation returns null; - * returning a non-null result will terminate the switch. - * <!-- end-user-doc --> - * @param object the target of the switch. - * @return the result of interpreting the object as an instance of '<em>ETyped Element Primitive Type List Result</em>'. - * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) - * @generated - */ - public <T> T1 caseETypedElementPrimitiveTypeListResult(ETypedElementPrimitiveTypeListResult<T> object) { - return null; - } - - /** - * Returns the result of interpreting the object as an instance of '<em>ETyped Element EObject List Result</em>'. - * <!-- begin-user-doc --> - * This implementation returns null; - * returning a non-null result will terminate the switch. - * <!-- end-user-doc --> - * @param object the target of the switch. - * @return the result of interpreting the object as an instance of '<em>ETyped Element EObject List Result</em>'. - * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) - * @generated - */ - public <T extends EObject> T1 caseETypedElementEObjectListResult(ETypedElementEObjectListResult<T> object) { - return null; - } - - /** - * Returns the result of interpreting the object as an instance of '<em>ETyped Element Result</em>'. - * <!-- begin-user-doc --> - * This implementation returns null; - * returning a non-null result will terminate the switch. - * <!-- end-user-doc --> - * @param object the target of the switch. - * @return the result of interpreting the object as an instance of '<em>ETyped Element Result</em>'. - * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) - * @generated - */ - public T1 caseETypedElementResult(ETypedElementResult object) { - return null; - } - - /** - * Returns the result of interpreting the object as an instance of '<em>EObject</em>'. - * <!-- begin-user-doc --> - * This implementation returns null; - * returning a non-null result will terminate the switch, but this is the last case anyway. - * <!-- end-user-doc --> - * @param object the target of the switch. - * @return the result of interpreting the object as an instance of '<em>EObject</em>'. - * @see #doSwitch(org.eclipse.emf.ecore.EObject) - * @generated - */ - public T1 defaultCase(EObject object) { - return null; - } - -} //RuntimeSwitch
diff --git a/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/emf/facet/efacet/metamodel/v0_2_0/efacet/serialization/AbstractAttributeInstance.java b/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/emf/facet/efacet/metamodel/v0_2_0/efacet/serialization/AbstractAttributeInstance.java deleted file mode 100644 index 96462aa..0000000 --- a/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/emf/facet/efacet/metamodel/v0_2_0/efacet/serialization/AbstractAttributeInstance.java +++ /dev/null
@@ -1,63 +0,0 @@ -/** - * Copyright (c) 2011 Mia-Software. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Gregoire Dupe (Mia-Software) - Design - * Nicolas Guyomar (Mia-Software) - Implementation - * Emmanuelle Rouillé (Mia-Software) - Bug 352618 - To be able to use non derived facet structural features and save them values. - * Nicolas Bros (Mia-Software) - Bug 361823 - [Restructuring] eFacet2 meta-model - */ -package org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.serialization; - -import org.eclipse.emf.ecore.EAttribute; -import org.eclipse.emf.ecore.EObject; - -/** - * <!-- begin-user-doc --> - * A representation of the model object '<em><b>Abstract Attribute Instance</b></em>'. - * <!-- end-user-doc --> - * - * <p> - * The following features are supported: - * <ul> - * <li>{@link org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.serialization.AbstractAttributeInstance#getEAttribute <em>EAttribute</em>}</li> - * </ul> - * </p> - * - * @see org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.serialization.SerializationPackage#getAbstractAttributeInstance() - * @model - * @generated - */ -public interface AbstractAttributeInstance extends EObject { - /** - * Returns the value of the '<em><b>EAttribute</b></em>' reference. - * <!-- begin-user-doc --> - * <p> - * If the meaning of the '<em>EAttribute</em>' reference isn't clear, - * there really should be more of a description here... - * </p> - * <!-- end-user-doc --> - * @return the value of the '<em>EAttribute</em>' reference. - * @see #setEAttribute(EAttribute) - * @see org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.serialization.SerializationPackage#getAbstractAttributeInstance_EAttribute() - * @model required="true" - * @generated - */ - EAttribute getEAttribute(); - - /** - * Sets the value of the '{@link org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.serialization.AbstractAttributeInstance#getEAttribute <em>EAttribute</em>}' reference. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @param value the new value of the '<em>EAttribute</em>' reference. - * @see #getEAttribute() - * @generated - */ - void setEAttribute(EAttribute value); - -} // AbstractAttributeInstance
diff --git a/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/emf/facet/efacet/metamodel/v0_2_0/efacet/serialization/AbstractReferenceInstance.java b/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/emf/facet/efacet/metamodel/v0_2_0/efacet/serialization/AbstractReferenceInstance.java deleted file mode 100644 index dfbae0f..0000000 --- a/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/emf/facet/efacet/metamodel/v0_2_0/efacet/serialization/AbstractReferenceInstance.java +++ /dev/null
@@ -1,63 +0,0 @@ -/** - * Copyright (c) 2011 Mia-Software. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Gregoire Dupe (Mia-Software) - Design - * Nicolas Guyomar (Mia-Software) - Implementation - * Emmanuelle Rouillé (Mia-Software) - Bug 352618 - To be able to use non derived facet structural features and save them values. - * Nicolas Bros (Mia-Software) - Bug 361823 - [Restructuring] eFacet2 meta-model - */ -package org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.serialization; - -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.EReference; - -/** - * <!-- begin-user-doc --> - * A representation of the model object '<em><b>Abstract Reference Instance</b></em>'. - * <!-- end-user-doc --> - * - * <p> - * The following features are supported: - * <ul> - * <li>{@link org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.serialization.AbstractReferenceInstance#getEReference <em>EReference</em>}</li> - * </ul> - * </p> - * - * @see org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.serialization.SerializationPackage#getAbstractReferenceInstance() - * @model - * @generated - */ -public interface AbstractReferenceInstance extends EObject { - /** - * Returns the value of the '<em><b>EReference</b></em>' reference. - * <!-- begin-user-doc --> - * <p> - * If the meaning of the '<em>EReference</em>' reference isn't clear, - * there really should be more of a description here... - * </p> - * <!-- end-user-doc --> - * @return the value of the '<em>EReference</em>' reference. - * @see #setEReference(EReference) - * @see org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.serialization.SerializationPackage#getAbstractReferenceInstance_EReference() - * @model required="true" - * @generated - */ - EReference getEReference(); - - /** - * Sets the value of the '{@link org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.serialization.AbstractReferenceInstance#getEReference <em>EReference</em>}' reference. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @param value the new value of the '<em>EReference</em>' reference. - * @see #getEReference() - * @generated - */ - void setEReference(EReference value); - -} // AbstractReferenceInstance
diff --git a/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/emf/facet/efacet/metamodel/v0_2_0/efacet/serialization/ExtendedEObjectReference.java b/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/emf/facet/efacet/metamodel/v0_2_0/efacet/serialization/ExtendedEObjectReference.java deleted file mode 100644 index e68f04b..0000000 --- a/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/emf/facet/efacet/metamodel/v0_2_0/efacet/serialization/ExtendedEObjectReference.java +++ /dev/null
@@ -1,97 +0,0 @@ -/** - * Copyright (c) 2011 Mia-Software. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Gregoire Dupe (Mia-Software) - Design - * Nicolas Guyomar (Mia-Software) - Implementation - * Emmanuelle Rouillé (Mia-Software) - Bug 352618 - To be able to use non derived facet structural features and save them values. - * Nicolas Bros (Mia-Software) - Bug 361823 - [Restructuring] eFacet2 meta-model - */ -package org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.serialization; - -import org.eclipse.emf.common.util.EList; -import org.eclipse.emf.ecore.EObject; - -/** - * <!-- begin-user-doc --> - * A representation of the model object '<em><b>Extended EObject Reference</b></em>'. - * <!-- end-user-doc --> - * - * <p> - * The following features are supported: - * <ul> - * <li>{@link org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.serialization.ExtendedEObjectReference#getExtendedEObject <em>Extended EObject</em>}</li> - * <li>{@link org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.serialization.ExtendedEObjectReference#getAttributeInstances <em>Attribute Instances</em>}</li> - * <li>{@link org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.serialization.ExtendedEObjectReference#getReferenceInstances <em>Reference Instances</em>}</li> - * </ul> - * </p> - * - * @see org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.serialization.SerializationPackage#getExtendedEObjectReference() - * @model - * @generated - */ -public interface ExtendedEObjectReference extends EObject { - /** - * Returns the value of the '<em><b>Extended EObject</b></em>' reference. - * <!-- begin-user-doc --> - * <p> - * If the meaning of the '<em>Extended EObject</em>' reference isn't clear, - * there really should be more of a description here... - * </p> - * <!-- end-user-doc --> - * @return the value of the '<em>Extended EObject</em>' reference. - * @see #setExtendedEObject(EObject) - * @see org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.serialization.SerializationPackage#getExtendedEObjectReference_ExtendedEObject() - * @model required="true" - * @generated - */ - EObject getExtendedEObject(); - - /** - * Sets the value of the '{@link org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.serialization.ExtendedEObjectReference#getExtendedEObject <em>Extended EObject</em>}' reference. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @param value the new value of the '<em>Extended EObject</em>' reference. - * @see #getExtendedEObject() - * @generated - */ - void setExtendedEObject(EObject value); - - /** - * Returns the value of the '<em><b>Attribute Instances</b></em>' containment reference list. - * The list contents are of type {@link org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.serialization.AbstractAttributeInstance}. - * <!-- begin-user-doc --> - * <p> - * If the meaning of the '<em>Attribute Instances</em>' containment reference list isn't clear, - * there really should be more of a description here... - * </p> - * <!-- end-user-doc --> - * @return the value of the '<em>Attribute Instances</em>' containment reference list. - * @see org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.serialization.SerializationPackage#getExtendedEObjectReference_AttributeInstances() - * @model containment="true" - * @generated - */ - EList<AbstractAttributeInstance> getAttributeInstances(); - - /** - * Returns the value of the '<em><b>Reference Instances</b></em>' containment reference list. - * The list contents are of type {@link org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.serialization.AbstractReferenceInstance}. - * <!-- begin-user-doc --> - * <p> - * If the meaning of the '<em>Reference Instances</em>' containment reference list isn't clear, - * there really should be more of a description here... - * </p> - * <!-- end-user-doc --> - * @return the value of the '<em>Reference Instances</em>' containment reference list. - * @see org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.serialization.SerializationPackage#getExtendedEObjectReference_ReferenceInstances() - * @model containment="true" - * @generated - */ - EList<AbstractReferenceInstance> getReferenceInstances(); - -} // ExtendedEObjectReference
diff --git a/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/emf/facet/efacet/metamodel/v0_2_0/efacet/serialization/MultiValuedAttributeInstance.java b/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/emf/facet/efacet/metamodel/v0_2_0/efacet/serialization/MultiValuedAttributeInstance.java deleted file mode 100644 index 14c19dc..0000000 --- a/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/emf/facet/efacet/metamodel/v0_2_0/efacet/serialization/MultiValuedAttributeInstance.java +++ /dev/null
@@ -1,52 +0,0 @@ -/** - * Copyright (c) 2011 Mia-Software. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Gregoire Dupe (Mia-Software) - Design - * Nicolas Guyomar (Mia-Software) - Implementation - * Emmanuelle Rouillé (Mia-Software) - Bug 352618 - To be able to use non derived facet structural features and save them values. - * Nicolas Bros (Mia-Software) - Bug 361823 - [Restructuring] eFacet2 meta-model - */ -package org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.serialization; - -import org.eclipse.emf.common.util.EList; - -/** - * <!-- begin-user-doc --> - * A representation of the model object '<em><b>Multi Valued Attribute Instance</b></em>'. - * <!-- end-user-doc --> - * - * <p> - * The following features are supported: - * <ul> - * <li>{@link org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.serialization.MultiValuedAttributeInstance#getValues <em>Values</em>}</li> - * </ul> - * </p> - * - * @see org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.serialization.SerializationPackage#getMultiValuedAttributeInstance() - * @model - * @generated - */ -public interface MultiValuedAttributeInstance extends AbstractAttributeInstance { - /** - * Returns the value of the '<em><b>Values</b></em>' attribute list. - * The list contents are of type {@link java.lang.Object}. - * <!-- begin-user-doc --> - * <p> - * If the meaning of the '<em>Values</em>' attribute list isn't clear, - * there really should be more of a description here... - * </p> - * <!-- end-user-doc --> - * @return the value of the '<em>Values</em>' attribute list. - * @see org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.serialization.SerializationPackage#getMultiValuedAttributeInstance_Values() - * @model - * @generated - */ - EList<Object> getValues(); - -} // MultiValuedAttributeInstance
diff --git a/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/emf/facet/efacet/metamodel/v0_2_0/efacet/serialization/MultiValuedContainmentReferenceInstance.java b/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/emf/facet/efacet/metamodel/v0_2_0/efacet/serialization/MultiValuedContainmentReferenceInstance.java deleted file mode 100644 index be7084d..0000000 --- a/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/emf/facet/efacet/metamodel/v0_2_0/efacet/serialization/MultiValuedContainmentReferenceInstance.java +++ /dev/null
@@ -1,53 +0,0 @@ -/** - * Copyright (c) 2011 Mia-Software. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Gregoire Dupe (Mia-Software) - Design - * Nicolas Guyomar (Mia-Software) - Implementation - * Emmanuelle Rouillé (Mia-Software) - Bug 352618 - To be able to use non derived facet structural features and save them values. - * Nicolas Bros (Mia-Software) - Bug 361823 - [Restructuring] eFacet2 meta-model - */ -package org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.serialization; - -import org.eclipse.emf.common.util.EList; -import org.eclipse.emf.ecore.EObject; - -/** - * <!-- begin-user-doc --> - * A representation of the model object '<em><b>Multi Valued Containment Reference Instance</b></em>'. - * <!-- end-user-doc --> - * - * <p> - * The following features are supported: - * <ul> - * <li>{@link org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.serialization.MultiValuedContainmentReferenceInstance#getOwnedElements <em>Owned Elements</em>}</li> - * </ul> - * </p> - * - * @see org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.serialization.SerializationPackage#getMultiValuedContainmentReferenceInstance() - * @model - * @generated - */ -public interface MultiValuedContainmentReferenceInstance extends AbstractReferenceInstance { - /** - * Returns the value of the '<em><b>Owned Elements</b></em>' containment reference list. - * The list contents are of type {@link org.eclipse.emf.ecore.EObject}. - * <!-- begin-user-doc --> - * <p> - * If the meaning of the '<em>Owned Elements</em>' containment reference list isn't clear, - * there really should be more of a description here... - * </p> - * <!-- end-user-doc --> - * @return the value of the '<em>Owned Elements</em>' containment reference list. - * @see org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.serialization.SerializationPackage#getMultiValuedContainmentReferenceInstance_OwnedElements() - * @model containment="true" - * @generated - */ - EList<EObject> getOwnedElements(); - -} // MultiValuedContainmentReferenceInstance
diff --git a/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/emf/facet/efacet/metamodel/v0_2_0/efacet/serialization/MultiValuedReferenceInstance.java b/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/emf/facet/efacet/metamodel/v0_2_0/efacet/serialization/MultiValuedReferenceInstance.java deleted file mode 100644 index 1c7c2d6..0000000 --- a/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/emf/facet/efacet/metamodel/v0_2_0/efacet/serialization/MultiValuedReferenceInstance.java +++ /dev/null
@@ -1,53 +0,0 @@ -/** - * Copyright (c) 2011 Mia-Software. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Gregoire Dupe (Mia-Software) - Design - * Nicolas Guyomar (Mia-Software) - Implementation - * Emmanuelle Rouillé (Mia-Software) - Bug 352618 - To be able to use non derived facet structural features and save them values. - * Nicolas Bros (Mia-Software) - Bug 361823 - [Restructuring] eFacet2 meta-model - */ -package org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.serialization; - -import org.eclipse.emf.common.util.EList; -import org.eclipse.emf.ecore.EObject; - -/** - * <!-- begin-user-doc --> - * A representation of the model object '<em><b>Multi Valued Reference Instance</b></em>'. - * <!-- end-user-doc --> - * - * <p> - * The following features are supported: - * <ul> - * <li>{@link org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.serialization.MultiValuedReferenceInstance#getReferencedElements <em>Referenced Elements</em>}</li> - * </ul> - * </p> - * - * @see org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.serialization.SerializationPackage#getMultiValuedReferenceInstance() - * @model - * @generated - */ -public interface MultiValuedReferenceInstance extends AbstractReferenceInstance { - /** - * Returns the value of the '<em><b>Referenced Elements</b></em>' reference list. - * The list contents are of type {@link org.eclipse.emf.ecore.EObject}. - * <!-- begin-user-doc --> - * <p> - * If the meaning of the '<em>Referenced Elements</em>' reference list isn't clear, - * there really should be more of a description here... - * </p> - * <!-- end-user-doc --> - * @return the value of the '<em>Referenced Elements</em>' reference list. - * @see org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.serialization.SerializationPackage#getMultiValuedReferenceInstance_ReferencedElements() - * @model - * @generated - */ - EList<EObject> getReferencedElements(); - -} // MultiValuedReferenceInstance
diff --git a/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/emf/facet/efacet/metamodel/v0_2_0/efacet/serialization/SerializationFactory.java b/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/emf/facet/efacet/metamodel/v0_2_0/efacet/serialization/SerializationFactory.java deleted file mode 100644 index 5ff0f4d..0000000 --- a/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/emf/facet/efacet/metamodel/v0_2_0/efacet/serialization/SerializationFactory.java +++ /dev/null
@@ -1,127 +0,0 @@ -/** - * Copyright (c) 2011 Mia-Software. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Gregoire Dupe (Mia-Software) - Design - * Nicolas Guyomar (Mia-Software) - Implementation - * Emmanuelle Rouillé (Mia-Software) - Bug 352618 - To be able to use non derived facet structural features and save them values. - * Nicolas Bros (Mia-Software) - Bug 361823 - [Restructuring] eFacet2 meta-model - * Gregoire Dupe (Mia-Software) - Bug 373078 - API Cleaning - */ -package org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.serialization; - -import org.eclipse.emf.ecore.EFactory; - -/** - * <!-- begin-user-doc --> - * The <b>Factory</b> for the model. - * It provides a create method for each non-abstract class of the model. - * <!-- end-user-doc --> - * @see org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.serialization.SerializationPackage - * @generated - */ -public interface SerializationFactory extends EFactory { - /** - * The singleton instance of the factory. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - SerializationFactory eINSTANCE = org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.serialization.impl.SerializationFactoryImpl.init(); - - /** - * Returns a new object of class '<em>Abstract Reference Instance</em>'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return a new object of class '<em>Abstract Reference Instance</em>'. - * @generated - */ - AbstractReferenceInstance createAbstractReferenceInstance(); - - /** - * Returns a new object of class '<em>Multi Valued Containment Reference Instance</em>'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return a new object of class '<em>Multi Valued Containment Reference Instance</em>'. - * @generated - */ - MultiValuedContainmentReferenceInstance createMultiValuedContainmentReferenceInstance(); - - /** - * Returns a new object of class '<em>Multi Valued Reference Instance</em>'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return a new object of class '<em>Multi Valued Reference Instance</em>'. - * @generated - */ - MultiValuedReferenceInstance createMultiValuedReferenceInstance(); - - /** - * Returns a new object of class '<em>Single Valued Attribute Instance</em>'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return a new object of class '<em>Single Valued Attribute Instance</em>'. - * @generated - */ - SingleValuedAttributeInstance createSingleValuedAttributeInstance(); - - /** - * Returns a new object of class '<em>Extended EObject Reference</em>'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return a new object of class '<em>Extended EObject Reference</em>'. - * @generated - */ - ExtendedEObjectReference createExtendedEObjectReference(); - - /** - * Returns a new object of class '<em>Single Valued Containment Reference Instance</em>'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return a new object of class '<em>Single Valued Containment Reference Instance</em>'. - * @generated - */ - SingleValuedContainmentReferenceInstance createSingleValuedContainmentReferenceInstance(); - - /** - * Returns a new object of class '<em>Single Valued Reference Instance</em>'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return a new object of class '<em>Single Valued Reference Instance</em>'. - * @generated - */ - SingleValuedReferenceInstance createSingleValuedReferenceInstance(); - - /** - * Returns a new object of class '<em>Multi Valued Attribute Instance</em>'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return a new object of class '<em>Multi Valued Attribute Instance</em>'. - * @generated - */ - MultiValuedAttributeInstance createMultiValuedAttributeInstance(); - - /** - * Returns a new object of class '<em>Abstract Attribute Instance</em>'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return a new object of class '<em>Abstract Attribute Instance</em>'. - * @generated - */ - AbstractAttributeInstance createAbstractAttributeInstance(); - - /** - * Returns the package supported by this factory. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the package supported by this factory. - * @generated - */ - SerializationPackage getSerializationPackage(); - -} //SerializationFactory
diff --git a/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/emf/facet/efacet/metamodel/v0_2_0/efacet/serialization/SerializationPackage.java b/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/emf/facet/efacet/metamodel/v0_2_0/efacet/serialization/SerializationPackage.java deleted file mode 100644 index d75dab6..0000000 --- a/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/emf/facet/efacet/metamodel/v0_2_0/efacet/serialization/SerializationPackage.java +++ /dev/null
@@ -1,809 +0,0 @@ -/** - * Copyright (c) 2011 Mia-Software. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Gregoire Dupe (Mia-Software) - Design - * Nicolas Guyomar (Mia-Software) - Implementation - * Emmanuelle Rouillé (Mia-Software) - Bug 352618 - To be able to use non derived facet structural features and save them values. - * Nicolas Bros (Mia-Software) - Bug 361823 - [Restructuring] eFacet2 meta-model - * Gregoire Dupe (Mia-Software) - Bug 373078 - API Cleaning - */ -package org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.serialization; - -import org.eclipse.emf.ecore.EAttribute; -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.ecore.EPackage; -import org.eclipse.emf.ecore.EReference; - -/** - * <!-- begin-user-doc --> - * The <b>Package</b> for the model. - * It contains accessors for the meta objects to represent - * <ul> - * <li>each class,</li> - * <li>each feature of each class,</li> - * <li>each enum,</li> - * <li>and each data type</li> - * </ul> - * <!-- end-user-doc --> - * @see org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.serialization.SerializationFactory - * @model kind="package" - * @generated - */ -public interface SerializationPackage extends EPackage { - /** - * The package name. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - String eNAME = "serialization"; //$NON-NLS-1$ - - /** - * The package namespace URI. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - String eNS_URI = "http://www.eclipse.org/emf/facet/efacet/0.2.incubation/efacet/serialization"; //$NON-NLS-1$ - - /** - * The package namespace name. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - String eNS_PREFIX = "serialization"; //$NON-NLS-1$ - - /** - * The singleton instance of the package. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - SerializationPackage eINSTANCE = org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.serialization.impl.SerializationPackageImpl.init(); - - /** - * The meta object id for the '{@link org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.serialization.impl.AbstractReferenceInstanceImpl <em>Abstract Reference Instance</em>}' class. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.serialization.impl.AbstractReferenceInstanceImpl - * @see org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.serialization.impl.SerializationPackageImpl#getAbstractReferenceInstance() - * @generated - */ - int ABSTRACT_REFERENCE_INSTANCE = 0; - - /** - * The feature id for the '<em><b>EReference</b></em>' reference. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int ABSTRACT_REFERENCE_INSTANCE__EREFERENCE = 0; - - /** - * The number of structural features of the '<em>Abstract Reference Instance</em>' class. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int ABSTRACT_REFERENCE_INSTANCE_FEATURE_COUNT = 1; - - /** - * The meta object id for the '{@link org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.serialization.impl.MultiValuedContainmentReferenceInstanceImpl <em>Multi Valued Containment Reference Instance</em>}' class. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.serialization.impl.MultiValuedContainmentReferenceInstanceImpl - * @see org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.serialization.impl.SerializationPackageImpl#getMultiValuedContainmentReferenceInstance() - * @generated - */ - int MULTI_VALUED_CONTAINMENT_REFERENCE_INSTANCE = 1; - - /** - * The feature id for the '<em><b>EReference</b></em>' reference. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int MULTI_VALUED_CONTAINMENT_REFERENCE_INSTANCE__EREFERENCE = ABSTRACT_REFERENCE_INSTANCE__EREFERENCE; - - /** - * The feature id for the '<em><b>Owned Elements</b></em>' containment reference list. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int MULTI_VALUED_CONTAINMENT_REFERENCE_INSTANCE__OWNED_ELEMENTS = ABSTRACT_REFERENCE_INSTANCE_FEATURE_COUNT + 0; - - /** - * The number of structural features of the '<em>Multi Valued Containment Reference Instance</em>' class. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int MULTI_VALUED_CONTAINMENT_REFERENCE_INSTANCE_FEATURE_COUNT = ABSTRACT_REFERENCE_INSTANCE_FEATURE_COUNT + 1; - - /** - * The meta object id for the '{@link org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.serialization.impl.MultiValuedReferenceInstanceImpl <em>Multi Valued Reference Instance</em>}' class. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.serialization.impl.MultiValuedReferenceInstanceImpl - * @see org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.serialization.impl.SerializationPackageImpl#getMultiValuedReferenceInstance() - * @generated - */ - int MULTI_VALUED_REFERENCE_INSTANCE = 2; - - /** - * The feature id for the '<em><b>EReference</b></em>' reference. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int MULTI_VALUED_REFERENCE_INSTANCE__EREFERENCE = ABSTRACT_REFERENCE_INSTANCE__EREFERENCE; - - /** - * The feature id for the '<em><b>Referenced Elements</b></em>' reference list. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int MULTI_VALUED_REFERENCE_INSTANCE__REFERENCED_ELEMENTS = ABSTRACT_REFERENCE_INSTANCE_FEATURE_COUNT + 0; - - /** - * The number of structural features of the '<em>Multi Valued Reference Instance</em>' class. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int MULTI_VALUED_REFERENCE_INSTANCE_FEATURE_COUNT = ABSTRACT_REFERENCE_INSTANCE_FEATURE_COUNT + 1; - - /** - * The meta object id for the '{@link org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.serialization.impl.AbstractAttributeInstanceImpl <em>Abstract Attribute Instance</em>}' class. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.serialization.impl.AbstractAttributeInstanceImpl - * @see org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.serialization.impl.SerializationPackageImpl#getAbstractAttributeInstance() - * @generated - */ - int ABSTRACT_ATTRIBUTE_INSTANCE = 8; - - /** - * The feature id for the '<em><b>EAttribute</b></em>' reference. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int ABSTRACT_ATTRIBUTE_INSTANCE__EATTRIBUTE = 0; - - /** - * The number of structural features of the '<em>Abstract Attribute Instance</em>' class. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int ABSTRACT_ATTRIBUTE_INSTANCE_FEATURE_COUNT = 1; - - /** - * The meta object id for the '{@link org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.serialization.impl.SingleValuedAttributeInstanceImpl <em>Single Valued Attribute Instance</em>}' class. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.serialization.impl.SingleValuedAttributeInstanceImpl - * @see org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.serialization.impl.SerializationPackageImpl#getSingleValuedAttributeInstance() - * @generated - */ - int SINGLE_VALUED_ATTRIBUTE_INSTANCE = 3; - - /** - * The feature id for the '<em><b>EAttribute</b></em>' reference. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int SINGLE_VALUED_ATTRIBUTE_INSTANCE__EATTRIBUTE = ABSTRACT_ATTRIBUTE_INSTANCE__EATTRIBUTE; - - /** - * The feature id for the '<em><b>Value</b></em>' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int SINGLE_VALUED_ATTRIBUTE_INSTANCE__VALUE = ABSTRACT_ATTRIBUTE_INSTANCE_FEATURE_COUNT + 0; - - /** - * The number of structural features of the '<em>Single Valued Attribute Instance</em>' class. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int SINGLE_VALUED_ATTRIBUTE_INSTANCE_FEATURE_COUNT = ABSTRACT_ATTRIBUTE_INSTANCE_FEATURE_COUNT + 1; - - /** - * The meta object id for the '{@link org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.serialization.impl.ExtendedEObjectReferenceImpl <em>Extended EObject Reference</em>}' class. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.serialization.impl.ExtendedEObjectReferenceImpl - * @see org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.serialization.impl.SerializationPackageImpl#getExtendedEObjectReference() - * @generated - */ - int EXTENDED_EOBJECT_REFERENCE = 4; - - /** - * The feature id for the '<em><b>Extended EObject</b></em>' reference. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int EXTENDED_EOBJECT_REFERENCE__EXTENDED_EOBJECT = 0; - - /** - * The feature id for the '<em><b>Attribute Instances</b></em>' containment reference list. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int EXTENDED_EOBJECT_REFERENCE__ATTRIBUTE_INSTANCES = 1; - - /** - * The feature id for the '<em><b>Reference Instances</b></em>' containment reference list. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int EXTENDED_EOBJECT_REFERENCE__REFERENCE_INSTANCES = 2; - - /** - * The number of structural features of the '<em>Extended EObject Reference</em>' class. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int EXTENDED_EOBJECT_REFERENCE_FEATURE_COUNT = 3; - - /** - * The meta object id for the '{@link org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.serialization.impl.SingleValuedContainmentReferenceInstanceImpl <em>Single Valued Containment Reference Instance</em>}' class. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.serialization.impl.SingleValuedContainmentReferenceInstanceImpl - * @see org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.serialization.impl.SerializationPackageImpl#getSingleValuedContainmentReferenceInstance() - * @generated - */ - int SINGLE_VALUED_CONTAINMENT_REFERENCE_INSTANCE = 5; - - /** - * The feature id for the '<em><b>EReference</b></em>' reference. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int SINGLE_VALUED_CONTAINMENT_REFERENCE_INSTANCE__EREFERENCE = ABSTRACT_REFERENCE_INSTANCE__EREFERENCE; - - /** - * The feature id for the '<em><b>Owned Element</b></em>' containment reference. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int SINGLE_VALUED_CONTAINMENT_REFERENCE_INSTANCE__OWNED_ELEMENT = ABSTRACT_REFERENCE_INSTANCE_FEATURE_COUNT + 0; - - /** - * The number of structural features of the '<em>Single Valued Containment Reference Instance</em>' class. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int SINGLE_VALUED_CONTAINMENT_REFERENCE_INSTANCE_FEATURE_COUNT = ABSTRACT_REFERENCE_INSTANCE_FEATURE_COUNT + 1; - - /** - * The meta object id for the '{@link org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.serialization.impl.SingleValuedReferenceInstanceImpl <em>Single Valued Reference Instance</em>}' class. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.serialization.impl.SingleValuedReferenceInstanceImpl - * @see org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.serialization.impl.SerializationPackageImpl#getSingleValuedReferenceInstance() - * @generated - */ - int SINGLE_VALUED_REFERENCE_INSTANCE = 6; - - /** - * The feature id for the '<em><b>EReference</b></em>' reference. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int SINGLE_VALUED_REFERENCE_INSTANCE__EREFERENCE = ABSTRACT_REFERENCE_INSTANCE__EREFERENCE; - - /** - * The feature id for the '<em><b>Referenced Element</b></em>' reference. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int SINGLE_VALUED_REFERENCE_INSTANCE__REFERENCED_ELEMENT = ABSTRACT_REFERENCE_INSTANCE_FEATURE_COUNT + 0; - - /** - * The number of structural features of the '<em>Single Valued Reference Instance</em>' class. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int SINGLE_VALUED_REFERENCE_INSTANCE_FEATURE_COUNT = ABSTRACT_REFERENCE_INSTANCE_FEATURE_COUNT + 1; - - /** - * The meta object id for the '{@link org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.serialization.impl.MultiValuedAttributeInstanceImpl <em>Multi Valued Attribute Instance</em>}' class. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.serialization.impl.MultiValuedAttributeInstanceImpl - * @see org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.serialization.impl.SerializationPackageImpl#getMultiValuedAttributeInstance() - * @generated - */ - int MULTI_VALUED_ATTRIBUTE_INSTANCE = 7; - - /** - * The feature id for the '<em><b>EAttribute</b></em>' reference. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int MULTI_VALUED_ATTRIBUTE_INSTANCE__EATTRIBUTE = ABSTRACT_ATTRIBUTE_INSTANCE__EATTRIBUTE; - - /** - * The feature id for the '<em><b>Values</b></em>' attribute list. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int MULTI_VALUED_ATTRIBUTE_INSTANCE__VALUES = ABSTRACT_ATTRIBUTE_INSTANCE_FEATURE_COUNT + 0; - - /** - * The number of structural features of the '<em>Multi Valued Attribute Instance</em>' class. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int MULTI_VALUED_ATTRIBUTE_INSTANCE_FEATURE_COUNT = ABSTRACT_ATTRIBUTE_INSTANCE_FEATURE_COUNT + 1; - - - /** - * Returns the meta object for class '{@link org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.serialization.AbstractReferenceInstance <em>Abstract Reference Instance</em>}'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the meta object for class '<em>Abstract Reference Instance</em>'. - * @see org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.serialization.AbstractReferenceInstance - * @generated - */ - EClass getAbstractReferenceInstance(); - - /** - * Returns the meta object for the reference '{@link org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.serialization.AbstractReferenceInstance#getEReference <em>EReference</em>}'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the meta object for the reference '<em>EReference</em>'. - * @see org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.serialization.AbstractReferenceInstance#getEReference() - * @see #getAbstractReferenceInstance() - * @generated - */ - EReference getAbstractReferenceInstance_EReference(); - - /** - * Returns the meta object for class '{@link org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.serialization.MultiValuedContainmentReferenceInstance <em>Multi Valued Containment Reference Instance</em>}'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the meta object for class '<em>Multi Valued Containment Reference Instance</em>'. - * @see org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.serialization.MultiValuedContainmentReferenceInstance - * @generated - */ - EClass getMultiValuedContainmentReferenceInstance(); - - /** - * Returns the meta object for the containment reference list '{@link org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.serialization.MultiValuedContainmentReferenceInstance#getOwnedElements <em>Owned Elements</em>}'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the meta object for the containment reference list '<em>Owned Elements</em>'. - * @see org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.serialization.MultiValuedContainmentReferenceInstance#getOwnedElements() - * @see #getMultiValuedContainmentReferenceInstance() - * @generated - */ - EReference getMultiValuedContainmentReferenceInstance_OwnedElements(); - - /** - * Returns the meta object for class '{@link org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.serialization.MultiValuedReferenceInstance <em>Multi Valued Reference Instance</em>}'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the meta object for class '<em>Multi Valued Reference Instance</em>'. - * @see org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.serialization.MultiValuedReferenceInstance - * @generated - */ - EClass getMultiValuedReferenceInstance(); - - /** - * Returns the meta object for the reference list '{@link org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.serialization.MultiValuedReferenceInstance#getReferencedElements <em>Referenced Elements</em>}'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the meta object for the reference list '<em>Referenced Elements</em>'. - * @see org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.serialization.MultiValuedReferenceInstance#getReferencedElements() - * @see #getMultiValuedReferenceInstance() - * @generated - */ - EReference getMultiValuedReferenceInstance_ReferencedElements(); - - /** - * Returns the meta object for class '{@link org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.serialization.SingleValuedAttributeInstance <em>Single Valued Attribute Instance</em>}'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the meta object for class '<em>Single Valued Attribute Instance</em>'. - * @see org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.serialization.SingleValuedAttributeInstance - * @generated - */ - EClass getSingleValuedAttributeInstance(); - - /** - * Returns the meta object for the attribute '{@link org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.serialization.SingleValuedAttributeInstance#getValue <em>Value</em>}'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the meta object for the attribute '<em>Value</em>'. - * @see org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.serialization.SingleValuedAttributeInstance#getValue() - * @see #getSingleValuedAttributeInstance() - * @generated - */ - EAttribute getSingleValuedAttributeInstance_Value(); - - /** - * Returns the meta object for class '{@link org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.serialization.ExtendedEObjectReference <em>Extended EObject Reference</em>}'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the meta object for class '<em>Extended EObject Reference</em>'. - * @see org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.serialization.ExtendedEObjectReference - * @generated - */ - EClass getExtendedEObjectReference(); - - /** - * Returns the meta object for the reference '{@link org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.serialization.ExtendedEObjectReference#getExtendedEObject <em>Extended EObject</em>}'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the meta object for the reference '<em>Extended EObject</em>'. - * @see org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.serialization.ExtendedEObjectReference#getExtendedEObject() - * @see #getExtendedEObjectReference() - * @generated - */ - EReference getExtendedEObjectReference_ExtendedEObject(); - - /** - * Returns the meta object for the containment reference list '{@link org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.serialization.ExtendedEObjectReference#getAttributeInstances <em>Attribute Instances</em>}'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the meta object for the containment reference list '<em>Attribute Instances</em>'. - * @see org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.serialization.ExtendedEObjectReference#getAttributeInstances() - * @see #getExtendedEObjectReference() - * @generated - */ - EReference getExtendedEObjectReference_AttributeInstances(); - - /** - * Returns the meta object for the containment reference list '{@link org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.serialization.ExtendedEObjectReference#getReferenceInstances <em>Reference Instances</em>}'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the meta object for the containment reference list '<em>Reference Instances</em>'. - * @see org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.serialization.ExtendedEObjectReference#getReferenceInstances() - * @see #getExtendedEObjectReference() - * @generated - */ - EReference getExtendedEObjectReference_ReferenceInstances(); - - /** - * Returns the meta object for class '{@link org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.serialization.SingleValuedContainmentReferenceInstance <em>Single Valued Containment Reference Instance</em>}'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the meta object for class '<em>Single Valued Containment Reference Instance</em>'. - * @see org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.serialization.SingleValuedContainmentReferenceInstance - * @generated - */ - EClass getSingleValuedContainmentReferenceInstance(); - - /** - * Returns the meta object for the containment reference '{@link org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.serialization.SingleValuedContainmentReferenceInstance#getOwnedElement <em>Owned Element</em>}'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the meta object for the containment reference '<em>Owned Element</em>'. - * @see org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.serialization.SingleValuedContainmentReferenceInstance#getOwnedElement() - * @see #getSingleValuedContainmentReferenceInstance() - * @generated - */ - EReference getSingleValuedContainmentReferenceInstance_OwnedElement(); - - /** - * Returns the meta object for class '{@link org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.serialization.SingleValuedReferenceInstance <em>Single Valued Reference Instance</em>}'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the meta object for class '<em>Single Valued Reference Instance</em>'. - * @see org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.serialization.SingleValuedReferenceInstance - * @generated - */ - EClass getSingleValuedReferenceInstance(); - - /** - * Returns the meta object for the reference '{@link org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.serialization.SingleValuedReferenceInstance#getReferencedElement <em>Referenced Element</em>}'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the meta object for the reference '<em>Referenced Element</em>'. - * @see org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.serialization.SingleValuedReferenceInstance#getReferencedElement() - * @see #getSingleValuedReferenceInstance() - * @generated - */ - EReference getSingleValuedReferenceInstance_ReferencedElement(); - - /** - * Returns the meta object for class '{@link org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.serialization.MultiValuedAttributeInstance <em>Multi Valued Attribute Instance</em>}'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the meta object for class '<em>Multi Valued Attribute Instance</em>'. - * @see org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.serialization.MultiValuedAttributeInstance - * @generated - */ - EClass getMultiValuedAttributeInstance(); - - /** - * Returns the meta object for the attribute list '{@link org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.serialization.MultiValuedAttributeInstance#getValues <em>Values</em>}'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the meta object for the attribute list '<em>Values</em>'. - * @see org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.serialization.MultiValuedAttributeInstance#getValues() - * @see #getMultiValuedAttributeInstance() - * @generated - */ - EAttribute getMultiValuedAttributeInstance_Values(); - - /** - * Returns the meta object for class '{@link org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.serialization.AbstractAttributeInstance <em>Abstract Attribute Instance</em>}'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the meta object for class '<em>Abstract Attribute Instance</em>'. - * @see org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.serialization.AbstractAttributeInstance - * @generated - */ - EClass getAbstractAttributeInstance(); - - /** - * Returns the meta object for the reference '{@link org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.serialization.AbstractAttributeInstance#getEAttribute <em>EAttribute</em>}'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the meta object for the reference '<em>EAttribute</em>'. - * @see org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.serialization.AbstractAttributeInstance#getEAttribute() - * @see #getAbstractAttributeInstance() - * @generated - */ - EReference getAbstractAttributeInstance_EAttribute(); - - /** - * Returns the factory that creates the instances of the model. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the factory that creates the instances of the model. - * @generated - */ - SerializationFactory getSerializationFactory(); - - /** - * <!-- begin-user-doc --> - * Defines literals for the meta objects that represent - * <ul> - * <li>each class,</li> - * <li>each feature of each class,</li> - * <li>each enum,</li> - * <li>and each data type</li> - * </ul> - * <!-- end-user-doc --> - * @generated - */ - interface Literals { - /** - * The meta object literal for the '{@link org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.serialization.impl.AbstractReferenceInstanceImpl <em>Abstract Reference Instance</em>}' class. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.serialization.impl.AbstractReferenceInstanceImpl - * @see org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.serialization.impl.SerializationPackageImpl#getAbstractReferenceInstance() - * @generated - */ - EClass ABSTRACT_REFERENCE_INSTANCE = eINSTANCE.getAbstractReferenceInstance(); - - /** - * The meta object literal for the '<em><b>EReference</b></em>' reference feature. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - EReference ABSTRACT_REFERENCE_INSTANCE__EREFERENCE = eINSTANCE.getAbstractReferenceInstance_EReference(); - - /** - * The meta object literal for the '{@link org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.serialization.impl.MultiValuedContainmentReferenceInstanceImpl <em>Multi Valued Containment Reference Instance</em>}' class. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.serialization.impl.MultiValuedContainmentReferenceInstanceImpl - * @see org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.serialization.impl.SerializationPackageImpl#getMultiValuedContainmentReferenceInstance() - * @generated - */ - EClass MULTI_VALUED_CONTAINMENT_REFERENCE_INSTANCE = eINSTANCE.getMultiValuedContainmentReferenceInstance(); - - /** - * The meta object literal for the '<em><b>Owned Elements</b></em>' containment reference list feature. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - EReference MULTI_VALUED_CONTAINMENT_REFERENCE_INSTANCE__OWNED_ELEMENTS = eINSTANCE.getMultiValuedContainmentReferenceInstance_OwnedElements(); - - /** - * The meta object literal for the '{@link org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.serialization.impl.MultiValuedReferenceInstanceImpl <em>Multi Valued Reference Instance</em>}' class. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.serialization.impl.MultiValuedReferenceInstanceImpl - * @see org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.serialization.impl.SerializationPackageImpl#getMultiValuedReferenceInstance() - * @generated - */ - EClass MULTI_VALUED_REFERENCE_INSTANCE = eINSTANCE.getMultiValuedReferenceInstance(); - - /** - * The meta object literal for the '<em><b>Referenced Elements</b></em>' reference list feature. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - EReference MULTI_VALUED_REFERENCE_INSTANCE__REFERENCED_ELEMENTS = eINSTANCE.getMultiValuedReferenceInstance_ReferencedElements(); - - /** - * The meta object literal for the '{@link org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.serialization.impl.SingleValuedAttributeInstanceImpl <em>Single Valued Attribute Instance</em>}' class. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.serialization.impl.SingleValuedAttributeInstanceImpl - * @see org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.serialization.impl.SerializationPackageImpl#getSingleValuedAttributeInstance() - * @generated - */ - EClass SINGLE_VALUED_ATTRIBUTE_INSTANCE = eINSTANCE.getSingleValuedAttributeInstance(); - - /** - * The meta object literal for the '<em><b>Value</b></em>' attribute feature. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - EAttribute SINGLE_VALUED_ATTRIBUTE_INSTANCE__VALUE = eINSTANCE.getSingleValuedAttributeInstance_Value(); - - /** - * The meta object literal for the '{@link org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.serialization.impl.ExtendedEObjectReferenceImpl <em>Extended EObject Reference</em>}' class. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.serialization.impl.ExtendedEObjectReferenceImpl - * @see org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.serialization.impl.SerializationPackageImpl#getExtendedEObjectReference() - * @generated - */ - EClass EXTENDED_EOBJECT_REFERENCE = eINSTANCE.getExtendedEObjectReference(); - - /** - * The meta object literal for the '<em><b>Extended EObject</b></em>' reference feature. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - EReference EXTENDED_EOBJECT_REFERENCE__EXTENDED_EOBJECT = eINSTANCE.getExtendedEObjectReference_ExtendedEObject(); - - /** - * The meta object literal for the '<em><b>Attribute Instances</b></em>' containment reference list feature. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - EReference EXTENDED_EOBJECT_REFERENCE__ATTRIBUTE_INSTANCES = eINSTANCE.getExtendedEObjectReference_AttributeInstances(); - - /** - * The meta object literal for the '<em><b>Reference Instances</b></em>' containment reference list feature. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - EReference EXTENDED_EOBJECT_REFERENCE__REFERENCE_INSTANCES = eINSTANCE.getExtendedEObjectReference_ReferenceInstances(); - - /** - * The meta object literal for the '{@link org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.serialization.impl.SingleValuedContainmentReferenceInstanceImpl <em>Single Valued Containment Reference Instance</em>}' class. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.serialization.impl.SingleValuedContainmentReferenceInstanceImpl - * @see org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.serialization.impl.SerializationPackageImpl#getSingleValuedContainmentReferenceInstance() - * @generated - */ - EClass SINGLE_VALUED_CONTAINMENT_REFERENCE_INSTANCE = eINSTANCE.getSingleValuedContainmentReferenceInstance(); - - /** - * The meta object literal for the '<em><b>Owned Element</b></em>' containment reference feature. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - EReference SINGLE_VALUED_CONTAINMENT_REFERENCE_INSTANCE__OWNED_ELEMENT = eINSTANCE.getSingleValuedContainmentReferenceInstance_OwnedElement(); - - /** - * The meta object literal for the '{@link org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.serialization.impl.SingleValuedReferenceInstanceImpl <em>Single Valued Reference Instance</em>}' class. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.serialization.impl.SingleValuedReferenceInstanceImpl - * @see org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.serialization.impl.SerializationPackageImpl#getSingleValuedReferenceInstance() - * @generated - */ - EClass SINGLE_VALUED_REFERENCE_INSTANCE = eINSTANCE.getSingleValuedReferenceInstance(); - - /** - * The meta object literal for the '<em><b>Referenced Element</b></em>' reference feature. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - EReference SINGLE_VALUED_REFERENCE_INSTANCE__REFERENCED_ELEMENT = eINSTANCE.getSingleValuedReferenceInstance_ReferencedElement(); - - /** - * The meta object literal for the '{@link org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.serialization.impl.MultiValuedAttributeInstanceImpl <em>Multi Valued Attribute Instance</em>}' class. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.serialization.impl.MultiValuedAttributeInstanceImpl - * @see org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.serialization.impl.SerializationPackageImpl#getMultiValuedAttributeInstance() - * @generated - */ - EClass MULTI_VALUED_ATTRIBUTE_INSTANCE = eINSTANCE.getMultiValuedAttributeInstance(); - - /** - * The meta object literal for the '<em><b>Values</b></em>' attribute list feature. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - EAttribute MULTI_VALUED_ATTRIBUTE_INSTANCE__VALUES = eINSTANCE.getMultiValuedAttributeInstance_Values(); - - /** - * The meta object literal for the '{@link org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.serialization.impl.AbstractAttributeInstanceImpl <em>Abstract Attribute Instance</em>}' class. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.serialization.impl.AbstractAttributeInstanceImpl - * @see org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.serialization.impl.SerializationPackageImpl#getAbstractAttributeInstance() - * @generated - */ - EClass ABSTRACT_ATTRIBUTE_INSTANCE = eINSTANCE.getAbstractAttributeInstance(); - - /** - * The meta object literal for the '<em><b>EAttribute</b></em>' reference feature. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - EReference ABSTRACT_ATTRIBUTE_INSTANCE__EATTRIBUTE = eINSTANCE.getAbstractAttributeInstance_EAttribute(); - - } - -} //SerializationPackage
diff --git a/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/emf/facet/efacet/metamodel/v0_2_0/efacet/serialization/SingleValuedAttributeInstance.java b/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/emf/facet/efacet/metamodel/v0_2_0/efacet/serialization/SingleValuedAttributeInstance.java deleted file mode 100644 index 0f2a68d..0000000 --- a/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/emf/facet/efacet/metamodel/v0_2_0/efacet/serialization/SingleValuedAttributeInstance.java +++ /dev/null
@@ -1,61 +0,0 @@ -/** - * Copyright (c) 2011 Mia-Software. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Gregoire Dupe (Mia-Software) - Design - * Nicolas Guyomar (Mia-Software) - Implementation - * Emmanuelle Rouillé (Mia-Software) - Bug 352618 - To be able to use non derived facet structural features and save them values. - * Nicolas Bros (Mia-Software) - Bug 361823 - [Restructuring] eFacet2 meta-model - */ -package org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.serialization; - - -/** - * <!-- begin-user-doc --> - * A representation of the model object '<em><b>Single Valued Attribute Instance</b></em>'. - * <!-- end-user-doc --> - * - * <p> - * The following features are supported: - * <ul> - * <li>{@link org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.serialization.SingleValuedAttributeInstance#getValue <em>Value</em>}</li> - * </ul> - * </p> - * - * @see org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.serialization.SerializationPackage#getSingleValuedAttributeInstance() - * @model - * @generated - */ -public interface SingleValuedAttributeInstance extends AbstractAttributeInstance { - /** - * Returns the value of the '<em><b>Value</b></em>' attribute. - * <!-- begin-user-doc --> - * <p> - * If the meaning of the '<em>Value</em>' attribute isn't clear, - * there really should be more of a description here... - * </p> - * <!-- end-user-doc --> - * @return the value of the '<em>Value</em>' attribute. - * @see #setValue(Object) - * @see org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.serialization.SerializationPackage#getSingleValuedAttributeInstance_Value() - * @model - * @generated - */ - Object getValue(); - - /** - * Sets the value of the '{@link org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.serialization.SingleValuedAttributeInstance#getValue <em>Value</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @param value the new value of the '<em>Value</em>' attribute. - * @see #getValue() - * @generated - */ - void setValue(Object value); - -} // SingleValuedAttributeInstance
diff --git a/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/emf/facet/efacet/metamodel/v0_2_0/efacet/serialization/SingleValuedContainmentReferenceInstance.java b/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/emf/facet/efacet/metamodel/v0_2_0/efacet/serialization/SingleValuedContainmentReferenceInstance.java deleted file mode 100644 index c3e67a6..0000000 --- a/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/emf/facet/efacet/metamodel/v0_2_0/efacet/serialization/SingleValuedContainmentReferenceInstance.java +++ /dev/null
@@ -1,62 +0,0 @@ -/** - * Copyright (c) 2011 Mia-Software. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Gregoire Dupe (Mia-Software) - Design - * Nicolas Guyomar (Mia-Software) - Implementation - * Emmanuelle Rouillé (Mia-Software) - Bug 352618 - To be able to use non derived facet structural features and save them values. - * Nicolas Bros (Mia-Software) - Bug 361823 - [Restructuring] eFacet2 meta-model - */ -package org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.serialization; - -import org.eclipse.emf.ecore.EObject; - -/** - * <!-- begin-user-doc --> - * A representation of the model object '<em><b>Single Valued Containment Reference Instance</b></em>'. - * <!-- end-user-doc --> - * - * <p> - * The following features are supported: - * <ul> - * <li>{@link org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.serialization.SingleValuedContainmentReferenceInstance#getOwnedElement <em>Owned Element</em>}</li> - * </ul> - * </p> - * - * @see org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.serialization.SerializationPackage#getSingleValuedContainmentReferenceInstance() - * @model - * @generated - */ -public interface SingleValuedContainmentReferenceInstance extends AbstractReferenceInstance { - /** - * Returns the value of the '<em><b>Owned Element</b></em>' containment reference. - * <!-- begin-user-doc --> - * <p> - * If the meaning of the '<em>Owned Element</em>' containment reference isn't clear, - * there really should be more of a description here... - * </p> - * <!-- end-user-doc --> - * @return the value of the '<em>Owned Element</em>' containment reference. - * @see #setOwnedElement(EObject) - * @see org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.serialization.SerializationPackage#getSingleValuedContainmentReferenceInstance_OwnedElement() - * @model containment="true" - * @generated - */ - EObject getOwnedElement(); - - /** - * Sets the value of the '{@link org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.serialization.SingleValuedContainmentReferenceInstance#getOwnedElement <em>Owned Element</em>}' containment reference. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @param value the new value of the '<em>Owned Element</em>' containment reference. - * @see #getOwnedElement() - * @generated - */ - void setOwnedElement(EObject value); - -} // SingleValuedContainmentReferenceInstance
diff --git a/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/emf/facet/efacet/metamodel/v0_2_0/efacet/serialization/SingleValuedReferenceInstance.java b/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/emf/facet/efacet/metamodel/v0_2_0/efacet/serialization/SingleValuedReferenceInstance.java deleted file mode 100644 index 9880a0e..0000000 --- a/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/emf/facet/efacet/metamodel/v0_2_0/efacet/serialization/SingleValuedReferenceInstance.java +++ /dev/null
@@ -1,62 +0,0 @@ -/** - * Copyright (c) 2011 Mia-Software. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Gregoire Dupe (Mia-Software) - Design - * Nicolas Guyomar (Mia-Software) - Implementation - * Emmanuelle Rouillé (Mia-Software) - Bug 352618 - To be able to use non derived facet structural features and save them values. - * Nicolas Bros (Mia-Software) - Bug 361823 - [Restructuring] eFacet2 meta-model - */ -package org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.serialization; - -import org.eclipse.emf.ecore.EObject; - -/** - * <!-- begin-user-doc --> - * A representation of the model object '<em><b>Single Valued Reference Instance</b></em>'. - * <!-- end-user-doc --> - * - * <p> - * The following features are supported: - * <ul> - * <li>{@link org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.serialization.SingleValuedReferenceInstance#getReferencedElement <em>Referenced Element</em>}</li> - * </ul> - * </p> - * - * @see org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.serialization.SerializationPackage#getSingleValuedReferenceInstance() - * @model - * @generated - */ -public interface SingleValuedReferenceInstance extends AbstractReferenceInstance { - /** - * Returns the value of the '<em><b>Referenced Element</b></em>' reference. - * <!-- begin-user-doc --> - * <p> - * If the meaning of the '<em>Referenced Element</em>' reference isn't clear, - * there really should be more of a description here... - * </p> - * <!-- end-user-doc --> - * @return the value of the '<em>Referenced Element</em>' reference. - * @see #setReferencedElement(EObject) - * @see org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.serialization.SerializationPackage#getSingleValuedReferenceInstance_ReferencedElement() - * @model - * @generated - */ - EObject getReferencedElement(); - - /** - * Sets the value of the '{@link org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.serialization.SingleValuedReferenceInstance#getReferencedElement <em>Referenced Element</em>}' reference. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @param value the new value of the '<em>Referenced Element</em>' reference. - * @see #getReferencedElement() - * @generated - */ - void setReferencedElement(EObject value); - -} // SingleValuedReferenceInstance
diff --git a/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/emf/facet/efacet/metamodel/v0_2_0/efacet/serialization/impl/AbstractAttributeInstanceImpl.java b/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/emf/facet/efacet/metamodel/v0_2_0/efacet/serialization/impl/AbstractAttributeInstanceImpl.java deleted file mode 100644 index 059c2ee..0000000 --- a/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/emf/facet/efacet/metamodel/v0_2_0/efacet/serialization/impl/AbstractAttributeInstanceImpl.java +++ /dev/null
@@ -1,166 +0,0 @@ -/** - * Copyright (c) 2011 Mia-Software. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Gregoire Dupe (Mia-Software) - Design - * Nicolas Guyomar (Mia-Software) - Implementation - * Emmanuelle Rouillé (Mia-Software) - Bug 352618 - To be able to use non derived facet structural features and save them values. - * Nicolas Bros (Mia-Software) - Bug 361823 - [Restructuring] eFacet2 meta-model - */ -package org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.serialization.impl; - -import org.eclipse.emf.common.notify.Notification; -import org.eclipse.emf.ecore.EAttribute; -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.ecore.InternalEObject; -import org.eclipse.emf.ecore.impl.ENotificationImpl; -import org.eclipse.emf.ecore.impl.EObjectImpl; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.serialization.AbstractAttributeInstance; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.serialization.SerializationPackage; - -/** - * <!-- begin-user-doc --> - * An implementation of the model object '<em><b>Abstract Attribute Instance</b></em>'. - * <!-- end-user-doc --> - * <p> - * The following features are implemented: - * <ul> - * <li>{@link org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.serialization.impl.AbstractAttributeInstanceImpl#getEAttribute <em>EAttribute</em>}</li> - * </ul> - * </p> - * - * @generated - */ -public class AbstractAttributeInstanceImpl extends EObjectImpl implements AbstractAttributeInstance { - /** - * The cached value of the '{@link #getEAttribute() <em>EAttribute</em>}' reference. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #getEAttribute() - * @generated - * @ordered - */ - protected EAttribute eAttribute; - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected AbstractAttributeInstanceImpl() { - super(); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - protected EClass eStaticClass() { - return SerializationPackage.Literals.ABSTRACT_ATTRIBUTE_INSTANCE; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EAttribute getEAttribute() { - if (eAttribute != null && eAttribute.eIsProxy()) { - InternalEObject oldEAttribute = (InternalEObject)eAttribute; - eAttribute = (EAttribute)eResolveProxy(oldEAttribute); - if (eAttribute != oldEAttribute) { - if (eNotificationRequired()) - eNotify(new ENotificationImpl(this, Notification.RESOLVE, SerializationPackage.ABSTRACT_ATTRIBUTE_INSTANCE__EATTRIBUTE, oldEAttribute, eAttribute)); - } - } - return eAttribute; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EAttribute basicGetEAttribute() { - return eAttribute; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public void setEAttribute(EAttribute newEAttribute) { - EAttribute oldEAttribute = eAttribute; - eAttribute = newEAttribute; - if (eNotificationRequired()) - eNotify(new ENotificationImpl(this, Notification.SET, SerializationPackage.ABSTRACT_ATTRIBUTE_INSTANCE__EATTRIBUTE, oldEAttribute, eAttribute)); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public Object eGet(int featureID, boolean resolve, boolean coreType) { - switch (featureID) { - case SerializationPackage.ABSTRACT_ATTRIBUTE_INSTANCE__EATTRIBUTE: - if (resolve) return getEAttribute(); - return basicGetEAttribute(); - } - return super.eGet(featureID, resolve, coreType); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public void eSet(int featureID, Object newValue) { - switch (featureID) { - case SerializationPackage.ABSTRACT_ATTRIBUTE_INSTANCE__EATTRIBUTE: - setEAttribute((EAttribute)newValue); - return; - } - super.eSet(featureID, newValue); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public void eUnset(int featureID) { - switch (featureID) { - case SerializationPackage.ABSTRACT_ATTRIBUTE_INSTANCE__EATTRIBUTE: - setEAttribute((EAttribute)null); - return; - } - super.eUnset(featureID); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public boolean eIsSet(int featureID) { - switch (featureID) { - case SerializationPackage.ABSTRACT_ATTRIBUTE_INSTANCE__EATTRIBUTE: - return eAttribute != null; - } - return super.eIsSet(featureID); - } - -} //AbstractAttributeInstanceImpl
diff --git a/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/emf/facet/efacet/metamodel/v0_2_0/efacet/serialization/impl/AbstractReferenceInstanceImpl.java b/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/emf/facet/efacet/metamodel/v0_2_0/efacet/serialization/impl/AbstractReferenceInstanceImpl.java deleted file mode 100644 index 586be6c..0000000 --- a/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/emf/facet/efacet/metamodel/v0_2_0/efacet/serialization/impl/AbstractReferenceInstanceImpl.java +++ /dev/null
@@ -1,166 +0,0 @@ -/** - * Copyright (c) 2011 Mia-Software. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Gregoire Dupe (Mia-Software) - Design - * Nicolas Guyomar (Mia-Software) - Implementation - * Emmanuelle Rouillé (Mia-Software) - Bug 352618 - To be able to use non derived facet structural features and save them values. - * Nicolas Bros (Mia-Software) - Bug 361823 - [Restructuring] eFacet2 meta-model - */ -package org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.serialization.impl; - -import org.eclipse.emf.common.notify.Notification; -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.ecore.EReference; -import org.eclipse.emf.ecore.InternalEObject; -import org.eclipse.emf.ecore.impl.ENotificationImpl; -import org.eclipse.emf.ecore.impl.EObjectImpl; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.serialization.AbstractReferenceInstance; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.serialization.SerializationPackage; - -/** - * <!-- begin-user-doc --> - * An implementation of the model object '<em><b>Abstract Reference Instance</b></em>'. - * <!-- end-user-doc --> - * <p> - * The following features are implemented: - * <ul> - * <li>{@link org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.serialization.impl.AbstractReferenceInstanceImpl#getEReference <em>EReference</em>}</li> - * </ul> - * </p> - * - * @generated - */ -public class AbstractReferenceInstanceImpl extends EObjectImpl implements AbstractReferenceInstance { - /** - * The cached value of the '{@link #getEReference() <em>EReference</em>}' reference. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #getEReference() - * @generated - * @ordered - */ - protected EReference eReference; - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected AbstractReferenceInstanceImpl() { - super(); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - protected EClass eStaticClass() { - return SerializationPackage.Literals.ABSTRACT_REFERENCE_INSTANCE; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EReference getEReference() { - if (eReference != null && eReference.eIsProxy()) { - InternalEObject oldEReference = (InternalEObject)eReference; - eReference = (EReference)eResolveProxy(oldEReference); - if (eReference != oldEReference) { - if (eNotificationRequired()) - eNotify(new ENotificationImpl(this, Notification.RESOLVE, SerializationPackage.ABSTRACT_REFERENCE_INSTANCE__EREFERENCE, oldEReference, eReference)); - } - } - return eReference; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EReference basicGetEReference() { - return eReference; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public void setEReference(EReference newEReference) { - EReference oldEReference = eReference; - eReference = newEReference; - if (eNotificationRequired()) - eNotify(new ENotificationImpl(this, Notification.SET, SerializationPackage.ABSTRACT_REFERENCE_INSTANCE__EREFERENCE, oldEReference, eReference)); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public Object eGet(int featureID, boolean resolve, boolean coreType) { - switch (featureID) { - case SerializationPackage.ABSTRACT_REFERENCE_INSTANCE__EREFERENCE: - if (resolve) return getEReference(); - return basicGetEReference(); - } - return super.eGet(featureID, resolve, coreType); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public void eSet(int featureID, Object newValue) { - switch (featureID) { - case SerializationPackage.ABSTRACT_REFERENCE_INSTANCE__EREFERENCE: - setEReference((EReference)newValue); - return; - } - super.eSet(featureID, newValue); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public void eUnset(int featureID) { - switch (featureID) { - case SerializationPackage.ABSTRACT_REFERENCE_INSTANCE__EREFERENCE: - setEReference((EReference)null); - return; - } - super.eUnset(featureID); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public boolean eIsSet(int featureID) { - switch (featureID) { - case SerializationPackage.ABSTRACT_REFERENCE_INSTANCE__EREFERENCE: - return eReference != null; - } - return super.eIsSet(featureID); - } - -} //AbstractReferenceInstanceImpl
diff --git a/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/emf/facet/efacet/metamodel/v0_2_0/efacet/serialization/impl/ExtendedEObjectReferenceImpl.java b/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/emf/facet/efacet/metamodel/v0_2_0/efacet/serialization/impl/ExtendedEObjectReferenceImpl.java deleted file mode 100644 index d5de020..0000000 --- a/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/emf/facet/efacet/metamodel/v0_2_0/efacet/serialization/impl/ExtendedEObjectReferenceImpl.java +++ /dev/null
@@ -1,259 +0,0 @@ -/** - * Copyright (c) 2011 Mia-Software. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Gregoire Dupe (Mia-Software) - Design - * Nicolas Guyomar (Mia-Software) - Implementation - * Emmanuelle Rouillé (Mia-Software) - Bug 352618 - To be able to use non derived facet structural features and save them values. - * Nicolas Bros (Mia-Software) - Bug 361823 - [Restructuring] eFacet2 meta-model - */ -package org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.serialization.impl; - -import java.util.Collection; - -import org.eclipse.emf.common.notify.Notification; -import org.eclipse.emf.common.notify.NotificationChain; -import org.eclipse.emf.common.util.EList; -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.InternalEObject; -import org.eclipse.emf.ecore.impl.ENotificationImpl; -import org.eclipse.emf.ecore.impl.EObjectImpl; -import org.eclipse.emf.ecore.util.EObjectContainmentEList; -import org.eclipse.emf.ecore.util.InternalEList; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.serialization.AbstractAttributeInstance; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.serialization.AbstractReferenceInstance; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.serialization.ExtendedEObjectReference; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.serialization.SerializationPackage; - -/** - * <!-- begin-user-doc --> - * An implementation of the model object '<em><b>Extended EObject Reference</b></em>'. - * <!-- end-user-doc --> - * <p> - * The following features are implemented: - * <ul> - * <li>{@link org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.serialization.impl.ExtendedEObjectReferenceImpl#getExtendedEObject <em>Extended EObject</em>}</li> - * <li>{@link org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.serialization.impl.ExtendedEObjectReferenceImpl#getAttributeInstances <em>Attribute Instances</em>}</li> - * <li>{@link org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.serialization.impl.ExtendedEObjectReferenceImpl#getReferenceInstances <em>Reference Instances</em>}</li> - * </ul> - * </p> - * - * @generated - */ -public class ExtendedEObjectReferenceImpl extends EObjectImpl implements ExtendedEObjectReference { - /** - * The cached value of the '{@link #getExtendedEObject() <em>Extended EObject</em>}' reference. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #getExtendedEObject() - * @generated - * @ordered - */ - protected EObject extendedEObject; - - /** - * The cached value of the '{@link #getAttributeInstances() <em>Attribute Instances</em>}' containment reference list. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #getAttributeInstances() - * @generated - * @ordered - */ - protected EList<AbstractAttributeInstance> attributeInstances; - - /** - * The cached value of the '{@link #getReferenceInstances() <em>Reference Instances</em>}' containment reference list. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #getReferenceInstances() - * @generated - * @ordered - */ - protected EList<AbstractReferenceInstance> referenceInstances; - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected ExtendedEObjectReferenceImpl() { - super(); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - protected EClass eStaticClass() { - return SerializationPackage.Literals.EXTENDED_EOBJECT_REFERENCE; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EObject getExtendedEObject() { - if (extendedEObject != null && extendedEObject.eIsProxy()) { - InternalEObject oldExtendedEObject = (InternalEObject)extendedEObject; - extendedEObject = eResolveProxy(oldExtendedEObject); - if (extendedEObject != oldExtendedEObject) { - if (eNotificationRequired()) - eNotify(new ENotificationImpl(this, Notification.RESOLVE, SerializationPackage.EXTENDED_EOBJECT_REFERENCE__EXTENDED_EOBJECT, oldExtendedEObject, extendedEObject)); - } - } - return extendedEObject; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EObject basicGetExtendedEObject() { - return extendedEObject; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public void setExtendedEObject(EObject newExtendedEObject) { - EObject oldExtendedEObject = extendedEObject; - extendedEObject = newExtendedEObject; - if (eNotificationRequired()) - eNotify(new ENotificationImpl(this, Notification.SET, SerializationPackage.EXTENDED_EOBJECT_REFERENCE__EXTENDED_EOBJECT, oldExtendedEObject, extendedEObject)); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EList<AbstractAttributeInstance> getAttributeInstances() { - if (attributeInstances == null) { - attributeInstances = new EObjectContainmentEList<AbstractAttributeInstance>(AbstractAttributeInstance.class, this, SerializationPackage.EXTENDED_EOBJECT_REFERENCE__ATTRIBUTE_INSTANCES); - } - return attributeInstances; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EList<AbstractReferenceInstance> getReferenceInstances() { - if (referenceInstances == null) { - referenceInstances = new EObjectContainmentEList<AbstractReferenceInstance>(AbstractReferenceInstance.class, this, SerializationPackage.EXTENDED_EOBJECT_REFERENCE__REFERENCE_INSTANCES); - } - return referenceInstances; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { - switch (featureID) { - case SerializationPackage.EXTENDED_EOBJECT_REFERENCE__ATTRIBUTE_INSTANCES: - return ((InternalEList<?>)getAttributeInstances()).basicRemove(otherEnd, msgs); - case SerializationPackage.EXTENDED_EOBJECT_REFERENCE__REFERENCE_INSTANCES: - return ((InternalEList<?>)getReferenceInstances()).basicRemove(otherEnd, msgs); - } - return super.eInverseRemove(otherEnd, featureID, msgs); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public Object eGet(int featureID, boolean resolve, boolean coreType) { - switch (featureID) { - case SerializationPackage.EXTENDED_EOBJECT_REFERENCE__EXTENDED_EOBJECT: - if (resolve) return getExtendedEObject(); - return basicGetExtendedEObject(); - case SerializationPackage.EXTENDED_EOBJECT_REFERENCE__ATTRIBUTE_INSTANCES: - return getAttributeInstances(); - case SerializationPackage.EXTENDED_EOBJECT_REFERENCE__REFERENCE_INSTANCES: - return getReferenceInstances(); - } - return super.eGet(featureID, resolve, coreType); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @SuppressWarnings("unchecked") - @Override - public void eSet(int featureID, Object newValue) { - switch (featureID) { - case SerializationPackage.EXTENDED_EOBJECT_REFERENCE__EXTENDED_EOBJECT: - setExtendedEObject((EObject)newValue); - return; - case SerializationPackage.EXTENDED_EOBJECT_REFERENCE__ATTRIBUTE_INSTANCES: - getAttributeInstances().clear(); - getAttributeInstances().addAll((Collection<? extends AbstractAttributeInstance>)newValue); - return; - case SerializationPackage.EXTENDED_EOBJECT_REFERENCE__REFERENCE_INSTANCES: - getReferenceInstances().clear(); - getReferenceInstances().addAll((Collection<? extends AbstractReferenceInstance>)newValue); - return; - } - super.eSet(featureID, newValue); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public void eUnset(int featureID) { - switch (featureID) { - case SerializationPackage.EXTENDED_EOBJECT_REFERENCE__EXTENDED_EOBJECT: - setExtendedEObject((EObject)null); - return; - case SerializationPackage.EXTENDED_EOBJECT_REFERENCE__ATTRIBUTE_INSTANCES: - getAttributeInstances().clear(); - return; - case SerializationPackage.EXTENDED_EOBJECT_REFERENCE__REFERENCE_INSTANCES: - getReferenceInstances().clear(); - return; - } - super.eUnset(featureID); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public boolean eIsSet(int featureID) { - switch (featureID) { - case SerializationPackage.EXTENDED_EOBJECT_REFERENCE__EXTENDED_EOBJECT: - return extendedEObject != null; - case SerializationPackage.EXTENDED_EOBJECT_REFERENCE__ATTRIBUTE_INSTANCES: - return attributeInstances != null && !attributeInstances.isEmpty(); - case SerializationPackage.EXTENDED_EOBJECT_REFERENCE__REFERENCE_INSTANCES: - return referenceInstances != null && !referenceInstances.isEmpty(); - } - return super.eIsSet(featureID); - } - -} //ExtendedEObjectReferenceImpl
diff --git a/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/emf/facet/efacet/metamodel/v0_2_0/efacet/serialization/impl/MultiValuedAttributeInstanceImpl.java b/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/emf/facet/efacet/metamodel/v0_2_0/efacet/serialization/impl/MultiValuedAttributeInstanceImpl.java deleted file mode 100644 index 47de748..0000000 --- a/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/emf/facet/efacet/metamodel/v0_2_0/efacet/serialization/impl/MultiValuedAttributeInstanceImpl.java +++ /dev/null
@@ -1,156 +0,0 @@ -/** - * Copyright (c) 2011 Mia-Software. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Gregoire Dupe (Mia-Software) - Design - * Nicolas Guyomar (Mia-Software) - Implementation - * Emmanuelle Rouillé (Mia-Software) - Bug 352618 - To be able to use non derived facet structural features and save them values. - * Nicolas Bros (Mia-Software) - Bug 361823 - [Restructuring] eFacet2 meta-model - */ -package org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.serialization.impl; - -import java.util.Collection; - -import org.eclipse.emf.common.util.EList; -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.ecore.util.EDataTypeUniqueEList; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.serialization.MultiValuedAttributeInstance; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.serialization.SerializationPackage; - -/** - * <!-- begin-user-doc --> - * An implementation of the model object '<em><b>Multi Valued Attribute Instance</b></em>'. - * <!-- end-user-doc --> - * <p> - * The following features are implemented: - * <ul> - * <li>{@link org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.serialization.impl.MultiValuedAttributeInstanceImpl#getValues <em>Values</em>}</li> - * </ul> - * </p> - * - * @generated - */ -public class MultiValuedAttributeInstanceImpl extends AbstractAttributeInstanceImpl implements MultiValuedAttributeInstance { - /** - * The cached value of the '{@link #getValues() <em>Values</em>}' attribute list. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #getValues() - * @generated - * @ordered - */ - protected EList<Object> values; - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected MultiValuedAttributeInstanceImpl() { - super(); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - protected EClass eStaticClass() { - return SerializationPackage.Literals.MULTI_VALUED_ATTRIBUTE_INSTANCE; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EList<Object> getValues() { - if (values == null) { - values = new EDataTypeUniqueEList<Object>(Object.class, this, SerializationPackage.MULTI_VALUED_ATTRIBUTE_INSTANCE__VALUES); - } - return values; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public Object eGet(int featureID, boolean resolve, boolean coreType) { - switch (featureID) { - case SerializationPackage.MULTI_VALUED_ATTRIBUTE_INSTANCE__VALUES: - return getValues(); - } - return super.eGet(featureID, resolve, coreType); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @SuppressWarnings("unchecked") - @Override - public void eSet(int featureID, Object newValue) { - switch (featureID) { - case SerializationPackage.MULTI_VALUED_ATTRIBUTE_INSTANCE__VALUES: - getValues().clear(); - getValues().addAll((Collection<? extends Object>)newValue); - return; - } - super.eSet(featureID, newValue); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public void eUnset(int featureID) { - switch (featureID) { - case SerializationPackage.MULTI_VALUED_ATTRIBUTE_INSTANCE__VALUES: - getValues().clear(); - return; - } - super.eUnset(featureID); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public boolean eIsSet(int featureID) { - switch (featureID) { - case SerializationPackage.MULTI_VALUED_ATTRIBUTE_INSTANCE__VALUES: - return values != null && !values.isEmpty(); - } - return super.eIsSet(featureID); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public String toString() { - if (eIsProxy()) return super.toString(); - - StringBuffer result = new StringBuffer(super.toString()); - result.append(" (values: "); //$NON-NLS-1$ - result.append(values); - result.append(')'); - return result.toString(); - } - -} //MultiValuedAttributeInstanceImpl
diff --git a/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/emf/facet/efacet/metamodel/v0_2_0/efacet/serialization/impl/MultiValuedContainmentReferenceInstanceImpl.java b/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/emf/facet/efacet/metamodel/v0_2_0/efacet/serialization/impl/MultiValuedContainmentReferenceInstanceImpl.java deleted file mode 100644 index 75af462..0000000 --- a/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/emf/facet/efacet/metamodel/v0_2_0/efacet/serialization/impl/MultiValuedContainmentReferenceInstanceImpl.java +++ /dev/null
@@ -1,158 +0,0 @@ -/** - * Copyright (c) 2011 Mia-Software. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Gregoire Dupe (Mia-Software) - Design - * Nicolas Guyomar (Mia-Software) - Implementation - * Emmanuelle Rouillé (Mia-Software) - Bug 352618 - To be able to use non derived facet structural features and save them values. - * Nicolas Bros (Mia-Software) - Bug 361823 - [Restructuring] eFacet2 meta-model - */ -package org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.serialization.impl; - -import java.util.Collection; - -import org.eclipse.emf.common.notify.NotificationChain; -import org.eclipse.emf.common.util.EList; -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.InternalEObject; -import org.eclipse.emf.ecore.util.EObjectContainmentEList; -import org.eclipse.emf.ecore.util.InternalEList; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.serialization.MultiValuedContainmentReferenceInstance; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.serialization.SerializationPackage; - -/** - * <!-- begin-user-doc --> - * An implementation of the model object '<em><b>Multi Valued Containment Reference Instance</b></em>'. - * <!-- end-user-doc --> - * <p> - * The following features are implemented: - * <ul> - * <li>{@link org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.serialization.impl.MultiValuedContainmentReferenceInstanceImpl#getOwnedElements <em>Owned Elements</em>}</li> - * </ul> - * </p> - * - * @generated - */ -public class MultiValuedContainmentReferenceInstanceImpl extends AbstractReferenceInstanceImpl implements MultiValuedContainmentReferenceInstance { - /** - * The cached value of the '{@link #getOwnedElements() <em>Owned Elements</em>}' containment reference list. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #getOwnedElements() - * @generated - * @ordered - */ - protected EList<EObject> ownedElements; - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected MultiValuedContainmentReferenceInstanceImpl() { - super(); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - protected EClass eStaticClass() { - return SerializationPackage.Literals.MULTI_VALUED_CONTAINMENT_REFERENCE_INSTANCE; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EList<EObject> getOwnedElements() { - if (ownedElements == null) { - ownedElements = new EObjectContainmentEList<EObject>(EObject.class, this, SerializationPackage.MULTI_VALUED_CONTAINMENT_REFERENCE_INSTANCE__OWNED_ELEMENTS); - } - return ownedElements; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { - switch (featureID) { - case SerializationPackage.MULTI_VALUED_CONTAINMENT_REFERENCE_INSTANCE__OWNED_ELEMENTS: - return ((InternalEList<?>)getOwnedElements()).basicRemove(otherEnd, msgs); - } - return super.eInverseRemove(otherEnd, featureID, msgs); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public Object eGet(int featureID, boolean resolve, boolean coreType) { - switch (featureID) { - case SerializationPackage.MULTI_VALUED_CONTAINMENT_REFERENCE_INSTANCE__OWNED_ELEMENTS: - return getOwnedElements(); - } - return super.eGet(featureID, resolve, coreType); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @SuppressWarnings("unchecked") - @Override - public void eSet(int featureID, Object newValue) { - switch (featureID) { - case SerializationPackage.MULTI_VALUED_CONTAINMENT_REFERENCE_INSTANCE__OWNED_ELEMENTS: - getOwnedElements().clear(); - getOwnedElements().addAll((Collection<? extends EObject>)newValue); - return; - } - super.eSet(featureID, newValue); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public void eUnset(int featureID) { - switch (featureID) { - case SerializationPackage.MULTI_VALUED_CONTAINMENT_REFERENCE_INSTANCE__OWNED_ELEMENTS: - getOwnedElements().clear(); - return; - } - super.eUnset(featureID); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public boolean eIsSet(int featureID) { - switch (featureID) { - case SerializationPackage.MULTI_VALUED_CONTAINMENT_REFERENCE_INSTANCE__OWNED_ELEMENTS: - return ownedElements != null && !ownedElements.isEmpty(); - } - return super.eIsSet(featureID); - } - -} //MultiValuedContainmentReferenceInstanceImpl
diff --git a/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/emf/facet/efacet/metamodel/v0_2_0/efacet/serialization/impl/MultiValuedReferenceInstanceImpl.java b/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/emf/facet/efacet/metamodel/v0_2_0/efacet/serialization/impl/MultiValuedReferenceInstanceImpl.java deleted file mode 100644 index 1effef5..0000000 --- a/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/emf/facet/efacet/metamodel/v0_2_0/efacet/serialization/impl/MultiValuedReferenceInstanceImpl.java +++ /dev/null
@@ -1,141 +0,0 @@ -/** - * Copyright (c) 2011 Mia-Software. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Gregoire Dupe (Mia-Software) - Design - * Nicolas Guyomar (Mia-Software) - Implementation - * Emmanuelle Rouillé (Mia-Software) - Bug 352618 - To be able to use non derived facet structural features and save them values. - * Nicolas Bros (Mia-Software) - Bug 361823 - [Restructuring] eFacet2 meta-model - */ -package org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.serialization.impl; - -import java.util.Collection; - -import org.eclipse.emf.common.util.EList; -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.util.EObjectResolvingEList; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.serialization.MultiValuedReferenceInstance; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.serialization.SerializationPackage; - -/** - * <!-- begin-user-doc --> - * An implementation of the model object '<em><b>Multi Valued Reference Instance</b></em>'. - * <!-- end-user-doc --> - * <p> - * The following features are implemented: - * <ul> - * <li>{@link org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.serialization.impl.MultiValuedReferenceInstanceImpl#getReferencedElements <em>Referenced Elements</em>}</li> - * </ul> - * </p> - * - * @generated - */ -public class MultiValuedReferenceInstanceImpl extends AbstractReferenceInstanceImpl implements MultiValuedReferenceInstance { - /** - * The cached value of the '{@link #getReferencedElements() <em>Referenced Elements</em>}' reference list. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #getReferencedElements() - * @generated - * @ordered - */ - protected EList<EObject> referencedElements; - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected MultiValuedReferenceInstanceImpl() { - super(); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - protected EClass eStaticClass() { - return SerializationPackage.Literals.MULTI_VALUED_REFERENCE_INSTANCE; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EList<EObject> getReferencedElements() { - if (referencedElements == null) { - referencedElements = new EObjectResolvingEList<EObject>(EObject.class, this, SerializationPackage.MULTI_VALUED_REFERENCE_INSTANCE__REFERENCED_ELEMENTS); - } - return referencedElements; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public Object eGet(int featureID, boolean resolve, boolean coreType) { - switch (featureID) { - case SerializationPackage.MULTI_VALUED_REFERENCE_INSTANCE__REFERENCED_ELEMENTS: - return getReferencedElements(); - } - return super.eGet(featureID, resolve, coreType); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @SuppressWarnings("unchecked") - @Override - public void eSet(int featureID, Object newValue) { - switch (featureID) { - case SerializationPackage.MULTI_VALUED_REFERENCE_INSTANCE__REFERENCED_ELEMENTS: - getReferencedElements().clear(); - getReferencedElements().addAll((Collection<? extends EObject>)newValue); - return; - } - super.eSet(featureID, newValue); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public void eUnset(int featureID) { - switch (featureID) { - case SerializationPackage.MULTI_VALUED_REFERENCE_INSTANCE__REFERENCED_ELEMENTS: - getReferencedElements().clear(); - return; - } - super.eUnset(featureID); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public boolean eIsSet(int featureID) { - switch (featureID) { - case SerializationPackage.MULTI_VALUED_REFERENCE_INSTANCE__REFERENCED_ELEMENTS: - return referencedElements != null && !referencedElements.isEmpty(); - } - return super.eIsSet(featureID); - } - -} //MultiValuedReferenceInstanceImpl
diff --git a/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/emf/facet/efacet/metamodel/v0_2_0/efacet/serialization/impl/SerializationFactoryImpl.java b/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/emf/facet/efacet/metamodel/v0_2_0/efacet/serialization/impl/SerializationFactoryImpl.java deleted file mode 100644 index 2f5161d..0000000 --- a/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/emf/facet/efacet/metamodel/v0_2_0/efacet/serialization/impl/SerializationFactoryImpl.java +++ /dev/null
@@ -1,212 +0,0 @@ -/** - * Copyright (c) 2011, 2015 Mia-Software, and Soft-Maint. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Gregoire Dupe (Mia-Software) - Design - * Nicolas Guyomar (Mia-Software) - Implementation - * Emmanuelle Rouillé (Mia-Software) - Bug 352618 - To be able to use non derived facet structural features and save them values. - * Nicolas Bros (Mia-Software) - Bug 361823 - [Restructuring] eFacet2 meta-model - * Gregoire Dupe (Mia-Software) - Bug 366055 - NavigationQuery - * Gregoire Dupe (Mia-Software) - Bug 369673 - [Facet] IsOneOfQuery - * Olivier Remaud (Soft-Maint) - Bug 369824 - Add a simple way to return string literal constants from a customization query - * Gregoire Dupe (Mia-Software) - Bug 369987 - [Restructuring][Table] Switch to the new customization and facet framework - * Gregoire Dupe (Mia-software) - Bug 364325 - [Restructuring] The user must be able to navigate into a model using the Facet. - * Nicolas Bros (Mia-Software) - Bug 372626 - [Facet] Aggregates - * Nicolas Bros (Mia-Software) - Bug 376941 - [EFacet] Facet operation arguments in Facet model - * Gregoire Dupe (Mia-Software) - Bug 376576 - [EFacet] Change the multiplicity of Facet::extendedFacet - * Jonathan Pepin (Soft-Maint) - Bug 463898 - Create FacetReference not derived, without query and with opposite mechanism - */ -package org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.serialization.impl; - -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.EPackage; -import org.eclipse.emf.ecore.impl.EFactoryImpl; -import org.eclipse.emf.ecore.plugin.EcorePlugin; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.serialization.*; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.serialization.AbstractAttributeInstance; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.serialization.AbstractReferenceInstance; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.serialization.ExtendedEObjectReference; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.serialization.MultiValuedAttributeInstance; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.serialization.MultiValuedContainmentReferenceInstance; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.serialization.MultiValuedReferenceInstance; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.serialization.SerializationFactory; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.serialization.SerializationPackage; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.serialization.SingleValuedAttributeInstance; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.serialization.SingleValuedContainmentReferenceInstance; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.serialization.SingleValuedReferenceInstance; - -/** - * <!-- begin-user-doc --> - * An implementation of the model <b>Factory</b>. - * <!-- end-user-doc --> - * @generated - */ -public class SerializationFactoryImpl extends EFactoryImpl implements SerializationFactory { - /** - * Creates the default factory implementation. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public static SerializationFactory init() { - try { - SerializationFactory theSerializationFactory = (SerializationFactory)EPackage.Registry.INSTANCE.getEFactory(SerializationPackage.eNS_URI); - if (theSerializationFactory != null) { - return theSerializationFactory; - } - } - catch (Exception exception) { - EcorePlugin.INSTANCE.log(exception); - } - return new SerializationFactoryImpl(); - } - - /** - * Creates an instance of the factory. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public SerializationFactoryImpl() { - super(); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public EObject create(EClass eClass) { - switch (eClass.getClassifierID()) { - case SerializationPackage.ABSTRACT_REFERENCE_INSTANCE: return createAbstractReferenceInstance(); - case SerializationPackage.MULTI_VALUED_CONTAINMENT_REFERENCE_INSTANCE: return createMultiValuedContainmentReferenceInstance(); - case SerializationPackage.MULTI_VALUED_REFERENCE_INSTANCE: return createMultiValuedReferenceInstance(); - case SerializationPackage.SINGLE_VALUED_ATTRIBUTE_INSTANCE: return createSingleValuedAttributeInstance(); - case SerializationPackage.EXTENDED_EOBJECT_REFERENCE: return createExtendedEObjectReference(); - case SerializationPackage.SINGLE_VALUED_CONTAINMENT_REFERENCE_INSTANCE: return createSingleValuedContainmentReferenceInstance(); - case SerializationPackage.SINGLE_VALUED_REFERENCE_INSTANCE: return createSingleValuedReferenceInstance(); - case SerializationPackage.MULTI_VALUED_ATTRIBUTE_INSTANCE: return createMultiValuedAttributeInstance(); - case SerializationPackage.ABSTRACT_ATTRIBUTE_INSTANCE: return createAbstractAttributeInstance(); - default: - throw new IllegalArgumentException("The class '" + eClass.getName() + "' is not a valid classifier"); //$NON-NLS-1$ //$NON-NLS-2$ - } - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public AbstractReferenceInstance createAbstractReferenceInstance() { - AbstractReferenceInstanceImpl abstractReferenceInstance = new AbstractReferenceInstanceImpl(); - return abstractReferenceInstance; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public MultiValuedContainmentReferenceInstance createMultiValuedContainmentReferenceInstance() { - MultiValuedContainmentReferenceInstanceImpl multiValuedContainmentReferenceInstance = new MultiValuedContainmentReferenceInstanceImpl(); - return multiValuedContainmentReferenceInstance; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public MultiValuedReferenceInstance createMultiValuedReferenceInstance() { - MultiValuedReferenceInstanceImpl multiValuedReferenceInstance = new MultiValuedReferenceInstanceImpl(); - return multiValuedReferenceInstance; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public SingleValuedAttributeInstance createSingleValuedAttributeInstance() { - SingleValuedAttributeInstanceImpl singleValuedAttributeInstance = new SingleValuedAttributeInstanceImpl(); - return singleValuedAttributeInstance; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public ExtendedEObjectReference createExtendedEObjectReference() { - ExtendedEObjectReferenceImpl extendedEObjectReference = new ExtendedEObjectReferenceImpl(); - return extendedEObjectReference; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public SingleValuedContainmentReferenceInstance createSingleValuedContainmentReferenceInstance() { - SingleValuedContainmentReferenceInstanceImpl singleValuedContainmentReferenceInstance = new SingleValuedContainmentReferenceInstanceImpl(); - return singleValuedContainmentReferenceInstance; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public SingleValuedReferenceInstance createSingleValuedReferenceInstance() { - SingleValuedReferenceInstanceImpl singleValuedReferenceInstance = new SingleValuedReferenceInstanceImpl(); - return singleValuedReferenceInstance; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public MultiValuedAttributeInstance createMultiValuedAttributeInstance() { - MultiValuedAttributeInstanceImpl multiValuedAttributeInstance = new MultiValuedAttributeInstanceImpl(); - return multiValuedAttributeInstance; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public AbstractAttributeInstance createAbstractAttributeInstance() { - AbstractAttributeInstanceImpl abstractAttributeInstance = new AbstractAttributeInstanceImpl(); - return abstractAttributeInstance; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public SerializationPackage getSerializationPackage() { - return (SerializationPackage)getEPackage(); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @deprecated - * @generated - */ - @Deprecated - public static SerializationPackage getPackage() { - return SerializationPackage.eINSTANCE; - } - -} //SerializationFactoryImpl
diff --git a/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/emf/facet/efacet/metamodel/v0_2_0/efacet/serialization/impl/SerializationPackageImpl.java b/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/emf/facet/efacet/metamodel/v0_2_0/efacet/serialization/impl/SerializationPackageImpl.java deleted file mode 100644 index 5321829..0000000 --- a/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/emf/facet/efacet/metamodel/v0_2_0/efacet/serialization/impl/SerializationPackageImpl.java +++ /dev/null
@@ -1,497 +0,0 @@ -/** - * Copyright (c) 2011, 2012 Mia-Software. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Gregoire Dupe (Mia-Software) - Design - * Nicolas Guyomar (Mia-Software) - Implementation - * Emmanuelle Rouillé (Mia-Software) - Bug 352618 - To be able to use non derived facet structural features and save them values. - * Nicolas Bros (Mia-Software) - Bug 361823 - [Restructuring] eFacet2 meta-model - * Gregoire Dupe (Mia-Software) - Bug 369987 - [Restructuring][Table] Switch to the new customization and facet framework - * Gregoire Dupe (Mia-Software) - Bug 364325 - [Restructuring] The user must be able to navigate into a model using the Facet. - */ -package org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.serialization.impl; - -import org.eclipse.emf.ecore.EAttribute; -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.ecore.EPackage; -import org.eclipse.emf.ecore.EReference; -import org.eclipse.emf.ecore.EcorePackage; -import org.eclipse.emf.ecore.impl.EPackageImpl; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.EFacetPackage; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.extensible.ExtensiblePackage; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.extensible.impl.ExtensiblePackageImpl; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.impl.EFacetPackageImpl; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.query.QueryPackage; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.query.impl.QueryPackageImpl; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.runtime.RuntimePackage; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.runtime.impl.RuntimePackageImpl; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.serialization.AbstractAttributeInstance; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.serialization.AbstractReferenceInstance; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.serialization.ExtendedEObjectReference; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.serialization.MultiValuedAttributeInstance; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.serialization.MultiValuedContainmentReferenceInstance; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.serialization.MultiValuedReferenceInstance; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.serialization.SerializationFactory; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.serialization.SerializationPackage; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.serialization.SingleValuedAttributeInstance; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.serialization.SingleValuedContainmentReferenceInstance; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.serialization.SingleValuedReferenceInstance; - -/** - * <!-- begin-user-doc --> - * An implementation of the model <b>Package</b>. - * <!-- end-user-doc --> - * @generated - */ -public class SerializationPackageImpl extends EPackageImpl implements SerializationPackage { - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - private EClass abstractReferenceInstanceEClass = null; - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - private EClass multiValuedContainmentReferenceInstanceEClass = null; - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - private EClass multiValuedReferenceInstanceEClass = null; - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - private EClass singleValuedAttributeInstanceEClass = null; - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - private EClass extendedEObjectReferenceEClass = null; - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - private EClass singleValuedContainmentReferenceInstanceEClass = null; - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - private EClass singleValuedReferenceInstanceEClass = null; - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - private EClass multiValuedAttributeInstanceEClass = null; - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - private EClass abstractAttributeInstanceEClass = null; - - /** - * Creates an instance of the model <b>Package</b>, registered with - * {@link org.eclipse.emf.ecore.EPackage.Registry EPackage.Registry} by the package - * package URI value. - * <p>Note: the correct way to create the package is via the static - * factory method {@link #init init()}, which also performs - * initialization of the package, or returns the registered package, - * if one already exists. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see org.eclipse.emf.ecore.EPackage.Registry - * @see org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.serialization.SerializationPackage#eNS_URI - * @see #init() - * @generated - */ - private SerializationPackageImpl() { - super(eNS_URI, SerializationFactory.eINSTANCE); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - private static boolean isInited = false; - - /** - * Creates, registers, and initializes the <b>Package</b> for this model, and for any others upon which it depends. - * - * <p>This method is used to initialize {@link SerializationPackage#eINSTANCE} when that field is accessed. - * Clients should not invoke it directly. Instead, they should simply access that field to obtain the package. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #eNS_URI - * @see #createPackageContents() - * @see #initializePackageContents() - * @generated - */ - public static SerializationPackage init() { - if (isInited) return (SerializationPackage)EPackage.Registry.INSTANCE.getEPackage(SerializationPackage.eNS_URI); - - // Obtain or create and register package - SerializationPackageImpl theSerializationPackage = (SerializationPackageImpl)(EPackage.Registry.INSTANCE.get(eNS_URI) instanceof SerializationPackageImpl ? EPackage.Registry.INSTANCE.get(eNS_URI) : new SerializationPackageImpl()); - - isInited = true; - - // Initialize simple dependencies - EcorePackage.eINSTANCE.eClass(); - - // Obtain or create and register interdependencies - EFacetPackageImpl theEFacetPackage = (EFacetPackageImpl)(EPackage.Registry.INSTANCE.getEPackage(EFacetPackage.eNS_URI) instanceof EFacetPackageImpl ? EPackage.Registry.INSTANCE.getEPackage(EFacetPackage.eNS_URI) : EFacetPackage.eINSTANCE); - ExtensiblePackageImpl theExtensiblePackage = (ExtensiblePackageImpl)(EPackage.Registry.INSTANCE.getEPackage(ExtensiblePackage.eNS_URI) instanceof ExtensiblePackageImpl ? EPackage.Registry.INSTANCE.getEPackage(ExtensiblePackage.eNS_URI) : ExtensiblePackage.eINSTANCE); - QueryPackageImpl theQueryPackage = (QueryPackageImpl)(EPackage.Registry.INSTANCE.getEPackage(QueryPackage.eNS_URI) instanceof QueryPackageImpl ? EPackage.Registry.INSTANCE.getEPackage(QueryPackage.eNS_URI) : QueryPackage.eINSTANCE); - RuntimePackageImpl theRuntimePackage = (RuntimePackageImpl)(EPackage.Registry.INSTANCE.getEPackage(RuntimePackage.eNS_URI) instanceof RuntimePackageImpl ? EPackage.Registry.INSTANCE.getEPackage(RuntimePackage.eNS_URI) : RuntimePackage.eINSTANCE); - - // Create package meta-data objects - theSerializationPackage.createPackageContents(); - theEFacetPackage.createPackageContents(); - theExtensiblePackage.createPackageContents(); - theQueryPackage.createPackageContents(); - theRuntimePackage.createPackageContents(); - - // Initialize created meta-data - theSerializationPackage.initializePackageContents(); - theEFacetPackage.initializePackageContents(); - theExtensiblePackage.initializePackageContents(); - theQueryPackage.initializePackageContents(); - theRuntimePackage.initializePackageContents(); - - // Mark meta-data to indicate it can't be changed - theSerializationPackage.freeze(); - - - // Update the registry and return the package - EPackage.Registry.INSTANCE.put(SerializationPackage.eNS_URI, theSerializationPackage); - return theSerializationPackage; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EClass getAbstractReferenceInstance() { - return abstractReferenceInstanceEClass; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EReference getAbstractReferenceInstance_EReference() { - return (EReference)abstractReferenceInstanceEClass.getEStructuralFeatures().get(0); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EClass getMultiValuedContainmentReferenceInstance() { - return multiValuedContainmentReferenceInstanceEClass; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EReference getMultiValuedContainmentReferenceInstance_OwnedElements() { - return (EReference)multiValuedContainmentReferenceInstanceEClass.getEStructuralFeatures().get(0); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EClass getMultiValuedReferenceInstance() { - return multiValuedReferenceInstanceEClass; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EReference getMultiValuedReferenceInstance_ReferencedElements() { - return (EReference)multiValuedReferenceInstanceEClass.getEStructuralFeatures().get(0); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EClass getSingleValuedAttributeInstance() { - return singleValuedAttributeInstanceEClass; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EAttribute getSingleValuedAttributeInstance_Value() { - return (EAttribute)singleValuedAttributeInstanceEClass.getEStructuralFeatures().get(0); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EClass getExtendedEObjectReference() { - return extendedEObjectReferenceEClass; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EReference getExtendedEObjectReference_ExtendedEObject() { - return (EReference)extendedEObjectReferenceEClass.getEStructuralFeatures().get(0); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EReference getExtendedEObjectReference_AttributeInstances() { - return (EReference)extendedEObjectReferenceEClass.getEStructuralFeatures().get(1); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EReference getExtendedEObjectReference_ReferenceInstances() { - return (EReference)extendedEObjectReferenceEClass.getEStructuralFeatures().get(2); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EClass getSingleValuedContainmentReferenceInstance() { - return singleValuedContainmentReferenceInstanceEClass; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EReference getSingleValuedContainmentReferenceInstance_OwnedElement() { - return (EReference)singleValuedContainmentReferenceInstanceEClass.getEStructuralFeatures().get(0); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EClass getSingleValuedReferenceInstance() { - return singleValuedReferenceInstanceEClass; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EReference getSingleValuedReferenceInstance_ReferencedElement() { - return (EReference)singleValuedReferenceInstanceEClass.getEStructuralFeatures().get(0); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EClass getMultiValuedAttributeInstance() { - return multiValuedAttributeInstanceEClass; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EAttribute getMultiValuedAttributeInstance_Values() { - return (EAttribute)multiValuedAttributeInstanceEClass.getEStructuralFeatures().get(0); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EClass getAbstractAttributeInstance() { - return abstractAttributeInstanceEClass; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EReference getAbstractAttributeInstance_EAttribute() { - return (EReference)abstractAttributeInstanceEClass.getEStructuralFeatures().get(0); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public SerializationFactory getSerializationFactory() { - return (SerializationFactory)getEFactoryInstance(); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - private boolean isCreated = false; - - /** - * Creates the meta-model objects for the package. This method is - * guarded to have no affect on any invocation but its first. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public void createPackageContents() { - if (isCreated) return; - isCreated = true; - - // Create classes and their features - abstractReferenceInstanceEClass = createEClass(ABSTRACT_REFERENCE_INSTANCE); - createEReference(abstractReferenceInstanceEClass, ABSTRACT_REFERENCE_INSTANCE__EREFERENCE); - - multiValuedContainmentReferenceInstanceEClass = createEClass(MULTI_VALUED_CONTAINMENT_REFERENCE_INSTANCE); - createEReference(multiValuedContainmentReferenceInstanceEClass, MULTI_VALUED_CONTAINMENT_REFERENCE_INSTANCE__OWNED_ELEMENTS); - - multiValuedReferenceInstanceEClass = createEClass(MULTI_VALUED_REFERENCE_INSTANCE); - createEReference(multiValuedReferenceInstanceEClass, MULTI_VALUED_REFERENCE_INSTANCE__REFERENCED_ELEMENTS); - - singleValuedAttributeInstanceEClass = createEClass(SINGLE_VALUED_ATTRIBUTE_INSTANCE); - createEAttribute(singleValuedAttributeInstanceEClass, SINGLE_VALUED_ATTRIBUTE_INSTANCE__VALUE); - - extendedEObjectReferenceEClass = createEClass(EXTENDED_EOBJECT_REFERENCE); - createEReference(extendedEObjectReferenceEClass, EXTENDED_EOBJECT_REFERENCE__EXTENDED_EOBJECT); - createEReference(extendedEObjectReferenceEClass, EXTENDED_EOBJECT_REFERENCE__ATTRIBUTE_INSTANCES); - createEReference(extendedEObjectReferenceEClass, EXTENDED_EOBJECT_REFERENCE__REFERENCE_INSTANCES); - - singleValuedContainmentReferenceInstanceEClass = createEClass(SINGLE_VALUED_CONTAINMENT_REFERENCE_INSTANCE); - createEReference(singleValuedContainmentReferenceInstanceEClass, SINGLE_VALUED_CONTAINMENT_REFERENCE_INSTANCE__OWNED_ELEMENT); - - singleValuedReferenceInstanceEClass = createEClass(SINGLE_VALUED_REFERENCE_INSTANCE); - createEReference(singleValuedReferenceInstanceEClass, SINGLE_VALUED_REFERENCE_INSTANCE__REFERENCED_ELEMENT); - - multiValuedAttributeInstanceEClass = createEClass(MULTI_VALUED_ATTRIBUTE_INSTANCE); - createEAttribute(multiValuedAttributeInstanceEClass, MULTI_VALUED_ATTRIBUTE_INSTANCE__VALUES); - - abstractAttributeInstanceEClass = createEClass(ABSTRACT_ATTRIBUTE_INSTANCE); - createEReference(abstractAttributeInstanceEClass, ABSTRACT_ATTRIBUTE_INSTANCE__EATTRIBUTE); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - private boolean isInitialized = false; - - /** - * Complete the initialization of the package and its meta-model. This - * method is guarded to have no affect on any invocation but its first. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public void initializePackageContents() { - if (isInitialized) return; - isInitialized = true; - - // Initialize package - setName(eNAME); - setNsPrefix(eNS_PREFIX); - setNsURI(eNS_URI); - - // Create type parameters - - // Set bounds for type parameters - - // Add supertypes to classes - multiValuedContainmentReferenceInstanceEClass.getESuperTypes().add(this.getAbstractReferenceInstance()); - multiValuedReferenceInstanceEClass.getESuperTypes().add(this.getAbstractReferenceInstance()); - singleValuedAttributeInstanceEClass.getESuperTypes().add(this.getAbstractAttributeInstance()); - singleValuedContainmentReferenceInstanceEClass.getESuperTypes().add(this.getAbstractReferenceInstance()); - singleValuedReferenceInstanceEClass.getESuperTypes().add(this.getAbstractReferenceInstance()); - multiValuedAttributeInstanceEClass.getESuperTypes().add(this.getAbstractAttributeInstance()); - - // Initialize classes and features; add operations and parameters - initEClass(abstractReferenceInstanceEClass, AbstractReferenceInstance.class, "AbstractReferenceInstance", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); //$NON-NLS-1$ - initEReference(getAbstractReferenceInstance_EReference(), ecorePackage.getEReference(), null, "eReference", null, 1, 1, AbstractReferenceInstance.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); //$NON-NLS-1$ - - initEClass(multiValuedContainmentReferenceInstanceEClass, MultiValuedContainmentReferenceInstance.class, "MultiValuedContainmentReferenceInstance", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); //$NON-NLS-1$ - initEReference(getMultiValuedContainmentReferenceInstance_OwnedElements(), ecorePackage.getEObject(), null, "ownedElements", null, 0, -1, MultiValuedContainmentReferenceInstance.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); //$NON-NLS-1$ - - initEClass(multiValuedReferenceInstanceEClass, MultiValuedReferenceInstance.class, "MultiValuedReferenceInstance", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); //$NON-NLS-1$ - initEReference(getMultiValuedReferenceInstance_ReferencedElements(), ecorePackage.getEObject(), null, "referencedElements", null, 0, -1, MultiValuedReferenceInstance.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); //$NON-NLS-1$ - - initEClass(singleValuedAttributeInstanceEClass, SingleValuedAttributeInstance.class, "SingleValuedAttributeInstance", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); //$NON-NLS-1$ - initEAttribute(getSingleValuedAttributeInstance_Value(), ecorePackage.getEJavaObject(), "value", null, 0, 1, SingleValuedAttributeInstance.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); //$NON-NLS-1$ - - initEClass(extendedEObjectReferenceEClass, ExtendedEObjectReference.class, "ExtendedEObjectReference", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); //$NON-NLS-1$ - initEReference(getExtendedEObjectReference_ExtendedEObject(), ecorePackage.getEObject(), null, "extendedEObject", null, 1, 1, ExtendedEObjectReference.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); //$NON-NLS-1$ - initEReference(getExtendedEObjectReference_AttributeInstances(), this.getAbstractAttributeInstance(), null, "attributeInstances", null, 0, -1, ExtendedEObjectReference.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); //$NON-NLS-1$ - initEReference(getExtendedEObjectReference_ReferenceInstances(), this.getAbstractReferenceInstance(), null, "referenceInstances", null, 0, -1, ExtendedEObjectReference.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); //$NON-NLS-1$ - - initEClass(singleValuedContainmentReferenceInstanceEClass, SingleValuedContainmentReferenceInstance.class, "SingleValuedContainmentReferenceInstance", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); //$NON-NLS-1$ - initEReference(getSingleValuedContainmentReferenceInstance_OwnedElement(), ecorePackage.getEObject(), null, "ownedElement", null, 0, 1, SingleValuedContainmentReferenceInstance.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); //$NON-NLS-1$ - - initEClass(singleValuedReferenceInstanceEClass, SingleValuedReferenceInstance.class, "SingleValuedReferenceInstance", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); //$NON-NLS-1$ - initEReference(getSingleValuedReferenceInstance_ReferencedElement(), ecorePackage.getEObject(), null, "referencedElement", null, 0, 1, SingleValuedReferenceInstance.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); //$NON-NLS-1$ - - initEClass(multiValuedAttributeInstanceEClass, MultiValuedAttributeInstance.class, "MultiValuedAttributeInstance", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); //$NON-NLS-1$ - initEAttribute(getMultiValuedAttributeInstance_Values(), ecorePackage.getEJavaObject(), "values", null, 0, -1, MultiValuedAttributeInstance.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); //$NON-NLS-1$ - - initEClass(abstractAttributeInstanceEClass, AbstractAttributeInstance.class, "AbstractAttributeInstance", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); //$NON-NLS-1$ - initEReference(getAbstractAttributeInstance_EAttribute(), ecorePackage.getEAttribute(), null, "eAttribute", null, 1, 1, AbstractAttributeInstance.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); //$NON-NLS-1$ - } - -} //SerializationPackageImpl
diff --git a/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/emf/facet/efacet/metamodel/v0_2_0/efacet/serialization/impl/SingleValuedAttributeInstanceImpl.java b/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/emf/facet/efacet/metamodel/v0_2_0/efacet/serialization/impl/SingleValuedAttributeInstanceImpl.java deleted file mode 100644 index 58aed2a..0000000 --- a/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/emf/facet/efacet/metamodel/v0_2_0/efacet/serialization/impl/SingleValuedAttributeInstanceImpl.java +++ /dev/null
@@ -1,171 +0,0 @@ -/** - * Copyright (c) 2011 Mia-Software. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Gregoire Dupe (Mia-Software) - Design - * Nicolas Guyomar (Mia-Software) - Implementation - * Emmanuelle Rouillé (Mia-Software) - Bug 352618 - To be able to use non derived facet structural features and save them values. - * Nicolas Bros (Mia-Software) - Bug 361823 - [Restructuring] eFacet2 meta-model - */ -package org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.serialization.impl; - -import org.eclipse.emf.common.notify.Notification; -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.ecore.impl.ENotificationImpl; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.serialization.SerializationPackage; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.serialization.SingleValuedAttributeInstance; - -/** - * <!-- begin-user-doc --> - * An implementation of the model object '<em><b>Single Valued Attribute Instance</b></em>'. - * <!-- end-user-doc --> - * <p> - * The following features are implemented: - * <ul> - * <li>{@link org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.serialization.impl.SingleValuedAttributeInstanceImpl#getValue <em>Value</em>}</li> - * </ul> - * </p> - * - * @generated - */ -public class SingleValuedAttributeInstanceImpl extends AbstractAttributeInstanceImpl implements SingleValuedAttributeInstance { - /** - * The default value of the '{@link #getValue() <em>Value</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #getValue() - * @generated - * @ordered - */ - protected static final Object VALUE_EDEFAULT = null; - - /** - * The cached value of the '{@link #getValue() <em>Value</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #getValue() - * @generated - * @ordered - */ - protected Object value = VALUE_EDEFAULT; - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected SingleValuedAttributeInstanceImpl() { - super(); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - protected EClass eStaticClass() { - return SerializationPackage.Literals.SINGLE_VALUED_ATTRIBUTE_INSTANCE; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public Object getValue() { - return value; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public void setValue(Object newValue) { - Object oldValue = value; - value = newValue; - if (eNotificationRequired()) - eNotify(new ENotificationImpl(this, Notification.SET, SerializationPackage.SINGLE_VALUED_ATTRIBUTE_INSTANCE__VALUE, oldValue, value)); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public Object eGet(int featureID, boolean resolve, boolean coreType) { - switch (featureID) { - case SerializationPackage.SINGLE_VALUED_ATTRIBUTE_INSTANCE__VALUE: - return getValue(); - } - return super.eGet(featureID, resolve, coreType); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public void eSet(int featureID, Object newValue) { - switch (featureID) { - case SerializationPackage.SINGLE_VALUED_ATTRIBUTE_INSTANCE__VALUE: - setValue(newValue); - return; - } - super.eSet(featureID, newValue); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public void eUnset(int featureID) { - switch (featureID) { - case SerializationPackage.SINGLE_VALUED_ATTRIBUTE_INSTANCE__VALUE: - setValue(VALUE_EDEFAULT); - return; - } - super.eUnset(featureID); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public boolean eIsSet(int featureID) { - switch (featureID) { - case SerializationPackage.SINGLE_VALUED_ATTRIBUTE_INSTANCE__VALUE: - return VALUE_EDEFAULT == null ? value != null : !VALUE_EDEFAULT.equals(value); - } - return super.eIsSet(featureID); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public String toString() { - if (eIsProxy()) return super.toString(); - - StringBuffer result = new StringBuffer(super.toString()); - result.append(" (value: "); //$NON-NLS-1$ - result.append(value); - result.append(')'); - return result.toString(); - } - -} //SingleValuedAttributeInstanceImpl
diff --git a/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/emf/facet/efacet/metamodel/v0_2_0/efacet/serialization/impl/SingleValuedContainmentReferenceInstanceImpl.java b/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/emf/facet/efacet/metamodel/v0_2_0/efacet/serialization/impl/SingleValuedContainmentReferenceInstanceImpl.java deleted file mode 100644 index ee4e80c..0000000 --- a/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/emf/facet/efacet/metamodel/v0_2_0/efacet/serialization/impl/SingleValuedContainmentReferenceInstanceImpl.java +++ /dev/null
@@ -1,184 +0,0 @@ -/** - * Copyright (c) 2011 Mia-Software. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Gregoire Dupe (Mia-Software) - Design - * Nicolas Guyomar (Mia-Software) - Implementation - * Emmanuelle Rouillé (Mia-Software) - Bug 352618 - To be able to use non derived facet structural features and save them values. - * Nicolas Bros (Mia-Software) - Bug 361823 - [Restructuring] eFacet2 meta-model - */ -package org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.serialization.impl; - -import org.eclipse.emf.common.notify.Notification; -import org.eclipse.emf.common.notify.NotificationChain; -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.InternalEObject; -import org.eclipse.emf.ecore.impl.ENotificationImpl; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.serialization.SerializationPackage; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.serialization.SingleValuedContainmentReferenceInstance; - -/** - * <!-- begin-user-doc --> - * An implementation of the model object '<em><b>Single Valued Containment Reference Instance</b></em>'. - * <!-- end-user-doc --> - * <p> - * The following features are implemented: - * <ul> - * <li>{@link org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.serialization.impl.SingleValuedContainmentReferenceInstanceImpl#getOwnedElement <em>Owned Element</em>}</li> - * </ul> - * </p> - * - * @generated - */ -public class SingleValuedContainmentReferenceInstanceImpl extends AbstractReferenceInstanceImpl implements SingleValuedContainmentReferenceInstance { - /** - * The cached value of the '{@link #getOwnedElement() <em>Owned Element</em>}' containment reference. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #getOwnedElement() - * @generated - * @ordered - */ - protected EObject ownedElement; - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected SingleValuedContainmentReferenceInstanceImpl() { - super(); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - protected EClass eStaticClass() { - return SerializationPackage.Literals.SINGLE_VALUED_CONTAINMENT_REFERENCE_INSTANCE; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EObject getOwnedElement() { - return ownedElement; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public NotificationChain basicSetOwnedElement(EObject newOwnedElement, NotificationChain msgs) { - EObject oldOwnedElement = ownedElement; - ownedElement = newOwnedElement; - if (eNotificationRequired()) { - ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, SerializationPackage.SINGLE_VALUED_CONTAINMENT_REFERENCE_INSTANCE__OWNED_ELEMENT, oldOwnedElement, newOwnedElement); - if (msgs == null) msgs = notification; else msgs.add(notification); - } - return msgs; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public void setOwnedElement(EObject newOwnedElement) { - if (newOwnedElement != ownedElement) { - NotificationChain msgs = null; - if (ownedElement != null) - msgs = ((InternalEObject)ownedElement).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - SerializationPackage.SINGLE_VALUED_CONTAINMENT_REFERENCE_INSTANCE__OWNED_ELEMENT, null, msgs); - if (newOwnedElement != null) - msgs = ((InternalEObject)newOwnedElement).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - SerializationPackage.SINGLE_VALUED_CONTAINMENT_REFERENCE_INSTANCE__OWNED_ELEMENT, null, msgs); - msgs = basicSetOwnedElement(newOwnedElement, msgs); - if (msgs != null) msgs.dispatch(); - } - else if (eNotificationRequired()) - eNotify(new ENotificationImpl(this, Notification.SET, SerializationPackage.SINGLE_VALUED_CONTAINMENT_REFERENCE_INSTANCE__OWNED_ELEMENT, newOwnedElement, newOwnedElement)); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { - switch (featureID) { - case SerializationPackage.SINGLE_VALUED_CONTAINMENT_REFERENCE_INSTANCE__OWNED_ELEMENT: - return basicSetOwnedElement(null, msgs); - } - return super.eInverseRemove(otherEnd, featureID, msgs); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public Object eGet(int featureID, boolean resolve, boolean coreType) { - switch (featureID) { - case SerializationPackage.SINGLE_VALUED_CONTAINMENT_REFERENCE_INSTANCE__OWNED_ELEMENT: - return getOwnedElement(); - } - return super.eGet(featureID, resolve, coreType); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public void eSet(int featureID, Object newValue) { - switch (featureID) { - case SerializationPackage.SINGLE_VALUED_CONTAINMENT_REFERENCE_INSTANCE__OWNED_ELEMENT: - setOwnedElement((EObject)newValue); - return; - } - super.eSet(featureID, newValue); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public void eUnset(int featureID) { - switch (featureID) { - case SerializationPackage.SINGLE_VALUED_CONTAINMENT_REFERENCE_INSTANCE__OWNED_ELEMENT: - setOwnedElement((EObject)null); - return; - } - super.eUnset(featureID); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public boolean eIsSet(int featureID) { - switch (featureID) { - case SerializationPackage.SINGLE_VALUED_CONTAINMENT_REFERENCE_INSTANCE__OWNED_ELEMENT: - return ownedElement != null; - } - return super.eIsSet(featureID); - } - -} //SingleValuedContainmentReferenceInstanceImpl
diff --git a/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/emf/facet/efacet/metamodel/v0_2_0/efacet/serialization/impl/SingleValuedReferenceInstanceImpl.java b/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/emf/facet/efacet/metamodel/v0_2_0/efacet/serialization/impl/SingleValuedReferenceInstanceImpl.java deleted file mode 100644 index 89245ab..0000000 --- a/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/emf/facet/efacet/metamodel/v0_2_0/efacet/serialization/impl/SingleValuedReferenceInstanceImpl.java +++ /dev/null
@@ -1,165 +0,0 @@ -/** - * Copyright (c) 2011 Mia-Software. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Gregoire Dupe (Mia-Software) - Design - * Nicolas Guyomar (Mia-Software) - Implementation - * Emmanuelle Rouillé (Mia-Software) - Bug 352618 - To be able to use non derived facet structural features and save them values. - * Nicolas Bros (Mia-Software) - Bug 361823 - [Restructuring] eFacet2 meta-model - */ -package org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.serialization.impl; - -import org.eclipse.emf.common.notify.Notification; -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.InternalEObject; -import org.eclipse.emf.ecore.impl.ENotificationImpl; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.serialization.SerializationPackage; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.serialization.SingleValuedReferenceInstance; - -/** - * <!-- begin-user-doc --> - * An implementation of the model object '<em><b>Single Valued Reference Instance</b></em>'. - * <!-- end-user-doc --> - * <p> - * The following features are implemented: - * <ul> - * <li>{@link org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.serialization.impl.SingleValuedReferenceInstanceImpl#getReferencedElement <em>Referenced Element</em>}</li> - * </ul> - * </p> - * - * @generated - */ -public class SingleValuedReferenceInstanceImpl extends AbstractReferenceInstanceImpl implements SingleValuedReferenceInstance { - /** - * The cached value of the '{@link #getReferencedElement() <em>Referenced Element</em>}' reference. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #getReferencedElement() - * @generated - * @ordered - */ - protected EObject referencedElement; - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected SingleValuedReferenceInstanceImpl() { - super(); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - protected EClass eStaticClass() { - return SerializationPackage.Literals.SINGLE_VALUED_REFERENCE_INSTANCE; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EObject getReferencedElement() { - if (referencedElement != null && referencedElement.eIsProxy()) { - InternalEObject oldReferencedElement = (InternalEObject)referencedElement; - referencedElement = eResolveProxy(oldReferencedElement); - if (referencedElement != oldReferencedElement) { - if (eNotificationRequired()) - eNotify(new ENotificationImpl(this, Notification.RESOLVE, SerializationPackage.SINGLE_VALUED_REFERENCE_INSTANCE__REFERENCED_ELEMENT, oldReferencedElement, referencedElement)); - } - } - return referencedElement; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EObject basicGetReferencedElement() { - return referencedElement; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public void setReferencedElement(EObject newReferencedElement) { - EObject oldReferencedElement = referencedElement; - referencedElement = newReferencedElement; - if (eNotificationRequired()) - eNotify(new ENotificationImpl(this, Notification.SET, SerializationPackage.SINGLE_VALUED_REFERENCE_INSTANCE__REFERENCED_ELEMENT, oldReferencedElement, referencedElement)); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public Object eGet(int featureID, boolean resolve, boolean coreType) { - switch (featureID) { - case SerializationPackage.SINGLE_VALUED_REFERENCE_INSTANCE__REFERENCED_ELEMENT: - if (resolve) return getReferencedElement(); - return basicGetReferencedElement(); - } - return super.eGet(featureID, resolve, coreType); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public void eSet(int featureID, Object newValue) { - switch (featureID) { - case SerializationPackage.SINGLE_VALUED_REFERENCE_INSTANCE__REFERENCED_ELEMENT: - setReferencedElement((EObject)newValue); - return; - } - super.eSet(featureID, newValue); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public void eUnset(int featureID) { - switch (featureID) { - case SerializationPackage.SINGLE_VALUED_REFERENCE_INSTANCE__REFERENCED_ELEMENT: - setReferencedElement((EObject)null); - return; - } - super.eUnset(featureID); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public boolean eIsSet(int featureID) { - switch (featureID) { - case SerializationPackage.SINGLE_VALUED_REFERENCE_INSTANCE__REFERENCED_ELEMENT: - return referencedElement != null; - } - return super.eIsSet(featureID); - } - -} //SingleValuedReferenceInstanceImpl
diff --git a/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/emf/facet/efacet/metamodel/v0_2_0/efacet/serialization/util/SerializationAdapterFactory.java b/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/emf/facet/efacet/metamodel/v0_2_0/efacet/serialization/util/SerializationAdapterFactory.java deleted file mode 100644 index e44ef69..0000000 --- a/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/emf/facet/efacet/metamodel/v0_2_0/efacet/serialization/util/SerializationAdapterFactory.java +++ /dev/null
@@ -1,283 +0,0 @@ -/** - * Copyright (c) 2011 Mia-Software. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Gregoire Dupe (Mia-Software) - Design - * Nicolas Guyomar (Mia-Software) - Implementation - * Emmanuelle Rouillé (Mia-Software) - Bug 352618 - To be able to use non derived facet structural features and save them values. - * Nicolas Bros (Mia-Software) - Bug 361823 - [Restructuring] eFacet2 meta-model - */ -package org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.serialization.util; - -import org.eclipse.emf.common.notify.Adapter; -import org.eclipse.emf.common.notify.Notifier; -import org.eclipse.emf.common.notify.impl.AdapterFactoryImpl; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.serialization.*; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.serialization.AbstractAttributeInstance; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.serialization.AbstractReferenceInstance; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.serialization.ExtendedEObjectReference; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.serialization.MultiValuedAttributeInstance; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.serialization.MultiValuedContainmentReferenceInstance; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.serialization.MultiValuedReferenceInstance; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.serialization.SerializationPackage; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.serialization.SingleValuedAttributeInstance; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.serialization.SingleValuedContainmentReferenceInstance; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.serialization.SingleValuedReferenceInstance; - -/** - * <!-- begin-user-doc --> - * The <b>Adapter Factory</b> for the model. - * It provides an adapter <code>createXXX</code> method for each class of the model. - * <!-- end-user-doc --> - * @see org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.serialization.SerializationPackage - * @generated - */ -public class SerializationAdapterFactory extends AdapterFactoryImpl { - /** - * The cached model package. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected static SerializationPackage modelPackage; - - /** - * Creates an instance of the adapter factory. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public SerializationAdapterFactory() { - if (modelPackage == null) { - modelPackage = SerializationPackage.eINSTANCE; - } - } - - /** - * Returns whether this factory is applicable for the type of the object. - * <!-- begin-user-doc --> - * This implementation returns <code>true</code> if the object is either the model's package or is an instance object of the model. - * <!-- end-user-doc --> - * @return whether this factory is applicable for the type of the object. - * @generated - */ - @Override - public boolean isFactoryForType(Object object) { - if (object == modelPackage) { - return true; - } - if (object instanceof EObject) { - return ((EObject)object).eClass().getEPackage() == modelPackage; - } - return false; - } - - /** - * The switch that delegates to the <code>createXXX</code> methods. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected SerializationSwitch<Adapter> modelSwitch = - new SerializationSwitch<Adapter>() { - @Override - public Adapter caseAbstractReferenceInstance(AbstractReferenceInstance object) { - return createAbstractReferenceInstanceAdapter(); - } - @Override - public Adapter caseMultiValuedContainmentReferenceInstance(MultiValuedContainmentReferenceInstance object) { - return createMultiValuedContainmentReferenceInstanceAdapter(); - } - @Override - public Adapter caseMultiValuedReferenceInstance(MultiValuedReferenceInstance object) { - return createMultiValuedReferenceInstanceAdapter(); - } - @Override - public Adapter caseSingleValuedAttributeInstance(SingleValuedAttributeInstance object) { - return createSingleValuedAttributeInstanceAdapter(); - } - @Override - public Adapter caseExtendedEObjectReference(ExtendedEObjectReference object) { - return createExtendedEObjectReferenceAdapter(); - } - @Override - public Adapter caseSingleValuedContainmentReferenceInstance(SingleValuedContainmentReferenceInstance object) { - return createSingleValuedContainmentReferenceInstanceAdapter(); - } - @Override - public Adapter caseSingleValuedReferenceInstance(SingleValuedReferenceInstance object) { - return createSingleValuedReferenceInstanceAdapter(); - } - @Override - public Adapter caseMultiValuedAttributeInstance(MultiValuedAttributeInstance object) { - return createMultiValuedAttributeInstanceAdapter(); - } - @Override - public Adapter caseAbstractAttributeInstance(AbstractAttributeInstance object) { - return createAbstractAttributeInstanceAdapter(); - } - @Override - public Adapter defaultCase(EObject object) { - return createEObjectAdapter(); - } - }; - - /** - * Creates an adapter for the <code>target</code>. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @param target the object to adapt. - * @return the adapter for the <code>target</code>. - * @generated - */ - @Override - public Adapter createAdapter(Notifier target) { - return modelSwitch.doSwitch((EObject)target); - } - - - /** - * Creates a new adapter for an object of class '{@link org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.serialization.AbstractReferenceInstance <em>Abstract Reference Instance</em>}'. - * <!-- begin-user-doc --> - * This default implementation returns null so that we can easily ignore cases; - * it's useful to ignore a case when inheritance will catch all the cases anyway. - * <!-- end-user-doc --> - * @return the new adapter. - * @see org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.serialization.AbstractReferenceInstance - * @generated - */ - public Adapter createAbstractReferenceInstanceAdapter() { - return null; - } - - /** - * Creates a new adapter for an object of class '{@link org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.serialization.MultiValuedContainmentReferenceInstance <em>Multi Valued Containment Reference Instance</em>}'. - * <!-- begin-user-doc --> - * This default implementation returns null so that we can easily ignore cases; - * it's useful to ignore a case when inheritance will catch all the cases anyway. - * <!-- end-user-doc --> - * @return the new adapter. - * @see org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.serialization.MultiValuedContainmentReferenceInstance - * @generated - */ - public Adapter createMultiValuedContainmentReferenceInstanceAdapter() { - return null; - } - - /** - * Creates a new adapter for an object of class '{@link org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.serialization.MultiValuedReferenceInstance <em>Multi Valued Reference Instance</em>}'. - * <!-- begin-user-doc --> - * This default implementation returns null so that we can easily ignore cases; - * it's useful to ignore a case when inheritance will catch all the cases anyway. - * <!-- end-user-doc --> - * @return the new adapter. - * @see org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.serialization.MultiValuedReferenceInstance - * @generated - */ - public Adapter createMultiValuedReferenceInstanceAdapter() { - return null; - } - - /** - * Creates a new adapter for an object of class '{@link org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.serialization.SingleValuedAttributeInstance <em>Single Valued Attribute Instance</em>}'. - * <!-- begin-user-doc --> - * This default implementation returns null so that we can easily ignore cases; - * it's useful to ignore a case when inheritance will catch all the cases anyway. - * <!-- end-user-doc --> - * @return the new adapter. - * @see org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.serialization.SingleValuedAttributeInstance - * @generated - */ - public Adapter createSingleValuedAttributeInstanceAdapter() { - return null; - } - - /** - * Creates a new adapter for an object of class '{@link org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.serialization.ExtendedEObjectReference <em>Extended EObject Reference</em>}'. - * <!-- begin-user-doc --> - * This default implementation returns null so that we can easily ignore cases; - * it's useful to ignore a case when inheritance will catch all the cases anyway. - * <!-- end-user-doc --> - * @return the new adapter. - * @see org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.serialization.ExtendedEObjectReference - * @generated - */ - public Adapter createExtendedEObjectReferenceAdapter() { - return null; - } - - /** - * Creates a new adapter for an object of class '{@link org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.serialization.SingleValuedContainmentReferenceInstance <em>Single Valued Containment Reference Instance</em>}'. - * <!-- begin-user-doc --> - * This default implementation returns null so that we can easily ignore cases; - * it's useful to ignore a case when inheritance will catch all the cases anyway. - * <!-- end-user-doc --> - * @return the new adapter. - * @see org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.serialization.SingleValuedContainmentReferenceInstance - * @generated - */ - public Adapter createSingleValuedContainmentReferenceInstanceAdapter() { - return null; - } - - /** - * Creates a new adapter for an object of class '{@link org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.serialization.SingleValuedReferenceInstance <em>Single Valued Reference Instance</em>}'. - * <!-- begin-user-doc --> - * This default implementation returns null so that we can easily ignore cases; - * it's useful to ignore a case when inheritance will catch all the cases anyway. - * <!-- end-user-doc --> - * @return the new adapter. - * @see org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.serialization.SingleValuedReferenceInstance - * @generated - */ - public Adapter createSingleValuedReferenceInstanceAdapter() { - return null; - } - - /** - * Creates a new adapter for an object of class '{@link org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.serialization.MultiValuedAttributeInstance <em>Multi Valued Attribute Instance</em>}'. - * <!-- begin-user-doc --> - * This default implementation returns null so that we can easily ignore cases; - * it's useful to ignore a case when inheritance will catch all the cases anyway. - * <!-- end-user-doc --> - * @return the new adapter. - * @see org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.serialization.MultiValuedAttributeInstance - * @generated - */ - public Adapter createMultiValuedAttributeInstanceAdapter() { - return null; - } - - /** - * Creates a new adapter for an object of class '{@link org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.serialization.AbstractAttributeInstance <em>Abstract Attribute Instance</em>}'. - * <!-- begin-user-doc --> - * This default implementation returns null so that we can easily ignore cases; - * it's useful to ignore a case when inheritance will catch all the cases anyway. - * <!-- end-user-doc --> - * @return the new adapter. - * @see org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.serialization.AbstractAttributeInstance - * @generated - */ - public Adapter createAbstractAttributeInstanceAdapter() { - return null; - } - - /** - * Creates a new adapter for the default case. - * <!-- begin-user-doc --> - * This default implementation returns null. - * <!-- end-user-doc --> - * @return the new adapter. - * @generated - */ - public Adapter createEObjectAdapter() { - return null; - } - -} //SerializationAdapterFactory
diff --git a/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/emf/facet/efacet/metamodel/v0_2_0/efacet/serialization/util/SerializationSwitch.java b/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/emf/facet/efacet/metamodel/v0_2_0/efacet/serialization/util/SerializationSwitch.java deleted file mode 100644 index 1701757..0000000 --- a/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/emf/facet/efacet/metamodel/v0_2_0/efacet/serialization/util/SerializationSwitch.java +++ /dev/null
@@ -1,325 +0,0 @@ -/** - * Copyright (c) 2011 Mia-Software. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Gregoire Dupe (Mia-Software) - Design - * Nicolas Guyomar (Mia-Software) - Implementation - * Emmanuelle Rouillé (Mia-Software) - Bug 352618 - To be able to use non derived facet structural features and save them values. - * Nicolas Bros (Mia-Software) - Bug 361823 - [Restructuring] eFacet2 meta-model - * Gregoire Dupe (Mia-Software) - Bug 366055 - NavigationQuery - * Gregoire Dupe (Mia-Software) - Bug 369673 - [Facet] IsOneOfQuery - * Olivier Remaud (Soft-Maint) - Bug 369824 - Add a simple way to return string literal constants from a customization query - * Gregoire Dupe (Mia-software) - Bug 369987 - [Restructuring][Table] Switch to the new customization and facet framework - */ -package org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.serialization.util; - -import java.util.List; - -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.serialization.*; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.serialization.AbstractAttributeInstance; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.serialization.AbstractReferenceInstance; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.serialization.ExtendedEObjectReference; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.serialization.MultiValuedAttributeInstance; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.serialization.MultiValuedContainmentReferenceInstance; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.serialization.MultiValuedReferenceInstance; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.serialization.SerializationPackage; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.serialization.SingleValuedAttributeInstance; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.serialization.SingleValuedContainmentReferenceInstance; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.serialization.SingleValuedReferenceInstance; - -/** - * <!-- begin-user-doc --> - * The <b>Switch</b> for the model's inheritance hierarchy. - * It supports the call {@link #doSwitch(EObject) doSwitch(object)} - * to invoke the <code>caseXXX</code> method for each class of the model, - * starting with the actual class of the object - * and proceeding up the inheritance hierarchy - * until a non-null result is returned, - * which is the result of the switch. - * <!-- end-user-doc --> - * @see org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.serialization.SerializationPackage - * @generated - */ -public class SerializationSwitch<T> { - /** - * The cached model package - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected static SerializationPackage modelPackage; - - /** - * Creates an instance of the switch. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public SerializationSwitch() { - if (modelPackage == null) { - modelPackage = SerializationPackage.eINSTANCE; - } - } - - /** - * Calls <code>caseXXX</code> for each class of the model until one returns a non null result; it yields that result. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the first non-null result returned by a <code>caseXXX</code> call. - * @generated - */ - public T doSwitch(EObject theEObject) { - return doSwitch(theEObject.eClass(), theEObject); - } - - /** - * Calls <code>caseXXX</code> for each class of the model until one returns a non null result; it yields that result. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the first non-null result returned by a <code>caseXXX</code> call. - * @generated - */ - protected T doSwitch(EClass theEClass, EObject theEObject) { - if (theEClass.eContainer() == modelPackage) { - return doSwitch(theEClass.getClassifierID(), theEObject); - } - else { - List<EClass> eSuperTypes = theEClass.getESuperTypes(); - return - eSuperTypes.isEmpty() ? - defaultCase(theEObject) : - doSwitch(eSuperTypes.get(0), theEObject); - } - } - - /** - * Calls <code>caseXXX</code> for each class of the model until one returns a non null result; it yields that result. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the first non-null result returned by a <code>caseXXX</code> call. - * @generated - */ - protected T doSwitch(int classifierID, EObject theEObject) { - switch (classifierID) { - case SerializationPackage.ABSTRACT_REFERENCE_INSTANCE: { - AbstractReferenceInstance abstractReferenceInstance = (AbstractReferenceInstance)theEObject; - T result = caseAbstractReferenceInstance(abstractReferenceInstance); - if (result == null) result = defaultCase(theEObject); - return result; - } - case SerializationPackage.MULTI_VALUED_CONTAINMENT_REFERENCE_INSTANCE: { - MultiValuedContainmentReferenceInstance multiValuedContainmentReferenceInstance = (MultiValuedContainmentReferenceInstance)theEObject; - T result = caseMultiValuedContainmentReferenceInstance(multiValuedContainmentReferenceInstance); - if (result == null) result = caseAbstractReferenceInstance(multiValuedContainmentReferenceInstance); - if (result == null) result = defaultCase(theEObject); - return result; - } - case SerializationPackage.MULTI_VALUED_REFERENCE_INSTANCE: { - MultiValuedReferenceInstance multiValuedReferenceInstance = (MultiValuedReferenceInstance)theEObject; - T result = caseMultiValuedReferenceInstance(multiValuedReferenceInstance); - if (result == null) result = caseAbstractReferenceInstance(multiValuedReferenceInstance); - if (result == null) result = defaultCase(theEObject); - return result; - } - case SerializationPackage.SINGLE_VALUED_ATTRIBUTE_INSTANCE: { - SingleValuedAttributeInstance singleValuedAttributeInstance = (SingleValuedAttributeInstance)theEObject; - T result = caseSingleValuedAttributeInstance(singleValuedAttributeInstance); - if (result == null) result = caseAbstractAttributeInstance(singleValuedAttributeInstance); - if (result == null) result = defaultCase(theEObject); - return result; - } - case SerializationPackage.EXTENDED_EOBJECT_REFERENCE: { - ExtendedEObjectReference extendedEObjectReference = (ExtendedEObjectReference)theEObject; - T result = caseExtendedEObjectReference(extendedEObjectReference); - if (result == null) result = defaultCase(theEObject); - return result; - } - case SerializationPackage.SINGLE_VALUED_CONTAINMENT_REFERENCE_INSTANCE: { - SingleValuedContainmentReferenceInstance singleValuedContainmentReferenceInstance = (SingleValuedContainmentReferenceInstance)theEObject; - T result = caseSingleValuedContainmentReferenceInstance(singleValuedContainmentReferenceInstance); - if (result == null) result = caseAbstractReferenceInstance(singleValuedContainmentReferenceInstance); - if (result == null) result = defaultCase(theEObject); - return result; - } - case SerializationPackage.SINGLE_VALUED_REFERENCE_INSTANCE: { - SingleValuedReferenceInstance singleValuedReferenceInstance = (SingleValuedReferenceInstance)theEObject; - T result = caseSingleValuedReferenceInstance(singleValuedReferenceInstance); - if (result == null) result = caseAbstractReferenceInstance(singleValuedReferenceInstance); - if (result == null) result = defaultCase(theEObject); - return result; - } - case SerializationPackage.MULTI_VALUED_ATTRIBUTE_INSTANCE: { - MultiValuedAttributeInstance multiValuedAttributeInstance = (MultiValuedAttributeInstance)theEObject; - T result = caseMultiValuedAttributeInstance(multiValuedAttributeInstance); - if (result == null) result = caseAbstractAttributeInstance(multiValuedAttributeInstance); - if (result == null) result = defaultCase(theEObject); - return result; - } - case SerializationPackage.ABSTRACT_ATTRIBUTE_INSTANCE: { - AbstractAttributeInstance abstractAttributeInstance = (AbstractAttributeInstance)theEObject; - T result = caseAbstractAttributeInstance(abstractAttributeInstance); - if (result == null) result = defaultCase(theEObject); - return result; - } - default: return defaultCase(theEObject); - } - } - - /** - * Returns the result of interpreting the object as an instance of '<em>Abstract Reference Instance</em>'. - * <!-- begin-user-doc --> - * This implementation returns null; - * returning a non-null result will terminate the switch. - * <!-- end-user-doc --> - * @param object the target of the switch. - * @return the result of interpreting the object as an instance of '<em>Abstract Reference Instance</em>'. - * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) - * @generated - */ - public T caseAbstractReferenceInstance(AbstractReferenceInstance object) { - return null; - } - - /** - * Returns the result of interpreting the object as an instance of '<em>Multi Valued Containment Reference Instance</em>'. - * <!-- begin-user-doc --> - * This implementation returns null; - * returning a non-null result will terminate the switch. - * <!-- end-user-doc --> - * @param object the target of the switch. - * @return the result of interpreting the object as an instance of '<em>Multi Valued Containment Reference Instance</em>'. - * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) - * @generated - */ - public T caseMultiValuedContainmentReferenceInstance(MultiValuedContainmentReferenceInstance object) { - return null; - } - - /** - * Returns the result of interpreting the object as an instance of '<em>Multi Valued Reference Instance</em>'. - * <!-- begin-user-doc --> - * This implementation returns null; - * returning a non-null result will terminate the switch. - * <!-- end-user-doc --> - * @param object the target of the switch. - * @return the result of interpreting the object as an instance of '<em>Multi Valued Reference Instance</em>'. - * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) - * @generated - */ - public T caseMultiValuedReferenceInstance(MultiValuedReferenceInstance object) { - return null; - } - - /** - * Returns the result of interpreting the object as an instance of '<em>Single Valued Attribute Instance</em>'. - * <!-- begin-user-doc --> - * This implementation returns null; - * returning a non-null result will terminate the switch. - * <!-- end-user-doc --> - * @param object the target of the switch. - * @return the result of interpreting the object as an instance of '<em>Single Valued Attribute Instance</em>'. - * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) - * @generated - */ - public T caseSingleValuedAttributeInstance(SingleValuedAttributeInstance object) { - return null; - } - - /** - * Returns the result of interpreting the object as an instance of '<em>Extended EObject Reference</em>'. - * <!-- begin-user-doc --> - * This implementation returns null; - * returning a non-null result will terminate the switch. - * <!-- end-user-doc --> - * @param object the target of the switch. - * @return the result of interpreting the object as an instance of '<em>Extended EObject Reference</em>'. - * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) - * @generated - */ - public T caseExtendedEObjectReference(ExtendedEObjectReference object) { - return null; - } - - /** - * Returns the result of interpreting the object as an instance of '<em>Single Valued Containment Reference Instance</em>'. - * <!-- begin-user-doc --> - * This implementation returns null; - * returning a non-null result will terminate the switch. - * <!-- end-user-doc --> - * @param object the target of the switch. - * @return the result of interpreting the object as an instance of '<em>Single Valued Containment Reference Instance</em>'. - * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) - * @generated - */ - public T caseSingleValuedContainmentReferenceInstance(SingleValuedContainmentReferenceInstance object) { - return null; - } - - /** - * Returns the result of interpreting the object as an instance of '<em>Single Valued Reference Instance</em>'. - * <!-- begin-user-doc --> - * This implementation returns null; - * returning a non-null result will terminate the switch. - * <!-- end-user-doc --> - * @param object the target of the switch. - * @return the result of interpreting the object as an instance of '<em>Single Valued Reference Instance</em>'. - * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) - * @generated - */ - public T caseSingleValuedReferenceInstance(SingleValuedReferenceInstance object) { - return null; - } - - /** - * Returns the result of interpreting the object as an instance of '<em>Multi Valued Attribute Instance</em>'. - * <!-- begin-user-doc --> - * This implementation returns null; - * returning a non-null result will terminate the switch. - * <!-- end-user-doc --> - * @param object the target of the switch. - * @return the result of interpreting the object as an instance of '<em>Multi Valued Attribute Instance</em>'. - * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) - * @generated - */ - public T caseMultiValuedAttributeInstance(MultiValuedAttributeInstance object) { - return null; - } - - /** - * Returns the result of interpreting the object as an instance of '<em>Abstract Attribute Instance</em>'. - * <!-- begin-user-doc --> - * This implementation returns null; - * returning a non-null result will terminate the switch. - * <!-- end-user-doc --> - * @param object the target of the switch. - * @return the result of interpreting the object as an instance of '<em>Abstract Attribute Instance</em>'. - * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) - * @generated - */ - public T caseAbstractAttributeInstance(AbstractAttributeInstance object) { - return null; - } - - /** - * Returns the result of interpreting the object as an instance of '<em>EObject</em>'. - * <!-- begin-user-doc --> - * This implementation returns null; - * returning a non-null result will terminate the switch, but this is the last case anyway. - * <!-- end-user-doc --> - * @param object the target of the switch. - * @return the result of interpreting the object as an instance of '<em>EObject</em>'. - * @see #doSwitch(org.eclipse.emf.ecore.EObject) - * @generated - */ - public T defaultCase(EObject object) { - return null; - } - -} //SerializationSwitch
diff --git a/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/emf/facet/efacet/metamodel/v0_2_0/efacet/util/EFacetAdapterFactory.java b/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/emf/facet/efacet/metamodel/v0_2_0/efacet/util/EFacetAdapterFactory.java deleted file mode 100644 index 22f5a92..0000000 --- a/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/emf/facet/efacet/metamodel/v0_2_0/efacet/util/EFacetAdapterFactory.java +++ /dev/null
@@ -1,474 +0,0 @@ -/** - * Copyright (c) 2011, 2012 Mia-Software. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Gregoire Dupe (Mia-Software) - Design - * Nicolas Guyomar (Mia-Software) - Implementation - * Emmanuelle Rouillé (Mia-Software) - Bug 352618 - To be able to use non derived facet structural features and save them values. - * Nicolas Bros (Mia-Software) - Bug 361823 - [Restructuring] eFacet2 meta-model - * Gregoire Dupe (Mia-Software) - Bug 364325 - [Restructuring] The user must be able to navigate into a model using the Facet. - */ -package org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.util; - -import org.eclipse.emf.common.notify.Adapter; -import org.eclipse.emf.common.notify.Notifier; -import org.eclipse.emf.common.notify.impl.AdapterFactoryImpl; -import org.eclipse.emf.ecore.EAttribute; -import org.eclipse.emf.ecore.EClassifier; -import org.eclipse.emf.ecore.EModelElement; -import org.eclipse.emf.ecore.ENamedElement; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.EOperation; -import org.eclipse.emf.ecore.EPackage; -import org.eclipse.emf.ecore.EReference; -import org.eclipse.emf.ecore.EStructuralFeature; -import org.eclipse.emf.ecore.ETypedElement; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.*; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.Category; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.DerivedTypedElement; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.DocumentedElement; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.EFacetPackage; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.Facet; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.FacetAttribute; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.FacetElement; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.FacetOperation; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.FacetReference; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.FacetSet; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.ParameterValue; - -/** - * <!-- begin-user-doc --> - * The <b>Adapter Factory</b> for the model. - * It provides an adapter <code>createXXX</code> method for each class of the model. - * <!-- end-user-doc --> - * @see org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.EFacetPackage - * @generated - */ -public class EFacetAdapterFactory extends AdapterFactoryImpl { - /** - * The cached model package. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected static EFacetPackage modelPackage; - - /** - * Creates an instance of the adapter factory. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EFacetAdapterFactory() { - if (modelPackage == null) { - modelPackage = EFacetPackage.eINSTANCE; - } - } - - /** - * Returns whether this factory is applicable for the type of the object. - * <!-- begin-user-doc --> - * This implementation returns <code>true</code> if the object is either the model's package or is an instance object of the model. - * <!-- end-user-doc --> - * @return whether this factory is applicable for the type of the object. - * @generated - */ - @Override - public boolean isFactoryForType(Object object) { - if (object == modelPackage) { - return true; - } - if (object instanceof EObject) { - return ((EObject)object).eClass().getEPackage() == modelPackage; - } - return false; - } - - /** - * The switch that delegates to the <code>createXXX</code> methods. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected EFacetSwitch<Adapter> modelSwitch = - new EFacetSwitch<Adapter>() { - @Override - public Adapter caseFacetAttribute(FacetAttribute object) { - return createFacetAttributeAdapter(); - } - @Override - public Adapter caseFacetReference(FacetReference object) { - return createFacetReferenceAdapter(); - } - @Override - public Adapter caseFacetOperation(FacetOperation object) { - return createFacetOperationAdapter(); - } - @Override - public Adapter caseFacetSet(FacetSet object) { - return createFacetSetAdapter(); - } - @Override - public Adapter caseFacet(Facet object) { - return createFacetAdapter(); - } - @Override - public Adapter caseCategory(Category object) { - return createCategoryAdapter(); - } - @Override - public Adapter caseFacetElement(FacetElement object) { - return createFacetElementAdapter(); - } - @Override - public Adapter caseDerivedTypedElement(DerivedTypedElement object) { - return createDerivedTypedElementAdapter(); - } - @Override - public Adapter caseParameterValue(ParameterValue object) { - return createParameterValueAdapter(); - } - @Override - public Adapter caseDocumentedElement(DocumentedElement object) { - return createDocumentedElementAdapter(); - } - @Override - public Adapter caseEModelElement(EModelElement object) { - return createEModelElementAdapter(); - } - @Override - public Adapter caseENamedElement(ENamedElement object) { - return createENamedElementAdapter(); - } - @Override - public Adapter caseETypedElement(ETypedElement object) { - return createETypedElementAdapter(); - } - @Override - public Adapter caseEStructuralFeature(EStructuralFeature object) { - return createEStructuralFeatureAdapter(); - } - @Override - public Adapter caseEAttribute(EAttribute object) { - return createEAttributeAdapter(); - } - @Override - public Adapter caseEReference(EReference object) { - return createEReferenceAdapter(); - } - @Override - public Adapter caseEOperation(EOperation object) { - return createEOperationAdapter(); - } - @Override - public Adapter caseEPackage(EPackage object) { - return createEPackageAdapter(); - } - @Override - public Adapter caseEClassifier(EClassifier object) { - return createEClassifierAdapter(); - } - @Override - public Adapter defaultCase(EObject object) { - return createEObjectAdapter(); - } - }; - - /** - * Creates an adapter for the <code>target</code>. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @param target the object to adapt. - * @return the adapter for the <code>target</code>. - * @generated - */ - @Override - public Adapter createAdapter(Notifier target) { - return modelSwitch.doSwitch((EObject)target); - } - - - /** - * Creates a new adapter for an object of class '{@link org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.FacetAttribute <em>Facet Attribute</em>}'. - * <!-- begin-user-doc --> - * This default implementation returns null so that we can easily ignore cases; - * it's useful to ignore a case when inheritance will catch all the cases anyway. - * <!-- end-user-doc --> - * @return the new adapter. - * @see org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.FacetAttribute - * @generated - */ - public Adapter createFacetAttributeAdapter() { - return null; - } - - /** - * Creates a new adapter for an object of class '{@link org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.FacetReference <em>Facet Reference</em>}'. - * <!-- begin-user-doc --> - * This default implementation returns null so that we can easily ignore cases; - * it's useful to ignore a case when inheritance will catch all the cases anyway. - * <!-- end-user-doc --> - * @return the new adapter. - * @see org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.FacetReference - * @generated - */ - public Adapter createFacetReferenceAdapter() { - return null; - } - - /** - * Creates a new adapter for an object of class '{@link org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.FacetOperation <em>Facet Operation</em>}'. - * <!-- begin-user-doc --> - * This default implementation returns null so that we can easily ignore cases; - * it's useful to ignore a case when inheritance will catch all the cases anyway. - * <!-- end-user-doc --> - * @return the new adapter. - * @see org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.FacetOperation - * @generated - */ - public Adapter createFacetOperationAdapter() { - return null; - } - - /** - * Creates a new adapter for an object of class '{@link org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.FacetSet <em>Facet Set</em>}'. - * <!-- begin-user-doc --> - * This default implementation returns null so that we can easily ignore cases; - * it's useful to ignore a case when inheritance will catch all the cases anyway. - * <!-- end-user-doc --> - * @return the new adapter. - * @see org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.FacetSet - * @generated - */ - public Adapter createFacetSetAdapter() { - return null; - } - - /** - * Creates a new adapter for an object of class '{@link org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.Facet <em>Facet</em>}'. - * <!-- begin-user-doc --> - * This default implementation returns null so that we can easily ignore cases; - * it's useful to ignore a case when inheritance will catch all the cases anyway. - * <!-- end-user-doc --> - * @return the new adapter. - * @see org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.Facet - * @generated - */ - public Adapter createFacetAdapter() { - return null; - } - - /** - * Creates a new adapter for an object of class '{@link org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.Category <em>Category</em>}'. - * <!-- begin-user-doc --> - * This default implementation returns null so that we can easily ignore cases; - * it's useful to ignore a case when inheritance will catch all the cases anyway. - * <!-- end-user-doc --> - * @return the new adapter. - * @see org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.Category - * @generated - */ - public Adapter createCategoryAdapter() { - return null; - } - - /** - * Creates a new adapter for an object of class '{@link org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.FacetElement <em>Facet Element</em>}'. - * <!-- begin-user-doc --> - * This default implementation returns null so that we can easily ignore cases; - * it's useful to ignore a case when inheritance will catch all the cases anyway. - * <!-- end-user-doc --> - * @return the new adapter. - * @see org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.FacetElement - * @generated - */ - public Adapter createFacetElementAdapter() { - return null; - } - - /** - * Creates a new adapter for an object of class '{@link org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.DerivedTypedElement <em>Derived Typed Element</em>}'. - * <!-- begin-user-doc --> - * This default implementation returns null so that we can easily ignore cases; - * it's useful to ignore a case when inheritance will catch all the cases anyway. - * <!-- end-user-doc --> - * @return the new adapter. - * @see org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.DerivedTypedElement - * @generated - */ - public Adapter createDerivedTypedElementAdapter() { - return null; - } - - /** - * Creates a new adapter for an object of class '{@link org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.ParameterValue <em>Parameter Value</em>}'. - * <!-- begin-user-doc --> - * This default implementation returns null so that we can easily ignore cases; - * it's useful to ignore a case when inheritance will catch all the cases anyway. - * <!-- end-user-doc --> - * @return the new adapter. - * @see org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.ParameterValue - * @generated - */ - public Adapter createParameterValueAdapter() { - return null; - } - - /** - * Creates a new adapter for an object of class '{@link org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.DocumentedElement <em>Documented Element</em>}'. - * <!-- begin-user-doc --> - * This default implementation returns null so that we can easily ignore cases; - * it's useful to ignore a case when inheritance will catch all the cases anyway. - * <!-- end-user-doc --> - * @return the new adapter. - * @see org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.DocumentedElement - * @generated - */ - public Adapter createDocumentedElementAdapter() { - return null; - } - - /** - * Creates a new adapter for an object of class '{@link org.eclipse.emf.ecore.EModelElement <em>EModel Element</em>}'. - * <!-- begin-user-doc --> - * This default implementation returns null so that we can easily ignore cases; - * it's useful to ignore a case when inheritance will catch all the cases anyway. - * <!-- end-user-doc --> - * @return the new adapter. - * @see org.eclipse.emf.ecore.EModelElement - * @generated - */ - public Adapter createEModelElementAdapter() { - return null; - } - - /** - * Creates a new adapter for an object of class '{@link org.eclipse.emf.ecore.ENamedElement <em>ENamed Element</em>}'. - * <!-- begin-user-doc --> - * This default implementation returns null so that we can easily ignore cases; - * it's useful to ignore a case when inheritance will catch all the cases anyway. - * <!-- end-user-doc --> - * @return the new adapter. - * @see org.eclipse.emf.ecore.ENamedElement - * @generated - */ - public Adapter createENamedElementAdapter() { - return null; - } - - /** - * Creates a new adapter for an object of class '{@link org.eclipse.emf.ecore.ETypedElement <em>ETyped Element</em>}'. - * <!-- begin-user-doc --> - * This default implementation returns null so that we can easily ignore cases; - * it's useful to ignore a case when inheritance will catch all the cases anyway. - * <!-- end-user-doc --> - * @return the new adapter. - * @see org.eclipse.emf.ecore.ETypedElement - * @generated - */ - public Adapter createETypedElementAdapter() { - return null; - } - - /** - * Creates a new adapter for an object of class '{@link org.eclipse.emf.ecore.EStructuralFeature <em>EStructural Feature</em>}'. - * <!-- begin-user-doc --> - * This default implementation returns null so that we can easily ignore cases; - * it's useful to ignore a case when inheritance will catch all the cases anyway. - * <!-- end-user-doc --> - * @return the new adapter. - * @see org.eclipse.emf.ecore.EStructuralFeature - * @generated - */ - public Adapter createEStructuralFeatureAdapter() { - return null; - } - - /** - * Creates a new adapter for an object of class '{@link org.eclipse.emf.ecore.EAttribute <em>EAttribute</em>}'. - * <!-- begin-user-doc --> - * This default implementation returns null so that we can easily ignore cases; - * it's useful to ignore a case when inheritance will catch all the cases anyway. - * <!-- end-user-doc --> - * @return the new adapter. - * @see org.eclipse.emf.ecore.EAttribute - * @generated - */ - public Adapter createEAttributeAdapter() { - return null; - } - - /** - * Creates a new adapter for an object of class '{@link org.eclipse.emf.ecore.EReference <em>EReference</em>}'. - * <!-- begin-user-doc --> - * This default implementation returns null so that we can easily ignore cases; - * it's useful to ignore a case when inheritance will catch all the cases anyway. - * <!-- end-user-doc --> - * @return the new adapter. - * @see org.eclipse.emf.ecore.EReference - * @generated - */ - public Adapter createEReferenceAdapter() { - return null; - } - - /** - * Creates a new adapter for an object of class '{@link org.eclipse.emf.ecore.EOperation <em>EOperation</em>}'. - * <!-- begin-user-doc --> - * This default implementation returns null so that we can easily ignore cases; - * it's useful to ignore a case when inheritance will catch all the cases anyway. - * <!-- end-user-doc --> - * @return the new adapter. - * @see org.eclipse.emf.ecore.EOperation - * @generated - */ - public Adapter createEOperationAdapter() { - return null; - } - - /** - * Creates a new adapter for an object of class '{@link org.eclipse.emf.ecore.EPackage <em>EPackage</em>}'. - * <!-- begin-user-doc --> - * This default implementation returns null so that we can easily ignore cases; - * it's useful to ignore a case when inheritance will catch all the cases anyway. - * <!-- end-user-doc --> - * @return the new adapter. - * @see org.eclipse.emf.ecore.EPackage - * @generated - */ - public Adapter createEPackageAdapter() { - return null; - } - - /** - * Creates a new adapter for an object of class '{@link org.eclipse.emf.ecore.EClassifier <em>EClassifier</em>}'. - * <!-- begin-user-doc --> - * This default implementation returns null so that we can easily ignore cases; - * it's useful to ignore a case when inheritance will catch all the cases anyway. - * <!-- end-user-doc --> - * @return the new adapter. - * @see org.eclipse.emf.ecore.EClassifier - * @generated - */ - public Adapter createEClassifierAdapter() { - return null; - } - - /** - * Creates a new adapter for the default case. - * <!-- begin-user-doc --> - * This default implementation returns null. - * <!-- end-user-doc --> - * @return the new adapter. - * @generated - */ - public Adapter createEObjectAdapter() { - return null; - } - -} //EFacetAdapterFactory
diff --git a/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/emf/facet/efacet/metamodel/v0_2_0/efacet/util/EFacetSwitch.java b/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/emf/facet/efacet/metamodel/v0_2_0/efacet/util/EFacetSwitch.java deleted file mode 100644 index 321ef52..0000000 --- a/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/emf/facet/efacet/metamodel/v0_2_0/efacet/util/EFacetSwitch.java +++ /dev/null
@@ -1,529 +0,0 @@ -/** - * Copyright (c) 2011, 2012 Mia-Software. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Gregoire Dupe (Mia-Software) - Design - * Nicolas Guyomar (Mia-Software) - Implementation - * Emmanuelle Rouillé (Mia-Software) - Bug 352618 - To be able to use non derived facet structural features and save them values. - * Nicolas Bros (Mia-Software) - Bug 361823 - [Restructuring] eFacet2 meta-model - * Gregoire Dupe (Mia-Software) - Bug 366055 - NavigationQuery - * Gregoire Dupe (Mia-Software) - Bug 369673 - [Facet] IsOneOfQuery - * Olivier Remaud (Soft-Maint) - Bug 369824 - Add a simple way to return string literal constants from a customization query - * Gregoire Dupe (Mia-software) - Bug 369987 - [Restructuring][Table] Switch to the new customization and facet framework - * Gregoire Dupe (Mia-Software) - Bug 364325 - [Restructuring] The user must be able to navigate into a model using the Facet. - */ -package org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.util; - -import java.util.List; - -import org.eclipse.emf.ecore.EAttribute; -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.ecore.EClassifier; -import org.eclipse.emf.ecore.EModelElement; -import org.eclipse.emf.ecore.ENamedElement; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.EOperation; -import org.eclipse.emf.ecore.EPackage; -import org.eclipse.emf.ecore.EReference; -import org.eclipse.emf.ecore.EStructuralFeature; -import org.eclipse.emf.ecore.ETypedElement; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.*; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.Category; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.DerivedTypedElement; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.DocumentedElement; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.EFacetPackage; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.Facet; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.FacetAttribute; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.FacetElement; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.FacetOperation; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.FacetReference; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.FacetSet; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.ParameterValue; - -/** - * <!-- begin-user-doc --> - * The <b>Switch</b> for the model's inheritance hierarchy. - * It supports the call {@link #doSwitch(EObject) doSwitch(object)} - * to invoke the <code>caseXXX</code> method for each class of the model, - * starting with the actual class of the object - * and proceeding up the inheritance hierarchy - * until a non-null result is returned, - * which is the result of the switch. - * <!-- end-user-doc --> - * @see org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.EFacetPackage - * @generated - */ -public class EFacetSwitch<T> { - /** - * The cached model package - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected static EFacetPackage modelPackage; - - /** - * Creates an instance of the switch. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EFacetSwitch() { - if (modelPackage == null) { - modelPackage = EFacetPackage.eINSTANCE; - } - } - - /** - * Calls <code>caseXXX</code> for each class of the model until one returns a non null result; it yields that result. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the first non-null result returned by a <code>caseXXX</code> call. - * @generated - */ - public T doSwitch(EObject theEObject) { - return doSwitch(theEObject.eClass(), theEObject); - } - - /** - * Calls <code>caseXXX</code> for each class of the model until one returns a non null result; it yields that result. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the first non-null result returned by a <code>caseXXX</code> call. - * @generated - */ - protected T doSwitch(EClass theEClass, EObject theEObject) { - if (theEClass.eContainer() == modelPackage) { - return doSwitch(theEClass.getClassifierID(), theEObject); - } - else { - List<EClass> eSuperTypes = theEClass.getESuperTypes(); - return - eSuperTypes.isEmpty() ? - defaultCase(theEObject) : - doSwitch(eSuperTypes.get(0), theEObject); - } - } - - /** - * Calls <code>caseXXX</code> for each class of the model until one returns a non null result; it yields that result. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the first non-null result returned by a <code>caseXXX</code> call. - * @generated - */ - protected T doSwitch(int classifierID, EObject theEObject) { - switch (classifierID) { - case EFacetPackage.FACET_ATTRIBUTE: { - FacetAttribute facetAttribute = (FacetAttribute)theEObject; - T result = caseFacetAttribute(facetAttribute); - if (result == null) result = caseEAttribute(facetAttribute); - if (result == null) result = caseDerivedTypedElement(facetAttribute); - if (result == null) result = caseEStructuralFeature(facetAttribute); - if (result == null) result = caseFacetElement(facetAttribute); - if (result == null) result = caseETypedElement(facetAttribute); - if (result == null) result = caseDocumentedElement(facetAttribute); - if (result == null) result = caseENamedElement(facetAttribute); - if (result == null) result = caseEModelElement(facetAttribute); - if (result == null) result = defaultCase(theEObject); - return result; - } - case EFacetPackage.FACET_REFERENCE: { - FacetReference facetReference = (FacetReference)theEObject; - T result = caseFacetReference(facetReference); - if (result == null) result = caseEReference(facetReference); - if (result == null) result = caseDerivedTypedElement(facetReference); - if (result == null) result = caseEStructuralFeature(facetReference); - if (result == null) result = caseFacetElement(facetReference); - if (result == null) result = caseETypedElement(facetReference); - if (result == null) result = caseDocumentedElement(facetReference); - if (result == null) result = caseENamedElement(facetReference); - if (result == null) result = caseEModelElement(facetReference); - if (result == null) result = defaultCase(theEObject); - return result; - } - case EFacetPackage.FACET_OPERATION: { - FacetOperation facetOperation = (FacetOperation)theEObject; - T result = caseFacetOperation(facetOperation); - if (result == null) result = caseEOperation(facetOperation); - if (result == null) result = caseDerivedTypedElement(facetOperation); - if (result == null) result = caseFacetElement(facetOperation); - if (result == null) result = caseETypedElement(facetOperation); - if (result == null) result = caseENamedElement(facetOperation); - if (result == null) result = caseDocumentedElement(facetOperation); - if (result == null) result = caseEModelElement(facetOperation); - if (result == null) result = defaultCase(theEObject); - return result; - } - case EFacetPackage.FACET_SET: { - FacetSet facetSet = (FacetSet)theEObject; - T result = caseFacetSet(facetSet); - if (result == null) result = caseEPackage(facetSet); - if (result == null) result = caseDocumentedElement(facetSet); - if (result == null) result = caseENamedElement(facetSet); - if (result == null) result = caseEModelElement(facetSet); - if (result == null) result = defaultCase(theEObject); - return result; - } - case EFacetPackage.FACET: { - Facet facet = (Facet)theEObject; - T result = caseFacet(facet); - if (result == null) result = caseEClassifier(facet); - if (result == null) result = caseDocumentedElement(facet); - if (result == null) result = caseENamedElement(facet); - if (result == null) result = caseEModelElement(facet); - if (result == null) result = defaultCase(theEObject); - return result; - } - case EFacetPackage.CATEGORY: { - Category category = (Category)theEObject; - T result = caseCategory(category); - if (result == null) result = caseENamedElement(category); - if (result == null) result = caseDocumentedElement(category); - if (result == null) result = caseEModelElement(category); - if (result == null) result = defaultCase(theEObject); - return result; - } - case EFacetPackage.FACET_ELEMENT: { - FacetElement facetElement = (FacetElement)theEObject; - T result = caseFacetElement(facetElement); - if (result == null) result = caseETypedElement(facetElement); - if (result == null) result = caseDocumentedElement(facetElement); - if (result == null) result = caseENamedElement(facetElement); - if (result == null) result = caseEModelElement(facetElement); - if (result == null) result = defaultCase(theEObject); - return result; - } - case EFacetPackage.DERIVED_TYPED_ELEMENT: { - DerivedTypedElement derivedTypedElement = (DerivedTypedElement)theEObject; - T result = caseDerivedTypedElement(derivedTypedElement); - if (result == null) result = caseFacetElement(derivedTypedElement); - if (result == null) result = caseETypedElement(derivedTypedElement); - if (result == null) result = caseDocumentedElement(derivedTypedElement); - if (result == null) result = caseENamedElement(derivedTypedElement); - if (result == null) result = caseEModelElement(derivedTypedElement); - if (result == null) result = defaultCase(theEObject); - return result; - } - case EFacetPackage.PARAMETER_VALUE: { - ParameterValue parameterValue = (ParameterValue)theEObject; - T result = caseParameterValue(parameterValue); - if (result == null) result = defaultCase(theEObject); - return result; - } - case EFacetPackage.DOCUMENTED_ELEMENT: { - DocumentedElement documentedElement = (DocumentedElement)theEObject; - T result = caseDocumentedElement(documentedElement); - if (result == null) result = defaultCase(theEObject); - return result; - } - default: return defaultCase(theEObject); - } - } - - /** - * Returns the result of interpreting the object as an instance of '<em>Facet Attribute</em>'. - * <!-- begin-user-doc --> - * This implementation returns null; - * returning a non-null result will terminate the switch. - * <!-- end-user-doc --> - * @param object the target of the switch. - * @return the result of interpreting the object as an instance of '<em>Facet Attribute</em>'. - * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) - * @generated - */ - public T caseFacetAttribute(FacetAttribute object) { - return null; - } - - /** - * Returns the result of interpreting the object as an instance of '<em>Facet Reference</em>'. - * <!-- begin-user-doc --> - * This implementation returns null; - * returning a non-null result will terminate the switch. - * <!-- end-user-doc --> - * @param object the target of the switch. - * @return the result of interpreting the object as an instance of '<em>Facet Reference</em>'. - * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) - * @generated - */ - public T caseFacetReference(FacetReference object) { - return null; - } - - /** - * Returns the result of interpreting the object as an instance of '<em>Facet Operation</em>'. - * <!-- begin-user-doc --> - * This implementation returns null; - * returning a non-null result will terminate the switch. - * <!-- end-user-doc --> - * @param object the target of the switch. - * @return the result of interpreting the object as an instance of '<em>Facet Operation</em>'. - * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) - * @generated - */ - public T caseFacetOperation(FacetOperation object) { - return null; - } - - /** - * Returns the result of interpreting the object as an instance of '<em>Facet Set</em>'. - * <!-- begin-user-doc --> - * This implementation returns null; - * returning a non-null result will terminate the switch. - * <!-- end-user-doc --> - * @param object the target of the switch. - * @return the result of interpreting the object as an instance of '<em>Facet Set</em>'. - * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) - * @generated - */ - public T caseFacetSet(FacetSet object) { - return null; - } - - /** - * Returns the result of interpreting the object as an instance of '<em>Facet</em>'. - * <!-- begin-user-doc --> - * This implementation returns null; - * returning a non-null result will terminate the switch. - * <!-- end-user-doc --> - * @param object the target of the switch. - * @return the result of interpreting the object as an instance of '<em>Facet</em>'. - * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) - * @generated - */ - public T caseFacet(Facet object) { - return null; - } - - /** - * Returns the result of interpreting the object as an instance of '<em>Category</em>'. - * <!-- begin-user-doc --> - * This implementation returns null; - * returning a non-null result will terminate the switch. - * <!-- end-user-doc --> - * @param object the target of the switch. - * @return the result of interpreting the object as an instance of '<em>Category</em>'. - * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) - * @generated - */ - public T caseCategory(Category object) { - return null; - } - - /** - * Returns the result of interpreting the object as an instance of '<em>Facet Element</em>'. - * <!-- begin-user-doc --> - * This implementation returns null; - * returning a non-null result will terminate the switch. - * <!-- end-user-doc --> - * @param object the target of the switch. - * @return the result of interpreting the object as an instance of '<em>Facet Element</em>'. - * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) - * @generated - */ - public T caseFacetElement(FacetElement object) { - return null; - } - - /** - * Returns the result of interpreting the object as an instance of '<em>Derived Typed Element</em>'. - * <!-- begin-user-doc --> - * This implementation returns null; - * returning a non-null result will terminate the switch. - * <!-- end-user-doc --> - * @param object the target of the switch. - * @return the result of interpreting the object as an instance of '<em>Derived Typed Element</em>'. - * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) - * @generated - */ - public T caseDerivedTypedElement(DerivedTypedElement object) { - return null; - } - - /** - * Returns the result of interpreting the object as an instance of '<em>Parameter Value</em>'. - * <!-- begin-user-doc --> - * This implementation returns null; - * returning a non-null result will terminate the switch. - * <!-- end-user-doc --> - * @param object the target of the switch. - * @return the result of interpreting the object as an instance of '<em>Parameter Value</em>'. - * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) - * @generated - */ - public T caseParameterValue(ParameterValue object) { - return null; - } - - /** - * Returns the result of interpreting the object as an instance of '<em>Documented Element</em>'. - * <!-- begin-user-doc --> - * This implementation returns null; - * returning a non-null result will terminate the switch. - * <!-- end-user-doc --> - * @param object the target of the switch. - * @return the result of interpreting the object as an instance of '<em>Documented Element</em>'. - * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) - * @generated - */ - public T caseDocumentedElement(DocumentedElement object) { - return null; - } - - /** - * Returns the result of interpreting the object as an instance of '<em>EModel Element</em>'. - * <!-- begin-user-doc --> - * This implementation returns null; - * returning a non-null result will terminate the switch. - * <!-- end-user-doc --> - * @param object the target of the switch. - * @return the result of interpreting the object as an instance of '<em>EModel Element</em>'. - * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) - * @generated - */ - public T caseEModelElement(EModelElement object) { - return null; - } - - /** - * Returns the result of interpreting the object as an instance of '<em>ENamed Element</em>'. - * <!-- begin-user-doc --> - * This implementation returns null; - * returning a non-null result will terminate the switch. - * <!-- end-user-doc --> - * @param object the target of the switch. - * @return the result of interpreting the object as an instance of '<em>ENamed Element</em>'. - * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) - * @generated - */ - public T caseENamedElement(ENamedElement object) { - return null; - } - - /** - * Returns the result of interpreting the object as an instance of '<em>ETyped Element</em>'. - * <!-- begin-user-doc --> - * This implementation returns null; - * returning a non-null result will terminate the switch. - * <!-- end-user-doc --> - * @param object the target of the switch. - * @return the result of interpreting the object as an instance of '<em>ETyped Element</em>'. - * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) - * @generated - */ - public T caseETypedElement(ETypedElement object) { - return null; - } - - /** - * Returns the result of interpreting the object as an instance of '<em>EStructural Feature</em>'. - * <!-- begin-user-doc --> - * This implementation returns null; - * returning a non-null result will terminate the switch. - * <!-- end-user-doc --> - * @param object the target of the switch. - * @return the result of interpreting the object as an instance of '<em>EStructural Feature</em>'. - * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) - * @generated - */ - public T caseEStructuralFeature(EStructuralFeature object) { - return null; - } - - /** - * Returns the result of interpreting the object as an instance of '<em>EAttribute</em>'. - * <!-- begin-user-doc --> - * This implementation returns null; - * returning a non-null result will terminate the switch. - * <!-- end-user-doc --> - * @param object the target of the switch. - * @return the result of interpreting the object as an instance of '<em>EAttribute</em>'. - * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) - * @generated - */ - public T caseEAttribute(EAttribute object) { - return null; - } - - /** - * Returns the result of interpreting the object as an instance of '<em>EReference</em>'. - * <!-- begin-user-doc --> - * This implementation returns null; - * returning a non-null result will terminate the switch. - * <!-- end-user-doc --> - * @param object the target of the switch. - * @return the result of interpreting the object as an instance of '<em>EReference</em>'. - * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) - * @generated - */ - public T caseEReference(EReference object) { - return null; - } - - /** - * Returns the result of interpreting the object as an instance of '<em>EOperation</em>'. - * <!-- begin-user-doc --> - * This implementation returns null; - * returning a non-null result will terminate the switch. - * <!-- end-user-doc --> - * @param object the target of the switch. - * @return the result of interpreting the object as an instance of '<em>EOperation</em>'. - * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) - * @generated - */ - public T caseEOperation(EOperation object) { - return null; - } - - /** - * Returns the result of interpreting the object as an instance of '<em>EPackage</em>'. - * <!-- begin-user-doc --> - * This implementation returns null; - * returning a non-null result will terminate the switch. - * <!-- end-user-doc --> - * @param object the target of the switch. - * @return the result of interpreting the object as an instance of '<em>EPackage</em>'. - * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) - * @generated - */ - public T caseEPackage(EPackage object) { - return null; - } - - /** - * Returns the result of interpreting the object as an instance of '<em>EClassifier</em>'. - * <!-- begin-user-doc --> - * This implementation returns null; - * returning a non-null result will terminate the switch. - * <!-- end-user-doc --> - * @param object the target of the switch. - * @return the result of interpreting the object as an instance of '<em>EClassifier</em>'. - * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) - * @generated - */ - public T caseEClassifier(EClassifier object) { - return null; - } - - /** - * Returns the result of interpreting the object as an instance of '<em>EObject</em>'. - * <!-- begin-user-doc --> - * This implementation returns null; - * returning a non-null result will terminate the switch, but this is the last case anyway. - * <!-- end-user-doc --> - * @param object the target of the switch. - * @return the result of interpreting the object as an instance of '<em>EObject</em>'. - * @see #doSwitch(org.eclipse.emf.ecore.EObject) - * @generated - */ - public T defaultCase(EObject object) { - return null; - } - -} //EFacetSwitch
diff --git a/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/emf/facet/efacet/metamodel/v0_2_0/efacetcatalog/EfacetcatalogFactory.java b/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/emf/facet/efacet/metamodel/v0_2_0/efacetcatalog/EfacetcatalogFactory.java deleted file mode 100644 index 20e61e5..0000000 --- a/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/emf/facet/efacet/metamodel/v0_2_0/efacetcatalog/EfacetcatalogFactory.java +++ /dev/null
@@ -1,57 +0,0 @@ -/** - * Copyright (c) 2011, 2015 Mia-Software. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Grégoire Dupé (Mia-Software) - Design - * Nicolas Guyomar (Mia-Software) - Implementation - * Emmanuelle Rouillé (Mia-Software) - Bug 352618 - To be able to use non-derived facet structural features and save their values. - * Nicolas Bros (Mia-Software) - Bug 370110 - Rename efacetcatalog2.ecore - * Grégoire Dupé (Mia-Software) - Bug 361817 - [Restructuring] Dynamic load to the facet catalog - * Grégoire Dupé (Mia-Software) - Bug 477657 - The catalog manager should be able to manage workspace model - */ -package org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacetcatalog; - -import org.eclipse.emf.ecore.EFactory; - -/** - * <!-- begin-user-doc --> - * The <b>Factory</b> for the model. - * It provides a create method for each non-abstract class of the model. - * <!-- end-user-doc --> - * @see org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacetcatalog.EfacetcatalogPackage - * @generated - */ -@Deprecated -public interface EfacetcatalogFactory extends EFactory { - /** - * The singleton instance of the factory. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - EfacetcatalogFactory eINSTANCE = org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacetcatalog.impl.EfacetcatalogFactoryImpl.init(); - - /** - * Returns a new object of class '<em>Facet Set Catalog</em>'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return a new object of class '<em>Facet Set Catalog</em>'. - * @generated - */ - FacetSetCatalog createFacetSetCatalog(); - - /** - * Returns the package supported by this factory. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the package supported by this factory. - * @generated - */ - EfacetcatalogPackage getEfacetcatalogPackage(); - -} //EfacetcatalogFactory
diff --git a/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/emf/facet/efacet/metamodel/v0_2_0/efacetcatalog/EfacetcatalogPackage.java b/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/emf/facet/efacet/metamodel/v0_2_0/efacetcatalog/EfacetcatalogPackage.java deleted file mode 100644 index ab7ac0b..0000000 --- a/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/emf/facet/efacet/metamodel/v0_2_0/efacetcatalog/EfacetcatalogPackage.java +++ /dev/null
@@ -1,155 +0,0 @@ -/** - * Copyright (c) 2011, 2015 Mia-Software. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Grégoire Dupé (Mia-Software) - Design - * Nicolas Guyomar (Mia-Software) - Implementation - * Emmanuelle Rouillé (Mia-Software) - Bug 352618 - To be able to use non-derived facet structural features and save their values. - * Nicolas Bros (Mia-Software) - Bug 370110 - Rename efacetcatalog2.ecore - * Grégoire Dupé (Mia-Software) - Bug 361817 - [Restructuring] Dynamic load to the facet catalog - * Grégoire Dupé (Mia-Software) - Bug 477657 - The catalog manager should be able to manage workspace model - */ -package org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacetcatalog; - -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.ecore.EPackage; -import org.eclipse.emf.ecore.EReference; -import org.eclipse.emf.facet.util.emf.catalog.CatalogPackage; - -/** - * <!-- begin-user-doc --> - * The <b>Package</b> for the model. - * It contains accessors for the meta objects to represent - * <ul> - * <li>each class,</li> - * <li>each feature of each class,</li> - * <li>each enum,</li> - * <li>and each data type</li> - * </ul> - * <!-- end-user-doc --> - * @see org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacetcatalog.EfacetcatalogFactory - * @model kind="package" - * @generated - */ -@Deprecated -public interface EfacetcatalogPackage extends EPackage { - /** - * The package name. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - String eNAME = "efacetcatalog"; //$NON-NLS-1$ - - /** - * The package namespace URI. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - String eNS_URI = "http://www.eclipse.org/emf/facet/efacet/0.2.incubation/efacetcatalog"; //$NON-NLS-1$ - - /** - * The package namespace name. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - String eNS_PREFIX = "efacetcatalog"; //$NON-NLS-1$ - - /** - * The singleton instance of the package. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - EfacetcatalogPackage eINSTANCE = org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacetcatalog.impl.EfacetcatalogPackageImpl.init(); - - /** - * The meta object id for the '{@link org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacetcatalog.impl.FacetSetCatalogImpl <em>Facet Set Catalog</em>}' class. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacetcatalog.impl.FacetSetCatalogImpl - * @see org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacetcatalog.impl.EfacetcatalogPackageImpl#getFacetSetCatalog() - * @generated - */ - int FACET_SET_CATALOG = 0; - - /** - * The feature id for the '<em><b>Installed Entries</b></em>' reference list. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int FACET_SET_CATALOG__INSTALLED_ENTRIES = CatalogPackage.CATALOG__INSTALLED_ENTRIES; - - /** - * The feature id for the '<em><b>Name</b></em>' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int FACET_SET_CATALOG__NAME = CatalogPackage.CATALOG__NAME; - - /** - * The number of structural features of the '<em>Facet Set Catalog</em>' class. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int FACET_SET_CATALOG_FEATURE_COUNT = CatalogPackage.CATALOG_FEATURE_COUNT + 0; - - - /** - * Returns the meta object for class '{@link org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacetcatalog.FacetSetCatalog <em>Facet Set Catalog</em>}'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the meta object for class '<em>Facet Set Catalog</em>'. - * @see org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacetcatalog.FacetSetCatalog - * @generated - */ - EClass getFacetSetCatalog(); - - /** - * Returns the factory that creates the instances of the model. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the factory that creates the instances of the model. - * @generated - */ - EfacetcatalogFactory getEfacetcatalogFactory(); - - /** - * <!-- begin-user-doc --> - * Defines literals for the meta objects that represent - * <ul> - * <li>each class,</li> - * <li>each feature of each class,</li> - * <li>each enum,</li> - * <li>and each data type</li> - * </ul> - * <!-- end-user-doc --> - * @generated - */ - interface Literals { - /** - * The meta object literal for the '{@link org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacetcatalog.impl.FacetSetCatalogImpl <em>Facet Set Catalog</em>}' class. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacetcatalog.impl.FacetSetCatalogImpl - * @see org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacetcatalog.impl.EfacetcatalogPackageImpl#getFacetSetCatalog() - * @generated - */ - EClass FACET_SET_CATALOG = eINSTANCE.getFacetSetCatalog(); - - } - -} //EfacetcatalogPackage
diff --git a/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/emf/facet/efacet/metamodel/v0_2_0/efacetcatalog/FacetSetCatalog.java b/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/emf/facet/efacet/metamodel/v0_2_0/efacetcatalog/FacetSetCatalog.java deleted file mode 100644 index e988c5b..0000000 --- a/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/emf/facet/efacet/metamodel/v0_2_0/efacetcatalog/FacetSetCatalog.java +++ /dev/null
@@ -1,42 +0,0 @@ -/** - * Copyright (c) 2011, 2015 Mia-Software. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Grégoire Dupé (Mia-Software) - Design - * Nicolas Guyomar (Mia-Software) - Implementation - * Emmanuelle Rouillé (Mia-Software) - Bug 352618 - To be able to use non-derived facet structural features and save their values. - * Nicolas Bros (Mia-Software) - Bug 370110 - Rename efacetcatalog2.ecore - * Grégoire Dupé (Mia-Software) - Bug 361817 - [Restructuring] Dynamic load to the facet catalog - * Grégoire Dupé (Mia-Software) - Bug 477657 - The catalog manager should be able to manage workspace model - */ -package org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacetcatalog; - -import org.eclipse.emf.common.util.EList; - -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.FacetSet; - -import org.eclipse.emf.facet.util.emf.catalog.Catalog; - -/** - * <!-- begin-user-doc --> - * A representation of the model object '<em><b>Facet Set Catalog</b></em>'. - * <!-- end-user-doc --> - * - * <!-- begin-model-doc --> - * A FacetSetCatalog aims at referencing EMF Facet FacetSet. - * <!-- end-model-doc --> - * - * - * @see org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacetcatalog.EfacetcatalogPackage#getFacetSetCatalog() - * @model - * @generated - */ -@Deprecated -public interface FacetSetCatalog extends Catalog { - -} // FacetSetCatalog
diff --git a/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/emf/facet/efacet/metamodel/v0_2_0/efacetcatalog/impl/EfacetcatalogFactoryImpl.java b/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/emf/facet/efacet/metamodel/v0_2_0/efacetcatalog/impl/EfacetcatalogFactoryImpl.java deleted file mode 100644 index b34c28d..0000000 --- a/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/emf/facet/efacet/metamodel/v0_2_0/efacetcatalog/impl/EfacetcatalogFactoryImpl.java +++ /dev/null
@@ -1,110 +0,0 @@ -/** - * Copyright (c) 2011, 2015 Mia-Software. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Grégoire Dupé (Mia-Software) - Design - * Nicolas Guyomar (Mia-Software) - Implementation - * Emmanuelle Rouillé (Mia-Software) - Bug 352618 - To be able to use non-derived facet structural features and save their values. - * Nicolas Bros (Mia-Software) - Bug 370110 - Rename efacetcatalog2.ecore - * Grégoire Dupé (Mia-Software) - Bug 361817 - [Restructuring] Dynamic load to the facet catalog - * Grégoire Dupé (Mia-Software) - Bug 477657 - The catalog manager should be able to manage workspace model - */ -package org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacetcatalog.impl; - -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.EPackage; - -import org.eclipse.emf.ecore.impl.EFactoryImpl; - -import org.eclipse.emf.ecore.plugin.EcorePlugin; - -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacetcatalog.*; - -/** - * <!-- begin-user-doc --> - * An implementation of the model <b>Factory</b>. - * <!-- end-user-doc --> - * @generated - */ -@Deprecated -public class EfacetcatalogFactoryImpl extends EFactoryImpl implements EfacetcatalogFactory { - /** - * Creates the default factory implementation. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public static EfacetcatalogFactory init() { - try { - EfacetcatalogFactory theEfacetcatalogFactory = (EfacetcatalogFactory)EPackage.Registry.INSTANCE.getEFactory("http://www.eclipse.org/emf/facet/efacet/0.2.incubation/efacetcatalog"); //$NON-NLS-1$ - if (theEfacetcatalogFactory != null) { - return theEfacetcatalogFactory; - } - } - catch (Exception exception) { - EcorePlugin.INSTANCE.log(exception); - } - return new EfacetcatalogFactoryImpl(); - } - - /** - * Creates an instance of the factory. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EfacetcatalogFactoryImpl() { - super(); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public EObject create(EClass eClass) { - switch (eClass.getClassifierID()) { - case EfacetcatalogPackage.FACET_SET_CATALOG: return createFacetSetCatalog(); - default: - throw new IllegalArgumentException("The class '" + eClass.getName() + "' is not a valid classifier"); //$NON-NLS-1$ //$NON-NLS-2$ - } - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public FacetSetCatalog createFacetSetCatalog() { - FacetSetCatalogImpl facetSetCatalog = new FacetSetCatalogImpl(); - return facetSetCatalog; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EfacetcatalogPackage getEfacetcatalogPackage() { - return (EfacetcatalogPackage)getEPackage(); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @deprecated - * @generated - */ - @Deprecated - public static EfacetcatalogPackage getPackage() { - return EfacetcatalogPackage.eINSTANCE; - } - -} //EfacetcatalogFactoryImpl
diff --git a/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/emf/facet/efacet/metamodel/v0_2_0/efacetcatalog/impl/EfacetcatalogPackageImpl.java b/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/emf/facet/efacet/metamodel/v0_2_0/efacetcatalog/impl/EfacetcatalogPackageImpl.java deleted file mode 100644 index 5e6e093..0000000 --- a/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/emf/facet/efacet/metamodel/v0_2_0/efacetcatalog/impl/EfacetcatalogPackageImpl.java +++ /dev/null
@@ -1,193 +0,0 @@ -/** - * Copyright (c) 2011, 2015 Mia-Software. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Grégoire Dupé (Mia-Software) - Design - * Nicolas Guyomar (Mia-Software) - Implementation - * Emmanuelle Rouillé (Mia-Software) - Bug 352618 - To be able to use non-derived facet structural features and save their values. - * Nicolas Bros (Mia-Software) - Bug 370110 - Rename efacetcatalog2.ecore - * Grégoire Dupé (Mia-Software) - Bug 361817 - [Restructuring] Dynamic load to the facet catalog - * Grégoire Dupé (Mia-Software) - Bug 477657 - The catalog manager should be able to manage workspace model - */ -package org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacetcatalog.impl; - -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.ecore.EPackage; -import org.eclipse.emf.ecore.EReference; - -import org.eclipse.emf.ecore.impl.EPackageImpl; - -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.EFacetPackage; - -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacetcatalog.EfacetcatalogFactory; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacetcatalog.EfacetcatalogPackage; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacetcatalog.FacetSetCatalog; - -import org.eclipse.emf.facet.util.emf.catalog.CatalogPackage; - -/** - * <!-- begin-user-doc --> - * An implementation of the model <b>Package</b>. - * <!-- end-user-doc --> - * @generated - */ -@Deprecated -public class EfacetcatalogPackageImpl extends EPackageImpl implements EfacetcatalogPackage { - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - private EClass facetSetCatalogEClass = null; - - /** - * Creates an instance of the model <b>Package</b>, registered with - * {@link org.eclipse.emf.ecore.EPackage.Registry EPackage.Registry} by the package - * package URI value. - * <p>Note: the correct way to create the package is via the static - * factory method {@link #init init()}, which also performs - * initialization of the package, or returns the registered package, - * if one already exists. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see org.eclipse.emf.ecore.EPackage.Registry - * @see org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacetcatalog.EfacetcatalogPackage#eNS_URI - * @see #init() - * @generated - */ - private EfacetcatalogPackageImpl() { - super(eNS_URI, EfacetcatalogFactory.eINSTANCE); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - private static boolean isInited = false; - - /** - * Creates, registers, and initializes the <b>Package</b> for this model, and for any others upon which it depends. - * - * <p>This method is used to initialize {@link EfacetcatalogPackage#eINSTANCE} when that field is accessed. - * Clients should not invoke it directly. Instead, they should simply access that field to obtain the package. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #eNS_URI - * @see #createPackageContents() - * @see #initializePackageContents() - * @generated - */ - public static EfacetcatalogPackage init() { - if (isInited) return (EfacetcatalogPackage)EPackage.Registry.INSTANCE.getEPackage(EfacetcatalogPackage.eNS_URI); - - // Obtain or create and register package - EfacetcatalogPackageImpl theEfacetcatalogPackage = (EfacetcatalogPackageImpl)(EPackage.Registry.INSTANCE.get(eNS_URI) instanceof EfacetcatalogPackageImpl ? EPackage.Registry.INSTANCE.get(eNS_URI) : new EfacetcatalogPackageImpl()); - - isInited = true; - - // Initialize simple dependencies - CatalogPackage.eINSTANCE.eClass(); - EFacetPackage.eINSTANCE.eClass(); - - // Create package meta-data objects - theEfacetcatalogPackage.createPackageContents(); - - // Initialize created meta-data - theEfacetcatalogPackage.initializePackageContents(); - - // Mark meta-data to indicate it can't be changed - theEfacetcatalogPackage.freeze(); - - - // Update the registry and return the package - EPackage.Registry.INSTANCE.put(EfacetcatalogPackage.eNS_URI, theEfacetcatalogPackage); - return theEfacetcatalogPackage; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EClass getFacetSetCatalog() { - return facetSetCatalogEClass; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EfacetcatalogFactory getEfacetcatalogFactory() { - return (EfacetcatalogFactory)getEFactoryInstance(); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - private boolean isCreated = false; - - /** - * Creates the meta-model objects for the package. This method is - * guarded to have no affect on any invocation but its first. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public void createPackageContents() { - if (isCreated) return; - isCreated = true; - - // Create classes and their features - facetSetCatalogEClass = createEClass(FACET_SET_CATALOG); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - private boolean isInitialized = false; - - /** - * Complete the initialization of the package and its meta-model. This - * method is guarded to have no affect on any invocation but its first. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public void initializePackageContents() { - if (isInitialized) return; - isInitialized = true; - - // Initialize package - setName(eNAME); - setNsPrefix(eNS_PREFIX); - setNsURI(eNS_URI); - - // Obtain other dependent packages - CatalogPackage theCatalogPackage = (CatalogPackage)EPackage.Registry.INSTANCE.getEPackage(CatalogPackage.eNS_URI); - - // Create type parameters - - // Set bounds for type parameters - - // Add supertypes to classes - facetSetCatalogEClass.getESuperTypes().add(theCatalogPackage.getCatalog()); - - // Initialize classes and features; add operations and parameters - initEClass(facetSetCatalogEClass, FacetSetCatalog.class, "FacetSetCatalog", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); //$NON-NLS-1$ - - // Create resource - createResource(eNS_URI); - } - -} //EfacetcatalogPackageImpl
diff --git a/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/emf/facet/efacet/metamodel/v0_2_0/efacetcatalog/impl/FacetSetCatalogImpl.java b/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/emf/facet/efacet/metamodel/v0_2_0/efacetcatalog/impl/FacetSetCatalogImpl.java deleted file mode 100644 index 70afeac..0000000 --- a/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/emf/facet/efacet/metamodel/v0_2_0/efacetcatalog/impl/FacetSetCatalogImpl.java +++ /dev/null
@@ -1,215 +0,0 @@ -/** - * Copyright (c) 2011, 2015 Mia-Software. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Grégoire Dupé (Mia-Software) - Design - * Nicolas Guyomar (Mia-Software) - Implementation - * Emmanuelle Rouillé (Mia-Software) - Bug 352618 - To be able to use non-derived facet structural features and save their values. - * Nicolas Bros (Mia-Software) - Bug 370110 - Rename efacetcatalog2.ecore - * Grégoire Dupé (Mia-Software) - Bug 361817 - [Restructuring] Dynamic load to the facet catalog - * Grégoire Dupé (Mia-Software) - Bug 477657 - The catalog manager should be able to manage workspace model - */ -package org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacetcatalog.impl; - -import java.util.Collection; - -import org.eclipse.emf.common.notify.Notification; -import org.eclipse.emf.common.util.EList; -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.impl.ENotificationImpl; -import org.eclipse.emf.ecore.impl.EObjectImpl; -import org.eclipse.emf.ecore.util.EObjectResolvingEList; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacetcatalog.EfacetcatalogPackage; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacetcatalog.FacetSetCatalog; - -/** - * <!-- begin-user-doc --> - * An implementation of the model object '<em><b>Facet Set Catalog</b></em>'. - * <!-- end-user-doc --> - * <p> - * The following features are implemented: - * <ul> - * <li>{@link org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacetcatalog.impl.FacetSetCatalogImpl#getInstalledEntries <em>Installed Entries</em>}</li> - * <li>{@link org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacetcatalog.impl.FacetSetCatalogImpl#getName <em>Name</em>}</li> - * </ul> - * </p> - * - * @generated - */ -@Deprecated -public class FacetSetCatalogImpl extends EObjectImpl implements FacetSetCatalog { - /** - * The cached value of the '{@link #getInstalledEntries() <em>Installed Entries</em>}' reference list. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #getInstalledEntries() - * @generated - * @ordered - */ - protected EList<EObject> installedEntries; - - /** - * The default value of the '{@link #getName() <em>Name</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #getName() - * @generated - * @ordered - */ - protected static final String NAME_EDEFAULT = null; - - /** - * The cached value of the '{@link #getName() <em>Name</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #getName() - * @generated - * @ordered - */ - protected String name = NAME_EDEFAULT; - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected FacetSetCatalogImpl() { - super(); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - protected EClass eStaticClass() { - return EfacetcatalogPackage.Literals.FACET_SET_CATALOG; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EList<EObject> getInstalledEntries() { - if (installedEntries == null) { - installedEntries = new EObjectResolvingEList<EObject>(EObject.class, this, EfacetcatalogPackage.FACET_SET_CATALOG__INSTALLED_ENTRIES); - } - return installedEntries; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public String getName() { - return name; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public void setName(final String newName) { - String oldName = name; - name = newName; - if (eNotificationRequired()) - eNotify(new ENotificationImpl(this, Notification.SET, EfacetcatalogPackage.FACET_SET_CATALOG__NAME, oldName, name)); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public Object eGet(final int featureID, final boolean resolve, final boolean coreType) { - switch (featureID) { - case EfacetcatalogPackage.FACET_SET_CATALOG__INSTALLED_ENTRIES: - return getInstalledEntries(); - case EfacetcatalogPackage.FACET_SET_CATALOG__NAME: - return getName(); - } - return super.eGet(featureID, resolve, coreType); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @SuppressWarnings("unchecked") - @Override - public void eSet(final int featureID, final Object newValue) { - switch (featureID) { - case EfacetcatalogPackage.FACET_SET_CATALOG__INSTALLED_ENTRIES: - getInstalledEntries().clear(); - getInstalledEntries().addAll((Collection<? extends EObject>)newValue); - return; - case EfacetcatalogPackage.FACET_SET_CATALOG__NAME: - setName((String)newValue); - return; - } - super.eSet(featureID, newValue); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public void eUnset(final int featureID) { - switch (featureID) { - case EfacetcatalogPackage.FACET_SET_CATALOG__INSTALLED_ENTRIES: - getInstalledEntries().clear(); - return; - case EfacetcatalogPackage.FACET_SET_CATALOG__NAME: - setName(NAME_EDEFAULT); - return; - } - super.eUnset(featureID); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public boolean eIsSet(final int featureID) { - switch (featureID) { - case EfacetcatalogPackage.FACET_SET_CATALOG__INSTALLED_ENTRIES: - return installedEntries != null && !installedEntries.isEmpty(); - case EfacetcatalogPackage.FACET_SET_CATALOG__NAME: - return NAME_EDEFAULT == null ? name != null : !NAME_EDEFAULT.equals(name); - } - return super.eIsSet(featureID); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public String toString() { - if (eIsProxy()) return super.toString(); - - StringBuffer result = new StringBuffer(super.toString()); - result.append(" (name: "); //$NON-NLS-1$ - result.append(name); - result.append(')'); - return result.toString(); - } - -} //FacetSetCatalogImpl
diff --git a/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/emf/facet/efacet/metamodel/v0_2_0/efacetcatalog/util/EfacetcatalogAdapterFactory.java b/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/emf/facet/efacet/metamodel/v0_2_0/efacetcatalog/util/EfacetcatalogAdapterFactory.java deleted file mode 100644 index 8a5afdc..0000000 --- a/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/emf/facet/efacet/metamodel/v0_2_0/efacetcatalog/util/EfacetcatalogAdapterFactory.java +++ /dev/null
@@ -1,154 +0,0 @@ -/** - * Copyright (c) 2011,2012 Mia-Software. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Gregoire Dupe (Mia-Software) - Design - * Nicolas Guyomar (Mia-Software) - Implementation - * Emmanuelle Rouillé (Mia-Software) - Bug 352618 - To be able to use non-derived facet structural features and save their values. - * Nicolas Bros (Mia-Software) - Bug 370110 - Rename efacetcatalog2.ecore - * Grégoire Dupé (Mia-Software) - Bug 361817 - [Restructuring] Dynamic load to the facet catalog - * - */ -package org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacetcatalog.util; - -import org.eclipse.emf.common.notify.Adapter; -import org.eclipse.emf.common.notify.Notifier; - -import org.eclipse.emf.common.notify.impl.AdapterFactoryImpl; - -import org.eclipse.emf.ecore.EObject; - -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacetcatalog.*; - -import org.eclipse.emf.facet.util.emf.catalog.Catalog; - -/** - * <!-- begin-user-doc --> - * The <b>Adapter Factory</b> for the model. - * It provides an adapter <code>createXXX</code> method for each class of the model. - * <!-- end-user-doc --> - * @see org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacetcatalog.EfacetcatalogPackage - * @generated - */ -public class EfacetcatalogAdapterFactory extends AdapterFactoryImpl { - /** - * The cached model package. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected static EfacetcatalogPackage modelPackage; - - /** - * Creates an instance of the adapter factory. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EfacetcatalogAdapterFactory() { - if (modelPackage == null) { - modelPackage = EfacetcatalogPackage.eINSTANCE; - } - } - - /** - * Returns whether this factory is applicable for the type of the object. - * <!-- begin-user-doc --> - * This implementation returns <code>true</code> if the object is either the model's package or is an instance object of the model. - * <!-- end-user-doc --> - * @return whether this factory is applicable for the type of the object. - * @generated - */ - @Override - public boolean isFactoryForType(Object object) { - if (object == modelPackage) { - return true; - } - if (object instanceof EObject) { - return ((EObject)object).eClass().getEPackage() == modelPackage; - } - return false; - } - - /** - * The switch that delegates to the <code>createXXX</code> methods. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected EfacetcatalogSwitch<Adapter> modelSwitch = - new EfacetcatalogSwitch<Adapter>() { - @Override - public Adapter caseFacetSetCatalog(FacetSetCatalog object) { - return createFacetSetCatalogAdapter(); - } - @Override - public Adapter caseCatalog(Catalog object) { - return createCatalogAdapter(); - } - @Override - public Adapter defaultCase(EObject object) { - return createEObjectAdapter(); - } - }; - - /** - * Creates an adapter for the <code>target</code>. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @param target the object to adapt. - * @return the adapter for the <code>target</code>. - * @generated - */ - @Override - public Adapter createAdapter(Notifier target) { - return modelSwitch.doSwitch((EObject)target); - } - - - /** - * Creates a new adapter for an object of class '{@link org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacetcatalog.FacetSetCatalog <em>Facet Set Catalog</em>}'. - * <!-- begin-user-doc --> - * This default implementation returns null so that we can easily ignore cases; - * it's useful to ignore a case when inheritance will catch all the cases anyway. - * <!-- end-user-doc --> - * @return the new adapter. - * @see org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacetcatalog.FacetSetCatalog - * @generated - */ - public Adapter createFacetSetCatalogAdapter() { - return null; - } - - /** - * Creates a new adapter for an object of class '{@link org.eclipse.emf.facet.util.emf.catalog.Catalog <em>Catalog</em>}'. - * <!-- begin-user-doc --> - * This default implementation returns null so that we can easily ignore cases; - * it's useful to ignore a case when inheritance will catch all the cases anyway. - * <!-- end-user-doc --> - * @return the new adapter. - * @see org.eclipse.emf.facet.util.emf.catalog.Catalog - * @generated - */ - public Adapter createCatalogAdapter() { - return null; - } - - /** - * Creates a new adapter for the default case. - * <!-- begin-user-doc --> - * This default implementation returns null. - * <!-- end-user-doc --> - * @return the new adapter. - * @generated - */ - public Adapter createEObjectAdapter() { - return null; - } - -} //EfacetcatalogAdapterFactory
diff --git a/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/emf/facet/efacet/metamodel/v0_2_0/efacetcatalog/util/EfacetcatalogSwitch.java b/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/emf/facet/efacet/metamodel/v0_2_0/efacetcatalog/util/EfacetcatalogSwitch.java deleted file mode 100644 index d305496..0000000 --- a/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/emf/facet/efacet/metamodel/v0_2_0/efacetcatalog/util/EfacetcatalogSwitch.java +++ /dev/null
@@ -1,158 +0,0 @@ -/** - * Copyright (c) 2011,2012 Mia-Software. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Gregoire Dupe (Mia-Software) - Design - * Nicolas Guyomar (Mia-Software) - Implementation - * Emmanuelle Rouillé (Mia-Software) - Bug 352618 - To be able to use non-derived facet structural features and save their values. - * Nicolas Bros (Mia-Software) - Bug 370110 - Rename efacetcatalog2.ecore - * Grégoire Dupé (Mia-Software) - Bug 361817 - [Restructuring] Dynamic load to the facet catalog - * - */ -package org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacetcatalog.util; - -import java.util.List; - -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.ecore.EObject; - -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacetcatalog.*; - -import org.eclipse.emf.facet.util.emf.catalog.Catalog; - -/** - * <!-- begin-user-doc --> - * The <b>Switch</b> for the model's inheritance hierarchy. - * It supports the call {@link #doSwitch(EObject) doSwitch(object)} - * to invoke the <code>caseXXX</code> method for each class of the model, - * starting with the actual class of the object - * and proceeding up the inheritance hierarchy - * until a non-null result is returned, - * which is the result of the switch. - * <!-- end-user-doc --> - * @see org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacetcatalog.EfacetcatalogPackage - * @generated - */ -public class EfacetcatalogSwitch<T> { - /** - * The cached model package - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected static EfacetcatalogPackage modelPackage; - - /** - * Creates an instance of the switch. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EfacetcatalogSwitch() { - if (modelPackage == null) { - modelPackage = EfacetcatalogPackage.eINSTANCE; - } - } - - /** - * Calls <code>caseXXX</code> for each class of the model until one returns a non null result; it yields that result. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the first non-null result returned by a <code>caseXXX</code> call. - * @generated - */ - public T doSwitch(EObject theEObject) { - return doSwitch(theEObject.eClass(), theEObject); - } - - /** - * Calls <code>caseXXX</code> for each class of the model until one returns a non null result; it yields that result. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the first non-null result returned by a <code>caseXXX</code> call. - * @generated - */ - protected T doSwitch(EClass theEClass, EObject theEObject) { - if (theEClass.eContainer() == modelPackage) { - return doSwitch(theEClass.getClassifierID(), theEObject); - } - else { - List<EClass> eSuperTypes = theEClass.getESuperTypes(); - return - eSuperTypes.isEmpty() ? - defaultCase(theEObject) : - doSwitch(eSuperTypes.get(0), theEObject); - } - } - - /** - * Calls <code>caseXXX</code> for each class of the model until one returns a non null result; it yields that result. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the first non-null result returned by a <code>caseXXX</code> call. - * @generated - */ - protected T doSwitch(int classifierID, EObject theEObject) { - switch (classifierID) { - case EfacetcatalogPackage.FACET_SET_CATALOG: { - FacetSetCatalog facetSetCatalog = (FacetSetCatalog)theEObject; - T result = caseFacetSetCatalog(facetSetCatalog); - if (result == null) result = caseCatalog(facetSetCatalog); - if (result == null) result = defaultCase(theEObject); - return result; - } - default: return defaultCase(theEObject); - } - } - - /** - * Returns the result of interpreting the object as an instance of '<em>Facet Set Catalog</em>'. - * <!-- begin-user-doc --> - * This implementation returns null; - * returning a non-null result will terminate the switch. - * <!-- end-user-doc --> - * @param object the target of the switch. - * @return the result of interpreting the object as an instance of '<em>Facet Set Catalog</em>'. - * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) - * @generated - */ - public T caseFacetSetCatalog(FacetSetCatalog object) { - return null; - } - - /** - * Returns the result of interpreting the object as an instance of '<em>Catalog</em>'. - * <!-- begin-user-doc --> - * This implementation returns null; - * returning a non-null result will terminate the switch. - * <!-- end-user-doc --> - * @param object the target of the switch. - * @return the result of interpreting the object as an instance of '<em>Catalog</em>'. - * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) - * @generated - */ - public T caseCatalog(Catalog object) { - return null; - } - - /** - * Returns the result of interpreting the object as an instance of '<em>EObject</em>'. - * <!-- begin-user-doc --> - * This implementation returns null; - * returning a non-null result will terminate the switch, but this is the last case anyway. - * <!-- end-user-doc --> - * @param object the target of the switch. - * @return the result of interpreting the object as an instance of '<em>EObject</em>'. - * @see #doSwitch(org.eclipse.emf.ecore.EObject) - * @generated - */ - public T defaultCase(EObject object) { - return null; - } - -} //EfacetcatalogSwitch
diff --git a/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/modisco/facet/efacet/metamodel/v0_2_0/efacet/Category.java b/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/modisco/facet/efacet/metamodel/v0_2_0/efacet/Category.java new file mode 100644 index 0000000..65c3a76 --- /dev/null +++ b/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/modisco/facet/efacet/metamodel/v0_2_0/efacet/Category.java
@@ -0,0 +1,34 @@ +/** + * Copyright (c) 2011 Mia-Software. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Gregoire Dupe (Mia-Software) - Design + * Nicolas Guyomar (Mia-Software) - Implementation + * Emmanuelle Rouillé (Mia-Software) - Bug 352618 - To be able to use non derived facet structural features and save them values. + * Nicolas Bros (Mia-Software) - Bug 361823 - [Restructuring] eFacet2 meta-model + */ +package org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet; + +import org.eclipse.emf.ecore.ENamedElement; + +/** + * <!-- begin-user-doc --> + * A representation of the model object '<em><b>Category</b></em>'. + * <!-- end-user-doc --> + * + * <!-- begin-model-doc --> + * A Category is used to group related elements. + * <!-- end-model-doc --> + * + * + * @see org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.EFacetPackage#getCategory() + * @model + * @generated + */ +public interface Category extends ENamedElement, DocumentedElement { +} // Category
diff --git a/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/modisco/facet/efacet/metamodel/v0_2_0/efacet/DerivedTypedElement.java b/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/modisco/facet/efacet/metamodel/v0_2_0/efacet/DerivedTypedElement.java new file mode 100644 index 0000000..37feb56 --- /dev/null +++ b/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/modisco/facet/efacet/metamodel/v0_2_0/efacet/DerivedTypedElement.java
@@ -0,0 +1,103 @@ +/** + * Copyright (c) 2011, 2015 Mia-Software, and Soft-Maint. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Gregoire Dupe (Mia-Software) - Design + * Nicolas Guyomar (Mia-Software) - Implementation + * Emmanuelle Rouillé (Mia-Software) - Bug 352618 - To be able to use non derived facet structural features and save them values. + * Nicolas Bros (Mia-Software) - Bug 361823 - [Restructuring] eFacet2 meta-model + * Gregoire Dupe (Mia-Software) - Bug 366055 - NavigationQuery + * Gregoire Dupe (Mia-Software) - Bug 369673 - [Facet] IsOneOfQuery + * Olivier Remaud (Soft-Maint) - Bug 369824 - Add a simple way to return string literal constants from a customization query + * Gregoire Dupe (Mia-Software) - Bug 369987 - [Restructuring][Table] Switch to the new customization and facet framework + * Gregoire Dupe (Mia-software) - Bug 364325 - [Restructuring] The user must be able to navigate into a model using the Facet. + * Nicolas Bros (Mia-Software) - Bug 372626 - [Facet] Aggregates + * Nicolas Bros (Mia-Software) - Bug 376941 - [EFacet] Facet operation arguments in Facet model + * Gregoire Dupe (Mia-Software) - Bug 376576 - [EFacet] Change the multiplicity of Facet::extendedFacet + * Jonathan Pepin (Soft-Maint) - Bug 463898 - Create FacetReference not derived, without query and with opposite mechanism + */ +package org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet; + +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.extensible.Query; + +/** + * <!-- begin-user-doc --> + * A representation of the model object '<em><b>Derived Typed Element</b></em>'. + * <!-- end-user-doc --> + * + * <!-- begin-model-doc --> + * A derivable typed element is a structural feature that the value can be computed by using a query. + * + * NB: DerivedTypeElement must be named "DerivableTypeElement". Old definition: A derived typed element is a virtual structural feature the value of which is computed using a query. + * <!-- end-model-doc --> + * + * <p> + * The following features are supported: + * <ul> + * <li>{@link org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.DerivedTypedElement#getQuery <em>Query</em>}</li> + * <li>{@link org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.DerivedTypedElement#getOverride <em>Override</em>}</li> + * </ul> + * </p> + * + * @see org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.EFacetPackage#getDerivedTypedElement() + * @model abstract="true" + * @generated + */ +public interface DerivedTypedElement extends FacetElement { + /** + * Returns the value of the '<em><b>Query</b></em>' containment reference. + * <!-- begin-user-doc --> + * <p> + * If the meaning of the '<em>Query</em>' containment reference isn't clear, + * there really should be more of a description here... + * </p> + * <!-- end-user-doc --> + * @return the value of the '<em>Query</em>' containment reference. + * @see #setQuery(Query) + * @see org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.EFacetPackage#getDerivedTypedElement_Query() + * @model containment="true" + * @generated + */ + Query getQuery(); + + /** + * Sets the value of the '{@link org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.DerivedTypedElement#getQuery <em>Query</em>}' containment reference. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @param value the new value of the '<em>Query</em>' containment reference. + * @see #getQuery() + * @generated + */ + void setQuery(Query value); + + /** + * Returns the value of the '<em><b>Override</b></em>' reference. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * <!-- begin-model-doc --> + * If it exists a facet A which extends a facet B then a derived typed element of A can override a typed element of B; if the both typed elements have the same name, same multiplicity, and same type. + * <!-- end-model-doc --> + * @return the value of the '<em>Override</em>' reference. + * @see #setOverride(DerivedTypedElement) + * @see org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.EFacetPackage#getDerivedTypedElement_Override() + * @model + * @generated + */ + DerivedTypedElement getOverride(); + + /** + * Sets the value of the '{@link org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.DerivedTypedElement#getOverride <em>Override</em>}' reference. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @param value the new value of the '<em>Override</em>' reference. + * @see #getOverride() + * @generated + */ + void setOverride(DerivedTypedElement value); + +} // DerivedTypedElement
diff --git a/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/modisco/facet/efacet/metamodel/v0_2_0/efacet/DocumentedElement.java b/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/modisco/facet/efacet/metamodel/v0_2_0/efacet/DocumentedElement.java new file mode 100644 index 0000000..ed6c4a9 --- /dev/null +++ b/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/modisco/facet/efacet/metamodel/v0_2_0/efacet/DocumentedElement.java
@@ -0,0 +1,62 @@ +/** + * Copyright (c) 2011 Mia-Software. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Gregoire Dupe (Mia-Software) - Design + * Nicolas Guyomar (Mia-Software) - Implementation + * Emmanuelle Rouillé (Mia-Software) - Bug 352618 - To be able to use non derived facet structural features and save them values. + * Nicolas Bros (Mia-Software) - Bug 361823 - [Restructuring] eFacet2 meta-model + */ +package org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet; + +import org.eclipse.emf.ecore.EObject; + +/** + * <!-- begin-user-doc --> + * A representation of the model object '<em><b>Documented Element</b></em>'. + * <!-- end-user-doc --> + * + * <p> + * The following features are supported: + * <ul> + * <li>{@link org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.DocumentedElement#getDocumentation <em>Documentation</em>}</li> + * </ul> + * </p> + * + * @see org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.EFacetPackage#getDocumentedElement() + * @model + * @generated + */ +public interface DocumentedElement extends EObject { + /** + * Returns the value of the '<em><b>Documentation</b></em>' attribute. + * <!-- begin-user-doc --> + * <p> + * If the meaning of the '<em>Documentation</em>' attribute isn't clear, + * there really should be more of a description here... + * </p> + * <!-- end-user-doc --> + * @return the value of the '<em>Documentation</em>' attribute. + * @see #setDocumentation(String) + * @see org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.EFacetPackage#getDocumentedElement_Documentation() + * @model + * @generated + */ + String getDocumentation(); + + /** + * Sets the value of the '{@link org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.DocumentedElement#getDocumentation <em>Documentation</em>}' attribute. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @param value the new value of the '<em>Documentation</em>' attribute. + * @see #getDocumentation() + * @generated + */ + void setDocumentation(String value); + +} // DocumentedElement
diff --git a/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/modisco/facet/efacet/metamodel/v0_2_0/efacet/EFacetFactory.java b/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/modisco/facet/efacet/metamodel/v0_2_0/efacet/EFacetFactory.java new file mode 100644 index 0000000..940ff75 --- /dev/null +++ b/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/modisco/facet/efacet/metamodel/v0_2_0/efacet/EFacetFactory.java
@@ -0,0 +1,119 @@ +/** + * Copyright (c) 2011, 2012 Mia-Software. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Gregoire Dupe (Mia-Software) - Design + * Nicolas Guyomar (Mia-Software) - Implementation + * Emmanuelle Rouillé (Mia-Software) - Bug 352618 - To be able to use non derived facet structural features and save them values. + * Nicolas Bros (Mia-Software) - Bug 361823 - [Restructuring] eFacet2 meta-model + * Gregoire Dupe (Mia-Software) - Bug 364325 - [Restructuring] The user must be able to navigate into a model using the Facet. + * Gregoire Dupe (Mia-Software) - Bug 373078 - API Cleaning + */ +package org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet; + +import org.eclipse.emf.ecore.EFactory; + +/** + * <!-- begin-user-doc --> + * The <b>Factory</b> for the model. + * It provides a create method for each non-abstract class of the model. + * <!-- end-user-doc --> + * @see org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.EFacetPackage + * @generated + */ +public interface EFacetFactory extends EFactory { + /** + * The singleton instance of the factory. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + EFacetFactory eINSTANCE = org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.impl.EFacetFactoryImpl.init(); + + /** + * Returns a new object of class '<em>Facet Attribute</em>'. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @return a new object of class '<em>Facet Attribute</em>'. + * @generated + */ + FacetAttribute createFacetAttribute(); + + /** + * Returns a new object of class '<em>Facet Reference</em>'. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @return a new object of class '<em>Facet Reference</em>'. + * @generated + */ + FacetReference createFacetReference(); + + /** + * Returns a new object of class '<em>Facet Operation</em>'. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @return a new object of class '<em>Facet Operation</em>'. + * @generated + */ + FacetOperation createFacetOperation(); + + /** + * Returns a new object of class '<em>Facet Set</em>'. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @return a new object of class '<em>Facet Set</em>'. + * @generated + */ + FacetSet createFacetSet(); + + /** + * Returns a new object of class '<em>Facet</em>'. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @return a new object of class '<em>Facet</em>'. + * @generated + */ + Facet createFacet(); + + /** + * Returns a new object of class '<em>Category</em>'. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @return a new object of class '<em>Category</em>'. + * @generated + */ + Category createCategory(); + + /** + * Returns a new object of class '<em>Parameter Value</em>'. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @return a new object of class '<em>Parameter Value</em>'. + * @generated + */ + ParameterValue createParameterValue(); + + /** + * Returns a new object of class '<em>Documented Element</em>'. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @return a new object of class '<em>Documented Element</em>'. + * @generated + */ + DocumentedElement createDocumentedElement(); + + /** + * Returns the package supported by this factory. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @return the package supported by this factory. + * @generated + */ + EFacetPackage getEFacetPackage(); + +} //EFacetFactory
diff --git a/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/modisco/facet/efacet/metamodel/v0_2_0/efacet/EFacetPackage.java b/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/modisco/facet/efacet/metamodel/v0_2_0/efacet/EFacetPackage.java new file mode 100644 index 0000000..b1ab161 --- /dev/null +++ b/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/modisco/facet/efacet/metamodel/v0_2_0/efacet/EFacetPackage.java
@@ -0,0 +1,1933 @@ +/** + * Copyright (c) 2011, 2015 Mia-Software, and Soft-Maint. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Gregoire Dupe (Mia-Software) - Design + * Nicolas Guyomar (Mia-Software) - Implementation + * Emmanuelle Rouillé (Mia-Software) - Bug 352618 - To be able to use non derived facet structural features and save them values. + * Nicolas Bros (Mia-Software) - Bug 361823 - [Restructuring] eFacet2 meta-model + * Gregoire Dupe (Mia-Software) - Bug 366055 - NavigationQuery + * Gregoire Dupe (Mia-Software) - Bug 369673 - [Facet] IsOneOfQuery + * Olivier Remaud (Soft-Maint) - Bug 369824 - Add a simple way to return string literal constants from a customization query + * Gregoire Dupe (Mia-Software) - Bug 369987 - [Restructuring][Table] Switch to the new customization and facet framework + * Gregoire Dupe (Mia-software) - Bug 364325 - [Restructuring] The user must be able to navigate into a model using the Facet. + * Nicolas Bros (Mia-Software) - Bug 372626 - [Facet] Aggregates + * Nicolas Bros (Mia-Software) - Bug 376941 - [EFacet] Facet operation arguments in Facet model + * Gregoire Dupe (Mia-Software) - Bug 376576 - [EFacet] Change the multiplicity of Facet::extendedFacet + * Jonathan Pepin (Soft-Maint) - Bug 463898 - Create FacetReference not derived, without query and with opposite mechanism + */ +package org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet; + +import org.eclipse.emf.ecore.EAttribute; +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.EDataType; +import org.eclipse.emf.ecore.EPackage; +import org.eclipse.emf.ecore.EReference; +import org.eclipse.emf.ecore.EcorePackage; + +/** + * <!-- begin-user-doc --> + * The <b>Package</b> for the model. + * It contains accessors for the meta objects to represent + * <ul> + * <li>each class,</li> + * <li>each feature of each class,</li> + * <li>each enum,</li> + * <li>and each data type</li> + * </ul> + * <!-- end-user-doc --> + * @see org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.EFacetFactory + * @model kind="package" + * annotation="http://www.eclipse.org/emf/2002/Ecore validationDelegates='org.eclipse.ocl.ecore.OCL'" + * @generated + */ +public interface EFacetPackage extends EPackage { + /** + * The package name. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + String eNAME = "efacet"; //$NON-NLS-1$ + + /** + * The package namespace URI. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + String eNS_URI = "http://www.eclipse.org/emf/facet/efacet/0.2.incubation/efacet"; //$NON-NLS-1$ + + /** + * The package namespace name. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + String eNS_PREFIX = "efacet"; //$NON-NLS-1$ + + /** + * The singleton instance of the package. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + EFacetPackage eINSTANCE = org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.impl.EFacetPackageImpl.init(); + + /** + * The meta object id for the '{@link org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.impl.FacetAttributeImpl <em>Facet Attribute</em>}' class. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @see org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.impl.FacetAttributeImpl + * @see org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.impl.EFacetPackageImpl#getFacetAttribute() + * @generated + */ + int FACET_ATTRIBUTE = 0; + + /** + * The feature id for the '<em><b>EAnnotations</b></em>' containment reference list. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + */ + int FACET_ATTRIBUTE__EANNOTATIONS = EcorePackage.EATTRIBUTE__EANNOTATIONS; + + /** + * The feature id for the '<em><b>Name</b></em>' attribute. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + */ + int FACET_ATTRIBUTE__NAME = EcorePackage.EATTRIBUTE__NAME; + + /** + * The feature id for the '<em><b>Ordered</b></em>' attribute. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + */ + int FACET_ATTRIBUTE__ORDERED = EcorePackage.EATTRIBUTE__ORDERED; + + /** + * The feature id for the '<em><b>Unique</b></em>' attribute. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + */ + int FACET_ATTRIBUTE__UNIQUE = EcorePackage.EATTRIBUTE__UNIQUE; + + /** + * The feature id for the '<em><b>Lower Bound</b></em>' attribute. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + */ + int FACET_ATTRIBUTE__LOWER_BOUND = EcorePackage.EATTRIBUTE__LOWER_BOUND; + + /** + * The feature id for the '<em><b>Upper Bound</b></em>' attribute. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + */ + int FACET_ATTRIBUTE__UPPER_BOUND = EcorePackage.EATTRIBUTE__UPPER_BOUND; + + /** + * The feature id for the '<em><b>Many</b></em>' attribute. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + */ + int FACET_ATTRIBUTE__MANY = EcorePackage.EATTRIBUTE__MANY; + + /** + * The feature id for the '<em><b>Required</b></em>' attribute. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + */ + int FACET_ATTRIBUTE__REQUIRED = EcorePackage.EATTRIBUTE__REQUIRED; + + /** + * The feature id for the '<em><b>EType</b></em>' reference. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + */ + int FACET_ATTRIBUTE__ETYPE = EcorePackage.EATTRIBUTE__ETYPE; + + /** + * The feature id for the '<em><b>EGeneric Type</b></em>' containment reference. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + */ + int FACET_ATTRIBUTE__EGENERIC_TYPE = EcorePackage.EATTRIBUTE__EGENERIC_TYPE; + + /** + * The feature id for the '<em><b>Changeable</b></em>' attribute. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + */ + int FACET_ATTRIBUTE__CHANGEABLE = EcorePackage.EATTRIBUTE__CHANGEABLE; + + /** + * The feature id for the '<em><b>Volatile</b></em>' attribute. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + */ + int FACET_ATTRIBUTE__VOLATILE = EcorePackage.EATTRIBUTE__VOLATILE; + + /** + * The feature id for the '<em><b>Transient</b></em>' attribute. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + */ + int FACET_ATTRIBUTE__TRANSIENT = EcorePackage.EATTRIBUTE__TRANSIENT; + + /** + * The feature id for the '<em><b>Default Value Literal</b></em>' attribute. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + */ + int FACET_ATTRIBUTE__DEFAULT_VALUE_LITERAL = EcorePackage.EATTRIBUTE__DEFAULT_VALUE_LITERAL; + + /** + * The feature id for the '<em><b>Default Value</b></em>' attribute. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + */ + int FACET_ATTRIBUTE__DEFAULT_VALUE = EcorePackage.EATTRIBUTE__DEFAULT_VALUE; + + /** + * The feature id for the '<em><b>Unsettable</b></em>' attribute. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + */ + int FACET_ATTRIBUTE__UNSETTABLE = EcorePackage.EATTRIBUTE__UNSETTABLE; + + /** + * The feature id for the '<em><b>Derived</b></em>' attribute. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + */ + int FACET_ATTRIBUTE__DERIVED = EcorePackage.EATTRIBUTE__DERIVED; + + /** + * The feature id for the '<em><b>EContaining Class</b></em>' container reference. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + */ + int FACET_ATTRIBUTE__ECONTAINING_CLASS = EcorePackage.EATTRIBUTE__ECONTAINING_CLASS; + + /** + * The feature id for the '<em><b>ID</b></em>' attribute. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + */ + int FACET_ATTRIBUTE__ID = EcorePackage.EATTRIBUTE__ID; + + /** + * The feature id for the '<em><b>EAttribute Type</b></em>' reference. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + */ + int FACET_ATTRIBUTE__EATTRIBUTE_TYPE = EcorePackage.EATTRIBUTE__EATTRIBUTE_TYPE; + + /** + * The feature id for the '<em><b>Documentation</b></em>' attribute. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + */ + int FACET_ATTRIBUTE__DOCUMENTATION = EcorePackage.EATTRIBUTE_FEATURE_COUNT + 0; + + /** + * The feature id for the '<em><b>Categories</b></em>' reference list. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + */ + int FACET_ATTRIBUTE__CATEGORIES = EcorePackage.EATTRIBUTE_FEATURE_COUNT + 1; + + /** + * The feature id for the '<em><b>Query</b></em>' containment reference. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + */ + int FACET_ATTRIBUTE__QUERY = EcorePackage.EATTRIBUTE_FEATURE_COUNT + 2; + + /** + * The feature id for the '<em><b>Override</b></em>' reference. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + */ + int FACET_ATTRIBUTE__OVERRIDE = EcorePackage.EATTRIBUTE_FEATURE_COUNT + 3; + + /** + * The number of structural features of the '<em>Facet Attribute</em>' class. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + */ + int FACET_ATTRIBUTE_FEATURE_COUNT = EcorePackage.EATTRIBUTE_FEATURE_COUNT + 4; + + /** + * The meta object id for the '{@link org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.impl.FacetReferenceImpl <em>Facet Reference</em>}' class. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @see org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.impl.FacetReferenceImpl + * @see org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.impl.EFacetPackageImpl#getFacetReference() + * @generated + */ + int FACET_REFERENCE = 1; + + /** + * The feature id for the '<em><b>EAnnotations</b></em>' containment reference list. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + */ + int FACET_REFERENCE__EANNOTATIONS = EcorePackage.EREFERENCE__EANNOTATIONS; + + /** + * The feature id for the '<em><b>Name</b></em>' attribute. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + */ + int FACET_REFERENCE__NAME = EcorePackage.EREFERENCE__NAME; + + /** + * The feature id for the '<em><b>Ordered</b></em>' attribute. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + */ + int FACET_REFERENCE__ORDERED = EcorePackage.EREFERENCE__ORDERED; + + /** + * The feature id for the '<em><b>Unique</b></em>' attribute. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + */ + int FACET_REFERENCE__UNIQUE = EcorePackage.EREFERENCE__UNIQUE; + + /** + * The feature id for the '<em><b>Lower Bound</b></em>' attribute. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + */ + int FACET_REFERENCE__LOWER_BOUND = EcorePackage.EREFERENCE__LOWER_BOUND; + + /** + * The feature id for the '<em><b>Upper Bound</b></em>' attribute. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + */ + int FACET_REFERENCE__UPPER_BOUND = EcorePackage.EREFERENCE__UPPER_BOUND; + + /** + * The feature id for the '<em><b>Many</b></em>' attribute. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + */ + int FACET_REFERENCE__MANY = EcorePackage.EREFERENCE__MANY; + + /** + * The feature id for the '<em><b>Required</b></em>' attribute. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + */ + int FACET_REFERENCE__REQUIRED = EcorePackage.EREFERENCE__REQUIRED; + + /** + * The feature id for the '<em><b>EType</b></em>' reference. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + */ + int FACET_REFERENCE__ETYPE = EcorePackage.EREFERENCE__ETYPE; + + /** + * The feature id for the '<em><b>EGeneric Type</b></em>' containment reference. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + */ + int FACET_REFERENCE__EGENERIC_TYPE = EcorePackage.EREFERENCE__EGENERIC_TYPE; + + /** + * The feature id for the '<em><b>Changeable</b></em>' attribute. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + */ + int FACET_REFERENCE__CHANGEABLE = EcorePackage.EREFERENCE__CHANGEABLE; + + /** + * The feature id for the '<em><b>Volatile</b></em>' attribute. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + */ + int FACET_REFERENCE__VOLATILE = EcorePackage.EREFERENCE__VOLATILE; + + /** + * The feature id for the '<em><b>Transient</b></em>' attribute. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + */ + int FACET_REFERENCE__TRANSIENT = EcorePackage.EREFERENCE__TRANSIENT; + + /** + * The feature id for the '<em><b>Default Value Literal</b></em>' attribute. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + */ + int FACET_REFERENCE__DEFAULT_VALUE_LITERAL = EcorePackage.EREFERENCE__DEFAULT_VALUE_LITERAL; + + /** + * The feature id for the '<em><b>Default Value</b></em>' attribute. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + */ + int FACET_REFERENCE__DEFAULT_VALUE = EcorePackage.EREFERENCE__DEFAULT_VALUE; + + /** + * The feature id for the '<em><b>Unsettable</b></em>' attribute. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + */ + int FACET_REFERENCE__UNSETTABLE = EcorePackage.EREFERENCE__UNSETTABLE; + + /** + * The feature id for the '<em><b>Derived</b></em>' attribute. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + */ + int FACET_REFERENCE__DERIVED = EcorePackage.EREFERENCE__DERIVED; + + /** + * The feature id for the '<em><b>EContaining Class</b></em>' container reference. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + */ + int FACET_REFERENCE__ECONTAINING_CLASS = EcorePackage.EREFERENCE__ECONTAINING_CLASS; + + /** + * The feature id for the '<em><b>Containment</b></em>' attribute. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + */ + int FACET_REFERENCE__CONTAINMENT = EcorePackage.EREFERENCE__CONTAINMENT; + + /** + * The feature id for the '<em><b>Container</b></em>' attribute. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + */ + int FACET_REFERENCE__CONTAINER = EcorePackage.EREFERENCE__CONTAINER; + + /** + * The feature id for the '<em><b>Resolve Proxies</b></em>' attribute. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + */ + int FACET_REFERENCE__RESOLVE_PROXIES = EcorePackage.EREFERENCE__RESOLVE_PROXIES; + + /** + * The feature id for the '<em><b>EOpposite</b></em>' reference. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + */ + int FACET_REFERENCE__EOPPOSITE = EcorePackage.EREFERENCE__EOPPOSITE; + + /** + * The feature id for the '<em><b>EReference Type</b></em>' reference. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + */ + int FACET_REFERENCE__EREFERENCE_TYPE = EcorePackage.EREFERENCE__EREFERENCE_TYPE; + + /** + * The feature id for the '<em><b>EKeys</b></em>' reference list. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + */ + int FACET_REFERENCE__EKEYS = EcorePackage.EREFERENCE__EKEYS; + + /** + * The feature id for the '<em><b>Documentation</b></em>' attribute. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + */ + int FACET_REFERENCE__DOCUMENTATION = EcorePackage.EREFERENCE_FEATURE_COUNT + 0; + + /** + * The feature id for the '<em><b>Categories</b></em>' reference list. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + */ + int FACET_REFERENCE__CATEGORIES = EcorePackage.EREFERENCE_FEATURE_COUNT + 1; + + /** + * The feature id for the '<em><b>Query</b></em>' containment reference. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + */ + int FACET_REFERENCE__QUERY = EcorePackage.EREFERENCE_FEATURE_COUNT + 2; + + /** + * The feature id for the '<em><b>Override</b></em>' reference. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + */ + int FACET_REFERENCE__OVERRIDE = EcorePackage.EREFERENCE_FEATURE_COUNT + 3; + + /** + * The feature id for the '<em><b>FOpposite</b></em>' reference. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + * @since 1.0 + */ + int FACET_REFERENCE__FOPPOSITE = EcorePackage.EREFERENCE_FEATURE_COUNT + 4; + + /** + * The number of structural features of the '<em>Facet Reference</em>' class. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + */ + int FACET_REFERENCE_FEATURE_COUNT = EcorePackage.EREFERENCE_FEATURE_COUNT + 5; + + /** + * The meta object id for the '{@link org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.impl.FacetOperationImpl <em>Facet Operation</em>}' class. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @see org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.impl.FacetOperationImpl + * @see org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.impl.EFacetPackageImpl#getFacetOperation() + * @generated + */ + int FACET_OPERATION = 2; + + /** + * The feature id for the '<em><b>EAnnotations</b></em>' containment reference list. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + */ + int FACET_OPERATION__EANNOTATIONS = EcorePackage.EOPERATION__EANNOTATIONS; + + /** + * The feature id for the '<em><b>Name</b></em>' attribute. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + */ + int FACET_OPERATION__NAME = EcorePackage.EOPERATION__NAME; + + /** + * The feature id for the '<em><b>Ordered</b></em>' attribute. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + */ + int FACET_OPERATION__ORDERED = EcorePackage.EOPERATION__ORDERED; + + /** + * The feature id for the '<em><b>Unique</b></em>' attribute. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + */ + int FACET_OPERATION__UNIQUE = EcorePackage.EOPERATION__UNIQUE; + + /** + * The feature id for the '<em><b>Lower Bound</b></em>' attribute. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + */ + int FACET_OPERATION__LOWER_BOUND = EcorePackage.EOPERATION__LOWER_BOUND; + + /** + * The feature id for the '<em><b>Upper Bound</b></em>' attribute. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + */ + int FACET_OPERATION__UPPER_BOUND = EcorePackage.EOPERATION__UPPER_BOUND; + + /** + * The feature id for the '<em><b>Many</b></em>' attribute. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + */ + int FACET_OPERATION__MANY = EcorePackage.EOPERATION__MANY; + + /** + * The feature id for the '<em><b>Required</b></em>' attribute. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + */ + int FACET_OPERATION__REQUIRED = EcorePackage.EOPERATION__REQUIRED; + + /** + * The feature id for the '<em><b>EType</b></em>' reference. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + */ + int FACET_OPERATION__ETYPE = EcorePackage.EOPERATION__ETYPE; + + /** + * The feature id for the '<em><b>EGeneric Type</b></em>' containment reference. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + */ + int FACET_OPERATION__EGENERIC_TYPE = EcorePackage.EOPERATION__EGENERIC_TYPE; + + /** + * The feature id for the '<em><b>EContaining Class</b></em>' container reference. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + */ + int FACET_OPERATION__ECONTAINING_CLASS = EcorePackage.EOPERATION__ECONTAINING_CLASS; + + /** + * The feature id for the '<em><b>EType Parameters</b></em>' containment reference list. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + */ + int FACET_OPERATION__ETYPE_PARAMETERS = EcorePackage.EOPERATION__ETYPE_PARAMETERS; + + /** + * The feature id for the '<em><b>EParameters</b></em>' containment reference list. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + */ + int FACET_OPERATION__EPARAMETERS = EcorePackage.EOPERATION__EPARAMETERS; + + /** + * The feature id for the '<em><b>EExceptions</b></em>' reference list. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + */ + int FACET_OPERATION__EEXCEPTIONS = EcorePackage.EOPERATION__EEXCEPTIONS; + + /** + * The feature id for the '<em><b>EGeneric Exceptions</b></em>' containment reference list. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + */ + int FACET_OPERATION__EGENERIC_EXCEPTIONS = EcorePackage.EOPERATION__EGENERIC_EXCEPTIONS; + + /** + * The feature id for the '<em><b>Documentation</b></em>' attribute. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + */ + int FACET_OPERATION__DOCUMENTATION = EcorePackage.EOPERATION_FEATURE_COUNT + 0; + + /** + * The feature id for the '<em><b>Categories</b></em>' reference list. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + */ + int FACET_OPERATION__CATEGORIES = EcorePackage.EOPERATION_FEATURE_COUNT + 1; + + /** + * The feature id for the '<em><b>Query</b></em>' containment reference. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + */ + int FACET_OPERATION__QUERY = EcorePackage.EOPERATION_FEATURE_COUNT + 2; + + /** + * The feature id for the '<em><b>Override</b></em>' reference. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + */ + int FACET_OPERATION__OVERRIDE = EcorePackage.EOPERATION_FEATURE_COUNT + 3; + + /** + * The number of structural features of the '<em>Facet Operation</em>' class. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + */ + int FACET_OPERATION_FEATURE_COUNT = EcorePackage.EOPERATION_FEATURE_COUNT + 4; + + /** + * The meta object id for the '{@link org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.impl.FacetSetImpl <em>Facet Set</em>}' class. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @see org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.impl.FacetSetImpl + * @see org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.impl.EFacetPackageImpl#getFacetSet() + * @generated + */ + int FACET_SET = 3; + + /** + * The feature id for the '<em><b>EAnnotations</b></em>' containment reference list. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + */ + int FACET_SET__EANNOTATIONS = EcorePackage.EPACKAGE__EANNOTATIONS; + + /** + * The feature id for the '<em><b>Name</b></em>' attribute. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + */ + int FACET_SET__NAME = EcorePackage.EPACKAGE__NAME; + + /** + * The feature id for the '<em><b>Ns URI</b></em>' attribute. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + */ + int FACET_SET__NS_URI = EcorePackage.EPACKAGE__NS_URI; + + /** + * The feature id for the '<em><b>Ns Prefix</b></em>' attribute. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + */ + int FACET_SET__NS_PREFIX = EcorePackage.EPACKAGE__NS_PREFIX; + + /** + * The feature id for the '<em><b>EFactory Instance</b></em>' reference. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + */ + int FACET_SET__EFACTORY_INSTANCE = EcorePackage.EPACKAGE__EFACTORY_INSTANCE; + + /** + * The feature id for the '<em><b>EClassifiers</b></em>' containment reference list. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + */ + int FACET_SET__ECLASSIFIERS = EcorePackage.EPACKAGE__ECLASSIFIERS; + + /** + * The feature id for the '<em><b>ESubpackages</b></em>' containment reference list. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + */ + int FACET_SET__ESUBPACKAGES = EcorePackage.EPACKAGE__ESUBPACKAGES; + + /** + * The feature id for the '<em><b>ESuper Package</b></em>' container reference. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + */ + int FACET_SET__ESUPER_PACKAGE = EcorePackage.EPACKAGE__ESUPER_PACKAGE; + + /** + * The feature id for the '<em><b>Documentation</b></em>' attribute. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + */ + int FACET_SET__DOCUMENTATION = EcorePackage.EPACKAGE_FEATURE_COUNT + 0; + + /** + * The feature id for the '<em><b>Categories</b></em>' containment reference list. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + */ + int FACET_SET__CATEGORIES = EcorePackage.EPACKAGE_FEATURE_COUNT + 1; + + /** + * The number of structural features of the '<em>Facet Set</em>' class. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + */ + int FACET_SET_FEATURE_COUNT = EcorePackage.EPACKAGE_FEATURE_COUNT + 2; + + /** + * The meta object id for the '{@link org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.impl.FacetImpl <em>Facet</em>}' class. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @see org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.impl.FacetImpl + * @see org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.impl.EFacetPackageImpl#getFacet() + * @generated + */ + int FACET = 4; + + /** + * The feature id for the '<em><b>EAnnotations</b></em>' containment reference list. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + */ + int FACET__EANNOTATIONS = EcorePackage.ECLASSIFIER__EANNOTATIONS; + + /** + * The feature id for the '<em><b>Name</b></em>' attribute. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + */ + int FACET__NAME = EcorePackage.ECLASSIFIER__NAME; + + /** + * The feature id for the '<em><b>Instance Class Name</b></em>' attribute. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + */ + int FACET__INSTANCE_CLASS_NAME = EcorePackage.ECLASSIFIER__INSTANCE_CLASS_NAME; + + /** + * The feature id for the '<em><b>Instance Class</b></em>' attribute. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + */ + int FACET__INSTANCE_CLASS = EcorePackage.ECLASSIFIER__INSTANCE_CLASS; + + /** + * The feature id for the '<em><b>Default Value</b></em>' attribute. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + */ + int FACET__DEFAULT_VALUE = EcorePackage.ECLASSIFIER__DEFAULT_VALUE; + + /** + * The feature id for the '<em><b>Instance Type Name</b></em>' attribute. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + */ + int FACET__INSTANCE_TYPE_NAME = EcorePackage.ECLASSIFIER__INSTANCE_TYPE_NAME; + + /** + * The feature id for the '<em><b>EPackage</b></em>' container reference. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + */ + int FACET__EPACKAGE = EcorePackage.ECLASSIFIER__EPACKAGE; + + /** + * The feature id for the '<em><b>EType Parameters</b></em>' containment reference list. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + */ + int FACET__ETYPE_PARAMETERS = EcorePackage.ECLASSIFIER__ETYPE_PARAMETERS; + + /** + * The feature id for the '<em><b>Documentation</b></em>' attribute. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + */ + int FACET__DOCUMENTATION = EcorePackage.ECLASSIFIER_FEATURE_COUNT + 0; + + /** + * The feature id for the '<em><b>Extended Metaclass</b></em>' reference. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + */ + int FACET__EXTENDED_METACLASS = EcorePackage.ECLASSIFIER_FEATURE_COUNT + 1; + + /** + * The feature id for the '<em><b>Facet Elements</b></em>' containment reference list. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + */ + int FACET__FACET_ELEMENTS = EcorePackage.ECLASSIFIER_FEATURE_COUNT + 2; + + /** + * The feature id for the '<em><b>Facet Operations</b></em>' containment reference list. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + */ + int FACET__FACET_OPERATIONS = EcorePackage.ECLASSIFIER_FEATURE_COUNT + 3; + + /** + * The feature id for the '<em><b>Conformance Typed Element</b></em>' reference. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + */ + int FACET__CONFORMANCE_TYPED_ELEMENT = EcorePackage.ECLASSIFIER_FEATURE_COUNT + 4; + + /** + * The feature id for the '<em><b>Extended Facets</b></em>' reference list. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + * @since 0.2 + */ + int FACET__EXTENDED_FACETS = EcorePackage.ECLASSIFIER_FEATURE_COUNT + 5; + + /** + * The number of structural features of the '<em>Facet</em>' class. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + */ + int FACET_FEATURE_COUNT = EcorePackage.ECLASSIFIER_FEATURE_COUNT + 6; + + /** + * The meta object id for the '{@link org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.impl.CategoryImpl <em>Category</em>}' class. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @see org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.impl.CategoryImpl + * @see org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.impl.EFacetPackageImpl#getCategory() + * @generated + */ + int CATEGORY = 5; + + /** + * The feature id for the '<em><b>EAnnotations</b></em>' containment reference list. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + */ + int CATEGORY__EANNOTATIONS = EcorePackage.ENAMED_ELEMENT__EANNOTATIONS; + + /** + * The feature id for the '<em><b>Name</b></em>' attribute. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + */ + int CATEGORY__NAME = EcorePackage.ENAMED_ELEMENT__NAME; + + /** + * The feature id for the '<em><b>Documentation</b></em>' attribute. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + */ + int CATEGORY__DOCUMENTATION = EcorePackage.ENAMED_ELEMENT_FEATURE_COUNT + 0; + + /** + * The number of structural features of the '<em>Category</em>' class. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + */ + int CATEGORY_FEATURE_COUNT = EcorePackage.ENAMED_ELEMENT_FEATURE_COUNT + 1; + + /** + * The meta object id for the '{@link org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.impl.FacetElementImpl <em>Facet Element</em>}' class. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @see org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.impl.FacetElementImpl + * @see org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.impl.EFacetPackageImpl#getFacetElement() + * @generated + */ + int FACET_ELEMENT = 6; + + /** + * The feature id for the '<em><b>EAnnotations</b></em>' containment reference list. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + */ + int FACET_ELEMENT__EANNOTATIONS = EcorePackage.ETYPED_ELEMENT__EANNOTATIONS; + + /** + * The feature id for the '<em><b>Name</b></em>' attribute. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + */ + int FACET_ELEMENT__NAME = EcorePackage.ETYPED_ELEMENT__NAME; + + /** + * The feature id for the '<em><b>Ordered</b></em>' attribute. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + */ + int FACET_ELEMENT__ORDERED = EcorePackage.ETYPED_ELEMENT__ORDERED; + + /** + * The feature id for the '<em><b>Unique</b></em>' attribute. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + */ + int FACET_ELEMENT__UNIQUE = EcorePackage.ETYPED_ELEMENT__UNIQUE; + + /** + * The feature id for the '<em><b>Lower Bound</b></em>' attribute. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + */ + int FACET_ELEMENT__LOWER_BOUND = EcorePackage.ETYPED_ELEMENT__LOWER_BOUND; + + /** + * The feature id for the '<em><b>Upper Bound</b></em>' attribute. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + */ + int FACET_ELEMENT__UPPER_BOUND = EcorePackage.ETYPED_ELEMENT__UPPER_BOUND; + + /** + * The feature id for the '<em><b>Many</b></em>' attribute. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + */ + int FACET_ELEMENT__MANY = EcorePackage.ETYPED_ELEMENT__MANY; + + /** + * The feature id for the '<em><b>Required</b></em>' attribute. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + */ + int FACET_ELEMENT__REQUIRED = EcorePackage.ETYPED_ELEMENT__REQUIRED; + + /** + * The feature id for the '<em><b>EType</b></em>' reference. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + */ + int FACET_ELEMENT__ETYPE = EcorePackage.ETYPED_ELEMENT__ETYPE; + + /** + * The feature id for the '<em><b>EGeneric Type</b></em>' containment reference. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + */ + int FACET_ELEMENT__EGENERIC_TYPE = EcorePackage.ETYPED_ELEMENT__EGENERIC_TYPE; + + /** + * The feature id for the '<em><b>Documentation</b></em>' attribute. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + */ + int FACET_ELEMENT__DOCUMENTATION = EcorePackage.ETYPED_ELEMENT_FEATURE_COUNT + 0; + + /** + * The feature id for the '<em><b>Categories</b></em>' reference list. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + */ + int FACET_ELEMENT__CATEGORIES = EcorePackage.ETYPED_ELEMENT_FEATURE_COUNT + 1; + + /** + * The number of structural features of the '<em>Facet Element</em>' class. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + */ + int FACET_ELEMENT_FEATURE_COUNT = EcorePackage.ETYPED_ELEMENT_FEATURE_COUNT + 2; + + /** + * The meta object id for the '{@link org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.impl.DerivedTypedElementImpl <em>Derived Typed Element</em>}' class. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @see org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.impl.DerivedTypedElementImpl + * @see org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.impl.EFacetPackageImpl#getDerivedTypedElement() + * @generated + */ + int DERIVED_TYPED_ELEMENT = 7; + + /** + * The feature id for the '<em><b>EAnnotations</b></em>' containment reference list. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + */ + int DERIVED_TYPED_ELEMENT__EANNOTATIONS = FACET_ELEMENT__EANNOTATIONS; + + /** + * The feature id for the '<em><b>Name</b></em>' attribute. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + */ + int DERIVED_TYPED_ELEMENT__NAME = FACET_ELEMENT__NAME; + + /** + * The feature id for the '<em><b>Ordered</b></em>' attribute. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + */ + int DERIVED_TYPED_ELEMENT__ORDERED = FACET_ELEMENT__ORDERED; + + /** + * The feature id for the '<em><b>Unique</b></em>' attribute. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + */ + int DERIVED_TYPED_ELEMENT__UNIQUE = FACET_ELEMENT__UNIQUE; + + /** + * The feature id for the '<em><b>Lower Bound</b></em>' attribute. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + */ + int DERIVED_TYPED_ELEMENT__LOWER_BOUND = FACET_ELEMENT__LOWER_BOUND; + + /** + * The feature id for the '<em><b>Upper Bound</b></em>' attribute. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + */ + int DERIVED_TYPED_ELEMENT__UPPER_BOUND = FACET_ELEMENT__UPPER_BOUND; + + /** + * The feature id for the '<em><b>Many</b></em>' attribute. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + */ + int DERIVED_TYPED_ELEMENT__MANY = FACET_ELEMENT__MANY; + + /** + * The feature id for the '<em><b>Required</b></em>' attribute. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + */ + int DERIVED_TYPED_ELEMENT__REQUIRED = FACET_ELEMENT__REQUIRED; + + /** + * The feature id for the '<em><b>EType</b></em>' reference. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + */ + int DERIVED_TYPED_ELEMENT__ETYPE = FACET_ELEMENT__ETYPE; + + /** + * The feature id for the '<em><b>EGeneric Type</b></em>' containment reference. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + */ + int DERIVED_TYPED_ELEMENT__EGENERIC_TYPE = FACET_ELEMENT__EGENERIC_TYPE; + + /** + * The feature id for the '<em><b>Documentation</b></em>' attribute. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + */ + int DERIVED_TYPED_ELEMENT__DOCUMENTATION = FACET_ELEMENT__DOCUMENTATION; + + /** + * The feature id for the '<em><b>Categories</b></em>' reference list. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + */ + int DERIVED_TYPED_ELEMENT__CATEGORIES = FACET_ELEMENT__CATEGORIES; + + /** + * The feature id for the '<em><b>Query</b></em>' containment reference. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + */ + int DERIVED_TYPED_ELEMENT__QUERY = FACET_ELEMENT_FEATURE_COUNT + 0; + + /** + * The feature id for the '<em><b>Override</b></em>' reference. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + */ + int DERIVED_TYPED_ELEMENT__OVERRIDE = FACET_ELEMENT_FEATURE_COUNT + 1; + + /** + * The number of structural features of the '<em>Derived Typed Element</em>' class. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + */ + int DERIVED_TYPED_ELEMENT_FEATURE_COUNT = FACET_ELEMENT_FEATURE_COUNT + 2; + + /** + * The meta object id for the '{@link org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.impl.ParameterValueImpl <em>Parameter Value</em>}' class. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @see org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.impl.ParameterValueImpl + * @see org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.impl.EFacetPackageImpl#getParameterValue() + * @generated + */ + int PARAMETER_VALUE = 8; + + /** + * The feature id for the '<em><b>Parameter</b></em>' reference. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + */ + int PARAMETER_VALUE__PARAMETER = 0; + + /** + * The feature id for the '<em><b>Value</b></em>' attribute. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + */ + int PARAMETER_VALUE__VALUE = 1; + + /** + * The number of structural features of the '<em>Parameter Value</em>' class. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + */ + int PARAMETER_VALUE_FEATURE_COUNT = 2; + + /** + * The meta object id for the '{@link org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.impl.DocumentedElementImpl <em>Documented Element</em>}' class. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @see org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.impl.DocumentedElementImpl + * @see org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.impl.EFacetPackageImpl#getDocumentedElement() + * @generated + */ + int DOCUMENTED_ELEMENT = 9; + + /** + * The feature id for the '<em><b>Documentation</b></em>' attribute. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + */ + int DOCUMENTED_ELEMENT__DOCUMENTATION = 0; + + /** + * The number of structural features of the '<em>Documented Element</em>' class. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + */ + int DOCUMENTED_ELEMENT_FEATURE_COUNT = 1; + + /** + * The meta object id for the '<em>Resource</em>' data type. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @see org.eclipse.emf.ecore.resource.Resource + * @see org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.impl.EFacetPackageImpl#getResource() + * @generated + */ + int RESOURCE = 10; + + + /** + * Returns the meta object for class '{@link org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.FacetAttribute <em>Facet Attribute</em>}'. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @return the meta object for class '<em>Facet Attribute</em>'. + * @see org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.FacetAttribute + * @generated + */ + EClass getFacetAttribute(); + + /** + * Returns the meta object for class '{@link org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.FacetReference <em>Facet Reference</em>}'. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @return the meta object for class '<em>Facet Reference</em>'. + * @see org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.FacetReference + * @generated + */ + EClass getFacetReference(); + + /** + * Returns the meta object for the reference '{@link org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.FacetReference#getFOpposite <em>FOpposite</em>}'. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @return the meta object for the reference '<em>FOpposite</em>'. + * @see org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.FacetReference#getFOpposite() + * @see #getFacetReference() + * @generated + * @since 1.0 + */ + EReference getFacetReference_FOpposite(); + + /** + * Returns the meta object for class '{@link org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.FacetOperation <em>Facet Operation</em>}'. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @return the meta object for class '<em>Facet Operation</em>'. + * @see org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.FacetOperation + * @generated + */ + EClass getFacetOperation(); + + /** + * Returns the meta object for class '{@link org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.FacetSet <em>Facet Set</em>}'. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @return the meta object for class '<em>Facet Set</em>'. + * @see org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.FacetSet + * @generated + */ + EClass getFacetSet(); + + /** + * Returns the meta object for the containment reference list '{@link org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.FacetSet#getCategories <em>Categories</em>}'. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @return the meta object for the containment reference list '<em>Categories</em>'. + * @see org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.FacetSet#getCategories() + * @see #getFacetSet() + * @generated + */ + EReference getFacetSet_Categories(); + + /** + * Returns the meta object for class '{@link org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.Facet <em>Facet</em>}'. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @return the meta object for class '<em>Facet</em>'. + * @see org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.Facet + * @generated + */ + EClass getFacet(); + + /** + * Returns the meta object for the reference '{@link org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.Facet#getExtendedMetaclass <em>Extended Metaclass</em>}'. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @return the meta object for the reference '<em>Extended Metaclass</em>'. + * @see org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.Facet#getExtendedMetaclass() + * @see #getFacet() + * @generated + */ + EReference getFacet_ExtendedMetaclass(); + + /** + * Returns the meta object for the containment reference list '{@link org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.Facet#getFacetElements <em>Facet Elements</em>}'. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @return the meta object for the containment reference list '<em>Facet Elements</em>'. + * @see org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.Facet#getFacetElements() + * @see #getFacet() + * @generated + */ + EReference getFacet_FacetElements(); + + /** + * Returns the meta object for the containment reference list '{@link org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.Facet#getFacetOperations <em>Facet Operations</em>}'. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @return the meta object for the containment reference list '<em>Facet Operations</em>'. + * @see org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.Facet#getFacetOperations() + * @see #getFacet() + * @generated + */ + EReference getFacet_FacetOperations(); + + /** + * Returns the meta object for the reference '{@link org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.Facet#getConformanceTypedElement <em>Conformance Typed Element</em>}'. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @return the meta object for the reference '<em>Conformance Typed Element</em>'. + * @see org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.Facet#getConformanceTypedElement() + * @see #getFacet() + * @generated + */ + EReference getFacet_ConformanceTypedElement(); + + /** + * Returns the meta object for the reference list '{@link org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.Facet#getExtendedFacets <em>Extended Facets</em>}'. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @return the meta object for the reference list '<em>Extended Facets</em>'. + * @see org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.Facet#getExtendedFacets() + * @see #getFacet() + * @generated + * @since 0.2 + */ + EReference getFacet_ExtendedFacets(); + + /** + * Returns the meta object for class '{@link org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.Category <em>Category</em>}'. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @return the meta object for class '<em>Category</em>'. + * @see org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.Category + * @generated + */ + EClass getCategory(); + + /** + * Returns the meta object for class '{@link org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.FacetElement <em>Facet Element</em>}'. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @return the meta object for class '<em>Facet Element</em>'. + * @see org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.FacetElement + * @generated + */ + EClass getFacetElement(); + + /** + * Returns the meta object for the reference list '{@link org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.FacetElement#getCategories <em>Categories</em>}'. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @return the meta object for the reference list '<em>Categories</em>'. + * @see org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.FacetElement#getCategories() + * @see #getFacetElement() + * @generated + */ + EReference getFacetElement_Categories(); + + /** + * Returns the meta object for class '{@link org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.DerivedTypedElement <em>Derived Typed Element</em>}'. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @return the meta object for class '<em>Derived Typed Element</em>'. + * @see org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.DerivedTypedElement + * @generated + */ + EClass getDerivedTypedElement(); + + /** + * Returns the meta object for the containment reference '{@link org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.DerivedTypedElement#getQuery <em>Query</em>}'. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @return the meta object for the containment reference '<em>Query</em>'. + * @see org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.DerivedTypedElement#getQuery() + * @see #getDerivedTypedElement() + * @generated + */ + EReference getDerivedTypedElement_Query(); + + /** + * Returns the meta object for the reference '{@link org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.DerivedTypedElement#getOverride <em>Override</em>}'. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @return the meta object for the reference '<em>Override</em>'. + * @see org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.DerivedTypedElement#getOverride() + * @see #getDerivedTypedElement() + * @generated + */ + EReference getDerivedTypedElement_Override(); + + /** + * Returns the meta object for class '{@link org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.ParameterValue <em>Parameter Value</em>}'. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @return the meta object for class '<em>Parameter Value</em>'. + * @see org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.ParameterValue + * @generated + */ + EClass getParameterValue(); + + /** + * Returns the meta object for the reference '{@link org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.ParameterValue#getParameter <em>Parameter</em>}'. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @return the meta object for the reference '<em>Parameter</em>'. + * @see org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.ParameterValue#getParameter() + * @see #getParameterValue() + * @generated + */ + EReference getParameterValue_Parameter(); + + /** + * Returns the meta object for the attribute '{@link org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.ParameterValue#getValue <em>Value</em>}'. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @return the meta object for the attribute '<em>Value</em>'. + * @see org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.ParameterValue#getValue() + * @see #getParameterValue() + * @generated + */ + EAttribute getParameterValue_Value(); + + /** + * Returns the meta object for class '{@link org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.DocumentedElement <em>Documented Element</em>}'. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @return the meta object for class '<em>Documented Element</em>'. + * @see org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.DocumentedElement + * @generated + */ + EClass getDocumentedElement(); + + /** + * Returns the meta object for the attribute '{@link org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.DocumentedElement#getDocumentation <em>Documentation</em>}'. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @return the meta object for the attribute '<em>Documentation</em>'. + * @see org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.DocumentedElement#getDocumentation() + * @see #getDocumentedElement() + * @generated + */ + EAttribute getDocumentedElement_Documentation(); + + /** + * Returns the meta object for data type '{@link org.eclipse.emf.ecore.resource.Resource <em>Resource</em>}'. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @return the meta object for data type '<em>Resource</em>'. + * @see org.eclipse.emf.ecore.resource.Resource + * @model instanceClass="org.eclipse.emf.ecore.resource.Resource" + * @generated + */ + EDataType getResource(); + + /** + * Returns the factory that creates the instances of the model. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @return the factory that creates the instances of the model. + * @generated + */ + EFacetFactory getEFacetFactory(); + + /** + * <!-- begin-user-doc --> + * Defines literals for the meta objects that represent + * <ul> + * <li>each class,</li> + * <li>each feature of each class,</li> + * <li>each enum,</li> + * <li>and each data type</li> + * </ul> + * <!-- end-user-doc --> + * @generated + */ + interface Literals { + /** + * The meta object literal for the '{@link org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.impl.FacetAttributeImpl <em>Facet Attribute</em>}' class. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @see org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.impl.FacetAttributeImpl + * @see org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.impl.EFacetPackageImpl#getFacetAttribute() + * @generated + */ + EClass FACET_ATTRIBUTE = eINSTANCE.getFacetAttribute(); + + /** + * The meta object literal for the '{@link org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.impl.FacetReferenceImpl <em>Facet Reference</em>}' class. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @see org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.impl.FacetReferenceImpl + * @see org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.impl.EFacetPackageImpl#getFacetReference() + * @generated + */ + EClass FACET_REFERENCE = eINSTANCE.getFacetReference(); + + /** + * The meta object literal for the '<em><b>FOpposite</b></em>' reference feature. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @since 1.0 + */ + EReference FACET_REFERENCE__FOPPOSITE = eINSTANCE.getFacetReference_FOpposite(); + + /** + * The meta object literal for the '{@link org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.impl.FacetOperationImpl <em>Facet Operation</em>}' class. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @see org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.impl.FacetOperationImpl + * @see org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.impl.EFacetPackageImpl#getFacetOperation() + * @generated + */ + EClass FACET_OPERATION = eINSTANCE.getFacetOperation(); + + /** + * The meta object literal for the '{@link org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.impl.FacetSetImpl <em>Facet Set</em>}' class. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @see org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.impl.FacetSetImpl + * @see org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.impl.EFacetPackageImpl#getFacetSet() + * @generated + */ + EClass FACET_SET = eINSTANCE.getFacetSet(); + + /** + * The meta object literal for the '<em><b>Categories</b></em>' containment reference list feature. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + EReference FACET_SET__CATEGORIES = eINSTANCE.getFacetSet_Categories(); + + /** + * The meta object literal for the '{@link org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.impl.FacetImpl <em>Facet</em>}' class. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @see org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.impl.FacetImpl + * @see org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.impl.EFacetPackageImpl#getFacet() + * @generated + */ + EClass FACET = eINSTANCE.getFacet(); + + /** + * The meta object literal for the '<em><b>Extended Metaclass</b></em>' reference feature. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + EReference FACET__EXTENDED_METACLASS = eINSTANCE.getFacet_ExtendedMetaclass(); + + /** + * The meta object literal for the '<em><b>Facet Elements</b></em>' containment reference list feature. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + EReference FACET__FACET_ELEMENTS = eINSTANCE.getFacet_FacetElements(); + + /** + * The meta object literal for the '<em><b>Facet Operations</b></em>' containment reference list feature. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + EReference FACET__FACET_OPERATIONS = eINSTANCE.getFacet_FacetOperations(); + + /** + * The meta object literal for the '<em><b>Conformance Typed Element</b></em>' reference feature. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + EReference FACET__CONFORMANCE_TYPED_ELEMENT = eINSTANCE.getFacet_ConformanceTypedElement(); + + /** + * The meta object literal for the '<em><b>Extended Facets</b></em>' reference list feature. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @since 0.2 + */ + EReference FACET__EXTENDED_FACETS = eINSTANCE.getFacet_ExtendedFacets(); + + /** + * The meta object literal for the '{@link org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.impl.CategoryImpl <em>Category</em>}' class. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @see org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.impl.CategoryImpl + * @see org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.impl.EFacetPackageImpl#getCategory() + * @generated + */ + EClass CATEGORY = eINSTANCE.getCategory(); + + /** + * The meta object literal for the '{@link org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.impl.FacetElementImpl <em>Facet Element</em>}' class. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @see org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.impl.FacetElementImpl + * @see org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.impl.EFacetPackageImpl#getFacetElement() + * @generated + */ + EClass FACET_ELEMENT = eINSTANCE.getFacetElement(); + + /** + * The meta object literal for the '<em><b>Categories</b></em>' reference list feature. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + EReference FACET_ELEMENT__CATEGORIES = eINSTANCE.getFacetElement_Categories(); + + /** + * The meta object literal for the '{@link org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.impl.DerivedTypedElementImpl <em>Derived Typed Element</em>}' class. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @see org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.impl.DerivedTypedElementImpl + * @see org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.impl.EFacetPackageImpl#getDerivedTypedElement() + * @generated + */ + EClass DERIVED_TYPED_ELEMENT = eINSTANCE.getDerivedTypedElement(); + + /** + * The meta object literal for the '<em><b>Query</b></em>' containment reference feature. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + EReference DERIVED_TYPED_ELEMENT__QUERY = eINSTANCE.getDerivedTypedElement_Query(); + + /** + * The meta object literal for the '<em><b>Override</b></em>' reference feature. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + EReference DERIVED_TYPED_ELEMENT__OVERRIDE = eINSTANCE.getDerivedTypedElement_Override(); + + /** + * The meta object literal for the '{@link org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.impl.ParameterValueImpl <em>Parameter Value</em>}' class. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @see org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.impl.ParameterValueImpl + * @see org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.impl.EFacetPackageImpl#getParameterValue() + * @generated + */ + EClass PARAMETER_VALUE = eINSTANCE.getParameterValue(); + + /** + * The meta object literal for the '<em><b>Parameter</b></em>' reference feature. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + EReference PARAMETER_VALUE__PARAMETER = eINSTANCE.getParameterValue_Parameter(); + + /** + * The meta object literal for the '<em><b>Value</b></em>' attribute feature. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + EAttribute PARAMETER_VALUE__VALUE = eINSTANCE.getParameterValue_Value(); + + /** + * The meta object literal for the '{@link org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.impl.DocumentedElementImpl <em>Documented Element</em>}' class. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @see org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.impl.DocumentedElementImpl + * @see org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.impl.EFacetPackageImpl#getDocumentedElement() + * @generated + */ + EClass DOCUMENTED_ELEMENT = eINSTANCE.getDocumentedElement(); + + /** + * The meta object literal for the '<em><b>Documentation</b></em>' attribute feature. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + EAttribute DOCUMENTED_ELEMENT__DOCUMENTATION = eINSTANCE.getDocumentedElement_Documentation(); + + /** + * The meta object literal for the '<em>Resource</em>' data type. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @see org.eclipse.emf.ecore.resource.Resource + * @see org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.impl.EFacetPackageImpl#getResource() + * @generated + */ + EDataType RESOURCE = eINSTANCE.getResource(); + + } + +} //EFacetPackage
diff --git a/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/modisco/facet/efacet/metamodel/v0_2_0/efacet/Facet.java b/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/modisco/facet/efacet/metamodel/v0_2_0/efacet/Facet.java new file mode 100644 index 0000000..b90d4ef --- /dev/null +++ b/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/modisco/facet/efacet/metamodel/v0_2_0/efacet/Facet.java
@@ -0,0 +1,153 @@ +/** + * Copyright (c) 2011 Mia-Software. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Gregoire Dupe (Mia-Software) - Design + * Nicolas Guyomar (Mia-Software) - Implementation + * Emmanuelle Rouillé (Mia-Software) - Bug 352618 - To be able to use non derived facet structural features and save them values. + * Nicolas Bros (Mia-Software) - Bug 361823 - [Restructuring] eFacet2 meta-model + * Gregoire Dupe (Mia-Software) - Bug 369987 - [Restructuring][Table] Switch to the new customization and facet framework + * Gregoire Dupe (Mia-Software) - Bug 373078 - API Cleaning + * Gregoire Dupe (Mia-Software) - Bug 376576 - [EFacet] Change the multiplicity of Facet::extendedFacet + */ +package org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet; + +import org.eclipse.emf.common.util.EList; +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.EClassifier; +import org.eclipse.emf.ecore.EStructuralFeature; +import org.eclipse.emf.ecore.ETypedElement; + +/** + * <!-- begin-user-doc --> + * A representation of the model object '<em><b>Facet</b></em>'. + * <!-- end-user-doc --> + * + * <!-- begin-model-doc --> + * A Facet is a virtual sub-type of an existing EClass. A Facet cannot be instantiated. + * <!-- end-model-doc --> + * + * <p> + * The following features are supported: + * <ul> + * <li>{@link org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.Facet#getExtendedMetaclass <em>Extended Metaclass</em>}</li> + * <li>{@link org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.Facet#getFacetElements <em>Facet Elements</em>}</li> + * <li>{@link org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.Facet#getFacetOperations <em>Facet Operations</em>}</li> + * <li>{@link org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.Facet#getConformanceTypedElement <em>Conformance Typed Element</em>}</li> + * <li>{@link org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.Facet#getExtendedFacets <em>Extended Facets</em>}</li> + * </ul> + * </p> + * + * @see org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.EFacetPackage#getFacet() + * @model annotation="http://www.eclipse.org/emf/2002/Ecore validationDelegates='( self.query.scope = self.facet.extendedMetaClass ) and ( self.query.name = self.name )'" + * annotation="http://www.eclipse.org/emf/2002/Ecore validationDelegates='self.conformanceQuery.scope = self.extendedMetaClass'" + * annotation="org.eclipse.ocl.ecore.OCL body='not(self.container().oclCastAs(FacetSet).facets->exists(f|f.extendedMetaClass.container() <> self.extendedMetaClass.container() ))'" + * @generated + */ +public interface Facet extends EClassifier, DocumentedElement { + /** + * Returns the value of the '<em><b>Extended Metaclass</b></em>' reference. + * <!-- begin-user-doc --> + * <p> + * If the meaning of the '<em>Extended Metaclass</em>' reference isn't clear, + * there really should be more of a description here... + * </p> + * <!-- end-user-doc --> + * @return the value of the '<em>Extended Metaclass</em>' reference. + * @see #setExtendedMetaclass(EClass) + * @see org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.EFacetPackage#getFacet_ExtendedMetaclass() + * @model annotation="GenModel documentation='The \"extendedMetaclass\" reference references the virtually subtyped EClass.'" + * @generated + */ + EClass getExtendedMetaclass(); + + /** + * Sets the value of the '{@link org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.Facet#getExtendedMetaclass <em>Extended Metaclass</em>}' reference. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @param value the new value of the '<em>Extended Metaclass</em>' reference. + * @see #getExtendedMetaclass() + * @generated + */ + void setExtendedMetaclass(EClass value); + + /** + * Returns the value of the '<em><b>Facet Elements</b></em>' containment reference list. + * The list contents are of type {@link org.eclipse.emf.ecore.EStructuralFeature}. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * <!-- begin-model-doc --> + * This composite reference contains virtual attributes, references and operations. + * <!-- end-model-doc --> + * @return the value of the '<em>Facet Elements</em>' containment reference list. + * @see org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.EFacetPackage#getFacet_FacetElements() + * @model containment="true" + * @generated + */ + EList<EStructuralFeature> getFacetElements(); + + /** + * Returns the value of the '<em><b>Facet Operations</b></em>' containment reference list. + * The list contents are of type {@link org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.FacetOperation}. + * <!-- begin-user-doc --> + * <p> + * If the meaning of the '<em>Facet Operations</em>' containment reference list isn't clear, + * there really should be more of a description here... + * </p> + * <!-- end-user-doc --> + * @return the value of the '<em>Facet Operations</em>' containment reference list. + * @see org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.EFacetPackage#getFacet_FacetOperations() + * @model containment="true" + * @generated + */ + EList<FacetOperation> getFacetOperations(); + + /** + * Returns the value of the '<em><b>Conformance Typed Element</b></em>' reference. + * <!-- begin-user-doc --> + * <p> + * If the meaning of the '<em>Conformance Typed Element</em>' reference isn't clear, + * there really should be more of a description here... + * </p> + * <!-- end-user-doc --> + * @return the value of the '<em>Conformance Typed Element</em>' reference. + * @see #setConformanceTypedElement(ETypedElement) + * @see org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.EFacetPackage#getFacet_ConformanceTypedElement() + * @model + * @generated + */ + ETypedElement getConformanceTypedElement(); + + /** + * Sets the value of the '{@link org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.Facet#getConformanceTypedElement <em>Conformance Typed Element</em>}' reference. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @param value the new value of the '<em>Conformance Typed Element</em>' reference. + * @see #getConformanceTypedElement() + * @generated + */ + void setConformanceTypedElement(ETypedElement value); + + /** + * Returns the value of the '<em><b>Extended Facets</b></em>' reference list. + * The list contents are of type {@link org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.Facet}. + * <!-- begin-user-doc --> + * <p> + * If the meaning of the '<em>Extended Facets</em>' reference list isn't clear, + * there really should be more of a description here... + * </p> + * <!-- end-user-doc --> + * @return the value of the '<em>Extended Facets</em>' reference list. + * @see org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.EFacetPackage#getFacet_ExtendedFacets() + * @model annotation="GenModel documentation='A facet can extend other facets. If A facet A can extend a facet B. In this case an eObject conforms to the facet A if it matches conformance evaluation of A and B. '" + * @generated + * @since 0.2 + */ + EList<Facet> getExtendedFacets(); + +} // Facet
diff --git a/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/modisco/facet/efacet/metamodel/v0_2_0/efacet/FacetAttribute.java b/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/modisco/facet/efacet/metamodel/v0_2_0/efacet/FacetAttribute.java new file mode 100644 index 0000000..a6051e8 --- /dev/null +++ b/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/modisco/facet/efacet/metamodel/v0_2_0/efacet/FacetAttribute.java
@@ -0,0 +1,34 @@ +/** + * Copyright (c) 2011 Mia-Software. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Gregoire Dupe (Mia-Software) - Design + * Nicolas Guyomar (Mia-Software) - Implementation + * Emmanuelle Rouillé (Mia-Software) - Bug 352618 - To be able to use non derived facet structural features and save them values. + * Nicolas Bros (Mia-Software) - Bug 361823 - [Restructuring] eFacet2 meta-model + */ +package org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet; + +import org.eclipse.emf.ecore.EAttribute; + +/** + * <!-- begin-user-doc --> + * A representation of the model object '<em><b>Facet Attribute</b></em>'. + * <!-- end-user-doc --> + * + * <!-- begin-model-doc --> + * A FacetAttribute is a virtual attribute added to all the eObjects which conform to the Facet owning the FacetAttribute. + * <!-- end-model-doc --> + * + * + * @see org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.EFacetPackage#getFacetAttribute() + * @model + * @generated + */ +public interface FacetAttribute extends EAttribute, DerivedTypedElement { +} // FacetAttribute
diff --git a/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/modisco/facet/efacet/metamodel/v0_2_0/efacet/FacetElement.java b/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/modisco/facet/efacet/metamodel/v0_2_0/efacet/FacetElement.java new file mode 100644 index 0000000..35ac4e4 --- /dev/null +++ b/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/modisco/facet/efacet/metamodel/v0_2_0/efacet/FacetElement.java
@@ -0,0 +1,57 @@ +/** + * Copyright (c) 2011 Mia-Software. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Gregoire Dupe (Mia-Software) - Design + * Nicolas Guyomar (Mia-Software) - Implementation + * Emmanuelle Rouillé (Mia-Software) - Bug 352618 - To be able to use non derived facet structural features and save them values. + * Nicolas Bros (Mia-Software) - Bug 361823 - [Restructuring] eFacet2 meta-model + */ +package org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet; + +import org.eclipse.emf.common.util.EList; +import org.eclipse.emf.ecore.ETypedElement; + +/** + * <!-- begin-user-doc --> + * A representation of the model object '<em><b>Facet Element</b></em>'. + * <!-- end-user-doc --> + * + * <!-- begin-model-doc --> + * A facet element is owned by a facet. It can be a facet reference, a facet attribute or a facet operation. + * <!-- end-model-doc --> + * + * <p> + * The following features are supported: + * <ul> + * <li>{@link org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.FacetElement#getCategories <em>Categories</em>}</li> + * </ul> + * </p> + * + * @see org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.EFacetPackage#getFacetElement() + * @model abstract="true" + * @generated + */ +public interface FacetElement extends ETypedElement, DocumentedElement { + /** + * Returns the value of the '<em><b>Categories</b></em>' reference list. + * The list contents are of type {@link org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.Category}. + * <!-- begin-user-doc --> + * <p> + * If the meaning of the '<em>Categories</em>' reference list isn't clear, + * there really should be more of a description here... + * </p> + * <!-- end-user-doc --> + * @return the value of the '<em>Categories</em>' reference list. + * @see org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.EFacetPackage#getFacetElement_Categories() + * @model + * @generated + */ + EList<Category> getCategories(); + +} // FacetElement
diff --git a/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/modisco/facet/efacet/metamodel/v0_2_0/efacet/FacetOperation.java b/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/modisco/facet/efacet/metamodel/v0_2_0/efacet/FacetOperation.java new file mode 100644 index 0000000..8d71fcc --- /dev/null +++ b/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/modisco/facet/efacet/metamodel/v0_2_0/efacet/FacetOperation.java
@@ -0,0 +1,34 @@ +/** + * Copyright (c) 2011 Mia-Software. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Gregoire Dupe (Mia-Software) - Design + * Nicolas Guyomar (Mia-Software) - Implementation + * Emmanuelle Rouillé (Mia-Software) - Bug 352618 - To be able to use non derived facet structural features and save them values. + * Nicolas Bros (Mia-Software) - Bug 361823 - [Restructuring] eFacet2 meta-model + */ +package org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet; + +import org.eclipse.emf.ecore.EOperation; + +/** + * <!-- begin-user-doc --> + * A representation of the model object '<em><b>Facet Operation</b></em>'. + * <!-- end-user-doc --> + * + * <!-- begin-model-doc --> + * A FacetOperation is a virtual operation added to all the eObjects which conform to the Facet owning the FacetOperation. + * <!-- end-model-doc --> + * + * + * @see org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.EFacetPackage#getFacetOperation() + * @model + * @generated + */ +public interface FacetOperation extends EOperation, DerivedTypedElement { +} // FacetOperation
diff --git a/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/modisco/facet/efacet/metamodel/v0_2_0/efacet/FacetReference.java b/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/modisco/facet/efacet/metamodel/v0_2_0/efacet/FacetReference.java new file mode 100644 index 0000000..21712c6 --- /dev/null +++ b/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/modisco/facet/efacet/metamodel/v0_2_0/efacet/FacetReference.java
@@ -0,0 +1,77 @@ +/** + * Copyright (c) 2011, 2015 Mia-Software, and Soft-Maint. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Gregoire Dupe (Mia-Software) - Design + * Nicolas Guyomar (Mia-Software) - Implementation + * Emmanuelle Rouillé (Mia-Software) - Bug 352618 - To be able to use non derived facet structural features and save them values. + * Nicolas Bros (Mia-Software) - Bug 361823 - [Restructuring] eFacet2 meta-model + * Gregoire Dupe (Mia-Software) - Bug 366055 - NavigationQuery + * Gregoire Dupe (Mia-Software) - Bug 369673 - [Facet] IsOneOfQuery + * Olivier Remaud (Soft-Maint) - Bug 369824 - Add a simple way to return string literal constants from a customization query + * Gregoire Dupe (Mia-Software) - Bug 369987 - [Restructuring][Table] Switch to the new customization and facet framework + * Gregoire Dupe (Mia-software) - Bug 364325 - [Restructuring] The user must be able to navigate into a model using the Facet. + * Nicolas Bros (Mia-Software) - Bug 372626 - [Facet] Aggregates + * Nicolas Bros (Mia-Software) - Bug 376941 - [EFacet] Facet operation arguments in Facet model + * Gregoire Dupe (Mia-Software) - Bug 376576 - [EFacet] Change the multiplicity of Facet::extendedFacet + * Jonathan Pepin (Soft-Maint) - Bug 463898 - Create FacetReference not derived, without query and with opposite mechanism + */ +package org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet; + +import org.eclipse.emf.ecore.EReference; + +/** + * <!-- begin-user-doc --> + * A representation of the model object '<em><b>Facet Reference</b></em>'. + * <!-- end-user-doc --> + * + * <!-- begin-model-doc --> + * A FacetReference is a virtual reference added to all the eObjects which conform to the Facet owning the FacetReference. + * <!-- end-model-doc --> + * + * <p> + * The following features are supported: + * <ul> + * <li>{@link org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.FacetReference#getFOpposite <em>FOpposite</em>}</li> + * </ul> + * </p> + * + * @see org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.EFacetPackage#getFacetReference() + * @model + * @generated + */ +public interface FacetReference extends EReference, DerivedTypedElement { + + /** + * Returns the value of the '<em><b>FOpposite</b></em>' reference. + * <!-- begin-user-doc --> + * <p> + * If the meaning of the '<em>FOpposite</em>' reference isn't clear, + * there really should be more of a description here... + * </p> + * <!-- end-user-doc --> + * @return the value of the '<em>FOpposite</em>' reference. + * @see #setFOpposite(FacetReference) + * @see org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.EFacetPackage#getFacetReference_FOpposite() + * @model + * @generated + * @since 1.0 + */ + FacetReference getFOpposite(); + + /** + * Sets the value of the '{@link org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.FacetReference#getFOpposite <em>FOpposite</em>}' reference. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @param value the new value of the '<em>FOpposite</em>' reference. + * @see #getFOpposite() + * @generated + * @since 1.0 + */ + void setFOpposite(FacetReference value); +} // FacetReference
diff --git a/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/modisco/facet/efacet/metamodel/v0_2_0/efacet/FacetSet.java b/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/modisco/facet/efacet/metamodel/v0_2_0/efacet/FacetSet.java new file mode 100644 index 0000000..7f288db --- /dev/null +++ b/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/modisco/facet/efacet/metamodel/v0_2_0/efacet/FacetSet.java
@@ -0,0 +1,63 @@ +/** + * Copyright (c) 2011 Mia-Software. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Gregoire Dupe (Mia-Software) - Design + * Nicolas Guyomar (Mia-Software) - Implementation + * Emmanuelle Rouillé (Mia-Software) - Bug 352618 - To be able to use non derived facet structural features and save them values. + * Nicolas Bros (Mia-Software) - Bug 361823 - [Restructuring] eFacet2 meta-model + * Gregoire Dupe (Mia-Software) - Bug 373078 - API Cleaning + */ +package org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet; + +import org.eclipse.emf.common.util.EList; +import org.eclipse.emf.ecore.EPackage; + +/** + * <!-- begin-user-doc --> + * A representation of the model object '<em><b>Facet Set</b></em>'. + * <!-- end-user-doc --> + * + * <p> + * The following features are supported: + * <ul> + * <li>{@link org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.FacetSet#getCategories <em>Categories</em>}</li> + * </ul> + * </p> + * + * @see org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.EFacetPackage#getFacetSet() + * @model annotation="GenModel documentation='A \"FacetSet\" is the root element of a facet model. It contains a list of \"Facet\".'" + * @generated + */ +public interface FacetSet extends EPackage, DocumentedElement { + /** + * Returns the value of the '<em><b>Categories</b></em>' containment reference list. + * The list contents are of type {@link org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.Category}. + * <!-- begin-user-doc --> + * <p> + * If the meaning of the '<em>Categories</em>' containment reference list isn't clear, + * there really should be more of a description here... + * </p> + * <!-- end-user-doc --> + * @return the value of the '<em>Categories</em>' containment reference list. + * @see org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.EFacetPackage#getFacetSet_Categories() + * @model containment="true" + * @generated + */ + EList<Category> getCategories(); + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @model kind="operation" + * annotation="GenModel documentation='The FacetSets aggregated by this FacetSet (this operation is overridden in Aggregate in the aggregate metamodel).'" + * @generated + */ + EList<FacetSet> getFacetSets(); + +} // FacetSet
diff --git a/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/modisco/facet/efacet/metamodel/v0_2_0/efacet/ParameterValue.java b/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/modisco/facet/efacet/metamodel/v0_2_0/efacet/ParameterValue.java new file mode 100644 index 0000000..ebd9cd7 --- /dev/null +++ b/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/modisco/facet/efacet/metamodel/v0_2_0/efacet/ParameterValue.java
@@ -0,0 +1,94 @@ +/** + * Copyright (c) 2011 Mia-Software. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Gregoire Dupe (Mia-Software) - Design + * Nicolas Guyomar (Mia-Software) - Implementation + * Emmanuelle Rouillé (Mia-Software) - Bug 352618 - To be able to use non derived facet structural features and save them values. + * Nicolas Bros (Mia-Software) - Bug 361823 - [Restructuring] eFacet2 meta-model + */ +package org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet; + +import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.ecore.EParameter; + +/** + * <!-- begin-user-doc --> + * A representation of the model object '<em><b>Parameter Value</b></em>'. + * <!-- end-user-doc --> + * + * <!-- begin-model-doc --> + * This is the value given as a parameter to execute a query for an operation. + * <!-- end-model-doc --> + * + * <p> + * The following features are supported: + * <ul> + * <li>{@link org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.ParameterValue#getParameter <em>Parameter</em>}</li> + * <li>{@link org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.ParameterValue#getValue <em>Value</em>}</li> + * </ul> + * </p> + * + * @see org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.EFacetPackage#getParameterValue() + * @model + * @generated + */ +public interface ParameterValue extends EObject { + /** + * Returns the value of the '<em><b>Parameter</b></em>' reference. + * <!-- begin-user-doc --> + * <p> + * If the meaning of the '<em>Parameter</em>' reference isn't clear, + * there really should be more of a description here... + * </p> + * <!-- end-user-doc --> + * @return the value of the '<em>Parameter</em>' reference. + * @see #setParameter(EParameter) + * @see org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.EFacetPackage#getParameterValue_Parameter() + * @model required="true" + * @generated + */ + EParameter getParameter(); + + /** + * Sets the value of the '{@link org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.ParameterValue#getParameter <em>Parameter</em>}' reference. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @param value the new value of the '<em>Parameter</em>' reference. + * @see #getParameter() + * @generated + */ + void setParameter(EParameter value); + + /** + * Returns the value of the '<em><b>Value</b></em>' attribute. + * <!-- begin-user-doc --> + * <p> + * If the meaning of the '<em>Value</em>' attribute isn't clear, + * there really should be more of a description here... + * </p> + * <!-- end-user-doc --> + * @return the value of the '<em>Value</em>' attribute. + * @see #setValue(Object) + * @see org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.EFacetPackage#getParameterValue_Value() + * @model + * @generated + */ + Object getValue(); + + /** + * Sets the value of the '{@link org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.ParameterValue#getValue <em>Value</em>}' attribute. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @param value the new value of the '<em>Value</em>' attribute. + * @see #getValue() + * @generated + */ + void setValue(Object value); + +} // ParameterValue
diff --git a/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/modisco/facet/efacet/metamodel/v0_2_0/efacet/extensible/ExtensibleFactory.java b/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/modisco/facet/efacet/metamodel/v0_2_0/efacet/extensible/ExtensibleFactory.java new file mode 100644 index 0000000..0177ee6 --- /dev/null +++ b/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/modisco/facet/efacet/metamodel/v0_2_0/efacet/extensible/ExtensibleFactory.java
@@ -0,0 +1,46 @@ +/** + * Copyright (c) 2011 Mia-Software. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Gregoire Dupe (Mia-Software) - Design + * Nicolas Guyomar (Mia-Software) - Implementation + * Emmanuelle Rouillé (Mia-Software) - Bug 352618 - To be able to use non derived facet structural features and save them values. + * Nicolas Bros (Mia-Software) - Bug 361823 - [Restructuring] eFacet2 meta-model + * Gregoire Dupe (Mia-Software) - Bug 373078 - API Cleaning + */ +package org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.extensible; + +import org.eclipse.emf.ecore.EFactory; + +/** + * <!-- begin-user-doc --> + * The <b>Factory</b> for the model. + * It provides a create method for each non-abstract class of the model. + * <!-- end-user-doc --> + * @see org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.extensible.ExtensiblePackage + * @generated + */ +public interface ExtensibleFactory extends EFactory { + /** + * The singleton instance of the factory. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + ExtensibleFactory eINSTANCE = org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.extensible.impl.ExtensibleFactoryImpl.init(); + + /** + * Returns the package supported by this factory. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @return the package supported by this factory. + * @generated + */ + ExtensiblePackage getExtensiblePackage(); + +} //ExtensibleFactory
diff --git a/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/modisco/facet/efacet/metamodel/v0_2_0/efacet/extensible/ExtensiblePackage.java b/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/modisco/facet/efacet/metamodel/v0_2_0/efacet/extensible/ExtensiblePackage.java new file mode 100644 index 0000000..f96df15 --- /dev/null +++ b/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/modisco/facet/efacet/metamodel/v0_2_0/efacet/extensible/ExtensiblePackage.java
@@ -0,0 +1,191 @@ +/** + * Copyright (c) 2011 Mia-Software. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Gregoire Dupe (Mia-Software) - Design + * Nicolas Guyomar (Mia-Software) - Implementation + * Emmanuelle Rouillé (Mia-Software) - Bug 352618 - To be able to use non derived facet structural features and save them values. + * Nicolas Bros (Mia-Software) - Bug 361823 - [Restructuring] eFacet2 meta-model + * Gregoire Dupe (Mia-Software) - Bug 373078 - API Cleaning + */ +package org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.extensible; + +import org.eclipse.emf.ecore.EAttribute; +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.EPackage; +import org.eclipse.emf.ecore.EReference; + +/** + * <!-- begin-user-doc --> + * The <b>Package</b> for the model. + * It contains accessors for the meta objects to represent + * <ul> + * <li>each class,</li> + * <li>each feature of each class,</li> + * <li>each enum,</li> + * <li>and each data type</li> + * </ul> + * <!-- end-user-doc --> + * @see org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.extensible.ExtensibleFactory + * @model kind="package" + * @generated + */ +public interface ExtensiblePackage extends EPackage { + /** + * The package name. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + String eNAME = "extensible"; //$NON-NLS-1$ + + /** + * The package namespace URI. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + String eNS_URI = "http://www.eclipse.org/emf/facet/efacet/0.2.incubation/efacet/extensible"; //$NON-NLS-1$ + + /** + * The package namespace name. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + String eNS_PREFIX = "extensible"; //$NON-NLS-1$ + + /** + * The singleton instance of the package. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + ExtensiblePackage eINSTANCE = org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.extensible.impl.ExtensiblePackageImpl.init(); + + /** + * The meta object id for the '{@link org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.extensible.impl.QueryImpl <em>Query</em>}' class. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @see org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.extensible.impl.QueryImpl + * @see org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.extensible.impl.ExtensiblePackageImpl#getQuery() + * @generated + */ + int QUERY = 0; + + /** + * The feature id for the '<em><b>Can Have Side Effects</b></em>' attribute. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + */ + int QUERY__CAN_HAVE_SIDE_EFFECTS = 0; + + /** + * The feature id for the '<em><b>Can Be Cached</b></em>' attribute. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + */ + int QUERY__CAN_BE_CACHED = 1; + + /** + * The number of structural features of the '<em>Query</em>' class. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + */ + int QUERY_FEATURE_COUNT = 2; + + + /** + * Returns the meta object for class '{@link org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.extensible.Query <em>Query</em>}'. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @return the meta object for class '<em>Query</em>'. + * @see org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.extensible.Query + * @generated + */ + EClass getQuery(); + + /** + * Returns the meta object for the attribute '{@link org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.extensible.Query#isCanHaveSideEffects <em>Can Have Side Effects</em>}'. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @return the meta object for the attribute '<em>Can Have Side Effects</em>'. + * @see org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.extensible.Query#isCanHaveSideEffects() + * @see #getQuery() + * @generated + */ + EAttribute getQuery_CanHaveSideEffects(); + + /** + * Returns the meta object for the attribute '{@link org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.extensible.Query#isCanBeCached <em>Can Be Cached</em>}'. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @return the meta object for the attribute '<em>Can Be Cached</em>'. + * @see org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.extensible.Query#isCanBeCached() + * @see #getQuery() + * @generated + */ + EAttribute getQuery_CanBeCached(); + + /** + * Returns the factory that creates the instances of the model. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @return the factory that creates the instances of the model. + * @generated + */ + ExtensibleFactory getExtensibleFactory(); + + /** + * <!-- begin-user-doc --> + * Defines literals for the meta objects that represent + * <ul> + * <li>each class,</li> + * <li>each feature of each class,</li> + * <li>each enum,</li> + * <li>and each data type</li> + * </ul> + * <!-- end-user-doc --> + * @generated + */ + interface Literals { + /** + * The meta object literal for the '{@link org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.extensible.impl.QueryImpl <em>Query</em>}' class. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @see org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.extensible.impl.QueryImpl + * @see org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.extensible.impl.ExtensiblePackageImpl#getQuery() + * @generated + */ + EClass QUERY = eINSTANCE.getQuery(); + + /** + * The meta object literal for the '<em><b>Can Have Side Effects</b></em>' attribute feature. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + EAttribute QUERY__CAN_HAVE_SIDE_EFFECTS = eINSTANCE.getQuery_CanHaveSideEffects(); + + /** + * The meta object literal for the '<em><b>Can Be Cached</b></em>' attribute feature. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + EAttribute QUERY__CAN_BE_CACHED = eINSTANCE.getQuery_CanBeCached(); + + } + +} //ExtensiblePackage
diff --git a/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/modisco/facet/efacet/metamodel/v0_2_0/efacet/extensible/Query.java b/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/modisco/facet/efacet/metamodel/v0_2_0/efacet/extensible/Query.java new file mode 100644 index 0000000..a06f985 --- /dev/null +++ b/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/modisco/facet/efacet/metamodel/v0_2_0/efacet/extensible/Query.java
@@ -0,0 +1,98 @@ +/** + * Copyright (c) 2011 Mia-Software. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Gregoire Dupe (Mia-Software) - Design + * Nicolas Guyomar (Mia-Software) - Implementation + * Emmanuelle Rouillé (Mia-Software) - Bug 352618 - To be able to use non derived facet structural features and save them values. + * Nicolas Bros (Mia-Software) - Bug 361823 - [Restructuring] eFacet2 meta-model + * Gregoire Dupe (Mia-Software) - Bug 373078 - API Cleaning + */ +package org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.extensible; + +import org.eclipse.emf.common.util.EList; +import org.eclipse.emf.ecore.EClassifier; +import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.ecore.EParameter; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.DerivedTypedElement; + +/** + * <!-- begin-user-doc --> + * A representation of the model object '<em><b>Query</b></em>'. + * <!-- end-user-doc --> + * + * <!-- begin-model-doc --> + * Query is the abstract representation of the concept of query. This class has to be sub-classed for each existing query language (Java, OCL, etc.) + * <!-- end-model-doc --> + * + * <p> + * The following features are supported: + * <ul> + * <li>{@link org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.extensible.Query#isCanHaveSideEffects <em>Can Have Side Effects</em>}</li> + * <li>{@link org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.extensible.Query#isCanBeCached <em>Can Be Cached</em>}</li> + * </ul> + * </p> + * + * @see org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.extensible.ExtensiblePackage#getQuery() + * @model abstract="true" + * @generated + */ +public interface Query extends EObject { + /** + * Returns the value of the '<em><b>Can Have Side Effects</b></em>' attribute. + * <!-- begin-user-doc --> + * <p> + * If the meaning of the '<em>Can Have Side Effects</em>' attribute isn't clear, + * there really should be more of a description here... + * </p> + * <!-- end-user-doc --> + * @return the value of the '<em>Can Have Side Effects</em>' attribute. + * @see #setCanHaveSideEffects(boolean) + * @see org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.extensible.ExtensiblePackage#getQuery_CanHaveSideEffects() + * @model + * @generated + */ + boolean isCanHaveSideEffects(); + + /** + * Sets the value of the '{@link org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.extensible.Query#isCanHaveSideEffects <em>Can Have Side Effects</em>}' attribute. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @param value the new value of the '<em>Can Have Side Effects</em>' attribute. + * @see #isCanHaveSideEffects() + * @generated + */ + void setCanHaveSideEffects(boolean value); + + /** + * Returns the value of the '<em><b>Can Be Cached</b></em>' attribute. + * <!-- begin-user-doc --> + * <p> + * If the meaning of the '<em>Can Be Cached</em>' attribute isn't clear, + * there really should be more of a description here... + * </p> + * <!-- end-user-doc --> + * @return the value of the '<em>Can Be Cached</em>' attribute. + * @see #setCanBeCached(boolean) + * @see org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.extensible.ExtensiblePackage#getQuery_CanBeCached() + * @model + * @generated + */ + boolean isCanBeCached(); + + /** + * Sets the value of the '{@link org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.extensible.Query#isCanBeCached <em>Can Be Cached</em>}' attribute. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @param value the new value of the '<em>Can Be Cached</em>' attribute. + * @see #isCanBeCached() + * @generated + */ + void setCanBeCached(boolean value); + +} // Query
diff --git a/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/modisco/facet/efacet/metamodel/v0_2_0/efacet/extensible/impl/ExtensibleFactoryImpl.java b/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/modisco/facet/efacet/metamodel/v0_2_0/efacet/extensible/impl/ExtensibleFactoryImpl.java new file mode 100644 index 0000000..a3dc434 --- /dev/null +++ b/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/modisco/facet/efacet/metamodel/v0_2_0/efacet/extensible/impl/ExtensibleFactoryImpl.java
@@ -0,0 +1,102 @@ +/** + * Copyright (c) 2011, 2015 Mia-Software, and Soft-Maint. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Gregoire Dupe (Mia-Software) - Design + * Nicolas Guyomar (Mia-Software) - Implementation + * Emmanuelle Rouillé (Mia-Software) - Bug 352618 - To be able to use non derived facet structural features and save them values. + * Nicolas Bros (Mia-Software) - Bug 361823 - [Restructuring] eFacet2 meta-model + * Gregoire Dupe (Mia-Software) - Bug 366055 - NavigationQuery + * Gregoire Dupe (Mia-Software) - Bug 369673 - [Facet] IsOneOfQuery + * Olivier Remaud (Soft-Maint) - Bug 369824 - Add a simple way to return string literal constants from a customization query + * Gregoire Dupe (Mia-Software) - Bug 369987 - [Restructuring][Table] Switch to the new customization and facet framework + * Gregoire Dupe (Mia-software) - Bug 364325 - [Restructuring] The user must be able to navigate into a model using the Facet. + * Nicolas Bros (Mia-Software) - Bug 372626 - [Facet] Aggregates + * Nicolas Bros (Mia-Software) - Bug 376941 - [EFacet] Facet operation arguments in Facet model + * Gregoire Dupe (Mia-Software) - Bug 376576 - [EFacet] Change the multiplicity of Facet::extendedFacet + * Jonathan Pepin (Soft-Maint) - Bug 463898 - Create FacetReference not derived, without query and with opposite mechanism + */ +package org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.extensible.impl; + +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.ecore.EPackage; +import org.eclipse.emf.ecore.impl.EFactoryImpl; +import org.eclipse.emf.ecore.plugin.EcorePlugin; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.extensible.*; + +/** + * <!-- begin-user-doc --> + * An implementation of the model <b>Factory</b>. + * <!-- end-user-doc --> + * @generated + */ +public class ExtensibleFactoryImpl extends EFactoryImpl implements ExtensibleFactory { + /** + * Creates the default factory implementation. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public static ExtensibleFactory init() { + try { + ExtensibleFactory theExtensibleFactory = (ExtensibleFactory)EPackage.Registry.INSTANCE.getEFactory(ExtensiblePackage.eNS_URI); + if (theExtensibleFactory != null) { + return theExtensibleFactory; + } + } + catch (Exception exception) { + EcorePlugin.INSTANCE.log(exception); + } + return new ExtensibleFactoryImpl(); + } + + /** + * Creates an instance of the factory. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public ExtensibleFactoryImpl() { + super(); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + public EObject create(EClass eClass) { + switch (eClass.getClassifierID()) { + default: + throw new IllegalArgumentException("The class '" + eClass.getName() + "' is not a valid classifier"); //$NON-NLS-1$ //$NON-NLS-2$ + } + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public ExtensiblePackage getExtensiblePackage() { + return (ExtensiblePackage)getEPackage(); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @deprecated + * @generated + */ + @Deprecated + public static ExtensiblePackage getPackage() { + return ExtensiblePackage.eINSTANCE; + } + +} //ExtensibleFactoryImpl
diff --git a/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/modisco/facet/efacet/metamodel/v0_2_0/efacet/extensible/impl/ExtensiblePackageImpl.java b/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/modisco/facet/efacet/metamodel/v0_2_0/efacet/extensible/impl/ExtensiblePackageImpl.java new file mode 100644 index 0000000..5b920a6 --- /dev/null +++ b/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/modisco/facet/efacet/metamodel/v0_2_0/efacet/extensible/impl/ExtensiblePackageImpl.java
@@ -0,0 +1,225 @@ +/** + * Copyright (c) 2011, 2012 Mia-Software. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Gregoire Dupe (Mia-Software) - Design + * Nicolas Guyomar (Mia-Software) - Implementation + * Emmanuelle Rouillé (Mia-Software) - Bug 352618 - To be able to use non derived facet structural features and save them values. + * Nicolas Bros (Mia-Software) - Bug 361823 - [Restructuring] eFacet2 meta-model + * Gregoire Dupe (Mia-Software) - Bug 369987 - [Restructuring][Table] Switch to the new customization and facet framework + * Gregoire Dupe (Mia-Software) - Bug 364325 - [Restructuring] The user must be able to navigate into a model using the Facet. + * Gregoire Dupe (Mia-Software) - Bug 373078 - API Cleaning + */ +package org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.extensible.impl; + +import org.eclipse.emf.ecore.EAttribute; +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.EPackage; +import org.eclipse.emf.ecore.EReference; +import org.eclipse.emf.ecore.EcorePackage; +import org.eclipse.emf.ecore.impl.EPackageImpl; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.EFacetPackage; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.extensible.ExtensibleFactory; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.extensible.ExtensiblePackage; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.extensible.Query; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.impl.EFacetPackageImpl; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.query.QueryPackage; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.query.impl.QueryPackageImpl; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.runtime.RuntimePackage; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.runtime.impl.RuntimePackageImpl; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.serialization.SerializationPackage; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.serialization.impl.SerializationPackageImpl; + +/** + * <!-- begin-user-doc --> + * An implementation of the model <b>Package</b>. + * <!-- end-user-doc --> + * @generated + */ +public class ExtensiblePackageImpl extends EPackageImpl implements ExtensiblePackage { + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + private EClass queryEClass = null; + + /** + * Creates an instance of the model <b>Package</b>, registered with + * {@link org.eclipse.emf.ecore.EPackage.Registry EPackage.Registry} by the package + * package URI value. + * <p>Note: the correct way to create the package is via the static + * factory method {@link #init init()}, which also performs + * initialization of the package, or returns the registered package, + * if one already exists. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @see org.eclipse.emf.ecore.EPackage.Registry + * @see org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.extensible.ExtensiblePackage#eNS_URI + * @see #init() + * @generated + */ + private ExtensiblePackageImpl() { + super(eNS_URI, ExtensibleFactory.eINSTANCE); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + private static boolean isInited = false; + + /** + * Creates, registers, and initializes the <b>Package</b> for this model, and for any others upon which it depends. + * + * <p>This method is used to initialize {@link ExtensiblePackage#eINSTANCE} when that field is accessed. + * Clients should not invoke it directly. Instead, they should simply access that field to obtain the package. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @see #eNS_URI + * @see #createPackageContents() + * @see #initializePackageContents() + * @generated + */ + public static ExtensiblePackage init() { + if (isInited) return (ExtensiblePackage)EPackage.Registry.INSTANCE.getEPackage(ExtensiblePackage.eNS_URI); + + // Obtain or create and register package + ExtensiblePackageImpl theExtensiblePackage = (ExtensiblePackageImpl)(EPackage.Registry.INSTANCE.get(eNS_URI) instanceof ExtensiblePackageImpl ? EPackage.Registry.INSTANCE.get(eNS_URI) : new ExtensiblePackageImpl()); + + isInited = true; + + // Initialize simple dependencies + EcorePackage.eINSTANCE.eClass(); + + // Obtain or create and register interdependencies + EFacetPackageImpl theEFacetPackage = (EFacetPackageImpl)(EPackage.Registry.INSTANCE.getEPackage(EFacetPackage.eNS_URI) instanceof EFacetPackageImpl ? EPackage.Registry.INSTANCE.getEPackage(EFacetPackage.eNS_URI) : EFacetPackage.eINSTANCE); + SerializationPackageImpl theSerializationPackage = (SerializationPackageImpl)(EPackage.Registry.INSTANCE.getEPackage(SerializationPackage.eNS_URI) instanceof SerializationPackageImpl ? EPackage.Registry.INSTANCE.getEPackage(SerializationPackage.eNS_URI) : SerializationPackage.eINSTANCE); + QueryPackageImpl theQueryPackage = (QueryPackageImpl)(EPackage.Registry.INSTANCE.getEPackage(QueryPackage.eNS_URI) instanceof QueryPackageImpl ? EPackage.Registry.INSTANCE.getEPackage(QueryPackage.eNS_URI) : QueryPackage.eINSTANCE); + RuntimePackageImpl theRuntimePackage = (RuntimePackageImpl)(EPackage.Registry.INSTANCE.getEPackage(RuntimePackage.eNS_URI) instanceof RuntimePackageImpl ? EPackage.Registry.INSTANCE.getEPackage(RuntimePackage.eNS_URI) : RuntimePackage.eINSTANCE); + + // Create package meta-data objects + theExtensiblePackage.createPackageContents(); + theEFacetPackage.createPackageContents(); + theSerializationPackage.createPackageContents(); + theQueryPackage.createPackageContents(); + theRuntimePackage.createPackageContents(); + + // Initialize created meta-data + theExtensiblePackage.initializePackageContents(); + theEFacetPackage.initializePackageContents(); + theSerializationPackage.initializePackageContents(); + theQueryPackage.initializePackageContents(); + theRuntimePackage.initializePackageContents(); + + // Mark meta-data to indicate it can't be changed + theExtensiblePackage.freeze(); + + + // Update the registry and return the package + EPackage.Registry.INSTANCE.put(ExtensiblePackage.eNS_URI, theExtensiblePackage); + return theExtensiblePackage; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public EClass getQuery() { + return queryEClass; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public EAttribute getQuery_CanHaveSideEffects() { + return (EAttribute)queryEClass.getEStructuralFeatures().get(0); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public EAttribute getQuery_CanBeCached() { + return (EAttribute)queryEClass.getEStructuralFeatures().get(1); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public ExtensibleFactory getExtensibleFactory() { + return (ExtensibleFactory)getEFactoryInstance(); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + private boolean isCreated = false; + + /** + * Creates the meta-model objects for the package. This method is + * guarded to have no affect on any invocation but its first. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public void createPackageContents() { + if (isCreated) return; + isCreated = true; + + // Create classes and their features + queryEClass = createEClass(QUERY); + createEAttribute(queryEClass, QUERY__CAN_HAVE_SIDE_EFFECTS); + createEAttribute(queryEClass, QUERY__CAN_BE_CACHED); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + private boolean isInitialized = false; + + /** + * Complete the initialization of the package and its meta-model. This + * method is guarded to have no affect on any invocation but its first. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public void initializePackageContents() { + if (isInitialized) return; + isInitialized = true; + + // Initialize package + setName(eNAME); + setNsPrefix(eNS_PREFIX); + setNsURI(eNS_URI); + + // Create type parameters + + // Set bounds for type parameters + + // Add supertypes to classes + + // Initialize classes and features; add operations and parameters + initEClass(queryEClass, Query.class, "Query", IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); //$NON-NLS-1$ + initEAttribute(getQuery_CanHaveSideEffects(), ecorePackage.getEBoolean(), "canHaveSideEffects", null, 0, 1, Query.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); //$NON-NLS-1$ + initEAttribute(getQuery_CanBeCached(), ecorePackage.getEBoolean(), "canBeCached", null, 0, 1, Query.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); //$NON-NLS-1$ + } + +} //ExtensiblePackageImpl
diff --git a/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/modisco/facet/efacet/metamodel/v0_2_0/efacet/extensible/impl/QueryImpl.java b/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/modisco/facet/efacet/metamodel/v0_2_0/efacet/extensible/impl/QueryImpl.java new file mode 100644 index 0000000..139083a --- /dev/null +++ b/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/modisco/facet/efacet/metamodel/v0_2_0/efacet/extensible/impl/QueryImpl.java
@@ -0,0 +1,249 @@ +/** + * Copyright (c) 2011 Mia-Software. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Gregoire Dupe (Mia-Software) - Design + * Nicolas Guyomar (Mia-Software) - Implementation + * Emmanuelle Rouillé (Mia-Software) - Bug 352618 - To be able to use non derived facet structural features and save them values. + * Nicolas Bros (Mia-Software) - Bug 361823 - [Restructuring] eFacet2 meta-model + * Gregoire Dupe (Mia-Software) - Bug 373078 - API Cleaning + */ +package org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.extensible.impl; + +import org.eclipse.emf.common.notify.Notification; +import org.eclipse.emf.common.util.EList; +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.EClassifier; +import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.ecore.EOperation; +import org.eclipse.emf.ecore.EParameter; +import org.eclipse.emf.ecore.ETypedElement; +import org.eclipse.emf.ecore.InternalEObject; +import org.eclipse.emf.ecore.impl.ENotificationImpl; +import org.eclipse.emf.ecore.impl.EObjectImpl; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.DerivedTypedElement; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.Facet; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.extensible.ExtensiblePackage; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.extensible.Query; + +/** + * <!-- begin-user-doc --> + * An implementation of the model object '<em><b>Query</b></em>'. + * <!-- end-user-doc --> + * <p> + * The following features are implemented: + * <ul> + * <li>{@link org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.extensible.impl.QueryImpl#isCanHaveSideEffects <em>Can Have Side Effects</em>}</li> + * <li>{@link org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.extensible.impl.QueryImpl#isCanBeCached <em>Can Be Cached</em>}</li> + * </ul> + * </p> + * + * @generated + */ +public abstract class QueryImpl extends EObjectImpl implements Query { + /** + * The default value of the '{@link #isCanHaveSideEffects() <em>Can Have Side Effects</em>}' attribute. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @see #isCanHaveSideEffects() + * @generated + * @ordered + */ + protected static final boolean CAN_HAVE_SIDE_EFFECTS_EDEFAULT = false; + + /** + * The cached value of the '{@link #isCanHaveSideEffects() <em>Can Have Side Effects</em>}' attribute. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @see #isCanHaveSideEffects() + * @generated + * @ordered + */ + protected boolean canHaveSideEffects = CAN_HAVE_SIDE_EFFECTS_EDEFAULT; + + /** + * The default value of the '{@link #isCanBeCached() <em>Can Be Cached</em>}' attribute. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @see #isCanBeCached() + * @generated + * @ordered + */ + protected static final boolean CAN_BE_CACHED_EDEFAULT = false; + + /** + * The cached value of the '{@link #isCanBeCached() <em>Can Be Cached</em>}' attribute. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @see #isCanBeCached() + * @generated + * @ordered + */ + protected boolean canBeCached = CAN_BE_CACHED_EDEFAULT; + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + protected QueryImpl() { + super(); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + protected EClass eStaticClass() { + return ExtensiblePackage.Literals.QUERY; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated NOT + */ + public DerivedTypedElement basicGetOwningDerivedTypedElement() { + EObject container = eContainer(); + if (container instanceof DerivedTypedElement) { + return (DerivedTypedElement) container; + } + throw new IllegalStateException("Query must always be contained by a DerivedTypedElement"); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public boolean isCanHaveSideEffects() { + return canHaveSideEffects; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public void setCanHaveSideEffects(boolean newCanHaveSideEffects) { + boolean oldCanHaveSideEffects = canHaveSideEffects; + canHaveSideEffects = newCanHaveSideEffects; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.SET, ExtensiblePackage.QUERY__CAN_HAVE_SIDE_EFFECTS, oldCanHaveSideEffects, canHaveSideEffects)); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public boolean isCanBeCached() { + return canBeCached; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public void setCanBeCached(boolean newCanBeCached) { + boolean oldCanBeCached = canBeCached; + canBeCached = newCanBeCached; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.SET, ExtensiblePackage.QUERY__CAN_BE_CACHED, oldCanBeCached, canBeCached)); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + public Object eGet(int featureID, boolean resolve, boolean coreType) { + switch (featureID) { + case ExtensiblePackage.QUERY__CAN_HAVE_SIDE_EFFECTS: + return isCanHaveSideEffects(); + case ExtensiblePackage.QUERY__CAN_BE_CACHED: + return isCanBeCached(); + } + return super.eGet(featureID, resolve, coreType); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + public void eSet(int featureID, Object newValue) { + switch (featureID) { + case ExtensiblePackage.QUERY__CAN_HAVE_SIDE_EFFECTS: + setCanHaveSideEffects((Boolean)newValue); + return; + case ExtensiblePackage.QUERY__CAN_BE_CACHED: + setCanBeCached((Boolean)newValue); + return; + } + super.eSet(featureID, newValue); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + public void eUnset(int featureID) { + switch (featureID) { + case ExtensiblePackage.QUERY__CAN_HAVE_SIDE_EFFECTS: + setCanHaveSideEffects(CAN_HAVE_SIDE_EFFECTS_EDEFAULT); + return; + case ExtensiblePackage.QUERY__CAN_BE_CACHED: + setCanBeCached(CAN_BE_CACHED_EDEFAULT); + return; + } + super.eUnset(featureID); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + public boolean eIsSet(int featureID) { + switch (featureID) { + case ExtensiblePackage.QUERY__CAN_HAVE_SIDE_EFFECTS: + return canHaveSideEffects != CAN_HAVE_SIDE_EFFECTS_EDEFAULT; + case ExtensiblePackage.QUERY__CAN_BE_CACHED: + return canBeCached != CAN_BE_CACHED_EDEFAULT; + } + return super.eIsSet(featureID); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + public String toString() { + if (eIsProxy()) return super.toString(); + + StringBuffer result = new StringBuffer(super.toString()); + result.append(" (canHaveSideEffects: "); //$NON-NLS-1$ + result.append(canHaveSideEffects); + result.append(", canBeCached: "); //$NON-NLS-1$ + result.append(canBeCached); + result.append(')'); + return result.toString(); + } + +} //QueryImpl
diff --git a/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/modisco/facet/efacet/metamodel/v0_2_0/efacet/extensible/util/ExtensibleAdapterFactory.java b/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/modisco/facet/efacet/metamodel/v0_2_0/efacet/extensible/util/ExtensibleAdapterFactory.java new file mode 100644 index 0000000..b01a57b --- /dev/null +++ b/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/modisco/facet/efacet/metamodel/v0_2_0/efacet/extensible/util/ExtensibleAdapterFactory.java
@@ -0,0 +1,129 @@ +/** + * Copyright (c) 2011 Mia-Software. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Gregoire Dupe (Mia-Software) - Design + * Nicolas Guyomar (Mia-Software) - Implementation + * Emmanuelle Rouillé (Mia-Software) - Bug 352618 - To be able to use non derived facet structural features and save them values. + * Nicolas Bros (Mia-Software) - Bug 361823 - [Restructuring] eFacet2 meta-model + */ +package org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.extensible.util; + +import org.eclipse.emf.common.notify.Adapter; +import org.eclipse.emf.common.notify.Notifier; +import org.eclipse.emf.common.notify.impl.AdapterFactoryImpl; +import org.eclipse.emf.ecore.EObject; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.extensible.*; + +/** + * <!-- begin-user-doc --> + * The <b>Adapter Factory</b> for the model. + * It provides an adapter <code>createXXX</code> method for each class of the model. + * <!-- end-user-doc --> + * @see org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.extensible.ExtensiblePackage + * @generated + */ +public class ExtensibleAdapterFactory extends AdapterFactoryImpl { + /** + * The cached model package. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + protected static ExtensiblePackage modelPackage; + + /** + * Creates an instance of the adapter factory. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public ExtensibleAdapterFactory() { + if (modelPackage == null) { + modelPackage = ExtensiblePackage.eINSTANCE; + } + } + + /** + * Returns whether this factory is applicable for the type of the object. + * <!-- begin-user-doc --> + * This implementation returns <code>true</code> if the object is either the model's package or is an instance object of the model. + * <!-- end-user-doc --> + * @return whether this factory is applicable for the type of the object. + * @generated + */ + @Override + public boolean isFactoryForType(Object object) { + if (object == modelPackage) { + return true; + } + if (object instanceof EObject) { + return ((EObject)object).eClass().getEPackage() == modelPackage; + } + return false; + } + + /** + * The switch that delegates to the <code>createXXX</code> methods. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + protected ExtensibleSwitch<Adapter> modelSwitch = + new ExtensibleSwitch<Adapter>() { + @Override + public Adapter caseQuery(Query object) { + return createQueryAdapter(); + } + @Override + public Adapter defaultCase(EObject object) { + return createEObjectAdapter(); + } + }; + + /** + * Creates an adapter for the <code>target</code>. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @param target the object to adapt. + * @return the adapter for the <code>target</code>. + * @generated + */ + @Override + public Adapter createAdapter(Notifier target) { + return modelSwitch.doSwitch((EObject)target); + } + + + /** + * Creates a new adapter for an object of class '{@link org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.extensible.Query <em>Query</em>}'. + * <!-- begin-user-doc --> + * This default implementation returns null so that we can easily ignore cases; + * it's useful to ignore a case when inheritance will catch all the cases anyway. + * <!-- end-user-doc --> + * @return the new adapter. + * @see org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.extensible.Query + * @generated + */ + public Adapter createQueryAdapter() { + return null; + } + + /** + * Creates a new adapter for the default case. + * <!-- begin-user-doc --> + * This default implementation returns null. + * <!-- end-user-doc --> + * @return the new adapter. + * @generated + */ + public Adapter createEObjectAdapter() { + return null; + } + +} //ExtensibleAdapterFactory
diff --git a/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/modisco/facet/efacet/metamodel/v0_2_0/efacet/extensible/util/ExtensibleSwitch.java b/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/modisco/facet/efacet/metamodel/v0_2_0/efacet/extensible/util/ExtensibleSwitch.java new file mode 100644 index 0000000..47da8a0 --- /dev/null +++ b/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/modisco/facet/efacet/metamodel/v0_2_0/efacet/extensible/util/ExtensibleSwitch.java
@@ -0,0 +1,141 @@ +/** + * Copyright (c) 2011 Mia-Software. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Gregoire Dupe (Mia-Software) - Design + * Nicolas Guyomar (Mia-Software) - Implementation + * Emmanuelle Rouillé (Mia-Software) - Bug 352618 - To be able to use non derived facet structural features and save them values. + * Nicolas Bros (Mia-Software) - Bug 361823 - [Restructuring] eFacet2 meta-model + * Gregoire Dupe (Mia-Software) - Bug 366055 - NavigationQuery + * Gregoire Dupe (Mia-Software) - Bug 369673 - [Facet] IsOneOfQuery + * Olivier Remaud (Soft-Maint) - Bug 369824 - Add a simple way to return string literal constants from a customization query + * Gregoire Dupe (Mia-software) - Bug 369987 - [Restructuring][Table] Switch to the new customization and facet framework + */ +package org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.extensible.util; + +import java.util.List; + +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.EObject; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.extensible.*; + +/** + * <!-- begin-user-doc --> + * The <b>Switch</b> for the model's inheritance hierarchy. + * It supports the call {@link #doSwitch(EObject) doSwitch(object)} + * to invoke the <code>caseXXX</code> method for each class of the model, + * starting with the actual class of the object + * and proceeding up the inheritance hierarchy + * until a non-null result is returned, + * which is the result of the switch. + * <!-- end-user-doc --> + * @see org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.extensible.ExtensiblePackage + * @generated + */ +public class ExtensibleSwitch<T> { + /** + * The cached model package + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + protected static ExtensiblePackage modelPackage; + + /** + * Creates an instance of the switch. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public ExtensibleSwitch() { + if (modelPackage == null) { + modelPackage = ExtensiblePackage.eINSTANCE; + } + } + + /** + * Calls <code>caseXXX</code> for each class of the model until one returns a non null result; it yields that result. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @return the first non-null result returned by a <code>caseXXX</code> call. + * @generated + */ + public T doSwitch(EObject theEObject) { + return doSwitch(theEObject.eClass(), theEObject); + } + + /** + * Calls <code>caseXXX</code> for each class of the model until one returns a non null result; it yields that result. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @return the first non-null result returned by a <code>caseXXX</code> call. + * @generated + */ + protected T doSwitch(EClass theEClass, EObject theEObject) { + if (theEClass.eContainer() == modelPackage) { + return doSwitch(theEClass.getClassifierID(), theEObject); + } + else { + List<EClass> eSuperTypes = theEClass.getESuperTypes(); + return + eSuperTypes.isEmpty() ? + defaultCase(theEObject) : + doSwitch(eSuperTypes.get(0), theEObject); + } + } + + /** + * Calls <code>caseXXX</code> for each class of the model until one returns a non null result; it yields that result. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @return the first non-null result returned by a <code>caseXXX</code> call. + * @generated + */ + protected T doSwitch(int classifierID, EObject theEObject) { + switch (classifierID) { + case ExtensiblePackage.QUERY: { + Query query = (Query)theEObject; + T result = caseQuery(query); + if (result == null) result = defaultCase(theEObject); + return result; + } + default: return defaultCase(theEObject); + } + } + + /** + * Returns the result of interpreting the object as an instance of '<em>Query</em>'. + * <!-- begin-user-doc --> + * This implementation returns null; + * returning a non-null result will terminate the switch. + * <!-- end-user-doc --> + * @param object the target of the switch. + * @return the result of interpreting the object as an instance of '<em>Query</em>'. + * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) + * @generated + */ + public T caseQuery(Query object) { + return null; + } + + /** + * Returns the result of interpreting the object as an instance of '<em>EObject</em>'. + * <!-- begin-user-doc --> + * This implementation returns null; + * returning a non-null result will terminate the switch, but this is the last case anyway. + * <!-- end-user-doc --> + * @param object the target of the switch. + * @return the result of interpreting the object as an instance of '<em>EObject</em>'. + * @see #doSwitch(org.eclipse.emf.ecore.EObject) + * @generated + */ + public T defaultCase(EObject object) { + return null; + } + +} //ExtensibleSwitch
diff --git a/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/modisco/facet/efacet/metamodel/v0_2_0/efacet/impl/CategoryImpl.java b/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/modisco/facet/efacet/metamodel/v0_2_0/efacet/impl/CategoryImpl.java new file mode 100644 index 0000000..66b2c72 --- /dev/null +++ b/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/modisco/facet/efacet/metamodel/v0_2_0/efacet/impl/CategoryImpl.java
@@ -0,0 +1,205 @@ +/** + * Copyright (c) 2011 Mia-Software. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Gregoire Dupe (Mia-Software) - Design + * Nicolas Guyomar (Mia-Software) - Implementation + * Emmanuelle Rouillé (Mia-Software) - Bug 352618 - To be able to use non derived facet structural features and save them values. + * Nicolas Bros (Mia-Software) - Bug 361823 - [Restructuring] eFacet2 meta-model + */ +package org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.impl; + +import org.eclipse.emf.common.notify.Notification; +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.impl.ENamedElementImpl; +import org.eclipse.emf.ecore.impl.ENotificationImpl; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.Category; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.DocumentedElement; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.EFacetPackage; + +/** + * <!-- begin-user-doc --> + * An implementation of the model object '<em><b>Category</b></em>'. + * <!-- end-user-doc --> + * <p> + * The following features are implemented: + * <ul> + * <li>{@link org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.impl.CategoryImpl#getDocumentation <em>Documentation</em>}</li> + * </ul> + * </p> + * + * @generated + */ +public class CategoryImpl extends ENamedElementImpl implements Category { + /** + * The default value of the '{@link #getDocumentation() <em>Documentation</em>}' attribute. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @see #getDocumentation() + * @generated + * @ordered + */ + protected static final String DOCUMENTATION_EDEFAULT = null; + + /** + * The cached value of the '{@link #getDocumentation() <em>Documentation</em>}' attribute. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @see #getDocumentation() + * @generated + * @ordered + */ + protected String documentation = DOCUMENTATION_EDEFAULT; + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + protected CategoryImpl() { + super(); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + protected EClass eStaticClass() { + return EFacetPackage.Literals.CATEGORY; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public String getDocumentation() { + return documentation; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public void setDocumentation(String newDocumentation) { + String oldDocumentation = documentation; + documentation = newDocumentation; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.SET, EFacetPackage.CATEGORY__DOCUMENTATION, oldDocumentation, documentation)); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + public Object eGet(int featureID, boolean resolve, boolean coreType) { + switch (featureID) { + case EFacetPackage.CATEGORY__DOCUMENTATION: + return getDocumentation(); + } + return super.eGet(featureID, resolve, coreType); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + public void eSet(int featureID, Object newValue) { + switch (featureID) { + case EFacetPackage.CATEGORY__DOCUMENTATION: + setDocumentation((String)newValue); + return; + } + super.eSet(featureID, newValue); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + public void eUnset(int featureID) { + switch (featureID) { + case EFacetPackage.CATEGORY__DOCUMENTATION: + setDocumentation(DOCUMENTATION_EDEFAULT); + return; + } + super.eUnset(featureID); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + public boolean eIsSet(int featureID) { + switch (featureID) { + case EFacetPackage.CATEGORY__DOCUMENTATION: + return DOCUMENTATION_EDEFAULT == null ? documentation != null : !DOCUMENTATION_EDEFAULT.equals(documentation); + } + return super.eIsSet(featureID); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + public int eBaseStructuralFeatureID(int derivedFeatureID, Class<?> baseClass) { + if (baseClass == DocumentedElement.class) { + switch (derivedFeatureID) { + case EFacetPackage.CATEGORY__DOCUMENTATION: return EFacetPackage.DOCUMENTED_ELEMENT__DOCUMENTATION; + default: return -1; + } + } + return super.eBaseStructuralFeatureID(derivedFeatureID, baseClass); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + public int eDerivedStructuralFeatureID(int baseFeatureID, Class<?> baseClass) { + if (baseClass == DocumentedElement.class) { + switch (baseFeatureID) { + case EFacetPackage.DOCUMENTED_ELEMENT__DOCUMENTATION: return EFacetPackage.CATEGORY__DOCUMENTATION; + default: return -1; + } + } + return super.eDerivedStructuralFeatureID(baseFeatureID, baseClass); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + public String toString() { + if (eIsProxy()) return super.toString(); + + StringBuffer result = new StringBuffer(super.toString()); + result.append(" (documentation: "); //$NON-NLS-1$ + result.append(documentation); + result.append(')'); + return result.toString(); + } + +} //CategoryImpl
diff --git a/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/modisco/facet/efacet/metamodel/v0_2_0/efacet/impl/DerivedTypedElementImpl.java b/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/modisco/facet/efacet/metamodel/v0_2_0/efacet/impl/DerivedTypedElementImpl.java new file mode 100644 index 0000000..42c0e02 --- /dev/null +++ b/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/modisco/facet/efacet/metamodel/v0_2_0/efacet/impl/DerivedTypedElementImpl.java
@@ -0,0 +1,244 @@ +/** + * Copyright (c) 2011 Mia-Software. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Gregoire Dupe (Mia-Software) - Design + * Nicolas Guyomar (Mia-Software) - Implementation + * Emmanuelle Rouillé (Mia-Software) - Bug 352618 - To be able to use non derived facet structural features and save them values. + * Nicolas Bros (Mia-Software) - Bug 361823 - [Restructuring] eFacet2 meta-model + */ +package org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.impl; + +import org.eclipse.emf.common.notify.Notification; +import org.eclipse.emf.common.notify.NotificationChain; +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.InternalEObject; +import org.eclipse.emf.ecore.impl.ENotificationImpl; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.DerivedTypedElement; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.EFacetPackage; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.extensible.Query; + +/** + * <!-- begin-user-doc --> + * An implementation of the model object '<em><b>Derived Typed Element</b></em>'. + * <!-- end-user-doc --> + * <p> + * The following features are implemented: + * <ul> + * <li>{@link org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.impl.DerivedTypedElementImpl#getQuery <em>Query</em>}</li> + * <li>{@link org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.impl.DerivedTypedElementImpl#getOverride <em>Override</em>}</li> + * </ul> + * </p> + * + * @generated + */ +public abstract class DerivedTypedElementImpl extends FacetElementImpl implements DerivedTypedElement { + /** + * The cached value of the '{@link #getQuery() <em>Query</em>}' containment reference. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @see #getQuery() + * @generated + * @ordered + */ + protected Query query; + + /** + * The cached value of the '{@link #getOverride() <em>Override</em>}' reference. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @see #getOverride() + * @generated + * @ordered + */ + protected DerivedTypedElement override; + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + protected DerivedTypedElementImpl() { + super(); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + protected EClass eStaticClass() { + return EFacetPackage.Literals.DERIVED_TYPED_ELEMENT; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public Query getQuery() { + return query; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public NotificationChain basicSetQuery(Query newQuery, NotificationChain msgs) { + Query oldQuery = query; + query = newQuery; + if (eNotificationRequired()) { + ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, EFacetPackage.DERIVED_TYPED_ELEMENT__QUERY, oldQuery, newQuery); + if (msgs == null) msgs = notification; else msgs.add(notification); + } + return msgs; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public void setQuery(Query newQuery) { + if (newQuery != query) { + NotificationChain msgs = null; + if (query != null) + msgs = ((InternalEObject)query).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - EFacetPackage.DERIVED_TYPED_ELEMENT__QUERY, null, msgs); + if (newQuery != null) + msgs = ((InternalEObject)newQuery).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - EFacetPackage.DERIVED_TYPED_ELEMENT__QUERY, null, msgs); + msgs = basicSetQuery(newQuery, msgs); + if (msgs != null) msgs.dispatch(); + } + else if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.SET, EFacetPackage.DERIVED_TYPED_ELEMENT__QUERY, newQuery, newQuery)); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public DerivedTypedElement getOverride() { + if (override != null && override.eIsProxy()) { + InternalEObject oldOverride = (InternalEObject)override; + override = (DerivedTypedElement)eResolveProxy(oldOverride); + if (override != oldOverride) { + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.RESOLVE, EFacetPackage.DERIVED_TYPED_ELEMENT__OVERRIDE, oldOverride, override)); + } + } + return override; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public DerivedTypedElement basicGetOverride() { + return override; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public void setOverride(DerivedTypedElement newOverride) { + DerivedTypedElement oldOverride = override; + override = newOverride; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.SET, EFacetPackage.DERIVED_TYPED_ELEMENT__OVERRIDE, oldOverride, override)); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { + switch (featureID) { + case EFacetPackage.DERIVED_TYPED_ELEMENT__QUERY: + return basicSetQuery(null, msgs); + } + return super.eInverseRemove(otherEnd, featureID, msgs); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + public Object eGet(int featureID, boolean resolve, boolean coreType) { + switch (featureID) { + case EFacetPackage.DERIVED_TYPED_ELEMENT__QUERY: + return getQuery(); + case EFacetPackage.DERIVED_TYPED_ELEMENT__OVERRIDE: + if (resolve) return getOverride(); + return basicGetOverride(); + } + return super.eGet(featureID, resolve, coreType); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + public void eSet(int featureID, Object newValue) { + switch (featureID) { + case EFacetPackage.DERIVED_TYPED_ELEMENT__QUERY: + setQuery((Query)newValue); + return; + case EFacetPackage.DERIVED_TYPED_ELEMENT__OVERRIDE: + setOverride((DerivedTypedElement)newValue); + return; + } + super.eSet(featureID, newValue); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + public void eUnset(int featureID) { + switch (featureID) { + case EFacetPackage.DERIVED_TYPED_ELEMENT__QUERY: + setQuery((Query)null); + return; + case EFacetPackage.DERIVED_TYPED_ELEMENT__OVERRIDE: + setOverride((DerivedTypedElement)null); + return; + } + super.eUnset(featureID); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + public boolean eIsSet(int featureID) { + switch (featureID) { + case EFacetPackage.DERIVED_TYPED_ELEMENT__QUERY: + return query != null; + case EFacetPackage.DERIVED_TYPED_ELEMENT__OVERRIDE: + return override != null; + } + return super.eIsSet(featureID); + } + +} //DerivedTypedElementImpl
diff --git a/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/modisco/facet/efacet/metamodel/v0_2_0/efacet/impl/DocumentedElementImpl.java b/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/modisco/facet/efacet/metamodel/v0_2_0/efacet/impl/DocumentedElementImpl.java new file mode 100644 index 0000000..0e65eac --- /dev/null +++ b/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/modisco/facet/efacet/metamodel/v0_2_0/efacet/impl/DocumentedElementImpl.java
@@ -0,0 +1,172 @@ +/** + * Copyright (c) 2011 Mia-Software. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Gregoire Dupe (Mia-Software) - Design + * Nicolas Guyomar (Mia-Software) - Implementation + * Emmanuelle Rouillé (Mia-Software) - Bug 352618 - To be able to use non derived facet structural features and save them values. + * Nicolas Bros (Mia-Software) - Bug 361823 - [Restructuring] eFacet2 meta-model + */ +package org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.impl; + +import org.eclipse.emf.common.notify.Notification; +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.impl.ENotificationImpl; +import org.eclipse.emf.ecore.impl.EObjectImpl; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.DocumentedElement; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.EFacetPackage; + +/** + * <!-- begin-user-doc --> + * An implementation of the model object '<em><b>Documented Element</b></em>'. + * <!-- end-user-doc --> + * <p> + * The following features are implemented: + * <ul> + * <li>{@link org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.impl.DocumentedElementImpl#getDocumentation <em>Documentation</em>}</li> + * </ul> + * </p> + * + * @generated + */ +public class DocumentedElementImpl extends EObjectImpl implements DocumentedElement { + /** + * The default value of the '{@link #getDocumentation() <em>Documentation</em>}' attribute. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @see #getDocumentation() + * @generated + * @ordered + */ + protected static final String DOCUMENTATION_EDEFAULT = null; + + /** + * The cached value of the '{@link #getDocumentation() <em>Documentation</em>}' attribute. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @see #getDocumentation() + * @generated + * @ordered + */ + protected String documentation = DOCUMENTATION_EDEFAULT; + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + protected DocumentedElementImpl() { + super(); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + protected EClass eStaticClass() { + return EFacetPackage.Literals.DOCUMENTED_ELEMENT; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public String getDocumentation() { + return documentation; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public void setDocumentation(String newDocumentation) { + String oldDocumentation = documentation; + documentation = newDocumentation; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.SET, EFacetPackage.DOCUMENTED_ELEMENT__DOCUMENTATION, oldDocumentation, documentation)); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + public Object eGet(int featureID, boolean resolve, boolean coreType) { + switch (featureID) { + case EFacetPackage.DOCUMENTED_ELEMENT__DOCUMENTATION: + return getDocumentation(); + } + return super.eGet(featureID, resolve, coreType); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + public void eSet(int featureID, Object newValue) { + switch (featureID) { + case EFacetPackage.DOCUMENTED_ELEMENT__DOCUMENTATION: + setDocumentation((String)newValue); + return; + } + super.eSet(featureID, newValue); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + public void eUnset(int featureID) { + switch (featureID) { + case EFacetPackage.DOCUMENTED_ELEMENT__DOCUMENTATION: + setDocumentation(DOCUMENTATION_EDEFAULT); + return; + } + super.eUnset(featureID); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + public boolean eIsSet(int featureID) { + switch (featureID) { + case EFacetPackage.DOCUMENTED_ELEMENT__DOCUMENTATION: + return DOCUMENTATION_EDEFAULT == null ? documentation != null : !DOCUMENTATION_EDEFAULT.equals(documentation); + } + return super.eIsSet(featureID); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + public String toString() { + if (eIsProxy()) return super.toString(); + + StringBuffer result = new StringBuffer(super.toString()); + result.append(" (documentation: "); //$NON-NLS-1$ + result.append(documentation); + result.append(')'); + return result.toString(); + } + +} //DocumentedElementImpl
diff --git a/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/modisco/facet/efacet/metamodel/v0_2_0/efacet/impl/EFacetFactoryImpl.java b/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/modisco/facet/efacet/metamodel/v0_2_0/efacet/impl/EFacetFactoryImpl.java new file mode 100644 index 0000000..d95e175 --- /dev/null +++ b/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/modisco/facet/efacet/metamodel/v0_2_0/efacet/impl/EFacetFactoryImpl.java
@@ -0,0 +1,240 @@ +/** + * Copyright (c) 2011, 2015 Mia-Software, and Soft-Maint. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Gregoire Dupe (Mia-Software) - Design + * Nicolas Guyomar (Mia-Software) - Implementation + * Emmanuelle Rouillé (Mia-Software) - Bug 352618 - To be able to use non derived facet structural features and save them values. + * Nicolas Bros (Mia-Software) - Bug 361823 - [Restructuring] eFacet2 meta-model + * Gregoire Dupe (Mia-Software) - Bug 366055 - NavigationQuery + * Gregoire Dupe (Mia-Software) - Bug 369673 - [Facet] IsOneOfQuery + * Olivier Remaud (Soft-Maint) - Bug 369824 - Add a simple way to return string literal constants from a customization query + * Gregoire Dupe (Mia-Software) - Bug 369987 - [Restructuring][Table] Switch to the new customization and facet framework + * Gregoire Dupe (Mia-software) - Bug 364325 - [Restructuring] The user must be able to navigate into a model using the Facet. + * Nicolas Bros (Mia-Software) - Bug 372626 - [Facet] Aggregates + * Nicolas Bros (Mia-Software) - Bug 376941 - [EFacet] Facet operation arguments in Facet model + * Gregoire Dupe (Mia-Software) - Bug 376576 - [EFacet] Change the multiplicity of Facet::extendedFacet + * Jonathan Pepin (Soft-Maint) - Bug 463898 - Create FacetReference not derived, without query and with opposite mechanism + */ +package org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.impl; + +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.EDataType; +import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.ecore.EPackage; +import org.eclipse.emf.ecore.impl.EFactoryImpl; +import org.eclipse.emf.ecore.plugin.EcorePlugin; +import org.eclipse.emf.ecore.resource.Resource; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.*; + +/** + * <!-- begin-user-doc --> + * An implementation of the model <b>Factory</b>. + * <!-- end-user-doc --> + * @generated + */ +public class EFacetFactoryImpl extends EFactoryImpl implements EFacetFactory { + /** + * Creates the default factory implementation. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public static EFacetFactory init() { + try { + EFacetFactory theEFacetFactory = (EFacetFactory)EPackage.Registry.INSTANCE.getEFactory(EFacetPackage.eNS_URI); + if (theEFacetFactory != null) { + return theEFacetFactory; + } + } + catch (Exception exception) { + EcorePlugin.INSTANCE.log(exception); + } + return new EFacetFactoryImpl(); + } + + /** + * Creates an instance of the factory. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public EFacetFactoryImpl() { + super(); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + public EObject create(EClass eClass) { + switch (eClass.getClassifierID()) { + case EFacetPackage.FACET_ATTRIBUTE: return createFacetAttribute(); + case EFacetPackage.FACET_REFERENCE: return createFacetReference(); + case EFacetPackage.FACET_OPERATION: return createFacetOperation(); + case EFacetPackage.FACET_SET: return createFacetSet(); + case EFacetPackage.FACET: return createFacet(); + case EFacetPackage.CATEGORY: return createCategory(); + case EFacetPackage.PARAMETER_VALUE: return createParameterValue(); + case EFacetPackage.DOCUMENTED_ELEMENT: return createDocumentedElement(); + default: + throw new IllegalArgumentException("The class '" + eClass.getName() + "' is not a valid classifier"); //$NON-NLS-1$ //$NON-NLS-2$ + } + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + public Object createFromString(EDataType eDataType, String initialValue) { + switch (eDataType.getClassifierID()) { + case EFacetPackage.RESOURCE: + return createResourceFromString(eDataType, initialValue); + default: + throw new IllegalArgumentException("The datatype '" + eDataType.getName() + "' is not a valid classifier"); //$NON-NLS-1$ //$NON-NLS-2$ + } + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + public String convertToString(EDataType eDataType, Object instanceValue) { + switch (eDataType.getClassifierID()) { + case EFacetPackage.RESOURCE: + return convertResourceToString(eDataType, instanceValue); + default: + throw new IllegalArgumentException("The datatype '" + eDataType.getName() + "' is not a valid classifier"); //$NON-NLS-1$ //$NON-NLS-2$ + } + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public FacetAttribute createFacetAttribute() { + FacetAttributeImpl facetAttribute = new FacetAttributeImpl(); + return facetAttribute; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public FacetReference createFacetReference() { + FacetReferenceImpl facetReference = new FacetReferenceImpl(); + return facetReference; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public FacetOperation createFacetOperation() { + FacetOperationImpl facetOperation = new FacetOperationImpl(); + return facetOperation; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public FacetSet createFacetSet() { + FacetSetImpl facetSet = new FacetSetImpl(); + return facetSet; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public Facet createFacet() { + FacetImpl facet = new FacetImpl(); + return facet; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public Category createCategory() { + CategoryImpl category = new CategoryImpl(); + return category; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public ParameterValue createParameterValue() { + ParameterValueImpl parameterValue = new ParameterValueImpl(); + return parameterValue; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public DocumentedElement createDocumentedElement() { + DocumentedElementImpl documentedElement = new DocumentedElementImpl(); + return documentedElement; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public Resource createResourceFromString(EDataType eDataType, String initialValue) { + return (Resource)super.createFromString(eDataType, initialValue); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public String convertResourceToString(EDataType eDataType, Object instanceValue) { + return super.convertToString(eDataType, instanceValue); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public EFacetPackage getEFacetPackage() { + return (EFacetPackage)getEPackage(); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @deprecated + * @generated + */ + @Deprecated + public static EFacetPackage getPackage() { + return EFacetPackage.eINSTANCE; + } + +} //EFacetFactoryImpl
diff --git a/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/modisco/facet/efacet/metamodel/v0_2_0/efacet/impl/EFacetPackageImpl.java b/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/modisco/facet/efacet/metamodel/v0_2_0/efacet/impl/EFacetPackageImpl.java new file mode 100644 index 0000000..d4a5ee8 --- /dev/null +++ b/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/modisco/facet/efacet/metamodel/v0_2_0/efacet/impl/EFacetPackageImpl.java
@@ -0,0 +1,685 @@ +/** + * Copyright (c) 2011, 2015 Mia-Software, and Soft-Maint. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Gregoire Dupe (Mia-Software) - Design + * Nicolas Guyomar (Mia-Software) - Implementation + * Emmanuelle Rouillé (Mia-Software) - Bug 352618 - To be able to use non derived facet structural features and save them values. + * Nicolas Bros (Mia-Software) - Bug 361823 - [Restructuring] eFacet2 meta-model + * Gregoire Dupe (Mia-Software) - Bug 366055 - NavigationQuery + * Gregoire Dupe (Mia-Software) - Bug 369673 - [Facet] IsOneOfQuery + * Olivier Remaud (Soft-Maint) - Bug 369824 - Add a simple way to return string literal constants from a customization query + * Gregoire Dupe (Mia-Software) - Bug 369987 - [Restructuring][Table] Switch to the new customization and facet framework + * Gregoire Dupe (Mia-software) - Bug 364325 - [Restructuring] The user must be able to navigate into a model using the Facet. + * Nicolas Bros (Mia-Software) - Bug 372626 - [Facet] Aggregates + * Nicolas Bros (Mia-Software) - Bug 376941 - [EFacet] Facet operation arguments in Facet model + * Gregoire Dupe (Mia-Software) - Bug 376576 - [EFacet] Change the multiplicity of Facet::extendedFacet + * Jonathan Pepin (Soft-Maint) - Bug 463898 - Create FacetReference not derived, without query and with opposite mechanism + */ +package org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.impl; + +import static org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.EFacetPackage.RESOURCE; + +import org.eclipse.emf.ecore.EAttribute; +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.EDataType; +import org.eclipse.emf.ecore.EPackage; +import org.eclipse.emf.ecore.EReference; +import org.eclipse.emf.ecore.EcorePackage; +import org.eclipse.emf.ecore.impl.EPackageImpl; +import org.eclipse.emf.ecore.resource.Resource; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.Category; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.DerivedTypedElement; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.DocumentedElement; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.EFacetFactory; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.EFacetPackage; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.Facet; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.FacetAttribute; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.FacetElement; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.FacetOperation; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.FacetReference; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.FacetSet; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.ParameterValue; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.extensible.ExtensiblePackage; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.extensible.impl.ExtensiblePackageImpl; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.query.QueryPackage; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.query.impl.QueryPackageImpl; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.runtime.RuntimePackage; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.runtime.impl.RuntimePackageImpl; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.serialization.SerializationPackage; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.serialization.impl.SerializationPackageImpl; + +/** + * <!-- begin-user-doc --> + * An implementation of the model <b>Package</b>. + * <!-- end-user-doc --> + * @generated + */ +public class EFacetPackageImpl extends EPackageImpl implements EFacetPackage { + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + private EClass facetAttributeEClass = null; + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + private EClass facetReferenceEClass = null; + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + private EClass facetOperationEClass = null; + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + private EClass facetSetEClass = null; + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + private EClass facetEClass = null; + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + private EClass categoryEClass = null; + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + private EClass facetElementEClass = null; + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + private EClass derivedTypedElementEClass = null; + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + private EClass parameterValueEClass = null; + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + private EClass documentedElementEClass = null; + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + private EDataType resourceEDataType = null; + + /** + * Creates an instance of the model <b>Package</b>, registered with + * {@link org.eclipse.emf.ecore.EPackage.Registry EPackage.Registry} by the package + * package URI value. + * <p>Note: the correct way to create the package is via the static + * factory method {@link #init init()}, which also performs + * initialization of the package, or returns the registered package, + * if one already exists. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @see org.eclipse.emf.ecore.EPackage.Registry + * @see org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.EFacetPackage#eNS_URI + * @see #init() + * @generated + */ + private EFacetPackageImpl() { + super(eNS_URI, EFacetFactory.eINSTANCE); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + private static boolean isInited = false; + + /** + * Creates, registers, and initializes the <b>Package</b> for this model, and for any others upon which it depends. + * + * <p>This method is used to initialize {@link EFacetPackage#eINSTANCE} when that field is accessed. + * Clients should not invoke it directly. Instead, they should simply access that field to obtain the package. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @see #eNS_URI + * @see #createPackageContents() + * @see #initializePackageContents() + * @generated + */ + public static EFacetPackage init() { + if (isInited) return (EFacetPackage)EPackage.Registry.INSTANCE.getEPackage(EFacetPackage.eNS_URI); + + // Obtain or create and register package + EFacetPackageImpl theEFacetPackage = (EFacetPackageImpl)(EPackage.Registry.INSTANCE.get(eNS_URI) instanceof EFacetPackageImpl ? EPackage.Registry.INSTANCE.get(eNS_URI) : new EFacetPackageImpl()); + + isInited = true; + + // Initialize simple dependencies + EcorePackage.eINSTANCE.eClass(); + + // Obtain or create and register interdependencies + SerializationPackageImpl theSerializationPackage = (SerializationPackageImpl)(EPackage.Registry.INSTANCE.getEPackage(SerializationPackage.eNS_URI) instanceof SerializationPackageImpl ? EPackage.Registry.INSTANCE.getEPackage(SerializationPackage.eNS_URI) : SerializationPackage.eINSTANCE); + ExtensiblePackageImpl theExtensiblePackage = (ExtensiblePackageImpl)(EPackage.Registry.INSTANCE.getEPackage(ExtensiblePackage.eNS_URI) instanceof ExtensiblePackageImpl ? EPackage.Registry.INSTANCE.getEPackage(ExtensiblePackage.eNS_URI) : ExtensiblePackage.eINSTANCE); + QueryPackageImpl theQueryPackage = (QueryPackageImpl)(EPackage.Registry.INSTANCE.getEPackage(QueryPackage.eNS_URI) instanceof QueryPackageImpl ? EPackage.Registry.INSTANCE.getEPackage(QueryPackage.eNS_URI) : QueryPackage.eINSTANCE); + RuntimePackageImpl theRuntimePackage = (RuntimePackageImpl)(EPackage.Registry.INSTANCE.getEPackage(RuntimePackage.eNS_URI) instanceof RuntimePackageImpl ? EPackage.Registry.INSTANCE.getEPackage(RuntimePackage.eNS_URI) : RuntimePackage.eINSTANCE); + + // Create package meta-data objects + theEFacetPackage.createPackageContents(); + theSerializationPackage.createPackageContents(); + theExtensiblePackage.createPackageContents(); + theQueryPackage.createPackageContents(); + theRuntimePackage.createPackageContents(); + + // Initialize created meta-data + theEFacetPackage.initializePackageContents(); + theSerializationPackage.initializePackageContents(); + theExtensiblePackage.initializePackageContents(); + theQueryPackage.initializePackageContents(); + theRuntimePackage.initializePackageContents(); + + // Mark meta-data to indicate it can't be changed + theEFacetPackage.freeze(); + + + // Update the registry and return the package + EPackage.Registry.INSTANCE.put(EFacetPackage.eNS_URI, theEFacetPackage); + return theEFacetPackage; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public EClass getFacetAttribute() { + return facetAttributeEClass; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public EClass getFacetReference() { + return facetReferenceEClass; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public EReference getFacetReference_FOpposite() { + return (EReference)facetReferenceEClass.getEStructuralFeatures().get(0); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public EClass getFacetOperation() { + return facetOperationEClass; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public EClass getFacetSet() { + return facetSetEClass; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public EReference getFacetSet_Categories() { + return (EReference)facetSetEClass.getEStructuralFeatures().get(0); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public EClass getFacet() { + return facetEClass; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public EReference getFacet_ExtendedMetaclass() { + return (EReference)facetEClass.getEStructuralFeatures().get(0); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public EReference getFacet_FacetElements() { + return (EReference)facetEClass.getEStructuralFeatures().get(1); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public EReference getFacet_FacetOperations() { + return (EReference)facetEClass.getEStructuralFeatures().get(2); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public EReference getFacet_ConformanceTypedElement() { + return (EReference)facetEClass.getEStructuralFeatures().get(3); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public EReference getFacet_ExtendedFacets() { + return (EReference)facetEClass.getEStructuralFeatures().get(4); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public EClass getCategory() { + return categoryEClass; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public EClass getFacetElement() { + return facetElementEClass; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public EReference getFacetElement_Categories() { + return (EReference)facetElementEClass.getEStructuralFeatures().get(0); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public EClass getDerivedTypedElement() { + return derivedTypedElementEClass; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public EReference getDerivedTypedElement_Query() { + return (EReference)derivedTypedElementEClass.getEStructuralFeatures().get(0); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public EReference getDerivedTypedElement_Override() { + return (EReference)derivedTypedElementEClass.getEStructuralFeatures().get(1); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public EClass getParameterValue() { + return parameterValueEClass; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public EReference getParameterValue_Parameter() { + return (EReference)parameterValueEClass.getEStructuralFeatures().get(0); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public EAttribute getParameterValue_Value() { + return (EAttribute)parameterValueEClass.getEStructuralFeatures().get(1); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public EClass getDocumentedElement() { + return documentedElementEClass; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public EAttribute getDocumentedElement_Documentation() { + return (EAttribute)documentedElementEClass.getEStructuralFeatures().get(0); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public EDataType getResource() { + return resourceEDataType; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public EFacetFactory getEFacetFactory() { + return (EFacetFactory)getEFactoryInstance(); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + private boolean isCreated = false; + + /** + * Creates the meta-model objects for the package. This method is + * guarded to have no affect on any invocation but its first. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public void createPackageContents() { + if (isCreated) return; + isCreated = true; + + // Create classes and their features + facetAttributeEClass = createEClass(FACET_ATTRIBUTE); + + facetReferenceEClass = createEClass(FACET_REFERENCE); + createEReference(facetReferenceEClass, FACET_REFERENCE__FOPPOSITE); + + facetOperationEClass = createEClass(FACET_OPERATION); + + facetSetEClass = createEClass(FACET_SET); + createEReference(facetSetEClass, FACET_SET__CATEGORIES); + + facetEClass = createEClass(FACET); + createEReference(facetEClass, FACET__EXTENDED_METACLASS); + createEReference(facetEClass, FACET__FACET_ELEMENTS); + createEReference(facetEClass, FACET__FACET_OPERATIONS); + createEReference(facetEClass, FACET__CONFORMANCE_TYPED_ELEMENT); + createEReference(facetEClass, FACET__EXTENDED_FACETS); + + categoryEClass = createEClass(CATEGORY); + + facetElementEClass = createEClass(FACET_ELEMENT); + createEReference(facetElementEClass, FACET_ELEMENT__CATEGORIES); + + derivedTypedElementEClass = createEClass(DERIVED_TYPED_ELEMENT); + createEReference(derivedTypedElementEClass, DERIVED_TYPED_ELEMENT__QUERY); + createEReference(derivedTypedElementEClass, DERIVED_TYPED_ELEMENT__OVERRIDE); + + parameterValueEClass = createEClass(PARAMETER_VALUE); + createEReference(parameterValueEClass, PARAMETER_VALUE__PARAMETER); + createEAttribute(parameterValueEClass, PARAMETER_VALUE__VALUE); + + documentedElementEClass = createEClass(DOCUMENTED_ELEMENT); + createEAttribute(documentedElementEClass, DOCUMENTED_ELEMENT__DOCUMENTATION); + + // Create data types + resourceEDataType = createEDataType(RESOURCE); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + private boolean isInitialized = false; + + /** + * Complete the initialization of the package and its meta-model. This + * method is guarded to have no affect on any invocation but its first. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public void initializePackageContents() { + if (isInitialized) return; + isInitialized = true; + + // Initialize package + setName(eNAME); + setNsPrefix(eNS_PREFIX); + setNsURI(eNS_URI); + + // Obtain other dependent packages + SerializationPackage theSerializationPackage = (SerializationPackage)EPackage.Registry.INSTANCE.getEPackage(SerializationPackage.eNS_URI); + ExtensiblePackage theExtensiblePackage = (ExtensiblePackage)EPackage.Registry.INSTANCE.getEPackage(ExtensiblePackage.eNS_URI); + QueryPackage theQueryPackage = (QueryPackage)EPackage.Registry.INSTANCE.getEPackage(QueryPackage.eNS_URI); + RuntimePackage theRuntimePackage = (RuntimePackage)EPackage.Registry.INSTANCE.getEPackage(RuntimePackage.eNS_URI); + + // Add subpackages + getESubpackages().add(theSerializationPackage); + getESubpackages().add(theExtensiblePackage); + getESubpackages().add(theQueryPackage); + getESubpackages().add(theRuntimePackage); + + // Create type parameters + + // Set bounds for type parameters + + // Add supertypes to classes + facetAttributeEClass.getESuperTypes().add(ecorePackage.getEAttribute()); + facetAttributeEClass.getESuperTypes().add(this.getDerivedTypedElement()); + facetReferenceEClass.getESuperTypes().add(ecorePackage.getEReference()); + facetReferenceEClass.getESuperTypes().add(this.getDerivedTypedElement()); + facetOperationEClass.getESuperTypes().add(ecorePackage.getEOperation()); + facetOperationEClass.getESuperTypes().add(this.getDerivedTypedElement()); + facetSetEClass.getESuperTypes().add(ecorePackage.getEPackage()); + facetSetEClass.getESuperTypes().add(this.getDocumentedElement()); + facetEClass.getESuperTypes().add(ecorePackage.getEClassifier()); + facetEClass.getESuperTypes().add(this.getDocumentedElement()); + categoryEClass.getESuperTypes().add(ecorePackage.getENamedElement()); + categoryEClass.getESuperTypes().add(this.getDocumentedElement()); + facetElementEClass.getESuperTypes().add(ecorePackage.getETypedElement()); + facetElementEClass.getESuperTypes().add(this.getDocumentedElement()); + derivedTypedElementEClass.getESuperTypes().add(this.getFacetElement()); + + // Initialize classes and features; add operations and parameters + initEClass(facetAttributeEClass, FacetAttribute.class, "FacetAttribute", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); //$NON-NLS-1$ + + initEClass(facetReferenceEClass, FacetReference.class, "FacetReference", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); //$NON-NLS-1$ + initEReference(getFacetReference_FOpposite(), this.getFacetReference(), null, "fOpposite", null, 0, 1, FacetReference.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); //$NON-NLS-1$ + + initEClass(facetOperationEClass, FacetOperation.class, "FacetOperation", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); //$NON-NLS-1$ + + initEClass(facetSetEClass, FacetSet.class, "FacetSet", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); //$NON-NLS-1$ + initEReference(getFacetSet_Categories(), this.getCategory(), null, "categories", null, 0, -1, FacetSet.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); //$NON-NLS-1$ + + addEOperation(facetSetEClass, this.getFacetSet(), "getFacetSets", 0, -1, IS_UNIQUE, IS_ORDERED); //$NON-NLS-1$ + + initEClass(facetEClass, Facet.class, "Facet", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); //$NON-NLS-1$ + initEReference(getFacet_ExtendedMetaclass(), ecorePackage.getEClass(), null, "extendedMetaclass", null, 0, 1, Facet.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); //$NON-NLS-1$ + initEReference(getFacet_FacetElements(), ecorePackage.getEStructuralFeature(), null, "facetElements", null, 0, -1, Facet.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); //$NON-NLS-1$ + initEReference(getFacet_FacetOperations(), this.getFacetOperation(), null, "facetOperations", null, 0, -1, Facet.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); //$NON-NLS-1$ + initEReference(getFacet_ConformanceTypedElement(), ecorePackage.getETypedElement(), null, "conformanceTypedElement", null, 0, 1, Facet.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); //$NON-NLS-1$ + initEReference(getFacet_ExtendedFacets(), this.getFacet(), null, "extendedFacets", null, 0, -1, Facet.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); //$NON-NLS-1$ + + initEClass(categoryEClass, Category.class, "Category", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); //$NON-NLS-1$ + + initEClass(facetElementEClass, FacetElement.class, "FacetElement", IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); //$NON-NLS-1$ + initEReference(getFacetElement_Categories(), this.getCategory(), null, "categories", null, 0, -1, FacetElement.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); //$NON-NLS-1$ + + initEClass(derivedTypedElementEClass, DerivedTypedElement.class, "DerivedTypedElement", IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); //$NON-NLS-1$ + initEReference(getDerivedTypedElement_Query(), theExtensiblePackage.getQuery(), null, "query", null, 0, 1, DerivedTypedElement.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); //$NON-NLS-1$ + initEReference(getDerivedTypedElement_Override(), this.getDerivedTypedElement(), null, "override", null, 0, 1, DerivedTypedElement.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); //$NON-NLS-1$ + + initEClass(parameterValueEClass, ParameterValue.class, "ParameterValue", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); //$NON-NLS-1$ + initEReference(getParameterValue_Parameter(), ecorePackage.getEParameter(), null, "parameter", null, 1, 1, ParameterValue.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); //$NON-NLS-1$ + initEAttribute(getParameterValue_Value(), ecorePackage.getEJavaObject(), "value", null, 0, 1, ParameterValue.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); //$NON-NLS-1$ + + initEClass(documentedElementEClass, DocumentedElement.class, "DocumentedElement", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); //$NON-NLS-1$ + initEAttribute(getDocumentedElement_Documentation(), ecorePackage.getEString(), "documentation", null, 0, 1, DocumentedElement.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); //$NON-NLS-1$ + + // Initialize data types + initEDataType(resourceEDataType, Resource.class, "Resource", IS_SERIALIZABLE, !IS_GENERATED_INSTANCE_CLASS); //$NON-NLS-1$ + + // Create resource + createResource(eNS_URI); + + // Create annotations + // http://www.eclipse.org/emf/2002/Ecore + createEcoreAnnotations(); + // GenModel + createGenModel_1Annotations(); + // org.eclipse.ocl.ecore.OCL + createOrgAnnotations(); + } + + /** + * Initializes the annotations for <b>http://www.eclipse.org/emf/2002/Ecore</b>. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + protected void createEcoreAnnotations() { + String source = "http://www.eclipse.org/emf/2002/Ecore"; //$NON-NLS-1$ + addAnnotation + (this, + source, + new String[] { + "validationDelegates", "org.eclipse.ocl.ecore.OCL" //$NON-NLS-1$ //$NON-NLS-2$ + }); + addAnnotation + (facetEClass, + source, + new String[] { + "validationDelegates", "( self.query.scope = self.facet.extendedMetaClass ) and ( self.query.name = self.name )" //$NON-NLS-1$ //$NON-NLS-2$ + }); + addAnnotation + (facetEClass, + source, + new String[] { + "validationDelegates", "self.conformanceQuery.scope = self.extendedMetaClass" //$NON-NLS-1$ //$NON-NLS-2$ + }); + } + + /** + * Initializes the annotations for <b>GenModel</b>. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + protected void createGenModel_1Annotations() { + String source = "GenModel"; //$NON-NLS-1$ + addAnnotation + (facetSetEClass, + source, + new String[] { + "documentation", "A \"FacetSet\" is the root element of a facet model. It contains a list of \"Facet\"." //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ + }); + addAnnotation + (facetSetEClass.getEOperations().get(0), + source, + new String[] { + "documentation", "The FacetSets aggregated by this FacetSet (this operation is overridden in Aggregate in the aggregate metamodel)." //$NON-NLS-1$ //$NON-NLS-2$ + }); + addAnnotation + (getFacet_ExtendedMetaclass(), + source, + new String[] { + "documentation", "The \"extendedMetaclass\" reference references the virtually subtyped EClass." //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + }); + addAnnotation + (getFacet_ExtendedFacets(), + source, + new String[] { + "documentation", "A facet can extend other facets. If A facet A can extend a facet B. In this case an eObject conforms to the facet A if it matches conformance evaluation of A and B. " //$NON-NLS-1$ //$NON-NLS-2$ + }); + } + + /** + * Initializes the annotations for <b>org.eclipse.ocl.ecore.OCL</b>. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + protected void createOrgAnnotations() { + String source = "org.eclipse.ocl.ecore.OCL"; //$NON-NLS-1$ + addAnnotation + (facetEClass, + source, + new String[] { + "body", "not(self.container().oclCastAs(FacetSet).facets->exists(f|f.extendedMetaClass.container() <> self.extendedMetaClass.container() ))" //$NON-NLS-1$ //$NON-NLS-2$ + }); + } + +} //EFacetPackageImpl
diff --git a/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/modisco/facet/efacet/metamodel/v0_2_0/efacet/impl/FacetAttributeImpl.java b/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/modisco/facet/efacet/metamodel/v0_2_0/efacet/impl/FacetAttributeImpl.java new file mode 100644 index 0000000..6a59304 --- /dev/null +++ b/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/modisco/facet/efacet/metamodel/v0_2_0/efacet/impl/FacetAttributeImpl.java
@@ -0,0 +1,414 @@ +/** + * Copyright (c) 2011 Mia-Software. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Gregoire Dupe (Mia-Software) - Design + * Nicolas Guyomar (Mia-Software) - Implementation + * Emmanuelle Rouillé (Mia-Software) - Bug 352618 - To be able to use non derived facet structural features and save them values. + * Nicolas Bros (Mia-Software) - Bug 361823 - [Restructuring] eFacet2 meta-model + */ +package org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.impl; + +import java.util.Collection; + +import org.eclipse.emf.common.notify.Notification; +import org.eclipse.emf.common.notify.NotificationChain; +import org.eclipse.emf.common.util.EList; +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.InternalEObject; +import org.eclipse.emf.ecore.impl.EAttributeImpl; +import org.eclipse.emf.ecore.impl.ENotificationImpl; +import org.eclipse.emf.ecore.util.EObjectResolvingEList; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.Category; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.DerivedTypedElement; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.DocumentedElement; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.EFacetPackage; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.FacetAttribute; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.FacetElement; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.extensible.Query; + +/** + * <!-- begin-user-doc --> + * An implementation of the model object '<em><b>Facet Attribute</b></em>'. + * <!-- end-user-doc --> + * <p> + * The following features are implemented: + * <ul> + * <li>{@link org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.impl.FacetAttributeImpl#getDocumentation <em>Documentation</em>}</li> + * <li>{@link org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.impl.FacetAttributeImpl#getCategories <em>Categories</em>}</li> + * <li>{@link org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.impl.FacetAttributeImpl#getQuery <em>Query</em>}</li> + * <li>{@link org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.impl.FacetAttributeImpl#getOverride <em>Override</em>}</li> + * </ul> + * </p> + * + * @generated + */ +public class FacetAttributeImpl extends EAttributeImpl implements FacetAttribute { + /** + * The default value of the '{@link #getDocumentation() <em>Documentation</em>}' attribute. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @see #getDocumentation() + * @generated + * @ordered + */ + protected static final String DOCUMENTATION_EDEFAULT = null; + + /** + * The cached value of the '{@link #getDocumentation() <em>Documentation</em>}' attribute. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @see #getDocumentation() + * @generated + * @ordered + */ + protected String documentation = DOCUMENTATION_EDEFAULT; + + /** + * The cached value of the '{@link #getCategories() <em>Categories</em>}' reference list. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @see #getCategories() + * @generated + * @ordered + */ + protected EList<Category> categories; + + /** + * The cached value of the '{@link #getQuery() <em>Query</em>}' containment reference. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @see #getQuery() + * @generated + * @ordered + */ + protected Query query; + + /** + * The cached value of the '{@link #getOverride() <em>Override</em>}' reference. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @see #getOverride() + * @generated + * @ordered + */ + protected DerivedTypedElement override; + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + protected FacetAttributeImpl() { + super(); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + protected EClass eStaticClass() { + return EFacetPackage.Literals.FACET_ATTRIBUTE; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public String getDocumentation() { + return documentation; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public void setDocumentation(String newDocumentation) { + String oldDocumentation = documentation; + documentation = newDocumentation; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.SET, EFacetPackage.FACET_ATTRIBUTE__DOCUMENTATION, oldDocumentation, documentation)); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public EList<Category> getCategories() { + if (categories == null) { + categories = new EObjectResolvingEList<Category>(Category.class, this, EFacetPackage.FACET_ATTRIBUTE__CATEGORIES); + } + return categories; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public Query getQuery() { + return query; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public NotificationChain basicSetQuery(Query newQuery, NotificationChain msgs) { + Query oldQuery = query; + query = newQuery; + if (eNotificationRequired()) { + ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, EFacetPackage.FACET_ATTRIBUTE__QUERY, oldQuery, newQuery); + if (msgs == null) msgs = notification; else msgs.add(notification); + } + return msgs; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public void setQuery(Query newQuery) { + if (newQuery != query) { + NotificationChain msgs = null; + if (query != null) + msgs = ((InternalEObject)query).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - EFacetPackage.FACET_ATTRIBUTE__QUERY, null, msgs); + if (newQuery != null) + msgs = ((InternalEObject)newQuery).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - EFacetPackage.FACET_ATTRIBUTE__QUERY, null, msgs); + msgs = basicSetQuery(newQuery, msgs); + if (msgs != null) msgs.dispatch(); + } + else if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.SET, EFacetPackage.FACET_ATTRIBUTE__QUERY, newQuery, newQuery)); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public DerivedTypedElement getOverride() { + if (override != null && override.eIsProxy()) { + InternalEObject oldOverride = (InternalEObject)override; + override = (DerivedTypedElement)eResolveProxy(oldOverride); + if (override != oldOverride) { + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.RESOLVE, EFacetPackage.FACET_ATTRIBUTE__OVERRIDE, oldOverride, override)); + } + } + return override; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public DerivedTypedElement basicGetOverride() { + return override; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public void setOverride(DerivedTypedElement newOverride) { + DerivedTypedElement oldOverride = override; + override = newOverride; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.SET, EFacetPackage.FACET_ATTRIBUTE__OVERRIDE, oldOverride, override)); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { + switch (featureID) { + case EFacetPackage.FACET_ATTRIBUTE__QUERY: + return basicSetQuery(null, msgs); + } + return super.eInverseRemove(otherEnd, featureID, msgs); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + public Object eGet(int featureID, boolean resolve, boolean coreType) { + switch (featureID) { + case EFacetPackage.FACET_ATTRIBUTE__DOCUMENTATION: + return getDocumentation(); + case EFacetPackage.FACET_ATTRIBUTE__CATEGORIES: + return getCategories(); + case EFacetPackage.FACET_ATTRIBUTE__QUERY: + return getQuery(); + case EFacetPackage.FACET_ATTRIBUTE__OVERRIDE: + if (resolve) return getOverride(); + return basicGetOverride(); + } + return super.eGet(featureID, resolve, coreType); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @SuppressWarnings("unchecked") + @Override + public void eSet(int featureID, Object newValue) { + switch (featureID) { + case EFacetPackage.FACET_ATTRIBUTE__DOCUMENTATION: + setDocumentation((String)newValue); + return; + case EFacetPackage.FACET_ATTRIBUTE__CATEGORIES: + getCategories().clear(); + getCategories().addAll((Collection<? extends Category>)newValue); + return; + case EFacetPackage.FACET_ATTRIBUTE__QUERY: + setQuery((Query)newValue); + return; + case EFacetPackage.FACET_ATTRIBUTE__OVERRIDE: + setOverride((DerivedTypedElement)newValue); + return; + } + super.eSet(featureID, newValue); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + public void eUnset(int featureID) { + switch (featureID) { + case EFacetPackage.FACET_ATTRIBUTE__DOCUMENTATION: + setDocumentation(DOCUMENTATION_EDEFAULT); + return; + case EFacetPackage.FACET_ATTRIBUTE__CATEGORIES: + getCategories().clear(); + return; + case EFacetPackage.FACET_ATTRIBUTE__QUERY: + setQuery((Query)null); + return; + case EFacetPackage.FACET_ATTRIBUTE__OVERRIDE: + setOverride((DerivedTypedElement)null); + return; + } + super.eUnset(featureID); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + public boolean eIsSet(int featureID) { + switch (featureID) { + case EFacetPackage.FACET_ATTRIBUTE__DOCUMENTATION: + return DOCUMENTATION_EDEFAULT == null ? documentation != null : !DOCUMENTATION_EDEFAULT.equals(documentation); + case EFacetPackage.FACET_ATTRIBUTE__CATEGORIES: + return categories != null && !categories.isEmpty(); + case EFacetPackage.FACET_ATTRIBUTE__QUERY: + return query != null; + case EFacetPackage.FACET_ATTRIBUTE__OVERRIDE: + return override != null; + } + return super.eIsSet(featureID); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + public int eBaseStructuralFeatureID(int derivedFeatureID, Class<?> baseClass) { + if (baseClass == DocumentedElement.class) { + switch (derivedFeatureID) { + case EFacetPackage.FACET_ATTRIBUTE__DOCUMENTATION: return EFacetPackage.DOCUMENTED_ELEMENT__DOCUMENTATION; + default: return -1; + } + } + if (baseClass == FacetElement.class) { + switch (derivedFeatureID) { + case EFacetPackage.FACET_ATTRIBUTE__CATEGORIES: return EFacetPackage.FACET_ELEMENT__CATEGORIES; + default: return -1; + } + } + if (baseClass == DerivedTypedElement.class) { + switch (derivedFeatureID) { + case EFacetPackage.FACET_ATTRIBUTE__QUERY: return EFacetPackage.DERIVED_TYPED_ELEMENT__QUERY; + case EFacetPackage.FACET_ATTRIBUTE__OVERRIDE: return EFacetPackage.DERIVED_TYPED_ELEMENT__OVERRIDE; + default: return -1; + } + } + return super.eBaseStructuralFeatureID(derivedFeatureID, baseClass); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + public int eDerivedStructuralFeatureID(int baseFeatureID, Class<?> baseClass) { + if (baseClass == DocumentedElement.class) { + switch (baseFeatureID) { + case EFacetPackage.DOCUMENTED_ELEMENT__DOCUMENTATION: return EFacetPackage.FACET_ATTRIBUTE__DOCUMENTATION; + default: return -1; + } + } + if (baseClass == FacetElement.class) { + switch (baseFeatureID) { + case EFacetPackage.FACET_ELEMENT__CATEGORIES: return EFacetPackage.FACET_ATTRIBUTE__CATEGORIES; + default: return -1; + } + } + if (baseClass == DerivedTypedElement.class) { + switch (baseFeatureID) { + case EFacetPackage.DERIVED_TYPED_ELEMENT__QUERY: return EFacetPackage.FACET_ATTRIBUTE__QUERY; + case EFacetPackage.DERIVED_TYPED_ELEMENT__OVERRIDE: return EFacetPackage.FACET_ATTRIBUTE__OVERRIDE; + default: return -1; + } + } + return super.eDerivedStructuralFeatureID(baseFeatureID, baseClass); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + public String toString() { + if (eIsProxy()) return super.toString(); + + StringBuffer result = new StringBuffer(super.toString()); + result.append(" (documentation: "); //$NON-NLS-1$ + result.append(documentation); + result.append(')'); + return result.toString(); + } + +} //FacetAttributeImpl
diff --git a/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/modisco/facet/efacet/metamodel/v0_2_0/efacet/impl/FacetElementImpl.java b/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/modisco/facet/efacet/metamodel/v0_2_0/efacet/impl/FacetElementImpl.java new file mode 100644 index 0000000..f49d8b1 --- /dev/null +++ b/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/modisco/facet/efacet/metamodel/v0_2_0/efacet/impl/FacetElementImpl.java
@@ -0,0 +1,245 @@ +/** + * Copyright (c) 2011 Mia-Software. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Gregoire Dupe (Mia-Software) - Design + * Nicolas Guyomar (Mia-Software) - Implementation + * Emmanuelle Rouillé (Mia-Software) - Bug 352618 - To be able to use non derived facet structural features and save them values. + * Nicolas Bros (Mia-Software) - Bug 361823 - [Restructuring] eFacet2 meta-model + */ +package org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.impl; + +import java.util.Collection; + +import org.eclipse.emf.common.notify.Notification; +import org.eclipse.emf.common.util.EList; +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.impl.ENotificationImpl; +import org.eclipse.emf.ecore.impl.ETypedElementImpl; +import org.eclipse.emf.ecore.util.EObjectResolvingEList; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.Category; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.DocumentedElement; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.EFacetPackage; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.FacetElement; + +/** + * <!-- begin-user-doc --> + * An implementation of the model object '<em><b>Facet Element</b></em>'. + * <!-- end-user-doc --> + * <p> + * The following features are implemented: + * <ul> + * <li>{@link org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.impl.FacetElementImpl#getDocumentation <em>Documentation</em>}</li> + * <li>{@link org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.impl.FacetElementImpl#getCategories <em>Categories</em>}</li> + * </ul> + * </p> + * + * @generated + */ +public abstract class FacetElementImpl extends ETypedElementImpl implements FacetElement { + /** + * The default value of the '{@link #getDocumentation() <em>Documentation</em>}' attribute. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @see #getDocumentation() + * @generated + * @ordered + */ + protected static final String DOCUMENTATION_EDEFAULT = null; + + /** + * The cached value of the '{@link #getDocumentation() <em>Documentation</em>}' attribute. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @see #getDocumentation() + * @generated + * @ordered + */ + protected String documentation = DOCUMENTATION_EDEFAULT; + + /** + * The cached value of the '{@link #getCategories() <em>Categories</em>}' reference list. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @see #getCategories() + * @generated + * @ordered + */ + protected EList<Category> categories; + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + protected FacetElementImpl() { + super(); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + protected EClass eStaticClass() { + return EFacetPackage.Literals.FACET_ELEMENT; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public String getDocumentation() { + return documentation; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public void setDocumentation(String newDocumentation) { + String oldDocumentation = documentation; + documentation = newDocumentation; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.SET, EFacetPackage.FACET_ELEMENT__DOCUMENTATION, oldDocumentation, documentation)); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public EList<Category> getCategories() { + if (categories == null) { + categories = new EObjectResolvingEList<Category>(Category.class, this, EFacetPackage.FACET_ELEMENT__CATEGORIES); + } + return categories; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + public Object eGet(int featureID, boolean resolve, boolean coreType) { + switch (featureID) { + case EFacetPackage.FACET_ELEMENT__DOCUMENTATION: + return getDocumentation(); + case EFacetPackage.FACET_ELEMENT__CATEGORIES: + return getCategories(); + } + return super.eGet(featureID, resolve, coreType); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @SuppressWarnings("unchecked") + @Override + public void eSet(int featureID, Object newValue) { + switch (featureID) { + case EFacetPackage.FACET_ELEMENT__DOCUMENTATION: + setDocumentation((String)newValue); + return; + case EFacetPackage.FACET_ELEMENT__CATEGORIES: + getCategories().clear(); + getCategories().addAll((Collection<? extends Category>)newValue); + return; + } + super.eSet(featureID, newValue); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + public void eUnset(int featureID) { + switch (featureID) { + case EFacetPackage.FACET_ELEMENT__DOCUMENTATION: + setDocumentation(DOCUMENTATION_EDEFAULT); + return; + case EFacetPackage.FACET_ELEMENT__CATEGORIES: + getCategories().clear(); + return; + } + super.eUnset(featureID); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + public boolean eIsSet(int featureID) { + switch (featureID) { + case EFacetPackage.FACET_ELEMENT__DOCUMENTATION: + return DOCUMENTATION_EDEFAULT == null ? documentation != null : !DOCUMENTATION_EDEFAULT.equals(documentation); + case EFacetPackage.FACET_ELEMENT__CATEGORIES: + return categories != null && !categories.isEmpty(); + } + return super.eIsSet(featureID); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + public int eBaseStructuralFeatureID(int derivedFeatureID, Class<?> baseClass) { + if (baseClass == DocumentedElement.class) { + switch (derivedFeatureID) { + case EFacetPackage.FACET_ELEMENT__DOCUMENTATION: return EFacetPackage.DOCUMENTED_ELEMENT__DOCUMENTATION; + default: return -1; + } + } + return super.eBaseStructuralFeatureID(derivedFeatureID, baseClass); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + public int eDerivedStructuralFeatureID(int baseFeatureID, Class<?> baseClass) { + if (baseClass == DocumentedElement.class) { + switch (baseFeatureID) { + case EFacetPackage.DOCUMENTED_ELEMENT__DOCUMENTATION: return EFacetPackage.FACET_ELEMENT__DOCUMENTATION; + default: return -1; + } + } + return super.eDerivedStructuralFeatureID(baseFeatureID, baseClass); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + public String toString() { + if (eIsProxy()) return super.toString(); + + StringBuffer result = new StringBuffer(super.toString()); + result.append(" (documentation: "); //$NON-NLS-1$ + result.append(documentation); + result.append(')'); + return result.toString(); + } + +} //FacetElementImpl
diff --git a/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/modisco/facet/efacet/metamodel/v0_2_0/efacet/impl/FacetImpl.java b/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/modisco/facet/efacet/metamodel/v0_2_0/efacet/impl/FacetImpl.java new file mode 100644 index 0000000..361a19a --- /dev/null +++ b/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/modisco/facet/efacet/metamodel/v0_2_0/efacet/impl/FacetImpl.java
@@ -0,0 +1,490 @@ +/** + * Copyright (c) 2011 Mia-Software. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Gregoire Dupe (Mia-Software) - Design + * Nicolas Guyomar (Mia-Software) - Implementation + * Emmanuelle Rouillé (Mia-Software) - Bug 352618 - To be able to use non derived facet structural features and save them values. + * Nicolas Bros (Mia-Software) - Bug 361823 - [Restructuring] eFacet2 meta-model + * Gregoire Dupe (Mia-Software) - Bug 369987 - [Restructuring][Table] Switch to the new customization and facet framework + * Gregoire Dupe (Mia-Software) - Bug 373078 - API Cleaning + * Gregoire Dupe (Mia-Software) - Bug 376576 - [EFacet] Change the multiplicity of Facet::extendedFacet + */ +package org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.impl; + +import java.util.Collection; + +import org.eclipse.emf.common.notify.Notification; +import org.eclipse.emf.common.notify.NotificationChain; +import org.eclipse.emf.common.util.EList; +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.EStructuralFeature; +import org.eclipse.emf.ecore.ETypedElement; +import org.eclipse.emf.ecore.InternalEObject; +import org.eclipse.emf.ecore.impl.EClassifierImpl; +import org.eclipse.emf.ecore.impl.ENotificationImpl; +import org.eclipse.emf.ecore.util.EObjectContainmentEList; +import org.eclipse.emf.ecore.util.EObjectResolvingEList; +import org.eclipse.emf.ecore.util.InternalEList; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.DocumentedElement; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.EFacetPackage; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.Facet; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.FacetOperation; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.FacetSet; + +/** + * <!-- begin-user-doc --> + * An implementation of the model object '<em><b>Facet</b></em>'. + * <!-- end-user-doc --> + * <p> + * The following features are implemented: + * <ul> + * <li>{@link org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.impl.FacetImpl#getDocumentation <em>Documentation</em>}</li> + * <li>{@link org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.impl.FacetImpl#getExtendedMetaclass <em>Extended Metaclass</em>}</li> + * <li>{@link org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.impl.FacetImpl#getFacetElements <em>Facet Elements</em>}</li> + * <li>{@link org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.impl.FacetImpl#getFacetOperations <em>Facet Operations</em>}</li> + * <li>{@link org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.impl.FacetImpl#getConformanceTypedElement <em>Conformance Typed Element</em>}</li> + * <li>{@link org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.impl.FacetImpl#getExtendedFacets <em>Extended Facets</em>}</li> + * </ul> + * </p> + * + * @generated + */ +public class FacetImpl extends EClassifierImpl implements Facet { + /** + * The default value of the '{@link #getDocumentation() <em>Documentation</em>}' attribute. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @see #getDocumentation() + * @generated + * @ordered + */ + protected static final String DOCUMENTATION_EDEFAULT = null; + + /** + * The cached value of the '{@link #getDocumentation() <em>Documentation</em>}' attribute. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @see #getDocumentation() + * @generated + * @ordered + */ + protected String documentation = DOCUMENTATION_EDEFAULT; + + /** + * The cached value of the '{@link #getExtendedMetaclass() <em>Extended Metaclass</em>}' reference. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @see #getExtendedMetaclass() + * @generated + * @ordered + */ + protected EClass extendedMetaclass; + + /** + * The cached value of the '{@link #getFacetElements() <em>Facet Elements</em>}' containment reference list. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @see #getFacetElements() + * @generated + * @ordered + */ + protected EList<EStructuralFeature> facetElements; + + /** + * The cached value of the '{@link #getFacetOperations() <em>Facet Operations</em>}' containment reference list. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @see #getFacetOperations() + * @generated + * @ordered + */ + protected EList<FacetOperation> facetOperations; + + /** + * The cached value of the '{@link #getConformanceTypedElement() <em>Conformance Typed Element</em>}' reference. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @see #getConformanceTypedElement() + * @generated + * @ordered + */ + protected ETypedElement conformanceTypedElement; + + /** + * The cached value of the '{@link #getExtendedFacets() <em>Extended Facets</em>}' reference list. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @see #getExtendedFacets() + * @generated + * @ordered + */ + protected EList<Facet> extendedFacets; + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + protected FacetImpl() { + super(); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + protected EClass eStaticClass() { + return EFacetPackage.Literals.FACET; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public String getDocumentation() { + return documentation; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public void setDocumentation(String newDocumentation) { + String oldDocumentation = documentation; + documentation = newDocumentation; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.SET, EFacetPackage.FACET__DOCUMENTATION, oldDocumentation, documentation)); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated NOT + */ + public FacetSet basicGetFacetSet() { + if (getEPackage() instanceof FacetSet) { + FacetSet facetSet = (FacetSet) getEPackage(); + return facetSet; + } + return null; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated NOT + */ + public void setFacetSet(final FacetSet newFacetSet) { + newFacetSet.getEClassifiers().add(this); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public EClass getExtendedMetaclass() { + if (extendedMetaclass != null && extendedMetaclass.eIsProxy()) { + InternalEObject oldExtendedMetaclass = (InternalEObject)extendedMetaclass; + extendedMetaclass = (EClass)eResolveProxy(oldExtendedMetaclass); + if (extendedMetaclass != oldExtendedMetaclass) { + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.RESOLVE, EFacetPackage.FACET__EXTENDED_METACLASS, oldExtendedMetaclass, extendedMetaclass)); + } + } + return extendedMetaclass; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated NOT + */ + public EClass basicGetExtendedMetaclass() { + if (this.extendedMetaclass != null && this.extendedMetaclass.eIsProxy()) { + InternalEObject oldExtendedMetaclass = (InternalEObject)this.extendedMetaclass; + this.extendedMetaclass = (EClass)eResolveProxy(oldExtendedMetaclass); + if (this.extendedMetaclass != oldExtendedMetaclass) { + if (eNotificationRequired()) { + eNotify(new ENotificationImpl(this, Notification.RESOLVE, EFacetPackage.FACET__EXTENDED_METACLASS, oldExtendedMetaclass, this.extendedMetaclass)); + } + } + } + return this.extendedMetaclass; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public void setExtendedMetaclass(EClass newExtendedMetaclass) { + EClass oldExtendedMetaclass = extendedMetaclass; + extendedMetaclass = newExtendedMetaclass; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.SET, EFacetPackage.FACET__EXTENDED_METACLASS, oldExtendedMetaclass, extendedMetaclass)); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public EList<EStructuralFeature> getFacetElements() { + if (facetElements == null) { + facetElements = new EObjectContainmentEList<EStructuralFeature>(EStructuralFeature.class, this, EFacetPackage.FACET__FACET_ELEMENTS); + } + return facetElements; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public EList<FacetOperation> getFacetOperations() { + if (facetOperations == null) { + facetOperations = new EObjectContainmentEList<FacetOperation>(FacetOperation.class, this, EFacetPackage.FACET__FACET_OPERATIONS); + } + return facetOperations; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public ETypedElement getConformanceTypedElement() { + if (conformanceTypedElement != null && conformanceTypedElement.eIsProxy()) { + InternalEObject oldConformanceTypedElement = (InternalEObject)conformanceTypedElement; + conformanceTypedElement = (ETypedElement)eResolveProxy(oldConformanceTypedElement); + if (conformanceTypedElement != oldConformanceTypedElement) { + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.RESOLVE, EFacetPackage.FACET__CONFORMANCE_TYPED_ELEMENT, oldConformanceTypedElement, conformanceTypedElement)); + } + } + return conformanceTypedElement; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public ETypedElement basicGetConformanceTypedElement() { + return conformanceTypedElement; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public void setConformanceTypedElement(ETypedElement newConformanceTypedElement) { + ETypedElement oldConformanceTypedElement = conformanceTypedElement; + conformanceTypedElement = newConformanceTypedElement; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.SET, EFacetPackage.FACET__CONFORMANCE_TYPED_ELEMENT, oldConformanceTypedElement, conformanceTypedElement)); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public EList<Facet> getExtendedFacets() { + if (extendedFacets == null) { + extendedFacets = new EObjectResolvingEList<Facet>(Facet.class, this, EFacetPackage.FACET__EXTENDED_FACETS); + } + return extendedFacets; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { + switch (featureID) { + case EFacetPackage.FACET__FACET_ELEMENTS: + return ((InternalEList<?>)getFacetElements()).basicRemove(otherEnd, msgs); + case EFacetPackage.FACET__FACET_OPERATIONS: + return ((InternalEList<?>)getFacetOperations()).basicRemove(otherEnd, msgs); + } + return super.eInverseRemove(otherEnd, featureID, msgs); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + public Object eGet(int featureID, boolean resolve, boolean coreType) { + switch (featureID) { + case EFacetPackage.FACET__DOCUMENTATION: + return getDocumentation(); + case EFacetPackage.FACET__EXTENDED_METACLASS: + if (resolve) return getExtendedMetaclass(); + return basicGetExtendedMetaclass(); + case EFacetPackage.FACET__FACET_ELEMENTS: + return getFacetElements(); + case EFacetPackage.FACET__FACET_OPERATIONS: + return getFacetOperations(); + case EFacetPackage.FACET__CONFORMANCE_TYPED_ELEMENT: + if (resolve) return getConformanceTypedElement(); + return basicGetConformanceTypedElement(); + case EFacetPackage.FACET__EXTENDED_FACETS: + return getExtendedFacets(); + } + return super.eGet(featureID, resolve, coreType); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @SuppressWarnings("unchecked") + @Override + public void eSet(int featureID, Object newValue) { + switch (featureID) { + case EFacetPackage.FACET__DOCUMENTATION: + setDocumentation((String)newValue); + return; + case EFacetPackage.FACET__EXTENDED_METACLASS: + setExtendedMetaclass((EClass)newValue); + return; + case EFacetPackage.FACET__FACET_ELEMENTS: + getFacetElements().clear(); + getFacetElements().addAll((Collection<? extends EStructuralFeature>)newValue); + return; + case EFacetPackage.FACET__FACET_OPERATIONS: + getFacetOperations().clear(); + getFacetOperations().addAll((Collection<? extends FacetOperation>)newValue); + return; + case EFacetPackage.FACET__CONFORMANCE_TYPED_ELEMENT: + setConformanceTypedElement((ETypedElement)newValue); + return; + case EFacetPackage.FACET__EXTENDED_FACETS: + getExtendedFacets().clear(); + getExtendedFacets().addAll((Collection<? extends Facet>)newValue); + return; + } + super.eSet(featureID, newValue); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + public void eUnset(int featureID) { + switch (featureID) { + case EFacetPackage.FACET__DOCUMENTATION: + setDocumentation(DOCUMENTATION_EDEFAULT); + return; + case EFacetPackage.FACET__EXTENDED_METACLASS: + setExtendedMetaclass((EClass)null); + return; + case EFacetPackage.FACET__FACET_ELEMENTS: + getFacetElements().clear(); + return; + case EFacetPackage.FACET__FACET_OPERATIONS: + getFacetOperations().clear(); + return; + case EFacetPackage.FACET__CONFORMANCE_TYPED_ELEMENT: + setConformanceTypedElement((ETypedElement)null); + return; + case EFacetPackage.FACET__EXTENDED_FACETS: + getExtendedFacets().clear(); + return; + } + super.eUnset(featureID); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + public boolean eIsSet(int featureID) { + switch (featureID) { + case EFacetPackage.FACET__DOCUMENTATION: + return DOCUMENTATION_EDEFAULT == null ? documentation != null : !DOCUMENTATION_EDEFAULT.equals(documentation); + case EFacetPackage.FACET__EXTENDED_METACLASS: + return extendedMetaclass != null; + case EFacetPackage.FACET__FACET_ELEMENTS: + return facetElements != null && !facetElements.isEmpty(); + case EFacetPackage.FACET__FACET_OPERATIONS: + return facetOperations != null && !facetOperations.isEmpty(); + case EFacetPackage.FACET__CONFORMANCE_TYPED_ELEMENT: + return conformanceTypedElement != null; + case EFacetPackage.FACET__EXTENDED_FACETS: + return extendedFacets != null && !extendedFacets.isEmpty(); + } + return super.eIsSet(featureID); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + public int eBaseStructuralFeatureID(int derivedFeatureID, Class<?> baseClass) { + if (baseClass == DocumentedElement.class) { + switch (derivedFeatureID) { + case EFacetPackage.FACET__DOCUMENTATION: return EFacetPackage.DOCUMENTED_ELEMENT__DOCUMENTATION; + default: return -1; + } + } + return super.eBaseStructuralFeatureID(derivedFeatureID, baseClass); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + public int eDerivedStructuralFeatureID(int baseFeatureID, Class<?> baseClass) { + if (baseClass == DocumentedElement.class) { + switch (baseFeatureID) { + case EFacetPackage.DOCUMENTED_ELEMENT__DOCUMENTATION: return EFacetPackage.FACET__DOCUMENTATION; + default: return -1; + } + } + return super.eDerivedStructuralFeatureID(baseFeatureID, baseClass); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + public String toString() { + if (eIsProxy()) return super.toString(); + + StringBuffer result = new StringBuffer(super.toString()); + result.append(" (documentation: "); //$NON-NLS-1$ + result.append(documentation); + result.append(')'); + return result.toString(); + } + +} //FacetImpl
diff --git a/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/modisco/facet/efacet/metamodel/v0_2_0/efacet/impl/FacetOperationImpl.java b/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/modisco/facet/efacet/metamodel/v0_2_0/efacet/impl/FacetOperationImpl.java new file mode 100644 index 0000000..0a5509f --- /dev/null +++ b/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/modisco/facet/efacet/metamodel/v0_2_0/efacet/impl/FacetOperationImpl.java
@@ -0,0 +1,414 @@ +/** + * Copyright (c) 2011 Mia-Software. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Gregoire Dupe (Mia-Software) - Design + * Nicolas Guyomar (Mia-Software) - Implementation + * Emmanuelle Rouillé (Mia-Software) - Bug 352618 - To be able to use non derived facet structural features and save them values. + * Nicolas Bros (Mia-Software) - Bug 361823 - [Restructuring] eFacet2 meta-model + */ +package org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.impl; + +import java.util.Collection; + +import org.eclipse.emf.common.notify.Notification; +import org.eclipse.emf.common.notify.NotificationChain; +import org.eclipse.emf.common.util.EList; +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.InternalEObject; +import org.eclipse.emf.ecore.impl.ENotificationImpl; +import org.eclipse.emf.ecore.impl.EOperationImpl; +import org.eclipse.emf.ecore.util.EObjectResolvingEList; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.Category; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.DerivedTypedElement; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.DocumentedElement; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.EFacetPackage; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.FacetElement; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.FacetOperation; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.extensible.Query; + +/** + * <!-- begin-user-doc --> + * An implementation of the model object '<em><b>Facet Operation</b></em>'. + * <!-- end-user-doc --> + * <p> + * The following features are implemented: + * <ul> + * <li>{@link org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.impl.FacetOperationImpl#getDocumentation <em>Documentation</em>}</li> + * <li>{@link org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.impl.FacetOperationImpl#getCategories <em>Categories</em>}</li> + * <li>{@link org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.impl.FacetOperationImpl#getQuery <em>Query</em>}</li> + * <li>{@link org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.impl.FacetOperationImpl#getOverride <em>Override</em>}</li> + * </ul> + * </p> + * + * @generated + */ +public class FacetOperationImpl extends EOperationImpl implements FacetOperation { + /** + * The default value of the '{@link #getDocumentation() <em>Documentation</em>}' attribute. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @see #getDocumentation() + * @generated + * @ordered + */ + protected static final String DOCUMENTATION_EDEFAULT = null; + + /** + * The cached value of the '{@link #getDocumentation() <em>Documentation</em>}' attribute. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @see #getDocumentation() + * @generated + * @ordered + */ + protected String documentation = DOCUMENTATION_EDEFAULT; + + /** + * The cached value of the '{@link #getCategories() <em>Categories</em>}' reference list. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @see #getCategories() + * @generated + * @ordered + */ + protected EList<Category> categories; + + /** + * The cached value of the '{@link #getQuery() <em>Query</em>}' containment reference. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @see #getQuery() + * @generated + * @ordered + */ + protected Query query; + + /** + * The cached value of the '{@link #getOverride() <em>Override</em>}' reference. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @see #getOverride() + * @generated + * @ordered + */ + protected DerivedTypedElement override; + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + protected FacetOperationImpl() { + super(); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + protected EClass eStaticClass() { + return EFacetPackage.Literals.FACET_OPERATION; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public String getDocumentation() { + return documentation; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public void setDocumentation(String newDocumentation) { + String oldDocumentation = documentation; + documentation = newDocumentation; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.SET, EFacetPackage.FACET_OPERATION__DOCUMENTATION, oldDocumentation, documentation)); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public EList<Category> getCategories() { + if (categories == null) { + categories = new EObjectResolvingEList<Category>(Category.class, this, EFacetPackage.FACET_OPERATION__CATEGORIES); + } + return categories; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public Query getQuery() { + return query; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public NotificationChain basicSetQuery(Query newQuery, NotificationChain msgs) { + Query oldQuery = query; + query = newQuery; + if (eNotificationRequired()) { + ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, EFacetPackage.FACET_OPERATION__QUERY, oldQuery, newQuery); + if (msgs == null) msgs = notification; else msgs.add(notification); + } + return msgs; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public void setQuery(Query newQuery) { + if (newQuery != query) { + NotificationChain msgs = null; + if (query != null) + msgs = ((InternalEObject)query).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - EFacetPackage.FACET_OPERATION__QUERY, null, msgs); + if (newQuery != null) + msgs = ((InternalEObject)newQuery).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - EFacetPackage.FACET_OPERATION__QUERY, null, msgs); + msgs = basicSetQuery(newQuery, msgs); + if (msgs != null) msgs.dispatch(); + } + else if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.SET, EFacetPackage.FACET_OPERATION__QUERY, newQuery, newQuery)); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public DerivedTypedElement getOverride() { + if (override != null && override.eIsProxy()) { + InternalEObject oldOverride = (InternalEObject)override; + override = (DerivedTypedElement)eResolveProxy(oldOverride); + if (override != oldOverride) { + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.RESOLVE, EFacetPackage.FACET_OPERATION__OVERRIDE, oldOverride, override)); + } + } + return override; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public DerivedTypedElement basicGetOverride() { + return override; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public void setOverride(DerivedTypedElement newOverride) { + DerivedTypedElement oldOverride = override; + override = newOverride; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.SET, EFacetPackage.FACET_OPERATION__OVERRIDE, oldOverride, override)); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { + switch (featureID) { + case EFacetPackage.FACET_OPERATION__QUERY: + return basicSetQuery(null, msgs); + } + return super.eInverseRemove(otherEnd, featureID, msgs); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + public Object eGet(int featureID, boolean resolve, boolean coreType) { + switch (featureID) { + case EFacetPackage.FACET_OPERATION__DOCUMENTATION: + return getDocumentation(); + case EFacetPackage.FACET_OPERATION__CATEGORIES: + return getCategories(); + case EFacetPackage.FACET_OPERATION__QUERY: + return getQuery(); + case EFacetPackage.FACET_OPERATION__OVERRIDE: + if (resolve) return getOverride(); + return basicGetOverride(); + } + return super.eGet(featureID, resolve, coreType); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @SuppressWarnings("unchecked") + @Override + public void eSet(int featureID, Object newValue) { + switch (featureID) { + case EFacetPackage.FACET_OPERATION__DOCUMENTATION: + setDocumentation((String)newValue); + return; + case EFacetPackage.FACET_OPERATION__CATEGORIES: + getCategories().clear(); + getCategories().addAll((Collection<? extends Category>)newValue); + return; + case EFacetPackage.FACET_OPERATION__QUERY: + setQuery((Query)newValue); + return; + case EFacetPackage.FACET_OPERATION__OVERRIDE: + setOverride((DerivedTypedElement)newValue); + return; + } + super.eSet(featureID, newValue); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + public void eUnset(int featureID) { + switch (featureID) { + case EFacetPackage.FACET_OPERATION__DOCUMENTATION: + setDocumentation(DOCUMENTATION_EDEFAULT); + return; + case EFacetPackage.FACET_OPERATION__CATEGORIES: + getCategories().clear(); + return; + case EFacetPackage.FACET_OPERATION__QUERY: + setQuery((Query)null); + return; + case EFacetPackage.FACET_OPERATION__OVERRIDE: + setOverride((DerivedTypedElement)null); + return; + } + super.eUnset(featureID); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + public boolean eIsSet(int featureID) { + switch (featureID) { + case EFacetPackage.FACET_OPERATION__DOCUMENTATION: + return DOCUMENTATION_EDEFAULT == null ? documentation != null : !DOCUMENTATION_EDEFAULT.equals(documentation); + case EFacetPackage.FACET_OPERATION__CATEGORIES: + return categories != null && !categories.isEmpty(); + case EFacetPackage.FACET_OPERATION__QUERY: + return query != null; + case EFacetPackage.FACET_OPERATION__OVERRIDE: + return override != null; + } + return super.eIsSet(featureID); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + public int eBaseStructuralFeatureID(int derivedFeatureID, Class<?> baseClass) { + if (baseClass == DocumentedElement.class) { + switch (derivedFeatureID) { + case EFacetPackage.FACET_OPERATION__DOCUMENTATION: return EFacetPackage.DOCUMENTED_ELEMENT__DOCUMENTATION; + default: return -1; + } + } + if (baseClass == FacetElement.class) { + switch (derivedFeatureID) { + case EFacetPackage.FACET_OPERATION__CATEGORIES: return EFacetPackage.FACET_ELEMENT__CATEGORIES; + default: return -1; + } + } + if (baseClass == DerivedTypedElement.class) { + switch (derivedFeatureID) { + case EFacetPackage.FACET_OPERATION__QUERY: return EFacetPackage.DERIVED_TYPED_ELEMENT__QUERY; + case EFacetPackage.FACET_OPERATION__OVERRIDE: return EFacetPackage.DERIVED_TYPED_ELEMENT__OVERRIDE; + default: return -1; + } + } + return super.eBaseStructuralFeatureID(derivedFeatureID, baseClass); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + public int eDerivedStructuralFeatureID(int baseFeatureID, Class<?> baseClass) { + if (baseClass == DocumentedElement.class) { + switch (baseFeatureID) { + case EFacetPackage.DOCUMENTED_ELEMENT__DOCUMENTATION: return EFacetPackage.FACET_OPERATION__DOCUMENTATION; + default: return -1; + } + } + if (baseClass == FacetElement.class) { + switch (baseFeatureID) { + case EFacetPackage.FACET_ELEMENT__CATEGORIES: return EFacetPackage.FACET_OPERATION__CATEGORIES; + default: return -1; + } + } + if (baseClass == DerivedTypedElement.class) { + switch (baseFeatureID) { + case EFacetPackage.DERIVED_TYPED_ELEMENT__QUERY: return EFacetPackage.FACET_OPERATION__QUERY; + case EFacetPackage.DERIVED_TYPED_ELEMENT__OVERRIDE: return EFacetPackage.FACET_OPERATION__OVERRIDE; + default: return -1; + } + } + return super.eDerivedStructuralFeatureID(baseFeatureID, baseClass); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + public String toString() { + if (eIsProxy()) return super.toString(); + + StringBuffer result = new StringBuffer(super.toString()); + result.append(" (documentation: "); //$NON-NLS-1$ + result.append(documentation); + result.append(')'); + return result.toString(); + } + +} //FacetOperationImpl
diff --git a/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/modisco/facet/efacet/metamodel/v0_2_0/efacet/impl/FacetReferenceImpl.java b/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/modisco/facet/efacet/metamodel/v0_2_0/efacet/impl/FacetReferenceImpl.java new file mode 100644 index 0000000..96cc413 --- /dev/null +++ b/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/modisco/facet/efacet/metamodel/v0_2_0/efacet/impl/FacetReferenceImpl.java
@@ -0,0 +1,483 @@ +/** + * Copyright (c) 2011, 2015 Mia-Software, and Soft-Maint. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Gregoire Dupe (Mia-Software) - Design + * Nicolas Guyomar (Mia-Software) - Implementation + * Emmanuelle Rouillé (Mia-Software) - Bug 352618 - To be able to use non derived facet structural features and save them values. + * Nicolas Bros (Mia-Software) - Bug 361823 - [Restructuring] eFacet2 meta-model + * Gregoire Dupe (Mia-Software) - Bug 366055 - NavigationQuery + * Gregoire Dupe (Mia-Software) - Bug 369673 - [Facet] IsOneOfQuery + * Olivier Remaud (Soft-Maint) - Bug 369824 - Add a simple way to return string literal constants from a customization query + * Gregoire Dupe (Mia-Software) - Bug 369987 - [Restructuring][Table] Switch to the new customization and facet framework + * Gregoire Dupe (Mia-software) - Bug 364325 - [Restructuring] The user must be able to navigate into a model using the Facet. + * Nicolas Bros (Mia-Software) - Bug 372626 - [Facet] Aggregates + * Nicolas Bros (Mia-Software) - Bug 376941 - [EFacet] Facet operation arguments in Facet model + * Gregoire Dupe (Mia-Software) - Bug 376576 - [EFacet] Change the multiplicity of Facet::extendedFacet + * Jonathan Pepin (Soft-Maint) - Bug 463898 - Create FacetReference not derived, without query and with opposite mechanism + */ +package org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.impl; + +import java.util.Collection; + +import org.eclipse.emf.common.notify.Notification; +import org.eclipse.emf.common.notify.NotificationChain; +import org.eclipse.emf.common.util.EList; +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.InternalEObject; +import org.eclipse.emf.ecore.impl.ENotificationImpl; +import org.eclipse.emf.ecore.impl.EReferenceImpl; +import org.eclipse.emf.ecore.util.EObjectResolvingEList; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.Category; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.DerivedTypedElement; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.DocumentedElement; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.EFacetPackage; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.FacetElement; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.FacetReference; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.extensible.Query; + +/** + * <!-- begin-user-doc --> + * An implementation of the model object '<em><b>Facet Reference</b></em>'. + * <!-- end-user-doc --> + * <p> + * The following features are implemented: + * <ul> + * <li>{@link org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.impl.FacetReferenceImpl#getDocumentation <em>Documentation</em>}</li> + * <li>{@link org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.impl.FacetReferenceImpl#getCategories <em>Categories</em>}</li> + * <li>{@link org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.impl.FacetReferenceImpl#getQuery <em>Query</em>}</li> + * <li>{@link org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.impl.FacetReferenceImpl#getOverride <em>Override</em>}</li> + * <li>{@link org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.impl.FacetReferenceImpl#getFOpposite <em>FOpposite</em>}</li> + * </ul> + * </p> + * + * @generated + */ +public class FacetReferenceImpl extends EReferenceImpl implements FacetReference { + /** + * The default value of the '{@link #getDocumentation() <em>Documentation</em>}' attribute. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @see #getDocumentation() + * @generated + * @ordered + */ + protected static final String DOCUMENTATION_EDEFAULT = null; + + /** + * The cached value of the '{@link #getDocumentation() <em>Documentation</em>}' attribute. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @see #getDocumentation() + * @generated + * @ordered + */ + protected String documentation = DOCUMENTATION_EDEFAULT; + + /** + * The cached value of the '{@link #getCategories() <em>Categories</em>}' reference list. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @see #getCategories() + * @generated + * @ordered + */ + protected EList<Category> categories; + + /** + * The cached value of the '{@link #getQuery() <em>Query</em>}' containment reference. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @see #getQuery() + * @generated + * @ordered + */ + protected Query query; + + /** + * The cached value of the '{@link #getOverride() <em>Override</em>}' reference. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @see #getOverride() + * @generated + * @ordered + */ + protected DerivedTypedElement override; + + /** + * The cached value of the '{@link #getFOpposite() <em>FOpposite</em>}' reference. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @see #getFOpposite() + * @generated + * @ordered + */ + protected FacetReference fOpposite; + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + protected FacetReferenceImpl() { + super(); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + protected EClass eStaticClass() { + return EFacetPackage.Literals.FACET_REFERENCE; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public String getDocumentation() { + return documentation; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public void setDocumentation(String newDocumentation) { + String oldDocumentation = documentation; + documentation = newDocumentation; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.SET, EFacetPackage.FACET_REFERENCE__DOCUMENTATION, oldDocumentation, documentation)); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public EList<Category> getCategories() { + if (categories == null) { + categories = new EObjectResolvingEList<Category>(Category.class, this, EFacetPackage.FACET_REFERENCE__CATEGORIES); + } + return categories; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public Query getQuery() { + return query; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public NotificationChain basicSetQuery(Query newQuery, NotificationChain msgs) { + Query oldQuery = query; + query = newQuery; + if (eNotificationRequired()) { + ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, EFacetPackage.FACET_REFERENCE__QUERY, oldQuery, newQuery); + if (msgs == null) msgs = notification; else msgs.add(notification); + } + return msgs; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public void setQuery(Query newQuery) { + if (newQuery != query) { + NotificationChain msgs = null; + if (query != null) + msgs = ((InternalEObject)query).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - EFacetPackage.FACET_REFERENCE__QUERY, null, msgs); + if (newQuery != null) + msgs = ((InternalEObject)newQuery).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - EFacetPackage.FACET_REFERENCE__QUERY, null, msgs); + msgs = basicSetQuery(newQuery, msgs); + if (msgs != null) msgs.dispatch(); + } + else if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.SET, EFacetPackage.FACET_REFERENCE__QUERY, newQuery, newQuery)); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public DerivedTypedElement getOverride() { + if (override != null && override.eIsProxy()) { + InternalEObject oldOverride = (InternalEObject)override; + override = (DerivedTypedElement)eResolveProxy(oldOverride); + if (override != oldOverride) { + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.RESOLVE, EFacetPackage.FACET_REFERENCE__OVERRIDE, oldOverride, override)); + } + } + return override; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public DerivedTypedElement basicGetOverride() { + return override; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public void setOverride(DerivedTypedElement newOverride) { + DerivedTypedElement oldOverride = override; + override = newOverride; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.SET, EFacetPackage.FACET_REFERENCE__OVERRIDE, oldOverride, override)); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public FacetReference getFOpposite() { + if (fOpposite != null && fOpposite.eIsProxy()) { + InternalEObject oldFOpposite = (InternalEObject)fOpposite; + fOpposite = (FacetReference)eResolveProxy(oldFOpposite); + if (fOpposite != oldFOpposite) { + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.RESOLVE, EFacetPackage.FACET_REFERENCE__FOPPOSITE, oldFOpposite, fOpposite)); + } + } + return fOpposite; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public FacetReference basicGetFOpposite() { + return fOpposite; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public void setFOpposite(FacetReference newFOpposite) { + FacetReference oldFOpposite = fOpposite; + fOpposite = newFOpposite; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.SET, EFacetPackage.FACET_REFERENCE__FOPPOSITE, oldFOpposite, fOpposite)); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { + switch (featureID) { + case EFacetPackage.FACET_REFERENCE__QUERY: + return basicSetQuery(null, msgs); + } + return super.eInverseRemove(otherEnd, featureID, msgs); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + public Object eGet(int featureID, boolean resolve, boolean coreType) { + switch (featureID) { + case EFacetPackage.FACET_REFERENCE__DOCUMENTATION: + return getDocumentation(); + case EFacetPackage.FACET_REFERENCE__CATEGORIES: + return getCategories(); + case EFacetPackage.FACET_REFERENCE__QUERY: + return getQuery(); + case EFacetPackage.FACET_REFERENCE__OVERRIDE: + if (resolve) return getOverride(); + return basicGetOverride(); + case EFacetPackage.FACET_REFERENCE__FOPPOSITE: + if (resolve) return getFOpposite(); + return basicGetFOpposite(); + } + return super.eGet(featureID, resolve, coreType); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @SuppressWarnings("unchecked") + @Override + public void eSet(int featureID, Object newValue) { + switch (featureID) { + case EFacetPackage.FACET_REFERENCE__DOCUMENTATION: + setDocumentation((String)newValue); + return; + case EFacetPackage.FACET_REFERENCE__CATEGORIES: + getCategories().clear(); + getCategories().addAll((Collection<? extends Category>)newValue); + return; + case EFacetPackage.FACET_REFERENCE__QUERY: + setQuery((Query)newValue); + return; + case EFacetPackage.FACET_REFERENCE__OVERRIDE: + setOverride((DerivedTypedElement)newValue); + return; + case EFacetPackage.FACET_REFERENCE__FOPPOSITE: + setFOpposite((FacetReference)newValue); + return; + } + super.eSet(featureID, newValue); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + public void eUnset(int featureID) { + switch (featureID) { + case EFacetPackage.FACET_REFERENCE__DOCUMENTATION: + setDocumentation(DOCUMENTATION_EDEFAULT); + return; + case EFacetPackage.FACET_REFERENCE__CATEGORIES: + getCategories().clear(); + return; + case EFacetPackage.FACET_REFERENCE__QUERY: + setQuery((Query)null); + return; + case EFacetPackage.FACET_REFERENCE__OVERRIDE: + setOverride((DerivedTypedElement)null); + return; + case EFacetPackage.FACET_REFERENCE__FOPPOSITE: + setFOpposite((FacetReference)null); + return; + } + super.eUnset(featureID); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + public boolean eIsSet(int featureID) { + switch (featureID) { + case EFacetPackage.FACET_REFERENCE__DOCUMENTATION: + return DOCUMENTATION_EDEFAULT == null ? documentation != null : !DOCUMENTATION_EDEFAULT.equals(documentation); + case EFacetPackage.FACET_REFERENCE__CATEGORIES: + return categories != null && !categories.isEmpty(); + case EFacetPackage.FACET_REFERENCE__QUERY: + return query != null; + case EFacetPackage.FACET_REFERENCE__OVERRIDE: + return override != null; + case EFacetPackage.FACET_REFERENCE__FOPPOSITE: + return fOpposite != null; + } + return super.eIsSet(featureID); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + public int eBaseStructuralFeatureID(int derivedFeatureID, Class<?> baseClass) { + if (baseClass == DocumentedElement.class) { + switch (derivedFeatureID) { + case EFacetPackage.FACET_REFERENCE__DOCUMENTATION: return EFacetPackage.DOCUMENTED_ELEMENT__DOCUMENTATION; + default: return -1; + } + } + if (baseClass == FacetElement.class) { + switch (derivedFeatureID) { + case EFacetPackage.FACET_REFERENCE__CATEGORIES: return EFacetPackage.FACET_ELEMENT__CATEGORIES; + default: return -1; + } + } + if (baseClass == DerivedTypedElement.class) { + switch (derivedFeatureID) { + case EFacetPackage.FACET_REFERENCE__QUERY: return EFacetPackage.DERIVED_TYPED_ELEMENT__QUERY; + case EFacetPackage.FACET_REFERENCE__OVERRIDE: return EFacetPackage.DERIVED_TYPED_ELEMENT__OVERRIDE; + default: return -1; + } + } + return super.eBaseStructuralFeatureID(derivedFeatureID, baseClass); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + public int eDerivedStructuralFeatureID(int baseFeatureID, Class<?> baseClass) { + if (baseClass == DocumentedElement.class) { + switch (baseFeatureID) { + case EFacetPackage.DOCUMENTED_ELEMENT__DOCUMENTATION: return EFacetPackage.FACET_REFERENCE__DOCUMENTATION; + default: return -1; + } + } + if (baseClass == FacetElement.class) { + switch (baseFeatureID) { + case EFacetPackage.FACET_ELEMENT__CATEGORIES: return EFacetPackage.FACET_REFERENCE__CATEGORIES; + default: return -1; + } + } + if (baseClass == DerivedTypedElement.class) { + switch (baseFeatureID) { + case EFacetPackage.DERIVED_TYPED_ELEMENT__QUERY: return EFacetPackage.FACET_REFERENCE__QUERY; + case EFacetPackage.DERIVED_TYPED_ELEMENT__OVERRIDE: return EFacetPackage.FACET_REFERENCE__OVERRIDE; + default: return -1; + } + } + return super.eDerivedStructuralFeatureID(baseFeatureID, baseClass); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + public String toString() { + if (eIsProxy()) return super.toString(); + + StringBuffer result = new StringBuffer(super.toString()); + result.append(" (documentation: "); //$NON-NLS-1$ + result.append(documentation); + result.append(')'); + return result.toString(); + } + +} //FacetReferenceImpl
diff --git a/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/modisco/facet/efacet/metamodel/v0_2_0/efacet/impl/FacetSetImpl.java b/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/modisco/facet/efacet/metamodel/v0_2_0/efacet/impl/FacetSetImpl.java new file mode 100644 index 0000000..49d1188 --- /dev/null +++ b/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/modisco/facet/efacet/metamodel/v0_2_0/efacet/impl/FacetSetImpl.java
@@ -0,0 +1,318 @@ +/** + * Copyright (c) 2011 Mia-Software. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Gregoire Dupe (Mia-Software) - Design + * Nicolas Guyomar (Mia-Software) - Implementation + * Emmanuelle Rouillé (Mia-Software) - Bug 352618 - To be able to use non derived facet structural features and save them values. + * Nicolas Bros (Mia-Software) - Bug 361823 - [Restructuring] eFacet2 meta-model + * Gregoire Dupe (Mia-Software) - Bug 369987 - [Restructuring][Table] Switch to the new customization and facet framework + * Gregoire Dupe (Mia-Software) - Bug 373078 - API Cleaning + */ +package org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.impl; + +import java.util.Collection; +import java.util.Collections; + +import org.eclipse.emf.common.notify.Notification; +import org.eclipse.emf.common.notify.NotificationChain; +import org.eclipse.emf.common.util.BasicEList; +import org.eclipse.emf.common.util.EList; +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.EClassifier; +import org.eclipse.emf.ecore.EPackage; +import org.eclipse.emf.ecore.InternalEObject; +import org.eclipse.emf.ecore.impl.ENotificationImpl; +import org.eclipse.emf.ecore.impl.EPackageImpl; +import org.eclipse.emf.ecore.util.EObjectContainmentEList; +import org.eclipse.emf.ecore.util.InternalEList; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.Category; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.DocumentedElement; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.EFacetPackage; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.Facet; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.FacetSet; + +/** + * <!-- begin-user-doc --> + * An implementation of the model object '<em><b>Facet Set</b></em>'. + * <!-- end-user-doc --> + * <p> + * The following features are implemented: + * <ul> + * <li>{@link org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.impl.FacetSetImpl#getDocumentation <em>Documentation</em>}</li> + * <li>{@link org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.impl.FacetSetImpl#getCategories <em>Categories</em>}</li> + * </ul> + * </p> + * + * @generated + */ +public class FacetSetImpl extends EPackageImpl implements FacetSet { + /** + * The default value of the '{@link #getDocumentation() <em>Documentation</em>}' attribute. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @see #getDocumentation() + * @generated + * @ordered + */ + protected static final String DOCUMENTATION_EDEFAULT = null; + + /** + * The cached value of the '{@link #getDocumentation() <em>Documentation</em>}' attribute. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @see #getDocumentation() + * @generated + * @ordered + */ + protected String documentation = DOCUMENTATION_EDEFAULT; + + /** + * The cached value of the '{@link #getCategories() <em>Categories</em>}' containment reference list. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @see #getCategories() + * @generated + * @ordered + */ + protected EList<Category> categories; + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + protected FacetSetImpl() { + super(); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + protected EClass eStaticClass() { + return EFacetPackage.Literals.FACET_SET; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public String getDocumentation() { + return documentation; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public void setDocumentation(String newDocumentation) { + String oldDocumentation = documentation; + documentation = newDocumentation; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.SET, EFacetPackage.FACET_SET__DOCUMENTATION, oldDocumentation, documentation)); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated NOT + */ + public EList<Facet> getFacets() { + EList<Facet> facets = new BasicEList<Facet>(); + for(EClassifier eClassifier : this.getEClassifiers()){ + if (eClassifier instanceof Facet) { + Facet facet = (Facet) eClassifier; + facets.add(facet); + } + } + return facets; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public EList<Category> getCategories() { + if (categories == null) { + categories = new EObjectContainmentEList<Category>(Category.class, this, EFacetPackage.FACET_SET__CATEGORIES); + } + return categories; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated NOT + */ + public EPackage basicGetExtendedEPackage() { + EList<Facet> facets = getFacets(); + EPackage result = null; + for (Facet facet : facets) { + EClass extendedMetaclass = facet.getExtendedMetaclass(); + if (extendedMetaclass != null) { + EPackage ePackage = extendedMetaclass.getEPackage(); + if (ePackage != null) { + if (result != null && ePackage != result) { + throw new IllegalStateException("The Facets in a FacetSet must all extend EClasses from the same EPackage"); + } + result = ePackage; + } + } + } + return result; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated NOT + */ + public EList<FacetSet> getFacetSets() { + return new BasicEList<FacetSet>(); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { + switch (featureID) { + case EFacetPackage.FACET_SET__CATEGORIES: + return ((InternalEList<?>)getCategories()).basicRemove(otherEnd, msgs); + } + return super.eInverseRemove(otherEnd, featureID, msgs); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + public Object eGet(int featureID, boolean resolve, boolean coreType) { + switch (featureID) { + case EFacetPackage.FACET_SET__DOCUMENTATION: + return getDocumentation(); + case EFacetPackage.FACET_SET__CATEGORIES: + return getCategories(); + } + return super.eGet(featureID, resolve, coreType); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @SuppressWarnings("unchecked") + @Override + public void eSet(int featureID, Object newValue) { + switch (featureID) { + case EFacetPackage.FACET_SET__DOCUMENTATION: + setDocumentation((String)newValue); + return; + case EFacetPackage.FACET_SET__CATEGORIES: + getCategories().clear(); + getCategories().addAll((Collection<? extends Category>)newValue); + return; + } + super.eSet(featureID, newValue); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + public void eUnset(int featureID) { + switch (featureID) { + case EFacetPackage.FACET_SET__DOCUMENTATION: + setDocumentation(DOCUMENTATION_EDEFAULT); + return; + case EFacetPackage.FACET_SET__CATEGORIES: + getCategories().clear(); + return; + } + super.eUnset(featureID); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + public boolean eIsSet(int featureID) { + switch (featureID) { + case EFacetPackage.FACET_SET__DOCUMENTATION: + return DOCUMENTATION_EDEFAULT == null ? documentation != null : !DOCUMENTATION_EDEFAULT.equals(documentation); + case EFacetPackage.FACET_SET__CATEGORIES: + return categories != null && !categories.isEmpty(); + } + return super.eIsSet(featureID); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + public int eBaseStructuralFeatureID(int derivedFeatureID, Class<?> baseClass) { + if (baseClass == DocumentedElement.class) { + switch (derivedFeatureID) { + case EFacetPackage.FACET_SET__DOCUMENTATION: return EFacetPackage.DOCUMENTED_ELEMENT__DOCUMENTATION; + default: return -1; + } + } + return super.eBaseStructuralFeatureID(derivedFeatureID, baseClass); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + public int eDerivedStructuralFeatureID(int baseFeatureID, Class<?> baseClass) { + if (baseClass == DocumentedElement.class) { + switch (baseFeatureID) { + case EFacetPackage.DOCUMENTED_ELEMENT__DOCUMENTATION: return EFacetPackage.FACET_SET__DOCUMENTATION; + default: return -1; + } + } + return super.eDerivedStructuralFeatureID(baseFeatureID, baseClass); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + public String toString() { + if (eIsProxy()) return super.toString(); + + StringBuffer result = new StringBuffer(super.toString()); + result.append(" (documentation: "); //$NON-NLS-1$ + result.append(documentation); + result.append(')'); + return result.toString(); + } + +} //FacetSetImpl
diff --git a/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/modisco/facet/efacet/metamodel/v0_2_0/efacet/impl/ParameterValueImpl.java b/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/modisco/facet/efacet/metamodel/v0_2_0/efacet/impl/ParameterValueImpl.java new file mode 100644 index 0000000..e28b9df --- /dev/null +++ b/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/modisco/facet/efacet/metamodel/v0_2_0/efacet/impl/ParameterValueImpl.java
@@ -0,0 +1,234 @@ +/** + * Copyright (c) 2011 Mia-Software. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Gregoire Dupe (Mia-Software) - Design + * Nicolas Guyomar (Mia-Software) - Implementation + * Emmanuelle Rouillé (Mia-Software) - Bug 352618 - To be able to use non derived facet structural features and save them values. + * Nicolas Bros (Mia-Software) - Bug 361823 - [Restructuring] eFacet2 meta-model + */ +package org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.impl; + +import org.eclipse.emf.common.notify.Notification; +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.EParameter; +import org.eclipse.emf.ecore.InternalEObject; +import org.eclipse.emf.ecore.impl.ENotificationImpl; +import org.eclipse.emf.ecore.impl.EObjectImpl; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.EFacetPackage; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.ParameterValue; + +/** + * <!-- begin-user-doc --> + * An implementation of the model object '<em><b>Parameter Value</b></em>'. + * <!-- end-user-doc --> + * <p> + * The following features are implemented: + * <ul> + * <li>{@link org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.impl.ParameterValueImpl#getParameter <em>Parameter</em>}</li> + * <li>{@link org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.impl.ParameterValueImpl#getValue <em>Value</em>}</li> + * </ul> + * </p> + * + * @generated + */ +public class ParameterValueImpl extends EObjectImpl implements ParameterValue { + /** + * The cached value of the '{@link #getParameter() <em>Parameter</em>}' reference. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @see #getParameter() + * @generated + * @ordered + */ + protected EParameter parameter; + + /** + * The default value of the '{@link #getValue() <em>Value</em>}' attribute. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @see #getValue() + * @generated + * @ordered + */ + protected static final Object VALUE_EDEFAULT = null; + + /** + * The cached value of the '{@link #getValue() <em>Value</em>}' attribute. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @see #getValue() + * @generated + * @ordered + */ + protected Object value = VALUE_EDEFAULT; + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + protected ParameterValueImpl() { + super(); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + protected EClass eStaticClass() { + return EFacetPackage.Literals.PARAMETER_VALUE; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public EParameter getParameter() { + if (parameter != null && parameter.eIsProxy()) { + InternalEObject oldParameter = (InternalEObject)parameter; + parameter = (EParameter)eResolveProxy(oldParameter); + if (parameter != oldParameter) { + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.RESOLVE, EFacetPackage.PARAMETER_VALUE__PARAMETER, oldParameter, parameter)); + } + } + return parameter; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public EParameter basicGetParameter() { + return parameter; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public void setParameter(EParameter newParameter) { + EParameter oldParameter = parameter; + parameter = newParameter; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.SET, EFacetPackage.PARAMETER_VALUE__PARAMETER, oldParameter, parameter)); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public Object getValue() { + return value; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public void setValue(Object newValue) { + Object oldValue = value; + value = newValue; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.SET, EFacetPackage.PARAMETER_VALUE__VALUE, oldValue, value)); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + public Object eGet(int featureID, boolean resolve, boolean coreType) { + switch (featureID) { + case EFacetPackage.PARAMETER_VALUE__PARAMETER: + if (resolve) return getParameter(); + return basicGetParameter(); + case EFacetPackage.PARAMETER_VALUE__VALUE: + return getValue(); + } + return super.eGet(featureID, resolve, coreType); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + public void eSet(int featureID, Object newValue) { + switch (featureID) { + case EFacetPackage.PARAMETER_VALUE__PARAMETER: + setParameter((EParameter)newValue); + return; + case EFacetPackage.PARAMETER_VALUE__VALUE: + setValue(newValue); + return; + } + super.eSet(featureID, newValue); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + public void eUnset(int featureID) { + switch (featureID) { + case EFacetPackage.PARAMETER_VALUE__PARAMETER: + setParameter((EParameter)null); + return; + case EFacetPackage.PARAMETER_VALUE__VALUE: + setValue(VALUE_EDEFAULT); + return; + } + super.eUnset(featureID); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + public boolean eIsSet(int featureID) { + switch (featureID) { + case EFacetPackage.PARAMETER_VALUE__PARAMETER: + return parameter != null; + case EFacetPackage.PARAMETER_VALUE__VALUE: + return VALUE_EDEFAULT == null ? value != null : !VALUE_EDEFAULT.equals(value); + } + return super.eIsSet(featureID); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + public String toString() { + if (eIsProxy()) return super.toString(); + + StringBuffer result = new StringBuffer(super.toString()); + result.append(" (value: "); //$NON-NLS-1$ + result.append(value); + result.append(')'); + return result.toString(); + } + +} //ParameterValueImpl
diff --git a/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/modisco/facet/efacet/metamodel/v0_2_0/efacet/query/EObjectLiteralQuery.java b/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/modisco/facet/efacet/metamodel/v0_2_0/efacet/query/EObjectLiteralQuery.java new file mode 100644 index 0000000..3626cb7 --- /dev/null +++ b/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/modisco/facet/efacet/metamodel/v0_2_0/efacet/query/EObjectLiteralQuery.java
@@ -0,0 +1,72 @@ +/** + * Copyright (c) 2011-2012 Mia-Software. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Gregoire Dupe (Mia-Software) - Design + * Nicolas Guyomar (Mia-Software) - Implementation + * Emmanuelle Rouillé (Mia-Software) - Bug 352618 - To be able to use non derived facet structural features and save them values. + * Nicolas Bros (Mia-Software) - Bug 361823 - [Restructuring] eFacet2 meta-model + * Gregoire Dupe (Mia-Software) - Bug 366055 - NavigationQuery + * Gregoire Dupe (Mia-Software) - Bug 369673 - [Facet] IsOneOfQuery + * Olivier Remaud (Soft-Maint) - Bug 369824 - Add a simple way to return string literal constants from a customization query + * Gregoire Dupe (Mia-Software) - Bug 369987 - [Restructuring][Table] Switch to the new customization and facet framework + * Gregoire Dupe (Mia-software) - Bug 364325 - [Restructuring] The user must be able to navigate into a model using the Facet. + * Nicolas Bros (Mia-Software) - Bug 372626 - [Facet] Aggregates + * Nicolas Bros (Mia-Software) - Bug 376941 - [EFacet] Facet operation arguments in Facet model + * + */ +package org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.query; + +import org.eclipse.emf.ecore.EObject; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.extensible.Query; + +/** + * <!-- begin-user-doc --> + * A representation of the model object '<em><b>EObject Literal Query</b></em>'. + * <!-- end-user-doc --> + * + * <p> + * The following features are supported: + * <ul> + * <li>{@link org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.query.EObjectLiteralQuery#getElement <em>Element</em>}</li> + * </ul> + * </p> + * + * @see org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.query.QueryPackage#getEObjectLiteralQuery() + * @model + * @generated + * @since 0.2 + */ +public interface EObjectLiteralQuery extends Query { + /** + * Returns the value of the '<em><b>Element</b></em>' reference. + * <!-- begin-user-doc --> + * <p> + * If the meaning of the '<em>Element</em>' reference isn't clear, + * there really should be more of a description here... + * </p> + * <!-- end-user-doc --> + * @return the value of the '<em>Element</em>' reference. + * @see #setElement(EObject) + * @see org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.query.QueryPackage#getEObjectLiteralQuery_Element() + * @model + * @generated + */ + EObject getElement(); + + /** + * Sets the value of the '{@link org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.query.EObjectLiteralQuery#getElement <em>Element</em>}' reference. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @param value the new value of the '<em>Element</em>' reference. + * @see #getElement() + * @generated + */ + void setElement(EObject value); + +} // EObjectLiteralQuery
diff --git a/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/modisco/facet/efacet/metamodel/v0_2_0/efacet/query/FalseLiteralQuery.java b/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/modisco/facet/efacet/metamodel/v0_2_0/efacet/query/FalseLiteralQuery.java new file mode 100644 index 0000000..f5e9f72 --- /dev/null +++ b/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/modisco/facet/efacet/metamodel/v0_2_0/efacet/query/FalseLiteralQuery.java
@@ -0,0 +1,38 @@ +/** + * Copyright (c) 2011 Mia-Software. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Gregoire Dupe (Mia-Software) - Design + * Nicolas Guyomar (Mia-Software) - Implementation + * Emmanuelle Rouillé (Mia-Software) - Bug 352618 - To be able to use non derived facet structural features and save them values. + * Nicolas Bros (Mia-Software) - Bug 361823 - [Restructuring] eFacet2 meta-model + * Gregoire Dupe (Mia-Software) - Bug 366055 - NavigationQuery + * Gregoire Dupe (Mia-Software) - Bug 369673 - [Facet] IsOneOfQuery + * Olivier Remaud (Soft-Maint) - Bug 369824 - Add a simple way to return string literal constants from a customization query + * Gregoire Dupe (Mia-software) - Bug 369987 - [Restructuring][Table] Switch to the new customization and facet framework + */ +package org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.query; + +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.extensible.Query; + +/** + * <!-- begin-user-doc --> + * A representation of the model object '<em><b>False Literal Query</b></em>'. + * <!-- end-user-doc --> + * + * <!-- begin-model-doc --> + * This query retrun false. + * <!-- end-model-doc --> + * + * + * @see org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.query.QueryPackage#getFalseLiteralQuery() + * @model + * @generated + */ +public interface FalseLiteralQuery extends Query { +} // FalseLiteralQuery
diff --git a/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/modisco/facet/efacet/metamodel/v0_2_0/efacet/query/FloatLiteralQuery.java b/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/modisco/facet/efacet/metamodel/v0_2_0/efacet/query/FloatLiteralQuery.java new file mode 100644 index 0000000..28f1810 --- /dev/null +++ b/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/modisco/facet/efacet/metamodel/v0_2_0/efacet/query/FloatLiteralQuery.java
@@ -0,0 +1,71 @@ +/** + * Copyright (c) 2011-2012 Mia-Software. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Gregoire Dupe (Mia-Software) - Design + * Nicolas Guyomar (Mia-Software) - Implementation + * Emmanuelle Rouillé (Mia-Software) - Bug 352618 - To be able to use non derived facet structural features and save them values. + * Nicolas Bros (Mia-Software) - Bug 361823 - [Restructuring] eFacet2 meta-model + * Gregoire Dupe (Mia-Software) - Bug 366055 - NavigationQuery + * Gregoire Dupe (Mia-Software) - Bug 369673 - [Facet] IsOneOfQuery + * Olivier Remaud (Soft-Maint) - Bug 369824 - Add a simple way to return string literal constants from a customization query + * Gregoire Dupe (Mia-Software) - Bug 369987 - [Restructuring][Table] Switch to the new customization and facet framework + * Gregoire Dupe (Mia-software) - Bug 364325 - [Restructuring] The user must be able to navigate into a model using the Facet. + * Nicolas Bros (Mia-Software) - Bug 372626 - [Facet] Aggregates + * Nicolas Bros (Mia-Software) - Bug 376941 - [EFacet] Facet operation arguments in Facet model + * + */ +package org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.query; + +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.extensible.Query; + +/** + * <!-- begin-user-doc --> + * A representation of the model object '<em><b>Float Literal Query</b></em>'. + * <!-- end-user-doc --> + * + * <p> + * The following features are supported: + * <ul> + * <li>{@link org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.query.FloatLiteralQuery#getValue <em>Value</em>}</li> + * </ul> + * </p> + * + * @see org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.query.QueryPackage#getFloatLiteralQuery() + * @model + * @generated + * @since 0.2 + */ +public interface FloatLiteralQuery extends Query { + /** + * Returns the value of the '<em><b>Value</b></em>' attribute. + * <!-- begin-user-doc --> + * <p> + * If the meaning of the '<em>Value</em>' attribute isn't clear, + * there really should be more of a description here... + * </p> + * <!-- end-user-doc --> + * @return the value of the '<em>Value</em>' attribute. + * @see #setValue(float) + * @see org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.query.QueryPackage#getFloatLiteralQuery_Value() + * @model + * @generated + */ + float getValue(); + + /** + * Sets the value of the '{@link org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.query.FloatLiteralQuery#getValue <em>Value</em>}' attribute. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @param value the new value of the '<em>Value</em>' attribute. + * @see #getValue() + * @generated + */ + void setValue(float value); + +} // FloatLiteralQuery
diff --git a/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/modisco/facet/efacet/metamodel/v0_2_0/efacet/query/IntegerLiteralQuery.java b/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/modisco/facet/efacet/metamodel/v0_2_0/efacet/query/IntegerLiteralQuery.java new file mode 100644 index 0000000..f74251a --- /dev/null +++ b/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/modisco/facet/efacet/metamodel/v0_2_0/efacet/query/IntegerLiteralQuery.java
@@ -0,0 +1,71 @@ +/** + * Copyright (c) 2011-2012 Mia-Software. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Gregoire Dupe (Mia-Software) - Design + * Nicolas Guyomar (Mia-Software) - Implementation + * Emmanuelle Rouillé (Mia-Software) - Bug 352618 - To be able to use non derived facet structural features and save them values. + * Nicolas Bros (Mia-Software) - Bug 361823 - [Restructuring] eFacet2 meta-model + * Gregoire Dupe (Mia-Software) - Bug 366055 - NavigationQuery + * Gregoire Dupe (Mia-Software) - Bug 369673 - [Facet] IsOneOfQuery + * Olivier Remaud (Soft-Maint) - Bug 369824 - Add a simple way to return string literal constants from a customization query + * Gregoire Dupe (Mia-Software) - Bug 369987 - [Restructuring][Table] Switch to the new customization and facet framework + * Gregoire Dupe (Mia-software) - Bug 364325 - [Restructuring] The user must be able to navigate into a model using the Facet. + * Nicolas Bros (Mia-Software) - Bug 372626 - [Facet] Aggregates + * Nicolas Bros (Mia-Software) - Bug 376941 - [EFacet] Facet operation arguments in Facet model + * + */ +package org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.query; + +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.extensible.Query; + +/** + * <!-- begin-user-doc --> + * A representation of the model object '<em><b>Integer Literal Query</b></em>'. + * <!-- end-user-doc --> + * + * <p> + * The following features are supported: + * <ul> + * <li>{@link org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.query.IntegerLiteralQuery#getValue <em>Value</em>}</li> + * </ul> + * </p> + * + * @see org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.query.QueryPackage#getIntegerLiteralQuery() + * @model + * @generated + * @since 0.2 + */ +public interface IntegerLiteralQuery extends Query { + /** + * Returns the value of the '<em><b>Value</b></em>' attribute. + * <!-- begin-user-doc --> + * <p> + * If the meaning of the '<em>Value</em>' attribute isn't clear, + * there really should be more of a description here... + * </p> + * <!-- end-user-doc --> + * @return the value of the '<em>Value</em>' attribute. + * @see #setValue(int) + * @see org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.query.QueryPackage#getIntegerLiteralQuery_Value() + * @model + * @generated + */ + int getValue(); + + /** + * Sets the value of the '{@link org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.query.IntegerLiteralQuery#getValue <em>Value</em>}' attribute. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @param value the new value of the '<em>Value</em>' attribute. + * @see #getValue() + * @generated + */ + void setValue(int value); + +} // IntegerLiteralQuery
diff --git a/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/modisco/facet/efacet/metamodel/v0_2_0/efacet/query/IsOneOfQuery.java b/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/modisco/facet/efacet/metamodel/v0_2_0/efacet/query/IsOneOfQuery.java new file mode 100644 index 0000000..7d34fa1 --- /dev/null +++ b/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/modisco/facet/efacet/metamodel/v0_2_0/efacet/query/IsOneOfQuery.java
@@ -0,0 +1,61 @@ +/** + * Copyright (c) 2012 Mia-Software. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Gregoire Dupe (Mia-Software) - Design + * Nicolas Guyomar (Mia-Software) - Implementation + * Emmanuelle Rouillé (Mia-Software) - Bug 352618 - To be able to use non derived facet structural features and save them values. + * Nicolas Bros (Mia-Software) - Bug 361823 - [Restructuring] eFacet2 meta-model + * Gregoire Dupe (Mia-Software) - Bug 366055 - NavigationQuery + * Gregoire Dupe (Mia-Software) - Bug 369673 - [Facet] IsOneOfQuery + * Gregoire Dupe (Mia-Software) - Bug 369987 - [Restructuring][Table] Switch to the new customization and facet framework + */ +package org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.query; + +import org.eclipse.emf.common.util.EList; +import org.eclipse.emf.ecore.EObject; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.extensible.Query; + +/** + * <!-- begin-user-doc --> + * A representation of the model object '<em><b>Is One Of Query</b></em>'. + * <!-- end-user-doc --> + * + * <!-- begin-model-doc --> + * This query returns true if the source of the query is contained in a list of eObject handled by the referennce 'expectedEObjects'. + * <!-- end-model-doc --> + * + * <p> + * The following features are supported: + * <ul> + * <li>{@link org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.query.IsOneOfQuery#getExpectedEObjects <em>Expected EObjects</em>}</li> + * </ul> + * </p> + * + * @see org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.query.QueryPackage#getIsOneOfQuery() + * @model + * @generated + */ +public interface IsOneOfQuery extends Query { + /** + * Returns the value of the '<em><b>Expected EObjects</b></em>' reference list. + * The list contents are of type {@link org.eclipse.emf.ecore.EObject}. + * <!-- begin-user-doc --> + * <p> + * If the meaning of the '<em>Expected EObjects</em>' reference list isn't clear, + * there really should be more of a description here... + * </p> + * <!-- end-user-doc --> + * @return the value of the '<em>Expected EObjects</em>' reference list. + * @see org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.query.QueryPackage#getIsOneOfQuery_ExpectedEObjects() + * @model + * @generated + */ + EList<EObject> getExpectedEObjects(); + +} // IsOneOfQuery
diff --git a/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/modisco/facet/efacet/metamodel/v0_2_0/efacet/query/NavigationQuery.java b/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/modisco/facet/efacet/metamodel/v0_2_0/efacet/query/NavigationQuery.java new file mode 100644 index 0000000..4ff9ff4 --- /dev/null +++ b/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/modisco/facet/efacet/metamodel/v0_2_0/efacet/query/NavigationQuery.java
@@ -0,0 +1,87 @@ +/** + * Copyright (c) 2011 Mia-Software. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Gregoire Dupe (Mia-Software) - Design + * Nicolas Guyomar (Mia-Software) - Implementation + * Emmanuelle Rouillé (Mia-Software) - Bug 352618 - To be able to use non derived facet structural features and save them values. + * Nicolas Bros (Mia-Software) - Bug 361823 - [Restructuring] eFacet2 meta-model + * Gregoire Dupe (Mia-Software) - Bug 366055 - NavigationQuery + */ +package org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.query; + +import org.eclipse.emf.common.util.EList; +import org.eclipse.emf.ecore.ETypedElement; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.extensible.Query; + +/** + * <!-- begin-user-doc --> + * A representation of the model object '<em><b>Navigation Query</b></em>'. + * <!-- end-user-doc --> + * + * <!-- begin-model-doc --> + * This query points to a typed element (another attribute, reference or operation for example) that lends it value to the query. + * <!-- end-model-doc --> + * + * <p> + * The following features are supported: + * <ul> + * <li>{@link org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.query.NavigationQuery#getPath <em>Path</em>}</li> + * <li>{@link org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.query.NavigationQuery#isFailOnError <em>Fail On Error</em>}</li> + * </ul> + * </p> + * + * @see org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.query.QueryPackage#getNavigationQuery() + * @model + * @generated + */ +public interface NavigationQuery extends Query { + /** + * Returns the value of the '<em><b>Path</b></em>' reference list. + * The list contents are of type {@link org.eclipse.emf.ecore.ETypedElement}. + * <!-- begin-user-doc --> + * <p> + * If the meaning of the '<em>Path</em>' reference list isn't clear, + * there really should be more of a description here... + * </p> + * <!-- end-user-doc --> + * @return the value of the '<em>Path</em>' reference list. + * @see org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.query.QueryPackage#getNavigationQuery_Path() + * @model required="true" + * @generated + */ + EList<ETypedElement> getPath(); + + /** + * Returns the value of the '<em><b>Fail On Error</b></em>' attribute. + * The default value is <code>"true"</code>. + * <!-- begin-user-doc --> + * <p> + * If the meaning of the '<em>Fail On Error</em>' attribute isn't clear, + * there really should be more of a description here... + * </p> + * <!-- end-user-doc --> + * @return the value of the '<em>Fail On Error</em>' attribute. + * @see #setFailOnError(boolean) + * @see org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.query.QueryPackage#getNavigationQuery_FailOnError() + * @model default="true" + * @generated + */ + boolean isFailOnError(); + + /** + * Sets the value of the '{@link org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.query.NavigationQuery#isFailOnError <em>Fail On Error</em>}' attribute. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @param value the new value of the '<em>Fail On Error</em>' attribute. + * @see #isFailOnError() + * @generated + */ + void setFailOnError(boolean value); + +} // NavigationQuery
diff --git a/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/modisco/facet/efacet/metamodel/v0_2_0/efacet/query/NullLiteralQuery.java b/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/modisco/facet/efacet/metamodel/v0_2_0/efacet/query/NullLiteralQuery.java new file mode 100644 index 0000000..19032e3 --- /dev/null +++ b/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/modisco/facet/efacet/metamodel/v0_2_0/efacet/query/NullLiteralQuery.java
@@ -0,0 +1,39 @@ +/** + * Copyright (c) 2011 Mia-Software. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Gregoire Dupe (Mia-Software) - Design + * Nicolas Guyomar (Mia-Software) - Implementation + * Emmanuelle Rouillé (Mia-Software) - Bug 352618 - To be able to use non derived facet structural features and save them values. + * Nicolas Bros (Mia-Software) - Bug 361823 - [Restructuring] eFacet2 meta-model + * Gregoire Dupe (Mia-Software) - Bug 366055 - NavigationQuery + * Gregoire Dupe (Mia-Software) - Bug 369673 - [Facet] IsOneOfQuery + * Olivier Remaud (Soft-Maint) - Bug 369824 - Add a simple way to return string literal constants from a customization query + * Gregoire Dupe (Mia-software) - Bug 369987 - [Restructuring][Table] Switch to the new customization and facet framework + * Gregoire Dupe (Mia-Software) - Bug 369987 - [Restructuring][Table] Switch to the new customization and facet framework + */ +package org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.query; + +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.extensible.Query; + +/** + * <!-- begin-user-doc --> + * A representation of the model object '<em><b>Null Literal Query</b></em>'. + * <!-- end-user-doc --> + * + * <!-- begin-model-doc --> + * This query retrun null. + * <!-- end-model-doc --> + * + * + * @see org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.query.QueryPackage#getNullLiteralQuery() + * @model + * @generated + */ +public interface NullLiteralQuery extends Query { +} // NullLiteralQuery
diff --git a/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/modisco/facet/efacet/metamodel/v0_2_0/efacet/query/OperationCallQuery.java b/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/modisco/facet/efacet/metamodel/v0_2_0/efacet/query/OperationCallQuery.java new file mode 100644 index 0000000..b8a8ad3 --- /dev/null +++ b/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/modisco/facet/efacet/metamodel/v0_2_0/efacet/query/OperationCallQuery.java
@@ -0,0 +1,93 @@ +/** + * Copyright (c) 2011-2012 Mia-Software. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Gregoire Dupe (Mia-Software) - Design + * Nicolas Guyomar (Mia-Software) - Implementation + * Emmanuelle Rouillé (Mia-Software) - Bug 352618 - To be able to use non derived facet structural features and save them values. + * Nicolas Bros (Mia-Software) - Bug 361823 - [Restructuring] eFacet2 meta-model + * Gregoire Dupe (Mia-Software) - Bug 366055 - NavigationQuery + * Gregoire Dupe (Mia-Software) - Bug 369673 - [Facet] IsOneOfQuery + * Olivier Remaud (Soft-Maint) - Bug 369824 - Add a simple way to return string literal constants from a customization query + * Gregoire Dupe (Mia-Software) - Bug 369987 - [Restructuring][Table] Switch to the new customization and facet framework + * Gregoire Dupe (Mia-software) - Bug 364325 - [Restructuring] The user must be able to navigate into a model using the Facet. + * Nicolas Bros (Mia-Software) - Bug 372626 - [Facet] Aggregates + * Nicolas Bros (Mia-Software) - Bug 376941 - [EFacet] Facet operation arguments in Facet model + * + */ +package org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.query; + +import org.eclipse.emf.common.util.EList; + +import org.eclipse.emf.ecore.EOperation; + +import org.eclipse.emf.ecore.ETypedElement; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.extensible.Query; + +/** + * <!-- begin-user-doc --> + * A representation of the model object '<em><b>Operation Call Query</b></em>'. + * <!-- end-user-doc --> + * + * <p> + * The following features are supported: + * <ul> + * <li>{@link org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.query.OperationCallQuery#getOperation <em>Operation</em>}</li> + * <li>{@link org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.query.OperationCallQuery#getArguments <em>Arguments</em>}</li> + * </ul> + * </p> + * + * @see org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.query.QueryPackage#getOperationCallQuery() + * @model + * @generated + * @since 0.2 + */ +public interface OperationCallQuery extends Query { + /** + * Returns the value of the '<em><b>Operation</b></em>' reference. + * <!-- begin-user-doc --> + * <p> + * If the meaning of the '<em>Operation</em>' reference isn't clear, + * there really should be more of a description here... + * </p> + * <!-- end-user-doc --> + * @return the value of the '<em>Operation</em>' reference. + * @see #setOperation(EOperation) + * @see org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.query.QueryPackage#getOperationCallQuery_Operation() + * @model + * @generated + */ + EOperation getOperation(); + + /** + * Sets the value of the '{@link org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.query.OperationCallQuery#getOperation <em>Operation</em>}' reference. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @param value the new value of the '<em>Operation</em>' reference. + * @see #getOperation() + * @generated + */ + void setOperation(EOperation value); + + /** + * Returns the value of the '<em><b>Arguments</b></em>' containment reference list. + * The list contents are of type {@link org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.extensible.Query}. + * <!-- begin-user-doc --> + * <p> + * If the meaning of the '<em>Arguments</em>' containment reference list isn't clear, + * there really should be more of a description here... + * </p> + * <!-- end-user-doc --> + * @return the value of the '<em>Arguments</em>' containment reference list. + * @see org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.query.QueryPackage#getOperationCallQuery_Arguments() + * @model containment="true" + * @generated + */ + EList<Query> getArguments(); + +} // OperationCallQuery
diff --git a/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/modisco/facet/efacet/metamodel/v0_2_0/efacet/query/QueryFactory.java b/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/modisco/facet/efacet/metamodel/v0_2_0/efacet/query/QueryFactory.java new file mode 100644 index 0000000..d3bb7e7 --- /dev/null +++ b/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/modisco/facet/efacet/metamodel/v0_2_0/efacet/query/QueryFactory.java
@@ -0,0 +1,146 @@ +/** + * Copyright (c) 2011 Mia-Software. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Gregoire Dupe (Mia-Software) - Design + * Nicolas Guyomar (Mia-Software) - Implementation + * Emmanuelle Rouillé (Mia-Software) - Bug 352618 - To be able to use non derived facet structural features and save them values. + * Nicolas Bros (Mia-Software) - Bug 361823 - [Restructuring] eFacet2 meta-model + * Gregoire Dupe (Mia-Software) - Bug 366055 - NavigationQuery + * Gregoire Dupe (Mia-Software) - Bug 369987 - [Restructuring][Table] Switch to the new customization and facet framework + * Gregoire Dupe (Mia-Software) - Bug 373078 - API Cleaning + */ +package org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.query; + +import org.eclipse.emf.ecore.EFactory; + +/** + * <!-- begin-user-doc --> + * The <b>Factory</b> for the model. + * It provides a create method for each non-abstract class of the model. + * <!-- end-user-doc --> + * + * @see org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.query.QueryPackage + * @generated + * @noextend This interface is not intended to be extended by clients. + * @noimplement This interface is not intended to be implemented by clients. + */ +public interface QueryFactory extends EFactory { + /** + * The singleton instance of the factory. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + QueryFactory eINSTANCE = org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.query.impl.QueryFactoryImpl.init(); + + /** + * Returns a new object of class '<em>Navigation Query</em>'. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @return a new object of class '<em>Navigation Query</em>'. + * @generated + */ + NavigationQuery createNavigationQuery(); + + /** + * Returns a new object of class '<em>Is One Of Query</em>'. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @return a new object of class '<em>Is One Of Query</em>'. + * @generated + */ + IsOneOfQuery createIsOneOfQuery(); + + /** + * Returns a new object of class '<em>String Literal Query</em>'. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @return a new object of class '<em>String Literal Query</em>'. + * @generated + */ + StringLiteralQuery createStringLiteralQuery(); + + /** + * Returns a new object of class '<em>True Literal Query</em>'. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @return a new object of class '<em>True Literal Query</em>'. + * @generated + */ + TrueLiteralQuery createTrueLiteralQuery(); + + /** + * Returns a new object of class '<em>False Literal Query</em>'. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @return a new object of class '<em>False Literal Query</em>'. + * @generated + */ + FalseLiteralQuery createFalseLiteralQuery(); + + /** + * Returns a new object of class '<em>Null Literal Query</em>'. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @return a new object of class '<em>Null Literal Query</em>'. + * @generated + */ + NullLiteralQuery createNullLiteralQuery(); + + /** + * Returns a new object of class '<em>Integer Literal Query</em>'. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @return a new object of class '<em>Integer Literal Query</em>'. + * @generated + * @since 0.2 + */ + IntegerLiteralQuery createIntegerLiteralQuery(); + + /** + * Returns a new object of class '<em>Float Literal Query</em>'. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @return a new object of class '<em>Float Literal Query</em>'. + * @generated + * @since 0.2 + */ + FloatLiteralQuery createFloatLiteralQuery(); + + /** + * Returns a new object of class '<em>EObject Literal Query</em>'. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @return a new object of class '<em>EObject Literal Query</em>'. + * @generated + * @since 0.2 + */ + EObjectLiteralQuery createEObjectLiteralQuery(); + + /** + * Returns a new object of class '<em>Operation Call Query</em>'. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @return a new object of class '<em>Operation Call Query</em>'. + * @generated + * @since 0.2 + */ + OperationCallQuery createOperationCallQuery(); + + /** + * Returns the package supported by this factory. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @return the package supported by this factory. + * @generated + */ + QueryPackage getQueryPackage(); + +} //QueryFactory
diff --git a/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/modisco/facet/efacet/metamodel/v0_2_0/efacet/query/QueryPackage.java b/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/modisco/facet/efacet/metamodel/v0_2_0/efacet/query/QueryPackage.java new file mode 100644 index 0000000..83e48e2 --- /dev/null +++ b/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/modisco/facet/efacet/metamodel/v0_2_0/efacet/query/QueryPackage.java
@@ -0,0 +1,967 @@ +/** + * Copyright (c) 2011 Mia-Software. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Gregoire Dupe (Mia-Software) - Design + * Nicolas Guyomar (Mia-Software) - Implementation + * Emmanuelle Rouillé (Mia-Software) - Bug 352618 - To be able to use non derived facet structural features and save them values. + * Nicolas Bros (Mia-Software) - Bug 361823 - [Restructuring] eFacet2 meta-model + * Gregoire Dupe (Mia-Software) - Bug 366055 - NavigationQuery + * Gregoire Dupe (Mia-Software) - Bug 369987 - [Restructuring][Table] Switch to the new customization and facet framework + * Gregoire Dupe (Mia-Software) - Bug 373078 - API Cleaning + */ +package org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.query; + +import org.eclipse.emf.ecore.EAttribute; +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.EPackage; +import org.eclipse.emf.ecore.EReference; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.extensible.ExtensiblePackage; + +/** + * <!-- begin-user-doc --> + * The <b>Package</b> for the model. + * It contains accessors for the meta objects to represent + * <ul> + * <li>each class,</li> + * <li>each feature of each class,</li> + * <li>each enum,</li> + * <li>and each data type</li> + * </ul> + * <!-- end-user-doc --> + * @see org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.query.QueryFactory + * @model kind="package" + * @generated + * @noextend This interface is not intended to be extended by clients. + * @noimplement This interface is not intended to be implemented by clients. + */ +public interface QueryPackage extends EPackage { + /** + * The package name. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + String eNAME = "query"; //$NON-NLS-1$ + + /** + * The package namespace URI. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + String eNS_URI = "http://www.eclipse.org/emf/facet/efacet/0.2.incubation/efacet/query"; //$NON-NLS-1$ + + /** + * The package namespace name. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + String eNS_PREFIX = "query"; //$NON-NLS-1$ + + /** + * The singleton instance of the package. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + QueryPackage eINSTANCE = org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.query.impl.QueryPackageImpl.init(); + + /** + * The meta object id for the '{@link org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.query.impl.NavigationQueryImpl <em>Navigation Query</em>}' class. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @see org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.query.impl.NavigationQueryImpl + * @see org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.query.impl.QueryPackageImpl#getNavigationQuery() + * @generated + */ + int NAVIGATION_QUERY = 0; + + /** + * The feature id for the '<em><b>Can Have Side Effects</b></em>' attribute. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + */ + int NAVIGATION_QUERY__CAN_HAVE_SIDE_EFFECTS = ExtensiblePackage.QUERY__CAN_HAVE_SIDE_EFFECTS; + + /** + * The feature id for the '<em><b>Can Be Cached</b></em>' attribute. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + */ + int NAVIGATION_QUERY__CAN_BE_CACHED = ExtensiblePackage.QUERY__CAN_BE_CACHED; + + /** + * The feature id for the '<em><b>Path</b></em>' reference list. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + */ + int NAVIGATION_QUERY__PATH = ExtensiblePackage.QUERY_FEATURE_COUNT + 0; + + /** + * The feature id for the '<em><b>Fail On Error</b></em>' attribute. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + */ + int NAVIGATION_QUERY__FAIL_ON_ERROR = ExtensiblePackage.QUERY_FEATURE_COUNT + 1; + + /** + * The number of structural features of the '<em>Navigation Query</em>' class. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + */ + int NAVIGATION_QUERY_FEATURE_COUNT = ExtensiblePackage.QUERY_FEATURE_COUNT + 2; + + + /** + * The meta object id for the '{@link org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.query.impl.IsOneOfQueryImpl <em>Is One Of Query</em>}' class. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @see org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.query.impl.IsOneOfQueryImpl + * @see org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.query.impl.QueryPackageImpl#getIsOneOfQuery() + * @generated + */ + int IS_ONE_OF_QUERY = 1; + + /** + * The feature id for the '<em><b>Can Have Side Effects</b></em>' attribute. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + */ + int IS_ONE_OF_QUERY__CAN_HAVE_SIDE_EFFECTS = ExtensiblePackage.QUERY__CAN_HAVE_SIDE_EFFECTS; + + /** + * The feature id for the '<em><b>Can Be Cached</b></em>' attribute. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + */ + int IS_ONE_OF_QUERY__CAN_BE_CACHED = ExtensiblePackage.QUERY__CAN_BE_CACHED; + + /** + * The feature id for the '<em><b>Expected EObjects</b></em>' reference list. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + */ + int IS_ONE_OF_QUERY__EXPECTED_EOBJECTS = ExtensiblePackage.QUERY_FEATURE_COUNT + 0; + + /** + * The number of structural features of the '<em>Is One Of Query</em>' class. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + */ + int IS_ONE_OF_QUERY_FEATURE_COUNT = ExtensiblePackage.QUERY_FEATURE_COUNT + 1; + + + /** + * The meta object id for the '{@link org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.query.impl.StringLiteralQueryImpl <em>String Literal Query</em>}' class. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @see org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.query.impl.StringLiteralQueryImpl + * @see org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.query.impl.QueryPackageImpl#getStringLiteralQuery() + * @generated + */ + int STRING_LITERAL_QUERY = 2; + + /** + * The feature id for the '<em><b>Can Have Side Effects</b></em>' attribute. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + */ + int STRING_LITERAL_QUERY__CAN_HAVE_SIDE_EFFECTS = ExtensiblePackage.QUERY__CAN_HAVE_SIDE_EFFECTS; + + /** + * The feature id for the '<em><b>Can Be Cached</b></em>' attribute. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + */ + int STRING_LITERAL_QUERY__CAN_BE_CACHED = ExtensiblePackage.QUERY__CAN_BE_CACHED; + + /** + * The feature id for the '<em><b>Value</b></em>' attribute. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + */ + int STRING_LITERAL_QUERY__VALUE = ExtensiblePackage.QUERY_FEATURE_COUNT + 0; + + /** + * The number of structural features of the '<em>String Literal Query</em>' class. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + */ + int STRING_LITERAL_QUERY_FEATURE_COUNT = ExtensiblePackage.QUERY_FEATURE_COUNT + 1; + + + /** + * The meta object id for the '{@link org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.query.impl.TrueLiteralQueryImpl <em>True Literal Query</em>}' class. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @see org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.query.impl.TrueLiteralQueryImpl + * @see org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.query.impl.QueryPackageImpl#getTrueLiteralQuery() + * @generated + */ + int TRUE_LITERAL_QUERY = 3; + + /** + * The feature id for the '<em><b>Can Have Side Effects</b></em>' attribute. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + */ + int TRUE_LITERAL_QUERY__CAN_HAVE_SIDE_EFFECTS = ExtensiblePackage.QUERY__CAN_HAVE_SIDE_EFFECTS; + + /** + * The feature id for the '<em><b>Can Be Cached</b></em>' attribute. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + */ + int TRUE_LITERAL_QUERY__CAN_BE_CACHED = ExtensiblePackage.QUERY__CAN_BE_CACHED; + + /** + * The number of structural features of the '<em>True Literal Query</em>' class. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + */ + int TRUE_LITERAL_QUERY_FEATURE_COUNT = ExtensiblePackage.QUERY_FEATURE_COUNT + 0; + + /** + * The meta object id for the '{@link org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.query.impl.FalseLiteralQueryImpl <em>False Literal Query</em>}' class. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @see org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.query.impl.FalseLiteralQueryImpl + * @see org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.query.impl.QueryPackageImpl#getFalseLiteralQuery() + * @generated + */ + int FALSE_LITERAL_QUERY = 4; + + /** + * The feature id for the '<em><b>Can Have Side Effects</b></em>' attribute. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + */ + int FALSE_LITERAL_QUERY__CAN_HAVE_SIDE_EFFECTS = ExtensiblePackage.QUERY__CAN_HAVE_SIDE_EFFECTS; + + /** + * The feature id for the '<em><b>Can Be Cached</b></em>' attribute. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + */ + int FALSE_LITERAL_QUERY__CAN_BE_CACHED = ExtensiblePackage.QUERY__CAN_BE_CACHED; + + /** + * The number of structural features of the '<em>False Literal Query</em>' class. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + */ + int FALSE_LITERAL_QUERY_FEATURE_COUNT = ExtensiblePackage.QUERY_FEATURE_COUNT + 0; + + + /** + * The meta object id for the '{@link org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.query.impl.NullLiteralQueryImpl <em>Null Literal Query</em>}' class. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @see org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.query.impl.NullLiteralQueryImpl + * @see org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.query.impl.QueryPackageImpl#getNullLiteralQuery() + * @generated + */ + int NULL_LITERAL_QUERY = 5; + + /** + * The feature id for the '<em><b>Can Have Side Effects</b></em>' attribute. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + */ + int NULL_LITERAL_QUERY__CAN_HAVE_SIDE_EFFECTS = ExtensiblePackage.QUERY__CAN_HAVE_SIDE_EFFECTS; + + /** + * The feature id for the '<em><b>Can Be Cached</b></em>' attribute. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + */ + int NULL_LITERAL_QUERY__CAN_BE_CACHED = ExtensiblePackage.QUERY__CAN_BE_CACHED; + + /** + * The number of structural features of the '<em>Null Literal Query</em>' class. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + */ + int NULL_LITERAL_QUERY_FEATURE_COUNT = ExtensiblePackage.QUERY_FEATURE_COUNT + 0; + + + /** + * The meta object id for the '{@link org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.query.impl.IntegerLiteralQueryImpl <em>Integer Literal Query</em>}' class. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @see org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.query.impl.IntegerLiteralQueryImpl + * @see org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.query.impl.QueryPackageImpl#getIntegerLiteralQuery() + * @generated + * @since 0.2 + */ + int INTEGER_LITERAL_QUERY = 6; + + /** + * The feature id for the '<em><b>Can Have Side Effects</b></em>' attribute. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + * @since 0.2 + */ + int INTEGER_LITERAL_QUERY__CAN_HAVE_SIDE_EFFECTS = ExtensiblePackage.QUERY__CAN_HAVE_SIDE_EFFECTS; + + /** + * The feature id for the '<em><b>Can Be Cached</b></em>' attribute. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + * @since 0.2 + */ + int INTEGER_LITERAL_QUERY__CAN_BE_CACHED = ExtensiblePackage.QUERY__CAN_BE_CACHED; + + /** + * The feature id for the '<em><b>Value</b></em>' attribute. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + * @since 0.2 + */ + int INTEGER_LITERAL_QUERY__VALUE = ExtensiblePackage.QUERY_FEATURE_COUNT + 0; + + /** + * The number of structural features of the '<em>Integer Literal Query</em>' class. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + * @since 0.2 + */ + int INTEGER_LITERAL_QUERY_FEATURE_COUNT = ExtensiblePackage.QUERY_FEATURE_COUNT + 1; + + /** + * The meta object id for the '{@link org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.query.impl.FloatLiteralQueryImpl <em>Float Literal Query</em>}' class. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @see org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.query.impl.FloatLiteralQueryImpl + * @see org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.query.impl.QueryPackageImpl#getFloatLiteralQuery() + * @generated + * @since 0.2 + */ + int FLOAT_LITERAL_QUERY = 7; + + /** + * The feature id for the '<em><b>Can Have Side Effects</b></em>' attribute. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + * @since 0.2 + */ + int FLOAT_LITERAL_QUERY__CAN_HAVE_SIDE_EFFECTS = ExtensiblePackage.QUERY__CAN_HAVE_SIDE_EFFECTS; + + /** + * The feature id for the '<em><b>Can Be Cached</b></em>' attribute. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + * @since 0.2 + */ + int FLOAT_LITERAL_QUERY__CAN_BE_CACHED = ExtensiblePackage.QUERY__CAN_BE_CACHED; + + /** + * The feature id for the '<em><b>Value</b></em>' attribute. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + * @since 0.2 + */ + int FLOAT_LITERAL_QUERY__VALUE = ExtensiblePackage.QUERY_FEATURE_COUNT + 0; + + /** + * The number of structural features of the '<em>Float Literal Query</em>' class. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + * @since 0.2 + */ + int FLOAT_LITERAL_QUERY_FEATURE_COUNT = ExtensiblePackage.QUERY_FEATURE_COUNT + 1; + + /** + * The meta object id for the '{@link org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.query.impl.EObjectLiteralQueryImpl <em>EObject Literal Query</em>}' class. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @see org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.query.impl.EObjectLiteralQueryImpl + * @see org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.query.impl.QueryPackageImpl#getEObjectLiteralQuery() + * @generated + * @since 0.2 + */ + int EOBJECT_LITERAL_QUERY = 8; + + /** + * The feature id for the '<em><b>Can Have Side Effects</b></em>' attribute. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + * @since 0.2 + */ + int EOBJECT_LITERAL_QUERY__CAN_HAVE_SIDE_EFFECTS = ExtensiblePackage.QUERY__CAN_HAVE_SIDE_EFFECTS; + + /** + * The feature id for the '<em><b>Can Be Cached</b></em>' attribute. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + * @since 0.2 + */ + int EOBJECT_LITERAL_QUERY__CAN_BE_CACHED = ExtensiblePackage.QUERY__CAN_BE_CACHED; + + /** + * The feature id for the '<em><b>Element</b></em>' reference. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + * @since 0.2 + */ + int EOBJECT_LITERAL_QUERY__ELEMENT = ExtensiblePackage.QUERY_FEATURE_COUNT + 0; + + /** + * The number of structural features of the '<em>EObject Literal Query</em>' class. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + * @since 0.2 + */ + int EOBJECT_LITERAL_QUERY_FEATURE_COUNT = ExtensiblePackage.QUERY_FEATURE_COUNT + 1; + + /** + * The meta object id for the '{@link org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.query.impl.OperationCallQueryImpl <em>Operation Call Query</em>}' class. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @see org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.query.impl.OperationCallQueryImpl + * @see org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.query.impl.QueryPackageImpl#getOperationCallQuery() + * @generated + * @since 0.2 + */ + int OPERATION_CALL_QUERY = 9; + + /** + * The feature id for the '<em><b>Can Have Side Effects</b></em>' attribute. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + * @since 0.2 + */ + int OPERATION_CALL_QUERY__CAN_HAVE_SIDE_EFFECTS = ExtensiblePackage.QUERY__CAN_HAVE_SIDE_EFFECTS; + + /** + * The feature id for the '<em><b>Can Be Cached</b></em>' attribute. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + * @since 0.2 + */ + int OPERATION_CALL_QUERY__CAN_BE_CACHED = ExtensiblePackage.QUERY__CAN_BE_CACHED; + + /** + * The feature id for the '<em><b>Operation</b></em>' reference. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + * @since 0.2 + */ + int OPERATION_CALL_QUERY__OPERATION = ExtensiblePackage.QUERY_FEATURE_COUNT + 0; + + /** + * The feature id for the '<em><b>Arguments</b></em>' containment reference list. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + * @since 0.2 + */ + int OPERATION_CALL_QUERY__ARGUMENTS = ExtensiblePackage.QUERY_FEATURE_COUNT + 1; + + /** + * The number of structural features of the '<em>Operation Call Query</em>' class. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + * @since 0.2 + */ + int OPERATION_CALL_QUERY_FEATURE_COUNT = ExtensiblePackage.QUERY_FEATURE_COUNT + 2; + + + /** + * Returns the meta object for class '{@link org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.query.NavigationQuery <em>Navigation Query</em>}'. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @return the meta object for class '<em>Navigation Query</em>'. + * @see org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.query.NavigationQuery + * @generated + */ + EClass getNavigationQuery(); + + /** + * Returns the meta object for the reference list '{@link org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.query.NavigationQuery#getPath <em>Path</em>}'. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @return the meta object for the reference list '<em>Path</em>'. + * @see org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.query.NavigationQuery#getPath() + * @see #getNavigationQuery() + * @generated + */ + EReference getNavigationQuery_Path(); + + /** + * Returns the meta object for the attribute '{@link org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.query.NavigationQuery#isFailOnError <em>Fail On Error</em>}'. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @return the meta object for the attribute '<em>Fail On Error</em>'. + * @see org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.query.NavigationQuery#isFailOnError() + * @see #getNavigationQuery() + * @generated + */ + EAttribute getNavigationQuery_FailOnError(); + + /** + * Returns the meta object for class '{@link org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.query.IsOneOfQuery <em>Is One Of Query</em>}'. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @return the meta object for class '<em>Is One Of Query</em>'. + * @see org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.query.IsOneOfQuery + * @generated + */ + EClass getIsOneOfQuery(); + + /** + * Returns the meta object for the reference list '{@link org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.query.IsOneOfQuery#getExpectedEObjects <em>Expected EObjects</em>}'. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @return the meta object for the reference list '<em>Expected EObjects</em>'. + * @see org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.query.IsOneOfQuery#getExpectedEObjects() + * @see #getIsOneOfQuery() + * @generated + */ + EReference getIsOneOfQuery_ExpectedEObjects(); + + /** + * Returns the meta object for class '{@link org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.query.StringLiteralQuery <em>String Literal Query</em>}'. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @return the meta object for class '<em>String Literal Query</em>'. + * @see org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.query.StringLiteralQuery + * @generated + */ + EClass getStringLiteralQuery(); + + /** + * Returns the meta object for the attribute '{@link org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.query.StringLiteralQuery#getValue <em>Value</em>}'. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @return the meta object for the attribute '<em>Value</em>'. + * @see org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.query.StringLiteralQuery#getValue() + * @see #getStringLiteralQuery() + * @generated + */ + EAttribute getStringLiteralQuery_Value(); + + /** + * Returns the meta object for class '{@link org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.query.TrueLiteralQuery <em>True Literal Query</em>}'. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @return the meta object for class '<em>True Literal Query</em>'. + * @see org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.query.TrueLiteralQuery + * @generated + */ + EClass getTrueLiteralQuery(); + + /** + * Returns the meta object for class '{@link org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.query.FalseLiteralQuery <em>False Literal Query</em>}'. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @return the meta object for class '<em>False Literal Query</em>'. + * @see org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.query.FalseLiteralQuery + * @generated + */ + EClass getFalseLiteralQuery(); + + /** + * Returns the meta object for class '{@link org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.query.NullLiteralQuery <em>Null Literal Query</em>}'. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @return the meta object for class '<em>Null Literal Query</em>'. + * @see org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.query.NullLiteralQuery + * @generated + */ + EClass getNullLiteralQuery(); + + /** + * Returns the meta object for class '{@link org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.query.IntegerLiteralQuery <em>Integer Literal Query</em>}'. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @return the meta object for class '<em>Integer Literal Query</em>'. + * @see org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.query.IntegerLiteralQuery + * @generated + * @since 0.2 + */ + EClass getIntegerLiteralQuery(); + + /** + * Returns the meta object for the attribute '{@link org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.query.IntegerLiteralQuery#getValue <em>Value</em>}'. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @return the meta object for the attribute '<em>Value</em>'. + * @see org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.query.IntegerLiteralQuery#getValue() + * @see #getIntegerLiteralQuery() + * @generated + * @since 0.2 + */ + EAttribute getIntegerLiteralQuery_Value(); + + /** + * Returns the meta object for class '{@link org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.query.FloatLiteralQuery <em>Float Literal Query</em>}'. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @return the meta object for class '<em>Float Literal Query</em>'. + * @see org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.query.FloatLiteralQuery + * @generated + * @since 0.2 + */ + EClass getFloatLiteralQuery(); + + /** + * Returns the meta object for the attribute '{@link org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.query.FloatLiteralQuery#getValue <em>Value</em>}'. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @return the meta object for the attribute '<em>Value</em>'. + * @see org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.query.FloatLiteralQuery#getValue() + * @see #getFloatLiteralQuery() + * @generated + * @since 0.2 + */ + EAttribute getFloatLiteralQuery_Value(); + + /** + * Returns the meta object for class '{@link org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.query.EObjectLiteralQuery <em>EObject Literal Query</em>}'. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @return the meta object for class '<em>EObject Literal Query</em>'. + * @see org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.query.EObjectLiteralQuery + * @generated + * @since 0.2 + */ + EClass getEObjectLiteralQuery(); + + /** + * Returns the meta object for the reference '{@link org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.query.EObjectLiteralQuery#getElement <em>Element</em>}'. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @return the meta object for the reference '<em>Element</em>'. + * @see org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.query.EObjectLiteralQuery#getElement() + * @see #getEObjectLiteralQuery() + * @generated + * @since 0.2 + */ + EReference getEObjectLiteralQuery_Element(); + + /** + * Returns the meta object for class '{@link org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.query.OperationCallQuery <em>Operation Call Query</em>}'. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @return the meta object for class '<em>Operation Call Query</em>'. + * @see org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.query.OperationCallQuery + * @generated + * @since 0.2 + */ + EClass getOperationCallQuery(); + + /** + * Returns the meta object for the reference '{@link org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.query.OperationCallQuery#getOperation <em>Operation</em>}'. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @return the meta object for the reference '<em>Operation</em>'. + * @see org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.query.OperationCallQuery#getOperation() + * @see #getOperationCallQuery() + * @generated + * @since 0.2 + */ + EReference getOperationCallQuery_Operation(); + + /** + * Returns the meta object for the containment reference list '{@link org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.query.OperationCallQuery#getArguments <em>Arguments</em>}'. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @return the meta object for the containment reference list '<em>Arguments</em>'. + * @see org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.query.OperationCallQuery#getArguments() + * @see #getOperationCallQuery() + * @generated + * @since 0.2 + */ + EReference getOperationCallQuery_Arguments(); + + /** + * Returns the factory that creates the instances of the model. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @return the factory that creates the instances of the model. + * @generated + */ + QueryFactory getQueryFactory(); + + /** + * <!-- begin-user-doc --> + * Defines literals for the meta objects that represent + * <ul> + * <li>each class,</li> + * <li>each feature of each class,</li> + * <li>each enum,</li> + * <li>and each data type</li> + * </ul> + * <!-- end-user-doc --> + * @generated + */ + interface Literals { + /** + * The meta object literal for the '{@link org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.query.impl.NavigationQueryImpl <em>Navigation Query</em>}' class. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @see org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.query.impl.NavigationQueryImpl + * @see org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.query.impl.QueryPackageImpl#getNavigationQuery() + * @generated + */ + EClass NAVIGATION_QUERY = eINSTANCE.getNavigationQuery(); + + /** + * The meta object literal for the '<em><b>Path</b></em>' reference list feature. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + EReference NAVIGATION_QUERY__PATH = eINSTANCE.getNavigationQuery_Path(); + + /** + * The meta object literal for the '<em><b>Fail On Error</b></em>' attribute feature. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + EAttribute NAVIGATION_QUERY__FAIL_ON_ERROR = eINSTANCE.getNavigationQuery_FailOnError(); + + /** + * The meta object literal for the '{@link org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.query.impl.IsOneOfQueryImpl <em>Is One Of Query</em>}' class. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @see org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.query.impl.IsOneOfQueryImpl + * @see org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.query.impl.QueryPackageImpl#getIsOneOfQuery() + * @generated + */ + EClass IS_ONE_OF_QUERY = eINSTANCE.getIsOneOfQuery(); + + /** + * The meta object literal for the '<em><b>Expected EObjects</b></em>' reference list feature. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + EReference IS_ONE_OF_QUERY__EXPECTED_EOBJECTS = eINSTANCE.getIsOneOfQuery_ExpectedEObjects(); + + /** + * The meta object literal for the '{@link org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.query.impl.StringLiteralQueryImpl <em>String Literal Query</em>}' class. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @see org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.query.impl.StringLiteralQueryImpl + * @see org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.query.impl.QueryPackageImpl#getStringLiteralQuery() + * @generated + */ + EClass STRING_LITERAL_QUERY = eINSTANCE.getStringLiteralQuery(); + + /** + * The meta object literal for the '<em><b>Value</b></em>' attribute feature. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + EAttribute STRING_LITERAL_QUERY__VALUE = eINSTANCE.getStringLiteralQuery_Value(); + + /** + * The meta object literal for the '{@link org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.query.impl.TrueLiteralQueryImpl <em>True Literal Query</em>}' class. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @see org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.query.impl.TrueLiteralQueryImpl + * @see org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.query.impl.QueryPackageImpl#getTrueLiteralQuery() + * @generated + */ + EClass TRUE_LITERAL_QUERY = eINSTANCE.getTrueLiteralQuery(); + + /** + * The meta object literal for the '{@link org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.query.impl.FalseLiteralQueryImpl <em>False Literal Query</em>}' class. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @see org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.query.impl.FalseLiteralQueryImpl + * @see org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.query.impl.QueryPackageImpl#getFalseLiteralQuery() + * @generated + */ + EClass FALSE_LITERAL_QUERY = eINSTANCE.getFalseLiteralQuery(); + + /** + * The meta object literal for the '{@link org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.query.impl.NullLiteralQueryImpl <em>Null Literal Query</em>}' class. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @see org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.query.impl.NullLiteralQueryImpl + * @see org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.query.impl.QueryPackageImpl#getNullLiteralQuery() + * @generated + */ + EClass NULL_LITERAL_QUERY = eINSTANCE.getNullLiteralQuery(); + + /** + * The meta object literal for the '{@link org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.query.impl.IntegerLiteralQueryImpl <em>Integer Literal Query</em>}' class. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @see org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.query.impl.IntegerLiteralQueryImpl + * @see org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.query.impl.QueryPackageImpl#getIntegerLiteralQuery() + * @generated + * @since 0.2 + */ + EClass INTEGER_LITERAL_QUERY = eINSTANCE.getIntegerLiteralQuery(); + + /** + * The meta object literal for the '<em><b>Value</b></em>' attribute feature. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @since 0.2 + */ + EAttribute INTEGER_LITERAL_QUERY__VALUE = eINSTANCE.getIntegerLiteralQuery_Value(); + + /** + * The meta object literal for the '{@link org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.query.impl.FloatLiteralQueryImpl <em>Float Literal Query</em>}' class. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @see org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.query.impl.FloatLiteralQueryImpl + * @see org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.query.impl.QueryPackageImpl#getFloatLiteralQuery() + * @generated + * @since 0.2 + */ + EClass FLOAT_LITERAL_QUERY = eINSTANCE.getFloatLiteralQuery(); + + /** + * The meta object literal for the '<em><b>Value</b></em>' attribute feature. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @since 0.2 + */ + EAttribute FLOAT_LITERAL_QUERY__VALUE = eINSTANCE.getFloatLiteralQuery_Value(); + + /** + * The meta object literal for the '{@link org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.query.impl.EObjectLiteralQueryImpl <em>EObject Literal Query</em>}' class. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @see org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.query.impl.EObjectLiteralQueryImpl + * @see org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.query.impl.QueryPackageImpl#getEObjectLiteralQuery() + * @generated + * @since 0.2 + */ + EClass EOBJECT_LITERAL_QUERY = eINSTANCE.getEObjectLiteralQuery(); + + /** + * The meta object literal for the '<em><b>Element</b></em>' reference feature. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @since 0.2 + */ + EReference EOBJECT_LITERAL_QUERY__ELEMENT = eINSTANCE.getEObjectLiteralQuery_Element(); + + /** + * The meta object literal for the '{@link org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.query.impl.OperationCallQueryImpl <em>Operation Call Query</em>}' class. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @see org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.query.impl.OperationCallQueryImpl + * @see org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.query.impl.QueryPackageImpl#getOperationCallQuery() + * @generated + * @since 0.2 + */ + EClass OPERATION_CALL_QUERY = eINSTANCE.getOperationCallQuery(); + + /** + * The meta object literal for the '<em><b>Operation</b></em>' reference feature. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @since 0.2 + */ + EReference OPERATION_CALL_QUERY__OPERATION = eINSTANCE.getOperationCallQuery_Operation(); + + /** + * The meta object literal for the '<em><b>Arguments</b></em>' containment reference list feature. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @since 0.2 + */ + EReference OPERATION_CALL_QUERY__ARGUMENTS = eINSTANCE.getOperationCallQuery_Arguments(); + + } + +} //QueryPackage
diff --git a/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/modisco/facet/efacet/metamodel/v0_2_0/efacet/query/StringLiteralQuery.java b/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/modisco/facet/efacet/metamodel/v0_2_0/efacet/query/StringLiteralQuery.java new file mode 100644 index 0000000..7998314 --- /dev/null +++ b/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/modisco/facet/efacet/metamodel/v0_2_0/efacet/query/StringLiteralQuery.java
@@ -0,0 +1,65 @@ +/** + * Copyright (c) 2011 Mia-Software. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Gregoire Dupe (Mia-Software) - Design + * Nicolas Guyomar (Mia-Software) - Implementation + * Emmanuelle Rouillé (Mia-Software) - Bug 352618 - To be able to use non derived facet structural features and save them values. + * Nicolas Bros (Mia-Software) - Bug 361823 - [Restructuring] eFacet2 meta-model + * Gregoire Dupe (Mia-Software) - Bug 366055 - NavigationQuery + * Gregoire Dupe (Mia-Software) - Bug 369673 - [Facet] IsOneOfQuery + * Olivier Remaud (Soft-Maint) - Bug 369824 - Add a simple way to return string literal constants from a customization query + */ +package org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.query; + +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.extensible.Query; + +/** + * <!-- begin-user-doc --> + * A representation of the model object '<em><b>String Literal Query</b></em>'. + * <!-- end-user-doc --> + * + * <p> + * The following features are supported: + * <ul> + * <li>{@link org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.query.StringLiteralQuery#getValue <em>Value</em>}</li> + * </ul> + * </p> + * + * @see org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.query.QueryPackage#getStringLiteralQuery() + * @model + * @generated + */ +public interface StringLiteralQuery extends Query { + /** + * Returns the value of the '<em><b>Value</b></em>' attribute. + * <!-- begin-user-doc --> + * <p> + * If the meaning of the '<em>Value</em>' attribute isn't clear, + * there really should be more of a description here... + * </p> + * <!-- end-user-doc --> + * @return the value of the '<em>Value</em>' attribute. + * @see #setValue(String) + * @see org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.query.QueryPackage#getStringLiteralQuery_Value() + * @model + * @generated + */ + String getValue(); + + /** + * Sets the value of the '{@link org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.query.StringLiteralQuery#getValue <em>Value</em>}' attribute. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @param value the new value of the '<em>Value</em>' attribute. + * @see #getValue() + * @generated + */ + void setValue(String value); + +} // StringLiteralQuery
diff --git a/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/modisco/facet/efacet/metamodel/v0_2_0/efacet/query/TrueLiteralQuery.java b/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/modisco/facet/efacet/metamodel/v0_2_0/efacet/query/TrueLiteralQuery.java new file mode 100644 index 0000000..7dc747d --- /dev/null +++ b/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/modisco/facet/efacet/metamodel/v0_2_0/efacet/query/TrueLiteralQuery.java
@@ -0,0 +1,38 @@ +/** + * Copyright (c) 2011 Mia-Software. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Gregoire Dupe (Mia-Software) - Design + * Nicolas Guyomar (Mia-Software) - Implementation + * Emmanuelle Rouillé (Mia-Software) - Bug 352618 - To be able to use non derived facet structural features and save them values. + * Nicolas Bros (Mia-Software) - Bug 361823 - [Restructuring] eFacet2 meta-model + * Gregoire Dupe (Mia-Software) - Bug 366055 - NavigationQuery + * Gregoire Dupe (Mia-Software) - Bug 369673 - [Facet] IsOneOfQuery + * Olivier Remaud (Soft-Maint) - Bug 369824 - Add a simple way to return string literal constants from a customization query + * Gregoire Dupe (Mia-software) - Bug 369987 - [Restructuring][Table] Switch to the new customization and facet framework + */ +package org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.query; + +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.extensible.Query; + +/** + * <!-- begin-user-doc --> + * A representation of the model object '<em><b>True Literal Query</b></em>'. + * <!-- end-user-doc --> + * + * <!-- begin-model-doc --> + * This query retrun true. + * <!-- end-model-doc --> + * + * + * @see org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.query.QueryPackage#getTrueLiteralQuery() + * @model + * @generated + */ +public interface TrueLiteralQuery extends Query { +} // TrueLiteralQuery
diff --git a/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/modisco/facet/efacet/metamodel/v0_2_0/efacet/query/impl/EObjectLiteralQueryImpl.java b/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/modisco/facet/efacet/metamodel/v0_2_0/efacet/query/impl/EObjectLiteralQueryImpl.java new file mode 100644 index 0000000..4ca86ef --- /dev/null +++ b/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/modisco/facet/efacet/metamodel/v0_2_0/efacet/query/impl/EObjectLiteralQueryImpl.java
@@ -0,0 +1,176 @@ +/** + * Copyright (c) 2011-2012 Mia-Software. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Gregoire Dupe (Mia-Software) - Design + * Nicolas Guyomar (Mia-Software) - Implementation + * Emmanuelle Rouillé (Mia-Software) - Bug 352618 - To be able to use non derived facet structural features and save them values. + * Nicolas Bros (Mia-Software) - Bug 361823 - [Restructuring] eFacet2 meta-model + * Gregoire Dupe (Mia-Software) - Bug 366055 - NavigationQuery + * Gregoire Dupe (Mia-Software) - Bug 369673 - [Facet] IsOneOfQuery + * Olivier Remaud (Soft-Maint) - Bug 369824 - Add a simple way to return string literal constants from a customization query + * Gregoire Dupe (Mia-Software) - Bug 369987 - [Restructuring][Table] Switch to the new customization and facet framework + * Gregoire Dupe (Mia-software) - Bug 364325 - [Restructuring] The user must be able to navigate into a model using the Facet. + * Nicolas Bros (Mia-Software) - Bug 372626 - [Facet] Aggregates + * Nicolas Bros (Mia-Software) - Bug 376941 - [EFacet] Facet operation arguments in Facet model + * + */ +package org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.query.impl; + +import org.eclipse.emf.common.notify.Notification; + +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.ecore.InternalEObject; + +import org.eclipse.emf.ecore.impl.ENotificationImpl; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.extensible.impl.QueryImpl; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.query.EObjectLiteralQuery; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.query.QueryPackage; + +/** + * <!-- begin-user-doc --> + * An implementation of the model object '<em><b>EObject Literal Query</b></em>'. + * <!-- end-user-doc --> + * <p> + * The following features are implemented: + * <ul> + * <li>{@link org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.query.impl.EObjectLiteralQueryImpl#getElement <em>Element</em>}</li> + * </ul> + * </p> + * + * @generated + */ +public class EObjectLiteralQueryImpl extends QueryImpl implements EObjectLiteralQuery { + /** + * The cached value of the '{@link #getElement() <em>Element</em>}' reference. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @see #getElement() + * @generated + * @ordered + */ + protected EObject element; + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + protected EObjectLiteralQueryImpl() { + super(); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + protected EClass eStaticClass() { + return QueryPackage.Literals.EOBJECT_LITERAL_QUERY; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public EObject getElement() { + if (element != null && element.eIsProxy()) { + InternalEObject oldElement = (InternalEObject)element; + element = eResolveProxy(oldElement); + if (element != oldElement) { + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.RESOLVE, QueryPackage.EOBJECT_LITERAL_QUERY__ELEMENT, oldElement, element)); + } + } + return element; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public EObject basicGetElement() { + return element; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public void setElement(EObject newElement) { + EObject oldElement = element; + element = newElement; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.SET, QueryPackage.EOBJECT_LITERAL_QUERY__ELEMENT, oldElement, element)); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + public Object eGet(int featureID, boolean resolve, boolean coreType) { + switch (featureID) { + case QueryPackage.EOBJECT_LITERAL_QUERY__ELEMENT: + if (resolve) return getElement(); + return basicGetElement(); + } + return super.eGet(featureID, resolve, coreType); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + public void eSet(int featureID, Object newValue) { + switch (featureID) { + case QueryPackage.EOBJECT_LITERAL_QUERY__ELEMENT: + setElement((EObject)newValue); + return; + } + super.eSet(featureID, newValue); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + public void eUnset(int featureID) { + switch (featureID) { + case QueryPackage.EOBJECT_LITERAL_QUERY__ELEMENT: + setElement((EObject)null); + return; + } + super.eUnset(featureID); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + public boolean eIsSet(int featureID) { + switch (featureID) { + case QueryPackage.EOBJECT_LITERAL_QUERY__ELEMENT: + return element != null; + } + return super.eIsSet(featureID); + } + +} //EObjectLiteralQueryImpl
diff --git a/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/modisco/facet/efacet/metamodel/v0_2_0/efacet/query/impl/FalseLiteralQueryImpl.java b/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/modisco/facet/efacet/metamodel/v0_2_0/efacet/query/impl/FalseLiteralQueryImpl.java new file mode 100644 index 0000000..e1defb4 --- /dev/null +++ b/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/modisco/facet/efacet/metamodel/v0_2_0/efacet/query/impl/FalseLiteralQueryImpl.java
@@ -0,0 +1,55 @@ +/** + * Copyright (c) 2011 Mia-Software. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Gregoire Dupe (Mia-Software) - Design + * Nicolas Guyomar (Mia-Software) - Implementation + * Emmanuelle Rouillé (Mia-Software) - Bug 352618 - To be able to use non derived facet structural features and save them values. + * Nicolas Bros (Mia-Software) - Bug 361823 - [Restructuring] eFacet2 meta-model + * Gregoire Dupe (Mia-Software) - Bug 366055 - NavigationQuery + * Gregoire Dupe (Mia-Software) - Bug 369673 - [Facet] IsOneOfQuery + * Olivier Remaud (Soft-Maint) - Bug 369824 - Add a simple way to return string literal constants from a customization query + * Gregoire Dupe (Mia-software) - Bug 369987 - [Restructuring][Table] Switch to the new customization and facet framework + */ +package org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.query.impl; + +import org.eclipse.emf.ecore.EClass; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.extensible.impl.QueryImpl; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.query.FalseLiteralQuery; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.query.QueryPackage; + +/** + * <!-- begin-user-doc --> + * An implementation of the model object '<em><b>False Literal Query</b></em>'. + * <!-- end-user-doc --> + * <p> + * </p> + * + * @generated + */ +public class FalseLiteralQueryImpl extends QueryImpl implements FalseLiteralQuery { + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + protected FalseLiteralQueryImpl() { + super(); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + protected EClass eStaticClass() { + return QueryPackage.Literals.FALSE_LITERAL_QUERY; + } + +} //FalseLiteralQueryImpl
diff --git a/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/modisco/facet/efacet/metamodel/v0_2_0/efacet/query/impl/FloatLiteralQueryImpl.java b/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/modisco/facet/efacet/metamodel/v0_2_0/efacet/query/impl/FloatLiteralQueryImpl.java new file mode 100644 index 0000000..3ec85e8 --- /dev/null +++ b/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/modisco/facet/efacet/metamodel/v0_2_0/efacet/query/impl/FloatLiteralQueryImpl.java
@@ -0,0 +1,182 @@ +/** + * Copyright (c) 2011-2012 Mia-Software. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Gregoire Dupe (Mia-Software) - Design + * Nicolas Guyomar (Mia-Software) - Implementation + * Emmanuelle Rouillé (Mia-Software) - Bug 352618 - To be able to use non derived facet structural features and save them values. + * Nicolas Bros (Mia-Software) - Bug 361823 - [Restructuring] eFacet2 meta-model + * Gregoire Dupe (Mia-Software) - Bug 366055 - NavigationQuery + * Gregoire Dupe (Mia-Software) - Bug 369673 - [Facet] IsOneOfQuery + * Olivier Remaud (Soft-Maint) - Bug 369824 - Add a simple way to return string literal constants from a customization query + * Gregoire Dupe (Mia-Software) - Bug 369987 - [Restructuring][Table] Switch to the new customization and facet framework + * Gregoire Dupe (Mia-software) - Bug 364325 - [Restructuring] The user must be able to navigate into a model using the Facet. + * Nicolas Bros (Mia-Software) - Bug 372626 - [Facet] Aggregates + * Nicolas Bros (Mia-Software) - Bug 376941 - [EFacet] Facet operation arguments in Facet model + * + */ +package org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.query.impl; + +import org.eclipse.emf.common.notify.Notification; + +import org.eclipse.emf.ecore.EClass; + +import org.eclipse.emf.ecore.impl.ENotificationImpl; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.extensible.impl.QueryImpl; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.query.FloatLiteralQuery; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.query.QueryPackage; + +/** + * <!-- begin-user-doc --> + * An implementation of the model object '<em><b>Float Literal Query</b></em>'. + * <!-- end-user-doc --> + * <p> + * The following features are implemented: + * <ul> + * <li>{@link org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.query.impl.FloatLiteralQueryImpl#getValue <em>Value</em>}</li> + * </ul> + * </p> + * + * @generated + */ +public class FloatLiteralQueryImpl extends QueryImpl implements FloatLiteralQuery { + /** + * The default value of the '{@link #getValue() <em>Value</em>}' attribute. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @see #getValue() + * @generated + * @ordered + */ + protected static final float VALUE_EDEFAULT = 0.0F; + + /** + * The cached value of the '{@link #getValue() <em>Value</em>}' attribute. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @see #getValue() + * @generated + * @ordered + */ + protected float value = VALUE_EDEFAULT; + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + protected FloatLiteralQueryImpl() { + super(); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + protected EClass eStaticClass() { + return QueryPackage.Literals.FLOAT_LITERAL_QUERY; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public float getValue() { + return value; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public void setValue(float newValue) { + float oldValue = value; + value = newValue; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.SET, QueryPackage.FLOAT_LITERAL_QUERY__VALUE, oldValue, value)); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + public Object eGet(int featureID, boolean resolve, boolean coreType) { + switch (featureID) { + case QueryPackage.FLOAT_LITERAL_QUERY__VALUE: + return getValue(); + } + return super.eGet(featureID, resolve, coreType); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + public void eSet(int featureID, Object newValue) { + switch (featureID) { + case QueryPackage.FLOAT_LITERAL_QUERY__VALUE: + setValue((Float)newValue); + return; + } + super.eSet(featureID, newValue); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + public void eUnset(int featureID) { + switch (featureID) { + case QueryPackage.FLOAT_LITERAL_QUERY__VALUE: + setValue(VALUE_EDEFAULT); + return; + } + super.eUnset(featureID); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + public boolean eIsSet(int featureID) { + switch (featureID) { + case QueryPackage.FLOAT_LITERAL_QUERY__VALUE: + return value != VALUE_EDEFAULT; + } + return super.eIsSet(featureID); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + public String toString() { + if (eIsProxy()) return super.toString(); + + StringBuffer result = new StringBuffer(super.toString()); + result.append(" (value: "); //$NON-NLS-1$ + result.append(value); + result.append(')'); + return result.toString(); + } + +} //FloatLiteralQueryImpl
diff --git a/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/modisco/facet/efacet/metamodel/v0_2_0/efacet/query/impl/IntegerLiteralQueryImpl.java b/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/modisco/facet/efacet/metamodel/v0_2_0/efacet/query/impl/IntegerLiteralQueryImpl.java new file mode 100644 index 0000000..0adb818 --- /dev/null +++ b/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/modisco/facet/efacet/metamodel/v0_2_0/efacet/query/impl/IntegerLiteralQueryImpl.java
@@ -0,0 +1,182 @@ +/** + * Copyright (c) 2011-2012 Mia-Software. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Gregoire Dupe (Mia-Software) - Design + * Nicolas Guyomar (Mia-Software) - Implementation + * Emmanuelle Rouillé (Mia-Software) - Bug 352618 - To be able to use non derived facet structural features and save them values. + * Nicolas Bros (Mia-Software) - Bug 361823 - [Restructuring] eFacet2 meta-model + * Gregoire Dupe (Mia-Software) - Bug 366055 - NavigationQuery + * Gregoire Dupe (Mia-Software) - Bug 369673 - [Facet] IsOneOfQuery + * Olivier Remaud (Soft-Maint) - Bug 369824 - Add a simple way to return string literal constants from a customization query + * Gregoire Dupe (Mia-Software) - Bug 369987 - [Restructuring][Table] Switch to the new customization and facet framework + * Gregoire Dupe (Mia-software) - Bug 364325 - [Restructuring] The user must be able to navigate into a model using the Facet. + * Nicolas Bros (Mia-Software) - Bug 372626 - [Facet] Aggregates + * Nicolas Bros (Mia-Software) - Bug 376941 - [EFacet] Facet operation arguments in Facet model + * + */ +package org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.query.impl; + +import org.eclipse.emf.common.notify.Notification; + +import org.eclipse.emf.ecore.EClass; + +import org.eclipse.emf.ecore.impl.ENotificationImpl; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.extensible.impl.QueryImpl; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.query.IntegerLiteralQuery; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.query.QueryPackage; + +/** + * <!-- begin-user-doc --> + * An implementation of the model object '<em><b>Integer Literal Query</b></em>'. + * <!-- end-user-doc --> + * <p> + * The following features are implemented: + * <ul> + * <li>{@link org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.query.impl.IntegerLiteralQueryImpl#getValue <em>Value</em>}</li> + * </ul> + * </p> + * + * @generated + */ +public class IntegerLiteralQueryImpl extends QueryImpl implements IntegerLiteralQuery { + /** + * The default value of the '{@link #getValue() <em>Value</em>}' attribute. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @see #getValue() + * @generated + * @ordered + */ + protected static final int VALUE_EDEFAULT = 0; + + /** + * The cached value of the '{@link #getValue() <em>Value</em>}' attribute. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @see #getValue() + * @generated + * @ordered + */ + protected int value = VALUE_EDEFAULT; + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + protected IntegerLiteralQueryImpl() { + super(); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + protected EClass eStaticClass() { + return QueryPackage.Literals.INTEGER_LITERAL_QUERY; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public int getValue() { + return value; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public void setValue(int newValue) { + int oldValue = value; + value = newValue; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.SET, QueryPackage.INTEGER_LITERAL_QUERY__VALUE, oldValue, value)); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + public Object eGet(int featureID, boolean resolve, boolean coreType) { + switch (featureID) { + case QueryPackage.INTEGER_LITERAL_QUERY__VALUE: + return getValue(); + } + return super.eGet(featureID, resolve, coreType); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + public void eSet(int featureID, Object newValue) { + switch (featureID) { + case QueryPackage.INTEGER_LITERAL_QUERY__VALUE: + setValue((Integer)newValue); + return; + } + super.eSet(featureID, newValue); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + public void eUnset(int featureID) { + switch (featureID) { + case QueryPackage.INTEGER_LITERAL_QUERY__VALUE: + setValue(VALUE_EDEFAULT); + return; + } + super.eUnset(featureID); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + public boolean eIsSet(int featureID) { + switch (featureID) { + case QueryPackage.INTEGER_LITERAL_QUERY__VALUE: + return value != VALUE_EDEFAULT; + } + return super.eIsSet(featureID); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + public String toString() { + if (eIsProxy()) return super.toString(); + + StringBuffer result = new StringBuffer(super.toString()); + result.append(" (value: "); //$NON-NLS-1$ + result.append(value); + result.append(')'); + return result.toString(); + } + +} //IntegerLiteralQueryImpl
diff --git a/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/modisco/facet/efacet/metamodel/v0_2_0/efacet/query/impl/IsOneOfQueryImpl.java b/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/modisco/facet/efacet/metamodel/v0_2_0/efacet/query/impl/IsOneOfQueryImpl.java new file mode 100644 index 0000000..e6de6b2 --- /dev/null +++ b/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/modisco/facet/efacet/metamodel/v0_2_0/efacet/query/impl/IsOneOfQueryImpl.java
@@ -0,0 +1,144 @@ +/** + * Copyright (c) 2012 Mia-Software. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Gregoire Dupe (Mia-Software) - Design + * Nicolas Guyomar (Mia-Software) - Implementation + * Emmanuelle Rouillé (Mia-Software) - Bug 352618 - To be able to use non derived facet structural features and save them values. + * Nicolas Bros (Mia-Software) - Bug 361823 - [Restructuring] eFacet2 meta-model + * Gregoire Dupe (Mia-Software) - Bug 366055 - NavigationQuery + * Gregoire Dupe (Mia-Software) - Bug 369673 - [Facet] IsOneOfQuery + */ +package org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.query.impl; + +import java.util.Collection; + +import org.eclipse.emf.common.util.EList; +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.ecore.util.EObjectResolvingEList; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.extensible.impl.QueryImpl; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.query.IsOneOfQuery; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.query.QueryPackage; + +/** + * <!-- begin-user-doc --> + * An implementation of the model object '<em><b>Is One Of Query</b></em>'. + * <!-- end-user-doc --> + * <p> + * The following features are implemented: + * <ul> + * <li>{@link org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.query.impl.IsOneOfQueryImpl#getExpectedEObjects <em>Expected EObjects</em>}</li> + * </ul> + * </p> + * + * @generated + */ +public class IsOneOfQueryImpl extends QueryImpl implements IsOneOfQuery { + /** + * The cached value of the '{@link #getExpectedEObjects() <em>Expected EObjects</em>}' reference list. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @see #getExpectedEObjects() + * @generated + * @ordered + */ + protected EList<EObject> expectedEObjects; + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + protected IsOneOfQueryImpl() { + super(); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + protected EClass eStaticClass() { + return QueryPackage.Literals.IS_ONE_OF_QUERY; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public EList<EObject> getExpectedEObjects() { + if (expectedEObjects == null) { + expectedEObjects = new EObjectResolvingEList<EObject>(EObject.class, this, QueryPackage.IS_ONE_OF_QUERY__EXPECTED_EOBJECTS); + } + return expectedEObjects; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + public Object eGet(int featureID, boolean resolve, boolean coreType) { + switch (featureID) { + case QueryPackage.IS_ONE_OF_QUERY__EXPECTED_EOBJECTS: + return getExpectedEObjects(); + } + return super.eGet(featureID, resolve, coreType); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @SuppressWarnings("unchecked") + @Override + public void eSet(int featureID, Object newValue) { + switch (featureID) { + case QueryPackage.IS_ONE_OF_QUERY__EXPECTED_EOBJECTS: + getExpectedEObjects().clear(); + getExpectedEObjects().addAll((Collection<? extends EObject>)newValue); + return; + } + super.eSet(featureID, newValue); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + public void eUnset(int featureID) { + switch (featureID) { + case QueryPackage.IS_ONE_OF_QUERY__EXPECTED_EOBJECTS: + getExpectedEObjects().clear(); + return; + } + super.eUnset(featureID); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + public boolean eIsSet(int featureID) { + switch (featureID) { + case QueryPackage.IS_ONE_OF_QUERY__EXPECTED_EOBJECTS: + return expectedEObjects != null && !expectedEObjects.isEmpty(); + } + return super.eIsSet(featureID); + } + +} //IsOneOfQueryImpl
diff --git a/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/modisco/facet/efacet/metamodel/v0_2_0/efacet/query/impl/NavigationQueryImpl.java b/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/modisco/facet/efacet/metamodel/v0_2_0/efacet/query/impl/NavigationQueryImpl.java new file mode 100644 index 0000000..622eda6 --- /dev/null +++ b/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/modisco/facet/efacet/metamodel/v0_2_0/efacet/query/impl/NavigationQueryImpl.java
@@ -0,0 +1,212 @@ +/** + * Copyright (c) 2011 Mia-Software. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Gregoire Dupe (Mia-Software) - Design + * Nicolas Guyomar (Mia-Software) - Implementation + * Emmanuelle Rouillé (Mia-Software) - Bug 352618 - To be able to use non derived facet structural features and save them values. + * Nicolas Bros (Mia-Software) - Bug 361823 - [Restructuring] eFacet2 meta-model + * Gregoire Dupe (Mia-Software) - Bug 366055 - NavigationQuery + */ +package org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.query.impl; + +import java.util.Collection; + +import org.eclipse.emf.common.notify.Notification; +import org.eclipse.emf.common.util.EList; +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.ETypedElement; +import org.eclipse.emf.ecore.impl.ENotificationImpl; +import org.eclipse.emf.ecore.util.EObjectResolvingEList; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.extensible.impl.QueryImpl; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.query.NavigationQuery; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.query.QueryPackage; + +/** + * <!-- begin-user-doc --> + * An implementation of the model object '<em><b>Navigation Query</b></em>'. + * <!-- end-user-doc --> + * <p> + * The following features are implemented: + * <ul> + * <li>{@link org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.query.impl.NavigationQueryImpl#getPath <em>Path</em>}</li> + * <li>{@link org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.query.impl.NavigationQueryImpl#isFailOnError <em>Fail On Error</em>}</li> + * </ul> + * </p> + * + * @generated + */ +public class NavigationQueryImpl extends QueryImpl implements NavigationQuery { + /** + * The cached value of the '{@link #getPath() <em>Path</em>}' reference list. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @see #getPath() + * @generated + * @ordered + */ + protected EList<ETypedElement> path; + + /** + * The default value of the '{@link #isFailOnError() <em>Fail On Error</em>}' attribute. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @see #isFailOnError() + * @generated + * @ordered + */ + protected static final boolean FAIL_ON_ERROR_EDEFAULT = true; + /** + * The cached value of the '{@link #isFailOnError() <em>Fail On Error</em>}' attribute. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @see #isFailOnError() + * @generated + * @ordered + */ + protected boolean failOnError = FAIL_ON_ERROR_EDEFAULT; + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + protected NavigationQueryImpl() { + super(); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + protected EClass eStaticClass() { + return QueryPackage.Literals.NAVIGATION_QUERY; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public EList<ETypedElement> getPath() { + if (path == null) { + path = new EObjectResolvingEList<ETypedElement>(ETypedElement.class, this, QueryPackage.NAVIGATION_QUERY__PATH); + } + return path; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public boolean isFailOnError() { + return failOnError; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public void setFailOnError(boolean newFailOnError) { + boolean oldFailOnError = failOnError; + failOnError = newFailOnError; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.SET, QueryPackage.NAVIGATION_QUERY__FAIL_ON_ERROR, oldFailOnError, failOnError)); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + public Object eGet(int featureID, boolean resolve, boolean coreType) { + switch (featureID) { + case QueryPackage.NAVIGATION_QUERY__PATH: + return getPath(); + case QueryPackage.NAVIGATION_QUERY__FAIL_ON_ERROR: + return isFailOnError(); + } + return super.eGet(featureID, resolve, coreType); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @SuppressWarnings("unchecked") + @Override + public void eSet(int featureID, Object newValue) { + switch (featureID) { + case QueryPackage.NAVIGATION_QUERY__PATH: + getPath().clear(); + getPath().addAll((Collection<? extends ETypedElement>)newValue); + return; + case QueryPackage.NAVIGATION_QUERY__FAIL_ON_ERROR: + setFailOnError((Boolean)newValue); + return; + } + super.eSet(featureID, newValue); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + public void eUnset(int featureID) { + switch (featureID) { + case QueryPackage.NAVIGATION_QUERY__PATH: + getPath().clear(); + return; + case QueryPackage.NAVIGATION_QUERY__FAIL_ON_ERROR: + setFailOnError(FAIL_ON_ERROR_EDEFAULT); + return; + } + super.eUnset(featureID); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + public boolean eIsSet(int featureID) { + switch (featureID) { + case QueryPackage.NAVIGATION_QUERY__PATH: + return path != null && !path.isEmpty(); + case QueryPackage.NAVIGATION_QUERY__FAIL_ON_ERROR: + return failOnError != FAIL_ON_ERROR_EDEFAULT; + } + return super.eIsSet(featureID); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + public String toString() { + if (eIsProxy()) return super.toString(); + + StringBuffer result = new StringBuffer(super.toString()); + result.append(" (failOnError: "); //$NON-NLS-1$ + result.append(failOnError); + result.append(')'); + return result.toString(); + } + +} //NavigationQueryImpl
diff --git a/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/modisco/facet/efacet/metamodel/v0_2_0/efacet/query/impl/NullLiteralQueryImpl.java b/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/modisco/facet/efacet/metamodel/v0_2_0/efacet/query/impl/NullLiteralQueryImpl.java new file mode 100644 index 0000000..7979a0f --- /dev/null +++ b/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/modisco/facet/efacet/metamodel/v0_2_0/efacet/query/impl/NullLiteralQueryImpl.java
@@ -0,0 +1,55 @@ +/** + * Copyright (c) 2011 Mia-Software. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Gregoire Dupe (Mia-Software) - Design + * Nicolas Guyomar (Mia-Software) - Implementation + * Emmanuelle Rouillé (Mia-Software) - Bug 352618 - To be able to use non derived facet structural features and save them values. + * Nicolas Bros (Mia-Software) - Bug 361823 - [Restructuring] eFacet2 meta-model + * Gregoire Dupe (Mia-Software) - Bug 366055 - NavigationQuery + * Gregoire Dupe (Mia-Software) - Bug 369673 - [Facet] IsOneOfQuery + * Olivier Remaud (Soft-Maint) - Bug 369824 - Add a simple way to return string literal constants from a customization query + * Gregoire Dupe (Mia-software) - Bug 369987 - [Restructuring][Table] Switch to the new customization and facet framework + */ +package org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.query.impl; + +import org.eclipse.emf.ecore.EClass; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.extensible.impl.QueryImpl; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.query.NullLiteralQuery; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.query.QueryPackage; + +/** + * <!-- begin-user-doc --> + * An implementation of the model object '<em><b>Null Literal Query</b></em>'. + * <!-- end-user-doc --> + * <p> + * </p> + * + * @generated + */ +public class NullLiteralQueryImpl extends QueryImpl implements NullLiteralQuery { + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + protected NullLiteralQueryImpl() { + super(); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + protected EClass eStaticClass() { + return QueryPackage.Literals.NULL_LITERAL_QUERY; + } + +} //NullLiteralQueryImpl
diff --git a/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/modisco/facet/efacet/metamodel/v0_2_0/efacet/query/impl/OperationCallQueryImpl.java b/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/modisco/facet/efacet/metamodel/v0_2_0/efacet/query/impl/OperationCallQueryImpl.java new file mode 100644 index 0000000..45d38af --- /dev/null +++ b/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/modisco/facet/efacet/metamodel/v0_2_0/efacet/query/impl/OperationCallQueryImpl.java
@@ -0,0 +1,236 @@ +/** + * Copyright (c) 2011-2012 Mia-Software. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Gregoire Dupe (Mia-Software) - Design + * Nicolas Guyomar (Mia-Software) - Implementation + * Emmanuelle Rouillé (Mia-Software) - Bug 352618 - To be able to use non derived facet structural features and save them values. + * Nicolas Bros (Mia-Software) - Bug 361823 - [Restructuring] eFacet2 meta-model + * Gregoire Dupe (Mia-Software) - Bug 366055 - NavigationQuery + * Gregoire Dupe (Mia-Software) - Bug 369673 - [Facet] IsOneOfQuery + * Olivier Remaud (Soft-Maint) - Bug 369824 - Add a simple way to return string literal constants from a customization query + * Gregoire Dupe (Mia-Software) - Bug 369987 - [Restructuring][Table] Switch to the new customization and facet framework + * Gregoire Dupe (Mia-software) - Bug 364325 - [Restructuring] The user must be able to navigate into a model using the Facet. + * Nicolas Bros (Mia-Software) - Bug 372626 - [Facet] Aggregates + * Nicolas Bros (Mia-Software) - Bug 376941 - [EFacet] Facet operation arguments in Facet model + * + */ +package org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.query.impl; + +import java.util.Collection; + +import org.eclipse.emf.common.notify.Notification; +import org.eclipse.emf.common.notify.NotificationChain; + +import org.eclipse.emf.common.util.EList; + +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.EOperation; +import org.eclipse.emf.ecore.ETypedElement; +import org.eclipse.emf.ecore.InternalEObject; + +import org.eclipse.emf.ecore.impl.ENotificationImpl; + +import org.eclipse.emf.ecore.util.EObjectResolvingEList; +import org.eclipse.emf.ecore.util.EObjectContainmentEList; +import org.eclipse.emf.ecore.util.InternalEList; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.extensible.Query; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.extensible.impl.QueryImpl; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.query.OperationCallQuery; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.query.QueryPackage; + +/** + * <!-- begin-user-doc --> + * An implementation of the model object '<em><b>Operation Call Query</b></em>'. + * <!-- end-user-doc --> + * <p> + * The following features are implemented: + * <ul> + * <li>{@link org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.query.impl.OperationCallQueryImpl#getOperation <em>Operation</em>}</li> + * <li>{@link org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.query.impl.OperationCallQueryImpl#getArguments <em>Arguments</em>}</li> + * </ul> + * </p> + * + * @generated + */ +public class OperationCallQueryImpl extends QueryImpl implements OperationCallQuery { + /** + * The cached value of the '{@link #getOperation() <em>Operation</em>}' reference. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @see #getOperation() + * @generated + * @ordered + */ + protected EOperation operation; + + /** + * The cached value of the '{@link #getArguments() <em>Arguments</em>}' containment reference list. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @see #getArguments() + * @generated + * @ordered + */ + protected EList<Query> arguments; + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + protected OperationCallQueryImpl() { + super(); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + protected EClass eStaticClass() { + return QueryPackage.Literals.OPERATION_CALL_QUERY; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public EOperation getOperation() { + if (operation != null && operation.eIsProxy()) { + InternalEObject oldOperation = (InternalEObject)operation; + operation = (EOperation)eResolveProxy(oldOperation); + if (operation != oldOperation) { + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.RESOLVE, QueryPackage.OPERATION_CALL_QUERY__OPERATION, oldOperation, operation)); + } + } + return operation; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public EOperation basicGetOperation() { + return operation; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public void setOperation(EOperation newOperation) { + EOperation oldOperation = operation; + operation = newOperation; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.SET, QueryPackage.OPERATION_CALL_QUERY__OPERATION, oldOperation, operation)); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public EList<Query> getArguments() { + if (arguments == null) { + arguments = new EObjectContainmentEList<Query>(Query.class, this, QueryPackage.OPERATION_CALL_QUERY__ARGUMENTS); + } + return arguments; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { + switch (featureID) { + case QueryPackage.OPERATION_CALL_QUERY__ARGUMENTS: + return ((InternalEList<?>)getArguments()).basicRemove(otherEnd, msgs); + } + return super.eInverseRemove(otherEnd, featureID, msgs); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + public Object eGet(int featureID, boolean resolve, boolean coreType) { + switch (featureID) { + case QueryPackage.OPERATION_CALL_QUERY__OPERATION: + if (resolve) return getOperation(); + return basicGetOperation(); + case QueryPackage.OPERATION_CALL_QUERY__ARGUMENTS: + return getArguments(); + } + return super.eGet(featureID, resolve, coreType); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @SuppressWarnings("unchecked") + @Override + public void eSet(int featureID, Object newValue) { + switch (featureID) { + case QueryPackage.OPERATION_CALL_QUERY__OPERATION: + setOperation((EOperation)newValue); + return; + case QueryPackage.OPERATION_CALL_QUERY__ARGUMENTS: + getArguments().clear(); + getArguments().addAll((Collection<? extends Query>)newValue); + return; + } + super.eSet(featureID, newValue); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + public void eUnset(int featureID) { + switch (featureID) { + case QueryPackage.OPERATION_CALL_QUERY__OPERATION: + setOperation((EOperation)null); + return; + case QueryPackage.OPERATION_CALL_QUERY__ARGUMENTS: + getArguments().clear(); + return; + } + super.eUnset(featureID); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + public boolean eIsSet(int featureID) { + switch (featureID) { + case QueryPackage.OPERATION_CALL_QUERY__OPERATION: + return operation != null; + case QueryPackage.OPERATION_CALL_QUERY__ARGUMENTS: + return arguments != null && !arguments.isEmpty(); + } + return super.eIsSet(featureID); + } + +} //OperationCallQueryImpl
diff --git a/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/modisco/facet/efacet/metamodel/v0_2_0/efacet/query/impl/QueryFactoryImpl.java b/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/modisco/facet/efacet/metamodel/v0_2_0/efacet/query/impl/QueryFactoryImpl.java new file mode 100644 index 0000000..291b8c6 --- /dev/null +++ b/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/modisco/facet/efacet/metamodel/v0_2_0/efacet/query/impl/QueryFactoryImpl.java
@@ -0,0 +1,212 @@ +/** + * Copyright (c) 2011, 2015 Mia-Software, and Soft-Maint. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Gregoire Dupe (Mia-Software) - Design + * Nicolas Guyomar (Mia-Software) - Implementation + * Emmanuelle Rouillé (Mia-Software) - Bug 352618 - To be able to use non derived facet structural features and save them values. + * Nicolas Bros (Mia-Software) - Bug 361823 - [Restructuring] eFacet2 meta-model + * Gregoire Dupe (Mia-Software) - Bug 366055 - NavigationQuery + * Gregoire Dupe (Mia-Software) - Bug 369673 - [Facet] IsOneOfQuery + * Olivier Remaud (Soft-Maint) - Bug 369824 - Add a simple way to return string literal constants from a customization query + * Gregoire Dupe (Mia-Software) - Bug 369987 - [Restructuring][Table] Switch to the new customization and facet framework + * Gregoire Dupe (Mia-software) - Bug 364325 - [Restructuring] The user must be able to navigate into a model using the Facet. + * Nicolas Bros (Mia-Software) - Bug 372626 - [Facet] Aggregates + * Nicolas Bros (Mia-Software) - Bug 376941 - [EFacet] Facet operation arguments in Facet model + * Gregoire Dupe (Mia-Software) - Bug 376576 - [EFacet] Change the multiplicity of Facet::extendedFacet + * Jonathan Pepin (Soft-Maint) - Bug 463898 - Create FacetReference not derived, without query and with opposite mechanism + */ +package org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.query.impl; + +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.ecore.EPackage; +import org.eclipse.emf.ecore.impl.EFactoryImpl; +import org.eclipse.emf.ecore.plugin.EcorePlugin; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.query.*; + +/** + * <!-- begin-user-doc --> + * An implementation of the model <b>Factory</b>. + * <!-- end-user-doc --> + * @generated + */ +public class QueryFactoryImpl extends EFactoryImpl implements QueryFactory { + /** + * Creates the default factory implementation. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public static QueryFactory init() { + try { + QueryFactory theQueryFactory = (QueryFactory)EPackage.Registry.INSTANCE.getEFactory(QueryPackage.eNS_URI); + if (theQueryFactory != null) { + return theQueryFactory; + } + } + catch (Exception exception) { + EcorePlugin.INSTANCE.log(exception); + } + return new QueryFactoryImpl(); + } + + /** + * Creates an instance of the factory. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public QueryFactoryImpl() { + super(); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + public EObject create(EClass eClass) { + switch (eClass.getClassifierID()) { + case QueryPackage.NAVIGATION_QUERY: return createNavigationQuery(); + case QueryPackage.IS_ONE_OF_QUERY: return createIsOneOfQuery(); + case QueryPackage.STRING_LITERAL_QUERY: return createStringLiteralQuery(); + case QueryPackage.TRUE_LITERAL_QUERY: return createTrueLiteralQuery(); + case QueryPackage.FALSE_LITERAL_QUERY: return createFalseLiteralQuery(); + case QueryPackage.NULL_LITERAL_QUERY: return createNullLiteralQuery(); + case QueryPackage.INTEGER_LITERAL_QUERY: return createIntegerLiteralQuery(); + case QueryPackage.FLOAT_LITERAL_QUERY: return createFloatLiteralQuery(); + case QueryPackage.EOBJECT_LITERAL_QUERY: return createEObjectLiteralQuery(); + case QueryPackage.OPERATION_CALL_QUERY: return createOperationCallQuery(); + default: + throw new IllegalArgumentException("The class '" + eClass.getName() + "' is not a valid classifier"); //$NON-NLS-1$ //$NON-NLS-2$ + } + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public NavigationQuery createNavigationQuery() { + NavigationQueryImpl navigationQuery = new NavigationQueryImpl(); + return navigationQuery; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public IsOneOfQuery createIsOneOfQuery() { + IsOneOfQueryImpl isOneOfQuery = new IsOneOfQueryImpl(); + return isOneOfQuery; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public StringLiteralQuery createStringLiteralQuery() { + StringLiteralQueryImpl stringLiteralQuery = new StringLiteralQueryImpl(); + return stringLiteralQuery; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public TrueLiteralQuery createTrueLiteralQuery() { + TrueLiteralQueryImpl trueLiteralQuery = new TrueLiteralQueryImpl(); + return trueLiteralQuery; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public FalseLiteralQuery createFalseLiteralQuery() { + FalseLiteralQueryImpl falseLiteralQuery = new FalseLiteralQueryImpl(); + return falseLiteralQuery; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public NullLiteralQuery createNullLiteralQuery() { + NullLiteralQueryImpl nullLiteralQuery = new NullLiteralQueryImpl(); + return nullLiteralQuery; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public IntegerLiteralQuery createIntegerLiteralQuery() { + IntegerLiteralQueryImpl integerLiteralQuery = new IntegerLiteralQueryImpl(); + return integerLiteralQuery; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public FloatLiteralQuery createFloatLiteralQuery() { + FloatLiteralQueryImpl floatLiteralQuery = new FloatLiteralQueryImpl(); + return floatLiteralQuery; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public EObjectLiteralQuery createEObjectLiteralQuery() { + EObjectLiteralQueryImpl eObjectLiteralQuery = new EObjectLiteralQueryImpl(); + return eObjectLiteralQuery; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public OperationCallQuery createOperationCallQuery() { + OperationCallQueryImpl operationCallQuery = new OperationCallQueryImpl(); + return operationCallQuery; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public QueryPackage getQueryPackage() { + return (QueryPackage)getEPackage(); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @deprecated + * @generated + */ + @Deprecated + public static QueryPackage getPackage() { + return QueryPackage.eINSTANCE; + } + +} //QueryFactoryImpl
diff --git a/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/modisco/facet/efacet/metamodel/v0_2_0/efacet/query/impl/QueryPackageImpl.java b/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/modisco/facet/efacet/metamodel/v0_2_0/efacet/query/impl/QueryPackageImpl.java new file mode 100644 index 0000000..ab73414 --- /dev/null +++ b/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/modisco/facet/efacet/metamodel/v0_2_0/efacet/query/impl/QueryPackageImpl.java
@@ -0,0 +1,504 @@ +/** + * Copyright (c) 2011, 2012 Mia-Software. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Gregoire Dupe (Mia-Software) - Design + * Nicolas Guyomar (Mia-Software) - Implementation + * Emmanuelle Rouillé (Mia-Software) - Bug 352618 - To be able to use non derived facet structural features and save them values. + * Nicolas Bros (Mia-Software) - Bug 361823 - [Restructuring] eFacet2 meta-model + * Gregoire Dupe (Mia-Software) - Bug 366055 - NavigationQuery + * Gregoire Dupe (Mia-Software) - Bug 369987 - [Restructuring][Table] Switch to the new customization and facet framework + * Gregoire Dupe (Mia-Software) - Bug 364325 - [Restructuring] The user must be able to navigate into a model using the Facet. + */ +package org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.query.impl; + +import org.eclipse.emf.ecore.EAttribute; +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.EPackage; +import org.eclipse.emf.ecore.EReference; +import org.eclipse.emf.ecore.EcorePackage; +import org.eclipse.emf.ecore.impl.EPackageImpl; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.EFacetPackage; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.extensible.ExtensiblePackage; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.extensible.impl.ExtensiblePackageImpl; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.impl.EFacetPackageImpl; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.query.EObjectLiteralQuery; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.query.FalseLiteralQuery; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.query.FloatLiteralQuery; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.query.IntegerLiteralQuery; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.query.IsOneOfQuery; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.query.NavigationQuery; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.query.NullLiteralQuery; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.query.OperationCallQuery; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.query.QueryFactory; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.query.QueryPackage; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.query.StringLiteralQuery; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.query.TrueLiteralQuery; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.runtime.RuntimePackage; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.runtime.impl.RuntimePackageImpl; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.serialization.SerializationPackage; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.serialization.impl.SerializationPackageImpl; + +/** + * <!-- begin-user-doc --> + * An implementation of the model <b>Package</b>. + * <!-- end-user-doc --> + * @generated + */ +public class QueryPackageImpl extends EPackageImpl implements QueryPackage { + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + private EClass navigationQueryEClass = null; + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + private EClass isOneOfQueryEClass = null; + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + private EClass stringLiteralQueryEClass = null; + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + private EClass trueLiteralQueryEClass = null; + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + private EClass falseLiteralQueryEClass = null; + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + private EClass nullLiteralQueryEClass = null; + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + private EClass integerLiteralQueryEClass = null; + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + private EClass floatLiteralQueryEClass = null; + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + private EClass eObjectLiteralQueryEClass = null; + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + private EClass operationCallQueryEClass = null; + + /** + * Creates an instance of the model <b>Package</b>, registered with + * {@link org.eclipse.emf.ecore.EPackage.Registry EPackage.Registry} by the package + * package URI value. + * <p>Note: the correct way to create the package is via the static + * factory method {@link #init init()}, which also performs + * initialization of the package, or returns the registered package, + * if one already exists. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @see org.eclipse.emf.ecore.EPackage.Registry + * @see org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.query.QueryPackage#eNS_URI + * @see #init() + * @generated + */ + private QueryPackageImpl() { + super(eNS_URI, QueryFactory.eINSTANCE); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + private static boolean isInited = false; + + /** + * Creates, registers, and initializes the <b>Package</b> for this model, and for any others upon which it depends. + * + * <p>This method is used to initialize {@link QueryPackage#eINSTANCE} when that field is accessed. + * Clients should not invoke it directly. Instead, they should simply access that field to obtain the package. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @see #eNS_URI + * @see #createPackageContents() + * @see #initializePackageContents() + * @generated + */ + public static QueryPackage init() { + if (isInited) return (QueryPackage)EPackage.Registry.INSTANCE.getEPackage(QueryPackage.eNS_URI); + + // Obtain or create and register package + QueryPackageImpl theQueryPackage = (QueryPackageImpl)(EPackage.Registry.INSTANCE.get(eNS_URI) instanceof QueryPackageImpl ? EPackage.Registry.INSTANCE.get(eNS_URI) : new QueryPackageImpl()); + + isInited = true; + + // Initialize simple dependencies + EcorePackage.eINSTANCE.eClass(); + + // Obtain or create and register interdependencies + EFacetPackageImpl theEFacetPackage = (EFacetPackageImpl)(EPackage.Registry.INSTANCE.getEPackage(EFacetPackage.eNS_URI) instanceof EFacetPackageImpl ? EPackage.Registry.INSTANCE.getEPackage(EFacetPackage.eNS_URI) : EFacetPackage.eINSTANCE); + SerializationPackageImpl theSerializationPackage = (SerializationPackageImpl)(EPackage.Registry.INSTANCE.getEPackage(SerializationPackage.eNS_URI) instanceof SerializationPackageImpl ? EPackage.Registry.INSTANCE.getEPackage(SerializationPackage.eNS_URI) : SerializationPackage.eINSTANCE); + ExtensiblePackageImpl theExtensiblePackage = (ExtensiblePackageImpl)(EPackage.Registry.INSTANCE.getEPackage(ExtensiblePackage.eNS_URI) instanceof ExtensiblePackageImpl ? EPackage.Registry.INSTANCE.getEPackage(ExtensiblePackage.eNS_URI) : ExtensiblePackage.eINSTANCE); + RuntimePackageImpl theRuntimePackage = (RuntimePackageImpl)(EPackage.Registry.INSTANCE.getEPackage(RuntimePackage.eNS_URI) instanceof RuntimePackageImpl ? EPackage.Registry.INSTANCE.getEPackage(RuntimePackage.eNS_URI) : RuntimePackage.eINSTANCE); + + // Create package meta-data objects + theQueryPackage.createPackageContents(); + theEFacetPackage.createPackageContents(); + theSerializationPackage.createPackageContents(); + theExtensiblePackage.createPackageContents(); + theRuntimePackage.createPackageContents(); + + // Initialize created meta-data + theQueryPackage.initializePackageContents(); + theEFacetPackage.initializePackageContents(); + theSerializationPackage.initializePackageContents(); + theExtensiblePackage.initializePackageContents(); + theRuntimePackage.initializePackageContents(); + + // Mark meta-data to indicate it can't be changed + theQueryPackage.freeze(); + + + // Update the registry and return the package + EPackage.Registry.INSTANCE.put(QueryPackage.eNS_URI, theQueryPackage); + return theQueryPackage; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public EClass getNavigationQuery() { + return navigationQueryEClass; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public EReference getNavigationQuery_Path() { + return (EReference)navigationQueryEClass.getEStructuralFeatures().get(0); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public EAttribute getNavigationQuery_FailOnError() { + return (EAttribute)navigationQueryEClass.getEStructuralFeatures().get(1); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public EClass getIsOneOfQuery() { + return isOneOfQueryEClass; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public EReference getIsOneOfQuery_ExpectedEObjects() { + return (EReference)isOneOfQueryEClass.getEStructuralFeatures().get(0); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public EClass getStringLiteralQuery() { + return stringLiteralQueryEClass; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public EAttribute getStringLiteralQuery_Value() { + return (EAttribute)stringLiteralQueryEClass.getEStructuralFeatures().get(0); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public EClass getTrueLiteralQuery() { + return trueLiteralQueryEClass; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public EClass getFalseLiteralQuery() { + return falseLiteralQueryEClass; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public EClass getNullLiteralQuery() { + return nullLiteralQueryEClass; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public EClass getIntegerLiteralQuery() { + return integerLiteralQueryEClass; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public EAttribute getIntegerLiteralQuery_Value() { + return (EAttribute)integerLiteralQueryEClass.getEStructuralFeatures().get(0); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public EClass getFloatLiteralQuery() { + return floatLiteralQueryEClass; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public EAttribute getFloatLiteralQuery_Value() { + return (EAttribute)floatLiteralQueryEClass.getEStructuralFeatures().get(0); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public EClass getEObjectLiteralQuery() { + return eObjectLiteralQueryEClass; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public EReference getEObjectLiteralQuery_Element() { + return (EReference)eObjectLiteralQueryEClass.getEStructuralFeatures().get(0); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public EClass getOperationCallQuery() { + return operationCallQueryEClass; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public EReference getOperationCallQuery_Operation() { + return (EReference)operationCallQueryEClass.getEStructuralFeatures().get(0); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public EReference getOperationCallQuery_Arguments() { + return (EReference)operationCallQueryEClass.getEStructuralFeatures().get(1); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public QueryFactory getQueryFactory() { + return (QueryFactory)getEFactoryInstance(); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + private boolean isCreated = false; + + /** + * Creates the meta-model objects for the package. This method is + * guarded to have no affect on any invocation but its first. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public void createPackageContents() { + if (isCreated) return; + isCreated = true; + + // Create classes and their features + navigationQueryEClass = createEClass(NAVIGATION_QUERY); + createEReference(navigationQueryEClass, NAVIGATION_QUERY__PATH); + createEAttribute(navigationQueryEClass, NAVIGATION_QUERY__FAIL_ON_ERROR); + + isOneOfQueryEClass = createEClass(IS_ONE_OF_QUERY); + createEReference(isOneOfQueryEClass, IS_ONE_OF_QUERY__EXPECTED_EOBJECTS); + + stringLiteralQueryEClass = createEClass(STRING_LITERAL_QUERY); + createEAttribute(stringLiteralQueryEClass, STRING_LITERAL_QUERY__VALUE); + + trueLiteralQueryEClass = createEClass(TRUE_LITERAL_QUERY); + + falseLiteralQueryEClass = createEClass(FALSE_LITERAL_QUERY); + + nullLiteralQueryEClass = createEClass(NULL_LITERAL_QUERY); + + integerLiteralQueryEClass = createEClass(INTEGER_LITERAL_QUERY); + createEAttribute(integerLiteralQueryEClass, INTEGER_LITERAL_QUERY__VALUE); + + floatLiteralQueryEClass = createEClass(FLOAT_LITERAL_QUERY); + createEAttribute(floatLiteralQueryEClass, FLOAT_LITERAL_QUERY__VALUE); + + eObjectLiteralQueryEClass = createEClass(EOBJECT_LITERAL_QUERY); + createEReference(eObjectLiteralQueryEClass, EOBJECT_LITERAL_QUERY__ELEMENT); + + operationCallQueryEClass = createEClass(OPERATION_CALL_QUERY); + createEReference(operationCallQueryEClass, OPERATION_CALL_QUERY__OPERATION); + createEReference(operationCallQueryEClass, OPERATION_CALL_QUERY__ARGUMENTS); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + private boolean isInitialized = false; + + /** + * Complete the initialization of the package and its meta-model. This + * method is guarded to have no affect on any invocation but its first. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public void initializePackageContents() { + if (isInitialized) return; + isInitialized = true; + + // Initialize package + setName(eNAME); + setNsPrefix(eNS_PREFIX); + setNsURI(eNS_URI); + + // Obtain other dependent packages + ExtensiblePackage theExtensiblePackage = (ExtensiblePackage)EPackage.Registry.INSTANCE.getEPackage(ExtensiblePackage.eNS_URI); + + // Create type parameters + + // Set bounds for type parameters + + // Add supertypes to classes + navigationQueryEClass.getESuperTypes().add(theExtensiblePackage.getQuery()); + isOneOfQueryEClass.getESuperTypes().add(theExtensiblePackage.getQuery()); + stringLiteralQueryEClass.getESuperTypes().add(theExtensiblePackage.getQuery()); + trueLiteralQueryEClass.getESuperTypes().add(theExtensiblePackage.getQuery()); + falseLiteralQueryEClass.getESuperTypes().add(theExtensiblePackage.getQuery()); + nullLiteralQueryEClass.getESuperTypes().add(theExtensiblePackage.getQuery()); + integerLiteralQueryEClass.getESuperTypes().add(theExtensiblePackage.getQuery()); + floatLiteralQueryEClass.getESuperTypes().add(theExtensiblePackage.getQuery()); + eObjectLiteralQueryEClass.getESuperTypes().add(theExtensiblePackage.getQuery()); + operationCallQueryEClass.getESuperTypes().add(theExtensiblePackage.getQuery()); + + // Initialize classes and features; add operations and parameters + initEClass(navigationQueryEClass, NavigationQuery.class, "NavigationQuery", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); //$NON-NLS-1$ + initEReference(getNavigationQuery_Path(), ecorePackage.getETypedElement(), null, "path", null, 1, -1, NavigationQuery.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); //$NON-NLS-1$ + initEAttribute(getNavigationQuery_FailOnError(), ecorePackage.getEBoolean(), "failOnError", "true", 0, 1, NavigationQuery.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); //$NON-NLS-1$ //$NON-NLS-2$ + + initEClass(isOneOfQueryEClass, IsOneOfQuery.class, "IsOneOfQuery", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); //$NON-NLS-1$ + initEReference(getIsOneOfQuery_ExpectedEObjects(), ecorePackage.getEObject(), null, "expectedEObjects", null, 0, -1, IsOneOfQuery.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); //$NON-NLS-1$ + + initEClass(stringLiteralQueryEClass, StringLiteralQuery.class, "StringLiteralQuery", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); //$NON-NLS-1$ + initEAttribute(getStringLiteralQuery_Value(), ecorePackage.getEString(), "value", null, 0, 1, StringLiteralQuery.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); //$NON-NLS-1$ + + initEClass(trueLiteralQueryEClass, TrueLiteralQuery.class, "TrueLiteralQuery", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); //$NON-NLS-1$ + + initEClass(falseLiteralQueryEClass, FalseLiteralQuery.class, "FalseLiteralQuery", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); //$NON-NLS-1$ + + initEClass(nullLiteralQueryEClass, NullLiteralQuery.class, "NullLiteralQuery", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); //$NON-NLS-1$ + + initEClass(integerLiteralQueryEClass, IntegerLiteralQuery.class, "IntegerLiteralQuery", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); //$NON-NLS-1$ + initEAttribute(getIntegerLiteralQuery_Value(), ecorePackage.getEInt(), "value", null, 0, 1, IntegerLiteralQuery.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); //$NON-NLS-1$ + + initEClass(floatLiteralQueryEClass, FloatLiteralQuery.class, "FloatLiteralQuery", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); //$NON-NLS-1$ + initEAttribute(getFloatLiteralQuery_Value(), ecorePackage.getEFloat(), "value", null, 0, 1, FloatLiteralQuery.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); //$NON-NLS-1$ + + initEClass(eObjectLiteralQueryEClass, EObjectLiteralQuery.class, "EObjectLiteralQuery", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); //$NON-NLS-1$ + initEReference(getEObjectLiteralQuery_Element(), ecorePackage.getEObject(), null, "element", null, 0, 1, EObjectLiteralQuery.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); //$NON-NLS-1$ + + initEClass(operationCallQueryEClass, OperationCallQuery.class, "OperationCallQuery", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); //$NON-NLS-1$ + initEReference(getOperationCallQuery_Operation(), ecorePackage.getEOperation(), null, "operation", null, 0, 1, OperationCallQuery.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); //$NON-NLS-1$ + initEReference(getOperationCallQuery_Arguments(), theExtensiblePackage.getQuery(), null, "arguments", null, 0, -1, OperationCallQuery.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); //$NON-NLS-1$ + } + +} //QueryPackageImpl
diff --git a/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/modisco/facet/efacet/metamodel/v0_2_0/efacet/query/impl/StringLiteralQueryImpl.java b/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/modisco/facet/efacet/metamodel/v0_2_0/efacet/query/impl/StringLiteralQueryImpl.java new file mode 100644 index 0000000..3f604e6 --- /dev/null +++ b/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/modisco/facet/efacet/metamodel/v0_2_0/efacet/query/impl/StringLiteralQueryImpl.java
@@ -0,0 +1,175 @@ +/** + * Copyright (c) 2011 Mia-Software. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Gregoire Dupe (Mia-Software) - Design + * Nicolas Guyomar (Mia-Software) - Implementation + * Emmanuelle Rouillé (Mia-Software) - Bug 352618 - To be able to use non derived facet structural features and save them values. + * Nicolas Bros (Mia-Software) - Bug 361823 - [Restructuring] eFacet2 meta-model + * Gregoire Dupe (Mia-Software) - Bug 366055 - NavigationQuery + * Gregoire Dupe (Mia-Software) - Bug 369673 - [Facet] IsOneOfQuery + * Olivier Remaud (Soft-Maint) - Bug 369824 - Add a simple way to return string literal constants from a customization query + */ +package org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.query.impl; + +import org.eclipse.emf.common.notify.Notification; +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.impl.ENotificationImpl; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.extensible.impl.QueryImpl; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.query.QueryPackage; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.query.StringLiteralQuery; + +/** + * <!-- begin-user-doc --> + * An implementation of the model object '<em><b>String Literal Query</b></em>'. + * <!-- end-user-doc --> + * <p> + * The following features are implemented: + * <ul> + * <li>{@link org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.query.impl.StringLiteralQueryImpl#getValue <em>Value</em>}</li> + * </ul> + * </p> + * + * @generated + */ +public class StringLiteralQueryImpl extends QueryImpl implements StringLiteralQuery { + /** + * The default value of the '{@link #getValue() <em>Value</em>}' attribute. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @see #getValue() + * @generated + * @ordered + */ + protected static final String VALUE_EDEFAULT = null; + + /** + * The cached value of the '{@link #getValue() <em>Value</em>}' attribute. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @see #getValue() + * @generated + * @ordered + */ + protected String value = VALUE_EDEFAULT; + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + protected StringLiteralQueryImpl() { + super(); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + protected EClass eStaticClass() { + return QueryPackage.Literals.STRING_LITERAL_QUERY; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public String getValue() { + return value; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public void setValue(String newValue) { + String oldValue = value; + value = newValue; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.SET, QueryPackage.STRING_LITERAL_QUERY__VALUE, oldValue, value)); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + public Object eGet(int featureID, boolean resolve, boolean coreType) { + switch (featureID) { + case QueryPackage.STRING_LITERAL_QUERY__VALUE: + return getValue(); + } + return super.eGet(featureID, resolve, coreType); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + public void eSet(int featureID, Object newValue) { + switch (featureID) { + case QueryPackage.STRING_LITERAL_QUERY__VALUE: + setValue((String)newValue); + return; + } + super.eSet(featureID, newValue); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + public void eUnset(int featureID) { + switch (featureID) { + case QueryPackage.STRING_LITERAL_QUERY__VALUE: + setValue(VALUE_EDEFAULT); + return; + } + super.eUnset(featureID); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + public boolean eIsSet(int featureID) { + switch (featureID) { + case QueryPackage.STRING_LITERAL_QUERY__VALUE: + return VALUE_EDEFAULT == null ? value != null : !VALUE_EDEFAULT.equals(value); + } + return super.eIsSet(featureID); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + public String toString() { + if (eIsProxy()) return super.toString(); + + StringBuffer result = new StringBuffer(super.toString()); + result.append(" (value: "); //$NON-NLS-1$ + result.append(value); + result.append(')'); + return result.toString(); + } + +} //StringLiteralQueryImpl
diff --git a/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/modisco/facet/efacet/metamodel/v0_2_0/efacet/query/impl/TrueLiteralQueryImpl.java b/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/modisco/facet/efacet/metamodel/v0_2_0/efacet/query/impl/TrueLiteralQueryImpl.java new file mode 100644 index 0000000..79f8260 --- /dev/null +++ b/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/modisco/facet/efacet/metamodel/v0_2_0/efacet/query/impl/TrueLiteralQueryImpl.java
@@ -0,0 +1,56 @@ +/** + * Copyright (c) 2011 Mia-Software. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Gregoire Dupe (Mia-Software) - Design + * Nicolas Guyomar (Mia-Software) - Implementation + * Emmanuelle Rouillé (Mia-Software) - Bug 352618 - To be able to use non derived facet structural features and save them values. + * Nicolas Bros (Mia-Software) - Bug 361823 - [Restructuring] eFacet2 meta-model + * Gregoire Dupe (Mia-Software) - Bug 366055 - NavigationQuery + * Gregoire Dupe (Mia-Software) - Bug 369673 - [Facet] IsOneOfQuery + * Olivier Remaud (Soft-Maint) - Bug 369824 - Add a simple way to return string literal constants from a customization query + * Gregoire Dupe (Mia-software) - Bug 369987 - [Restructuring][Table] Switch to the new customization and facet framework + * Gregoire Dupe (Mia-Software) - Bug 369987 - [Restructuring][Table] Switch to the new customization and facet framework + */ +package org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.query.impl; + +import org.eclipse.emf.ecore.EClass; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.extensible.impl.QueryImpl; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.query.QueryPackage; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.query.TrueLiteralQuery; + +/** + * <!-- begin-user-doc --> + * An implementation of the model object '<em><b>True Literal Query</b></em>'. + * <!-- end-user-doc --> + * <p> + * </p> + * + * @generated + */ +public class TrueLiteralQueryImpl extends QueryImpl implements TrueLiteralQuery { + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + protected TrueLiteralQueryImpl() { + super(); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + protected EClass eStaticClass() { + return QueryPackage.Literals.TRUE_LITERAL_QUERY; + } + +} //TrueLiteralQueryImpl
diff --git a/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/modisco/facet/efacet/metamodel/v0_2_0/efacet/query/util/QueryAdapterFactory.java b/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/modisco/facet/efacet/metamodel/v0_2_0/efacet/query/util/QueryAdapterFactory.java new file mode 100644 index 0000000..5d3ab45 --- /dev/null +++ b/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/modisco/facet/efacet/metamodel/v0_2_0/efacet/query/util/QueryAdapterFactory.java
@@ -0,0 +1,312 @@ +/** + * Copyright (c) 2011 Mia-Software. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Gregoire Dupe (Mia-Software) - Design + * Nicolas Guyomar (Mia-Software) - Implementation + * Emmanuelle Rouillé (Mia-Software) - Bug 352618 - To be able to use non derived facet structural features and save them values. + * Nicolas Bros (Mia-Software) - Bug 361823 - [Restructuring] eFacet2 meta-model + * Gregoire Dupe (Mia-Software) - Bug 366055 - NavigationQuery + * Gregoire Dupe (Mia-Software) - Bug 369987 - [Restructuring][Table] Switch to the new customization and facet framework + */ +package org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.query.util; + +import org.eclipse.emf.common.notify.Adapter; +import org.eclipse.emf.common.notify.Notifier; +import org.eclipse.emf.common.notify.impl.AdapterFactoryImpl; +import org.eclipse.emf.ecore.EObject; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.extensible.Query; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.query.*; + +/** + * <!-- begin-user-doc --> + * The <b>Adapter Factory</b> for the model. + * It provides an adapter <code>createXXX</code> method for each class of the model. + * <!-- end-user-doc --> + * @see org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.query.QueryPackage + * @generated + */ +public class QueryAdapterFactory extends AdapterFactoryImpl { + /** + * The cached model package. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + protected static QueryPackage modelPackage; + + /** + * Creates an instance of the adapter factory. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public QueryAdapterFactory() { + if (modelPackage == null) { + modelPackage = QueryPackage.eINSTANCE; + } + } + + /** + * Returns whether this factory is applicable for the type of the object. + * <!-- begin-user-doc --> + * This implementation returns <code>true</code> if the object is either the model's package or is an instance object of the model. + * <!-- end-user-doc --> + * @return whether this factory is applicable for the type of the object. + * @generated + */ + @Override + public boolean isFactoryForType(Object object) { + if (object == modelPackage) { + return true; + } + if (object instanceof EObject) { + return ((EObject)object).eClass().getEPackage() == modelPackage; + } + return false; + } + + /** + * The switch that delegates to the <code>createXXX</code> methods. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + protected QuerySwitch<Adapter> modelSwitch = + new QuerySwitch<Adapter>() { + @Override + public Adapter caseNavigationQuery(NavigationQuery object) { + return createNavigationQueryAdapter(); + } + @Override + public Adapter caseIsOneOfQuery(IsOneOfQuery object) { + return createIsOneOfQueryAdapter(); + } + @Override + public Adapter caseStringLiteralQuery(StringLiteralQuery object) { + return createStringLiteralQueryAdapter(); + } + @Override + public Adapter caseTrueLiteralQuery(TrueLiteralQuery object) { + return createTrueLiteralQueryAdapter(); + } + @Override + public Adapter caseFalseLiteralQuery(FalseLiteralQuery object) { + return createFalseLiteralQueryAdapter(); + } + @Override + public Adapter caseNullLiteralQuery(NullLiteralQuery object) { + return createNullLiteralQueryAdapter(); + } + @Override + public Adapter caseIntegerLiteralQuery(IntegerLiteralQuery object) { + return createIntegerLiteralQueryAdapter(); + } + @Override + public Adapter caseFloatLiteralQuery(FloatLiteralQuery object) { + return createFloatLiteralQueryAdapter(); + } + @Override + public Adapter caseEObjectLiteralQuery(EObjectLiteralQuery object) { + return createEObjectLiteralQueryAdapter(); + } + @Override + public Adapter caseOperationCallQuery(OperationCallQuery object) { + return createOperationCallQueryAdapter(); + } + @Override + public Adapter caseQuery(Query object) { + return createQueryAdapter(); + } + @Override + public Adapter defaultCase(EObject object) { + return createEObjectAdapter(); + } + }; + + /** + * Creates an adapter for the <code>target</code>. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @param target the object to adapt. + * @return the adapter for the <code>target</code>. + * @generated + */ + @Override + public Adapter createAdapter(Notifier target) { + return modelSwitch.doSwitch((EObject)target); + } + + + /** + * Creates a new adapter for an object of class '{@link org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.query.NavigationQuery <em>Navigation Query</em>}'. + * <!-- begin-user-doc --> + * This default implementation returns null so that we can easily ignore cases; + * it's useful to ignore a case when inheritance will catch all the cases anyway. + * <!-- end-user-doc --> + * @return the new adapter. + * @see org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.query.NavigationQuery + * @generated + */ + public Adapter createNavigationQueryAdapter() { + return null; + } + + /** + * Creates a new adapter for an object of class '{@link org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.query.IsOneOfQuery <em>Is One Of Query</em>}'. + * <!-- begin-user-doc --> + * This default implementation returns null so that we can easily ignore cases; + * it's useful to ignore a case when inheritance will catch all the cases anyway. + * <!-- end-user-doc --> + * @return the new adapter. + * @see org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.query.IsOneOfQuery + * @generated + */ + public Adapter createIsOneOfQueryAdapter() { + return null; + } + + /** + * Creates a new adapter for an object of class '{@link org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.query.StringLiteralQuery <em>String Literal Query</em>}'. + * <!-- begin-user-doc --> + * This default implementation returns null so that we can easily ignore cases; + * it's useful to ignore a case when inheritance will catch all the cases anyway. + * <!-- end-user-doc --> + * @return the new adapter. + * @see org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.query.StringLiteralQuery + * @generated + */ + public Adapter createStringLiteralQueryAdapter() { + return null; + } + + /** + * Creates a new adapter for an object of class '{@link org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.query.TrueLiteralQuery <em>True Literal Query</em>}'. + * <!-- begin-user-doc --> + * This default implementation returns null so that we can easily ignore cases; + * it's useful to ignore a case when inheritance will catch all the cases anyway. + * <!-- end-user-doc --> + * @return the new adapter. + * @see org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.query.TrueLiteralQuery + * @generated + */ + public Adapter createTrueLiteralQueryAdapter() { + return null; + } + + /** + * Creates a new adapter for an object of class '{@link org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.query.FalseLiteralQuery <em>False Literal Query</em>}'. + * <!-- begin-user-doc --> + * This default implementation returns null so that we can easily ignore cases; + * it's useful to ignore a case when inheritance will catch all the cases anyway. + * <!-- end-user-doc --> + * @return the new adapter. + * @see org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.query.FalseLiteralQuery + * @generated + */ + public Adapter createFalseLiteralQueryAdapter() { + return null; + } + + /** + * Creates a new adapter for an object of class '{@link org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.query.NullLiteralQuery <em>Null Literal Query</em>}'. + * <!-- begin-user-doc --> + * This default implementation returns null so that we can easily ignore cases; + * it's useful to ignore a case when inheritance will catch all the cases anyway. + * <!-- end-user-doc --> + * @return the new adapter. + * @see org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.query.NullLiteralQuery + * @generated + */ + public Adapter createNullLiteralQueryAdapter() { + return null; + } + + /** + * Creates a new adapter for an object of class '{@link org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.query.IntegerLiteralQuery <em>Integer Literal Query</em>}'. + * <!-- begin-user-doc --> + * This default implementation returns null so that we can easily ignore cases; + * it's useful to ignore a case when inheritance will catch all the cases anyway. + * <!-- end-user-doc --> + * @return the new adapter. + * @see org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.query.IntegerLiteralQuery + * @generated + */ + public Adapter createIntegerLiteralQueryAdapter() { + return null; + } + + /** + * Creates a new adapter for an object of class '{@link org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.query.FloatLiteralQuery <em>Float Literal Query</em>}'. + * <!-- begin-user-doc --> + * This default implementation returns null so that we can easily ignore cases; + * it's useful to ignore a case when inheritance will catch all the cases anyway. + * <!-- end-user-doc --> + * @return the new adapter. + * @see org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.query.FloatLiteralQuery + * @generated + */ + public Adapter createFloatLiteralQueryAdapter() { + return null; + } + + /** + * Creates a new adapter for an object of class '{@link org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.query.EObjectLiteralQuery <em>EObject Literal Query</em>}'. + * <!-- begin-user-doc --> + * This default implementation returns null so that we can easily ignore cases; + * it's useful to ignore a case when inheritance will catch all the cases anyway. + * <!-- end-user-doc --> + * @return the new adapter. + * @see org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.query.EObjectLiteralQuery + * @generated + */ + public Adapter createEObjectLiteralQueryAdapter() { + return null; + } + + /** + * Creates a new adapter for an object of class '{@link org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.query.OperationCallQuery <em>Operation Call Query</em>}'. + * <!-- begin-user-doc --> + * This default implementation returns null so that we can easily ignore cases; + * it's useful to ignore a case when inheritance will catch all the cases anyway. + * <!-- end-user-doc --> + * @return the new adapter. + * @see org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.query.OperationCallQuery + * @generated + */ + public Adapter createOperationCallQueryAdapter() { + return null; + } + + /** + * Creates a new adapter for an object of class '{@link org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.extensible.Query <em>Query</em>}'. + * <!-- begin-user-doc --> + * This default implementation returns null so that we can easily ignore cases; + * it's useful to ignore a case when inheritance will catch all the cases anyway. + * <!-- end-user-doc --> + * @return the new adapter. + * @see org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.extensible.Query + * @generated + */ + public Adapter createQueryAdapter() { + return null; + } + + /** + * Creates a new adapter for the default case. + * <!-- begin-user-doc --> + * This default implementation returns null. + * <!-- end-user-doc --> + * @return the new adapter. + * @generated + */ + public Adapter createEObjectAdapter() { + return null; + } + +} //QueryAdapterFactory
diff --git a/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/modisco/facet/efacet/metamodel/v0_2_0/efacet/query/util/QuerySwitch.java b/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/modisco/facet/efacet/metamodel/v0_2_0/efacet/query/util/QuerySwitch.java new file mode 100644 index 0000000..d900f46 --- /dev/null +++ b/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/modisco/facet/efacet/metamodel/v0_2_0/efacet/query/util/QuerySwitch.java
@@ -0,0 +1,356 @@ +/** + * Copyright (c) 2011 Mia-Software. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Gregoire Dupe (Mia-Software) - Design + * Nicolas Guyomar (Mia-Software) - Implementation + * Emmanuelle Rouillé (Mia-Software) - Bug 352618 - To be able to use non derived facet structural features and save them values. + * Nicolas Bros (Mia-Software) - Bug 361823 - [Restructuring] eFacet2 meta-model + * Gregoire Dupe (Mia-Software) - Bug 366055 - NavigationQuery + * Gregoire Dupe (Mia-Software) - Bug 369673 - [Facet] IsOneOfQuery + * Olivier Remaud (Soft-Maint) - Bug 369824 - Add a simple way to return string literal constants from a customization query + * Gregoire Dupe (Mia-software) - Bug 369987 - [Restructuring][Table] Switch to the new customization and facet framework + */ +package org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.query.util; + +import java.util.List; + +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.EObject; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.extensible.Query; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.query.*; + +/** + * <!-- begin-user-doc --> + * The <b>Switch</b> for the model's inheritance hierarchy. + * It supports the call {@link #doSwitch(EObject) doSwitch(object)} + * to invoke the <code>caseXXX</code> method for each class of the model, + * starting with the actual class of the object + * and proceeding up the inheritance hierarchy + * until a non-null result is returned, + * which is the result of the switch. + * <!-- end-user-doc --> + * @see org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.query.QueryPackage + * @generated + */ +public class QuerySwitch<T> { + /** + * The cached model package + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + protected static QueryPackage modelPackage; + + /** + * Creates an instance of the switch. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public QuerySwitch() { + if (modelPackage == null) { + modelPackage = QueryPackage.eINSTANCE; + } + } + + /** + * Calls <code>caseXXX</code> for each class of the model until one returns a non null result; it yields that result. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @return the first non-null result returned by a <code>caseXXX</code> call. + * @generated + */ + public T doSwitch(EObject theEObject) { + return doSwitch(theEObject.eClass(), theEObject); + } + + /** + * Calls <code>caseXXX</code> for each class of the model until one returns a non null result; it yields that result. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @return the first non-null result returned by a <code>caseXXX</code> call. + * @generated + */ + protected T doSwitch(EClass theEClass, EObject theEObject) { + if (theEClass.eContainer() == modelPackage) { + return doSwitch(theEClass.getClassifierID(), theEObject); + } + else { + List<EClass> eSuperTypes = theEClass.getESuperTypes(); + return + eSuperTypes.isEmpty() ? + defaultCase(theEObject) : + doSwitch(eSuperTypes.get(0), theEObject); + } + } + + /** + * Calls <code>caseXXX</code> for each class of the model until one returns a non null result; it yields that result. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @return the first non-null result returned by a <code>caseXXX</code> call. + * @generated + */ + protected T doSwitch(int classifierID, EObject theEObject) { + switch (classifierID) { + case QueryPackage.NAVIGATION_QUERY: { + NavigationQuery navigationQuery = (NavigationQuery)theEObject; + T result = caseNavigationQuery(navigationQuery); + if (result == null) result = caseQuery(navigationQuery); + if (result == null) result = defaultCase(theEObject); + return result; + } + case QueryPackage.IS_ONE_OF_QUERY: { + IsOneOfQuery isOneOfQuery = (IsOneOfQuery)theEObject; + T result = caseIsOneOfQuery(isOneOfQuery); + if (result == null) result = caseQuery(isOneOfQuery); + if (result == null) result = defaultCase(theEObject); + return result; + } + case QueryPackage.STRING_LITERAL_QUERY: { + StringLiteralQuery stringLiteralQuery = (StringLiteralQuery)theEObject; + T result = caseStringLiteralQuery(stringLiteralQuery); + if (result == null) result = caseQuery(stringLiteralQuery); + if (result == null) result = defaultCase(theEObject); + return result; + } + case QueryPackage.TRUE_LITERAL_QUERY: { + TrueLiteralQuery trueLiteralQuery = (TrueLiteralQuery)theEObject; + T result = caseTrueLiteralQuery(trueLiteralQuery); + if (result == null) result = caseQuery(trueLiteralQuery); + if (result == null) result = defaultCase(theEObject); + return result; + } + case QueryPackage.FALSE_LITERAL_QUERY: { + FalseLiteralQuery falseLiteralQuery = (FalseLiteralQuery)theEObject; + T result = caseFalseLiteralQuery(falseLiteralQuery); + if (result == null) result = caseQuery(falseLiteralQuery); + if (result == null) result = defaultCase(theEObject); + return result; + } + case QueryPackage.NULL_LITERAL_QUERY: { + NullLiteralQuery nullLiteralQuery = (NullLiteralQuery)theEObject; + T result = caseNullLiteralQuery(nullLiteralQuery); + if (result == null) result = caseQuery(nullLiteralQuery); + if (result == null) result = defaultCase(theEObject); + return result; + } + case QueryPackage.INTEGER_LITERAL_QUERY: { + IntegerLiteralQuery integerLiteralQuery = (IntegerLiteralQuery)theEObject; + T result = caseIntegerLiteralQuery(integerLiteralQuery); + if (result == null) result = caseQuery(integerLiteralQuery); + if (result == null) result = defaultCase(theEObject); + return result; + } + case QueryPackage.FLOAT_LITERAL_QUERY: { + FloatLiteralQuery floatLiteralQuery = (FloatLiteralQuery)theEObject; + T result = caseFloatLiteralQuery(floatLiteralQuery); + if (result == null) result = caseQuery(floatLiteralQuery); + if (result == null) result = defaultCase(theEObject); + return result; + } + case QueryPackage.EOBJECT_LITERAL_QUERY: { + EObjectLiteralQuery eObjectLiteralQuery = (EObjectLiteralQuery)theEObject; + T result = caseEObjectLiteralQuery(eObjectLiteralQuery); + if (result == null) result = caseQuery(eObjectLiteralQuery); + if (result == null) result = defaultCase(theEObject); + return result; + } + case QueryPackage.OPERATION_CALL_QUERY: { + OperationCallQuery operationCallQuery = (OperationCallQuery)theEObject; + T result = caseOperationCallQuery(operationCallQuery); + if (result == null) result = caseQuery(operationCallQuery); + if (result == null) result = defaultCase(theEObject); + return result; + } + default: return defaultCase(theEObject); + } + } + + /** + * Returns the result of interpreting the object as an instance of '<em>Navigation Query</em>'. + * <!-- begin-user-doc --> + * This implementation returns null; + * returning a non-null result will terminate the switch. + * <!-- end-user-doc --> + * @param object the target of the switch. + * @return the result of interpreting the object as an instance of '<em>Navigation Query</em>'. + * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) + * @generated + */ + public T caseNavigationQuery(NavigationQuery object) { + return null; + } + + /** + * Returns the result of interpreting the object as an instance of '<em>Is One Of Query</em>'. + * <!-- begin-user-doc --> + * This implementation returns null; + * returning a non-null result will terminate the switch. + * <!-- end-user-doc --> + * @param object the target of the switch. + * @return the result of interpreting the object as an instance of '<em>Is One Of Query</em>'. + * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) + * @generated + */ + public T caseIsOneOfQuery(IsOneOfQuery object) { + return null; + } + + /** + * Returns the result of interpreting the object as an instance of '<em>String Literal Query</em>'. + * <!-- begin-user-doc --> + * This implementation returns null; + * returning a non-null result will terminate the switch. + * <!-- end-user-doc --> + * @param object the target of the switch. + * @return the result of interpreting the object as an instance of '<em>String Literal Query</em>'. + * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) + * @generated + */ + public T caseStringLiteralQuery(StringLiteralQuery object) { + return null; + } + + /** + * Returns the result of interpreting the object as an instance of '<em>True Literal Query</em>'. + * <!-- begin-user-doc --> + * This implementation returns null; + * returning a non-null result will terminate the switch. + * <!-- end-user-doc --> + * @param object the target of the switch. + * @return the result of interpreting the object as an instance of '<em>True Literal Query</em>'. + * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) + * @generated + */ + public T caseTrueLiteralQuery(TrueLiteralQuery object) { + return null; + } + + /** + * Returns the result of interpreting the object as an instance of '<em>False Literal Query</em>'. + * <!-- begin-user-doc --> + * This implementation returns null; + * returning a non-null result will terminate the switch. + * <!-- end-user-doc --> + * @param object the target of the switch. + * @return the result of interpreting the object as an instance of '<em>False Literal Query</em>'. + * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) + * @generated + */ + public T caseFalseLiteralQuery(FalseLiteralQuery object) { + return null; + } + + /** + * Returns the result of interpreting the object as an instance of '<em>Null Literal Query</em>'. + * <!-- begin-user-doc --> + * This implementation returns null; + * returning a non-null result will terminate the switch. + * <!-- end-user-doc --> + * @param object the target of the switch. + * @return the result of interpreting the object as an instance of '<em>Null Literal Query</em>'. + * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) + * @generated + */ + public T caseNullLiteralQuery(NullLiteralQuery object) { + return null; + } + + /** + * Returns the result of interpreting the object as an instance of '<em>Integer Literal Query</em>'. + * <!-- begin-user-doc --> + * This implementation returns null; + * returning a non-null result will terminate the switch. + * <!-- end-user-doc --> + * @param object the target of the switch. + * @return the result of interpreting the object as an instance of '<em>Integer Literal Query</em>'. + * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) + * @generated + */ + public T caseIntegerLiteralQuery(IntegerLiteralQuery object) { + return null; + } + + /** + * Returns the result of interpreting the object as an instance of '<em>Float Literal Query</em>'. + * <!-- begin-user-doc --> + * This implementation returns null; + * returning a non-null result will terminate the switch. + * <!-- end-user-doc --> + * @param object the target of the switch. + * @return the result of interpreting the object as an instance of '<em>Float Literal Query</em>'. + * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) + * @generated + */ + public T caseFloatLiteralQuery(FloatLiteralQuery object) { + return null; + } + + /** + * Returns the result of interpreting the object as an instance of '<em>EObject Literal Query</em>'. + * <!-- begin-user-doc --> + * This implementation returns null; + * returning a non-null result will terminate the switch. + * <!-- end-user-doc --> + * @param object the target of the switch. + * @return the result of interpreting the object as an instance of '<em>EObject Literal Query</em>'. + * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) + * @generated + */ + public T caseEObjectLiteralQuery(EObjectLiteralQuery object) { + return null; + } + + /** + * Returns the result of interpreting the object as an instance of '<em>Operation Call Query</em>'. + * <!-- begin-user-doc --> + * This implementation returns null; + * returning a non-null result will terminate the switch. + * <!-- end-user-doc --> + * @param object the target of the switch. + * @return the result of interpreting the object as an instance of '<em>Operation Call Query</em>'. + * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) + * @generated + */ + public T caseOperationCallQuery(OperationCallQuery object) { + return null; + } + + /** + * Returns the result of interpreting the object as an instance of '<em>Query</em>'. + * <!-- begin-user-doc --> + * This implementation returns null; + * returning a non-null result will terminate the switch. + * <!-- end-user-doc --> + * @param object the target of the switch. + * @return the result of interpreting the object as an instance of '<em>Query</em>'. + * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) + * @generated + */ + public T caseQuery(Query object) { + return null; + } + + /** + * Returns the result of interpreting the object as an instance of '<em>EObject</em>'. + * <!-- begin-user-doc --> + * This implementation returns null; + * returning a non-null result will terminate the switch, but this is the last case anyway. + * <!-- end-user-doc --> + * @param object the target of the switch. + * @return the result of interpreting the object as an instance of '<em>EObject</em>'. + * @see #doSwitch(org.eclipse.emf.ecore.EObject) + * @generated + */ + public T defaultCase(EObject object) { + return null; + } + +} //QuerySwitch
diff --git a/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/modisco/facet/efacet/metamodel/v0_2_0/efacet/runtime/ETypedElementEObjectListResult.java b/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/modisco/facet/efacet/metamodel/v0_2_0/efacet/runtime/ETypedElementEObjectListResult.java new file mode 100644 index 0000000..86bb6af --- /dev/null +++ b/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/modisco/facet/efacet/metamodel/v0_2_0/efacet/runtime/ETypedElementEObjectListResult.java
@@ -0,0 +1,62 @@ +/** + * Copyright (c) 2011, 2012 Mia-Software. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Gregoire Dupe (Mia-Software) - Design + * Nicolas Guyomar (Mia-Software) - Implementation + * Emmanuelle Rouillé (Mia-Software) - Bug 352618 - To be able to use non derived facet structural features and save them values. + * Nicolas Bros (Mia-Software) - Bug 361823 - [Restructuring] eFacet2 meta-model + * Gregoire Dupe (Mia-Software) - Bug 366055 - NavigationQuery + * Gregoire Dupe (Mia-Software) - Bug 369673 - [Facet] IsOneOfQuery + * Olivier Remaud (Soft-Maint) - Bug 369824 - Add a simple way to return string literal constants from a customization query + * Gregoire Dupe (Mia-software) - Bug 369987 - [Restructuring][Table] Switch to the new customization and facet framework + * Gregoire Dupe (Mia-software) - Bug 364325 - [Restructuring] The user must be able to navigate into a model using the Facet. + */ +package org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.runtime; + +import org.eclipse.emf.common.util.EList; +import org.eclipse.emf.ecore.EObject; + +/** + * <!-- begin-user-doc --> + * A representation of the model object '<em><b>ETyped Element EObject List Result</b></em>'. + * <!-- end-user-doc --> + * + * <!-- begin-model-doc --> + * This class represents the result of evaluating the value of a multiplicity-many DerivedTypedElement by means of a multi-valued query . + * <!-- end-model-doc --> + * + * <p> + * The following features are supported: + * <ul> + * <li>{@link org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.runtime.ETypedElementEObjectListResult#getResultList <em>Result List</em>}</li> + * </ul> + * </p> + * + * @see org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.runtime.RuntimePackage#getETypedElementEObjectListResult() + * @model + * @generated + */ +public interface ETypedElementEObjectListResult<T extends EObject> extends ETypedElementResult { + /** + * Returns the value of the '<em><b>Result List</b></em>' reference list. + * The list contents are of type {@link T}. + * <!-- begin-user-doc --> + * <p> + * If the meaning of the '<em>Result List</em>' reference list isn't clear, + * there really should be more of a description here... + * </p> + * <!-- end-user-doc --> + * @return the value of the '<em>Result List</em>' reference list. + * @see org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.runtime.RuntimePackage#getETypedElementEObjectListResult_ResultList() + * @model + * @generated + */ + EList<T> getResultList(); + +} // ETypedElementEObjectListResult
diff --git a/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/modisco/facet/efacet/metamodel/v0_2_0/efacet/runtime/ETypedElementEObjectResult.java b/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/modisco/facet/efacet/metamodel/v0_2_0/efacet/runtime/ETypedElementEObjectResult.java new file mode 100644 index 0000000..fd9d295 --- /dev/null +++ b/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/modisco/facet/efacet/metamodel/v0_2_0/efacet/runtime/ETypedElementEObjectResult.java
@@ -0,0 +1,71 @@ +/** + * Copyright (c) 2011, 2012 Mia-Software. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Gregoire Dupe (Mia-Software) - Design + * Nicolas Guyomar (Mia-Software) - Implementation + * Emmanuelle Rouillé (Mia-Software) - Bug 352618 - To be able to use non derived facet structural features and save them values. + * Nicolas Bros (Mia-Software) - Bug 361823 - [Restructuring] eFacet2 meta-model + * Gregoire Dupe (Mia-Software) - Bug 366055 - NavigationQuery + * Gregoire Dupe (Mia-Software) - Bug 369673 - [Facet] IsOneOfQuery + * Olivier Remaud (Soft-Maint) - Bug 369824 - Add a simple way to return string literal constants from a customization query + * Gregoire Dupe (Mia-software) - Bug 369987 - [Restructuring][Table] Switch to the new customization and facet framework + * Gregoire Dupe (Mia-software) - Bug 364325 - [Restructuring] The user must be able to navigate into a model using the Facet. + */ +package org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.runtime; + +import org.eclipse.emf.ecore.EObject; + +/** + * <!-- begin-user-doc --> + * A representation of the model object '<em><b>ETyped Element EObject Result</b></em>'. + * <!-- end-user-doc --> + * + * <!-- begin-model-doc --> + * This class represents the result of evaluating the value of a multiplicity-one DerivedTypedElement by means of a single-valued query . + * <!-- end-model-doc --> + * + * <p> + * The following features are supported: + * <ul> + * <li>{@link org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.runtime.ETypedElementEObjectResult#getResult <em>Result</em>}</li> + * </ul> + * </p> + * + * @see org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.runtime.RuntimePackage#getETypedElementEObjectResult() + * @model + * @generated + */ +public interface ETypedElementEObjectResult<T extends EObject> extends ETypedElementResult { + /** + * Returns the value of the '<em><b>Result</b></em>' reference. + * <!-- begin-user-doc --> + * <p> + * If the meaning of the '<em>Result</em>' reference isn't clear, + * there really should be more of a description here... + * </p> + * <!-- end-user-doc --> + * @return the value of the '<em>Result</em>' reference. + * @see #setResult(EObject) + * @see org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.runtime.RuntimePackage#getETypedElementEObjectResult_Result() + * @model + * @generated + */ + T getResult(); + + /** + * Sets the value of the '{@link org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.runtime.ETypedElementEObjectResult#getResult <em>Result</em>}' reference. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @param value the new value of the '<em>Result</em>' reference. + * @see #getResult() + * @generated + */ + void setResult(T value); + +} // ETypedElementEObjectResult
diff --git a/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/modisco/facet/efacet/metamodel/v0_2_0/efacet/runtime/ETypedElementPrimitiveTypeListResult.java b/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/modisco/facet/efacet/metamodel/v0_2_0/efacet/runtime/ETypedElementPrimitiveTypeListResult.java new file mode 100644 index 0000000..f8bc524 --- /dev/null +++ b/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/modisco/facet/efacet/metamodel/v0_2_0/efacet/runtime/ETypedElementPrimitiveTypeListResult.java
@@ -0,0 +1,61 @@ +/** + * Copyright (c) 2011, 2012 Mia-Software. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Gregoire Dupe (Mia-Software) - Design + * Nicolas Guyomar (Mia-Software) - Implementation + * Emmanuelle Rouillé (Mia-Software) - Bug 352618 - To be able to use non derived facet structural features and save them values. + * Nicolas Bros (Mia-Software) - Bug 361823 - [Restructuring] eFacet2 meta-model + * Gregoire Dupe (Mia-Software) - Bug 366055 - NavigationQuery + * Gregoire Dupe (Mia-Software) - Bug 369673 - [Facet] IsOneOfQuery + * Olivier Remaud (Soft-Maint) - Bug 369824 - Add a simple way to return string literal constants from a customization query + * Gregoire Dupe (Mia-software) - Bug 369987 - [Restructuring][Table] Switch to the new customization and facet framework + * Gregoire Dupe (Mia-software) - Bug 364325 - [Restructuring] The user must be able to navigate into a model using the Facet. + */ +package org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.runtime; + +import org.eclipse.emf.common.util.EList; + +/** + * <!-- begin-user-doc --> + * A representation of the model object '<em><b>ETyped Element Primitive Type List Result</b></em>'. + * <!-- end-user-doc --> + * + * <!-- begin-model-doc --> + * This class represents the result of evaluating the value of a multiplicity-many DerivedTypedElement by means of a multi-valued query . + * <!-- end-model-doc --> + * + * <p> + * The following features are supported: + * <ul> + * <li>{@link org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.runtime.ETypedElementPrimitiveTypeListResult#getResultList <em>Result List</em>}</li> + * </ul> + * </p> + * + * @see org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.runtime.RuntimePackage#getETypedElementPrimitiveTypeListResult() + * @model + * @generated + */ +public interface ETypedElementPrimitiveTypeListResult<T> extends ETypedElementResult { + /** + * Returns the value of the '<em><b>Result List</b></em>' attribute list. + * The list contents are of type {@link T}. + * <!-- begin-user-doc --> + * <p> + * If the meaning of the '<em>Result List</em>' attribute list isn't clear, + * there really should be more of a description here... + * </p> + * <!-- end-user-doc --> + * @return the value of the '<em>Result List</em>' attribute list. + * @see org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.runtime.RuntimePackage#getETypedElementPrimitiveTypeListResult_ResultList() + * @model + * @generated + */ + EList<T> getResultList(); + +} // ETypedElementPrimitiveTypeListResult
diff --git a/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/modisco/facet/efacet/metamodel/v0_2_0/efacet/runtime/ETypedElementPrimitiveTypeResult.java b/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/modisco/facet/efacet/metamodel/v0_2_0/efacet/runtime/ETypedElementPrimitiveTypeResult.java new file mode 100644 index 0000000..8fc2941 --- /dev/null +++ b/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/modisco/facet/efacet/metamodel/v0_2_0/efacet/runtime/ETypedElementPrimitiveTypeResult.java
@@ -0,0 +1,70 @@ +/** + * Copyright (c) 2011, 2012 Mia-Software. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Gregoire Dupe (Mia-Software) - Design + * Nicolas Guyomar (Mia-Software) - Implementation + * Emmanuelle Rouillé (Mia-Software) - Bug 352618 - To be able to use non derived facet structural features and save them values. + * Nicolas Bros (Mia-Software) - Bug 361823 - [Restructuring] eFacet2 meta-model + * Gregoire Dupe (Mia-Software) - Bug 366055 - NavigationQuery + * Gregoire Dupe (Mia-Software) - Bug 369673 - [Facet] IsOneOfQuery + * Olivier Remaud (Soft-Maint) - Bug 369824 - Add a simple way to return string literal constants from a customization query + * Gregoire Dupe (Mia-software) - Bug 369987 - [Restructuring][Table] Switch to the new customization and facet framework + * Gregoire Dupe (Mia-software) - Bug 364325 - [Restructuring] The user must be able to navigate into a model using the Facet. + */ +package org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.runtime; + + +/** + * <!-- begin-user-doc --> + * A representation of the model object '<em><b>ETyped Element Primitive Type Result</b></em>'. + * <!-- end-user-doc --> + * + * <!-- begin-model-doc --> + * This class represents the result of evaluating the value of a multiplicity-one DerivedTypedElement by means of a single-valued query . + * <!-- end-model-doc --> + * + * <p> + * The following features are supported: + * <ul> + * <li>{@link org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.runtime.ETypedElementPrimitiveTypeResult#getResult <em>Result</em>}</li> + * </ul> + * </p> + * + * @see org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.runtime.RuntimePackage#getETypedElementPrimitiveTypeResult() + * @model + * @generated + */ +public interface ETypedElementPrimitiveTypeResult<T> extends ETypedElementResult { + /** + * Returns the value of the '<em><b>Result</b></em>' attribute. + * <!-- begin-user-doc --> + * <p> + * If the meaning of the '<em>Result</em>' attribute isn't clear, + * there really should be more of a description here... + * </p> + * <!-- end-user-doc --> + * @return the value of the '<em>Result</em>' attribute. + * @see #setResult(Object) + * @see org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.runtime.RuntimePackage#getETypedElementPrimitiveTypeResult_Result() + * @model + * @generated + */ + T getResult(); + + /** + * Sets the value of the '{@link org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.runtime.ETypedElementPrimitiveTypeResult#getResult <em>Result</em>}' attribute. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @param value the new value of the '<em>Result</em>' attribute. + * @see #getResult() + * @generated + */ + void setResult(T value); + +} // ETypedElementPrimitiveTypeResult
diff --git a/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/modisco/facet/efacet/metamodel/v0_2_0/efacet/runtime/ETypedElementResult.java b/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/modisco/facet/efacet/metamodel/v0_2_0/efacet/runtime/ETypedElementResult.java new file mode 100644 index 0000000..4bfb745 --- /dev/null +++ b/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/modisco/facet/efacet/metamodel/v0_2_0/efacet/runtime/ETypedElementResult.java
@@ -0,0 +1,143 @@ +/** + * Copyright (c) 2011, 2012 Mia-Software. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Gregoire Dupe (Mia-Software) - Design + * Nicolas Guyomar (Mia-Software) - Implementation + * Emmanuelle Rouillé (Mia-Software) - Bug 352618 - To be able to use non derived facet structural features and save them values. + * Nicolas Bros (Mia-Software) - Bug 361823 - [Restructuring] eFacet2 meta-model + * Gregoire Dupe (Mia-Software) - Bug 366055 - NavigationQuery + * Gregoire Dupe (Mia-Software) - Bug 369673 - [Facet] IsOneOfQuery + * Olivier Remaud (Soft-Maint) - Bug 369824 - Add a simple way to return string literal constants from a customization query + * Gregoire Dupe (Mia-software) - Bug 369987 - [Restructuring][Table] Switch to the new customization and facet framework + * Gregoire Dupe (Mia-software) - Bug 364325 - [Restructuring] The user must be able to navigate into a model using the Facet. + */ +package org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.runtime; + +import org.eclipse.emf.common.util.EList; +import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.ecore.ETypedElement; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.ParameterValue; + +/** + * <!-- begin-user-doc --> + * A representation of the model object '<em><b>ETyped Element Result</b></em>'. + * <!-- end-user-doc --> + * + * <!-- begin-model-doc --> + * This class represents the result of evaluating the value of a DerivedTypedElement by means of a query . + * <!-- end-model-doc --> + * + * <p> + * The following features are supported: + * <ul> + * <li>{@link org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.runtime.ETypedElementResult#getDerivedTypedElement <em>Derived Typed Element</em>}</li> + * <li>{@link org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.runtime.ETypedElementResult#getParameterValues <em>Parameter Values</em>}</li> + * <li>{@link org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.runtime.ETypedElementResult#getSource <em>Source</em>}</li> + * <li>{@link org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.runtime.ETypedElementResult#getException <em>Exception</em>}</li> + * </ul> + * </p> + * + * @see org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.runtime.RuntimePackage#getETypedElementResult() + * @model abstract="true" + * @generated + */ +public interface ETypedElementResult extends EObject { + /** + * Returns the value of the '<em><b>Derived Typed Element</b></em>' reference. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * <!-- begin-model-doc --> + * The reference "query" references the executed query. + * <!-- end-model-doc --> + * @return the value of the '<em>Derived Typed Element</em>' reference. + * @see #setDerivedTypedElement(ETypedElement) + * @see org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.runtime.RuntimePackage#getETypedElementResult_DerivedTypedElement() + * @model required="true" + * @generated + */ + ETypedElement getDerivedTypedElement(); + + /** + * Sets the value of the '{@link org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.runtime.ETypedElementResult#getDerivedTypedElement <em>Derived Typed Element</em>}' reference. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @param value the new value of the '<em>Derived Typed Element</em>' reference. + * @see #getDerivedTypedElement() + * @generated + */ + void setDerivedTypedElement(ETypedElement value); + + /** + * Returns the value of the '<em><b>Parameter Values</b></em>' containment reference list. + * The list contents are of type {@link org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.ParameterValue}. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * <!-- begin-model-doc --> + * This is the list of the values given as parameters for the query execution. + * <!-- end-model-doc --> + * @return the value of the '<em>Parameter Values</em>' containment reference list. + * @see org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.runtime.RuntimePackage#getETypedElementResult_ParameterValues() + * @model containment="true" + * @generated + */ + EList<ParameterValue> getParameterValues(); + + /** + * Returns the value of the '<em><b>Source</b></em>' reference. + * <!-- begin-user-doc --> + * <p> + * If the meaning of the '<em>Source</em>' reference isn't clear, + * there really should be more of a description here... + * </p> + * <!-- end-user-doc --> + * @return the value of the '<em>Source</em>' reference. + * @see #setSource(EObject) + * @see org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.runtime.RuntimePackage#getETypedElementResult_Source() + * @model required="true" + * @generated + */ + EObject getSource(); + + /** + * Sets the value of the '{@link org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.runtime.ETypedElementResult#getSource <em>Source</em>}' reference. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @param value the new value of the '<em>Source</em>' reference. + * @see #getSource() + * @generated + */ + void setSource(EObject value); + + /** + * Returns the value of the '<em><b>Exception</b></em>' attribute. + * <!-- begin-user-doc --> + * <p> + * If the meaning of the '<em>Exception</em>' attribute isn't clear, + * there really should be more of a description here... + * </p> + * <!-- end-user-doc --> + * @return the value of the '<em>Exception</em>' attribute. + * @see #setException(Throwable) + * @see org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.runtime.RuntimePackage#getETypedElementResult_Exception() + * @model dataType="org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.runtime.JavaException" transient="true" + * @generated + */ + Throwable getException(); + + /** + * Sets the value of the '{@link org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.runtime.ETypedElementResult#getException <em>Exception</em>}' attribute. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @param value the new value of the '<em>Exception</em>' attribute. + * @see #getException() + * @generated + */ + void setException(Throwable value); + +} // ETypedElementResult
diff --git a/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/modisco/facet/efacet/metamodel/v0_2_0/efacet/runtime/RuntimeFactory.java b/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/modisco/facet/efacet/metamodel/v0_2_0/efacet/runtime/RuntimeFactory.java new file mode 100644 index 0000000..8459b54 --- /dev/null +++ b/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/modisco/facet/efacet/metamodel/v0_2_0/efacet/runtime/RuntimeFactory.java
@@ -0,0 +1,88 @@ +/** + * Copyright (c) 2011, 2012 Mia-Software. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Gregoire Dupe (Mia-Software) - Design + * Nicolas Guyomar (Mia-Software) - Implementation + * Emmanuelle Rouillé (Mia-Software) - Bug 352618 - To be able to use non derived facet structural features and save them values. + * Nicolas Bros (Mia-Software) - Bug 361823 - [Restructuring] eFacet2 meta-model + * Gregoire Dupe (Mia-Software) - Bug 366055 - NavigationQuery + * Gregoire Dupe (Mia-Software) - Bug 369673 - [Facet] IsOneOfQuery + * Olivier Remaud (Soft-Maint) - Bug 369824 - Add a simple way to return string literal constants from a customization query + * Gregoire Dupe (Mia-software) - Bug 369987 - [Restructuring][Table] Switch to the new customization and facet framework + * Gregoire Dupe (Mia-software) - Bug 364325 - [Restructuring] The user must be able to navigate into a model using the Facet. + * Gregoire Dupe (Mia-Software) - Bug 373078 - API Cleaning + */ +package org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.runtime; + +import org.eclipse.emf.ecore.EFactory; +import org.eclipse.emf.ecore.EObject; + +/** + * <!-- begin-user-doc --> + * The <b>Factory</b> for the model. + * It provides a create method for each non-abstract class of the model. + * <!-- end-user-doc --> + * @see org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.runtime.RuntimePackage + * @generated + */ +public interface RuntimeFactory extends EFactory { + /** + * The singleton instance of the factory. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + RuntimeFactory eINSTANCE = org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.runtime.impl.RuntimeFactoryImpl.init(); + + /** + * Returns a new object of class '<em>ETyped Element Primitive Type Result</em>'. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @return a new object of class '<em>ETyped Element Primitive Type Result</em>'. + * @generated + */ + <T> ETypedElementPrimitiveTypeResult<T> createETypedElementPrimitiveTypeResult(); + + /** + * Returns a new object of class '<em>ETyped Element EObject Result</em>'. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @return a new object of class '<em>ETyped Element EObject Result</em>'. + * @generated + */ + <T extends EObject> ETypedElementEObjectResult<T> createETypedElementEObjectResult(); + + /** + * Returns a new object of class '<em>ETyped Element Primitive Type List Result</em>'. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @return a new object of class '<em>ETyped Element Primitive Type List Result</em>'. + * @generated + */ + <T> ETypedElementPrimitiveTypeListResult<T> createETypedElementPrimitiveTypeListResult(); + + /** + * Returns a new object of class '<em>ETyped Element EObject List Result</em>'. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @return a new object of class '<em>ETyped Element EObject List Result</em>'. + * @generated + */ + <T extends EObject> ETypedElementEObjectListResult<T> createETypedElementEObjectListResult(); + + /** + * Returns the package supported by this factory. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @return the package supported by this factory. + * @generated + */ + RuntimePackage getRuntimePackage(); + +} //RuntimeFactory
diff --git a/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/modisco/facet/efacet/metamodel/v0_2_0/efacet/runtime/RuntimePackage.java b/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/modisco/facet/efacet/metamodel/v0_2_0/efacet/runtime/RuntimePackage.java new file mode 100644 index 0000000..295640d --- /dev/null +++ b/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/modisco/facet/efacet/metamodel/v0_2_0/efacet/runtime/RuntimePackage.java
@@ -0,0 +1,696 @@ +/** + * Copyright (c) 2011, 2012 Mia-Software. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Gregoire Dupe (Mia-Software) - Design + * Nicolas Guyomar (Mia-Software) - Implementation + * Emmanuelle Rouillé (Mia-Software) - Bug 352618 - To be able to use non derived facet structural features and save them values. + * Nicolas Bros (Mia-Software) - Bug 361823 - [Restructuring] eFacet2 meta-model + * Gregoire Dupe (Mia-Software) - Bug 366055 - NavigationQuery + * Gregoire Dupe (Mia-Software) - Bug 369673 - [Facet] IsOneOfQuery + * Olivier Remaud (Soft-Maint) - Bug 369824 - Add a simple way to return string literal constants from a customization query + * Gregoire Dupe (Mia-software) - Bug 369987 - [Restructuring][Table] Switch to the new customization and facet framework + * Gregoire Dupe (Mia-software) - Bug 364325 - [Restructuring] The user must be able to navigate into a model using the Facet. + * Gregoire Dupe (Mia-Software) - Bug 373078 - API Cleaning + */ +package org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.runtime; + +import org.eclipse.emf.ecore.EAttribute; +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.EDataType; +import org.eclipse.emf.ecore.EPackage; +import org.eclipse.emf.ecore.EReference; + +/** + * <!-- begin-user-doc --> + * The <b>Package</b> for the model. + * It contains accessors for the meta objects to represent + * <ul> + * <li>each class,</li> + * <li>each feature of each class,</li> + * <li>each enum,</li> + * <li>and each data type</li> + * </ul> + * <!-- end-user-doc --> + * @see org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.runtime.RuntimeFactory + * @model kind="package" + * @generated + */ +public interface RuntimePackage extends EPackage { + /** + * The package name. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + String eNAME = "runtime"; //$NON-NLS-1$ + + /** + * The package namespace URI. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + String eNS_URI = "http://www.eclipse.org/emf/facet/efacet/0.2.incubation/efacet/runtime"; //$NON-NLS-1$ + + /** + * The package namespace name. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + String eNS_PREFIX = "runtime"; //$NON-NLS-1$ + + /** + * The singleton instance of the package. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + RuntimePackage eINSTANCE = org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.runtime.impl.RuntimePackageImpl.init(); + + /** + * The meta object id for the '{@link org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.runtime.impl.ETypedElementResultImpl <em>ETyped Element Result</em>}' class. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @see org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.runtime.impl.ETypedElementResultImpl + * @see org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.runtime.impl.RuntimePackageImpl#getETypedElementResult() + * @generated + */ + int ETYPED_ELEMENT_RESULT = 4; + + /** + * The feature id for the '<em><b>Derived Typed Element</b></em>' reference. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + */ + int ETYPED_ELEMENT_RESULT__DERIVED_TYPED_ELEMENT = 0; + + /** + * The feature id for the '<em><b>Parameter Values</b></em>' containment reference list. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + */ + int ETYPED_ELEMENT_RESULT__PARAMETER_VALUES = 1; + + /** + * The feature id for the '<em><b>Source</b></em>' reference. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + */ + int ETYPED_ELEMENT_RESULT__SOURCE = 2; + + /** + * The feature id for the '<em><b>Exception</b></em>' attribute. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + */ + int ETYPED_ELEMENT_RESULT__EXCEPTION = 3; + + /** + * The number of structural features of the '<em>ETyped Element Result</em>' class. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + */ + int ETYPED_ELEMENT_RESULT_FEATURE_COUNT = 4; + + /** + * The meta object id for the '{@link org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.runtime.impl.ETypedElementPrimitiveTypeResultImpl <em>ETyped Element Primitive Type Result</em>}' class. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @see org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.runtime.impl.ETypedElementPrimitiveTypeResultImpl + * @see org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.runtime.impl.RuntimePackageImpl#getETypedElementPrimitiveTypeResult() + * @generated + */ + int ETYPED_ELEMENT_PRIMITIVE_TYPE_RESULT = 0; + + /** + * The feature id for the '<em><b>Derived Typed Element</b></em>' reference. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + */ + int ETYPED_ELEMENT_PRIMITIVE_TYPE_RESULT__DERIVED_TYPED_ELEMENT = ETYPED_ELEMENT_RESULT__DERIVED_TYPED_ELEMENT; + + /** + * The feature id for the '<em><b>Parameter Values</b></em>' containment reference list. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + */ + int ETYPED_ELEMENT_PRIMITIVE_TYPE_RESULT__PARAMETER_VALUES = ETYPED_ELEMENT_RESULT__PARAMETER_VALUES; + + /** + * The feature id for the '<em><b>Source</b></em>' reference. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + */ + int ETYPED_ELEMENT_PRIMITIVE_TYPE_RESULT__SOURCE = ETYPED_ELEMENT_RESULT__SOURCE; + + /** + * The feature id for the '<em><b>Exception</b></em>' attribute. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + */ + int ETYPED_ELEMENT_PRIMITIVE_TYPE_RESULT__EXCEPTION = ETYPED_ELEMENT_RESULT__EXCEPTION; + + /** + * The feature id for the '<em><b>Result</b></em>' attribute. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + */ + int ETYPED_ELEMENT_PRIMITIVE_TYPE_RESULT__RESULT = ETYPED_ELEMENT_RESULT_FEATURE_COUNT + 0; + + /** + * The number of structural features of the '<em>ETyped Element Primitive Type Result</em>' class. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + */ + int ETYPED_ELEMENT_PRIMITIVE_TYPE_RESULT_FEATURE_COUNT = ETYPED_ELEMENT_RESULT_FEATURE_COUNT + 1; + + /** + * The meta object id for the '{@link org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.runtime.impl.ETypedElementEObjectResultImpl <em>ETyped Element EObject Result</em>}' class. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @see org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.runtime.impl.ETypedElementEObjectResultImpl + * @see org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.runtime.impl.RuntimePackageImpl#getETypedElementEObjectResult() + * @generated + */ + int ETYPED_ELEMENT_EOBJECT_RESULT = 1; + + /** + * The feature id for the '<em><b>Derived Typed Element</b></em>' reference. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + */ + int ETYPED_ELEMENT_EOBJECT_RESULT__DERIVED_TYPED_ELEMENT = ETYPED_ELEMENT_RESULT__DERIVED_TYPED_ELEMENT; + + /** + * The feature id for the '<em><b>Parameter Values</b></em>' containment reference list. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + */ + int ETYPED_ELEMENT_EOBJECT_RESULT__PARAMETER_VALUES = ETYPED_ELEMENT_RESULT__PARAMETER_VALUES; + + /** + * The feature id for the '<em><b>Source</b></em>' reference. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + */ + int ETYPED_ELEMENT_EOBJECT_RESULT__SOURCE = ETYPED_ELEMENT_RESULT__SOURCE; + + /** + * The feature id for the '<em><b>Exception</b></em>' attribute. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + */ + int ETYPED_ELEMENT_EOBJECT_RESULT__EXCEPTION = ETYPED_ELEMENT_RESULT__EXCEPTION; + + /** + * The feature id for the '<em><b>Result</b></em>' reference. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + */ + int ETYPED_ELEMENT_EOBJECT_RESULT__RESULT = ETYPED_ELEMENT_RESULT_FEATURE_COUNT + 0; + + /** + * The number of structural features of the '<em>ETyped Element EObject Result</em>' class. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + */ + int ETYPED_ELEMENT_EOBJECT_RESULT_FEATURE_COUNT = ETYPED_ELEMENT_RESULT_FEATURE_COUNT + 1; + + /** + * The meta object id for the '{@link org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.runtime.impl.ETypedElementPrimitiveTypeListResultImpl <em>ETyped Element Primitive Type List Result</em>}' class. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @see org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.runtime.impl.ETypedElementPrimitiveTypeListResultImpl + * @see org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.runtime.impl.RuntimePackageImpl#getETypedElementPrimitiveTypeListResult() + * @generated + */ + int ETYPED_ELEMENT_PRIMITIVE_TYPE_LIST_RESULT = 2; + + /** + * The feature id for the '<em><b>Derived Typed Element</b></em>' reference. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + */ + int ETYPED_ELEMENT_PRIMITIVE_TYPE_LIST_RESULT__DERIVED_TYPED_ELEMENT = ETYPED_ELEMENT_RESULT__DERIVED_TYPED_ELEMENT; + + /** + * The feature id for the '<em><b>Parameter Values</b></em>' containment reference list. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + */ + int ETYPED_ELEMENT_PRIMITIVE_TYPE_LIST_RESULT__PARAMETER_VALUES = ETYPED_ELEMENT_RESULT__PARAMETER_VALUES; + + /** + * The feature id for the '<em><b>Source</b></em>' reference. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + */ + int ETYPED_ELEMENT_PRIMITIVE_TYPE_LIST_RESULT__SOURCE = ETYPED_ELEMENT_RESULT__SOURCE; + + /** + * The feature id for the '<em><b>Exception</b></em>' attribute. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + */ + int ETYPED_ELEMENT_PRIMITIVE_TYPE_LIST_RESULT__EXCEPTION = ETYPED_ELEMENT_RESULT__EXCEPTION; + + /** + * The feature id for the '<em><b>Result List</b></em>' attribute list. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + */ + int ETYPED_ELEMENT_PRIMITIVE_TYPE_LIST_RESULT__RESULT_LIST = ETYPED_ELEMENT_RESULT_FEATURE_COUNT + 0; + + /** + * The number of structural features of the '<em>ETyped Element Primitive Type List Result</em>' class. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + */ + int ETYPED_ELEMENT_PRIMITIVE_TYPE_LIST_RESULT_FEATURE_COUNT = ETYPED_ELEMENT_RESULT_FEATURE_COUNT + 1; + + /** + * The meta object id for the '{@link org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.runtime.impl.ETypedElementEObjectListResultImpl <em>ETyped Element EObject List Result</em>}' class. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @see org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.runtime.impl.ETypedElementEObjectListResultImpl + * @see org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.runtime.impl.RuntimePackageImpl#getETypedElementEObjectListResult() + * @generated + */ + int ETYPED_ELEMENT_EOBJECT_LIST_RESULT = 3; + + /** + * The feature id for the '<em><b>Derived Typed Element</b></em>' reference. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + */ + int ETYPED_ELEMENT_EOBJECT_LIST_RESULT__DERIVED_TYPED_ELEMENT = ETYPED_ELEMENT_RESULT__DERIVED_TYPED_ELEMENT; + + /** + * The feature id for the '<em><b>Parameter Values</b></em>' containment reference list. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + */ + int ETYPED_ELEMENT_EOBJECT_LIST_RESULT__PARAMETER_VALUES = ETYPED_ELEMENT_RESULT__PARAMETER_VALUES; + + /** + * The feature id for the '<em><b>Source</b></em>' reference. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + */ + int ETYPED_ELEMENT_EOBJECT_LIST_RESULT__SOURCE = ETYPED_ELEMENT_RESULT__SOURCE; + + /** + * The feature id for the '<em><b>Exception</b></em>' attribute. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + */ + int ETYPED_ELEMENT_EOBJECT_LIST_RESULT__EXCEPTION = ETYPED_ELEMENT_RESULT__EXCEPTION; + + /** + * The feature id for the '<em><b>Result List</b></em>' reference list. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + */ + int ETYPED_ELEMENT_EOBJECT_LIST_RESULT__RESULT_LIST = ETYPED_ELEMENT_RESULT_FEATURE_COUNT + 0; + + /** + * The number of structural features of the '<em>ETyped Element EObject List Result</em>' class. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + */ + int ETYPED_ELEMENT_EOBJECT_LIST_RESULT_FEATURE_COUNT = ETYPED_ELEMENT_RESULT_FEATURE_COUNT + 1; + + /** + * The meta object id for the '<em>Java Exception</em>' data type. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @see java.lang.Throwable + * @see org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.runtime.impl.RuntimePackageImpl#getJavaException() + * @generated + */ + int JAVA_EXCEPTION = 5; + + + /** + * Returns the meta object for class '{@link org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.runtime.ETypedElementPrimitiveTypeResult <em>ETyped Element Primitive Type Result</em>}'. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @return the meta object for class '<em>ETyped Element Primitive Type Result</em>'. + * @see org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.runtime.ETypedElementPrimitiveTypeResult + * @generated + */ + EClass getETypedElementPrimitiveTypeResult(); + + /** + * Returns the meta object for the attribute '{@link org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.runtime.ETypedElementPrimitiveTypeResult#getResult <em>Result</em>}'. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @return the meta object for the attribute '<em>Result</em>'. + * @see org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.runtime.ETypedElementPrimitiveTypeResult#getResult() + * @see #getETypedElementPrimitiveTypeResult() + * @generated + */ + EAttribute getETypedElementPrimitiveTypeResult_Result(); + + /** + * Returns the meta object for class '{@link org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.runtime.ETypedElementEObjectResult <em>ETyped Element EObject Result</em>}'. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @return the meta object for class '<em>ETyped Element EObject Result</em>'. + * @see org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.runtime.ETypedElementEObjectResult + * @generated + */ + EClass getETypedElementEObjectResult(); + + /** + * Returns the meta object for the reference '{@link org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.runtime.ETypedElementEObjectResult#getResult <em>Result</em>}'. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @return the meta object for the reference '<em>Result</em>'. + * @see org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.runtime.ETypedElementEObjectResult#getResult() + * @see #getETypedElementEObjectResult() + * @generated + */ + EReference getETypedElementEObjectResult_Result(); + + /** + * Returns the meta object for class '{@link org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.runtime.ETypedElementPrimitiveTypeListResult <em>ETyped Element Primitive Type List Result</em>}'. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @return the meta object for class '<em>ETyped Element Primitive Type List Result</em>'. + * @see org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.runtime.ETypedElementPrimitiveTypeListResult + * @generated + */ + EClass getETypedElementPrimitiveTypeListResult(); + + /** + * Returns the meta object for the attribute list '{@link org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.runtime.ETypedElementPrimitiveTypeListResult#getResultList <em>Result List</em>}'. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @return the meta object for the attribute list '<em>Result List</em>'. + * @see org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.runtime.ETypedElementPrimitiveTypeListResult#getResultList() + * @see #getETypedElementPrimitiveTypeListResult() + * @generated + */ + EAttribute getETypedElementPrimitiveTypeListResult_ResultList(); + + /** + * Returns the meta object for class '{@link org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.runtime.ETypedElementEObjectListResult <em>ETyped Element EObject List Result</em>}'. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @return the meta object for class '<em>ETyped Element EObject List Result</em>'. + * @see org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.runtime.ETypedElementEObjectListResult + * @generated + */ + EClass getETypedElementEObjectListResult(); + + /** + * Returns the meta object for the reference list '{@link org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.runtime.ETypedElementEObjectListResult#getResultList <em>Result List</em>}'. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @return the meta object for the reference list '<em>Result List</em>'. + * @see org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.runtime.ETypedElementEObjectListResult#getResultList() + * @see #getETypedElementEObjectListResult() + * @generated + */ + EReference getETypedElementEObjectListResult_ResultList(); + + /** + * Returns the meta object for class '{@link org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.runtime.ETypedElementResult <em>ETyped Element Result</em>}'. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @return the meta object for class '<em>ETyped Element Result</em>'. + * @see org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.runtime.ETypedElementResult + * @generated + */ + EClass getETypedElementResult(); + + /** + * Returns the meta object for the reference '{@link org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.runtime.ETypedElementResult#getDerivedTypedElement <em>Derived Typed Element</em>}'. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @return the meta object for the reference '<em>Derived Typed Element</em>'. + * @see org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.runtime.ETypedElementResult#getDerivedTypedElement() + * @see #getETypedElementResult() + * @generated + */ + EReference getETypedElementResult_DerivedTypedElement(); + + /** + * Returns the meta object for the containment reference list '{@link org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.runtime.ETypedElementResult#getParameterValues <em>Parameter Values</em>}'. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @return the meta object for the containment reference list '<em>Parameter Values</em>'. + * @see org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.runtime.ETypedElementResult#getParameterValues() + * @see #getETypedElementResult() + * @generated + */ + EReference getETypedElementResult_ParameterValues(); + + /** + * Returns the meta object for the reference '{@link org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.runtime.ETypedElementResult#getSource <em>Source</em>}'. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @return the meta object for the reference '<em>Source</em>'. + * @see org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.runtime.ETypedElementResult#getSource() + * @see #getETypedElementResult() + * @generated + */ + EReference getETypedElementResult_Source(); + + /** + * Returns the meta object for the attribute '{@link org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.runtime.ETypedElementResult#getException <em>Exception</em>}'. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @return the meta object for the attribute '<em>Exception</em>'. + * @see org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.runtime.ETypedElementResult#getException() + * @see #getETypedElementResult() + * @generated + */ + EAttribute getETypedElementResult_Exception(); + + /** + * Returns the meta object for data type '{@link java.lang.Throwable <em>Java Exception</em>}'. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @return the meta object for data type '<em>Java Exception</em>'. + * @see java.lang.Throwable + * @model instanceClass="java.lang.Throwable" + * @generated + */ + EDataType getJavaException(); + + /** + * Returns the factory that creates the instances of the model. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @return the factory that creates the instances of the model. + * @generated + */ + RuntimeFactory getRuntimeFactory(); + + /** + * <!-- begin-user-doc --> + * Defines literals for the meta objects that represent + * <ul> + * <li>each class,</li> + * <li>each feature of each class,</li> + * <li>each enum,</li> + * <li>and each data type</li> + * </ul> + * <!-- end-user-doc --> + * @generated + */ + interface Literals { + /** + * The meta object literal for the '{@link org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.runtime.impl.ETypedElementPrimitiveTypeResultImpl <em>ETyped Element Primitive Type Result</em>}' class. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @see org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.runtime.impl.ETypedElementPrimitiveTypeResultImpl + * @see org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.runtime.impl.RuntimePackageImpl#getETypedElementPrimitiveTypeResult() + * @generated + */ + EClass ETYPED_ELEMENT_PRIMITIVE_TYPE_RESULT = eINSTANCE.getETypedElementPrimitiveTypeResult(); + + /** + * The meta object literal for the '<em><b>Result</b></em>' attribute feature. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + EAttribute ETYPED_ELEMENT_PRIMITIVE_TYPE_RESULT__RESULT = eINSTANCE.getETypedElementPrimitiveTypeResult_Result(); + + /** + * The meta object literal for the '{@link org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.runtime.impl.ETypedElementEObjectResultImpl <em>ETyped Element EObject Result</em>}' class. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @see org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.runtime.impl.ETypedElementEObjectResultImpl + * @see org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.runtime.impl.RuntimePackageImpl#getETypedElementEObjectResult() + * @generated + */ + EClass ETYPED_ELEMENT_EOBJECT_RESULT = eINSTANCE.getETypedElementEObjectResult(); + + /** + * The meta object literal for the '<em><b>Result</b></em>' reference feature. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + EReference ETYPED_ELEMENT_EOBJECT_RESULT__RESULT = eINSTANCE.getETypedElementEObjectResult_Result(); + + /** + * The meta object literal for the '{@link org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.runtime.impl.ETypedElementPrimitiveTypeListResultImpl <em>ETyped Element Primitive Type List Result</em>}' class. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @see org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.runtime.impl.ETypedElementPrimitiveTypeListResultImpl + * @see org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.runtime.impl.RuntimePackageImpl#getETypedElementPrimitiveTypeListResult() + * @generated + */ + EClass ETYPED_ELEMENT_PRIMITIVE_TYPE_LIST_RESULT = eINSTANCE.getETypedElementPrimitiveTypeListResult(); + + /** + * The meta object literal for the '<em><b>Result List</b></em>' attribute list feature. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + EAttribute ETYPED_ELEMENT_PRIMITIVE_TYPE_LIST_RESULT__RESULT_LIST = eINSTANCE.getETypedElementPrimitiveTypeListResult_ResultList(); + + /** + * The meta object literal for the '{@link org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.runtime.impl.ETypedElementEObjectListResultImpl <em>ETyped Element EObject List Result</em>}' class. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @see org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.runtime.impl.ETypedElementEObjectListResultImpl + * @see org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.runtime.impl.RuntimePackageImpl#getETypedElementEObjectListResult() + * @generated + */ + EClass ETYPED_ELEMENT_EOBJECT_LIST_RESULT = eINSTANCE.getETypedElementEObjectListResult(); + + /** + * The meta object literal for the '<em><b>Result List</b></em>' reference list feature. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + EReference ETYPED_ELEMENT_EOBJECT_LIST_RESULT__RESULT_LIST = eINSTANCE.getETypedElementEObjectListResult_ResultList(); + + /** + * The meta object literal for the '{@link org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.runtime.impl.ETypedElementResultImpl <em>ETyped Element Result</em>}' class. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @see org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.runtime.impl.ETypedElementResultImpl + * @see org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.runtime.impl.RuntimePackageImpl#getETypedElementResult() + * @generated + */ + EClass ETYPED_ELEMENT_RESULT = eINSTANCE.getETypedElementResult(); + + /** + * The meta object literal for the '<em><b>Derived Typed Element</b></em>' reference feature. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + EReference ETYPED_ELEMENT_RESULT__DERIVED_TYPED_ELEMENT = eINSTANCE.getETypedElementResult_DerivedTypedElement(); + + /** + * The meta object literal for the '<em><b>Parameter Values</b></em>' containment reference list feature. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + EReference ETYPED_ELEMENT_RESULT__PARAMETER_VALUES = eINSTANCE.getETypedElementResult_ParameterValues(); + + /** + * The meta object literal for the '<em><b>Source</b></em>' reference feature. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + EReference ETYPED_ELEMENT_RESULT__SOURCE = eINSTANCE.getETypedElementResult_Source(); + + /** + * The meta object literal for the '<em><b>Exception</b></em>' attribute feature. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + EAttribute ETYPED_ELEMENT_RESULT__EXCEPTION = eINSTANCE.getETypedElementResult_Exception(); + + /** + * The meta object literal for the '<em>Java Exception</em>' data type. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @see java.lang.Throwable + * @see org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.runtime.impl.RuntimePackageImpl#getJavaException() + * @generated + */ + EDataType JAVA_EXCEPTION = eINSTANCE.getJavaException(); + + } + +} //RuntimePackage
diff --git a/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/modisco/facet/efacet/metamodel/v0_2_0/efacet/runtime/impl/ETypedElementEObjectListResultImpl.java b/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/modisco/facet/efacet/metamodel/v0_2_0/efacet/runtime/impl/ETypedElementEObjectListResultImpl.java new file mode 100644 index 0000000..ec813a0 --- /dev/null +++ b/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/modisco/facet/efacet/metamodel/v0_2_0/efacet/runtime/impl/ETypedElementEObjectListResultImpl.java
@@ -0,0 +1,146 @@ +/** + * Copyright (c) 2011, 2012 Mia-Software. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Gregoire Dupe (Mia-Software) - Design + * Nicolas Guyomar (Mia-Software) - Implementation + * Emmanuelle Rouillé (Mia-Software) - Bug 352618 - To be able to use non derived facet structural features and save them values. + * Nicolas Bros (Mia-Software) - Bug 361823 - [Restructuring] eFacet2 meta-model + * Gregoire Dupe (Mia-Software) - Bug 366055 - NavigationQuery + * Gregoire Dupe (Mia-Software) - Bug 369673 - [Facet] IsOneOfQuery + * Olivier Remaud (Soft-Maint) - Bug 369824 - Add a simple way to return string literal constants from a customization query + * Gregoire Dupe (Mia-software) - Bug 369987 - [Restructuring][Table] Switch to the new customization and facet framework + * Gregoire Dupe (Mia-software) - Bug 364325 - [Restructuring] The user must be able to navigate into a model using the Facet. + */ +package org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.runtime.impl; + +import java.util.Collection; + +import org.eclipse.emf.common.util.EList; +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.ecore.util.EObjectResolvingEList; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.runtime.ETypedElementEObjectListResult; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.runtime.RuntimePackage; + +/** + * <!-- begin-user-doc --> + * An implementation of the model object '<em><b>ETyped Element EObject List Result</b></em>'. + * <!-- end-user-doc --> + * <p> + * The following features are implemented: + * <ul> + * <li>{@link org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.runtime.impl.ETypedElementEObjectListResultImpl#getResultList <em>Result List</em>}</li> + * </ul> + * </p> + * + * @generated + */ +public class ETypedElementEObjectListResultImpl<T extends EObject> extends ETypedElementResultImpl implements ETypedElementEObjectListResult<T> { + /** + * The cached value of the '{@link #getResultList() <em>Result List</em>}' reference list. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @see #getResultList() + * @generated + * @ordered + */ + protected EList<T> resultList; + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + protected ETypedElementEObjectListResultImpl() { + super(); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + protected EClass eStaticClass() { + return RuntimePackage.Literals.ETYPED_ELEMENT_EOBJECT_LIST_RESULT; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public EList<T> getResultList() { + if (resultList == null) { + resultList = new EObjectResolvingEList<T>(EObject.class, this, RuntimePackage.ETYPED_ELEMENT_EOBJECT_LIST_RESULT__RESULT_LIST); + } + return resultList; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + public Object eGet(int featureID, boolean resolve, boolean coreType) { + switch (featureID) { + case RuntimePackage.ETYPED_ELEMENT_EOBJECT_LIST_RESULT__RESULT_LIST: + return getResultList(); + } + return super.eGet(featureID, resolve, coreType); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @SuppressWarnings("unchecked") + @Override + public void eSet(int featureID, Object newValue) { + switch (featureID) { + case RuntimePackage.ETYPED_ELEMENT_EOBJECT_LIST_RESULT__RESULT_LIST: + getResultList().clear(); + getResultList().addAll((Collection<? extends T>)newValue); + return; + } + super.eSet(featureID, newValue); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + public void eUnset(int featureID) { + switch (featureID) { + case RuntimePackage.ETYPED_ELEMENT_EOBJECT_LIST_RESULT__RESULT_LIST: + getResultList().clear(); + return; + } + super.eUnset(featureID); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + public boolean eIsSet(int featureID) { + switch (featureID) { + case RuntimePackage.ETYPED_ELEMENT_EOBJECT_LIST_RESULT__RESULT_LIST: + return resultList != null && !resultList.isEmpty(); + } + return super.eIsSet(featureID); + } + +} //ETypedElementEObjectListResultImpl
diff --git a/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/modisco/facet/efacet/metamodel/v0_2_0/efacet/runtime/impl/ETypedElementEObjectResultImpl.java b/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/modisco/facet/efacet/metamodel/v0_2_0/efacet/runtime/impl/ETypedElementEObjectResultImpl.java new file mode 100644 index 0000000..7e6ed5d --- /dev/null +++ b/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/modisco/facet/efacet/metamodel/v0_2_0/efacet/runtime/impl/ETypedElementEObjectResultImpl.java
@@ -0,0 +1,172 @@ +/** + * Copyright (c) 2011, 2012 Mia-Software. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Gregoire Dupe (Mia-Software) - Design + * Nicolas Guyomar (Mia-Software) - Implementation + * Emmanuelle Rouillé (Mia-Software) - Bug 352618 - To be able to use non derived facet structural features and save them values. + * Nicolas Bros (Mia-Software) - Bug 361823 - [Restructuring] eFacet2 meta-model + * Gregoire Dupe (Mia-Software) - Bug 366055 - NavigationQuery + * Gregoire Dupe (Mia-Software) - Bug 369673 - [Facet] IsOneOfQuery + * Olivier Remaud (Soft-Maint) - Bug 369824 - Add a simple way to return string literal constants from a customization query + * Gregoire Dupe (Mia-software) - Bug 369987 - [Restructuring][Table] Switch to the new customization and facet framework + * Gregoire Dupe (Mia-software) - Bug 364325 - [Restructuring] The user must be able to navigate into a model using the Facet. + */ +package org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.runtime.impl; + +import org.eclipse.emf.common.notify.Notification; +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.ecore.InternalEObject; +import org.eclipse.emf.ecore.impl.ENotificationImpl; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.runtime.ETypedElementEObjectResult; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.runtime.RuntimePackage; + +/** + * <!-- begin-user-doc --> + * An implementation of the model object '<em><b>ETyped Element EObject Result</b></em>'. + * <!-- end-user-doc --> + * <p> + * The following features are implemented: + * <ul> + * <li>{@link org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.runtime.impl.ETypedElementEObjectResultImpl#getResult <em>Result</em>}</li> + * </ul> + * </p> + * + * @generated + */ +public class ETypedElementEObjectResultImpl<T extends EObject> extends ETypedElementResultImpl implements ETypedElementEObjectResult<T> { + /** + * The cached value of the '{@link #getResult() <em>Result</em>}' reference. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @see #getResult() + * @generated + * @ordered + */ + protected T result; + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + protected ETypedElementEObjectResultImpl() { + super(); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + protected EClass eStaticClass() { + return RuntimePackage.Literals.ETYPED_ELEMENT_EOBJECT_RESULT; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @SuppressWarnings("unchecked") + public T getResult() { + if (result != null && result.eIsProxy()) { + InternalEObject oldResult = (InternalEObject)result; + result = (T)eResolveProxy(oldResult); + if (result != oldResult) { + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.RESOLVE, RuntimePackage.ETYPED_ELEMENT_EOBJECT_RESULT__RESULT, oldResult, result)); + } + } + return result; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public T basicGetResult() { + return result; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public void setResult(T newResult) { + T oldResult = result; + result = newResult; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.SET, RuntimePackage.ETYPED_ELEMENT_EOBJECT_RESULT__RESULT, oldResult, result)); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + public Object eGet(int featureID, boolean resolve, boolean coreType) { + switch (featureID) { + case RuntimePackage.ETYPED_ELEMENT_EOBJECT_RESULT__RESULT: + if (resolve) return getResult(); + return basicGetResult(); + } + return super.eGet(featureID, resolve, coreType); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @SuppressWarnings("unchecked") + @Override + public void eSet(int featureID, Object newValue) { + switch (featureID) { + case RuntimePackage.ETYPED_ELEMENT_EOBJECT_RESULT__RESULT: + setResult((T)newValue); + return; + } + super.eSet(featureID, newValue); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + public void eUnset(int featureID) { + switch (featureID) { + case RuntimePackage.ETYPED_ELEMENT_EOBJECT_RESULT__RESULT: + setResult((T)null); + return; + } + super.eUnset(featureID); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + public boolean eIsSet(int featureID) { + switch (featureID) { + case RuntimePackage.ETYPED_ELEMENT_EOBJECT_RESULT__RESULT: + return result != null; + } + return super.eIsSet(featureID); + } + +} //ETypedElementEObjectResultImpl
diff --git a/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/modisco/facet/efacet/metamodel/v0_2_0/efacet/runtime/impl/ETypedElementPrimitiveTypeListResultImpl.java b/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/modisco/facet/efacet/metamodel/v0_2_0/efacet/runtime/impl/ETypedElementPrimitiveTypeListResultImpl.java new file mode 100644 index 0000000..d77f660 --- /dev/null +++ b/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/modisco/facet/efacet/metamodel/v0_2_0/efacet/runtime/impl/ETypedElementPrimitiveTypeListResultImpl.java
@@ -0,0 +1,161 @@ +/** + * Copyright (c) 2011, 2012 Mia-Software. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Gregoire Dupe (Mia-Software) - Design + * Nicolas Guyomar (Mia-Software) - Implementation + * Emmanuelle Rouillé (Mia-Software) - Bug 352618 - To be able to use non derived facet structural features and save them values. + * Nicolas Bros (Mia-Software) - Bug 361823 - [Restructuring] eFacet2 meta-model + * Gregoire Dupe (Mia-Software) - Bug 366055 - NavigationQuery + * Gregoire Dupe (Mia-Software) - Bug 369673 - [Facet] IsOneOfQuery + * Olivier Remaud (Soft-Maint) - Bug 369824 - Add a simple way to return string literal constants from a customization query + * Gregoire Dupe (Mia-software) - Bug 369987 - [Restructuring][Table] Switch to the new customization and facet framework + * Gregoire Dupe (Mia-software) - Bug 364325 - [Restructuring] The user must be able to navigate into a model using the Facet. + */ +package org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.runtime.impl; + +import java.util.Collection; + +import org.eclipse.emf.common.util.EList; +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.util.EDataTypeUniqueEList; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.runtime.ETypedElementPrimitiveTypeListResult; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.runtime.RuntimePackage; + +/** + * <!-- begin-user-doc --> + * An implementation of the model object '<em><b>ETyped Element Primitive Type List Result</b></em>'. + * <!-- end-user-doc --> + * <p> + * The following features are implemented: + * <ul> + * <li>{@link org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.runtime.impl.ETypedElementPrimitiveTypeListResultImpl#getResultList <em>Result List</em>}</li> + * </ul> + * </p> + * + * @generated + */ +public class ETypedElementPrimitiveTypeListResultImpl<T> extends ETypedElementResultImpl implements ETypedElementPrimitiveTypeListResult<T> { + /** + * The cached value of the '{@link #getResultList() <em>Result List</em>}' attribute list. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @see #getResultList() + * @generated + * @ordered + */ + protected EList<T> resultList; + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + protected ETypedElementPrimitiveTypeListResultImpl() { + super(); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + protected EClass eStaticClass() { + return RuntimePackage.Literals.ETYPED_ELEMENT_PRIMITIVE_TYPE_LIST_RESULT; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public EList<T> getResultList() { + if (resultList == null) { + resultList = new EDataTypeUniqueEList<T>(Object.class, this, RuntimePackage.ETYPED_ELEMENT_PRIMITIVE_TYPE_LIST_RESULT__RESULT_LIST); + } + return resultList; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + public Object eGet(int featureID, boolean resolve, boolean coreType) { + switch (featureID) { + case RuntimePackage.ETYPED_ELEMENT_PRIMITIVE_TYPE_LIST_RESULT__RESULT_LIST: + return getResultList(); + } + return super.eGet(featureID, resolve, coreType); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @SuppressWarnings("unchecked") + @Override + public void eSet(int featureID, Object newValue) { + switch (featureID) { + case RuntimePackage.ETYPED_ELEMENT_PRIMITIVE_TYPE_LIST_RESULT__RESULT_LIST: + getResultList().clear(); + getResultList().addAll((Collection<? extends T>)newValue); + return; + } + super.eSet(featureID, newValue); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + public void eUnset(int featureID) { + switch (featureID) { + case RuntimePackage.ETYPED_ELEMENT_PRIMITIVE_TYPE_LIST_RESULT__RESULT_LIST: + getResultList().clear(); + return; + } + super.eUnset(featureID); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + public boolean eIsSet(int featureID) { + switch (featureID) { + case RuntimePackage.ETYPED_ELEMENT_PRIMITIVE_TYPE_LIST_RESULT__RESULT_LIST: + return resultList != null && !resultList.isEmpty(); + } + return super.eIsSet(featureID); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + public String toString() { + if (eIsProxy()) return super.toString(); + + StringBuffer result = new StringBuffer(super.toString()); + result.append(" (resultList: "); //$NON-NLS-1$ + result.append(resultList); + result.append(')'); + return result.toString(); + } + +} //ETypedElementPrimitiveTypeListResultImpl
diff --git a/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/modisco/facet/efacet/metamodel/v0_2_0/efacet/runtime/impl/ETypedElementPrimitiveTypeResultImpl.java b/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/modisco/facet/efacet/metamodel/v0_2_0/efacet/runtime/impl/ETypedElementPrimitiveTypeResultImpl.java new file mode 100644 index 0000000..6689154 --- /dev/null +++ b/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/modisco/facet/efacet/metamodel/v0_2_0/efacet/runtime/impl/ETypedElementPrimitiveTypeResultImpl.java
@@ -0,0 +1,167 @@ +/** + * Copyright (c) 2011, 2012 Mia-Software. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Gregoire Dupe (Mia-Software) - Design + * Nicolas Guyomar (Mia-Software) - Implementation + * Emmanuelle Rouillé (Mia-Software) - Bug 352618 - To be able to use non derived facet structural features and save them values. + * Nicolas Bros (Mia-Software) - Bug 361823 - [Restructuring] eFacet2 meta-model + * Gregoire Dupe (Mia-Software) - Bug 366055 - NavigationQuery + * Gregoire Dupe (Mia-Software) - Bug 369673 - [Facet] IsOneOfQuery + * Olivier Remaud (Soft-Maint) - Bug 369824 - Add a simple way to return string literal constants from a customization query + * Gregoire Dupe (Mia-software) - Bug 369987 - [Restructuring][Table] Switch to the new customization and facet framework + * Gregoire Dupe (Mia-software) - Bug 364325 - [Restructuring] The user must be able to navigate into a model using the Facet. + */ +package org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.runtime.impl; + +import org.eclipse.emf.common.notify.Notification; +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.impl.ENotificationImpl; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.runtime.ETypedElementPrimitiveTypeResult; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.runtime.RuntimePackage; + +/** + * <!-- begin-user-doc --> + * An implementation of the model object '<em><b>ETyped Element Primitive Type Result</b></em>'. + * <!-- end-user-doc --> + * <p> + * The following features are implemented: + * <ul> + * <li>{@link org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.runtime.impl.ETypedElementPrimitiveTypeResultImpl#getResult <em>Result</em>}</li> + * </ul> + * </p> + * + * @generated + */ +public class ETypedElementPrimitiveTypeResultImpl<T> extends ETypedElementResultImpl implements ETypedElementPrimitiveTypeResult<T> { + /** + * The cached value of the '{@link #getResult() <em>Result</em>}' attribute. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @see #getResult() + * @generated + * @ordered + */ + protected T result; + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + protected ETypedElementPrimitiveTypeResultImpl() { + super(); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + protected EClass eStaticClass() { + return RuntimePackage.Literals.ETYPED_ELEMENT_PRIMITIVE_TYPE_RESULT; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public T getResult() { + return result; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public void setResult(T newResult) { + T oldResult = result; + result = newResult; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.SET, RuntimePackage.ETYPED_ELEMENT_PRIMITIVE_TYPE_RESULT__RESULT, oldResult, result)); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + public Object eGet(int featureID, boolean resolve, boolean coreType) { + switch (featureID) { + case RuntimePackage.ETYPED_ELEMENT_PRIMITIVE_TYPE_RESULT__RESULT: + return getResult(); + } + return super.eGet(featureID, resolve, coreType); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @SuppressWarnings("unchecked") + @Override + public void eSet(int featureID, Object newValue) { + switch (featureID) { + case RuntimePackage.ETYPED_ELEMENT_PRIMITIVE_TYPE_RESULT__RESULT: + setResult((T)newValue); + return; + } + super.eSet(featureID, newValue); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + public void eUnset(int featureID) { + switch (featureID) { + case RuntimePackage.ETYPED_ELEMENT_PRIMITIVE_TYPE_RESULT__RESULT: + setResult((T)null); + return; + } + super.eUnset(featureID); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + public boolean eIsSet(int featureID) { + switch (featureID) { + case RuntimePackage.ETYPED_ELEMENT_PRIMITIVE_TYPE_RESULT__RESULT: + return result != null; + } + return super.eIsSet(featureID); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + public String toString() { + if (eIsProxy()) return super.toString(); + + StringBuffer result = new StringBuffer(super.toString()); + result.append(" (result: "); //$NON-NLS-1$ + result.append(result); + result.append(')'); + return result.toString(); + } + +} //ETypedElementPrimitiveTypeResultImpl
diff --git a/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/modisco/facet/efacet/metamodel/v0_2_0/efacet/runtime/impl/ETypedElementResultImpl.java b/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/modisco/facet/efacet/metamodel/v0_2_0/efacet/runtime/impl/ETypedElementResultImpl.java new file mode 100644 index 0000000..b9456df --- /dev/null +++ b/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/modisco/facet/efacet/metamodel/v0_2_0/efacet/runtime/impl/ETypedElementResultImpl.java
@@ -0,0 +1,356 @@ +/** + * Copyright (c) 2011, 2012 Mia-Software. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Gregoire Dupe (Mia-Software) - Design + * Nicolas Guyomar (Mia-Software) - Implementation + * Emmanuelle Rouillé (Mia-Software) - Bug 352618 - To be able to use non derived facet structural features and save them values. + * Nicolas Bros (Mia-Software) - Bug 361823 - [Restructuring] eFacet2 meta-model + * Gregoire Dupe (Mia-Software) - Bug 366055 - NavigationQuery + * Gregoire Dupe (Mia-Software) - Bug 369673 - [Facet] IsOneOfQuery + * Olivier Remaud (Soft-Maint) - Bug 369824 - Add a simple way to return string literal constants from a customization query + * Gregoire Dupe (Mia-software) - Bug 369987 - [Restructuring][Table] Switch to the new customization and facet framework + * Gregoire Dupe (Mia-software) - Bug 364325 - [Restructuring] The user must be able to navigate into a model using the Facet. + */ +package org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.runtime.impl; + +import java.util.Collection; + +import org.eclipse.emf.common.notify.Notification; +import org.eclipse.emf.common.notify.NotificationChain; +import org.eclipse.emf.common.util.EList; +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.ecore.ETypedElement; +import org.eclipse.emf.ecore.InternalEObject; +import org.eclipse.emf.ecore.impl.ENotificationImpl; +import org.eclipse.emf.ecore.impl.EObjectImpl; +import org.eclipse.emf.ecore.util.EObjectContainmentEList; +import org.eclipse.emf.ecore.util.InternalEList; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.ParameterValue; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.runtime.ETypedElementResult; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.runtime.RuntimePackage; + +/** + * <!-- begin-user-doc --> + * An implementation of the model object '<em><b>ETyped Element Result</b></em>'. + * <!-- end-user-doc --> + * <p> + * The following features are implemented: + * <ul> + * <li>{@link org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.runtime.impl.ETypedElementResultImpl#getDerivedTypedElement <em>Derived Typed Element</em>}</li> + * <li>{@link org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.runtime.impl.ETypedElementResultImpl#getParameterValues <em>Parameter Values</em>}</li> + * <li>{@link org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.runtime.impl.ETypedElementResultImpl#getSource <em>Source</em>}</li> + * <li>{@link org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.runtime.impl.ETypedElementResultImpl#getException <em>Exception</em>}</li> + * </ul> + * </p> + * + * @generated + */ +public abstract class ETypedElementResultImpl extends EObjectImpl implements ETypedElementResult { + /** + * The cached value of the '{@link #getDerivedTypedElement() <em>Derived Typed Element</em>}' reference. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @see #getDerivedTypedElement() + * @generated + * @ordered + */ + protected ETypedElement derivedTypedElement; + + /** + * The cached value of the '{@link #getParameterValues() <em>Parameter Values</em>}' containment reference list. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @see #getParameterValues() + * @generated + * @ordered + */ + protected EList<ParameterValue> parameterValues; + + /** + * The cached value of the '{@link #getSource() <em>Source</em>}' reference. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @see #getSource() + * @generated + * @ordered + */ + protected EObject source; + + /** + * The default value of the '{@link #getException() <em>Exception</em>}' attribute. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @see #getException() + * @generated + * @ordered + */ + protected static final Throwable EXCEPTION_EDEFAULT = null; + + /** + * The cached value of the '{@link #getException() <em>Exception</em>}' attribute. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @see #getException() + * @generated + * @ordered + */ + protected Throwable exception = EXCEPTION_EDEFAULT; + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + protected ETypedElementResultImpl() { + super(); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + protected EClass eStaticClass() { + return RuntimePackage.Literals.ETYPED_ELEMENT_RESULT; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public ETypedElement getDerivedTypedElement() { + if (derivedTypedElement != null && derivedTypedElement.eIsProxy()) { + InternalEObject oldDerivedTypedElement = (InternalEObject)derivedTypedElement; + derivedTypedElement = (ETypedElement)eResolveProxy(oldDerivedTypedElement); + if (derivedTypedElement != oldDerivedTypedElement) { + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.RESOLVE, RuntimePackage.ETYPED_ELEMENT_RESULT__DERIVED_TYPED_ELEMENT, oldDerivedTypedElement, derivedTypedElement)); + } + } + return derivedTypedElement; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public ETypedElement basicGetDerivedTypedElement() { + return derivedTypedElement; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public void setDerivedTypedElement(ETypedElement newDerivedTypedElement) { + ETypedElement oldDerivedTypedElement = derivedTypedElement; + derivedTypedElement = newDerivedTypedElement; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.SET, RuntimePackage.ETYPED_ELEMENT_RESULT__DERIVED_TYPED_ELEMENT, oldDerivedTypedElement, derivedTypedElement)); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public EList<ParameterValue> getParameterValues() { + if (parameterValues == null) { + parameterValues = new EObjectContainmentEList<ParameterValue>(ParameterValue.class, this, RuntimePackage.ETYPED_ELEMENT_RESULT__PARAMETER_VALUES); + } + return parameterValues; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public EObject getSource() { + if (source != null && source.eIsProxy()) { + InternalEObject oldSource = (InternalEObject)source; + source = eResolveProxy(oldSource); + if (source != oldSource) { + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.RESOLVE, RuntimePackage.ETYPED_ELEMENT_RESULT__SOURCE, oldSource, source)); + } + } + return source; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public EObject basicGetSource() { + return source; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public void setSource(EObject newSource) { + EObject oldSource = source; + source = newSource; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.SET, RuntimePackage.ETYPED_ELEMENT_RESULT__SOURCE, oldSource, source)); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public Throwable getException() { + return exception; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public void setException(Throwable newException) { + Throwable oldException = exception; + exception = newException; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.SET, RuntimePackage.ETYPED_ELEMENT_RESULT__EXCEPTION, oldException, exception)); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { + switch (featureID) { + case RuntimePackage.ETYPED_ELEMENT_RESULT__PARAMETER_VALUES: + return ((InternalEList<?>)getParameterValues()).basicRemove(otherEnd, msgs); + } + return super.eInverseRemove(otherEnd, featureID, msgs); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + public Object eGet(int featureID, boolean resolve, boolean coreType) { + switch (featureID) { + case RuntimePackage.ETYPED_ELEMENT_RESULT__DERIVED_TYPED_ELEMENT: + if (resolve) return getDerivedTypedElement(); + return basicGetDerivedTypedElement(); + case RuntimePackage.ETYPED_ELEMENT_RESULT__PARAMETER_VALUES: + return getParameterValues(); + case RuntimePackage.ETYPED_ELEMENT_RESULT__SOURCE: + if (resolve) return getSource(); + return basicGetSource(); + case RuntimePackage.ETYPED_ELEMENT_RESULT__EXCEPTION: + return getException(); + } + return super.eGet(featureID, resolve, coreType); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @SuppressWarnings("unchecked") + @Override + public void eSet(int featureID, Object newValue) { + switch (featureID) { + case RuntimePackage.ETYPED_ELEMENT_RESULT__DERIVED_TYPED_ELEMENT: + setDerivedTypedElement((ETypedElement)newValue); + return; + case RuntimePackage.ETYPED_ELEMENT_RESULT__PARAMETER_VALUES: + getParameterValues().clear(); + getParameterValues().addAll((Collection<? extends ParameterValue>)newValue); + return; + case RuntimePackage.ETYPED_ELEMENT_RESULT__SOURCE: + setSource((EObject)newValue); + return; + case RuntimePackage.ETYPED_ELEMENT_RESULT__EXCEPTION: + setException((Throwable)newValue); + return; + } + super.eSet(featureID, newValue); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + public void eUnset(int featureID) { + switch (featureID) { + case RuntimePackage.ETYPED_ELEMENT_RESULT__DERIVED_TYPED_ELEMENT: + setDerivedTypedElement((ETypedElement)null); + return; + case RuntimePackage.ETYPED_ELEMENT_RESULT__PARAMETER_VALUES: + getParameterValues().clear(); + return; + case RuntimePackage.ETYPED_ELEMENT_RESULT__SOURCE: + setSource((EObject)null); + return; + case RuntimePackage.ETYPED_ELEMENT_RESULT__EXCEPTION: + setException(EXCEPTION_EDEFAULT); + return; + } + super.eUnset(featureID); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + public boolean eIsSet(int featureID) { + switch (featureID) { + case RuntimePackage.ETYPED_ELEMENT_RESULT__DERIVED_TYPED_ELEMENT: + return derivedTypedElement != null; + case RuntimePackage.ETYPED_ELEMENT_RESULT__PARAMETER_VALUES: + return parameterValues != null && !parameterValues.isEmpty(); + case RuntimePackage.ETYPED_ELEMENT_RESULT__SOURCE: + return source != null; + case RuntimePackage.ETYPED_ELEMENT_RESULT__EXCEPTION: + return EXCEPTION_EDEFAULT == null ? exception != null : !EXCEPTION_EDEFAULT.equals(exception); + } + return super.eIsSet(featureID); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + public String toString() { + if (eIsProxy()) return super.toString(); + + StringBuffer result = new StringBuffer(super.toString()); + result.append(" (exception: "); //$NON-NLS-1$ + result.append(exception); + result.append(')'); + return result.toString(); + } + +} //ETypedElementResultImpl
diff --git a/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/modisco/facet/efacet/metamodel/v0_2_0/efacet/runtime/impl/RuntimeFactoryImpl.java b/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/modisco/facet/efacet/metamodel/v0_2_0/efacet/runtime/impl/RuntimeFactoryImpl.java new file mode 100644 index 0000000..59c46c0 --- /dev/null +++ b/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/modisco/facet/efacet/metamodel/v0_2_0/efacet/runtime/impl/RuntimeFactoryImpl.java
@@ -0,0 +1,195 @@ +/** + * Copyright (c) 2011, 2015 Mia-Software, and Soft-Maint. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Gregoire Dupe (Mia-Software) - Design + * Nicolas Guyomar (Mia-Software) - Implementation + * Emmanuelle Rouillé (Mia-Software) - Bug 352618 - To be able to use non derived facet structural features and save them values. + * Nicolas Bros (Mia-Software) - Bug 361823 - [Restructuring] eFacet2 meta-model + * Gregoire Dupe (Mia-Software) - Bug 366055 - NavigationQuery + * Gregoire Dupe (Mia-Software) - Bug 369673 - [Facet] IsOneOfQuery + * Olivier Remaud (Soft-Maint) - Bug 369824 - Add a simple way to return string literal constants from a customization query + * Gregoire Dupe (Mia-Software) - Bug 369987 - [Restructuring][Table] Switch to the new customization and facet framework + * Gregoire Dupe (Mia-software) - Bug 364325 - [Restructuring] The user must be able to navigate into a model using the Facet. + * Nicolas Bros (Mia-Software) - Bug 372626 - [Facet] Aggregates + * Nicolas Bros (Mia-Software) - Bug 376941 - [EFacet] Facet operation arguments in Facet model + * Gregoire Dupe (Mia-Software) - Bug 376576 - [EFacet] Change the multiplicity of Facet::extendedFacet + * Jonathan Pepin (Soft-Maint) - Bug 463898 - Create FacetReference not derived, without query and with opposite mechanism + */ +package org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.runtime.impl; + +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.EDataType; +import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.ecore.EPackage; +import org.eclipse.emf.ecore.impl.EFactoryImpl; +import org.eclipse.emf.ecore.plugin.EcorePlugin; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.runtime.*; + +/** + * <!-- begin-user-doc --> + * An implementation of the model <b>Factory</b>. + * <!-- end-user-doc --> + * @generated + */ +public class RuntimeFactoryImpl extends EFactoryImpl implements RuntimeFactory { + /** + * Creates the default factory implementation. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public static RuntimeFactory init() { + try { + RuntimeFactory theRuntimeFactory = (RuntimeFactory)EPackage.Registry.INSTANCE.getEFactory(RuntimePackage.eNS_URI); + if (theRuntimeFactory != null) { + return theRuntimeFactory; + } + } + catch (Exception exception) { + EcorePlugin.INSTANCE.log(exception); + } + return new RuntimeFactoryImpl(); + } + + /** + * Creates an instance of the factory. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public RuntimeFactoryImpl() { + super(); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + public EObject create(EClass eClass) { + switch (eClass.getClassifierID()) { + case RuntimePackage.ETYPED_ELEMENT_PRIMITIVE_TYPE_RESULT: return createETypedElementPrimitiveTypeResult(); + case RuntimePackage.ETYPED_ELEMENT_EOBJECT_RESULT: return createETypedElementEObjectResult(); + case RuntimePackage.ETYPED_ELEMENT_PRIMITIVE_TYPE_LIST_RESULT: return createETypedElementPrimitiveTypeListResult(); + case RuntimePackage.ETYPED_ELEMENT_EOBJECT_LIST_RESULT: return createETypedElementEObjectListResult(); + default: + throw new IllegalArgumentException("The class '" + eClass.getName() + "' is not a valid classifier"); //$NON-NLS-1$ //$NON-NLS-2$ + } + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + public Object createFromString(EDataType eDataType, String initialValue) { + switch (eDataType.getClassifierID()) { + case RuntimePackage.JAVA_EXCEPTION: + return createJavaExceptionFromString(eDataType, initialValue); + default: + throw new IllegalArgumentException("The datatype '" + eDataType.getName() + "' is not a valid classifier"); //$NON-NLS-1$ //$NON-NLS-2$ + } + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + public String convertToString(EDataType eDataType, Object instanceValue) { + switch (eDataType.getClassifierID()) { + case RuntimePackage.JAVA_EXCEPTION: + return convertJavaExceptionToString(eDataType, instanceValue); + default: + throw new IllegalArgumentException("The datatype '" + eDataType.getName() + "' is not a valid classifier"); //$NON-NLS-1$ //$NON-NLS-2$ + } + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public <T> ETypedElementPrimitiveTypeResult<T> createETypedElementPrimitiveTypeResult() { + ETypedElementPrimitiveTypeResultImpl<T> eTypedElementPrimitiveTypeResult = new ETypedElementPrimitiveTypeResultImpl<T>(); + return eTypedElementPrimitiveTypeResult; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public <T extends EObject> ETypedElementEObjectResult<T> createETypedElementEObjectResult() { + ETypedElementEObjectResultImpl<T> eTypedElementEObjectResult = new ETypedElementEObjectResultImpl<T>(); + return eTypedElementEObjectResult; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public <T> ETypedElementPrimitiveTypeListResult<T> createETypedElementPrimitiveTypeListResult() { + ETypedElementPrimitiveTypeListResultImpl<T> eTypedElementPrimitiveTypeListResult = new ETypedElementPrimitiveTypeListResultImpl<T>(); + return eTypedElementPrimitiveTypeListResult; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public <T extends EObject> ETypedElementEObjectListResult<T> createETypedElementEObjectListResult() { + ETypedElementEObjectListResultImpl<T> eTypedElementEObjectListResult = new ETypedElementEObjectListResultImpl<T>(); + return eTypedElementEObjectListResult; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public Throwable createJavaExceptionFromString(EDataType eDataType, String initialValue) { + return (Throwable)super.createFromString(eDataType, initialValue); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public String convertJavaExceptionToString(EDataType eDataType, Object instanceValue) { + return super.convertToString(eDataType, instanceValue); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public RuntimePackage getRuntimePackage() { + return (RuntimePackage)getEPackage(); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @deprecated + * @generated + */ + @Deprecated + public static RuntimePackage getPackage() { + return RuntimePackage.eINSTANCE; + } + +} //RuntimeFactoryImpl
diff --git a/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/modisco/facet/efacet/metamodel/v0_2_0/efacet/runtime/impl/RuntimePackageImpl.java b/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/modisco/facet/efacet/metamodel/v0_2_0/efacet/runtime/impl/RuntimePackageImpl.java new file mode 100644 index 0000000..22c9bf5 --- /dev/null +++ b/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/modisco/facet/efacet/metamodel/v0_2_0/efacet/runtime/impl/RuntimePackageImpl.java
@@ -0,0 +1,421 @@ +/** + * Copyright (c) 2011, 2012 Mia-Software. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Gregoire Dupe (Mia-Software) - Design + * Nicolas Guyomar (Mia-Software) - Implementation + * Emmanuelle Rouillé (Mia-Software) - Bug 352618 - To be able to use non derived facet structural features and save them values. + * Nicolas Bros (Mia-Software) - Bug 361823 - [Restructuring] eFacet2 meta-model + * Gregoire Dupe (Mia-Software) - Bug 366055 - NavigationQuery + * Gregoire Dupe (Mia-Software) - Bug 369673 - [Facet] IsOneOfQuery + * Olivier Remaud (Soft-Maint) - Bug 369824 - Add a simple way to return string literal constants from a customization query + * Gregoire Dupe (Mia-software) - Bug 369987 - [Restructuring][Table] Switch to the new customization and facet framework + * Gregoire Dupe (Mia-software) - Bug 364325 - [Restructuring] The user must be able to navigate into a model using the Facet. + */ +package org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.runtime.impl; + +import org.eclipse.emf.ecore.EAttribute; +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.EDataType; +import org.eclipse.emf.ecore.EGenericType; +import org.eclipse.emf.ecore.EPackage; +import org.eclipse.emf.ecore.EReference; +import org.eclipse.emf.ecore.ETypeParameter; +import org.eclipse.emf.ecore.EcorePackage; +import org.eclipse.emf.ecore.impl.EPackageImpl; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.EFacetPackage; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.extensible.ExtensiblePackage; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.extensible.impl.ExtensiblePackageImpl; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.impl.EFacetPackageImpl; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.query.QueryPackage; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.query.impl.QueryPackageImpl; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.runtime.ETypedElementEObjectListResult; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.runtime.ETypedElementEObjectResult; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.runtime.ETypedElementPrimitiveTypeListResult; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.runtime.ETypedElementPrimitiveTypeResult; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.runtime.ETypedElementResult; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.runtime.RuntimeFactory; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.runtime.RuntimePackage; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.serialization.SerializationPackage; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.serialization.impl.SerializationPackageImpl; + +/** + * <!-- begin-user-doc --> + * An implementation of the model <b>Package</b>. + * <!-- end-user-doc --> + * @generated + */ +public class RuntimePackageImpl extends EPackageImpl implements RuntimePackage { + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + private EClass eTypedElementPrimitiveTypeResultEClass = null; + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + private EClass eTypedElementEObjectResultEClass = null; + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + private EClass eTypedElementPrimitiveTypeListResultEClass = null; + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + private EClass eTypedElementEObjectListResultEClass = null; + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + private EClass eTypedElementResultEClass = null; + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + private EDataType javaExceptionEDataType = null; + + /** + * Creates an instance of the model <b>Package</b>, registered with + * {@link org.eclipse.emf.ecore.EPackage.Registry EPackage.Registry} by the package + * package URI value. + * <p>Note: the correct way to create the package is via the static + * factory method {@link #init init()}, which also performs + * initialization of the package, or returns the registered package, + * if one already exists. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @see org.eclipse.emf.ecore.EPackage.Registry + * @see org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.runtime.RuntimePackage#eNS_URI + * @see #init() + * @generated + */ + private RuntimePackageImpl() { + super(eNS_URI, RuntimeFactory.eINSTANCE); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + private static boolean isInited = false; + + /** + * Creates, registers, and initializes the <b>Package</b> for this model, and for any others upon which it depends. + * + * <p>This method is used to initialize {@link RuntimePackage#eINSTANCE} when that field is accessed. + * Clients should not invoke it directly. Instead, they should simply access that field to obtain the package. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @see #eNS_URI + * @see #createPackageContents() + * @see #initializePackageContents() + * @generated + */ + public static RuntimePackage init() { + if (isInited) return (RuntimePackage)EPackage.Registry.INSTANCE.getEPackage(RuntimePackage.eNS_URI); + + // Obtain or create and register package + RuntimePackageImpl theRuntimePackage = (RuntimePackageImpl)(EPackage.Registry.INSTANCE.get(eNS_URI) instanceof RuntimePackageImpl ? EPackage.Registry.INSTANCE.get(eNS_URI) : new RuntimePackageImpl()); + + isInited = true; + + // Initialize simple dependencies + EcorePackage.eINSTANCE.eClass(); + + // Obtain or create and register interdependencies + EFacetPackageImpl theEFacetPackage = (EFacetPackageImpl)(EPackage.Registry.INSTANCE.getEPackage(EFacetPackage.eNS_URI) instanceof EFacetPackageImpl ? EPackage.Registry.INSTANCE.getEPackage(EFacetPackage.eNS_URI) : EFacetPackage.eINSTANCE); + SerializationPackageImpl theSerializationPackage = (SerializationPackageImpl)(EPackage.Registry.INSTANCE.getEPackage(SerializationPackage.eNS_URI) instanceof SerializationPackageImpl ? EPackage.Registry.INSTANCE.getEPackage(SerializationPackage.eNS_URI) : SerializationPackage.eINSTANCE); + ExtensiblePackageImpl theExtensiblePackage = (ExtensiblePackageImpl)(EPackage.Registry.INSTANCE.getEPackage(ExtensiblePackage.eNS_URI) instanceof ExtensiblePackageImpl ? EPackage.Registry.INSTANCE.getEPackage(ExtensiblePackage.eNS_URI) : ExtensiblePackage.eINSTANCE); + QueryPackageImpl theQueryPackage = (QueryPackageImpl)(EPackage.Registry.INSTANCE.getEPackage(QueryPackage.eNS_URI) instanceof QueryPackageImpl ? EPackage.Registry.INSTANCE.getEPackage(QueryPackage.eNS_URI) : QueryPackage.eINSTANCE); + + // Create package meta-data objects + theRuntimePackage.createPackageContents(); + theEFacetPackage.createPackageContents(); + theSerializationPackage.createPackageContents(); + theExtensiblePackage.createPackageContents(); + theQueryPackage.createPackageContents(); + + // Initialize created meta-data + theRuntimePackage.initializePackageContents(); + theEFacetPackage.initializePackageContents(); + theSerializationPackage.initializePackageContents(); + theExtensiblePackage.initializePackageContents(); + theQueryPackage.initializePackageContents(); + + // Mark meta-data to indicate it can't be changed + theRuntimePackage.freeze(); + + + // Update the registry and return the package + EPackage.Registry.INSTANCE.put(RuntimePackage.eNS_URI, theRuntimePackage); + return theRuntimePackage; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public EClass getETypedElementPrimitiveTypeResult() { + return eTypedElementPrimitiveTypeResultEClass; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public EAttribute getETypedElementPrimitiveTypeResult_Result() { + return (EAttribute)eTypedElementPrimitiveTypeResultEClass.getEStructuralFeatures().get(0); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public EClass getETypedElementEObjectResult() { + return eTypedElementEObjectResultEClass; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public EReference getETypedElementEObjectResult_Result() { + return (EReference)eTypedElementEObjectResultEClass.getEStructuralFeatures().get(0); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public EClass getETypedElementPrimitiveTypeListResult() { + return eTypedElementPrimitiveTypeListResultEClass; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public EAttribute getETypedElementPrimitiveTypeListResult_ResultList() { + return (EAttribute)eTypedElementPrimitiveTypeListResultEClass.getEStructuralFeatures().get(0); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public EClass getETypedElementEObjectListResult() { + return eTypedElementEObjectListResultEClass; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public EReference getETypedElementEObjectListResult_ResultList() { + return (EReference)eTypedElementEObjectListResultEClass.getEStructuralFeatures().get(0); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public EClass getETypedElementResult() { + return eTypedElementResultEClass; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public EReference getETypedElementResult_DerivedTypedElement() { + return (EReference)eTypedElementResultEClass.getEStructuralFeatures().get(0); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public EReference getETypedElementResult_ParameterValues() { + return (EReference)eTypedElementResultEClass.getEStructuralFeatures().get(1); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public EReference getETypedElementResult_Source() { + return (EReference)eTypedElementResultEClass.getEStructuralFeatures().get(2); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public EAttribute getETypedElementResult_Exception() { + return (EAttribute)eTypedElementResultEClass.getEStructuralFeatures().get(3); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public EDataType getJavaException() { + return javaExceptionEDataType; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public RuntimeFactory getRuntimeFactory() { + return (RuntimeFactory)getEFactoryInstance(); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + private boolean isCreated = false; + + /** + * Creates the meta-model objects for the package. This method is + * guarded to have no affect on any invocation but its first. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public void createPackageContents() { + if (isCreated) return; + isCreated = true; + + // Create classes and their features + eTypedElementPrimitiveTypeResultEClass = createEClass(ETYPED_ELEMENT_PRIMITIVE_TYPE_RESULT); + createEAttribute(eTypedElementPrimitiveTypeResultEClass, ETYPED_ELEMENT_PRIMITIVE_TYPE_RESULT__RESULT); + + eTypedElementEObjectResultEClass = createEClass(ETYPED_ELEMENT_EOBJECT_RESULT); + createEReference(eTypedElementEObjectResultEClass, ETYPED_ELEMENT_EOBJECT_RESULT__RESULT); + + eTypedElementPrimitiveTypeListResultEClass = createEClass(ETYPED_ELEMENT_PRIMITIVE_TYPE_LIST_RESULT); + createEAttribute(eTypedElementPrimitiveTypeListResultEClass, ETYPED_ELEMENT_PRIMITIVE_TYPE_LIST_RESULT__RESULT_LIST); + + eTypedElementEObjectListResultEClass = createEClass(ETYPED_ELEMENT_EOBJECT_LIST_RESULT); + createEReference(eTypedElementEObjectListResultEClass, ETYPED_ELEMENT_EOBJECT_LIST_RESULT__RESULT_LIST); + + eTypedElementResultEClass = createEClass(ETYPED_ELEMENT_RESULT); + createEReference(eTypedElementResultEClass, ETYPED_ELEMENT_RESULT__DERIVED_TYPED_ELEMENT); + createEReference(eTypedElementResultEClass, ETYPED_ELEMENT_RESULT__PARAMETER_VALUES); + createEReference(eTypedElementResultEClass, ETYPED_ELEMENT_RESULT__SOURCE); + createEAttribute(eTypedElementResultEClass, ETYPED_ELEMENT_RESULT__EXCEPTION); + + // Create data types + javaExceptionEDataType = createEDataType(JAVA_EXCEPTION); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + private boolean isInitialized = false; + + /** + * Complete the initialization of the package and its meta-model. This + * method is guarded to have no affect on any invocation but its first. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public void initializePackageContents() { + if (isInitialized) return; + isInitialized = true; + + // Initialize package + setName(eNAME); + setNsPrefix(eNS_PREFIX); + setNsURI(eNS_URI); + + // Obtain other dependent packages + EFacetPackage theEFacetPackage = (EFacetPackage)EPackage.Registry.INSTANCE.getEPackage(EFacetPackage.eNS_URI); + + // Create type parameters + ETypeParameter eTypedElementPrimitiveTypeResultEClass_T = addETypeParameter(eTypedElementPrimitiveTypeResultEClass, "T"); //$NON-NLS-1$ + ETypeParameter eTypedElementEObjectResultEClass_T = addETypeParameter(eTypedElementEObjectResultEClass, "T"); //$NON-NLS-1$ + ETypeParameter eTypedElementPrimitiveTypeListResultEClass_T = addETypeParameter(eTypedElementPrimitiveTypeListResultEClass, "T"); //$NON-NLS-1$ + ETypeParameter eTypedElementEObjectListResultEClass_T = addETypeParameter(eTypedElementEObjectListResultEClass, "T"); //$NON-NLS-1$ + + // Set bounds for type parameters + EGenericType g1 = createEGenericType(ecorePackage.getEObject()); + eTypedElementEObjectResultEClass_T.getEBounds().add(g1); + g1 = createEGenericType(ecorePackage.getEObject()); + eTypedElementEObjectListResultEClass_T.getEBounds().add(g1); + + // Add supertypes to classes + eTypedElementPrimitiveTypeResultEClass.getESuperTypes().add(this.getETypedElementResult()); + eTypedElementEObjectResultEClass.getESuperTypes().add(this.getETypedElementResult()); + eTypedElementPrimitiveTypeListResultEClass.getESuperTypes().add(this.getETypedElementResult()); + eTypedElementEObjectListResultEClass.getESuperTypes().add(this.getETypedElementResult()); + + // Initialize classes and features; add operations and parameters + initEClass(eTypedElementPrimitiveTypeResultEClass, ETypedElementPrimitiveTypeResult.class, "ETypedElementPrimitiveTypeResult", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); //$NON-NLS-1$ + g1 = createEGenericType(eTypedElementPrimitiveTypeResultEClass_T); + initEAttribute(getETypedElementPrimitiveTypeResult_Result(), g1, "result", null, 0, 1, ETypedElementPrimitiveTypeResult.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); //$NON-NLS-1$ + + initEClass(eTypedElementEObjectResultEClass, ETypedElementEObjectResult.class, "ETypedElementEObjectResult", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); //$NON-NLS-1$ + g1 = createEGenericType(eTypedElementEObjectResultEClass_T); + initEReference(getETypedElementEObjectResult_Result(), g1, null, "result", null, 0, 1, ETypedElementEObjectResult.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); //$NON-NLS-1$ + + initEClass(eTypedElementPrimitiveTypeListResultEClass, ETypedElementPrimitiveTypeListResult.class, "ETypedElementPrimitiveTypeListResult", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); //$NON-NLS-1$ + g1 = createEGenericType(eTypedElementPrimitiveTypeListResultEClass_T); + initEAttribute(getETypedElementPrimitiveTypeListResult_ResultList(), g1, "resultList", null, 0, -1, ETypedElementPrimitiveTypeListResult.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); //$NON-NLS-1$ + + initEClass(eTypedElementEObjectListResultEClass, ETypedElementEObjectListResult.class, "ETypedElementEObjectListResult", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); //$NON-NLS-1$ + g1 = createEGenericType(eTypedElementEObjectListResultEClass_T); + initEReference(getETypedElementEObjectListResult_ResultList(), g1, null, "resultList", null, 0, -1, ETypedElementEObjectListResult.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); //$NON-NLS-1$ + + initEClass(eTypedElementResultEClass, ETypedElementResult.class, "ETypedElementResult", IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); //$NON-NLS-1$ + initEReference(getETypedElementResult_DerivedTypedElement(), ecorePackage.getETypedElement(), null, "derivedTypedElement", null, 1, 1, ETypedElementResult.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); //$NON-NLS-1$ + initEReference(getETypedElementResult_ParameterValues(), theEFacetPackage.getParameterValue(), null, "parameterValues", null, 0, -1, ETypedElementResult.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); //$NON-NLS-1$ + initEReference(getETypedElementResult_Source(), ecorePackage.getEObject(), null, "source", null, 1, 1, ETypedElementResult.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); //$NON-NLS-1$ + initEAttribute(getETypedElementResult_Exception(), this.getJavaException(), "exception", null, 0, 1, ETypedElementResult.class, IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); //$NON-NLS-1$ + + // Initialize data types + initEDataType(javaExceptionEDataType, Throwable.class, "JavaException", IS_SERIALIZABLE, !IS_GENERATED_INSTANCE_CLASS); //$NON-NLS-1$ + } + +} //RuntimePackageImpl
diff --git a/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/modisco/facet/efacet/metamodel/v0_2_0/efacet/runtime/util/RuntimeAdapterFactory.java b/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/modisco/facet/efacet/metamodel/v0_2_0/efacet/runtime/util/RuntimeAdapterFactory.java new file mode 100644 index 0000000..3069657 --- /dev/null +++ b/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/modisco/facet/efacet/metamodel/v0_2_0/efacet/runtime/util/RuntimeAdapterFactory.java
@@ -0,0 +1,206 @@ +/** + * Copyright (c) 2011, 2012 Mia-Software. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Gregoire Dupe (Mia-Software) - Design + * Nicolas Guyomar (Mia-Software) - Implementation + * Emmanuelle Rouillé (Mia-Software) - Bug 352618 - To be able to use non derived facet structural features and save them values. + * Nicolas Bros (Mia-Software) - Bug 361823 - [Restructuring] eFacet2 meta-model + * Gregoire Dupe (Mia-Software) - Bug 366055 - NavigationQuery + * Gregoire Dupe (Mia-Software) - Bug 369673 - [Facet] IsOneOfQuery + * Olivier Remaud (Soft-Maint) - Bug 369824 - Add a simple way to return string literal constants from a customization query + * Gregoire Dupe (Mia-software) - Bug 369987 - [Restructuring][Table] Switch to the new customization and facet framework + * Gregoire Dupe (Mia-software) - Bug 364325 - [Restructuring] The user must be able to navigate into a model using the Facet. + */ +package org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.runtime.util; + +import org.eclipse.emf.common.notify.Adapter; +import org.eclipse.emf.common.notify.Notifier; +import org.eclipse.emf.common.notify.impl.AdapterFactoryImpl; +import org.eclipse.emf.ecore.EObject; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.runtime.*; + +/** + * <!-- begin-user-doc --> + * The <b>Adapter Factory</b> for the model. + * It provides an adapter <code>createXXX</code> method for each class of the model. + * <!-- end-user-doc --> + * @see org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.runtime.RuntimePackage + * @generated + */ +public class RuntimeAdapterFactory extends AdapterFactoryImpl { + /** + * The cached model package. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + protected static RuntimePackage modelPackage; + + /** + * Creates an instance of the adapter factory. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public RuntimeAdapterFactory() { + if (modelPackage == null) { + modelPackage = RuntimePackage.eINSTANCE; + } + } + + /** + * Returns whether this factory is applicable for the type of the object. + * <!-- begin-user-doc --> + * This implementation returns <code>true</code> if the object is either the model's package or is an instance object of the model. + * <!-- end-user-doc --> + * @return whether this factory is applicable for the type of the object. + * @generated + */ + @Override + public boolean isFactoryForType(Object object) { + if (object == modelPackage) { + return true; + } + if (object instanceof EObject) { + return ((EObject)object).eClass().getEPackage() == modelPackage; + } + return false; + } + + /** + * The switch that delegates to the <code>createXXX</code> methods. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + protected RuntimeSwitch<Adapter> modelSwitch = + new RuntimeSwitch<Adapter>() { + @Override + public <T> Adapter caseETypedElementPrimitiveTypeResult(ETypedElementPrimitiveTypeResult<T> object) { + return createETypedElementPrimitiveTypeResultAdapter(); + } + @Override + public <T extends EObject> Adapter caseETypedElementEObjectResult(ETypedElementEObjectResult<T> object) { + return createETypedElementEObjectResultAdapter(); + } + @Override + public <T> Adapter caseETypedElementPrimitiveTypeListResult(ETypedElementPrimitiveTypeListResult<T> object) { + return createETypedElementPrimitiveTypeListResultAdapter(); + } + @Override + public <T extends EObject> Adapter caseETypedElementEObjectListResult(ETypedElementEObjectListResult<T> object) { + return createETypedElementEObjectListResultAdapter(); + } + @Override + public Adapter caseETypedElementResult(ETypedElementResult object) { + return createETypedElementResultAdapter(); + } + @Override + public Adapter defaultCase(EObject object) { + return createEObjectAdapter(); + } + }; + + /** + * Creates an adapter for the <code>target</code>. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @param target the object to adapt. + * @return the adapter for the <code>target</code>. + * @generated + */ + @Override + public Adapter createAdapter(Notifier target) { + return modelSwitch.doSwitch((EObject)target); + } + + + /** + * Creates a new adapter for an object of class '{@link org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.runtime.ETypedElementPrimitiveTypeResult <em>ETyped Element Primitive Type Result</em>}'. + * <!-- begin-user-doc --> + * This default implementation returns null so that we can easily ignore cases; + * it's useful to ignore a case when inheritance will catch all the cases anyway. + * <!-- end-user-doc --> + * @return the new adapter. + * @see org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.runtime.ETypedElementPrimitiveTypeResult + * @generated + */ + public Adapter createETypedElementPrimitiveTypeResultAdapter() { + return null; + } + + /** + * Creates a new adapter for an object of class '{@link org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.runtime.ETypedElementEObjectResult <em>ETyped Element EObject Result</em>}'. + * <!-- begin-user-doc --> + * This default implementation returns null so that we can easily ignore cases; + * it's useful to ignore a case when inheritance will catch all the cases anyway. + * <!-- end-user-doc --> + * @return the new adapter. + * @see org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.runtime.ETypedElementEObjectResult + * @generated + */ + public Adapter createETypedElementEObjectResultAdapter() { + return null; + } + + /** + * Creates a new adapter for an object of class '{@link org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.runtime.ETypedElementPrimitiveTypeListResult <em>ETyped Element Primitive Type List Result</em>}'. + * <!-- begin-user-doc --> + * This default implementation returns null so that we can easily ignore cases; + * it's useful to ignore a case when inheritance will catch all the cases anyway. + * <!-- end-user-doc --> + * @return the new adapter. + * @see org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.runtime.ETypedElementPrimitiveTypeListResult + * @generated + */ + public Adapter createETypedElementPrimitiveTypeListResultAdapter() { + return null; + } + + /** + * Creates a new adapter for an object of class '{@link org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.runtime.ETypedElementEObjectListResult <em>ETyped Element EObject List Result</em>}'. + * <!-- begin-user-doc --> + * This default implementation returns null so that we can easily ignore cases; + * it's useful to ignore a case when inheritance will catch all the cases anyway. + * <!-- end-user-doc --> + * @return the new adapter. + * @see org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.runtime.ETypedElementEObjectListResult + * @generated + */ + public Adapter createETypedElementEObjectListResultAdapter() { + return null; + } + + /** + * Creates a new adapter for an object of class '{@link org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.runtime.ETypedElementResult <em>ETyped Element Result</em>}'. + * <!-- begin-user-doc --> + * This default implementation returns null so that we can easily ignore cases; + * it's useful to ignore a case when inheritance will catch all the cases anyway. + * <!-- end-user-doc --> + * @return the new adapter. + * @see org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.runtime.ETypedElementResult + * @generated + */ + public Adapter createETypedElementResultAdapter() { + return null; + } + + /** + * Creates a new adapter for the default case. + * <!-- begin-user-doc --> + * This default implementation returns null. + * <!-- end-user-doc --> + * @return the new adapter. + * @generated + */ + public Adapter createEObjectAdapter() { + return null; + } + +} //RuntimeAdapterFactory
diff --git a/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/modisco/facet/efacet/metamodel/v0_2_0/efacet/runtime/util/RuntimeSwitch.java b/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/modisco/facet/efacet/metamodel/v0_2_0/efacet/runtime/util/RuntimeSwitch.java new file mode 100644 index 0000000..93b64ff --- /dev/null +++ b/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/modisco/facet/efacet/metamodel/v0_2_0/efacet/runtime/util/RuntimeSwitch.java
@@ -0,0 +1,230 @@ +/** + * Copyright (c) 2011, 2012 Mia-Software. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Gregoire Dupe (Mia-Software) - Design + * Nicolas Guyomar (Mia-Software) - Implementation + * Emmanuelle Rouillé (Mia-Software) - Bug 352618 - To be able to use non derived facet structural features and save them values. + * Nicolas Bros (Mia-Software) - Bug 361823 - [Restructuring] eFacet2 meta-model + * Gregoire Dupe (Mia-Software) - Bug 366055 - NavigationQuery + * Gregoire Dupe (Mia-Software) - Bug 369673 - [Facet] IsOneOfQuery + * Olivier Remaud (Soft-Maint) - Bug 369824 - Add a simple way to return string literal constants from a customization query + * Gregoire Dupe (Mia-software) - Bug 369987 - [Restructuring][Table] Switch to the new customization and facet framework + * Gregoire Dupe (Mia-software) - Bug 364325 - [Restructuring] The user must be able to navigate into a model using the Facet. + */ +package org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.runtime.util; + +import java.util.List; + +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.EObject; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.runtime.*; + +/** + * <!-- begin-user-doc --> + * The <b>Switch</b> for the model's inheritance hierarchy. + * It supports the call {@link #doSwitch(EObject) doSwitch(object)} + * to invoke the <code>caseXXX</code> method for each class of the model, + * starting with the actual class of the object + * and proceeding up the inheritance hierarchy + * until a non-null result is returned, + * which is the result of the switch. + * <!-- end-user-doc --> + * @see org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.runtime.RuntimePackage + * @generated + */ +public class RuntimeSwitch<T1> { + /** + * The cached model package + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + protected static RuntimePackage modelPackage; + + /** + * Creates an instance of the switch. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public RuntimeSwitch() { + if (modelPackage == null) { + modelPackage = RuntimePackage.eINSTANCE; + } + } + + /** + * Calls <code>caseXXX</code> for each class of the model until one returns a non null result; it yields that result. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @return the first non-null result returned by a <code>caseXXX</code> call. + * @generated + */ + public T1 doSwitch(EObject theEObject) { + return doSwitch(theEObject.eClass(), theEObject); + } + + /** + * Calls <code>caseXXX</code> for each class of the model until one returns a non null result; it yields that result. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @return the first non-null result returned by a <code>caseXXX</code> call. + * @generated + */ + protected T1 doSwitch(EClass theEClass, EObject theEObject) { + if (theEClass.eContainer() == modelPackage) { + return doSwitch(theEClass.getClassifierID(), theEObject); + } + else { + List<EClass> eSuperTypes = theEClass.getESuperTypes(); + return + eSuperTypes.isEmpty() ? + defaultCase(theEObject) : + doSwitch(eSuperTypes.get(0), theEObject); + } + } + + /** + * Calls <code>caseXXX</code> for each class of the model until one returns a non null result; it yields that result. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @return the first non-null result returned by a <code>caseXXX</code> call. + * @generated + */ + protected T1 doSwitch(int classifierID, EObject theEObject) { + switch (classifierID) { + case RuntimePackage.ETYPED_ELEMENT_PRIMITIVE_TYPE_RESULT: { + ETypedElementPrimitiveTypeResult<?> eTypedElementPrimitiveTypeResult = (ETypedElementPrimitiveTypeResult<?>)theEObject; + T1 result = caseETypedElementPrimitiveTypeResult(eTypedElementPrimitiveTypeResult); + if (result == null) result = caseETypedElementResult(eTypedElementPrimitiveTypeResult); + if (result == null) result = defaultCase(theEObject); + return result; + } + case RuntimePackage.ETYPED_ELEMENT_EOBJECT_RESULT: { + ETypedElementEObjectResult<?> eTypedElementEObjectResult = (ETypedElementEObjectResult<?>)theEObject; + T1 result = caseETypedElementEObjectResult(eTypedElementEObjectResult); + if (result == null) result = caseETypedElementResult(eTypedElementEObjectResult); + if (result == null) result = defaultCase(theEObject); + return result; + } + case RuntimePackage.ETYPED_ELEMENT_PRIMITIVE_TYPE_LIST_RESULT: { + ETypedElementPrimitiveTypeListResult<?> eTypedElementPrimitiveTypeListResult = (ETypedElementPrimitiveTypeListResult<?>)theEObject; + T1 result = caseETypedElementPrimitiveTypeListResult(eTypedElementPrimitiveTypeListResult); + if (result == null) result = caseETypedElementResult(eTypedElementPrimitiveTypeListResult); + if (result == null) result = defaultCase(theEObject); + return result; + } + case RuntimePackage.ETYPED_ELEMENT_EOBJECT_LIST_RESULT: { + ETypedElementEObjectListResult<?> eTypedElementEObjectListResult = (ETypedElementEObjectListResult<?>)theEObject; + T1 result = caseETypedElementEObjectListResult(eTypedElementEObjectListResult); + if (result == null) result = caseETypedElementResult(eTypedElementEObjectListResult); + if (result == null) result = defaultCase(theEObject); + return result; + } + case RuntimePackage.ETYPED_ELEMENT_RESULT: { + ETypedElementResult eTypedElementResult = (ETypedElementResult)theEObject; + T1 result = caseETypedElementResult(eTypedElementResult); + if (result == null) result = defaultCase(theEObject); + return result; + } + default: return defaultCase(theEObject); + } + } + + /** + * Returns the result of interpreting the object as an instance of '<em>ETyped Element Primitive Type Result</em>'. + * <!-- begin-user-doc --> + * This implementation returns null; + * returning a non-null result will terminate the switch. + * <!-- end-user-doc --> + * @param object the target of the switch. + * @return the result of interpreting the object as an instance of '<em>ETyped Element Primitive Type Result</em>'. + * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) + * @generated + */ + public <T> T1 caseETypedElementPrimitiveTypeResult(ETypedElementPrimitiveTypeResult<T> object) { + return null; + } + + /** + * Returns the result of interpreting the object as an instance of '<em>ETyped Element EObject Result</em>'. + * <!-- begin-user-doc --> + * This implementation returns null; + * returning a non-null result will terminate the switch. + * <!-- end-user-doc --> + * @param object the target of the switch. + * @return the result of interpreting the object as an instance of '<em>ETyped Element EObject Result</em>'. + * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) + * @generated + */ + public <T extends EObject> T1 caseETypedElementEObjectResult(ETypedElementEObjectResult<T> object) { + return null; + } + + /** + * Returns the result of interpreting the object as an instance of '<em>ETyped Element Primitive Type List Result</em>'. + * <!-- begin-user-doc --> + * This implementation returns null; + * returning a non-null result will terminate the switch. + * <!-- end-user-doc --> + * @param object the target of the switch. + * @return the result of interpreting the object as an instance of '<em>ETyped Element Primitive Type List Result</em>'. + * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) + * @generated + */ + public <T> T1 caseETypedElementPrimitiveTypeListResult(ETypedElementPrimitiveTypeListResult<T> object) { + return null; + } + + /** + * Returns the result of interpreting the object as an instance of '<em>ETyped Element EObject List Result</em>'. + * <!-- begin-user-doc --> + * This implementation returns null; + * returning a non-null result will terminate the switch. + * <!-- end-user-doc --> + * @param object the target of the switch. + * @return the result of interpreting the object as an instance of '<em>ETyped Element EObject List Result</em>'. + * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) + * @generated + */ + public <T extends EObject> T1 caseETypedElementEObjectListResult(ETypedElementEObjectListResult<T> object) { + return null; + } + + /** + * Returns the result of interpreting the object as an instance of '<em>ETyped Element Result</em>'. + * <!-- begin-user-doc --> + * This implementation returns null; + * returning a non-null result will terminate the switch. + * <!-- end-user-doc --> + * @param object the target of the switch. + * @return the result of interpreting the object as an instance of '<em>ETyped Element Result</em>'. + * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) + * @generated + */ + public T1 caseETypedElementResult(ETypedElementResult object) { + return null; + } + + /** + * Returns the result of interpreting the object as an instance of '<em>EObject</em>'. + * <!-- begin-user-doc --> + * This implementation returns null; + * returning a non-null result will terminate the switch, but this is the last case anyway. + * <!-- end-user-doc --> + * @param object the target of the switch. + * @return the result of interpreting the object as an instance of '<em>EObject</em>'. + * @see #doSwitch(org.eclipse.emf.ecore.EObject) + * @generated + */ + public T1 defaultCase(EObject object) { + return null; + } + +} //RuntimeSwitch
diff --git a/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/modisco/facet/efacet/metamodel/v0_2_0/efacet/serialization/AbstractAttributeInstance.java b/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/modisco/facet/efacet/metamodel/v0_2_0/efacet/serialization/AbstractAttributeInstance.java new file mode 100644 index 0000000..356dfd9 --- /dev/null +++ b/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/modisco/facet/efacet/metamodel/v0_2_0/efacet/serialization/AbstractAttributeInstance.java
@@ -0,0 +1,63 @@ +/** + * Copyright (c) 2011 Mia-Software. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Gregoire Dupe (Mia-Software) - Design + * Nicolas Guyomar (Mia-Software) - Implementation + * Emmanuelle Rouillé (Mia-Software) - Bug 352618 - To be able to use non derived facet structural features and save them values. + * Nicolas Bros (Mia-Software) - Bug 361823 - [Restructuring] eFacet2 meta-model + */ +package org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.serialization; + +import org.eclipse.emf.ecore.EAttribute; +import org.eclipse.emf.ecore.EObject; + +/** + * <!-- begin-user-doc --> + * A representation of the model object '<em><b>Abstract Attribute Instance</b></em>'. + * <!-- end-user-doc --> + * + * <p> + * The following features are supported: + * <ul> + * <li>{@link org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.serialization.AbstractAttributeInstance#getEAttribute <em>EAttribute</em>}</li> + * </ul> + * </p> + * + * @see org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.serialization.SerializationPackage#getAbstractAttributeInstance() + * @model + * @generated + */ +public interface AbstractAttributeInstance extends EObject { + /** + * Returns the value of the '<em><b>EAttribute</b></em>' reference. + * <!-- begin-user-doc --> + * <p> + * If the meaning of the '<em>EAttribute</em>' reference isn't clear, + * there really should be more of a description here... + * </p> + * <!-- end-user-doc --> + * @return the value of the '<em>EAttribute</em>' reference. + * @see #setEAttribute(EAttribute) + * @see org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.serialization.SerializationPackage#getAbstractAttributeInstance_EAttribute() + * @model required="true" + * @generated + */ + EAttribute getEAttribute(); + + /** + * Sets the value of the '{@link org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.serialization.AbstractAttributeInstance#getEAttribute <em>EAttribute</em>}' reference. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @param value the new value of the '<em>EAttribute</em>' reference. + * @see #getEAttribute() + * @generated + */ + void setEAttribute(EAttribute value); + +} // AbstractAttributeInstance
diff --git a/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/modisco/facet/efacet/metamodel/v0_2_0/efacet/serialization/AbstractReferenceInstance.java b/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/modisco/facet/efacet/metamodel/v0_2_0/efacet/serialization/AbstractReferenceInstance.java new file mode 100644 index 0000000..4b81df8 --- /dev/null +++ b/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/modisco/facet/efacet/metamodel/v0_2_0/efacet/serialization/AbstractReferenceInstance.java
@@ -0,0 +1,63 @@ +/** + * Copyright (c) 2011 Mia-Software. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Gregoire Dupe (Mia-Software) - Design + * Nicolas Guyomar (Mia-Software) - Implementation + * Emmanuelle Rouillé (Mia-Software) - Bug 352618 - To be able to use non derived facet structural features and save them values. + * Nicolas Bros (Mia-Software) - Bug 361823 - [Restructuring] eFacet2 meta-model + */ +package org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.serialization; + +import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.ecore.EReference; + +/** + * <!-- begin-user-doc --> + * A representation of the model object '<em><b>Abstract Reference Instance</b></em>'. + * <!-- end-user-doc --> + * + * <p> + * The following features are supported: + * <ul> + * <li>{@link org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.serialization.AbstractReferenceInstance#getEReference <em>EReference</em>}</li> + * </ul> + * </p> + * + * @see org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.serialization.SerializationPackage#getAbstractReferenceInstance() + * @model + * @generated + */ +public interface AbstractReferenceInstance extends EObject { + /** + * Returns the value of the '<em><b>EReference</b></em>' reference. + * <!-- begin-user-doc --> + * <p> + * If the meaning of the '<em>EReference</em>' reference isn't clear, + * there really should be more of a description here... + * </p> + * <!-- end-user-doc --> + * @return the value of the '<em>EReference</em>' reference. + * @see #setEReference(EReference) + * @see org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.serialization.SerializationPackage#getAbstractReferenceInstance_EReference() + * @model required="true" + * @generated + */ + EReference getEReference(); + + /** + * Sets the value of the '{@link org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.serialization.AbstractReferenceInstance#getEReference <em>EReference</em>}' reference. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @param value the new value of the '<em>EReference</em>' reference. + * @see #getEReference() + * @generated + */ + void setEReference(EReference value); + +} // AbstractReferenceInstance
diff --git a/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/modisco/facet/efacet/metamodel/v0_2_0/efacet/serialization/ExtendedEObjectReference.java b/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/modisco/facet/efacet/metamodel/v0_2_0/efacet/serialization/ExtendedEObjectReference.java new file mode 100644 index 0000000..a59c74b --- /dev/null +++ b/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/modisco/facet/efacet/metamodel/v0_2_0/efacet/serialization/ExtendedEObjectReference.java
@@ -0,0 +1,97 @@ +/** + * Copyright (c) 2011 Mia-Software. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Gregoire Dupe (Mia-Software) - Design + * Nicolas Guyomar (Mia-Software) - Implementation + * Emmanuelle Rouillé (Mia-Software) - Bug 352618 - To be able to use non derived facet structural features and save them values. + * Nicolas Bros (Mia-Software) - Bug 361823 - [Restructuring] eFacet2 meta-model + */ +package org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.serialization; + +import org.eclipse.emf.common.util.EList; +import org.eclipse.emf.ecore.EObject; + +/** + * <!-- begin-user-doc --> + * A representation of the model object '<em><b>Extended EObject Reference</b></em>'. + * <!-- end-user-doc --> + * + * <p> + * The following features are supported: + * <ul> + * <li>{@link org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.serialization.ExtendedEObjectReference#getExtendedEObject <em>Extended EObject</em>}</li> + * <li>{@link org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.serialization.ExtendedEObjectReference#getAttributeInstances <em>Attribute Instances</em>}</li> + * <li>{@link org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.serialization.ExtendedEObjectReference#getReferenceInstances <em>Reference Instances</em>}</li> + * </ul> + * </p> + * + * @see org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.serialization.SerializationPackage#getExtendedEObjectReference() + * @model + * @generated + */ +public interface ExtendedEObjectReference extends EObject { + /** + * Returns the value of the '<em><b>Extended EObject</b></em>' reference. + * <!-- begin-user-doc --> + * <p> + * If the meaning of the '<em>Extended EObject</em>' reference isn't clear, + * there really should be more of a description here... + * </p> + * <!-- end-user-doc --> + * @return the value of the '<em>Extended EObject</em>' reference. + * @see #setExtendedEObject(EObject) + * @see org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.serialization.SerializationPackage#getExtendedEObjectReference_ExtendedEObject() + * @model required="true" + * @generated + */ + EObject getExtendedEObject(); + + /** + * Sets the value of the '{@link org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.serialization.ExtendedEObjectReference#getExtendedEObject <em>Extended EObject</em>}' reference. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @param value the new value of the '<em>Extended EObject</em>' reference. + * @see #getExtendedEObject() + * @generated + */ + void setExtendedEObject(EObject value); + + /** + * Returns the value of the '<em><b>Attribute Instances</b></em>' containment reference list. + * The list contents are of type {@link org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.serialization.AbstractAttributeInstance}. + * <!-- begin-user-doc --> + * <p> + * If the meaning of the '<em>Attribute Instances</em>' containment reference list isn't clear, + * there really should be more of a description here... + * </p> + * <!-- end-user-doc --> + * @return the value of the '<em>Attribute Instances</em>' containment reference list. + * @see org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.serialization.SerializationPackage#getExtendedEObjectReference_AttributeInstances() + * @model containment="true" + * @generated + */ + EList<AbstractAttributeInstance> getAttributeInstances(); + + /** + * Returns the value of the '<em><b>Reference Instances</b></em>' containment reference list. + * The list contents are of type {@link org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.serialization.AbstractReferenceInstance}. + * <!-- begin-user-doc --> + * <p> + * If the meaning of the '<em>Reference Instances</em>' containment reference list isn't clear, + * there really should be more of a description here... + * </p> + * <!-- end-user-doc --> + * @return the value of the '<em>Reference Instances</em>' containment reference list. + * @see org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.serialization.SerializationPackage#getExtendedEObjectReference_ReferenceInstances() + * @model containment="true" + * @generated + */ + EList<AbstractReferenceInstance> getReferenceInstances(); + +} // ExtendedEObjectReference
diff --git a/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/modisco/facet/efacet/metamodel/v0_2_0/efacet/serialization/MultiValuedAttributeInstance.java b/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/modisco/facet/efacet/metamodel/v0_2_0/efacet/serialization/MultiValuedAttributeInstance.java new file mode 100644 index 0000000..1a35884 --- /dev/null +++ b/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/modisco/facet/efacet/metamodel/v0_2_0/efacet/serialization/MultiValuedAttributeInstance.java
@@ -0,0 +1,52 @@ +/** + * Copyright (c) 2011 Mia-Software. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Gregoire Dupe (Mia-Software) - Design + * Nicolas Guyomar (Mia-Software) - Implementation + * Emmanuelle Rouillé (Mia-Software) - Bug 352618 - To be able to use non derived facet structural features and save them values. + * Nicolas Bros (Mia-Software) - Bug 361823 - [Restructuring] eFacet2 meta-model + */ +package org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.serialization; + +import org.eclipse.emf.common.util.EList; + +/** + * <!-- begin-user-doc --> + * A representation of the model object '<em><b>Multi Valued Attribute Instance</b></em>'. + * <!-- end-user-doc --> + * + * <p> + * The following features are supported: + * <ul> + * <li>{@link org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.serialization.MultiValuedAttributeInstance#getValues <em>Values</em>}</li> + * </ul> + * </p> + * + * @see org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.serialization.SerializationPackage#getMultiValuedAttributeInstance() + * @model + * @generated + */ +public interface MultiValuedAttributeInstance extends AbstractAttributeInstance { + /** + * Returns the value of the '<em><b>Values</b></em>' attribute list. + * The list contents are of type {@link java.lang.Object}. + * <!-- begin-user-doc --> + * <p> + * If the meaning of the '<em>Values</em>' attribute list isn't clear, + * there really should be more of a description here... + * </p> + * <!-- end-user-doc --> + * @return the value of the '<em>Values</em>' attribute list. + * @see org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.serialization.SerializationPackage#getMultiValuedAttributeInstance_Values() + * @model + * @generated + */ + EList<Object> getValues(); + +} // MultiValuedAttributeInstance
diff --git a/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/modisco/facet/efacet/metamodel/v0_2_0/efacet/serialization/MultiValuedContainmentReferenceInstance.java b/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/modisco/facet/efacet/metamodel/v0_2_0/efacet/serialization/MultiValuedContainmentReferenceInstance.java new file mode 100644 index 0000000..24ea35a --- /dev/null +++ b/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/modisco/facet/efacet/metamodel/v0_2_0/efacet/serialization/MultiValuedContainmentReferenceInstance.java
@@ -0,0 +1,53 @@ +/** + * Copyright (c) 2011 Mia-Software. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Gregoire Dupe (Mia-Software) - Design + * Nicolas Guyomar (Mia-Software) - Implementation + * Emmanuelle Rouillé (Mia-Software) - Bug 352618 - To be able to use non derived facet structural features and save them values. + * Nicolas Bros (Mia-Software) - Bug 361823 - [Restructuring] eFacet2 meta-model + */ +package org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.serialization; + +import org.eclipse.emf.common.util.EList; +import org.eclipse.emf.ecore.EObject; + +/** + * <!-- begin-user-doc --> + * A representation of the model object '<em><b>Multi Valued Containment Reference Instance</b></em>'. + * <!-- end-user-doc --> + * + * <p> + * The following features are supported: + * <ul> + * <li>{@link org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.serialization.MultiValuedContainmentReferenceInstance#getOwnedElements <em>Owned Elements</em>}</li> + * </ul> + * </p> + * + * @see org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.serialization.SerializationPackage#getMultiValuedContainmentReferenceInstance() + * @model + * @generated + */ +public interface MultiValuedContainmentReferenceInstance extends AbstractReferenceInstance { + /** + * Returns the value of the '<em><b>Owned Elements</b></em>' containment reference list. + * The list contents are of type {@link org.eclipse.emf.ecore.EObject}. + * <!-- begin-user-doc --> + * <p> + * If the meaning of the '<em>Owned Elements</em>' containment reference list isn't clear, + * there really should be more of a description here... + * </p> + * <!-- end-user-doc --> + * @return the value of the '<em>Owned Elements</em>' containment reference list. + * @see org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.serialization.SerializationPackage#getMultiValuedContainmentReferenceInstance_OwnedElements() + * @model containment="true" + * @generated + */ + EList<EObject> getOwnedElements(); + +} // MultiValuedContainmentReferenceInstance
diff --git a/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/modisco/facet/efacet/metamodel/v0_2_0/efacet/serialization/MultiValuedReferenceInstance.java b/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/modisco/facet/efacet/metamodel/v0_2_0/efacet/serialization/MultiValuedReferenceInstance.java new file mode 100644 index 0000000..a2773bd --- /dev/null +++ b/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/modisco/facet/efacet/metamodel/v0_2_0/efacet/serialization/MultiValuedReferenceInstance.java
@@ -0,0 +1,53 @@ +/** + * Copyright (c) 2011 Mia-Software. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Gregoire Dupe (Mia-Software) - Design + * Nicolas Guyomar (Mia-Software) - Implementation + * Emmanuelle Rouillé (Mia-Software) - Bug 352618 - To be able to use non derived facet structural features and save them values. + * Nicolas Bros (Mia-Software) - Bug 361823 - [Restructuring] eFacet2 meta-model + */ +package org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.serialization; + +import org.eclipse.emf.common.util.EList; +import org.eclipse.emf.ecore.EObject; + +/** + * <!-- begin-user-doc --> + * A representation of the model object '<em><b>Multi Valued Reference Instance</b></em>'. + * <!-- end-user-doc --> + * + * <p> + * The following features are supported: + * <ul> + * <li>{@link org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.serialization.MultiValuedReferenceInstance#getReferencedElements <em>Referenced Elements</em>}</li> + * </ul> + * </p> + * + * @see org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.serialization.SerializationPackage#getMultiValuedReferenceInstance() + * @model + * @generated + */ +public interface MultiValuedReferenceInstance extends AbstractReferenceInstance { + /** + * Returns the value of the '<em><b>Referenced Elements</b></em>' reference list. + * The list contents are of type {@link org.eclipse.emf.ecore.EObject}. + * <!-- begin-user-doc --> + * <p> + * If the meaning of the '<em>Referenced Elements</em>' reference list isn't clear, + * there really should be more of a description here... + * </p> + * <!-- end-user-doc --> + * @return the value of the '<em>Referenced Elements</em>' reference list. + * @see org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.serialization.SerializationPackage#getMultiValuedReferenceInstance_ReferencedElements() + * @model + * @generated + */ + EList<EObject> getReferencedElements(); + +} // MultiValuedReferenceInstance
diff --git a/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/modisco/facet/efacet/metamodel/v0_2_0/efacet/serialization/SerializationFactory.java b/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/modisco/facet/efacet/metamodel/v0_2_0/efacet/serialization/SerializationFactory.java new file mode 100644 index 0000000..00555ce --- /dev/null +++ b/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/modisco/facet/efacet/metamodel/v0_2_0/efacet/serialization/SerializationFactory.java
@@ -0,0 +1,127 @@ +/** + * Copyright (c) 2011 Mia-Software. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Gregoire Dupe (Mia-Software) - Design + * Nicolas Guyomar (Mia-Software) - Implementation + * Emmanuelle Rouillé (Mia-Software) - Bug 352618 - To be able to use non derived facet structural features and save them values. + * Nicolas Bros (Mia-Software) - Bug 361823 - [Restructuring] eFacet2 meta-model + * Gregoire Dupe (Mia-Software) - Bug 373078 - API Cleaning + */ +package org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.serialization; + +import org.eclipse.emf.ecore.EFactory; + +/** + * <!-- begin-user-doc --> + * The <b>Factory</b> for the model. + * It provides a create method for each non-abstract class of the model. + * <!-- end-user-doc --> + * @see org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.serialization.SerializationPackage + * @generated + */ +public interface SerializationFactory extends EFactory { + /** + * The singleton instance of the factory. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + SerializationFactory eINSTANCE = org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.serialization.impl.SerializationFactoryImpl.init(); + + /** + * Returns a new object of class '<em>Abstract Reference Instance</em>'. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @return a new object of class '<em>Abstract Reference Instance</em>'. + * @generated + */ + AbstractReferenceInstance createAbstractReferenceInstance(); + + /** + * Returns a new object of class '<em>Multi Valued Containment Reference Instance</em>'. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @return a new object of class '<em>Multi Valued Containment Reference Instance</em>'. + * @generated + */ + MultiValuedContainmentReferenceInstance createMultiValuedContainmentReferenceInstance(); + + /** + * Returns a new object of class '<em>Multi Valued Reference Instance</em>'. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @return a new object of class '<em>Multi Valued Reference Instance</em>'. + * @generated + */ + MultiValuedReferenceInstance createMultiValuedReferenceInstance(); + + /** + * Returns a new object of class '<em>Single Valued Attribute Instance</em>'. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @return a new object of class '<em>Single Valued Attribute Instance</em>'. + * @generated + */ + SingleValuedAttributeInstance createSingleValuedAttributeInstance(); + + /** + * Returns a new object of class '<em>Extended EObject Reference</em>'. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @return a new object of class '<em>Extended EObject Reference</em>'. + * @generated + */ + ExtendedEObjectReference createExtendedEObjectReference(); + + /** + * Returns a new object of class '<em>Single Valued Containment Reference Instance</em>'. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @return a new object of class '<em>Single Valued Containment Reference Instance</em>'. + * @generated + */ + SingleValuedContainmentReferenceInstance createSingleValuedContainmentReferenceInstance(); + + /** + * Returns a new object of class '<em>Single Valued Reference Instance</em>'. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @return a new object of class '<em>Single Valued Reference Instance</em>'. + * @generated + */ + SingleValuedReferenceInstance createSingleValuedReferenceInstance(); + + /** + * Returns a new object of class '<em>Multi Valued Attribute Instance</em>'. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @return a new object of class '<em>Multi Valued Attribute Instance</em>'. + * @generated + */ + MultiValuedAttributeInstance createMultiValuedAttributeInstance(); + + /** + * Returns a new object of class '<em>Abstract Attribute Instance</em>'. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @return a new object of class '<em>Abstract Attribute Instance</em>'. + * @generated + */ + AbstractAttributeInstance createAbstractAttributeInstance(); + + /** + * Returns the package supported by this factory. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @return the package supported by this factory. + * @generated + */ + SerializationPackage getSerializationPackage(); + +} //SerializationFactory
diff --git a/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/modisco/facet/efacet/metamodel/v0_2_0/efacet/serialization/SerializationPackage.java b/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/modisco/facet/efacet/metamodel/v0_2_0/efacet/serialization/SerializationPackage.java new file mode 100644 index 0000000..eb4d6db --- /dev/null +++ b/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/modisco/facet/efacet/metamodel/v0_2_0/efacet/serialization/SerializationPackage.java
@@ -0,0 +1,809 @@ +/** + * Copyright (c) 2011 Mia-Software. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Gregoire Dupe (Mia-Software) - Design + * Nicolas Guyomar (Mia-Software) - Implementation + * Emmanuelle Rouillé (Mia-Software) - Bug 352618 - To be able to use non derived facet structural features and save them values. + * Nicolas Bros (Mia-Software) - Bug 361823 - [Restructuring] eFacet2 meta-model + * Gregoire Dupe (Mia-Software) - Bug 373078 - API Cleaning + */ +package org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.serialization; + +import org.eclipse.emf.ecore.EAttribute; +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.EPackage; +import org.eclipse.emf.ecore.EReference; + +/** + * <!-- begin-user-doc --> + * The <b>Package</b> for the model. + * It contains accessors for the meta objects to represent + * <ul> + * <li>each class,</li> + * <li>each feature of each class,</li> + * <li>each enum,</li> + * <li>and each data type</li> + * </ul> + * <!-- end-user-doc --> + * @see org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.serialization.SerializationFactory + * @model kind="package" + * @generated + */ +public interface SerializationPackage extends EPackage { + /** + * The package name. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + String eNAME = "serialization"; //$NON-NLS-1$ + + /** + * The package namespace URI. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + String eNS_URI = "http://www.eclipse.org/emf/facet/efacet/0.2.incubation/efacet/serialization"; //$NON-NLS-1$ + + /** + * The package namespace name. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + String eNS_PREFIX = "serialization"; //$NON-NLS-1$ + + /** + * The singleton instance of the package. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + SerializationPackage eINSTANCE = org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.serialization.impl.SerializationPackageImpl.init(); + + /** + * The meta object id for the '{@link org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.serialization.impl.AbstractReferenceInstanceImpl <em>Abstract Reference Instance</em>}' class. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @see org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.serialization.impl.AbstractReferenceInstanceImpl + * @see org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.serialization.impl.SerializationPackageImpl#getAbstractReferenceInstance() + * @generated + */ + int ABSTRACT_REFERENCE_INSTANCE = 0; + + /** + * The feature id for the '<em><b>EReference</b></em>' reference. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + */ + int ABSTRACT_REFERENCE_INSTANCE__EREFERENCE = 0; + + /** + * The number of structural features of the '<em>Abstract Reference Instance</em>' class. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + */ + int ABSTRACT_REFERENCE_INSTANCE_FEATURE_COUNT = 1; + + /** + * The meta object id for the '{@link org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.serialization.impl.MultiValuedContainmentReferenceInstanceImpl <em>Multi Valued Containment Reference Instance</em>}' class. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @see org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.serialization.impl.MultiValuedContainmentReferenceInstanceImpl + * @see org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.serialization.impl.SerializationPackageImpl#getMultiValuedContainmentReferenceInstance() + * @generated + */ + int MULTI_VALUED_CONTAINMENT_REFERENCE_INSTANCE = 1; + + /** + * The feature id for the '<em><b>EReference</b></em>' reference. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + */ + int MULTI_VALUED_CONTAINMENT_REFERENCE_INSTANCE__EREFERENCE = ABSTRACT_REFERENCE_INSTANCE__EREFERENCE; + + /** + * The feature id for the '<em><b>Owned Elements</b></em>' containment reference list. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + */ + int MULTI_VALUED_CONTAINMENT_REFERENCE_INSTANCE__OWNED_ELEMENTS = ABSTRACT_REFERENCE_INSTANCE_FEATURE_COUNT + 0; + + /** + * The number of structural features of the '<em>Multi Valued Containment Reference Instance</em>' class. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + */ + int MULTI_VALUED_CONTAINMENT_REFERENCE_INSTANCE_FEATURE_COUNT = ABSTRACT_REFERENCE_INSTANCE_FEATURE_COUNT + 1; + + /** + * The meta object id for the '{@link org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.serialization.impl.MultiValuedReferenceInstanceImpl <em>Multi Valued Reference Instance</em>}' class. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @see org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.serialization.impl.MultiValuedReferenceInstanceImpl + * @see org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.serialization.impl.SerializationPackageImpl#getMultiValuedReferenceInstance() + * @generated + */ + int MULTI_VALUED_REFERENCE_INSTANCE = 2; + + /** + * The feature id for the '<em><b>EReference</b></em>' reference. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + */ + int MULTI_VALUED_REFERENCE_INSTANCE__EREFERENCE = ABSTRACT_REFERENCE_INSTANCE__EREFERENCE; + + /** + * The feature id for the '<em><b>Referenced Elements</b></em>' reference list. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + */ + int MULTI_VALUED_REFERENCE_INSTANCE__REFERENCED_ELEMENTS = ABSTRACT_REFERENCE_INSTANCE_FEATURE_COUNT + 0; + + /** + * The number of structural features of the '<em>Multi Valued Reference Instance</em>' class. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + */ + int MULTI_VALUED_REFERENCE_INSTANCE_FEATURE_COUNT = ABSTRACT_REFERENCE_INSTANCE_FEATURE_COUNT + 1; + + /** + * The meta object id for the '{@link org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.serialization.impl.AbstractAttributeInstanceImpl <em>Abstract Attribute Instance</em>}' class. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @see org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.serialization.impl.AbstractAttributeInstanceImpl + * @see org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.serialization.impl.SerializationPackageImpl#getAbstractAttributeInstance() + * @generated + */ + int ABSTRACT_ATTRIBUTE_INSTANCE = 8; + + /** + * The feature id for the '<em><b>EAttribute</b></em>' reference. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + */ + int ABSTRACT_ATTRIBUTE_INSTANCE__EATTRIBUTE = 0; + + /** + * The number of structural features of the '<em>Abstract Attribute Instance</em>' class. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + */ + int ABSTRACT_ATTRIBUTE_INSTANCE_FEATURE_COUNT = 1; + + /** + * The meta object id for the '{@link org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.serialization.impl.SingleValuedAttributeInstanceImpl <em>Single Valued Attribute Instance</em>}' class. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @see org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.serialization.impl.SingleValuedAttributeInstanceImpl + * @see org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.serialization.impl.SerializationPackageImpl#getSingleValuedAttributeInstance() + * @generated + */ + int SINGLE_VALUED_ATTRIBUTE_INSTANCE = 3; + + /** + * The feature id for the '<em><b>EAttribute</b></em>' reference. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + */ + int SINGLE_VALUED_ATTRIBUTE_INSTANCE__EATTRIBUTE = ABSTRACT_ATTRIBUTE_INSTANCE__EATTRIBUTE; + + /** + * The feature id for the '<em><b>Value</b></em>' attribute. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + */ + int SINGLE_VALUED_ATTRIBUTE_INSTANCE__VALUE = ABSTRACT_ATTRIBUTE_INSTANCE_FEATURE_COUNT + 0; + + /** + * The number of structural features of the '<em>Single Valued Attribute Instance</em>' class. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + */ + int SINGLE_VALUED_ATTRIBUTE_INSTANCE_FEATURE_COUNT = ABSTRACT_ATTRIBUTE_INSTANCE_FEATURE_COUNT + 1; + + /** + * The meta object id for the '{@link org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.serialization.impl.ExtendedEObjectReferenceImpl <em>Extended EObject Reference</em>}' class. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @see org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.serialization.impl.ExtendedEObjectReferenceImpl + * @see org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.serialization.impl.SerializationPackageImpl#getExtendedEObjectReference() + * @generated + */ + int EXTENDED_EOBJECT_REFERENCE = 4; + + /** + * The feature id for the '<em><b>Extended EObject</b></em>' reference. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + */ + int EXTENDED_EOBJECT_REFERENCE__EXTENDED_EOBJECT = 0; + + /** + * The feature id for the '<em><b>Attribute Instances</b></em>' containment reference list. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + */ + int EXTENDED_EOBJECT_REFERENCE__ATTRIBUTE_INSTANCES = 1; + + /** + * The feature id for the '<em><b>Reference Instances</b></em>' containment reference list. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + */ + int EXTENDED_EOBJECT_REFERENCE__REFERENCE_INSTANCES = 2; + + /** + * The number of structural features of the '<em>Extended EObject Reference</em>' class. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + */ + int EXTENDED_EOBJECT_REFERENCE_FEATURE_COUNT = 3; + + /** + * The meta object id for the '{@link org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.serialization.impl.SingleValuedContainmentReferenceInstanceImpl <em>Single Valued Containment Reference Instance</em>}' class. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @see org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.serialization.impl.SingleValuedContainmentReferenceInstanceImpl + * @see org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.serialization.impl.SerializationPackageImpl#getSingleValuedContainmentReferenceInstance() + * @generated + */ + int SINGLE_VALUED_CONTAINMENT_REFERENCE_INSTANCE = 5; + + /** + * The feature id for the '<em><b>EReference</b></em>' reference. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + */ + int SINGLE_VALUED_CONTAINMENT_REFERENCE_INSTANCE__EREFERENCE = ABSTRACT_REFERENCE_INSTANCE__EREFERENCE; + + /** + * The feature id for the '<em><b>Owned Element</b></em>' containment reference. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + */ + int SINGLE_VALUED_CONTAINMENT_REFERENCE_INSTANCE__OWNED_ELEMENT = ABSTRACT_REFERENCE_INSTANCE_FEATURE_COUNT + 0; + + /** + * The number of structural features of the '<em>Single Valued Containment Reference Instance</em>' class. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + */ + int SINGLE_VALUED_CONTAINMENT_REFERENCE_INSTANCE_FEATURE_COUNT = ABSTRACT_REFERENCE_INSTANCE_FEATURE_COUNT + 1; + + /** + * The meta object id for the '{@link org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.serialization.impl.SingleValuedReferenceInstanceImpl <em>Single Valued Reference Instance</em>}' class. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @see org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.serialization.impl.SingleValuedReferenceInstanceImpl + * @see org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.serialization.impl.SerializationPackageImpl#getSingleValuedReferenceInstance() + * @generated + */ + int SINGLE_VALUED_REFERENCE_INSTANCE = 6; + + /** + * The feature id for the '<em><b>EReference</b></em>' reference. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + */ + int SINGLE_VALUED_REFERENCE_INSTANCE__EREFERENCE = ABSTRACT_REFERENCE_INSTANCE__EREFERENCE; + + /** + * The feature id for the '<em><b>Referenced Element</b></em>' reference. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + */ + int SINGLE_VALUED_REFERENCE_INSTANCE__REFERENCED_ELEMENT = ABSTRACT_REFERENCE_INSTANCE_FEATURE_COUNT + 0; + + /** + * The number of structural features of the '<em>Single Valued Reference Instance</em>' class. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + */ + int SINGLE_VALUED_REFERENCE_INSTANCE_FEATURE_COUNT = ABSTRACT_REFERENCE_INSTANCE_FEATURE_COUNT + 1; + + /** + * The meta object id for the '{@link org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.serialization.impl.MultiValuedAttributeInstanceImpl <em>Multi Valued Attribute Instance</em>}' class. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @see org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.serialization.impl.MultiValuedAttributeInstanceImpl + * @see org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.serialization.impl.SerializationPackageImpl#getMultiValuedAttributeInstance() + * @generated + */ + int MULTI_VALUED_ATTRIBUTE_INSTANCE = 7; + + /** + * The feature id for the '<em><b>EAttribute</b></em>' reference. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + */ + int MULTI_VALUED_ATTRIBUTE_INSTANCE__EATTRIBUTE = ABSTRACT_ATTRIBUTE_INSTANCE__EATTRIBUTE; + + /** + * The feature id for the '<em><b>Values</b></em>' attribute list. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + */ + int MULTI_VALUED_ATTRIBUTE_INSTANCE__VALUES = ABSTRACT_ATTRIBUTE_INSTANCE_FEATURE_COUNT + 0; + + /** + * The number of structural features of the '<em>Multi Valued Attribute Instance</em>' class. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + */ + int MULTI_VALUED_ATTRIBUTE_INSTANCE_FEATURE_COUNT = ABSTRACT_ATTRIBUTE_INSTANCE_FEATURE_COUNT + 1; + + + /** + * Returns the meta object for class '{@link org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.serialization.AbstractReferenceInstance <em>Abstract Reference Instance</em>}'. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @return the meta object for class '<em>Abstract Reference Instance</em>'. + * @see org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.serialization.AbstractReferenceInstance + * @generated + */ + EClass getAbstractReferenceInstance(); + + /** + * Returns the meta object for the reference '{@link org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.serialization.AbstractReferenceInstance#getEReference <em>EReference</em>}'. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @return the meta object for the reference '<em>EReference</em>'. + * @see org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.serialization.AbstractReferenceInstance#getEReference() + * @see #getAbstractReferenceInstance() + * @generated + */ + EReference getAbstractReferenceInstance_EReference(); + + /** + * Returns the meta object for class '{@link org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.serialization.MultiValuedContainmentReferenceInstance <em>Multi Valued Containment Reference Instance</em>}'. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @return the meta object for class '<em>Multi Valued Containment Reference Instance</em>'. + * @see org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.serialization.MultiValuedContainmentReferenceInstance + * @generated + */ + EClass getMultiValuedContainmentReferenceInstance(); + + /** + * Returns the meta object for the containment reference list '{@link org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.serialization.MultiValuedContainmentReferenceInstance#getOwnedElements <em>Owned Elements</em>}'. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @return the meta object for the containment reference list '<em>Owned Elements</em>'. + * @see org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.serialization.MultiValuedContainmentReferenceInstance#getOwnedElements() + * @see #getMultiValuedContainmentReferenceInstance() + * @generated + */ + EReference getMultiValuedContainmentReferenceInstance_OwnedElements(); + + /** + * Returns the meta object for class '{@link org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.serialization.MultiValuedReferenceInstance <em>Multi Valued Reference Instance</em>}'. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @return the meta object for class '<em>Multi Valued Reference Instance</em>'. + * @see org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.serialization.MultiValuedReferenceInstance + * @generated + */ + EClass getMultiValuedReferenceInstance(); + + /** + * Returns the meta object for the reference list '{@link org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.serialization.MultiValuedReferenceInstance#getReferencedElements <em>Referenced Elements</em>}'. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @return the meta object for the reference list '<em>Referenced Elements</em>'. + * @see org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.serialization.MultiValuedReferenceInstance#getReferencedElements() + * @see #getMultiValuedReferenceInstance() + * @generated + */ + EReference getMultiValuedReferenceInstance_ReferencedElements(); + + /** + * Returns the meta object for class '{@link org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.serialization.SingleValuedAttributeInstance <em>Single Valued Attribute Instance</em>}'. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @return the meta object for class '<em>Single Valued Attribute Instance</em>'. + * @see org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.serialization.SingleValuedAttributeInstance + * @generated + */ + EClass getSingleValuedAttributeInstance(); + + /** + * Returns the meta object for the attribute '{@link org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.serialization.SingleValuedAttributeInstance#getValue <em>Value</em>}'. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @return the meta object for the attribute '<em>Value</em>'. + * @see org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.serialization.SingleValuedAttributeInstance#getValue() + * @see #getSingleValuedAttributeInstance() + * @generated + */ + EAttribute getSingleValuedAttributeInstance_Value(); + + /** + * Returns the meta object for class '{@link org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.serialization.ExtendedEObjectReference <em>Extended EObject Reference</em>}'. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @return the meta object for class '<em>Extended EObject Reference</em>'. + * @see org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.serialization.ExtendedEObjectReference + * @generated + */ + EClass getExtendedEObjectReference(); + + /** + * Returns the meta object for the reference '{@link org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.serialization.ExtendedEObjectReference#getExtendedEObject <em>Extended EObject</em>}'. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @return the meta object for the reference '<em>Extended EObject</em>'. + * @see org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.serialization.ExtendedEObjectReference#getExtendedEObject() + * @see #getExtendedEObjectReference() + * @generated + */ + EReference getExtendedEObjectReference_ExtendedEObject(); + + /** + * Returns the meta object for the containment reference list '{@link org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.serialization.ExtendedEObjectReference#getAttributeInstances <em>Attribute Instances</em>}'. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @return the meta object for the containment reference list '<em>Attribute Instances</em>'. + * @see org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.serialization.ExtendedEObjectReference#getAttributeInstances() + * @see #getExtendedEObjectReference() + * @generated + */ + EReference getExtendedEObjectReference_AttributeInstances(); + + /** + * Returns the meta object for the containment reference list '{@link org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.serialization.ExtendedEObjectReference#getReferenceInstances <em>Reference Instances</em>}'. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @return the meta object for the containment reference list '<em>Reference Instances</em>'. + * @see org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.serialization.ExtendedEObjectReference#getReferenceInstances() + * @see #getExtendedEObjectReference() + * @generated + */ + EReference getExtendedEObjectReference_ReferenceInstances(); + + /** + * Returns the meta object for class '{@link org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.serialization.SingleValuedContainmentReferenceInstance <em>Single Valued Containment Reference Instance</em>}'. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @return the meta object for class '<em>Single Valued Containment Reference Instance</em>'. + * @see org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.serialization.SingleValuedContainmentReferenceInstance + * @generated + */ + EClass getSingleValuedContainmentReferenceInstance(); + + /** + * Returns the meta object for the containment reference '{@link org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.serialization.SingleValuedContainmentReferenceInstance#getOwnedElement <em>Owned Element</em>}'. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @return the meta object for the containment reference '<em>Owned Element</em>'. + * @see org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.serialization.SingleValuedContainmentReferenceInstance#getOwnedElement() + * @see #getSingleValuedContainmentReferenceInstance() + * @generated + */ + EReference getSingleValuedContainmentReferenceInstance_OwnedElement(); + + /** + * Returns the meta object for class '{@link org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.serialization.SingleValuedReferenceInstance <em>Single Valued Reference Instance</em>}'. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @return the meta object for class '<em>Single Valued Reference Instance</em>'. + * @see org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.serialization.SingleValuedReferenceInstance + * @generated + */ + EClass getSingleValuedReferenceInstance(); + + /** + * Returns the meta object for the reference '{@link org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.serialization.SingleValuedReferenceInstance#getReferencedElement <em>Referenced Element</em>}'. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @return the meta object for the reference '<em>Referenced Element</em>'. + * @see org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.serialization.SingleValuedReferenceInstance#getReferencedElement() + * @see #getSingleValuedReferenceInstance() + * @generated + */ + EReference getSingleValuedReferenceInstance_ReferencedElement(); + + /** + * Returns the meta object for class '{@link org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.serialization.MultiValuedAttributeInstance <em>Multi Valued Attribute Instance</em>}'. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @return the meta object for class '<em>Multi Valued Attribute Instance</em>'. + * @see org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.serialization.MultiValuedAttributeInstance + * @generated + */ + EClass getMultiValuedAttributeInstance(); + + /** + * Returns the meta object for the attribute list '{@link org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.serialization.MultiValuedAttributeInstance#getValues <em>Values</em>}'. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @return the meta object for the attribute list '<em>Values</em>'. + * @see org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.serialization.MultiValuedAttributeInstance#getValues() + * @see #getMultiValuedAttributeInstance() + * @generated + */ + EAttribute getMultiValuedAttributeInstance_Values(); + + /** + * Returns the meta object for class '{@link org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.serialization.AbstractAttributeInstance <em>Abstract Attribute Instance</em>}'. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @return the meta object for class '<em>Abstract Attribute Instance</em>'. + * @see org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.serialization.AbstractAttributeInstance + * @generated + */ + EClass getAbstractAttributeInstance(); + + /** + * Returns the meta object for the reference '{@link org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.serialization.AbstractAttributeInstance#getEAttribute <em>EAttribute</em>}'. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @return the meta object for the reference '<em>EAttribute</em>'. + * @see org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.serialization.AbstractAttributeInstance#getEAttribute() + * @see #getAbstractAttributeInstance() + * @generated + */ + EReference getAbstractAttributeInstance_EAttribute(); + + /** + * Returns the factory that creates the instances of the model. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @return the factory that creates the instances of the model. + * @generated + */ + SerializationFactory getSerializationFactory(); + + /** + * <!-- begin-user-doc --> + * Defines literals for the meta objects that represent + * <ul> + * <li>each class,</li> + * <li>each feature of each class,</li> + * <li>each enum,</li> + * <li>and each data type</li> + * </ul> + * <!-- end-user-doc --> + * @generated + */ + interface Literals { + /** + * The meta object literal for the '{@link org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.serialization.impl.AbstractReferenceInstanceImpl <em>Abstract Reference Instance</em>}' class. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @see org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.serialization.impl.AbstractReferenceInstanceImpl + * @see org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.serialization.impl.SerializationPackageImpl#getAbstractReferenceInstance() + * @generated + */ + EClass ABSTRACT_REFERENCE_INSTANCE = eINSTANCE.getAbstractReferenceInstance(); + + /** + * The meta object literal for the '<em><b>EReference</b></em>' reference feature. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + EReference ABSTRACT_REFERENCE_INSTANCE__EREFERENCE = eINSTANCE.getAbstractReferenceInstance_EReference(); + + /** + * The meta object literal for the '{@link org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.serialization.impl.MultiValuedContainmentReferenceInstanceImpl <em>Multi Valued Containment Reference Instance</em>}' class. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @see org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.serialization.impl.MultiValuedContainmentReferenceInstanceImpl + * @see org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.serialization.impl.SerializationPackageImpl#getMultiValuedContainmentReferenceInstance() + * @generated + */ + EClass MULTI_VALUED_CONTAINMENT_REFERENCE_INSTANCE = eINSTANCE.getMultiValuedContainmentReferenceInstance(); + + /** + * The meta object literal for the '<em><b>Owned Elements</b></em>' containment reference list feature. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + EReference MULTI_VALUED_CONTAINMENT_REFERENCE_INSTANCE__OWNED_ELEMENTS = eINSTANCE.getMultiValuedContainmentReferenceInstance_OwnedElements(); + + /** + * The meta object literal for the '{@link org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.serialization.impl.MultiValuedReferenceInstanceImpl <em>Multi Valued Reference Instance</em>}' class. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @see org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.serialization.impl.MultiValuedReferenceInstanceImpl + * @see org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.serialization.impl.SerializationPackageImpl#getMultiValuedReferenceInstance() + * @generated + */ + EClass MULTI_VALUED_REFERENCE_INSTANCE = eINSTANCE.getMultiValuedReferenceInstance(); + + /** + * The meta object literal for the '<em><b>Referenced Elements</b></em>' reference list feature. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + EReference MULTI_VALUED_REFERENCE_INSTANCE__REFERENCED_ELEMENTS = eINSTANCE.getMultiValuedReferenceInstance_ReferencedElements(); + + /** + * The meta object literal for the '{@link org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.serialization.impl.SingleValuedAttributeInstanceImpl <em>Single Valued Attribute Instance</em>}' class. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @see org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.serialization.impl.SingleValuedAttributeInstanceImpl + * @see org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.serialization.impl.SerializationPackageImpl#getSingleValuedAttributeInstance() + * @generated + */ + EClass SINGLE_VALUED_ATTRIBUTE_INSTANCE = eINSTANCE.getSingleValuedAttributeInstance(); + + /** + * The meta object literal for the '<em><b>Value</b></em>' attribute feature. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + EAttribute SINGLE_VALUED_ATTRIBUTE_INSTANCE__VALUE = eINSTANCE.getSingleValuedAttributeInstance_Value(); + + /** + * The meta object literal for the '{@link org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.serialization.impl.ExtendedEObjectReferenceImpl <em>Extended EObject Reference</em>}' class. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @see org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.serialization.impl.ExtendedEObjectReferenceImpl + * @see org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.serialization.impl.SerializationPackageImpl#getExtendedEObjectReference() + * @generated + */ + EClass EXTENDED_EOBJECT_REFERENCE = eINSTANCE.getExtendedEObjectReference(); + + /** + * The meta object literal for the '<em><b>Extended EObject</b></em>' reference feature. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + EReference EXTENDED_EOBJECT_REFERENCE__EXTENDED_EOBJECT = eINSTANCE.getExtendedEObjectReference_ExtendedEObject(); + + /** + * The meta object literal for the '<em><b>Attribute Instances</b></em>' containment reference list feature. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + EReference EXTENDED_EOBJECT_REFERENCE__ATTRIBUTE_INSTANCES = eINSTANCE.getExtendedEObjectReference_AttributeInstances(); + + /** + * The meta object literal for the '<em><b>Reference Instances</b></em>' containment reference list feature. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + EReference EXTENDED_EOBJECT_REFERENCE__REFERENCE_INSTANCES = eINSTANCE.getExtendedEObjectReference_ReferenceInstances(); + + /** + * The meta object literal for the '{@link org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.serialization.impl.SingleValuedContainmentReferenceInstanceImpl <em>Single Valued Containment Reference Instance</em>}' class. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @see org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.serialization.impl.SingleValuedContainmentReferenceInstanceImpl + * @see org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.serialization.impl.SerializationPackageImpl#getSingleValuedContainmentReferenceInstance() + * @generated + */ + EClass SINGLE_VALUED_CONTAINMENT_REFERENCE_INSTANCE = eINSTANCE.getSingleValuedContainmentReferenceInstance(); + + /** + * The meta object literal for the '<em><b>Owned Element</b></em>' containment reference feature. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + EReference SINGLE_VALUED_CONTAINMENT_REFERENCE_INSTANCE__OWNED_ELEMENT = eINSTANCE.getSingleValuedContainmentReferenceInstance_OwnedElement(); + + /** + * The meta object literal for the '{@link org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.serialization.impl.SingleValuedReferenceInstanceImpl <em>Single Valued Reference Instance</em>}' class. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @see org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.serialization.impl.SingleValuedReferenceInstanceImpl + * @see org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.serialization.impl.SerializationPackageImpl#getSingleValuedReferenceInstance() + * @generated + */ + EClass SINGLE_VALUED_REFERENCE_INSTANCE = eINSTANCE.getSingleValuedReferenceInstance(); + + /** + * The meta object literal for the '<em><b>Referenced Element</b></em>' reference feature. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + EReference SINGLE_VALUED_REFERENCE_INSTANCE__REFERENCED_ELEMENT = eINSTANCE.getSingleValuedReferenceInstance_ReferencedElement(); + + /** + * The meta object literal for the '{@link org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.serialization.impl.MultiValuedAttributeInstanceImpl <em>Multi Valued Attribute Instance</em>}' class. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @see org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.serialization.impl.MultiValuedAttributeInstanceImpl + * @see org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.serialization.impl.SerializationPackageImpl#getMultiValuedAttributeInstance() + * @generated + */ + EClass MULTI_VALUED_ATTRIBUTE_INSTANCE = eINSTANCE.getMultiValuedAttributeInstance(); + + /** + * The meta object literal for the '<em><b>Values</b></em>' attribute list feature. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + EAttribute MULTI_VALUED_ATTRIBUTE_INSTANCE__VALUES = eINSTANCE.getMultiValuedAttributeInstance_Values(); + + /** + * The meta object literal for the '{@link org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.serialization.impl.AbstractAttributeInstanceImpl <em>Abstract Attribute Instance</em>}' class. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @see org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.serialization.impl.AbstractAttributeInstanceImpl + * @see org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.serialization.impl.SerializationPackageImpl#getAbstractAttributeInstance() + * @generated + */ + EClass ABSTRACT_ATTRIBUTE_INSTANCE = eINSTANCE.getAbstractAttributeInstance(); + + /** + * The meta object literal for the '<em><b>EAttribute</b></em>' reference feature. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + EReference ABSTRACT_ATTRIBUTE_INSTANCE__EATTRIBUTE = eINSTANCE.getAbstractAttributeInstance_EAttribute(); + + } + +} //SerializationPackage
diff --git a/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/modisco/facet/efacet/metamodel/v0_2_0/efacet/serialization/SingleValuedAttributeInstance.java b/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/modisco/facet/efacet/metamodel/v0_2_0/efacet/serialization/SingleValuedAttributeInstance.java new file mode 100644 index 0000000..192b101 --- /dev/null +++ b/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/modisco/facet/efacet/metamodel/v0_2_0/efacet/serialization/SingleValuedAttributeInstance.java
@@ -0,0 +1,61 @@ +/** + * Copyright (c) 2011 Mia-Software. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Gregoire Dupe (Mia-Software) - Design + * Nicolas Guyomar (Mia-Software) - Implementation + * Emmanuelle Rouillé (Mia-Software) - Bug 352618 - To be able to use non derived facet structural features and save them values. + * Nicolas Bros (Mia-Software) - Bug 361823 - [Restructuring] eFacet2 meta-model + */ +package org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.serialization; + + +/** + * <!-- begin-user-doc --> + * A representation of the model object '<em><b>Single Valued Attribute Instance</b></em>'. + * <!-- end-user-doc --> + * + * <p> + * The following features are supported: + * <ul> + * <li>{@link org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.serialization.SingleValuedAttributeInstance#getValue <em>Value</em>}</li> + * </ul> + * </p> + * + * @see org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.serialization.SerializationPackage#getSingleValuedAttributeInstance() + * @model + * @generated + */ +public interface SingleValuedAttributeInstance extends AbstractAttributeInstance { + /** + * Returns the value of the '<em><b>Value</b></em>' attribute. + * <!-- begin-user-doc --> + * <p> + * If the meaning of the '<em>Value</em>' attribute isn't clear, + * there really should be more of a description here... + * </p> + * <!-- end-user-doc --> + * @return the value of the '<em>Value</em>' attribute. + * @see #setValue(Object) + * @see org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.serialization.SerializationPackage#getSingleValuedAttributeInstance_Value() + * @model + * @generated + */ + Object getValue(); + + /** + * Sets the value of the '{@link org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.serialization.SingleValuedAttributeInstance#getValue <em>Value</em>}' attribute. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @param value the new value of the '<em>Value</em>' attribute. + * @see #getValue() + * @generated + */ + void setValue(Object value); + +} // SingleValuedAttributeInstance
diff --git a/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/modisco/facet/efacet/metamodel/v0_2_0/efacet/serialization/SingleValuedContainmentReferenceInstance.java b/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/modisco/facet/efacet/metamodel/v0_2_0/efacet/serialization/SingleValuedContainmentReferenceInstance.java new file mode 100644 index 0000000..d7de60e --- /dev/null +++ b/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/modisco/facet/efacet/metamodel/v0_2_0/efacet/serialization/SingleValuedContainmentReferenceInstance.java
@@ -0,0 +1,62 @@ +/** + * Copyright (c) 2011 Mia-Software. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Gregoire Dupe (Mia-Software) - Design + * Nicolas Guyomar (Mia-Software) - Implementation + * Emmanuelle Rouillé (Mia-Software) - Bug 352618 - To be able to use non derived facet structural features and save them values. + * Nicolas Bros (Mia-Software) - Bug 361823 - [Restructuring] eFacet2 meta-model + */ +package org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.serialization; + +import org.eclipse.emf.ecore.EObject; + +/** + * <!-- begin-user-doc --> + * A representation of the model object '<em><b>Single Valued Containment Reference Instance</b></em>'. + * <!-- end-user-doc --> + * + * <p> + * The following features are supported: + * <ul> + * <li>{@link org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.serialization.SingleValuedContainmentReferenceInstance#getOwnedElement <em>Owned Element</em>}</li> + * </ul> + * </p> + * + * @see org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.serialization.SerializationPackage#getSingleValuedContainmentReferenceInstance() + * @model + * @generated + */ +public interface SingleValuedContainmentReferenceInstance extends AbstractReferenceInstance { + /** + * Returns the value of the '<em><b>Owned Element</b></em>' containment reference. + * <!-- begin-user-doc --> + * <p> + * If the meaning of the '<em>Owned Element</em>' containment reference isn't clear, + * there really should be more of a description here... + * </p> + * <!-- end-user-doc --> + * @return the value of the '<em>Owned Element</em>' containment reference. + * @see #setOwnedElement(EObject) + * @see org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.serialization.SerializationPackage#getSingleValuedContainmentReferenceInstance_OwnedElement() + * @model containment="true" + * @generated + */ + EObject getOwnedElement(); + + /** + * Sets the value of the '{@link org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.serialization.SingleValuedContainmentReferenceInstance#getOwnedElement <em>Owned Element</em>}' containment reference. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @param value the new value of the '<em>Owned Element</em>' containment reference. + * @see #getOwnedElement() + * @generated + */ + void setOwnedElement(EObject value); + +} // SingleValuedContainmentReferenceInstance
diff --git a/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/modisco/facet/efacet/metamodel/v0_2_0/efacet/serialization/SingleValuedReferenceInstance.java b/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/modisco/facet/efacet/metamodel/v0_2_0/efacet/serialization/SingleValuedReferenceInstance.java new file mode 100644 index 0000000..422a33b --- /dev/null +++ b/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/modisco/facet/efacet/metamodel/v0_2_0/efacet/serialization/SingleValuedReferenceInstance.java
@@ -0,0 +1,62 @@ +/** + * Copyright (c) 2011 Mia-Software. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Gregoire Dupe (Mia-Software) - Design + * Nicolas Guyomar (Mia-Software) - Implementation + * Emmanuelle Rouillé (Mia-Software) - Bug 352618 - To be able to use non derived facet structural features and save them values. + * Nicolas Bros (Mia-Software) - Bug 361823 - [Restructuring] eFacet2 meta-model + */ +package org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.serialization; + +import org.eclipse.emf.ecore.EObject; + +/** + * <!-- begin-user-doc --> + * A representation of the model object '<em><b>Single Valued Reference Instance</b></em>'. + * <!-- end-user-doc --> + * + * <p> + * The following features are supported: + * <ul> + * <li>{@link org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.serialization.SingleValuedReferenceInstance#getReferencedElement <em>Referenced Element</em>}</li> + * </ul> + * </p> + * + * @see org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.serialization.SerializationPackage#getSingleValuedReferenceInstance() + * @model + * @generated + */ +public interface SingleValuedReferenceInstance extends AbstractReferenceInstance { + /** + * Returns the value of the '<em><b>Referenced Element</b></em>' reference. + * <!-- begin-user-doc --> + * <p> + * If the meaning of the '<em>Referenced Element</em>' reference isn't clear, + * there really should be more of a description here... + * </p> + * <!-- end-user-doc --> + * @return the value of the '<em>Referenced Element</em>' reference. + * @see #setReferencedElement(EObject) + * @see org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.serialization.SerializationPackage#getSingleValuedReferenceInstance_ReferencedElement() + * @model + * @generated + */ + EObject getReferencedElement(); + + /** + * Sets the value of the '{@link org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.serialization.SingleValuedReferenceInstance#getReferencedElement <em>Referenced Element</em>}' reference. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @param value the new value of the '<em>Referenced Element</em>' reference. + * @see #getReferencedElement() + * @generated + */ + void setReferencedElement(EObject value); + +} // SingleValuedReferenceInstance
diff --git a/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/modisco/facet/efacet/metamodel/v0_2_0/efacet/serialization/impl/AbstractAttributeInstanceImpl.java b/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/modisco/facet/efacet/metamodel/v0_2_0/efacet/serialization/impl/AbstractAttributeInstanceImpl.java new file mode 100644 index 0000000..52eda54 --- /dev/null +++ b/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/modisco/facet/efacet/metamodel/v0_2_0/efacet/serialization/impl/AbstractAttributeInstanceImpl.java
@@ -0,0 +1,166 @@ +/** + * Copyright (c) 2011 Mia-Software. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Gregoire Dupe (Mia-Software) - Design + * Nicolas Guyomar (Mia-Software) - Implementation + * Emmanuelle Rouillé (Mia-Software) - Bug 352618 - To be able to use non derived facet structural features and save them values. + * Nicolas Bros (Mia-Software) - Bug 361823 - [Restructuring] eFacet2 meta-model + */ +package org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.serialization.impl; + +import org.eclipse.emf.common.notify.Notification; +import org.eclipse.emf.ecore.EAttribute; +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.InternalEObject; +import org.eclipse.emf.ecore.impl.ENotificationImpl; +import org.eclipse.emf.ecore.impl.EObjectImpl; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.serialization.AbstractAttributeInstance; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.serialization.SerializationPackage; + +/** + * <!-- begin-user-doc --> + * An implementation of the model object '<em><b>Abstract Attribute Instance</b></em>'. + * <!-- end-user-doc --> + * <p> + * The following features are implemented: + * <ul> + * <li>{@link org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.serialization.impl.AbstractAttributeInstanceImpl#getEAttribute <em>EAttribute</em>}</li> + * </ul> + * </p> + * + * @generated + */ +public class AbstractAttributeInstanceImpl extends EObjectImpl implements AbstractAttributeInstance { + /** + * The cached value of the '{@link #getEAttribute() <em>EAttribute</em>}' reference. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @see #getEAttribute() + * @generated + * @ordered + */ + protected EAttribute eAttribute; + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + protected AbstractAttributeInstanceImpl() { + super(); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + protected EClass eStaticClass() { + return SerializationPackage.Literals.ABSTRACT_ATTRIBUTE_INSTANCE; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public EAttribute getEAttribute() { + if (eAttribute != null && eAttribute.eIsProxy()) { + InternalEObject oldEAttribute = (InternalEObject)eAttribute; + eAttribute = (EAttribute)eResolveProxy(oldEAttribute); + if (eAttribute != oldEAttribute) { + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.RESOLVE, SerializationPackage.ABSTRACT_ATTRIBUTE_INSTANCE__EATTRIBUTE, oldEAttribute, eAttribute)); + } + } + return eAttribute; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public EAttribute basicGetEAttribute() { + return eAttribute; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public void setEAttribute(EAttribute newEAttribute) { + EAttribute oldEAttribute = eAttribute; + eAttribute = newEAttribute; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.SET, SerializationPackage.ABSTRACT_ATTRIBUTE_INSTANCE__EATTRIBUTE, oldEAttribute, eAttribute)); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + public Object eGet(int featureID, boolean resolve, boolean coreType) { + switch (featureID) { + case SerializationPackage.ABSTRACT_ATTRIBUTE_INSTANCE__EATTRIBUTE: + if (resolve) return getEAttribute(); + return basicGetEAttribute(); + } + return super.eGet(featureID, resolve, coreType); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + public void eSet(int featureID, Object newValue) { + switch (featureID) { + case SerializationPackage.ABSTRACT_ATTRIBUTE_INSTANCE__EATTRIBUTE: + setEAttribute((EAttribute)newValue); + return; + } + super.eSet(featureID, newValue); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + public void eUnset(int featureID) { + switch (featureID) { + case SerializationPackage.ABSTRACT_ATTRIBUTE_INSTANCE__EATTRIBUTE: + setEAttribute((EAttribute)null); + return; + } + super.eUnset(featureID); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + public boolean eIsSet(int featureID) { + switch (featureID) { + case SerializationPackage.ABSTRACT_ATTRIBUTE_INSTANCE__EATTRIBUTE: + return eAttribute != null; + } + return super.eIsSet(featureID); + } + +} //AbstractAttributeInstanceImpl
diff --git a/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/modisco/facet/efacet/metamodel/v0_2_0/efacet/serialization/impl/AbstractReferenceInstanceImpl.java b/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/modisco/facet/efacet/metamodel/v0_2_0/efacet/serialization/impl/AbstractReferenceInstanceImpl.java new file mode 100644 index 0000000..b322fee --- /dev/null +++ b/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/modisco/facet/efacet/metamodel/v0_2_0/efacet/serialization/impl/AbstractReferenceInstanceImpl.java
@@ -0,0 +1,166 @@ +/** + * Copyright (c) 2011 Mia-Software. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Gregoire Dupe (Mia-Software) - Design + * Nicolas Guyomar (Mia-Software) - Implementation + * Emmanuelle Rouillé (Mia-Software) - Bug 352618 - To be able to use non derived facet structural features and save them values. + * Nicolas Bros (Mia-Software) - Bug 361823 - [Restructuring] eFacet2 meta-model + */ +package org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.serialization.impl; + +import org.eclipse.emf.common.notify.Notification; +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.EReference; +import org.eclipse.emf.ecore.InternalEObject; +import org.eclipse.emf.ecore.impl.ENotificationImpl; +import org.eclipse.emf.ecore.impl.EObjectImpl; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.serialization.AbstractReferenceInstance; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.serialization.SerializationPackage; + +/** + * <!-- begin-user-doc --> + * An implementation of the model object '<em><b>Abstract Reference Instance</b></em>'. + * <!-- end-user-doc --> + * <p> + * The following features are implemented: + * <ul> + * <li>{@link org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.serialization.impl.AbstractReferenceInstanceImpl#getEReference <em>EReference</em>}</li> + * </ul> + * </p> + * + * @generated + */ +public class AbstractReferenceInstanceImpl extends EObjectImpl implements AbstractReferenceInstance { + /** + * The cached value of the '{@link #getEReference() <em>EReference</em>}' reference. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @see #getEReference() + * @generated + * @ordered + */ + protected EReference eReference; + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + protected AbstractReferenceInstanceImpl() { + super(); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + protected EClass eStaticClass() { + return SerializationPackage.Literals.ABSTRACT_REFERENCE_INSTANCE; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public EReference getEReference() { + if (eReference != null && eReference.eIsProxy()) { + InternalEObject oldEReference = (InternalEObject)eReference; + eReference = (EReference)eResolveProxy(oldEReference); + if (eReference != oldEReference) { + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.RESOLVE, SerializationPackage.ABSTRACT_REFERENCE_INSTANCE__EREFERENCE, oldEReference, eReference)); + } + } + return eReference; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public EReference basicGetEReference() { + return eReference; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public void setEReference(EReference newEReference) { + EReference oldEReference = eReference; + eReference = newEReference; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.SET, SerializationPackage.ABSTRACT_REFERENCE_INSTANCE__EREFERENCE, oldEReference, eReference)); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + public Object eGet(int featureID, boolean resolve, boolean coreType) { + switch (featureID) { + case SerializationPackage.ABSTRACT_REFERENCE_INSTANCE__EREFERENCE: + if (resolve) return getEReference(); + return basicGetEReference(); + } + return super.eGet(featureID, resolve, coreType); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + public void eSet(int featureID, Object newValue) { + switch (featureID) { + case SerializationPackage.ABSTRACT_REFERENCE_INSTANCE__EREFERENCE: + setEReference((EReference)newValue); + return; + } + super.eSet(featureID, newValue); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + public void eUnset(int featureID) { + switch (featureID) { + case SerializationPackage.ABSTRACT_REFERENCE_INSTANCE__EREFERENCE: + setEReference((EReference)null); + return; + } + super.eUnset(featureID); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + public boolean eIsSet(int featureID) { + switch (featureID) { + case SerializationPackage.ABSTRACT_REFERENCE_INSTANCE__EREFERENCE: + return eReference != null; + } + return super.eIsSet(featureID); + } + +} //AbstractReferenceInstanceImpl
diff --git a/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/modisco/facet/efacet/metamodel/v0_2_0/efacet/serialization/impl/ExtendedEObjectReferenceImpl.java b/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/modisco/facet/efacet/metamodel/v0_2_0/efacet/serialization/impl/ExtendedEObjectReferenceImpl.java new file mode 100644 index 0000000..99ae133 --- /dev/null +++ b/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/modisco/facet/efacet/metamodel/v0_2_0/efacet/serialization/impl/ExtendedEObjectReferenceImpl.java
@@ -0,0 +1,259 @@ +/** + * Copyright (c) 2011 Mia-Software. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Gregoire Dupe (Mia-Software) - Design + * Nicolas Guyomar (Mia-Software) - Implementation + * Emmanuelle Rouillé (Mia-Software) - Bug 352618 - To be able to use non derived facet structural features and save them values. + * Nicolas Bros (Mia-Software) - Bug 361823 - [Restructuring] eFacet2 meta-model + */ +package org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.serialization.impl; + +import java.util.Collection; + +import org.eclipse.emf.common.notify.Notification; +import org.eclipse.emf.common.notify.NotificationChain; +import org.eclipse.emf.common.util.EList; +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.ecore.InternalEObject; +import org.eclipse.emf.ecore.impl.ENotificationImpl; +import org.eclipse.emf.ecore.impl.EObjectImpl; +import org.eclipse.emf.ecore.util.EObjectContainmentEList; +import org.eclipse.emf.ecore.util.InternalEList; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.serialization.AbstractAttributeInstance; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.serialization.AbstractReferenceInstance; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.serialization.ExtendedEObjectReference; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.serialization.SerializationPackage; + +/** + * <!-- begin-user-doc --> + * An implementation of the model object '<em><b>Extended EObject Reference</b></em>'. + * <!-- end-user-doc --> + * <p> + * The following features are implemented: + * <ul> + * <li>{@link org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.serialization.impl.ExtendedEObjectReferenceImpl#getExtendedEObject <em>Extended EObject</em>}</li> + * <li>{@link org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.serialization.impl.ExtendedEObjectReferenceImpl#getAttributeInstances <em>Attribute Instances</em>}</li> + * <li>{@link org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.serialization.impl.ExtendedEObjectReferenceImpl#getReferenceInstances <em>Reference Instances</em>}</li> + * </ul> + * </p> + * + * @generated + */ +public class ExtendedEObjectReferenceImpl extends EObjectImpl implements ExtendedEObjectReference { + /** + * The cached value of the '{@link #getExtendedEObject() <em>Extended EObject</em>}' reference. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @see #getExtendedEObject() + * @generated + * @ordered + */ + protected EObject extendedEObject; + + /** + * The cached value of the '{@link #getAttributeInstances() <em>Attribute Instances</em>}' containment reference list. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @see #getAttributeInstances() + * @generated + * @ordered + */ + protected EList<AbstractAttributeInstance> attributeInstances; + + /** + * The cached value of the '{@link #getReferenceInstances() <em>Reference Instances</em>}' containment reference list. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @see #getReferenceInstances() + * @generated + * @ordered + */ + protected EList<AbstractReferenceInstance> referenceInstances; + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + protected ExtendedEObjectReferenceImpl() { + super(); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + protected EClass eStaticClass() { + return SerializationPackage.Literals.EXTENDED_EOBJECT_REFERENCE; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public EObject getExtendedEObject() { + if (extendedEObject != null && extendedEObject.eIsProxy()) { + InternalEObject oldExtendedEObject = (InternalEObject)extendedEObject; + extendedEObject = eResolveProxy(oldExtendedEObject); + if (extendedEObject != oldExtendedEObject) { + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.RESOLVE, SerializationPackage.EXTENDED_EOBJECT_REFERENCE__EXTENDED_EOBJECT, oldExtendedEObject, extendedEObject)); + } + } + return extendedEObject; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public EObject basicGetExtendedEObject() { + return extendedEObject; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public void setExtendedEObject(EObject newExtendedEObject) { + EObject oldExtendedEObject = extendedEObject; + extendedEObject = newExtendedEObject; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.SET, SerializationPackage.EXTENDED_EOBJECT_REFERENCE__EXTENDED_EOBJECT, oldExtendedEObject, extendedEObject)); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public EList<AbstractAttributeInstance> getAttributeInstances() { + if (attributeInstances == null) { + attributeInstances = new EObjectContainmentEList<AbstractAttributeInstance>(AbstractAttributeInstance.class, this, SerializationPackage.EXTENDED_EOBJECT_REFERENCE__ATTRIBUTE_INSTANCES); + } + return attributeInstances; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public EList<AbstractReferenceInstance> getReferenceInstances() { + if (referenceInstances == null) { + referenceInstances = new EObjectContainmentEList<AbstractReferenceInstance>(AbstractReferenceInstance.class, this, SerializationPackage.EXTENDED_EOBJECT_REFERENCE__REFERENCE_INSTANCES); + } + return referenceInstances; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { + switch (featureID) { + case SerializationPackage.EXTENDED_EOBJECT_REFERENCE__ATTRIBUTE_INSTANCES: + return ((InternalEList<?>)getAttributeInstances()).basicRemove(otherEnd, msgs); + case SerializationPackage.EXTENDED_EOBJECT_REFERENCE__REFERENCE_INSTANCES: + return ((InternalEList<?>)getReferenceInstances()).basicRemove(otherEnd, msgs); + } + return super.eInverseRemove(otherEnd, featureID, msgs); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + public Object eGet(int featureID, boolean resolve, boolean coreType) { + switch (featureID) { + case SerializationPackage.EXTENDED_EOBJECT_REFERENCE__EXTENDED_EOBJECT: + if (resolve) return getExtendedEObject(); + return basicGetExtendedEObject(); + case SerializationPackage.EXTENDED_EOBJECT_REFERENCE__ATTRIBUTE_INSTANCES: + return getAttributeInstances(); + case SerializationPackage.EXTENDED_EOBJECT_REFERENCE__REFERENCE_INSTANCES: + return getReferenceInstances(); + } + return super.eGet(featureID, resolve, coreType); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @SuppressWarnings("unchecked") + @Override + public void eSet(int featureID, Object newValue) { + switch (featureID) { + case SerializationPackage.EXTENDED_EOBJECT_REFERENCE__EXTENDED_EOBJECT: + setExtendedEObject((EObject)newValue); + return; + case SerializationPackage.EXTENDED_EOBJECT_REFERENCE__ATTRIBUTE_INSTANCES: + getAttributeInstances().clear(); + getAttributeInstances().addAll((Collection<? extends AbstractAttributeInstance>)newValue); + return; + case SerializationPackage.EXTENDED_EOBJECT_REFERENCE__REFERENCE_INSTANCES: + getReferenceInstances().clear(); + getReferenceInstances().addAll((Collection<? extends AbstractReferenceInstance>)newValue); + return; + } + super.eSet(featureID, newValue); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + public void eUnset(int featureID) { + switch (featureID) { + case SerializationPackage.EXTENDED_EOBJECT_REFERENCE__EXTENDED_EOBJECT: + setExtendedEObject((EObject)null); + return; + case SerializationPackage.EXTENDED_EOBJECT_REFERENCE__ATTRIBUTE_INSTANCES: + getAttributeInstances().clear(); + return; + case SerializationPackage.EXTENDED_EOBJECT_REFERENCE__REFERENCE_INSTANCES: + getReferenceInstances().clear(); + return; + } + super.eUnset(featureID); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + public boolean eIsSet(int featureID) { + switch (featureID) { + case SerializationPackage.EXTENDED_EOBJECT_REFERENCE__EXTENDED_EOBJECT: + return extendedEObject != null; + case SerializationPackage.EXTENDED_EOBJECT_REFERENCE__ATTRIBUTE_INSTANCES: + return attributeInstances != null && !attributeInstances.isEmpty(); + case SerializationPackage.EXTENDED_EOBJECT_REFERENCE__REFERENCE_INSTANCES: + return referenceInstances != null && !referenceInstances.isEmpty(); + } + return super.eIsSet(featureID); + } + +} //ExtendedEObjectReferenceImpl
diff --git a/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/modisco/facet/efacet/metamodel/v0_2_0/efacet/serialization/impl/MultiValuedAttributeInstanceImpl.java b/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/modisco/facet/efacet/metamodel/v0_2_0/efacet/serialization/impl/MultiValuedAttributeInstanceImpl.java new file mode 100644 index 0000000..c3594ce --- /dev/null +++ b/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/modisco/facet/efacet/metamodel/v0_2_0/efacet/serialization/impl/MultiValuedAttributeInstanceImpl.java
@@ -0,0 +1,156 @@ +/** + * Copyright (c) 2011 Mia-Software. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Gregoire Dupe (Mia-Software) - Design + * Nicolas Guyomar (Mia-Software) - Implementation + * Emmanuelle Rouillé (Mia-Software) - Bug 352618 - To be able to use non derived facet structural features and save them values. + * Nicolas Bros (Mia-Software) - Bug 361823 - [Restructuring] eFacet2 meta-model + */ +package org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.serialization.impl; + +import java.util.Collection; + +import org.eclipse.emf.common.util.EList; +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.util.EDataTypeUniqueEList; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.serialization.MultiValuedAttributeInstance; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.serialization.SerializationPackage; + +/** + * <!-- begin-user-doc --> + * An implementation of the model object '<em><b>Multi Valued Attribute Instance</b></em>'. + * <!-- end-user-doc --> + * <p> + * The following features are implemented: + * <ul> + * <li>{@link org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.serialization.impl.MultiValuedAttributeInstanceImpl#getValues <em>Values</em>}</li> + * </ul> + * </p> + * + * @generated + */ +public class MultiValuedAttributeInstanceImpl extends AbstractAttributeInstanceImpl implements MultiValuedAttributeInstance { + /** + * The cached value of the '{@link #getValues() <em>Values</em>}' attribute list. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @see #getValues() + * @generated + * @ordered + */ + protected EList<Object> values; + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + protected MultiValuedAttributeInstanceImpl() { + super(); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + protected EClass eStaticClass() { + return SerializationPackage.Literals.MULTI_VALUED_ATTRIBUTE_INSTANCE; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public EList<Object> getValues() { + if (values == null) { + values = new EDataTypeUniqueEList<Object>(Object.class, this, SerializationPackage.MULTI_VALUED_ATTRIBUTE_INSTANCE__VALUES); + } + return values; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + public Object eGet(int featureID, boolean resolve, boolean coreType) { + switch (featureID) { + case SerializationPackage.MULTI_VALUED_ATTRIBUTE_INSTANCE__VALUES: + return getValues(); + } + return super.eGet(featureID, resolve, coreType); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @SuppressWarnings("unchecked") + @Override + public void eSet(int featureID, Object newValue) { + switch (featureID) { + case SerializationPackage.MULTI_VALUED_ATTRIBUTE_INSTANCE__VALUES: + getValues().clear(); + getValues().addAll((Collection<? extends Object>)newValue); + return; + } + super.eSet(featureID, newValue); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + public void eUnset(int featureID) { + switch (featureID) { + case SerializationPackage.MULTI_VALUED_ATTRIBUTE_INSTANCE__VALUES: + getValues().clear(); + return; + } + super.eUnset(featureID); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + public boolean eIsSet(int featureID) { + switch (featureID) { + case SerializationPackage.MULTI_VALUED_ATTRIBUTE_INSTANCE__VALUES: + return values != null && !values.isEmpty(); + } + return super.eIsSet(featureID); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + public String toString() { + if (eIsProxy()) return super.toString(); + + StringBuffer result = new StringBuffer(super.toString()); + result.append(" (values: "); //$NON-NLS-1$ + result.append(values); + result.append(')'); + return result.toString(); + } + +} //MultiValuedAttributeInstanceImpl
diff --git a/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/modisco/facet/efacet/metamodel/v0_2_0/efacet/serialization/impl/MultiValuedContainmentReferenceInstanceImpl.java b/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/modisco/facet/efacet/metamodel/v0_2_0/efacet/serialization/impl/MultiValuedContainmentReferenceInstanceImpl.java new file mode 100644 index 0000000..4f3e2ef --- /dev/null +++ b/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/modisco/facet/efacet/metamodel/v0_2_0/efacet/serialization/impl/MultiValuedContainmentReferenceInstanceImpl.java
@@ -0,0 +1,158 @@ +/** + * Copyright (c) 2011 Mia-Software. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Gregoire Dupe (Mia-Software) - Design + * Nicolas Guyomar (Mia-Software) - Implementation + * Emmanuelle Rouillé (Mia-Software) - Bug 352618 - To be able to use non derived facet structural features and save them values. + * Nicolas Bros (Mia-Software) - Bug 361823 - [Restructuring] eFacet2 meta-model + */ +package org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.serialization.impl; + +import java.util.Collection; + +import org.eclipse.emf.common.notify.NotificationChain; +import org.eclipse.emf.common.util.EList; +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.ecore.InternalEObject; +import org.eclipse.emf.ecore.util.EObjectContainmentEList; +import org.eclipse.emf.ecore.util.InternalEList; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.serialization.MultiValuedContainmentReferenceInstance; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.serialization.SerializationPackage; + +/** + * <!-- begin-user-doc --> + * An implementation of the model object '<em><b>Multi Valued Containment Reference Instance</b></em>'. + * <!-- end-user-doc --> + * <p> + * The following features are implemented: + * <ul> + * <li>{@link org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.serialization.impl.MultiValuedContainmentReferenceInstanceImpl#getOwnedElements <em>Owned Elements</em>}</li> + * </ul> + * </p> + * + * @generated + */ +public class MultiValuedContainmentReferenceInstanceImpl extends AbstractReferenceInstanceImpl implements MultiValuedContainmentReferenceInstance { + /** + * The cached value of the '{@link #getOwnedElements() <em>Owned Elements</em>}' containment reference list. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @see #getOwnedElements() + * @generated + * @ordered + */ + protected EList<EObject> ownedElements; + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + protected MultiValuedContainmentReferenceInstanceImpl() { + super(); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + protected EClass eStaticClass() { + return SerializationPackage.Literals.MULTI_VALUED_CONTAINMENT_REFERENCE_INSTANCE; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public EList<EObject> getOwnedElements() { + if (ownedElements == null) { + ownedElements = new EObjectContainmentEList<EObject>(EObject.class, this, SerializationPackage.MULTI_VALUED_CONTAINMENT_REFERENCE_INSTANCE__OWNED_ELEMENTS); + } + return ownedElements; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { + switch (featureID) { + case SerializationPackage.MULTI_VALUED_CONTAINMENT_REFERENCE_INSTANCE__OWNED_ELEMENTS: + return ((InternalEList<?>)getOwnedElements()).basicRemove(otherEnd, msgs); + } + return super.eInverseRemove(otherEnd, featureID, msgs); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + public Object eGet(int featureID, boolean resolve, boolean coreType) { + switch (featureID) { + case SerializationPackage.MULTI_VALUED_CONTAINMENT_REFERENCE_INSTANCE__OWNED_ELEMENTS: + return getOwnedElements(); + } + return super.eGet(featureID, resolve, coreType); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @SuppressWarnings("unchecked") + @Override + public void eSet(int featureID, Object newValue) { + switch (featureID) { + case SerializationPackage.MULTI_VALUED_CONTAINMENT_REFERENCE_INSTANCE__OWNED_ELEMENTS: + getOwnedElements().clear(); + getOwnedElements().addAll((Collection<? extends EObject>)newValue); + return; + } + super.eSet(featureID, newValue); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + public void eUnset(int featureID) { + switch (featureID) { + case SerializationPackage.MULTI_VALUED_CONTAINMENT_REFERENCE_INSTANCE__OWNED_ELEMENTS: + getOwnedElements().clear(); + return; + } + super.eUnset(featureID); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + public boolean eIsSet(int featureID) { + switch (featureID) { + case SerializationPackage.MULTI_VALUED_CONTAINMENT_REFERENCE_INSTANCE__OWNED_ELEMENTS: + return ownedElements != null && !ownedElements.isEmpty(); + } + return super.eIsSet(featureID); + } + +} //MultiValuedContainmentReferenceInstanceImpl
diff --git a/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/modisco/facet/efacet/metamodel/v0_2_0/efacet/serialization/impl/MultiValuedReferenceInstanceImpl.java b/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/modisco/facet/efacet/metamodel/v0_2_0/efacet/serialization/impl/MultiValuedReferenceInstanceImpl.java new file mode 100644 index 0000000..a6626a0 --- /dev/null +++ b/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/modisco/facet/efacet/metamodel/v0_2_0/efacet/serialization/impl/MultiValuedReferenceInstanceImpl.java
@@ -0,0 +1,141 @@ +/** + * Copyright (c) 2011 Mia-Software. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Gregoire Dupe (Mia-Software) - Design + * Nicolas Guyomar (Mia-Software) - Implementation + * Emmanuelle Rouillé (Mia-Software) - Bug 352618 - To be able to use non derived facet structural features and save them values. + * Nicolas Bros (Mia-Software) - Bug 361823 - [Restructuring] eFacet2 meta-model + */ +package org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.serialization.impl; + +import java.util.Collection; + +import org.eclipse.emf.common.util.EList; +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.ecore.util.EObjectResolvingEList; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.serialization.MultiValuedReferenceInstance; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.serialization.SerializationPackage; + +/** + * <!-- begin-user-doc --> + * An implementation of the model object '<em><b>Multi Valued Reference Instance</b></em>'. + * <!-- end-user-doc --> + * <p> + * The following features are implemented: + * <ul> + * <li>{@link org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.serialization.impl.MultiValuedReferenceInstanceImpl#getReferencedElements <em>Referenced Elements</em>}</li> + * </ul> + * </p> + * + * @generated + */ +public class MultiValuedReferenceInstanceImpl extends AbstractReferenceInstanceImpl implements MultiValuedReferenceInstance { + /** + * The cached value of the '{@link #getReferencedElements() <em>Referenced Elements</em>}' reference list. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @see #getReferencedElements() + * @generated + * @ordered + */ + protected EList<EObject> referencedElements; + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + protected MultiValuedReferenceInstanceImpl() { + super(); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + protected EClass eStaticClass() { + return SerializationPackage.Literals.MULTI_VALUED_REFERENCE_INSTANCE; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public EList<EObject> getReferencedElements() { + if (referencedElements == null) { + referencedElements = new EObjectResolvingEList<EObject>(EObject.class, this, SerializationPackage.MULTI_VALUED_REFERENCE_INSTANCE__REFERENCED_ELEMENTS); + } + return referencedElements; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + public Object eGet(int featureID, boolean resolve, boolean coreType) { + switch (featureID) { + case SerializationPackage.MULTI_VALUED_REFERENCE_INSTANCE__REFERENCED_ELEMENTS: + return getReferencedElements(); + } + return super.eGet(featureID, resolve, coreType); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @SuppressWarnings("unchecked") + @Override + public void eSet(int featureID, Object newValue) { + switch (featureID) { + case SerializationPackage.MULTI_VALUED_REFERENCE_INSTANCE__REFERENCED_ELEMENTS: + getReferencedElements().clear(); + getReferencedElements().addAll((Collection<? extends EObject>)newValue); + return; + } + super.eSet(featureID, newValue); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + public void eUnset(int featureID) { + switch (featureID) { + case SerializationPackage.MULTI_VALUED_REFERENCE_INSTANCE__REFERENCED_ELEMENTS: + getReferencedElements().clear(); + return; + } + super.eUnset(featureID); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + public boolean eIsSet(int featureID) { + switch (featureID) { + case SerializationPackage.MULTI_VALUED_REFERENCE_INSTANCE__REFERENCED_ELEMENTS: + return referencedElements != null && !referencedElements.isEmpty(); + } + return super.eIsSet(featureID); + } + +} //MultiValuedReferenceInstanceImpl
diff --git a/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/modisco/facet/efacet/metamodel/v0_2_0/efacet/serialization/impl/SerializationFactoryImpl.java b/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/modisco/facet/efacet/metamodel/v0_2_0/efacet/serialization/impl/SerializationFactoryImpl.java new file mode 100644 index 0000000..78f6849 --- /dev/null +++ b/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/modisco/facet/efacet/metamodel/v0_2_0/efacet/serialization/impl/SerializationFactoryImpl.java
@@ -0,0 +1,201 @@ +/** + * Copyright (c) 2011, 2015 Mia-Software, and Soft-Maint. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Gregoire Dupe (Mia-Software) - Design + * Nicolas Guyomar (Mia-Software) - Implementation + * Emmanuelle Rouillé (Mia-Software) - Bug 352618 - To be able to use non derived facet structural features and save them values. + * Nicolas Bros (Mia-Software) - Bug 361823 - [Restructuring] eFacet2 meta-model + * Gregoire Dupe (Mia-Software) - Bug 366055 - NavigationQuery + * Gregoire Dupe (Mia-Software) - Bug 369673 - [Facet] IsOneOfQuery + * Olivier Remaud (Soft-Maint) - Bug 369824 - Add a simple way to return string literal constants from a customization query + * Gregoire Dupe (Mia-Software) - Bug 369987 - [Restructuring][Table] Switch to the new customization and facet framework + * Gregoire Dupe (Mia-software) - Bug 364325 - [Restructuring] The user must be able to navigate into a model using the Facet. + * Nicolas Bros (Mia-Software) - Bug 372626 - [Facet] Aggregates + * Nicolas Bros (Mia-Software) - Bug 376941 - [EFacet] Facet operation arguments in Facet model + * Gregoire Dupe (Mia-Software) - Bug 376576 - [EFacet] Change the multiplicity of Facet::extendedFacet + * Jonathan Pepin (Soft-Maint) - Bug 463898 - Create FacetReference not derived, without query and with opposite mechanism + */ +package org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.serialization.impl; + +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.ecore.EPackage; +import org.eclipse.emf.ecore.impl.EFactoryImpl; +import org.eclipse.emf.ecore.plugin.EcorePlugin; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.serialization.*; + +/** + * <!-- begin-user-doc --> + * An implementation of the model <b>Factory</b>. + * <!-- end-user-doc --> + * @generated + */ +public class SerializationFactoryImpl extends EFactoryImpl implements SerializationFactory { + /** + * Creates the default factory implementation. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public static SerializationFactory init() { + try { + SerializationFactory theSerializationFactory = (SerializationFactory)EPackage.Registry.INSTANCE.getEFactory(SerializationPackage.eNS_URI); + if (theSerializationFactory != null) { + return theSerializationFactory; + } + } + catch (Exception exception) { + EcorePlugin.INSTANCE.log(exception); + } + return new SerializationFactoryImpl(); + } + + /** + * Creates an instance of the factory. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public SerializationFactoryImpl() { + super(); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + public EObject create(EClass eClass) { + switch (eClass.getClassifierID()) { + case SerializationPackage.ABSTRACT_REFERENCE_INSTANCE: return createAbstractReferenceInstance(); + case SerializationPackage.MULTI_VALUED_CONTAINMENT_REFERENCE_INSTANCE: return createMultiValuedContainmentReferenceInstance(); + case SerializationPackage.MULTI_VALUED_REFERENCE_INSTANCE: return createMultiValuedReferenceInstance(); + case SerializationPackage.SINGLE_VALUED_ATTRIBUTE_INSTANCE: return createSingleValuedAttributeInstance(); + case SerializationPackage.EXTENDED_EOBJECT_REFERENCE: return createExtendedEObjectReference(); + case SerializationPackage.SINGLE_VALUED_CONTAINMENT_REFERENCE_INSTANCE: return createSingleValuedContainmentReferenceInstance(); + case SerializationPackage.SINGLE_VALUED_REFERENCE_INSTANCE: return createSingleValuedReferenceInstance(); + case SerializationPackage.MULTI_VALUED_ATTRIBUTE_INSTANCE: return createMultiValuedAttributeInstance(); + case SerializationPackage.ABSTRACT_ATTRIBUTE_INSTANCE: return createAbstractAttributeInstance(); + default: + throw new IllegalArgumentException("The class '" + eClass.getName() + "' is not a valid classifier"); //$NON-NLS-1$ //$NON-NLS-2$ + } + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public AbstractReferenceInstance createAbstractReferenceInstance() { + AbstractReferenceInstanceImpl abstractReferenceInstance = new AbstractReferenceInstanceImpl(); + return abstractReferenceInstance; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public MultiValuedContainmentReferenceInstance createMultiValuedContainmentReferenceInstance() { + MultiValuedContainmentReferenceInstanceImpl multiValuedContainmentReferenceInstance = new MultiValuedContainmentReferenceInstanceImpl(); + return multiValuedContainmentReferenceInstance; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public MultiValuedReferenceInstance createMultiValuedReferenceInstance() { + MultiValuedReferenceInstanceImpl multiValuedReferenceInstance = new MultiValuedReferenceInstanceImpl(); + return multiValuedReferenceInstance; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public SingleValuedAttributeInstance createSingleValuedAttributeInstance() { + SingleValuedAttributeInstanceImpl singleValuedAttributeInstance = new SingleValuedAttributeInstanceImpl(); + return singleValuedAttributeInstance; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public ExtendedEObjectReference createExtendedEObjectReference() { + ExtendedEObjectReferenceImpl extendedEObjectReference = new ExtendedEObjectReferenceImpl(); + return extendedEObjectReference; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public SingleValuedContainmentReferenceInstance createSingleValuedContainmentReferenceInstance() { + SingleValuedContainmentReferenceInstanceImpl singleValuedContainmentReferenceInstance = new SingleValuedContainmentReferenceInstanceImpl(); + return singleValuedContainmentReferenceInstance; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public SingleValuedReferenceInstance createSingleValuedReferenceInstance() { + SingleValuedReferenceInstanceImpl singleValuedReferenceInstance = new SingleValuedReferenceInstanceImpl(); + return singleValuedReferenceInstance; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public MultiValuedAttributeInstance createMultiValuedAttributeInstance() { + MultiValuedAttributeInstanceImpl multiValuedAttributeInstance = new MultiValuedAttributeInstanceImpl(); + return multiValuedAttributeInstance; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public AbstractAttributeInstance createAbstractAttributeInstance() { + AbstractAttributeInstanceImpl abstractAttributeInstance = new AbstractAttributeInstanceImpl(); + return abstractAttributeInstance; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public SerializationPackage getSerializationPackage() { + return (SerializationPackage)getEPackage(); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @deprecated + * @generated + */ + @Deprecated + public static SerializationPackage getPackage() { + return SerializationPackage.eINSTANCE; + } + +} //SerializationFactoryImpl
diff --git a/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/modisco/facet/efacet/metamodel/v0_2_0/efacet/serialization/impl/SerializationPackageImpl.java b/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/modisco/facet/efacet/metamodel/v0_2_0/efacet/serialization/impl/SerializationPackageImpl.java new file mode 100644 index 0000000..d577182 --- /dev/null +++ b/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/modisco/facet/efacet/metamodel/v0_2_0/efacet/serialization/impl/SerializationPackageImpl.java
@@ -0,0 +1,497 @@ +/** + * Copyright (c) 2011, 2012 Mia-Software. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Gregoire Dupe (Mia-Software) - Design + * Nicolas Guyomar (Mia-Software) - Implementation + * Emmanuelle Rouillé (Mia-Software) - Bug 352618 - To be able to use non derived facet structural features and save them values. + * Nicolas Bros (Mia-Software) - Bug 361823 - [Restructuring] eFacet2 meta-model + * Gregoire Dupe (Mia-Software) - Bug 369987 - [Restructuring][Table] Switch to the new customization and facet framework + * Gregoire Dupe (Mia-Software) - Bug 364325 - [Restructuring] The user must be able to navigate into a model using the Facet. + */ +package org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.serialization.impl; + +import org.eclipse.emf.ecore.EAttribute; +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.EPackage; +import org.eclipse.emf.ecore.EReference; +import org.eclipse.emf.ecore.EcorePackage; +import org.eclipse.emf.ecore.impl.EPackageImpl; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.EFacetPackage; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.extensible.ExtensiblePackage; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.extensible.impl.ExtensiblePackageImpl; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.impl.EFacetPackageImpl; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.query.QueryPackage; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.query.impl.QueryPackageImpl; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.runtime.RuntimePackage; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.runtime.impl.RuntimePackageImpl; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.serialization.AbstractAttributeInstance; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.serialization.AbstractReferenceInstance; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.serialization.ExtendedEObjectReference; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.serialization.MultiValuedAttributeInstance; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.serialization.MultiValuedContainmentReferenceInstance; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.serialization.MultiValuedReferenceInstance; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.serialization.SerializationFactory; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.serialization.SerializationPackage; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.serialization.SingleValuedAttributeInstance; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.serialization.SingleValuedContainmentReferenceInstance; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.serialization.SingleValuedReferenceInstance; + +/** + * <!-- begin-user-doc --> + * An implementation of the model <b>Package</b>. + * <!-- end-user-doc --> + * @generated + */ +public class SerializationPackageImpl extends EPackageImpl implements SerializationPackage { + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + private EClass abstractReferenceInstanceEClass = null; + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + private EClass multiValuedContainmentReferenceInstanceEClass = null; + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + private EClass multiValuedReferenceInstanceEClass = null; + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + private EClass singleValuedAttributeInstanceEClass = null; + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + private EClass extendedEObjectReferenceEClass = null; + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + private EClass singleValuedContainmentReferenceInstanceEClass = null; + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + private EClass singleValuedReferenceInstanceEClass = null; + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + private EClass multiValuedAttributeInstanceEClass = null; + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + private EClass abstractAttributeInstanceEClass = null; + + /** + * Creates an instance of the model <b>Package</b>, registered with + * {@link org.eclipse.emf.ecore.EPackage.Registry EPackage.Registry} by the package + * package URI value. + * <p>Note: the correct way to create the package is via the static + * factory method {@link #init init()}, which also performs + * initialization of the package, or returns the registered package, + * if one already exists. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @see org.eclipse.emf.ecore.EPackage.Registry + * @see org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.serialization.SerializationPackage#eNS_URI + * @see #init() + * @generated + */ + private SerializationPackageImpl() { + super(eNS_URI, SerializationFactory.eINSTANCE); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + private static boolean isInited = false; + + /** + * Creates, registers, and initializes the <b>Package</b> for this model, and for any others upon which it depends. + * + * <p>This method is used to initialize {@link SerializationPackage#eINSTANCE} when that field is accessed. + * Clients should not invoke it directly. Instead, they should simply access that field to obtain the package. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @see #eNS_URI + * @see #createPackageContents() + * @see #initializePackageContents() + * @generated + */ + public static SerializationPackage init() { + if (isInited) return (SerializationPackage)EPackage.Registry.INSTANCE.getEPackage(SerializationPackage.eNS_URI); + + // Obtain or create and register package + SerializationPackageImpl theSerializationPackage = (SerializationPackageImpl)(EPackage.Registry.INSTANCE.get(eNS_URI) instanceof SerializationPackageImpl ? EPackage.Registry.INSTANCE.get(eNS_URI) : new SerializationPackageImpl()); + + isInited = true; + + // Initialize simple dependencies + EcorePackage.eINSTANCE.eClass(); + + // Obtain or create and register interdependencies + EFacetPackageImpl theEFacetPackage = (EFacetPackageImpl)(EPackage.Registry.INSTANCE.getEPackage(EFacetPackage.eNS_URI) instanceof EFacetPackageImpl ? EPackage.Registry.INSTANCE.getEPackage(EFacetPackage.eNS_URI) : EFacetPackage.eINSTANCE); + ExtensiblePackageImpl theExtensiblePackage = (ExtensiblePackageImpl)(EPackage.Registry.INSTANCE.getEPackage(ExtensiblePackage.eNS_URI) instanceof ExtensiblePackageImpl ? EPackage.Registry.INSTANCE.getEPackage(ExtensiblePackage.eNS_URI) : ExtensiblePackage.eINSTANCE); + QueryPackageImpl theQueryPackage = (QueryPackageImpl)(EPackage.Registry.INSTANCE.getEPackage(QueryPackage.eNS_URI) instanceof QueryPackageImpl ? EPackage.Registry.INSTANCE.getEPackage(QueryPackage.eNS_URI) : QueryPackage.eINSTANCE); + RuntimePackageImpl theRuntimePackage = (RuntimePackageImpl)(EPackage.Registry.INSTANCE.getEPackage(RuntimePackage.eNS_URI) instanceof RuntimePackageImpl ? EPackage.Registry.INSTANCE.getEPackage(RuntimePackage.eNS_URI) : RuntimePackage.eINSTANCE); + + // Create package meta-data objects + theSerializationPackage.createPackageContents(); + theEFacetPackage.createPackageContents(); + theExtensiblePackage.createPackageContents(); + theQueryPackage.createPackageContents(); + theRuntimePackage.createPackageContents(); + + // Initialize created meta-data + theSerializationPackage.initializePackageContents(); + theEFacetPackage.initializePackageContents(); + theExtensiblePackage.initializePackageContents(); + theQueryPackage.initializePackageContents(); + theRuntimePackage.initializePackageContents(); + + // Mark meta-data to indicate it can't be changed + theSerializationPackage.freeze(); + + + // Update the registry and return the package + EPackage.Registry.INSTANCE.put(SerializationPackage.eNS_URI, theSerializationPackage); + return theSerializationPackage; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public EClass getAbstractReferenceInstance() { + return abstractReferenceInstanceEClass; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public EReference getAbstractReferenceInstance_EReference() { + return (EReference)abstractReferenceInstanceEClass.getEStructuralFeatures().get(0); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public EClass getMultiValuedContainmentReferenceInstance() { + return multiValuedContainmentReferenceInstanceEClass; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public EReference getMultiValuedContainmentReferenceInstance_OwnedElements() { + return (EReference)multiValuedContainmentReferenceInstanceEClass.getEStructuralFeatures().get(0); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public EClass getMultiValuedReferenceInstance() { + return multiValuedReferenceInstanceEClass; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public EReference getMultiValuedReferenceInstance_ReferencedElements() { + return (EReference)multiValuedReferenceInstanceEClass.getEStructuralFeatures().get(0); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public EClass getSingleValuedAttributeInstance() { + return singleValuedAttributeInstanceEClass; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public EAttribute getSingleValuedAttributeInstance_Value() { + return (EAttribute)singleValuedAttributeInstanceEClass.getEStructuralFeatures().get(0); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public EClass getExtendedEObjectReference() { + return extendedEObjectReferenceEClass; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public EReference getExtendedEObjectReference_ExtendedEObject() { + return (EReference)extendedEObjectReferenceEClass.getEStructuralFeatures().get(0); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public EReference getExtendedEObjectReference_AttributeInstances() { + return (EReference)extendedEObjectReferenceEClass.getEStructuralFeatures().get(1); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public EReference getExtendedEObjectReference_ReferenceInstances() { + return (EReference)extendedEObjectReferenceEClass.getEStructuralFeatures().get(2); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public EClass getSingleValuedContainmentReferenceInstance() { + return singleValuedContainmentReferenceInstanceEClass; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public EReference getSingleValuedContainmentReferenceInstance_OwnedElement() { + return (EReference)singleValuedContainmentReferenceInstanceEClass.getEStructuralFeatures().get(0); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public EClass getSingleValuedReferenceInstance() { + return singleValuedReferenceInstanceEClass; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public EReference getSingleValuedReferenceInstance_ReferencedElement() { + return (EReference)singleValuedReferenceInstanceEClass.getEStructuralFeatures().get(0); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public EClass getMultiValuedAttributeInstance() { + return multiValuedAttributeInstanceEClass; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public EAttribute getMultiValuedAttributeInstance_Values() { + return (EAttribute)multiValuedAttributeInstanceEClass.getEStructuralFeatures().get(0); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public EClass getAbstractAttributeInstance() { + return abstractAttributeInstanceEClass; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public EReference getAbstractAttributeInstance_EAttribute() { + return (EReference)abstractAttributeInstanceEClass.getEStructuralFeatures().get(0); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public SerializationFactory getSerializationFactory() { + return (SerializationFactory)getEFactoryInstance(); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + private boolean isCreated = false; + + /** + * Creates the meta-model objects for the package. This method is + * guarded to have no affect on any invocation but its first. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public void createPackageContents() { + if (isCreated) return; + isCreated = true; + + // Create classes and their features + abstractReferenceInstanceEClass = createEClass(ABSTRACT_REFERENCE_INSTANCE); + createEReference(abstractReferenceInstanceEClass, ABSTRACT_REFERENCE_INSTANCE__EREFERENCE); + + multiValuedContainmentReferenceInstanceEClass = createEClass(MULTI_VALUED_CONTAINMENT_REFERENCE_INSTANCE); + createEReference(multiValuedContainmentReferenceInstanceEClass, MULTI_VALUED_CONTAINMENT_REFERENCE_INSTANCE__OWNED_ELEMENTS); + + multiValuedReferenceInstanceEClass = createEClass(MULTI_VALUED_REFERENCE_INSTANCE); + createEReference(multiValuedReferenceInstanceEClass, MULTI_VALUED_REFERENCE_INSTANCE__REFERENCED_ELEMENTS); + + singleValuedAttributeInstanceEClass = createEClass(SINGLE_VALUED_ATTRIBUTE_INSTANCE); + createEAttribute(singleValuedAttributeInstanceEClass, SINGLE_VALUED_ATTRIBUTE_INSTANCE__VALUE); + + extendedEObjectReferenceEClass = createEClass(EXTENDED_EOBJECT_REFERENCE); + createEReference(extendedEObjectReferenceEClass, EXTENDED_EOBJECT_REFERENCE__EXTENDED_EOBJECT); + createEReference(extendedEObjectReferenceEClass, EXTENDED_EOBJECT_REFERENCE__ATTRIBUTE_INSTANCES); + createEReference(extendedEObjectReferenceEClass, EXTENDED_EOBJECT_REFERENCE__REFERENCE_INSTANCES); + + singleValuedContainmentReferenceInstanceEClass = createEClass(SINGLE_VALUED_CONTAINMENT_REFERENCE_INSTANCE); + createEReference(singleValuedContainmentReferenceInstanceEClass, SINGLE_VALUED_CONTAINMENT_REFERENCE_INSTANCE__OWNED_ELEMENT); + + singleValuedReferenceInstanceEClass = createEClass(SINGLE_VALUED_REFERENCE_INSTANCE); + createEReference(singleValuedReferenceInstanceEClass, SINGLE_VALUED_REFERENCE_INSTANCE__REFERENCED_ELEMENT); + + multiValuedAttributeInstanceEClass = createEClass(MULTI_VALUED_ATTRIBUTE_INSTANCE); + createEAttribute(multiValuedAttributeInstanceEClass, MULTI_VALUED_ATTRIBUTE_INSTANCE__VALUES); + + abstractAttributeInstanceEClass = createEClass(ABSTRACT_ATTRIBUTE_INSTANCE); + createEReference(abstractAttributeInstanceEClass, ABSTRACT_ATTRIBUTE_INSTANCE__EATTRIBUTE); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + private boolean isInitialized = false; + + /** + * Complete the initialization of the package and its meta-model. This + * method is guarded to have no affect on any invocation but its first. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public void initializePackageContents() { + if (isInitialized) return; + isInitialized = true; + + // Initialize package + setName(eNAME); + setNsPrefix(eNS_PREFIX); + setNsURI(eNS_URI); + + // Create type parameters + + // Set bounds for type parameters + + // Add supertypes to classes + multiValuedContainmentReferenceInstanceEClass.getESuperTypes().add(this.getAbstractReferenceInstance()); + multiValuedReferenceInstanceEClass.getESuperTypes().add(this.getAbstractReferenceInstance()); + singleValuedAttributeInstanceEClass.getESuperTypes().add(this.getAbstractAttributeInstance()); + singleValuedContainmentReferenceInstanceEClass.getESuperTypes().add(this.getAbstractReferenceInstance()); + singleValuedReferenceInstanceEClass.getESuperTypes().add(this.getAbstractReferenceInstance()); + multiValuedAttributeInstanceEClass.getESuperTypes().add(this.getAbstractAttributeInstance()); + + // Initialize classes and features; add operations and parameters + initEClass(abstractReferenceInstanceEClass, AbstractReferenceInstance.class, "AbstractReferenceInstance", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); //$NON-NLS-1$ + initEReference(getAbstractReferenceInstance_EReference(), ecorePackage.getEReference(), null, "eReference", null, 1, 1, AbstractReferenceInstance.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); //$NON-NLS-1$ + + initEClass(multiValuedContainmentReferenceInstanceEClass, MultiValuedContainmentReferenceInstance.class, "MultiValuedContainmentReferenceInstance", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); //$NON-NLS-1$ + initEReference(getMultiValuedContainmentReferenceInstance_OwnedElements(), ecorePackage.getEObject(), null, "ownedElements", null, 0, -1, MultiValuedContainmentReferenceInstance.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); //$NON-NLS-1$ + + initEClass(multiValuedReferenceInstanceEClass, MultiValuedReferenceInstance.class, "MultiValuedReferenceInstance", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); //$NON-NLS-1$ + initEReference(getMultiValuedReferenceInstance_ReferencedElements(), ecorePackage.getEObject(), null, "referencedElements", null, 0, -1, MultiValuedReferenceInstance.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); //$NON-NLS-1$ + + initEClass(singleValuedAttributeInstanceEClass, SingleValuedAttributeInstance.class, "SingleValuedAttributeInstance", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); //$NON-NLS-1$ + initEAttribute(getSingleValuedAttributeInstance_Value(), ecorePackage.getEJavaObject(), "value", null, 0, 1, SingleValuedAttributeInstance.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); //$NON-NLS-1$ + + initEClass(extendedEObjectReferenceEClass, ExtendedEObjectReference.class, "ExtendedEObjectReference", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); //$NON-NLS-1$ + initEReference(getExtendedEObjectReference_ExtendedEObject(), ecorePackage.getEObject(), null, "extendedEObject", null, 1, 1, ExtendedEObjectReference.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); //$NON-NLS-1$ + initEReference(getExtendedEObjectReference_AttributeInstances(), this.getAbstractAttributeInstance(), null, "attributeInstances", null, 0, -1, ExtendedEObjectReference.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); //$NON-NLS-1$ + initEReference(getExtendedEObjectReference_ReferenceInstances(), this.getAbstractReferenceInstance(), null, "referenceInstances", null, 0, -1, ExtendedEObjectReference.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); //$NON-NLS-1$ + + initEClass(singleValuedContainmentReferenceInstanceEClass, SingleValuedContainmentReferenceInstance.class, "SingleValuedContainmentReferenceInstance", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); //$NON-NLS-1$ + initEReference(getSingleValuedContainmentReferenceInstance_OwnedElement(), ecorePackage.getEObject(), null, "ownedElement", null, 0, 1, SingleValuedContainmentReferenceInstance.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); //$NON-NLS-1$ + + initEClass(singleValuedReferenceInstanceEClass, SingleValuedReferenceInstance.class, "SingleValuedReferenceInstance", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); //$NON-NLS-1$ + initEReference(getSingleValuedReferenceInstance_ReferencedElement(), ecorePackage.getEObject(), null, "referencedElement", null, 0, 1, SingleValuedReferenceInstance.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); //$NON-NLS-1$ + + initEClass(multiValuedAttributeInstanceEClass, MultiValuedAttributeInstance.class, "MultiValuedAttributeInstance", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); //$NON-NLS-1$ + initEAttribute(getMultiValuedAttributeInstance_Values(), ecorePackage.getEJavaObject(), "values", null, 0, -1, MultiValuedAttributeInstance.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); //$NON-NLS-1$ + + initEClass(abstractAttributeInstanceEClass, AbstractAttributeInstance.class, "AbstractAttributeInstance", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); //$NON-NLS-1$ + initEReference(getAbstractAttributeInstance_EAttribute(), ecorePackage.getEAttribute(), null, "eAttribute", null, 1, 1, AbstractAttributeInstance.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); //$NON-NLS-1$ + } + +} //SerializationPackageImpl
diff --git a/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/modisco/facet/efacet/metamodel/v0_2_0/efacet/serialization/impl/SingleValuedAttributeInstanceImpl.java b/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/modisco/facet/efacet/metamodel/v0_2_0/efacet/serialization/impl/SingleValuedAttributeInstanceImpl.java new file mode 100644 index 0000000..40884d3 --- /dev/null +++ b/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/modisco/facet/efacet/metamodel/v0_2_0/efacet/serialization/impl/SingleValuedAttributeInstanceImpl.java
@@ -0,0 +1,171 @@ +/** + * Copyright (c) 2011 Mia-Software. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Gregoire Dupe (Mia-Software) - Design + * Nicolas Guyomar (Mia-Software) - Implementation + * Emmanuelle Rouillé (Mia-Software) - Bug 352618 - To be able to use non derived facet structural features and save them values. + * Nicolas Bros (Mia-Software) - Bug 361823 - [Restructuring] eFacet2 meta-model + */ +package org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.serialization.impl; + +import org.eclipse.emf.common.notify.Notification; +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.impl.ENotificationImpl; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.serialization.SerializationPackage; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.serialization.SingleValuedAttributeInstance; + +/** + * <!-- begin-user-doc --> + * An implementation of the model object '<em><b>Single Valued Attribute Instance</b></em>'. + * <!-- end-user-doc --> + * <p> + * The following features are implemented: + * <ul> + * <li>{@link org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.serialization.impl.SingleValuedAttributeInstanceImpl#getValue <em>Value</em>}</li> + * </ul> + * </p> + * + * @generated + */ +public class SingleValuedAttributeInstanceImpl extends AbstractAttributeInstanceImpl implements SingleValuedAttributeInstance { + /** + * The default value of the '{@link #getValue() <em>Value</em>}' attribute. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @see #getValue() + * @generated + * @ordered + */ + protected static final Object VALUE_EDEFAULT = null; + + /** + * The cached value of the '{@link #getValue() <em>Value</em>}' attribute. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @see #getValue() + * @generated + * @ordered + */ + protected Object value = VALUE_EDEFAULT; + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + protected SingleValuedAttributeInstanceImpl() { + super(); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + protected EClass eStaticClass() { + return SerializationPackage.Literals.SINGLE_VALUED_ATTRIBUTE_INSTANCE; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public Object getValue() { + return value; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public void setValue(Object newValue) { + Object oldValue = value; + value = newValue; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.SET, SerializationPackage.SINGLE_VALUED_ATTRIBUTE_INSTANCE__VALUE, oldValue, value)); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + public Object eGet(int featureID, boolean resolve, boolean coreType) { + switch (featureID) { + case SerializationPackage.SINGLE_VALUED_ATTRIBUTE_INSTANCE__VALUE: + return getValue(); + } + return super.eGet(featureID, resolve, coreType); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + public void eSet(int featureID, Object newValue) { + switch (featureID) { + case SerializationPackage.SINGLE_VALUED_ATTRIBUTE_INSTANCE__VALUE: + setValue(newValue); + return; + } + super.eSet(featureID, newValue); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + public void eUnset(int featureID) { + switch (featureID) { + case SerializationPackage.SINGLE_VALUED_ATTRIBUTE_INSTANCE__VALUE: + setValue(VALUE_EDEFAULT); + return; + } + super.eUnset(featureID); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + public boolean eIsSet(int featureID) { + switch (featureID) { + case SerializationPackage.SINGLE_VALUED_ATTRIBUTE_INSTANCE__VALUE: + return VALUE_EDEFAULT == null ? value != null : !VALUE_EDEFAULT.equals(value); + } + return super.eIsSet(featureID); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + public String toString() { + if (eIsProxy()) return super.toString(); + + StringBuffer result = new StringBuffer(super.toString()); + result.append(" (value: "); //$NON-NLS-1$ + result.append(value); + result.append(')'); + return result.toString(); + } + +} //SingleValuedAttributeInstanceImpl
diff --git a/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/modisco/facet/efacet/metamodel/v0_2_0/efacet/serialization/impl/SingleValuedContainmentReferenceInstanceImpl.java b/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/modisco/facet/efacet/metamodel/v0_2_0/efacet/serialization/impl/SingleValuedContainmentReferenceInstanceImpl.java new file mode 100644 index 0000000..f805c37 --- /dev/null +++ b/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/modisco/facet/efacet/metamodel/v0_2_0/efacet/serialization/impl/SingleValuedContainmentReferenceInstanceImpl.java
@@ -0,0 +1,184 @@ +/** + * Copyright (c) 2011 Mia-Software. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Gregoire Dupe (Mia-Software) - Design + * Nicolas Guyomar (Mia-Software) - Implementation + * Emmanuelle Rouillé (Mia-Software) - Bug 352618 - To be able to use non derived facet structural features and save them values. + * Nicolas Bros (Mia-Software) - Bug 361823 - [Restructuring] eFacet2 meta-model + */ +package org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.serialization.impl; + +import org.eclipse.emf.common.notify.Notification; +import org.eclipse.emf.common.notify.NotificationChain; +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.ecore.InternalEObject; +import org.eclipse.emf.ecore.impl.ENotificationImpl; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.serialization.SerializationPackage; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.serialization.SingleValuedContainmentReferenceInstance; + +/** + * <!-- begin-user-doc --> + * An implementation of the model object '<em><b>Single Valued Containment Reference Instance</b></em>'. + * <!-- end-user-doc --> + * <p> + * The following features are implemented: + * <ul> + * <li>{@link org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.serialization.impl.SingleValuedContainmentReferenceInstanceImpl#getOwnedElement <em>Owned Element</em>}</li> + * </ul> + * </p> + * + * @generated + */ +public class SingleValuedContainmentReferenceInstanceImpl extends AbstractReferenceInstanceImpl implements SingleValuedContainmentReferenceInstance { + /** + * The cached value of the '{@link #getOwnedElement() <em>Owned Element</em>}' containment reference. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @see #getOwnedElement() + * @generated + * @ordered + */ + protected EObject ownedElement; + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + protected SingleValuedContainmentReferenceInstanceImpl() { + super(); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + protected EClass eStaticClass() { + return SerializationPackage.Literals.SINGLE_VALUED_CONTAINMENT_REFERENCE_INSTANCE; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public EObject getOwnedElement() { + return ownedElement; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public NotificationChain basicSetOwnedElement(EObject newOwnedElement, NotificationChain msgs) { + EObject oldOwnedElement = ownedElement; + ownedElement = newOwnedElement; + if (eNotificationRequired()) { + ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, SerializationPackage.SINGLE_VALUED_CONTAINMENT_REFERENCE_INSTANCE__OWNED_ELEMENT, oldOwnedElement, newOwnedElement); + if (msgs == null) msgs = notification; else msgs.add(notification); + } + return msgs; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public void setOwnedElement(EObject newOwnedElement) { + if (newOwnedElement != ownedElement) { + NotificationChain msgs = null; + if (ownedElement != null) + msgs = ((InternalEObject)ownedElement).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - SerializationPackage.SINGLE_VALUED_CONTAINMENT_REFERENCE_INSTANCE__OWNED_ELEMENT, null, msgs); + if (newOwnedElement != null) + msgs = ((InternalEObject)newOwnedElement).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - SerializationPackage.SINGLE_VALUED_CONTAINMENT_REFERENCE_INSTANCE__OWNED_ELEMENT, null, msgs); + msgs = basicSetOwnedElement(newOwnedElement, msgs); + if (msgs != null) msgs.dispatch(); + } + else if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.SET, SerializationPackage.SINGLE_VALUED_CONTAINMENT_REFERENCE_INSTANCE__OWNED_ELEMENT, newOwnedElement, newOwnedElement)); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { + switch (featureID) { + case SerializationPackage.SINGLE_VALUED_CONTAINMENT_REFERENCE_INSTANCE__OWNED_ELEMENT: + return basicSetOwnedElement(null, msgs); + } + return super.eInverseRemove(otherEnd, featureID, msgs); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + public Object eGet(int featureID, boolean resolve, boolean coreType) { + switch (featureID) { + case SerializationPackage.SINGLE_VALUED_CONTAINMENT_REFERENCE_INSTANCE__OWNED_ELEMENT: + return getOwnedElement(); + } + return super.eGet(featureID, resolve, coreType); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + public void eSet(int featureID, Object newValue) { + switch (featureID) { + case SerializationPackage.SINGLE_VALUED_CONTAINMENT_REFERENCE_INSTANCE__OWNED_ELEMENT: + setOwnedElement((EObject)newValue); + return; + } + super.eSet(featureID, newValue); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + public void eUnset(int featureID) { + switch (featureID) { + case SerializationPackage.SINGLE_VALUED_CONTAINMENT_REFERENCE_INSTANCE__OWNED_ELEMENT: + setOwnedElement((EObject)null); + return; + } + super.eUnset(featureID); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + public boolean eIsSet(int featureID) { + switch (featureID) { + case SerializationPackage.SINGLE_VALUED_CONTAINMENT_REFERENCE_INSTANCE__OWNED_ELEMENT: + return ownedElement != null; + } + return super.eIsSet(featureID); + } + +} //SingleValuedContainmentReferenceInstanceImpl
diff --git a/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/modisco/facet/efacet/metamodel/v0_2_0/efacet/serialization/impl/SingleValuedReferenceInstanceImpl.java b/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/modisco/facet/efacet/metamodel/v0_2_0/efacet/serialization/impl/SingleValuedReferenceInstanceImpl.java new file mode 100644 index 0000000..67798c9 --- /dev/null +++ b/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/modisco/facet/efacet/metamodel/v0_2_0/efacet/serialization/impl/SingleValuedReferenceInstanceImpl.java
@@ -0,0 +1,165 @@ +/** + * Copyright (c) 2011 Mia-Software. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Gregoire Dupe (Mia-Software) - Design + * Nicolas Guyomar (Mia-Software) - Implementation + * Emmanuelle Rouillé (Mia-Software) - Bug 352618 - To be able to use non derived facet structural features and save them values. + * Nicolas Bros (Mia-Software) - Bug 361823 - [Restructuring] eFacet2 meta-model + */ +package org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.serialization.impl; + +import org.eclipse.emf.common.notify.Notification; +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.ecore.InternalEObject; +import org.eclipse.emf.ecore.impl.ENotificationImpl; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.serialization.SerializationPackage; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.serialization.SingleValuedReferenceInstance; + +/** + * <!-- begin-user-doc --> + * An implementation of the model object '<em><b>Single Valued Reference Instance</b></em>'. + * <!-- end-user-doc --> + * <p> + * The following features are implemented: + * <ul> + * <li>{@link org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.serialization.impl.SingleValuedReferenceInstanceImpl#getReferencedElement <em>Referenced Element</em>}</li> + * </ul> + * </p> + * + * @generated + */ +public class SingleValuedReferenceInstanceImpl extends AbstractReferenceInstanceImpl implements SingleValuedReferenceInstance { + /** + * The cached value of the '{@link #getReferencedElement() <em>Referenced Element</em>}' reference. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @see #getReferencedElement() + * @generated + * @ordered + */ + protected EObject referencedElement; + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + protected SingleValuedReferenceInstanceImpl() { + super(); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + protected EClass eStaticClass() { + return SerializationPackage.Literals.SINGLE_VALUED_REFERENCE_INSTANCE; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public EObject getReferencedElement() { + if (referencedElement != null && referencedElement.eIsProxy()) { + InternalEObject oldReferencedElement = (InternalEObject)referencedElement; + referencedElement = eResolveProxy(oldReferencedElement); + if (referencedElement != oldReferencedElement) { + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.RESOLVE, SerializationPackage.SINGLE_VALUED_REFERENCE_INSTANCE__REFERENCED_ELEMENT, oldReferencedElement, referencedElement)); + } + } + return referencedElement; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public EObject basicGetReferencedElement() { + return referencedElement; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public void setReferencedElement(EObject newReferencedElement) { + EObject oldReferencedElement = referencedElement; + referencedElement = newReferencedElement; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.SET, SerializationPackage.SINGLE_VALUED_REFERENCE_INSTANCE__REFERENCED_ELEMENT, oldReferencedElement, referencedElement)); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + public Object eGet(int featureID, boolean resolve, boolean coreType) { + switch (featureID) { + case SerializationPackage.SINGLE_VALUED_REFERENCE_INSTANCE__REFERENCED_ELEMENT: + if (resolve) return getReferencedElement(); + return basicGetReferencedElement(); + } + return super.eGet(featureID, resolve, coreType); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + public void eSet(int featureID, Object newValue) { + switch (featureID) { + case SerializationPackage.SINGLE_VALUED_REFERENCE_INSTANCE__REFERENCED_ELEMENT: + setReferencedElement((EObject)newValue); + return; + } + super.eSet(featureID, newValue); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + public void eUnset(int featureID) { + switch (featureID) { + case SerializationPackage.SINGLE_VALUED_REFERENCE_INSTANCE__REFERENCED_ELEMENT: + setReferencedElement((EObject)null); + return; + } + super.eUnset(featureID); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + public boolean eIsSet(int featureID) { + switch (featureID) { + case SerializationPackage.SINGLE_VALUED_REFERENCE_INSTANCE__REFERENCED_ELEMENT: + return referencedElement != null; + } + return super.eIsSet(featureID); + } + +} //SingleValuedReferenceInstanceImpl
diff --git a/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/modisco/facet/efacet/metamodel/v0_2_0/efacet/serialization/util/SerializationAdapterFactory.java b/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/modisco/facet/efacet/metamodel/v0_2_0/efacet/serialization/util/SerializationAdapterFactory.java new file mode 100644 index 0000000..43db5c1 --- /dev/null +++ b/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/modisco/facet/efacet/metamodel/v0_2_0/efacet/serialization/util/SerializationAdapterFactory.java
@@ -0,0 +1,273 @@ +/** + * Copyright (c) 2011 Mia-Software. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Gregoire Dupe (Mia-Software) - Design + * Nicolas Guyomar (Mia-Software) - Implementation + * Emmanuelle Rouillé (Mia-Software) - Bug 352618 - To be able to use non derived facet structural features and save them values. + * Nicolas Bros (Mia-Software) - Bug 361823 - [Restructuring] eFacet2 meta-model + */ +package org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.serialization.util; + +import org.eclipse.emf.common.notify.Adapter; +import org.eclipse.emf.common.notify.Notifier; +import org.eclipse.emf.common.notify.impl.AdapterFactoryImpl; +import org.eclipse.emf.ecore.EObject; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.serialization.*; + +/** + * <!-- begin-user-doc --> + * The <b>Adapter Factory</b> for the model. + * It provides an adapter <code>createXXX</code> method for each class of the model. + * <!-- end-user-doc --> + * @see org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.serialization.SerializationPackage + * @generated + */ +public class SerializationAdapterFactory extends AdapterFactoryImpl { + /** + * The cached model package. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + protected static SerializationPackage modelPackage; + + /** + * Creates an instance of the adapter factory. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public SerializationAdapterFactory() { + if (modelPackage == null) { + modelPackage = SerializationPackage.eINSTANCE; + } + } + + /** + * Returns whether this factory is applicable for the type of the object. + * <!-- begin-user-doc --> + * This implementation returns <code>true</code> if the object is either the model's package or is an instance object of the model. + * <!-- end-user-doc --> + * @return whether this factory is applicable for the type of the object. + * @generated + */ + @Override + public boolean isFactoryForType(Object object) { + if (object == modelPackage) { + return true; + } + if (object instanceof EObject) { + return ((EObject)object).eClass().getEPackage() == modelPackage; + } + return false; + } + + /** + * The switch that delegates to the <code>createXXX</code> methods. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + protected SerializationSwitch<Adapter> modelSwitch = + new SerializationSwitch<Adapter>() { + @Override + public Adapter caseAbstractReferenceInstance(AbstractReferenceInstance object) { + return createAbstractReferenceInstanceAdapter(); + } + @Override + public Adapter caseMultiValuedContainmentReferenceInstance(MultiValuedContainmentReferenceInstance object) { + return createMultiValuedContainmentReferenceInstanceAdapter(); + } + @Override + public Adapter caseMultiValuedReferenceInstance(MultiValuedReferenceInstance object) { + return createMultiValuedReferenceInstanceAdapter(); + } + @Override + public Adapter caseSingleValuedAttributeInstance(SingleValuedAttributeInstance object) { + return createSingleValuedAttributeInstanceAdapter(); + } + @Override + public Adapter caseExtendedEObjectReference(ExtendedEObjectReference object) { + return createExtendedEObjectReferenceAdapter(); + } + @Override + public Adapter caseSingleValuedContainmentReferenceInstance(SingleValuedContainmentReferenceInstance object) { + return createSingleValuedContainmentReferenceInstanceAdapter(); + } + @Override + public Adapter caseSingleValuedReferenceInstance(SingleValuedReferenceInstance object) { + return createSingleValuedReferenceInstanceAdapter(); + } + @Override + public Adapter caseMultiValuedAttributeInstance(MultiValuedAttributeInstance object) { + return createMultiValuedAttributeInstanceAdapter(); + } + @Override + public Adapter caseAbstractAttributeInstance(AbstractAttributeInstance object) { + return createAbstractAttributeInstanceAdapter(); + } + @Override + public Adapter defaultCase(EObject object) { + return createEObjectAdapter(); + } + }; + + /** + * Creates an adapter for the <code>target</code>. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @param target the object to adapt. + * @return the adapter for the <code>target</code>. + * @generated + */ + @Override + public Adapter createAdapter(Notifier target) { + return modelSwitch.doSwitch((EObject)target); + } + + + /** + * Creates a new adapter for an object of class '{@link org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.serialization.AbstractReferenceInstance <em>Abstract Reference Instance</em>}'. + * <!-- begin-user-doc --> + * This default implementation returns null so that we can easily ignore cases; + * it's useful to ignore a case when inheritance will catch all the cases anyway. + * <!-- end-user-doc --> + * @return the new adapter. + * @see org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.serialization.AbstractReferenceInstance + * @generated + */ + public Adapter createAbstractReferenceInstanceAdapter() { + return null; + } + + /** + * Creates a new adapter for an object of class '{@link org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.serialization.MultiValuedContainmentReferenceInstance <em>Multi Valued Containment Reference Instance</em>}'. + * <!-- begin-user-doc --> + * This default implementation returns null so that we can easily ignore cases; + * it's useful to ignore a case when inheritance will catch all the cases anyway. + * <!-- end-user-doc --> + * @return the new adapter. + * @see org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.serialization.MultiValuedContainmentReferenceInstance + * @generated + */ + public Adapter createMultiValuedContainmentReferenceInstanceAdapter() { + return null; + } + + /** + * Creates a new adapter for an object of class '{@link org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.serialization.MultiValuedReferenceInstance <em>Multi Valued Reference Instance</em>}'. + * <!-- begin-user-doc --> + * This default implementation returns null so that we can easily ignore cases; + * it's useful to ignore a case when inheritance will catch all the cases anyway. + * <!-- end-user-doc --> + * @return the new adapter. + * @see org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.serialization.MultiValuedReferenceInstance + * @generated + */ + public Adapter createMultiValuedReferenceInstanceAdapter() { + return null; + } + + /** + * Creates a new adapter for an object of class '{@link org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.serialization.SingleValuedAttributeInstance <em>Single Valued Attribute Instance</em>}'. + * <!-- begin-user-doc --> + * This default implementation returns null so that we can easily ignore cases; + * it's useful to ignore a case when inheritance will catch all the cases anyway. + * <!-- end-user-doc --> + * @return the new adapter. + * @see org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.serialization.SingleValuedAttributeInstance + * @generated + */ + public Adapter createSingleValuedAttributeInstanceAdapter() { + return null; + } + + /** + * Creates a new adapter for an object of class '{@link org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.serialization.ExtendedEObjectReference <em>Extended EObject Reference</em>}'. + * <!-- begin-user-doc --> + * This default implementation returns null so that we can easily ignore cases; + * it's useful to ignore a case when inheritance will catch all the cases anyway. + * <!-- end-user-doc --> + * @return the new adapter. + * @see org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.serialization.ExtendedEObjectReference + * @generated + */ + public Adapter createExtendedEObjectReferenceAdapter() { + return null; + } + + /** + * Creates a new adapter for an object of class '{@link org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.serialization.SingleValuedContainmentReferenceInstance <em>Single Valued Containment Reference Instance</em>}'. + * <!-- begin-user-doc --> + * This default implementation returns null so that we can easily ignore cases; + * it's useful to ignore a case when inheritance will catch all the cases anyway. + * <!-- end-user-doc --> + * @return the new adapter. + * @see org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.serialization.SingleValuedContainmentReferenceInstance + * @generated + */ + public Adapter createSingleValuedContainmentReferenceInstanceAdapter() { + return null; + } + + /** + * Creates a new adapter for an object of class '{@link org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.serialization.SingleValuedReferenceInstance <em>Single Valued Reference Instance</em>}'. + * <!-- begin-user-doc --> + * This default implementation returns null so that we can easily ignore cases; + * it's useful to ignore a case when inheritance will catch all the cases anyway. + * <!-- end-user-doc --> + * @return the new adapter. + * @see org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.serialization.SingleValuedReferenceInstance + * @generated + */ + public Adapter createSingleValuedReferenceInstanceAdapter() { + return null; + } + + /** + * Creates a new adapter for an object of class '{@link org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.serialization.MultiValuedAttributeInstance <em>Multi Valued Attribute Instance</em>}'. + * <!-- begin-user-doc --> + * This default implementation returns null so that we can easily ignore cases; + * it's useful to ignore a case when inheritance will catch all the cases anyway. + * <!-- end-user-doc --> + * @return the new adapter. + * @see org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.serialization.MultiValuedAttributeInstance + * @generated + */ + public Adapter createMultiValuedAttributeInstanceAdapter() { + return null; + } + + /** + * Creates a new adapter for an object of class '{@link org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.serialization.AbstractAttributeInstance <em>Abstract Attribute Instance</em>}'. + * <!-- begin-user-doc --> + * This default implementation returns null so that we can easily ignore cases; + * it's useful to ignore a case when inheritance will catch all the cases anyway. + * <!-- end-user-doc --> + * @return the new adapter. + * @see org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.serialization.AbstractAttributeInstance + * @generated + */ + public Adapter createAbstractAttributeInstanceAdapter() { + return null; + } + + /** + * Creates a new adapter for the default case. + * <!-- begin-user-doc --> + * This default implementation returns null. + * <!-- end-user-doc --> + * @return the new adapter. + * @generated + */ + public Adapter createEObjectAdapter() { + return null; + } + +} //SerializationAdapterFactory
diff --git a/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/modisco/facet/efacet/metamodel/v0_2_0/efacet/serialization/util/SerializationSwitch.java b/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/modisco/facet/efacet/metamodel/v0_2_0/efacet/serialization/util/SerializationSwitch.java new file mode 100644 index 0000000..a6e8d5f --- /dev/null +++ b/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/modisco/facet/efacet/metamodel/v0_2_0/efacet/serialization/util/SerializationSwitch.java
@@ -0,0 +1,315 @@ +/** + * Copyright (c) 2011 Mia-Software. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Gregoire Dupe (Mia-Software) - Design + * Nicolas Guyomar (Mia-Software) - Implementation + * Emmanuelle Rouillé (Mia-Software) - Bug 352618 - To be able to use non derived facet structural features and save them values. + * Nicolas Bros (Mia-Software) - Bug 361823 - [Restructuring] eFacet2 meta-model + * Gregoire Dupe (Mia-Software) - Bug 366055 - NavigationQuery + * Gregoire Dupe (Mia-Software) - Bug 369673 - [Facet] IsOneOfQuery + * Olivier Remaud (Soft-Maint) - Bug 369824 - Add a simple way to return string literal constants from a customization query + * Gregoire Dupe (Mia-software) - Bug 369987 - [Restructuring][Table] Switch to the new customization and facet framework + */ +package org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.serialization.util; + +import java.util.List; + +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.EObject; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.serialization.*; + +/** + * <!-- begin-user-doc --> + * The <b>Switch</b> for the model's inheritance hierarchy. + * It supports the call {@link #doSwitch(EObject) doSwitch(object)} + * to invoke the <code>caseXXX</code> method for each class of the model, + * starting with the actual class of the object + * and proceeding up the inheritance hierarchy + * until a non-null result is returned, + * which is the result of the switch. + * <!-- end-user-doc --> + * @see org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.serialization.SerializationPackage + * @generated + */ +public class SerializationSwitch<T> { + /** + * The cached model package + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + protected static SerializationPackage modelPackage; + + /** + * Creates an instance of the switch. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public SerializationSwitch() { + if (modelPackage == null) { + modelPackage = SerializationPackage.eINSTANCE; + } + } + + /** + * Calls <code>caseXXX</code> for each class of the model until one returns a non null result; it yields that result. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @return the first non-null result returned by a <code>caseXXX</code> call. + * @generated + */ + public T doSwitch(EObject theEObject) { + return doSwitch(theEObject.eClass(), theEObject); + } + + /** + * Calls <code>caseXXX</code> for each class of the model until one returns a non null result; it yields that result. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @return the first non-null result returned by a <code>caseXXX</code> call. + * @generated + */ + protected T doSwitch(EClass theEClass, EObject theEObject) { + if (theEClass.eContainer() == modelPackage) { + return doSwitch(theEClass.getClassifierID(), theEObject); + } + else { + List<EClass> eSuperTypes = theEClass.getESuperTypes(); + return + eSuperTypes.isEmpty() ? + defaultCase(theEObject) : + doSwitch(eSuperTypes.get(0), theEObject); + } + } + + /** + * Calls <code>caseXXX</code> for each class of the model until one returns a non null result; it yields that result. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @return the first non-null result returned by a <code>caseXXX</code> call. + * @generated + */ + protected T doSwitch(int classifierID, EObject theEObject) { + switch (classifierID) { + case SerializationPackage.ABSTRACT_REFERENCE_INSTANCE: { + AbstractReferenceInstance abstractReferenceInstance = (AbstractReferenceInstance)theEObject; + T result = caseAbstractReferenceInstance(abstractReferenceInstance); + if (result == null) result = defaultCase(theEObject); + return result; + } + case SerializationPackage.MULTI_VALUED_CONTAINMENT_REFERENCE_INSTANCE: { + MultiValuedContainmentReferenceInstance multiValuedContainmentReferenceInstance = (MultiValuedContainmentReferenceInstance)theEObject; + T result = caseMultiValuedContainmentReferenceInstance(multiValuedContainmentReferenceInstance); + if (result == null) result = caseAbstractReferenceInstance(multiValuedContainmentReferenceInstance); + if (result == null) result = defaultCase(theEObject); + return result; + } + case SerializationPackage.MULTI_VALUED_REFERENCE_INSTANCE: { + MultiValuedReferenceInstance multiValuedReferenceInstance = (MultiValuedReferenceInstance)theEObject; + T result = caseMultiValuedReferenceInstance(multiValuedReferenceInstance); + if (result == null) result = caseAbstractReferenceInstance(multiValuedReferenceInstance); + if (result == null) result = defaultCase(theEObject); + return result; + } + case SerializationPackage.SINGLE_VALUED_ATTRIBUTE_INSTANCE: { + SingleValuedAttributeInstance singleValuedAttributeInstance = (SingleValuedAttributeInstance)theEObject; + T result = caseSingleValuedAttributeInstance(singleValuedAttributeInstance); + if (result == null) result = caseAbstractAttributeInstance(singleValuedAttributeInstance); + if (result == null) result = defaultCase(theEObject); + return result; + } + case SerializationPackage.EXTENDED_EOBJECT_REFERENCE: { + ExtendedEObjectReference extendedEObjectReference = (ExtendedEObjectReference)theEObject; + T result = caseExtendedEObjectReference(extendedEObjectReference); + if (result == null) result = defaultCase(theEObject); + return result; + } + case SerializationPackage.SINGLE_VALUED_CONTAINMENT_REFERENCE_INSTANCE: { + SingleValuedContainmentReferenceInstance singleValuedContainmentReferenceInstance = (SingleValuedContainmentReferenceInstance)theEObject; + T result = caseSingleValuedContainmentReferenceInstance(singleValuedContainmentReferenceInstance); + if (result == null) result = caseAbstractReferenceInstance(singleValuedContainmentReferenceInstance); + if (result == null) result = defaultCase(theEObject); + return result; + } + case SerializationPackage.SINGLE_VALUED_REFERENCE_INSTANCE: { + SingleValuedReferenceInstance singleValuedReferenceInstance = (SingleValuedReferenceInstance)theEObject; + T result = caseSingleValuedReferenceInstance(singleValuedReferenceInstance); + if (result == null) result = caseAbstractReferenceInstance(singleValuedReferenceInstance); + if (result == null) result = defaultCase(theEObject); + return result; + } + case SerializationPackage.MULTI_VALUED_ATTRIBUTE_INSTANCE: { + MultiValuedAttributeInstance multiValuedAttributeInstance = (MultiValuedAttributeInstance)theEObject; + T result = caseMultiValuedAttributeInstance(multiValuedAttributeInstance); + if (result == null) result = caseAbstractAttributeInstance(multiValuedAttributeInstance); + if (result == null) result = defaultCase(theEObject); + return result; + } + case SerializationPackage.ABSTRACT_ATTRIBUTE_INSTANCE: { + AbstractAttributeInstance abstractAttributeInstance = (AbstractAttributeInstance)theEObject; + T result = caseAbstractAttributeInstance(abstractAttributeInstance); + if (result == null) result = defaultCase(theEObject); + return result; + } + default: return defaultCase(theEObject); + } + } + + /** + * Returns the result of interpreting the object as an instance of '<em>Abstract Reference Instance</em>'. + * <!-- begin-user-doc --> + * This implementation returns null; + * returning a non-null result will terminate the switch. + * <!-- end-user-doc --> + * @param object the target of the switch. + * @return the result of interpreting the object as an instance of '<em>Abstract Reference Instance</em>'. + * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) + * @generated + */ + public T caseAbstractReferenceInstance(AbstractReferenceInstance object) { + return null; + } + + /** + * Returns the result of interpreting the object as an instance of '<em>Multi Valued Containment Reference Instance</em>'. + * <!-- begin-user-doc --> + * This implementation returns null; + * returning a non-null result will terminate the switch. + * <!-- end-user-doc --> + * @param object the target of the switch. + * @return the result of interpreting the object as an instance of '<em>Multi Valued Containment Reference Instance</em>'. + * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) + * @generated + */ + public T caseMultiValuedContainmentReferenceInstance(MultiValuedContainmentReferenceInstance object) { + return null; + } + + /** + * Returns the result of interpreting the object as an instance of '<em>Multi Valued Reference Instance</em>'. + * <!-- begin-user-doc --> + * This implementation returns null; + * returning a non-null result will terminate the switch. + * <!-- end-user-doc --> + * @param object the target of the switch. + * @return the result of interpreting the object as an instance of '<em>Multi Valued Reference Instance</em>'. + * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) + * @generated + */ + public T caseMultiValuedReferenceInstance(MultiValuedReferenceInstance object) { + return null; + } + + /** + * Returns the result of interpreting the object as an instance of '<em>Single Valued Attribute Instance</em>'. + * <!-- begin-user-doc --> + * This implementation returns null; + * returning a non-null result will terminate the switch. + * <!-- end-user-doc --> + * @param object the target of the switch. + * @return the result of interpreting the object as an instance of '<em>Single Valued Attribute Instance</em>'. + * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) + * @generated + */ + public T caseSingleValuedAttributeInstance(SingleValuedAttributeInstance object) { + return null; + } + + /** + * Returns the result of interpreting the object as an instance of '<em>Extended EObject Reference</em>'. + * <!-- begin-user-doc --> + * This implementation returns null; + * returning a non-null result will terminate the switch. + * <!-- end-user-doc --> + * @param object the target of the switch. + * @return the result of interpreting the object as an instance of '<em>Extended EObject Reference</em>'. + * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) + * @generated + */ + public T caseExtendedEObjectReference(ExtendedEObjectReference object) { + return null; + } + + /** + * Returns the result of interpreting the object as an instance of '<em>Single Valued Containment Reference Instance</em>'. + * <!-- begin-user-doc --> + * This implementation returns null; + * returning a non-null result will terminate the switch. + * <!-- end-user-doc --> + * @param object the target of the switch. + * @return the result of interpreting the object as an instance of '<em>Single Valued Containment Reference Instance</em>'. + * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) + * @generated + */ + public T caseSingleValuedContainmentReferenceInstance(SingleValuedContainmentReferenceInstance object) { + return null; + } + + /** + * Returns the result of interpreting the object as an instance of '<em>Single Valued Reference Instance</em>'. + * <!-- begin-user-doc --> + * This implementation returns null; + * returning a non-null result will terminate the switch. + * <!-- end-user-doc --> + * @param object the target of the switch. + * @return the result of interpreting the object as an instance of '<em>Single Valued Reference Instance</em>'. + * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) + * @generated + */ + public T caseSingleValuedReferenceInstance(SingleValuedReferenceInstance object) { + return null; + } + + /** + * Returns the result of interpreting the object as an instance of '<em>Multi Valued Attribute Instance</em>'. + * <!-- begin-user-doc --> + * This implementation returns null; + * returning a non-null result will terminate the switch. + * <!-- end-user-doc --> + * @param object the target of the switch. + * @return the result of interpreting the object as an instance of '<em>Multi Valued Attribute Instance</em>'. + * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) + * @generated + */ + public T caseMultiValuedAttributeInstance(MultiValuedAttributeInstance object) { + return null; + } + + /** + * Returns the result of interpreting the object as an instance of '<em>Abstract Attribute Instance</em>'. + * <!-- begin-user-doc --> + * This implementation returns null; + * returning a non-null result will terminate the switch. + * <!-- end-user-doc --> + * @param object the target of the switch. + * @return the result of interpreting the object as an instance of '<em>Abstract Attribute Instance</em>'. + * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) + * @generated + */ + public T caseAbstractAttributeInstance(AbstractAttributeInstance object) { + return null; + } + + /** + * Returns the result of interpreting the object as an instance of '<em>EObject</em>'. + * <!-- begin-user-doc --> + * This implementation returns null; + * returning a non-null result will terminate the switch, but this is the last case anyway. + * <!-- end-user-doc --> + * @param object the target of the switch. + * @return the result of interpreting the object as an instance of '<em>EObject</em>'. + * @see #doSwitch(org.eclipse.emf.ecore.EObject) + * @generated + */ + public T defaultCase(EObject object) { + return null; + } + +} //SerializationSwitch
diff --git a/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/modisco/facet/efacet/metamodel/v0_2_0/efacet/util/EFacetAdapterFactory.java b/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/modisco/facet/efacet/metamodel/v0_2_0/efacet/util/EFacetAdapterFactory.java new file mode 100644 index 0000000..b8bcf24 --- /dev/null +++ b/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/modisco/facet/efacet/metamodel/v0_2_0/efacet/util/EFacetAdapterFactory.java
@@ -0,0 +1,463 @@ +/** + * Copyright (c) 2011, 2012 Mia-Software. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Gregoire Dupe (Mia-Software) - Design + * Nicolas Guyomar (Mia-Software) - Implementation + * Emmanuelle Rouillé (Mia-Software) - Bug 352618 - To be able to use non derived facet structural features and save them values. + * Nicolas Bros (Mia-Software) - Bug 361823 - [Restructuring] eFacet2 meta-model + * Gregoire Dupe (Mia-Software) - Bug 364325 - [Restructuring] The user must be able to navigate into a model using the Facet. + */ +package org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.util; + +import org.eclipse.emf.common.notify.Adapter; +import org.eclipse.emf.common.notify.Notifier; +import org.eclipse.emf.common.notify.impl.AdapterFactoryImpl; +import org.eclipse.emf.ecore.EAttribute; +import org.eclipse.emf.ecore.EClassifier; +import org.eclipse.emf.ecore.EModelElement; +import org.eclipse.emf.ecore.ENamedElement; +import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.ecore.EOperation; +import org.eclipse.emf.ecore.EPackage; +import org.eclipse.emf.ecore.EReference; +import org.eclipse.emf.ecore.EStructuralFeature; +import org.eclipse.emf.ecore.ETypedElement; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.*; + +/** + * <!-- begin-user-doc --> + * The <b>Adapter Factory</b> for the model. + * It provides an adapter <code>createXXX</code> method for each class of the model. + * <!-- end-user-doc --> + * @see org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.EFacetPackage + * @generated + */ +public class EFacetAdapterFactory extends AdapterFactoryImpl { + /** + * The cached model package. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + protected static EFacetPackage modelPackage; + + /** + * Creates an instance of the adapter factory. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public EFacetAdapterFactory() { + if (modelPackage == null) { + modelPackage = EFacetPackage.eINSTANCE; + } + } + + /** + * Returns whether this factory is applicable for the type of the object. + * <!-- begin-user-doc --> + * This implementation returns <code>true</code> if the object is either the model's package or is an instance object of the model. + * <!-- end-user-doc --> + * @return whether this factory is applicable for the type of the object. + * @generated + */ + @Override + public boolean isFactoryForType(Object object) { + if (object == modelPackage) { + return true; + } + if (object instanceof EObject) { + return ((EObject)object).eClass().getEPackage() == modelPackage; + } + return false; + } + + /** + * The switch that delegates to the <code>createXXX</code> methods. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + protected EFacetSwitch<Adapter> modelSwitch = + new EFacetSwitch<Adapter>() { + @Override + public Adapter caseFacetAttribute(FacetAttribute object) { + return createFacetAttributeAdapter(); + } + @Override + public Adapter caseFacetReference(FacetReference object) { + return createFacetReferenceAdapter(); + } + @Override + public Adapter caseFacetOperation(FacetOperation object) { + return createFacetOperationAdapter(); + } + @Override + public Adapter caseFacetSet(FacetSet object) { + return createFacetSetAdapter(); + } + @Override + public Adapter caseFacet(Facet object) { + return createFacetAdapter(); + } + @Override + public Adapter caseCategory(Category object) { + return createCategoryAdapter(); + } + @Override + public Adapter caseFacetElement(FacetElement object) { + return createFacetElementAdapter(); + } + @Override + public Adapter caseDerivedTypedElement(DerivedTypedElement object) { + return createDerivedTypedElementAdapter(); + } + @Override + public Adapter caseParameterValue(ParameterValue object) { + return createParameterValueAdapter(); + } + @Override + public Adapter caseDocumentedElement(DocumentedElement object) { + return createDocumentedElementAdapter(); + } + @Override + public Adapter caseEModelElement(EModelElement object) { + return createEModelElementAdapter(); + } + @Override + public Adapter caseENamedElement(ENamedElement object) { + return createENamedElementAdapter(); + } + @Override + public Adapter caseETypedElement(ETypedElement object) { + return createETypedElementAdapter(); + } + @Override + public Adapter caseEStructuralFeature(EStructuralFeature object) { + return createEStructuralFeatureAdapter(); + } + @Override + public Adapter caseEAttribute(EAttribute object) { + return createEAttributeAdapter(); + } + @Override + public Adapter caseEReference(EReference object) { + return createEReferenceAdapter(); + } + @Override + public Adapter caseEOperation(EOperation object) { + return createEOperationAdapter(); + } + @Override + public Adapter caseEPackage(EPackage object) { + return createEPackageAdapter(); + } + @Override + public Adapter caseEClassifier(EClassifier object) { + return createEClassifierAdapter(); + } + @Override + public Adapter defaultCase(EObject object) { + return createEObjectAdapter(); + } + }; + + /** + * Creates an adapter for the <code>target</code>. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @param target the object to adapt. + * @return the adapter for the <code>target</code>. + * @generated + */ + @Override + public Adapter createAdapter(Notifier target) { + return modelSwitch.doSwitch((EObject)target); + } + + + /** + * Creates a new adapter for an object of class '{@link org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.FacetAttribute <em>Facet Attribute</em>}'. + * <!-- begin-user-doc --> + * This default implementation returns null so that we can easily ignore cases; + * it's useful to ignore a case when inheritance will catch all the cases anyway. + * <!-- end-user-doc --> + * @return the new adapter. + * @see org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.FacetAttribute + * @generated + */ + public Adapter createFacetAttributeAdapter() { + return null; + } + + /** + * Creates a new adapter for an object of class '{@link org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.FacetReference <em>Facet Reference</em>}'. + * <!-- begin-user-doc --> + * This default implementation returns null so that we can easily ignore cases; + * it's useful to ignore a case when inheritance will catch all the cases anyway. + * <!-- end-user-doc --> + * @return the new adapter. + * @see org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.FacetReference + * @generated + */ + public Adapter createFacetReferenceAdapter() { + return null; + } + + /** + * Creates a new adapter for an object of class '{@link org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.FacetOperation <em>Facet Operation</em>}'. + * <!-- begin-user-doc --> + * This default implementation returns null so that we can easily ignore cases; + * it's useful to ignore a case when inheritance will catch all the cases anyway. + * <!-- end-user-doc --> + * @return the new adapter. + * @see org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.FacetOperation + * @generated + */ + public Adapter createFacetOperationAdapter() { + return null; + } + + /** + * Creates a new adapter for an object of class '{@link org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.FacetSet <em>Facet Set</em>}'. + * <!-- begin-user-doc --> + * This default implementation returns null so that we can easily ignore cases; + * it's useful to ignore a case when inheritance will catch all the cases anyway. + * <!-- end-user-doc --> + * @return the new adapter. + * @see org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.FacetSet + * @generated + */ + public Adapter createFacetSetAdapter() { + return null; + } + + /** + * Creates a new adapter for an object of class '{@link org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.Facet <em>Facet</em>}'. + * <!-- begin-user-doc --> + * This default implementation returns null so that we can easily ignore cases; + * it's useful to ignore a case when inheritance will catch all the cases anyway. + * <!-- end-user-doc --> + * @return the new adapter. + * @see org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.Facet + * @generated + */ + public Adapter createFacetAdapter() { + return null; + } + + /** + * Creates a new adapter for an object of class '{@link org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.Category <em>Category</em>}'. + * <!-- begin-user-doc --> + * This default implementation returns null so that we can easily ignore cases; + * it's useful to ignore a case when inheritance will catch all the cases anyway. + * <!-- end-user-doc --> + * @return the new adapter. + * @see org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.Category + * @generated + */ + public Adapter createCategoryAdapter() { + return null; + } + + /** + * Creates a new adapter for an object of class '{@link org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.FacetElement <em>Facet Element</em>}'. + * <!-- begin-user-doc --> + * This default implementation returns null so that we can easily ignore cases; + * it's useful to ignore a case when inheritance will catch all the cases anyway. + * <!-- end-user-doc --> + * @return the new adapter. + * @see org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.FacetElement + * @generated + */ + public Adapter createFacetElementAdapter() { + return null; + } + + /** + * Creates a new adapter for an object of class '{@link org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.DerivedTypedElement <em>Derived Typed Element</em>}'. + * <!-- begin-user-doc --> + * This default implementation returns null so that we can easily ignore cases; + * it's useful to ignore a case when inheritance will catch all the cases anyway. + * <!-- end-user-doc --> + * @return the new adapter. + * @see org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.DerivedTypedElement + * @generated + */ + public Adapter createDerivedTypedElementAdapter() { + return null; + } + + /** + * Creates a new adapter for an object of class '{@link org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.ParameterValue <em>Parameter Value</em>}'. + * <!-- begin-user-doc --> + * This default implementation returns null so that we can easily ignore cases; + * it's useful to ignore a case when inheritance will catch all the cases anyway. + * <!-- end-user-doc --> + * @return the new adapter. + * @see org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.ParameterValue + * @generated + */ + public Adapter createParameterValueAdapter() { + return null; + } + + /** + * Creates a new adapter for an object of class '{@link org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.DocumentedElement <em>Documented Element</em>}'. + * <!-- begin-user-doc --> + * This default implementation returns null so that we can easily ignore cases; + * it's useful to ignore a case when inheritance will catch all the cases anyway. + * <!-- end-user-doc --> + * @return the new adapter. + * @see org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.DocumentedElement + * @generated + */ + public Adapter createDocumentedElementAdapter() { + return null; + } + + /** + * Creates a new adapter for an object of class '{@link org.eclipse.emf.ecore.EModelElement <em>EModel Element</em>}'. + * <!-- begin-user-doc --> + * This default implementation returns null so that we can easily ignore cases; + * it's useful to ignore a case when inheritance will catch all the cases anyway. + * <!-- end-user-doc --> + * @return the new adapter. + * @see org.eclipse.emf.ecore.EModelElement + * @generated + */ + public Adapter createEModelElementAdapter() { + return null; + } + + /** + * Creates a new adapter for an object of class '{@link org.eclipse.emf.ecore.ENamedElement <em>ENamed Element</em>}'. + * <!-- begin-user-doc --> + * This default implementation returns null so that we can easily ignore cases; + * it's useful to ignore a case when inheritance will catch all the cases anyway. + * <!-- end-user-doc --> + * @return the new adapter. + * @see org.eclipse.emf.ecore.ENamedElement + * @generated + */ + public Adapter createENamedElementAdapter() { + return null; + } + + /** + * Creates a new adapter for an object of class '{@link org.eclipse.emf.ecore.ETypedElement <em>ETyped Element</em>}'. + * <!-- begin-user-doc --> + * This default implementation returns null so that we can easily ignore cases; + * it's useful to ignore a case when inheritance will catch all the cases anyway. + * <!-- end-user-doc --> + * @return the new adapter. + * @see org.eclipse.emf.ecore.ETypedElement + * @generated + */ + public Adapter createETypedElementAdapter() { + return null; + } + + /** + * Creates a new adapter for an object of class '{@link org.eclipse.emf.ecore.EStructuralFeature <em>EStructural Feature</em>}'. + * <!-- begin-user-doc --> + * This default implementation returns null so that we can easily ignore cases; + * it's useful to ignore a case when inheritance will catch all the cases anyway. + * <!-- end-user-doc --> + * @return the new adapter. + * @see org.eclipse.emf.ecore.EStructuralFeature + * @generated + */ + public Adapter createEStructuralFeatureAdapter() { + return null; + } + + /** + * Creates a new adapter for an object of class '{@link org.eclipse.emf.ecore.EAttribute <em>EAttribute</em>}'. + * <!-- begin-user-doc --> + * This default implementation returns null so that we can easily ignore cases; + * it's useful to ignore a case when inheritance will catch all the cases anyway. + * <!-- end-user-doc --> + * @return the new adapter. + * @see org.eclipse.emf.ecore.EAttribute + * @generated + */ + public Adapter createEAttributeAdapter() { + return null; + } + + /** + * Creates a new adapter for an object of class '{@link org.eclipse.emf.ecore.EReference <em>EReference</em>}'. + * <!-- begin-user-doc --> + * This default implementation returns null so that we can easily ignore cases; + * it's useful to ignore a case when inheritance will catch all the cases anyway. + * <!-- end-user-doc --> + * @return the new adapter. + * @see org.eclipse.emf.ecore.EReference + * @generated + */ + public Adapter createEReferenceAdapter() { + return null; + } + + /** + * Creates a new adapter for an object of class '{@link org.eclipse.emf.ecore.EOperation <em>EOperation</em>}'. + * <!-- begin-user-doc --> + * This default implementation returns null so that we can easily ignore cases; + * it's useful to ignore a case when inheritance will catch all the cases anyway. + * <!-- end-user-doc --> + * @return the new adapter. + * @see org.eclipse.emf.ecore.EOperation + * @generated + */ + public Adapter createEOperationAdapter() { + return null; + } + + /** + * Creates a new adapter for an object of class '{@link org.eclipse.emf.ecore.EPackage <em>EPackage</em>}'. + * <!-- begin-user-doc --> + * This default implementation returns null so that we can easily ignore cases; + * it's useful to ignore a case when inheritance will catch all the cases anyway. + * <!-- end-user-doc --> + * @return the new adapter. + * @see org.eclipse.emf.ecore.EPackage + * @generated + */ + public Adapter createEPackageAdapter() { + return null; + } + + /** + * Creates a new adapter for an object of class '{@link org.eclipse.emf.ecore.EClassifier <em>EClassifier</em>}'. + * <!-- begin-user-doc --> + * This default implementation returns null so that we can easily ignore cases; + * it's useful to ignore a case when inheritance will catch all the cases anyway. + * <!-- end-user-doc --> + * @return the new adapter. + * @see org.eclipse.emf.ecore.EClassifier + * @generated + */ + public Adapter createEClassifierAdapter() { + return null; + } + + /** + * Creates a new adapter for the default case. + * <!-- begin-user-doc --> + * This default implementation returns null. + * <!-- end-user-doc --> + * @return the new adapter. + * @generated + */ + public Adapter createEObjectAdapter() { + return null; + } + +} //EFacetAdapterFactory
diff --git a/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/modisco/facet/efacet/metamodel/v0_2_0/efacet/util/EFacetSwitch.java b/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/modisco/facet/efacet/metamodel/v0_2_0/efacet/util/EFacetSwitch.java new file mode 100644 index 0000000..e5e0ce2 --- /dev/null +++ b/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/modisco/facet/efacet/metamodel/v0_2_0/efacet/util/EFacetSwitch.java
@@ -0,0 +1,518 @@ +/** + * Copyright (c) 2011, 2012 Mia-Software. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Gregoire Dupe (Mia-Software) - Design + * Nicolas Guyomar (Mia-Software) - Implementation + * Emmanuelle Rouillé (Mia-Software) - Bug 352618 - To be able to use non derived facet structural features and save them values. + * Nicolas Bros (Mia-Software) - Bug 361823 - [Restructuring] eFacet2 meta-model + * Gregoire Dupe (Mia-Software) - Bug 366055 - NavigationQuery + * Gregoire Dupe (Mia-Software) - Bug 369673 - [Facet] IsOneOfQuery + * Olivier Remaud (Soft-Maint) - Bug 369824 - Add a simple way to return string literal constants from a customization query + * Gregoire Dupe (Mia-software) - Bug 369987 - [Restructuring][Table] Switch to the new customization and facet framework + * Gregoire Dupe (Mia-Software) - Bug 364325 - [Restructuring] The user must be able to navigate into a model using the Facet. + */ +package org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.util; + +import java.util.List; + +import org.eclipse.emf.ecore.EAttribute; +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.EClassifier; +import org.eclipse.emf.ecore.EModelElement; +import org.eclipse.emf.ecore.ENamedElement; +import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.ecore.EOperation; +import org.eclipse.emf.ecore.EPackage; +import org.eclipse.emf.ecore.EReference; +import org.eclipse.emf.ecore.EStructuralFeature; +import org.eclipse.emf.ecore.ETypedElement; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.*; + +/** + * <!-- begin-user-doc --> + * The <b>Switch</b> for the model's inheritance hierarchy. + * It supports the call {@link #doSwitch(EObject) doSwitch(object)} + * to invoke the <code>caseXXX</code> method for each class of the model, + * starting with the actual class of the object + * and proceeding up the inheritance hierarchy + * until a non-null result is returned, + * which is the result of the switch. + * <!-- end-user-doc --> + * @see org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.EFacetPackage + * @generated + */ +public class EFacetSwitch<T> { + /** + * The cached model package + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + protected static EFacetPackage modelPackage; + + /** + * Creates an instance of the switch. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public EFacetSwitch() { + if (modelPackage == null) { + modelPackage = EFacetPackage.eINSTANCE; + } + } + + /** + * Calls <code>caseXXX</code> for each class of the model until one returns a non null result; it yields that result. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @return the first non-null result returned by a <code>caseXXX</code> call. + * @generated + */ + public T doSwitch(EObject theEObject) { + return doSwitch(theEObject.eClass(), theEObject); + } + + /** + * Calls <code>caseXXX</code> for each class of the model until one returns a non null result; it yields that result. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @return the first non-null result returned by a <code>caseXXX</code> call. + * @generated + */ + protected T doSwitch(EClass theEClass, EObject theEObject) { + if (theEClass.eContainer() == modelPackage) { + return doSwitch(theEClass.getClassifierID(), theEObject); + } + else { + List<EClass> eSuperTypes = theEClass.getESuperTypes(); + return + eSuperTypes.isEmpty() ? + defaultCase(theEObject) : + doSwitch(eSuperTypes.get(0), theEObject); + } + } + + /** + * Calls <code>caseXXX</code> for each class of the model until one returns a non null result; it yields that result. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @return the first non-null result returned by a <code>caseXXX</code> call. + * @generated + */ + protected T doSwitch(int classifierID, EObject theEObject) { + switch (classifierID) { + case EFacetPackage.FACET_ATTRIBUTE: { + FacetAttribute facetAttribute = (FacetAttribute)theEObject; + T result = caseFacetAttribute(facetAttribute); + if (result == null) result = caseEAttribute(facetAttribute); + if (result == null) result = caseDerivedTypedElement(facetAttribute); + if (result == null) result = caseEStructuralFeature(facetAttribute); + if (result == null) result = caseFacetElement(facetAttribute); + if (result == null) result = caseETypedElement(facetAttribute); + if (result == null) result = caseDocumentedElement(facetAttribute); + if (result == null) result = caseENamedElement(facetAttribute); + if (result == null) result = caseEModelElement(facetAttribute); + if (result == null) result = defaultCase(theEObject); + return result; + } + case EFacetPackage.FACET_REFERENCE: { + FacetReference facetReference = (FacetReference)theEObject; + T result = caseFacetReference(facetReference); + if (result == null) result = caseEReference(facetReference); + if (result == null) result = caseDerivedTypedElement(facetReference); + if (result == null) result = caseEStructuralFeature(facetReference); + if (result == null) result = caseFacetElement(facetReference); + if (result == null) result = caseETypedElement(facetReference); + if (result == null) result = caseDocumentedElement(facetReference); + if (result == null) result = caseENamedElement(facetReference); + if (result == null) result = caseEModelElement(facetReference); + if (result == null) result = defaultCase(theEObject); + return result; + } + case EFacetPackage.FACET_OPERATION: { + FacetOperation facetOperation = (FacetOperation)theEObject; + T result = caseFacetOperation(facetOperation); + if (result == null) result = caseEOperation(facetOperation); + if (result == null) result = caseDerivedTypedElement(facetOperation); + if (result == null) result = caseFacetElement(facetOperation); + if (result == null) result = caseETypedElement(facetOperation); + if (result == null) result = caseENamedElement(facetOperation); + if (result == null) result = caseDocumentedElement(facetOperation); + if (result == null) result = caseEModelElement(facetOperation); + if (result == null) result = defaultCase(theEObject); + return result; + } + case EFacetPackage.FACET_SET: { + FacetSet facetSet = (FacetSet)theEObject; + T result = caseFacetSet(facetSet); + if (result == null) result = caseEPackage(facetSet); + if (result == null) result = caseDocumentedElement(facetSet); + if (result == null) result = caseENamedElement(facetSet); + if (result == null) result = caseEModelElement(facetSet); + if (result == null) result = defaultCase(theEObject); + return result; + } + case EFacetPackage.FACET: { + Facet facet = (Facet)theEObject; + T result = caseFacet(facet); + if (result == null) result = caseEClassifier(facet); + if (result == null) result = caseDocumentedElement(facet); + if (result == null) result = caseENamedElement(facet); + if (result == null) result = caseEModelElement(facet); + if (result == null) result = defaultCase(theEObject); + return result; + } + case EFacetPackage.CATEGORY: { + Category category = (Category)theEObject; + T result = caseCategory(category); + if (result == null) result = caseENamedElement(category); + if (result == null) result = caseDocumentedElement(category); + if (result == null) result = caseEModelElement(category); + if (result == null) result = defaultCase(theEObject); + return result; + } + case EFacetPackage.FACET_ELEMENT: { + FacetElement facetElement = (FacetElement)theEObject; + T result = caseFacetElement(facetElement); + if (result == null) result = caseETypedElement(facetElement); + if (result == null) result = caseDocumentedElement(facetElement); + if (result == null) result = caseENamedElement(facetElement); + if (result == null) result = caseEModelElement(facetElement); + if (result == null) result = defaultCase(theEObject); + return result; + } + case EFacetPackage.DERIVED_TYPED_ELEMENT: { + DerivedTypedElement derivedTypedElement = (DerivedTypedElement)theEObject; + T result = caseDerivedTypedElement(derivedTypedElement); + if (result == null) result = caseFacetElement(derivedTypedElement); + if (result == null) result = caseETypedElement(derivedTypedElement); + if (result == null) result = caseDocumentedElement(derivedTypedElement); + if (result == null) result = caseENamedElement(derivedTypedElement); + if (result == null) result = caseEModelElement(derivedTypedElement); + if (result == null) result = defaultCase(theEObject); + return result; + } + case EFacetPackage.PARAMETER_VALUE: { + ParameterValue parameterValue = (ParameterValue)theEObject; + T result = caseParameterValue(parameterValue); + if (result == null) result = defaultCase(theEObject); + return result; + } + case EFacetPackage.DOCUMENTED_ELEMENT: { + DocumentedElement documentedElement = (DocumentedElement)theEObject; + T result = caseDocumentedElement(documentedElement); + if (result == null) result = defaultCase(theEObject); + return result; + } + default: return defaultCase(theEObject); + } + } + + /** + * Returns the result of interpreting the object as an instance of '<em>Facet Attribute</em>'. + * <!-- begin-user-doc --> + * This implementation returns null; + * returning a non-null result will terminate the switch. + * <!-- end-user-doc --> + * @param object the target of the switch. + * @return the result of interpreting the object as an instance of '<em>Facet Attribute</em>'. + * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) + * @generated + */ + public T caseFacetAttribute(FacetAttribute object) { + return null; + } + + /** + * Returns the result of interpreting the object as an instance of '<em>Facet Reference</em>'. + * <!-- begin-user-doc --> + * This implementation returns null; + * returning a non-null result will terminate the switch. + * <!-- end-user-doc --> + * @param object the target of the switch. + * @return the result of interpreting the object as an instance of '<em>Facet Reference</em>'. + * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) + * @generated + */ + public T caseFacetReference(FacetReference object) { + return null; + } + + /** + * Returns the result of interpreting the object as an instance of '<em>Facet Operation</em>'. + * <!-- begin-user-doc --> + * This implementation returns null; + * returning a non-null result will terminate the switch. + * <!-- end-user-doc --> + * @param object the target of the switch. + * @return the result of interpreting the object as an instance of '<em>Facet Operation</em>'. + * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) + * @generated + */ + public T caseFacetOperation(FacetOperation object) { + return null; + } + + /** + * Returns the result of interpreting the object as an instance of '<em>Facet Set</em>'. + * <!-- begin-user-doc --> + * This implementation returns null; + * returning a non-null result will terminate the switch. + * <!-- end-user-doc --> + * @param object the target of the switch. + * @return the result of interpreting the object as an instance of '<em>Facet Set</em>'. + * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) + * @generated + */ + public T caseFacetSet(FacetSet object) { + return null; + } + + /** + * Returns the result of interpreting the object as an instance of '<em>Facet</em>'. + * <!-- begin-user-doc --> + * This implementation returns null; + * returning a non-null result will terminate the switch. + * <!-- end-user-doc --> + * @param object the target of the switch. + * @return the result of interpreting the object as an instance of '<em>Facet</em>'. + * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) + * @generated + */ + public T caseFacet(Facet object) { + return null; + } + + /** + * Returns the result of interpreting the object as an instance of '<em>Category</em>'. + * <!-- begin-user-doc --> + * This implementation returns null; + * returning a non-null result will terminate the switch. + * <!-- end-user-doc --> + * @param object the target of the switch. + * @return the result of interpreting the object as an instance of '<em>Category</em>'. + * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) + * @generated + */ + public T caseCategory(Category object) { + return null; + } + + /** + * Returns the result of interpreting the object as an instance of '<em>Facet Element</em>'. + * <!-- begin-user-doc --> + * This implementation returns null; + * returning a non-null result will terminate the switch. + * <!-- end-user-doc --> + * @param object the target of the switch. + * @return the result of interpreting the object as an instance of '<em>Facet Element</em>'. + * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) + * @generated + */ + public T caseFacetElement(FacetElement object) { + return null; + } + + /** + * Returns the result of interpreting the object as an instance of '<em>Derived Typed Element</em>'. + * <!-- begin-user-doc --> + * This implementation returns null; + * returning a non-null result will terminate the switch. + * <!-- end-user-doc --> + * @param object the target of the switch. + * @return the result of interpreting the object as an instance of '<em>Derived Typed Element</em>'. + * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) + * @generated + */ + public T caseDerivedTypedElement(DerivedTypedElement object) { + return null; + } + + /** + * Returns the result of interpreting the object as an instance of '<em>Parameter Value</em>'. + * <!-- begin-user-doc --> + * This implementation returns null; + * returning a non-null result will terminate the switch. + * <!-- end-user-doc --> + * @param object the target of the switch. + * @return the result of interpreting the object as an instance of '<em>Parameter Value</em>'. + * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) + * @generated + */ + public T caseParameterValue(ParameterValue object) { + return null; + } + + /** + * Returns the result of interpreting the object as an instance of '<em>Documented Element</em>'. + * <!-- begin-user-doc --> + * This implementation returns null; + * returning a non-null result will terminate the switch. + * <!-- end-user-doc --> + * @param object the target of the switch. + * @return the result of interpreting the object as an instance of '<em>Documented Element</em>'. + * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) + * @generated + */ + public T caseDocumentedElement(DocumentedElement object) { + return null; + } + + /** + * Returns the result of interpreting the object as an instance of '<em>EModel Element</em>'. + * <!-- begin-user-doc --> + * This implementation returns null; + * returning a non-null result will terminate the switch. + * <!-- end-user-doc --> + * @param object the target of the switch. + * @return the result of interpreting the object as an instance of '<em>EModel Element</em>'. + * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) + * @generated + */ + public T caseEModelElement(EModelElement object) { + return null; + } + + /** + * Returns the result of interpreting the object as an instance of '<em>ENamed Element</em>'. + * <!-- begin-user-doc --> + * This implementation returns null; + * returning a non-null result will terminate the switch. + * <!-- end-user-doc --> + * @param object the target of the switch. + * @return the result of interpreting the object as an instance of '<em>ENamed Element</em>'. + * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) + * @generated + */ + public T caseENamedElement(ENamedElement object) { + return null; + } + + /** + * Returns the result of interpreting the object as an instance of '<em>ETyped Element</em>'. + * <!-- begin-user-doc --> + * This implementation returns null; + * returning a non-null result will terminate the switch. + * <!-- end-user-doc --> + * @param object the target of the switch. + * @return the result of interpreting the object as an instance of '<em>ETyped Element</em>'. + * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) + * @generated + */ + public T caseETypedElement(ETypedElement object) { + return null; + } + + /** + * Returns the result of interpreting the object as an instance of '<em>EStructural Feature</em>'. + * <!-- begin-user-doc --> + * This implementation returns null; + * returning a non-null result will terminate the switch. + * <!-- end-user-doc --> + * @param object the target of the switch. + * @return the result of interpreting the object as an instance of '<em>EStructural Feature</em>'. + * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) + * @generated + */ + public T caseEStructuralFeature(EStructuralFeature object) { + return null; + } + + /** + * Returns the result of interpreting the object as an instance of '<em>EAttribute</em>'. + * <!-- begin-user-doc --> + * This implementation returns null; + * returning a non-null result will terminate the switch. + * <!-- end-user-doc --> + * @param object the target of the switch. + * @return the result of interpreting the object as an instance of '<em>EAttribute</em>'. + * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) + * @generated + */ + public T caseEAttribute(EAttribute object) { + return null; + } + + /** + * Returns the result of interpreting the object as an instance of '<em>EReference</em>'. + * <!-- begin-user-doc --> + * This implementation returns null; + * returning a non-null result will terminate the switch. + * <!-- end-user-doc --> + * @param object the target of the switch. + * @return the result of interpreting the object as an instance of '<em>EReference</em>'. + * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) + * @generated + */ + public T caseEReference(EReference object) { + return null; + } + + /** + * Returns the result of interpreting the object as an instance of '<em>EOperation</em>'. + * <!-- begin-user-doc --> + * This implementation returns null; + * returning a non-null result will terminate the switch. + * <!-- end-user-doc --> + * @param object the target of the switch. + * @return the result of interpreting the object as an instance of '<em>EOperation</em>'. + * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) + * @generated + */ + public T caseEOperation(EOperation object) { + return null; + } + + /** + * Returns the result of interpreting the object as an instance of '<em>EPackage</em>'. + * <!-- begin-user-doc --> + * This implementation returns null; + * returning a non-null result will terminate the switch. + * <!-- end-user-doc --> + * @param object the target of the switch. + * @return the result of interpreting the object as an instance of '<em>EPackage</em>'. + * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) + * @generated + */ + public T caseEPackage(EPackage object) { + return null; + } + + /** + * Returns the result of interpreting the object as an instance of '<em>EClassifier</em>'. + * <!-- begin-user-doc --> + * This implementation returns null; + * returning a non-null result will terminate the switch. + * <!-- end-user-doc --> + * @param object the target of the switch. + * @return the result of interpreting the object as an instance of '<em>EClassifier</em>'. + * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) + * @generated + */ + public T caseEClassifier(EClassifier object) { + return null; + } + + /** + * Returns the result of interpreting the object as an instance of '<em>EObject</em>'. + * <!-- begin-user-doc --> + * This implementation returns null; + * returning a non-null result will terminate the switch, but this is the last case anyway. + * <!-- end-user-doc --> + * @param object the target of the switch. + * @return the result of interpreting the object as an instance of '<em>EObject</em>'. + * @see #doSwitch(org.eclipse.emf.ecore.EObject) + * @generated + */ + public T defaultCase(EObject object) { + return null; + } + +} //EFacetSwitch
diff --git a/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/modisco/facet/efacet/metamodel/v0_2_0/efacetcatalog/EfacetcatalogFactory.java b/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/modisco/facet/efacet/metamodel/v0_2_0/efacetcatalog/EfacetcatalogFactory.java new file mode 100644 index 0000000..aa98f0c --- /dev/null +++ b/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/modisco/facet/efacet/metamodel/v0_2_0/efacetcatalog/EfacetcatalogFactory.java
@@ -0,0 +1,57 @@ +/** + * Copyright (c) 2011, 2015 Mia-Software. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Grégoire Dupé (Mia-Software) - Design + * Nicolas Guyomar (Mia-Software) - Implementation + * Emmanuelle Rouillé (Mia-Software) - Bug 352618 - To be able to use non-derived facet structural features and save their values. + * Nicolas Bros (Mia-Software) - Bug 370110 - Rename efacetcatalog2.ecore + * Grégoire Dupé (Mia-Software) - Bug 361817 - [Restructuring] Dynamic load to the facet catalog + * Grégoire Dupé (Mia-Software) - Bug 477657 - The catalog manager should be able to manage workspace model + */ +package org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacetcatalog; + +import org.eclipse.emf.ecore.EFactory; + +/** + * <!-- begin-user-doc --> + * The <b>Factory</b> for the model. + * It provides a create method for each non-abstract class of the model. + * <!-- end-user-doc --> + * @see org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacetcatalog.EfacetcatalogPackage + * @generated + */ +@Deprecated +public interface EfacetcatalogFactory extends EFactory { + /** + * The singleton instance of the factory. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + EfacetcatalogFactory eINSTANCE = org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacetcatalog.impl.EfacetcatalogFactoryImpl.init(); + + /** + * Returns a new object of class '<em>Facet Set Catalog</em>'. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @return a new object of class '<em>Facet Set Catalog</em>'. + * @generated + */ + FacetSetCatalog createFacetSetCatalog(); + + /** + * Returns the package supported by this factory. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @return the package supported by this factory. + * @generated + */ + EfacetcatalogPackage getEfacetcatalogPackage(); + +} //EfacetcatalogFactory
diff --git a/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/modisco/facet/efacet/metamodel/v0_2_0/efacetcatalog/EfacetcatalogPackage.java b/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/modisco/facet/efacet/metamodel/v0_2_0/efacetcatalog/EfacetcatalogPackage.java new file mode 100644 index 0000000..b2a4fb9 --- /dev/null +++ b/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/modisco/facet/efacet/metamodel/v0_2_0/efacetcatalog/EfacetcatalogPackage.java
@@ -0,0 +1,155 @@ +/** + * Copyright (c) 2011, 2015 Mia-Software. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Grégoire Dupé (Mia-Software) - Design + * Nicolas Guyomar (Mia-Software) - Implementation + * Emmanuelle Rouillé (Mia-Software) - Bug 352618 - To be able to use non-derived facet structural features and save their values. + * Nicolas Bros (Mia-Software) - Bug 370110 - Rename efacetcatalog2.ecore + * Grégoire Dupé (Mia-Software) - Bug 361817 - [Restructuring] Dynamic load to the facet catalog + * Grégoire Dupé (Mia-Software) - Bug 477657 - The catalog manager should be able to manage workspace model + */ +package org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacetcatalog; + +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.EPackage; +import org.eclipse.emf.ecore.EReference; +import org.eclipse.modisco.facet.util.emf.catalog.CatalogPackage; + +/** + * <!-- begin-user-doc --> + * The <b>Package</b> for the model. + * It contains accessors for the meta objects to represent + * <ul> + * <li>each class,</li> + * <li>each feature of each class,</li> + * <li>each enum,</li> + * <li>and each data type</li> + * </ul> + * <!-- end-user-doc --> + * @see org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacetcatalog.EfacetcatalogFactory + * @model kind="package" + * @generated + */ +@Deprecated +public interface EfacetcatalogPackage extends EPackage { + /** + * The package name. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + String eNAME = "efacetcatalog"; //$NON-NLS-1$ + + /** + * The package namespace URI. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + String eNS_URI = "http://www.eclipse.org/emf/facet/efacet/0.2.incubation/efacetcatalog"; //$NON-NLS-1$ + + /** + * The package namespace name. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + String eNS_PREFIX = "efacetcatalog"; //$NON-NLS-1$ + + /** + * The singleton instance of the package. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + EfacetcatalogPackage eINSTANCE = org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacetcatalog.impl.EfacetcatalogPackageImpl.init(); + + /** + * The meta object id for the '{@link org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacetcatalog.impl.FacetSetCatalogImpl <em>Facet Set Catalog</em>}' class. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @see org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacetcatalog.impl.FacetSetCatalogImpl + * @see org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacetcatalog.impl.EfacetcatalogPackageImpl#getFacetSetCatalog() + * @generated + */ + int FACET_SET_CATALOG = 0; + + /** + * The feature id for the '<em><b>Installed Entries</b></em>' reference list. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + */ + int FACET_SET_CATALOG__INSTALLED_ENTRIES = CatalogPackage.CATALOG__INSTALLED_ENTRIES; + + /** + * The feature id for the '<em><b>Name</b></em>' attribute. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + */ + int FACET_SET_CATALOG__NAME = CatalogPackage.CATALOG__NAME; + + /** + * The number of structural features of the '<em>Facet Set Catalog</em>' class. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + */ + int FACET_SET_CATALOG_FEATURE_COUNT = CatalogPackage.CATALOG_FEATURE_COUNT + 0; + + + /** + * Returns the meta object for class '{@link org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacetcatalog.FacetSetCatalog <em>Facet Set Catalog</em>}'. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @return the meta object for class '<em>Facet Set Catalog</em>'. + * @see org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacetcatalog.FacetSetCatalog + * @generated + */ + EClass getFacetSetCatalog(); + + /** + * Returns the factory that creates the instances of the model. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @return the factory that creates the instances of the model. + * @generated + */ + EfacetcatalogFactory getEfacetcatalogFactory(); + + /** + * <!-- begin-user-doc --> + * Defines literals for the meta objects that represent + * <ul> + * <li>each class,</li> + * <li>each feature of each class,</li> + * <li>each enum,</li> + * <li>and each data type</li> + * </ul> + * <!-- end-user-doc --> + * @generated + */ + interface Literals { + /** + * The meta object literal for the '{@link org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacetcatalog.impl.FacetSetCatalogImpl <em>Facet Set Catalog</em>}' class. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @see org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacetcatalog.impl.FacetSetCatalogImpl + * @see org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacetcatalog.impl.EfacetcatalogPackageImpl#getFacetSetCatalog() + * @generated + */ + EClass FACET_SET_CATALOG = eINSTANCE.getFacetSetCatalog(); + + } + +} //EfacetcatalogPackage
diff --git a/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/modisco/facet/efacet/metamodel/v0_2_0/efacetcatalog/FacetSetCatalog.java b/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/modisco/facet/efacet/metamodel/v0_2_0/efacetcatalog/FacetSetCatalog.java new file mode 100644 index 0000000..db7305b --- /dev/null +++ b/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/modisco/facet/efacet/metamodel/v0_2_0/efacetcatalog/FacetSetCatalog.java
@@ -0,0 +1,40 @@ +/** + * Copyright (c) 2011, 2015 Mia-Software. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Grégoire Dupé (Mia-Software) - Design + * Nicolas Guyomar (Mia-Software) - Implementation + * Emmanuelle Rouillé (Mia-Software) - Bug 352618 - To be able to use non-derived facet structural features and save their values. + * Nicolas Bros (Mia-Software) - Bug 370110 - Rename efacetcatalog2.ecore + * Grégoire Dupé (Mia-Software) - Bug 361817 - [Restructuring] Dynamic load to the facet catalog + * Grégoire Dupé (Mia-Software) - Bug 477657 - The catalog manager should be able to manage workspace model + */ +package org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacetcatalog; + +import org.eclipse.emf.common.util.EList; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.FacetSet; +import org.eclipse.modisco.facet.util.emf.catalog.Catalog; + +/** + * <!-- begin-user-doc --> + * A representation of the model object '<em><b>Facet Set Catalog</b></em>'. + * <!-- end-user-doc --> + * + * <!-- begin-model-doc --> + * A FacetSetCatalog aims at referencing EMF Facet FacetSet. + * <!-- end-model-doc --> + * + * + * @see org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacetcatalog.EfacetcatalogPackage#getFacetSetCatalog() + * @model + * @generated + */ +@Deprecated +public interface FacetSetCatalog extends Catalog { + +} // FacetSetCatalog
diff --git a/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/modisco/facet/efacet/metamodel/v0_2_0/efacetcatalog/impl/EfacetcatalogFactoryImpl.java b/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/modisco/facet/efacet/metamodel/v0_2_0/efacetcatalog/impl/EfacetcatalogFactoryImpl.java new file mode 100644 index 0000000..7165262 --- /dev/null +++ b/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/modisco/facet/efacet/metamodel/v0_2_0/efacetcatalog/impl/EfacetcatalogFactoryImpl.java
@@ -0,0 +1,109 @@ +/** + * Copyright (c) 2011, 2015 Mia-Software. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Grégoire Dupé (Mia-Software) - Design + * Nicolas Guyomar (Mia-Software) - Implementation + * Emmanuelle Rouillé (Mia-Software) - Bug 352618 - To be able to use non-derived facet structural features and save their values. + * Nicolas Bros (Mia-Software) - Bug 370110 - Rename efacetcatalog2.ecore + * Grégoire Dupé (Mia-Software) - Bug 361817 - [Restructuring] Dynamic load to the facet catalog + * Grégoire Dupé (Mia-Software) - Bug 477657 - The catalog manager should be able to manage workspace model + */ +package org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacetcatalog.impl; + +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.ecore.EPackage; + +import org.eclipse.emf.ecore.impl.EFactoryImpl; + +import org.eclipse.emf.ecore.plugin.EcorePlugin; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacetcatalog.*; + +/** + * <!-- begin-user-doc --> + * An implementation of the model <b>Factory</b>. + * <!-- end-user-doc --> + * @generated + */ +@Deprecated +public class EfacetcatalogFactoryImpl extends EFactoryImpl implements EfacetcatalogFactory { + /** + * Creates the default factory implementation. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public static EfacetcatalogFactory init() { + try { + EfacetcatalogFactory theEfacetcatalogFactory = (EfacetcatalogFactory)EPackage.Registry.INSTANCE.getEFactory("http://www.eclipse.org/emf/facet/efacet/0.2.incubation/efacetcatalog"); //$NON-NLS-1$ + if (theEfacetcatalogFactory != null) { + return theEfacetcatalogFactory; + } + } + catch (Exception exception) { + EcorePlugin.INSTANCE.log(exception); + } + return new EfacetcatalogFactoryImpl(); + } + + /** + * Creates an instance of the factory. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public EfacetcatalogFactoryImpl() { + super(); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + public EObject create(EClass eClass) { + switch (eClass.getClassifierID()) { + case EfacetcatalogPackage.FACET_SET_CATALOG: return createFacetSetCatalog(); + default: + throw new IllegalArgumentException("The class '" + eClass.getName() + "' is not a valid classifier"); //$NON-NLS-1$ //$NON-NLS-2$ + } + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public FacetSetCatalog createFacetSetCatalog() { + FacetSetCatalogImpl facetSetCatalog = new FacetSetCatalogImpl(); + return facetSetCatalog; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public EfacetcatalogPackage getEfacetcatalogPackage() { + return (EfacetcatalogPackage)getEPackage(); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @deprecated + * @generated + */ + @Deprecated + public static EfacetcatalogPackage getPackage() { + return EfacetcatalogPackage.eINSTANCE; + } + +} //EfacetcatalogFactoryImpl
diff --git a/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/modisco/facet/efacet/metamodel/v0_2_0/efacetcatalog/impl/EfacetcatalogPackageImpl.java b/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/modisco/facet/efacet/metamodel/v0_2_0/efacetcatalog/impl/EfacetcatalogPackageImpl.java new file mode 100644 index 0000000..24aac58 --- /dev/null +++ b/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/modisco/facet/efacet/metamodel/v0_2_0/efacetcatalog/impl/EfacetcatalogPackageImpl.java
@@ -0,0 +1,190 @@ +/** + * Copyright (c) 2011, 2015 Mia-Software. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Grégoire Dupé (Mia-Software) - Design + * Nicolas Guyomar (Mia-Software) - Implementation + * Emmanuelle Rouillé (Mia-Software) - Bug 352618 - To be able to use non-derived facet structural features and save their values. + * Nicolas Bros (Mia-Software) - Bug 370110 - Rename efacetcatalog2.ecore + * Grégoire Dupé (Mia-Software) - Bug 361817 - [Restructuring] Dynamic load to the facet catalog + * Grégoire Dupé (Mia-Software) - Bug 477657 - The catalog manager should be able to manage workspace model + */ +package org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacetcatalog.impl; + +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.EPackage; +import org.eclipse.emf.ecore.EReference; + +import org.eclipse.emf.ecore.impl.EPackageImpl; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.EFacetPackage; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacetcatalog.EfacetcatalogFactory; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacetcatalog.EfacetcatalogPackage; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacetcatalog.FacetSetCatalog; +import org.eclipse.modisco.facet.util.emf.catalog.CatalogPackage; + +/** + * <!-- begin-user-doc --> + * An implementation of the model <b>Package</b>. + * <!-- end-user-doc --> + * @generated + */ +@Deprecated +public class EfacetcatalogPackageImpl extends EPackageImpl implements EfacetcatalogPackage { + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + private EClass facetSetCatalogEClass = null; + + /** + * Creates an instance of the model <b>Package</b>, registered with + * {@link org.eclipse.emf.ecore.EPackage.Registry EPackage.Registry} by the package + * package URI value. + * <p>Note: the correct way to create the package is via the static + * factory method {@link #init init()}, which also performs + * initialization of the package, or returns the registered package, + * if one already exists. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @see org.eclipse.emf.ecore.EPackage.Registry + * @see org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacetcatalog.EfacetcatalogPackage#eNS_URI + * @see #init() + * @generated + */ + private EfacetcatalogPackageImpl() { + super(eNS_URI, EfacetcatalogFactory.eINSTANCE); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + private static boolean isInited = false; + + /** + * Creates, registers, and initializes the <b>Package</b> for this model, and for any others upon which it depends. + * + * <p>This method is used to initialize {@link EfacetcatalogPackage#eINSTANCE} when that field is accessed. + * Clients should not invoke it directly. Instead, they should simply access that field to obtain the package. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @see #eNS_URI + * @see #createPackageContents() + * @see #initializePackageContents() + * @generated + */ + public static EfacetcatalogPackage init() { + if (isInited) return (EfacetcatalogPackage)EPackage.Registry.INSTANCE.getEPackage(EfacetcatalogPackage.eNS_URI); + + // Obtain or create and register package + EfacetcatalogPackageImpl theEfacetcatalogPackage = (EfacetcatalogPackageImpl)(EPackage.Registry.INSTANCE.get(eNS_URI) instanceof EfacetcatalogPackageImpl ? EPackage.Registry.INSTANCE.get(eNS_URI) : new EfacetcatalogPackageImpl()); + + isInited = true; + + // Initialize simple dependencies + CatalogPackage.eINSTANCE.eClass(); + EFacetPackage.eINSTANCE.eClass(); + + // Create package meta-data objects + theEfacetcatalogPackage.createPackageContents(); + + // Initialize created meta-data + theEfacetcatalogPackage.initializePackageContents(); + + // Mark meta-data to indicate it can't be changed + theEfacetcatalogPackage.freeze(); + + + // Update the registry and return the package + EPackage.Registry.INSTANCE.put(EfacetcatalogPackage.eNS_URI, theEfacetcatalogPackage); + return theEfacetcatalogPackage; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public EClass getFacetSetCatalog() { + return facetSetCatalogEClass; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public EfacetcatalogFactory getEfacetcatalogFactory() { + return (EfacetcatalogFactory)getEFactoryInstance(); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + private boolean isCreated = false; + + /** + * Creates the meta-model objects for the package. This method is + * guarded to have no affect on any invocation but its first. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public void createPackageContents() { + if (isCreated) return; + isCreated = true; + + // Create classes and their features + facetSetCatalogEClass = createEClass(FACET_SET_CATALOG); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + private boolean isInitialized = false; + + /** + * Complete the initialization of the package and its meta-model. This + * method is guarded to have no affect on any invocation but its first. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public void initializePackageContents() { + if (isInitialized) return; + isInitialized = true; + + // Initialize package + setName(eNAME); + setNsPrefix(eNS_PREFIX); + setNsURI(eNS_URI); + + // Obtain other dependent packages + CatalogPackage theCatalogPackage = (CatalogPackage)EPackage.Registry.INSTANCE.getEPackage(CatalogPackage.eNS_URI); + + // Create type parameters + + // Set bounds for type parameters + + // Add supertypes to classes + facetSetCatalogEClass.getESuperTypes().add(theCatalogPackage.getCatalog()); + + // Initialize classes and features; add operations and parameters + initEClass(facetSetCatalogEClass, FacetSetCatalog.class, "FacetSetCatalog", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); //$NON-NLS-1$ + + // Create resource + createResource(eNS_URI); + } + +} //EfacetcatalogPackageImpl
diff --git a/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/modisco/facet/efacet/metamodel/v0_2_0/efacetcatalog/impl/FacetSetCatalogImpl.java b/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/modisco/facet/efacet/metamodel/v0_2_0/efacetcatalog/impl/FacetSetCatalogImpl.java new file mode 100644 index 0000000..7390c21 --- /dev/null +++ b/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/modisco/facet/efacet/metamodel/v0_2_0/efacetcatalog/impl/FacetSetCatalogImpl.java
@@ -0,0 +1,215 @@ +/** + * Copyright (c) 2011, 2015 Mia-Software. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Grégoire Dupé (Mia-Software) - Design + * Nicolas Guyomar (Mia-Software) - Implementation + * Emmanuelle Rouillé (Mia-Software) - Bug 352618 - To be able to use non-derived facet structural features and save their values. + * Nicolas Bros (Mia-Software) - Bug 370110 - Rename efacetcatalog2.ecore + * Grégoire Dupé (Mia-Software) - Bug 361817 - [Restructuring] Dynamic load to the facet catalog + * Grégoire Dupé (Mia-Software) - Bug 477657 - The catalog manager should be able to manage workspace model + */ +package org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacetcatalog.impl; + +import java.util.Collection; + +import org.eclipse.emf.common.notify.Notification; +import org.eclipse.emf.common.util.EList; +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.ecore.impl.ENotificationImpl; +import org.eclipse.emf.ecore.impl.EObjectImpl; +import org.eclipse.emf.ecore.util.EObjectResolvingEList; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacetcatalog.EfacetcatalogPackage; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacetcatalog.FacetSetCatalog; + +/** + * <!-- begin-user-doc --> + * An implementation of the model object '<em><b>Facet Set Catalog</b></em>'. + * <!-- end-user-doc --> + * <p> + * The following features are implemented: + * <ul> + * <li>{@link org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacetcatalog.impl.FacetSetCatalogImpl#getInstalledEntries <em>Installed Entries</em>}</li> + * <li>{@link org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacetcatalog.impl.FacetSetCatalogImpl#getName <em>Name</em>}</li> + * </ul> + * </p> + * + * @generated + */ +@Deprecated +public class FacetSetCatalogImpl extends EObjectImpl implements FacetSetCatalog { + /** + * The cached value of the '{@link #getInstalledEntries() <em>Installed Entries</em>}' reference list. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @see #getInstalledEntries() + * @generated + * @ordered + */ + protected EList<EObject> installedEntries; + + /** + * The default value of the '{@link #getName() <em>Name</em>}' attribute. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @see #getName() + * @generated + * @ordered + */ + protected static final String NAME_EDEFAULT = null; + + /** + * The cached value of the '{@link #getName() <em>Name</em>}' attribute. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @see #getName() + * @generated + * @ordered + */ + protected String name = NAME_EDEFAULT; + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + protected FacetSetCatalogImpl() { + super(); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + protected EClass eStaticClass() { + return EfacetcatalogPackage.Literals.FACET_SET_CATALOG; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public EList<EObject> getInstalledEntries() { + if (installedEntries == null) { + installedEntries = new EObjectResolvingEList<EObject>(EObject.class, this, EfacetcatalogPackage.FACET_SET_CATALOG__INSTALLED_ENTRIES); + } + return installedEntries; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public String getName() { + return name; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public void setName(final String newName) { + String oldName = name; + name = newName; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.SET, EfacetcatalogPackage.FACET_SET_CATALOG__NAME, oldName, name)); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + public Object eGet(final int featureID, final boolean resolve, final boolean coreType) { + switch (featureID) { + case EfacetcatalogPackage.FACET_SET_CATALOG__INSTALLED_ENTRIES: + return getInstalledEntries(); + case EfacetcatalogPackage.FACET_SET_CATALOG__NAME: + return getName(); + } + return super.eGet(featureID, resolve, coreType); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @SuppressWarnings("unchecked") + @Override + public void eSet(final int featureID, final Object newValue) { + switch (featureID) { + case EfacetcatalogPackage.FACET_SET_CATALOG__INSTALLED_ENTRIES: + getInstalledEntries().clear(); + getInstalledEntries().addAll((Collection<? extends EObject>)newValue); + return; + case EfacetcatalogPackage.FACET_SET_CATALOG__NAME: + setName((String)newValue); + return; + } + super.eSet(featureID, newValue); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + public void eUnset(final int featureID) { + switch (featureID) { + case EfacetcatalogPackage.FACET_SET_CATALOG__INSTALLED_ENTRIES: + getInstalledEntries().clear(); + return; + case EfacetcatalogPackage.FACET_SET_CATALOG__NAME: + setName(NAME_EDEFAULT); + return; + } + super.eUnset(featureID); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + public boolean eIsSet(final int featureID) { + switch (featureID) { + case EfacetcatalogPackage.FACET_SET_CATALOG__INSTALLED_ENTRIES: + return installedEntries != null && !installedEntries.isEmpty(); + case EfacetcatalogPackage.FACET_SET_CATALOG__NAME: + return NAME_EDEFAULT == null ? name != null : !NAME_EDEFAULT.equals(name); + } + return super.eIsSet(featureID); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + public String toString() { + if (eIsProxy()) return super.toString(); + + StringBuffer result = new StringBuffer(super.toString()); + result.append(" (name: "); //$NON-NLS-1$ + result.append(name); + result.append(')'); + return result.toString(); + } + +} //FacetSetCatalogImpl
diff --git a/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/modisco/facet/efacet/metamodel/v0_2_0/efacetcatalog/util/EfacetcatalogAdapterFactory.java b/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/modisco/facet/efacet/metamodel/v0_2_0/efacetcatalog/util/EfacetcatalogAdapterFactory.java new file mode 100644 index 0000000..e278837 --- /dev/null +++ b/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/modisco/facet/efacet/metamodel/v0_2_0/efacetcatalog/util/EfacetcatalogAdapterFactory.java
@@ -0,0 +1,152 @@ +/** + * Copyright (c) 2011,2012 Mia-Software. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Gregoire Dupe (Mia-Software) - Design + * Nicolas Guyomar (Mia-Software) - Implementation + * Emmanuelle Rouillé (Mia-Software) - Bug 352618 - To be able to use non-derived facet structural features and save their values. + * Nicolas Bros (Mia-Software) - Bug 370110 - Rename efacetcatalog2.ecore + * Grégoire Dupé (Mia-Software) - Bug 361817 - [Restructuring] Dynamic load to the facet catalog + * + */ +package org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacetcatalog.util; + +import org.eclipse.emf.common.notify.Adapter; +import org.eclipse.emf.common.notify.Notifier; + +import org.eclipse.emf.common.notify.impl.AdapterFactoryImpl; + +import org.eclipse.emf.ecore.EObject; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacetcatalog.*; +import org.eclipse.modisco.facet.util.emf.catalog.Catalog; + +/** + * <!-- begin-user-doc --> + * The <b>Adapter Factory</b> for the model. + * It provides an adapter <code>createXXX</code> method for each class of the model. + * <!-- end-user-doc --> + * @see org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacetcatalog.EfacetcatalogPackage + * @generated + */ +public class EfacetcatalogAdapterFactory extends AdapterFactoryImpl { + /** + * The cached model package. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + protected static EfacetcatalogPackage modelPackage; + + /** + * Creates an instance of the adapter factory. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public EfacetcatalogAdapterFactory() { + if (modelPackage == null) { + modelPackage = EfacetcatalogPackage.eINSTANCE; + } + } + + /** + * Returns whether this factory is applicable for the type of the object. + * <!-- begin-user-doc --> + * This implementation returns <code>true</code> if the object is either the model's package or is an instance object of the model. + * <!-- end-user-doc --> + * @return whether this factory is applicable for the type of the object. + * @generated + */ + @Override + public boolean isFactoryForType(Object object) { + if (object == modelPackage) { + return true; + } + if (object instanceof EObject) { + return ((EObject)object).eClass().getEPackage() == modelPackage; + } + return false; + } + + /** + * The switch that delegates to the <code>createXXX</code> methods. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + protected EfacetcatalogSwitch<Adapter> modelSwitch = + new EfacetcatalogSwitch<Adapter>() { + @Override + public Adapter caseFacetSetCatalog(FacetSetCatalog object) { + return createFacetSetCatalogAdapter(); + } + @Override + public Adapter caseCatalog(Catalog object) { + return createCatalogAdapter(); + } + @Override + public Adapter defaultCase(EObject object) { + return createEObjectAdapter(); + } + }; + + /** + * Creates an adapter for the <code>target</code>. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @param target the object to adapt. + * @return the adapter for the <code>target</code>. + * @generated + */ + @Override + public Adapter createAdapter(Notifier target) { + return modelSwitch.doSwitch((EObject)target); + } + + + /** + * Creates a new adapter for an object of class '{@link org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacetcatalog.FacetSetCatalog <em>Facet Set Catalog</em>}'. + * <!-- begin-user-doc --> + * This default implementation returns null so that we can easily ignore cases; + * it's useful to ignore a case when inheritance will catch all the cases anyway. + * <!-- end-user-doc --> + * @return the new adapter. + * @see org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacetcatalog.FacetSetCatalog + * @generated + */ + public Adapter createFacetSetCatalogAdapter() { + return null; + } + + /** + * Creates a new adapter for an object of class '{@link org.eclipse.modisco.facet.util.emf.catalog.Catalog <em>Catalog</em>}'. + * <!-- begin-user-doc --> + * This default implementation returns null so that we can easily ignore cases; + * it's useful to ignore a case when inheritance will catch all the cases anyway. + * <!-- end-user-doc --> + * @return the new adapter. + * @see org.eclipse.modisco.facet.util.emf.catalog.Catalog + * @generated + */ + public Adapter createCatalogAdapter() { + return null; + } + + /** + * Creates a new adapter for the default case. + * <!-- begin-user-doc --> + * This default implementation returns null. + * <!-- end-user-doc --> + * @return the new adapter. + * @generated + */ + public Adapter createEObjectAdapter() { + return null; + } + +} //EfacetcatalogAdapterFactory
diff --git a/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/modisco/facet/efacet/metamodel/v0_2_0/efacetcatalog/util/EfacetcatalogSwitch.java b/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/modisco/facet/efacet/metamodel/v0_2_0/efacetcatalog/util/EfacetcatalogSwitch.java new file mode 100644 index 0000000..06881a9 --- /dev/null +++ b/org.eclipse.modisco.facet.efacet.metamodel/src/org/eclipse/modisco/facet/efacet/metamodel/v0_2_0/efacetcatalog/util/EfacetcatalogSwitch.java
@@ -0,0 +1,156 @@ +/** + * Copyright (c) 2011,2012 Mia-Software. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Gregoire Dupe (Mia-Software) - Design + * Nicolas Guyomar (Mia-Software) - Implementation + * Emmanuelle Rouillé (Mia-Software) - Bug 352618 - To be able to use non-derived facet structural features and save their values. + * Nicolas Bros (Mia-Software) - Bug 370110 - Rename efacetcatalog2.ecore + * Grégoire Dupé (Mia-Software) - Bug 361817 - [Restructuring] Dynamic load to the facet catalog + * + */ +package org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacetcatalog.util; + +import java.util.List; + +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.EObject; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacetcatalog.*; +import org.eclipse.modisco.facet.util.emf.catalog.Catalog; + +/** + * <!-- begin-user-doc --> + * The <b>Switch</b> for the model's inheritance hierarchy. + * It supports the call {@link #doSwitch(EObject) doSwitch(object)} + * to invoke the <code>caseXXX</code> method for each class of the model, + * starting with the actual class of the object + * and proceeding up the inheritance hierarchy + * until a non-null result is returned, + * which is the result of the switch. + * <!-- end-user-doc --> + * @see org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacetcatalog.EfacetcatalogPackage + * @generated + */ +public class EfacetcatalogSwitch<T> { + /** + * The cached model package + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + protected static EfacetcatalogPackage modelPackage; + + /** + * Creates an instance of the switch. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public EfacetcatalogSwitch() { + if (modelPackage == null) { + modelPackage = EfacetcatalogPackage.eINSTANCE; + } + } + + /** + * Calls <code>caseXXX</code> for each class of the model until one returns a non null result; it yields that result. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @return the first non-null result returned by a <code>caseXXX</code> call. + * @generated + */ + public T doSwitch(EObject theEObject) { + return doSwitch(theEObject.eClass(), theEObject); + } + + /** + * Calls <code>caseXXX</code> for each class of the model until one returns a non null result; it yields that result. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @return the first non-null result returned by a <code>caseXXX</code> call. + * @generated + */ + protected T doSwitch(EClass theEClass, EObject theEObject) { + if (theEClass.eContainer() == modelPackage) { + return doSwitch(theEClass.getClassifierID(), theEObject); + } + else { + List<EClass> eSuperTypes = theEClass.getESuperTypes(); + return + eSuperTypes.isEmpty() ? + defaultCase(theEObject) : + doSwitch(eSuperTypes.get(0), theEObject); + } + } + + /** + * Calls <code>caseXXX</code> for each class of the model until one returns a non null result; it yields that result. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @return the first non-null result returned by a <code>caseXXX</code> call. + * @generated + */ + protected T doSwitch(int classifierID, EObject theEObject) { + switch (classifierID) { + case EfacetcatalogPackage.FACET_SET_CATALOG: { + FacetSetCatalog facetSetCatalog = (FacetSetCatalog)theEObject; + T result = caseFacetSetCatalog(facetSetCatalog); + if (result == null) result = caseCatalog(facetSetCatalog); + if (result == null) result = defaultCase(theEObject); + return result; + } + default: return defaultCase(theEObject); + } + } + + /** + * Returns the result of interpreting the object as an instance of '<em>Facet Set Catalog</em>'. + * <!-- begin-user-doc --> + * This implementation returns null; + * returning a non-null result will terminate the switch. + * <!-- end-user-doc --> + * @param object the target of the switch. + * @return the result of interpreting the object as an instance of '<em>Facet Set Catalog</em>'. + * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) + * @generated + */ + public T caseFacetSetCatalog(FacetSetCatalog object) { + return null; + } + + /** + * Returns the result of interpreting the object as an instance of '<em>Catalog</em>'. + * <!-- begin-user-doc --> + * This implementation returns null; + * returning a non-null result will terminate the switch. + * <!-- end-user-doc --> + * @param object the target of the switch. + * @return the result of interpreting the object as an instance of '<em>Catalog</em>'. + * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) + * @generated + */ + public T caseCatalog(Catalog object) { + return null; + } + + /** + * Returns the result of interpreting the object as an instance of '<em>EObject</em>'. + * <!-- begin-user-doc --> + * This implementation returns null; + * returning a non-null result will terminate the switch, but this is the last case anyway. + * <!-- end-user-doc --> + * @param object the target of the switch. + * @return the result of interpreting the object as an instance of '<em>EObject</em>'. + * @see #doSwitch(org.eclipse.emf.ecore.EObject) + * @generated + */ + public T defaultCase(EObject object) { + return null; + } + +} //EfacetcatalogSwitch
diff --git a/org.eclipse.modisco.facet.efacet.ui/.settings/org.eclipse.core.resources.prefs b/org.eclipse.modisco.facet.efacet.ui/.settings/org.eclipse.core.resources.prefs index 371b83a..0d975e8 100644 --- a/org.eclipse.modisco.facet.efacet.ui/.settings/org.eclipse.core.resources.prefs +++ b/org.eclipse.modisco.facet.efacet.ui/.settings/org.eclipse.core.resources.prefs
@@ -1,4 +1,3 @@ -#Thu Mar 17 13:44:27 CET 2011 eclipse.preferences.version=1 -encoding//src/org/eclipse/emf/facet/efacet/ui/internal/messages.properties=ISO-8859-1 +encoding//src/org/eclipse/modisco/facet/efacet/ui/internal/messages.properties=ISO-8859-1 encoding/<project>=UTF-8
diff --git a/org.eclipse.modisco.facet.efacet.ui/META-INF/MANIFEST.MF b/org.eclipse.modisco.facet.efacet.ui/META-INF/MANIFEST.MF index f516084..449c9ec 100644 --- a/org.eclipse.modisco.facet.efacet.ui/META-INF/MANIFEST.MF +++ b/org.eclipse.modisco.facet.efacet.ui/META-INF/MANIFEST.MF
@@ -3,7 +3,7 @@ Bundle-Name: %Bundle-Name Bundle-SymbolicName: org.eclipse.emf.facet.efacet.ui;singleton:=true Bundle-Version: 1.3.0.qualifier -Bundle-Activator: org.eclipse.emf.facet.efacet.ui.internal.Activator +Bundle-Activator: org.eclipse.modisco.facet.efacet.ui.internal.Activator Require-Bundle: org.eclipse.core.runtime, org.eclipse.ui.ide, org.eclipse.emf.facet.efacet.core;bundle-version="0.1.0", @@ -24,12 +24,12 @@ Bundle-ActivationPolicy: lazy Bundle-RequiredExecutionEnvironment: JavaSE-1.8 Bundle-Vendor: %Bundle-Vendor -Export-Package: org.eclipse.emf.facet.efacet.ui, - org.eclipse.emf.facet.efacet.ui.internal.composites;x-friends:="org.eclipse.emf.facet.query.java.ui", - org.eclipse.emf.facet.efacet.ui.internal.exported;x-friends:="org.eclipse.emf.facet.aggregate.tests", - org.eclipse.emf.facet.efacet.ui.internal.exported.dialog;x-friends:="org.eclipse.emf.facet.widgets.table.ui,org.eclipse.emf.facet.efacet.tests,org.eclipse.emf.facet.aggregate.tests", - org.eclipse.emf.facet.efacet.ui.internal.exported.view;x-friends:="org.eclipse.emf.facet.efacet.tests", - org.eclipse.emf.facet.efacet.ui.internal.exported.widget;x-friends:="org.eclipse.emf.facet.efacet.tests", - org.eclipse.emf.facet.efacet.ui.internal.exported.wizard;x-friends:="org.eclipse.emf.facet.query.java.ui", - org.eclipse.emf.facet.efacet.ui.internal.wizards;x-friends:="org.eclipse.emf.facet.query.java.ui" +Export-Package: org.eclipse.modisco.facet.efacet.ui, + org.eclipse.modisco.facet.efacet.ui.internal.composites;x-friends:="org.eclipse.emf.facet.query.java.ui", + org.eclipse.modisco.facet.efacet.ui.internal.exported;x-friends:="org.eclipse.emf.facet.aggregate.tests", + org.eclipse.modisco.facet.efacet.ui.internal.exported.dialog;x-friends:="org.eclipse.emf.facet.widgets.table.ui,org.eclipse.emf.facet.efacet.tests,org.eclipse.emf.facet.aggregate.tests", + org.eclipse.modisco.facet.efacet.ui.internal.exported.view;x-friends:="org.eclipse.emf.facet.efacet.tests", + org.eclipse.modisco.facet.efacet.ui.internal.exported.widget;x-friends:="org.eclipse.emf.facet.efacet.tests", + org.eclipse.modisco.facet.efacet.ui.internal.exported.wizard;x-friends:="org.eclipse.emf.facet.query.java.ui", + org.eclipse.modisco.facet.efacet.ui.internal.wizards;x-friends:="org.eclipse.emf.facet.query.java.ui" Automatic-Module-Name: org.eclipse.emf.facet.efacet.ui
diff --git a/org.eclipse.modisco.facet.efacet.ui/plugin.xml b/org.eclipse.modisco.facet.efacet.ui/plugin.xml index 7a99dfe..77cea80 100644 --- a/org.eclipse.modisco.facet.efacet.ui/plugin.xml +++ b/org.eclipse.modisco.facet.efacet.ui/plugin.xml Binary files differ
diff --git a/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/emf/facet/efacet/ui/FacetSetLoaderHandlerUtils.java b/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/emf/facet/efacet/ui/FacetSetLoaderHandlerUtils.java deleted file mode 100644 index 92aaa67..0000000 --- a/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/emf/facet/efacet/ui/FacetSetLoaderHandlerUtils.java +++ /dev/null
@@ -1,94 +0,0 @@ -/** - * Copyright (c) 2015 Soft-Maint, and Mia-Software. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Thomas Cicognani (Soft-Maint) - Bug 472075 - Update API to create UI shortcuts to activate FacetSets - * Grégoire Dupé (Mia-Software) - Bug 472075 - Update API to create UI shortcuts to activate FacetSets - */ -package org.eclipse.emf.facet.efacet.ui; - -import java.util.List; - -import org.eclipse.core.commands.ExecutionEvent; -import org.eclipse.core.commands.ExecutionException; -import org.eclipse.emf.facet.custom.core.ICustomizationManager; -import org.eclipse.emf.facet.custom.core.ICustomizationManagerProvider; -import org.eclipse.emf.facet.efacet.core.IFacetManager; -import org.eclipse.emf.facet.efacet.core.IFacetSetCatalogManager; -import org.eclipse.emf.facet.efacet.core.IFacetSetCatalogManagerFactory; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.FacetSet; -import org.eclipse.ui.IWorkbenchPart; -import org.eclipse.ui.handlers.HandlerUtil; - -/** - * Utilitarian to manage Handlers which will (un)load FacetSets: allow users to - * (des)activate facet sets (customizations are facet sets). If you want to - * create a menu shortcut, your Handler must extends this class - * @noinstantiate This class is not intended to be instantiated by clients. - * @since 1.1 - */ -public final class FacetSetLoaderHandlerUtils { - - private FacetSetLoaderHandlerUtils() { - // Must not be used. - } - - /** - * Execute the Handler - * - * @param event - * The execution event that contains the application context - * @param facetSetID - * ID of the facet set linked to this Handler - * @return the result of the execution. Reserved for future use, can be - * <code>null</code>. - * @throws ExecutionException - */ - public static Object execute(final ExecutionEvent event, - final String facetSetID) throws ExecutionException { - final boolean toggle = HandlerUtil.toggleCommandState(event - .getCommand()); - final IWorkbenchPart activePart = HandlerUtil.getActivePart(event); - if (activePart != null) { - final ICustomizationManagerProvider customMgrProvider = (ICustomizationManagerProvider) activePart - .getAdapter(ICustomizationManagerProvider.class); - if (customMgrProvider != null) { - execute(facetSetID, toggle, customMgrProvider); - } - } - return null; - } - - private static void execute(final String facetSetID, final boolean toggle, - final ICustomizationManagerProvider customMgrProvider) { - final ICustomizationManager manager = customMgrProvider - .getCustomizationManager(); - - final IFacetSetCatalogManager catalog = IFacetSetCatalogManagerFactory.DEFAULT - .getOrCreateFacetSetCatalogManager(manager.getResourceSet()); - - FacetSet facetSetToActive = null; - for (FacetSet facetSet : catalog.getRegisteredFacetSets()) { - if (facetSetID.equals(facetSet.getName())) { - facetSetToActive = facetSet; - break; - } - } - if (facetSetToActive != null) { - final IFacetManager facetManager = manager.getFacetManager(); - final List<FacetSet> managedFacetSets = facetManager - .getManagedFacetSets(); - if (toggle) { - managedFacetSets.remove(facetSetToActive); - } else { - if (!managedFacetSets.contains(facetSetToActive)) { - managedFacetSets.add(0, facetSetToActive); - } - } - } - } -}
diff --git a/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/emf/facet/efacet/ui/FacetSetShortcutActionUtils.java b/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/emf/facet/efacet/ui/FacetSetShortcutActionUtils.java deleted file mode 100644 index dfb818c..0000000 --- a/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/emf/facet/efacet/ui/FacetSetShortcutActionUtils.java +++ /dev/null
@@ -1,63 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2015 Mia-Software - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Thomas Cicognani (Mia-Software) - Bug 472075 - Update API to create UI shortcuts to activate FacetSets - * Grégoire Dupé (Mia-Software) - Bug 472075 - Update API to create UI shortcuts to activate FacetSets - *******************************************************************************/ -package org.eclipse.emf.facet.efacet.ui; - -import java.util.List; -import java.util.Set; - -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.FacetSet; -import org.eclipse.jface.action.Action; -import org.eclipse.jface.resource.ImageDescriptor; - -/** - * @since 1.1 - * @noinstantiate This class is not intended to be instantiated by clients. - */ -public final class FacetSetShortcutActionUtils { - - private FacetSetShortcutActionUtils() { - // NOT TO BE USED - } - - public static void setImageDescriptor(final Action action, - final ImageDescriptor imageDescriptor) { - if (imageDescriptor != null) { - action.setImageDescriptor(imageDescriptor); - } - } - - public static <T extends FacetSet> void runAction(final Action action, - final String actionId, final Set<T> availableFS, - final List<T> activatedFS) { - for (T facetSet : availableFS) { - final String facetSetName = facetSet.getName(); - if (facetSetName.equals(actionId)) { - setActivatedFacetSets(action, facetSet, activatedFS); - break; - } - } - } - - private static <T extends FacetSet> void setActivatedFacetSets( - final Action action, final T facetSet, final List<T> activatedFS) { - /* - * The condition is inverted because the toggle state changes before - * launching the run method - */ - if (action.isChecked()) { - activatedFS.add(0, facetSet); - } else { - activatedFS.remove(facetSet); - } - } - -}
diff --git a/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/emf/facet/efacet/ui/IETypedElementResultDisplayer.java b/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/emf/facet/efacet/ui/IETypedElementResultDisplayer.java deleted file mode 100644 index a6fb949..0000000 --- a/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/emf/facet/efacet/ui/IETypedElementResultDisplayer.java +++ /dev/null
@@ -1,28 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010, 2012 Mia-Software. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Nicolas Bros (Mia-Software) - * Gregoire Dupe (Mia-Software) - Bug 364325 - [Restructuring] The user must be able to navigate into a model using the Facet. - *******************************************************************************/ -package org.eclipse.emf.facet.efacet.ui; - -import java.util.List; - -import org.eclipse.emf.edit.domain.EditingDomain; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.runtime.ETypedElementResult; - -/** - * Implemented by a view or editor that wants to be used to display the results - * of a model query. - */ -//Copied from org.eclipse.emf.facet.infra.query.ui.views.queryExecution.QueryResultDisplayer -public interface IETypedElementResultDisplayer { - void displayETypedElementResults(final List<ETypedElementResult> result, EditingDomain editingDomain); - - String getName(); -}
diff --git a/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/emf/facet/efacet/ui/IETypedElementResultDisplayerOpener.java b/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/emf/facet/efacet/ui/IETypedElementResultDisplayerOpener.java deleted file mode 100644 index fa7857c..0000000 --- a/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/emf/facet/efacet/ui/IETypedElementResultDisplayerOpener.java +++ /dev/null
@@ -1,29 +0,0 @@ -/** - * Copyright (c) 2011, 2012 Mia-Software. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Gregoire Dupe (Mia-Software) - Bug 364325 - [Restructuring] The user must be able to navigate into a model using the Facet. - */ -package org.eclipse.emf.facet.efacet.ui; - -import java.util.List; - -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.runtime.ETypedElementResult; -import org.eclipse.ui.IWorkbenchPart; - - -/** - * This method must be implemented and referenced by the extension point org.eclipse.emf.facet.efacet.ui.displayeropener - * - * This is a new version of the org.eclipse.emf.facet.infra.query.ui.views.queryExecution.QueryResultDisplayer. - * @author Gregoire Dupe - * - */ -public interface IETypedElementResultDisplayerOpener { - IWorkbenchPart open(List<ETypedElementResult> results); -}
diff --git a/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/emf/facet/efacet/ui/IFacetManagerProvider2.java b/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/emf/facet/efacet/ui/IFacetManagerProvider2.java deleted file mode 100644 index bbd1019..0000000 --- a/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/emf/facet/efacet/ui/IFacetManagerProvider2.java +++ /dev/null
@@ -1,34 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2015 Mia-Software - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Thomas Cicognani (Mia-Software) - Bug 472075 - Update API to create UI shortcuts to activate FacetSets - *******************************************************************************/ -package org.eclipse.emf.facet.efacet.ui; - -import java.util.List; - -import org.eclipse.emf.facet.efacet.core.IFacetManagerProvider; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.FacetSet; -import org.eclipse.jface.resource.ImageDescriptor; - -/** - * @since 1.1 - */ -public interface IFacetManagerProvider2 extends IFacetManagerProvider { - - interface IFacetSetShortcut { - FacetSet getFacetSet(); - - String getLabel(); - - ImageDescriptor getIcon(); - } - - List<IFacetSetShortcut> getFacetSetShortcuts(); - -}
diff --git a/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/emf/facet/efacet/ui/LoadFacetSetShortcutsMenuUtils.java b/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/emf/facet/efacet/ui/LoadFacetSetShortcutsMenuUtils.java deleted file mode 100644 index 64b9498..0000000 --- a/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/emf/facet/efacet/ui/LoadFacetSetShortcutsMenuUtils.java +++ /dev/null
@@ -1,124 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2015 Mia-Software - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Thomas Cicognani (Mia-Software) - Bug 472075 - Update API to create UI shortcuts to activate FacetSets - * Grégoire Dupé (Mia-Software) - Bug 472075 - Update API to create UI shortcuts to activate FacetSets - *******************************************************************************/ -package org.eclipse.emf.facet.efacet.ui; - -import java.util.ArrayList; -import java.util.List; - -import org.eclipse.emf.facet.efacet.core.IFacetManager; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.FacetSet; -import org.eclipse.emf.facet.efacet.ui.IFacetManagerProvider2.IFacetSetShortcut; -import org.eclipse.emf.facet.efacet.ui.internal.actions.ShortcutFacetSetAction; -import org.eclipse.emf.facet.util.ui.internal.exported.handler.HandlerUtils; -import org.eclipse.jface.action.Action; -import org.eclipse.jface.action.ActionContributionItem; -import org.eclipse.jface.action.IContributionItem; -import org.eclipse.ui.IEditorPart; -import org.eclipse.ui.IWorkbenchPage; -import org.eclipse.ui.IWorkbenchPart; - -/** - * @since 1.1 - * @noinstantiate This class is not intended to be instantiated by clients. - */ -public final class LoadFacetSetShortcutsMenuUtils { - - private LoadFacetSetShortcutsMenuUtils() { - // NOT TO BE USED - } - - public static IContributionItem[] getFacetSetItemsFromCurrentPart() { - final IFacetManagerProvider2 facetMgrPrv = getProviderFromCurrentPart(IFacetManagerProvider2.class); - return getFacetSetItems(facetMgrPrv); - } - - public static IContributionItem[] getFacetSetItemsFromCurrentEditor() { - final IFacetManagerProvider2 facetMgrPrv = getProviderFromCurrentEditor(IFacetManagerProvider2.class); - return getFacetSetItems(facetMgrPrv); - } - - private static IContributionItem[] getFacetSetItems( - final IFacetManagerProvider2 facetMgrPrv) { - final List<IContributionItem> menuList = new ArrayList<IContributionItem>(); - if (facetMgrPrv != null) { - final List<IFacetSetShortcut> shortcuts = facetMgrPrv - .getFacetSetShortcuts(); - final IFacetManager facetManager = facetMgrPrv.getFacetManager(); - for (IFacetSetShortcut shortcut : shortcuts) { - final ActionContributionItem action = createFacetSetMenuItem( - shortcut, facetManager); - menuList.add(action); - } - } - return menuList.toArray(new IContributionItem[menuList.size()]); - } - - public static <T> T getProviderFromCurrentPart(final Class<T> providerType) { - final IWorkbenchPart activePart = HandlerUtils.getActivePart(); - return getProviderFromCurrentPart(providerType, activePart); - } - - public static <T> T getProviderFromCurrentEditor( - final Class<T> providerType) { - T result = null; - final IWorkbenchPage activePage = HandlerUtils.getActivePage(); - if (activePage != null) { - final IEditorPart activeEditor = activePage.getActiveEditor(); - if (activeEditor != null) { - result = getProviderFromCurrentPart(providerType, activeEditor); - } - } - return result; - } - - private static <T> T getProviderFromCurrentPart( - final Class<T> providerType, final IWorkbenchPart activePart) { - T result = null; - if (activePart != null) { - final Object adapt = activePart.getAdapter(providerType); - if (adapt != null) { - /* - * @SuppressWarnings("unchecked") Cast safe thanks to the - * getAdapter method - */ - @SuppressWarnings("unchecked") - final T adapted = (T) adapt; - result = adapted; - } - } - return result; - } - - private static ActionContributionItem createFacetSetMenuItem( - final IFacetSetShortcut shortcut, final IFacetManager facetManager) { - final FacetSet facetSet = shortcut.getFacetSet(); - final String facetSetId = facetSet.getName(); - final Action action = new ShortcutFacetSetAction(facetSetId, - shortcut.getLabel(), shortcut.getIcon(), facetManager); - final List<FacetSet> activeFacetSets = facetManager - .getManagedFacetSets(); - return createMenuItem(facetSetId, activeFacetSets, action); - } - - public static ActionContributionItem createMenuItem(final String itemId, - final List<? extends FacetSet> activeFacetSets, - final Action newAction) { - for (FacetSet activeCustom : activeFacetSets) { - final String facetSetName = activeCustom.getName(); - if (facetSetName.equals(itemId)) { - newAction.setChecked(true); - break; - } - } - return new ActionContributionItem(newAction); - } -}
diff --git a/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/emf/facet/efacet/ui/internal/Activator.java b/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/emf/facet/efacet/ui/internal/Activator.java deleted file mode 100644 index d0a0a4b..0000000 --- a/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/emf/facet/efacet/ui/internal/Activator.java +++ /dev/null
@@ -1,59 +0,0 @@ -/** - * Copyright (c) 2011 Mia-Software. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Nicolas Guyomar (Mia-Software) - Bug 349546 - EMF Facet facetSet editor - * Nicolas Bros (Mia-Software) - Bug 379439 - Missing icons for Navigation view actions - */ -package org.eclipse.emf.facet.efacet.ui.internal; - -import org.eclipse.ui.plugin.AbstractUIPlugin; -import org.osgi.framework.BundleContext; - -/** - * The activator class controls the plug-in life cycle - */ -public class Activator extends AbstractUIPlugin { - - public static final String PLUGIN_ID = "org.eclipse.emf.facet.efacet.ui"; //$NON-NLS-1$ - - // The shared instance - private static Activator plugin; - - /* - * (non-Javadoc) - * - * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext ) - */ - @Override - public void start(final BundleContext context) throws Exception { - super.start(context); - Activator.plugin = this; - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext ) - */ - @Override - public void stop(final BundleContext context) throws Exception { - Activator.plugin = null; - super.stop(context); - } - - /** - * Returns the shared instance - * - * @return the shared instance - */ - public static Activator getDefault() { - return Activator.plugin; - } - -}
diff --git a/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/emf/facet/efacet/ui/internal/IFacetUIFactory2.java b/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/emf/facet/efacet/ui/internal/IFacetUIFactory2.java deleted file mode 100644 index e46b2f0..0000000 --- a/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/emf/facet/efacet/ui/internal/IFacetUIFactory2.java +++ /dev/null
@@ -1,116 +0,0 @@ -/** - * Copyright (c) 2011 Mia-Software. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Nicolas Guyomar (Mia-Software) - Bug 349546 - EMF Facet facetSet editor - * Gregoire Dupe (Mia-Software) - Bug 361617 - Deprecation of APIs for the old Facet metamodels - */ -package org.eclipse.emf.facet.efacet.ui.internal; - -import org.eclipse.emf.ecore.EParameter; -import org.eclipse.emf.edit.domain.EditingDomain; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.Facet; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.FacetAttribute; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.FacetOperation; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.FacetReference; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.FacetSet; -import org.eclipse.emf.facet.efacet.ui.internal.exported.wizard.ICreateFacetInFacetSetWizard2; -import org.eclipse.emf.facet.efacet.ui.internal.exported.wizard.ICreateFacetSetWizard; -import org.eclipse.emf.facet.efacet.ui.internal.exported.wizard.IFacetChildrenWizard2; -import org.eclipse.jface.viewers.ISelection; - -/** - * This interface provides methods used to create wizards that create {@link Facet}s and Facet elements. - * - * TODO: This interface has to be renamed to IFacetUIFactory before the release of 0.2 - * - * @since 0.2 - */ -//TODO: This interface has to be renamed to IFacetUIFactory before the release of 0.2 -public interface IFacetUIFactory2 { - - /** - * Returns an instance of a {@link FacetUIFactoryImpl} - */ - IFacetUIFactory2 INSTANCE = null; //TODO cf. https://bugs.eclipse.org/bugs/show_bug.cgi?id=364601 - - /** - * Create a wizard dialog dedicated to the addition of a {@link Facet} in a {@link FacetSet} - * - * @param selection - * the current selection, should be a FacetSet - * @param editingDomain - * the editing domain used to perform the EMF command - * @return the newly created wizard - */ - public ICreateFacetInFacetSetWizard2 createCreateFacetInFacetSetWizardDialog(ISelection selection, EditingDomain editingDomain); - - /** - * Create a wizard dialog dedicated to the creation of a {@link FacetSet} - * - * @param selection - * the current selection - * @return the newly created wizard - */ - public ICreateFacetSetWizard createCreateFacetSetWizardDialog(ISelection selection); - - /** - * Create a wizard dialog dedicated to the creation of a {@link FacetSet} - * - * @param selection - * the current selection - * @param openCreatedFacetSetInEditor - * @return the newly created wizard - */ - public ICreateFacetSetWizard createCreateFacetSetWizardDialog(ISelection selection, boolean openCreatedFacetSetInEditor); - - /** - * Create a wizard dialog dedicated to the addition of a {@link FacetAttribute} in a {@link Facet} - * - * @param selection - * the current selection, should be a Facet - * @param editingDomain - * the editing domain used to perform the EMF command - * @return the newly created wizard - */ - public IFacetChildrenWizard2 createAddFacetAttributeWizardDialog(ISelection selection, EditingDomain editingDomain); - - /** - * Create a wizard dialog dedicated to the addition of a {@link FacetOperation} in a {@link Facet} - * - * @param selection - * the current selection, should be a Facet - * @param editingDomain - * the editing domain used to perform the EMF command - * @return the newly created wizard - */ - public IFacetChildrenWizard2 createAddFacetOperationWizardDialog(ISelection selection, EditingDomain editingDomain); - - /** - * Create a wizard dialog dedicated to the addition of a {@link EParameter} to a {@link FacetOperation} - * - * @param selection - * the current selection, should be a FacetOperation - * @param editingDomain - * the editing domain used to perform the EMF command - * @return the newly created wizard - */ - public IFacetChildrenWizard2 createAddFacetOperationParameterWizardDialog(ISelection selection, EditingDomain editingDomain); - - /** - * Create a wizard dialog dedicated to the addition of a {@link FacetReference} in a {@link Facet} - * - * @param selection - * the current selection, should be a Facet Reference - * @param editingDomain - * the editing domain used to perform the EMF command - * @return the newly created wizard - */ - public IFacetChildrenWizard2 createAddFacetReferenceWizardDialog(ISelection selection, EditingDomain editingDomain); - -}
diff --git a/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/emf/facet/efacet/ui/internal/IQueryCreationPagePart2.java b/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/emf/facet/efacet/ui/internal/IQueryCreationPagePart2.java deleted file mode 100644 index a721968..0000000 --- a/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/emf/facet/efacet/ui/internal/IQueryCreationPagePart2.java +++ /dev/null
@@ -1,168 +0,0 @@ -/** - * Copyright (c) 2011 Mia-Software. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Nicolas Guyomar (Mia-Software) - Bug 349546 - EMF Facet facetSet editor - * Gregoire Dupe (Mia-Software) - Bug 361617 - Deprecation of APIs for the old Facet metamodels - */ -package org.eclipse.emf.facet.efacet.ui.internal; - -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.ecore.EClassifier; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.FacetSet; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.extensible.Query; -import org.eclipse.swt.events.ModifyListener; -import org.eclipse.swt.widgets.Composite; - -/** - * This interface has to be implemented by {@link Query} factory UI Class. It is used to complete a - * generic {@link Query} creation wizard with specific widget. - * - * TODO: This interface has to be renamed to IQueryCreationPagePart before the release of 0.2 - * - * @since 0.2 - */ -//TODO: This interface has to be renamed to IQueryCreationPagePart before the release of 0.2 -public interface IQueryCreationPagePart2 { - - /** - * Set the {@link Query}'s {@link FacetSet}. - * - * @param facetSet - * the given {@link FacetSet} - */ - public void setFacetSet(FacetSet facetSet); - - /** - * Set the {@link Query}'s upperBound. - * - * @param upperBound - * the upperBound. - */ - public void setUpperBound(int upperBound); - - /** - * Set the {@link Query}'s lowerBound. - * - * @param lowerBound - * the lowerBound. - */ - public void setLowerBound(int lowerBound); - - /** - * Set the {@link Query}'s {@link Query#isOrdered() <em>attribute</em>} attribute. - * - * @param ordered - * whether - */ - public void setOrdered(final boolean ordered); - - /** - * Set the {@link Query}'s {@link Query#isUnique() <em>unique</em>} attribute. - * - * @param unique - * Whether the query is unique or not. - */ - public void setUnique(final boolean unique); - - /** - * Set the {@link Query}'s type. - * - * @param queryType - * the {@link Query}'s type. - */ - public void setQueryType(EClassifier queryType); - - /** - * Set the {@link Query}'s name. - * - * @param name - * the query's name. - */ - public void setQueryName(String name); - - /** - * Set the {@link Query}'s {@link Query#isCanBeCached() <em>Can Be Cached</em>}. - * - * @param canBeCached - * whether the query result can be cached. - */ - public void setCanBeCached(boolean canBeCached); - - /** - * Set the {@link Query}'s {@link Query#isHasSideEffect() <em>Has Side Effect</em>}. - * - * @param hasSideEffect - * whether the query has side effect, such as modifying a model when applied on it. - */ - public void setHasSideEffect(boolean hasSideEffect); - - /** - * Set the {@link Query}'s '{@link Query#getScope <em>Scope</em>}'. - * - * @param type - * the {@link Query}'s '{@link Query#getScope <em>Scope</em>}'. - */ - public void setQueryScope(EClass scope); - - /** - * This method is dedicated to create a {@link Query} with every attribute set by the others - * methods of {@link IQueryCreationPagePart2}. - * - * @return the newly created {@link Query} - */ - public Query performFinish(); - - /** - * This method is called by the {@link org.eclipse.emf.facet.efacet.ui.internal.wizards.pages.CreateQueryWizardPage}. - * - * @param parent - * the Wizard's composite to be completed with specific widget for this {@link Query} creation. - */ - public void completeComposite(Composite parent); - - /** - * Returns <code>true</code> if the composite is complete. - * - * @return <code>true</code> if the composite is complete. - */ - public boolean isCompositeComplete(); - - /** - * Returns the error messages generated by the part, or null if none. - * - * @return the error messages generated by the part, or null if none. - */ - public String getErrorMessage(); - - /** - * Add a {@link ModifyListener} on the part. - * - * @param listener - * a {@link ModifyListener} - */ - public void addModifyListener(ModifyListener listener); - - /** - * Remove an existing {@link ModifyListener} from the part's listener. - * - * @param listener - * an existing {@link ModifyListener} listener. - */ - public void removeModifyListener(ModifyListener listener); - - /** - * Notify the registered listener that something has been modified in the part. It should only - * be used as a way to update the buttons' state of the containing wizard dialog. - * - * @param modifiedComposite - * the composite on which the modification occured. - */ - public void notifyCompositeListeners(Composite modifiedComposite); - -}
diff --git a/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/emf/facet/efacet/ui/internal/IQueryCreationPagePart2Registry.java b/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/emf/facet/efacet/ui/internal/IQueryCreationPagePart2Registry.java deleted file mode 100644 index 86f3ea3..0000000 --- a/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/emf/facet/efacet/ui/internal/IQueryCreationPagePart2Registry.java +++ /dev/null
@@ -1,50 +0,0 @@ -/** - * Copyright (c) 2011 Mia-Software. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Nicolas Guyomar (Mia-Software) - Bug 349546 - EMF Facet facetSet editor - * Gregoire Dupe (Mia-Software) - Bug 361617 - Deprecation of APIs for the old Facet metamodels - */ -package org.eclipse.emf.facet.efacet.ui.internal; - -import java.util.Map; - -import org.eclipse.emf.ecore.EClass; - -/** - * This interface is dedicated to the registry - * - * TODO: This interface has to be renamed to IQueryCreationPagePartRegistry before the release of 0.2 - * - * @since 0.2 - */ -//TODO: This interface has to be renamed to IQueryCreationPagePartRegistry before the release of 0.2 -public interface IQueryCreationPagePart2Registry { - - /** - * Returns an instance of {@link QueryCreationPagePartRegistryImpl}. - */ - IQueryCreationPagePart2Registry INSTANCE = null; //TODO cf. https://bugs.eclipse.org/bugs/show_bug.cgi?id=364601 - - /** - * Return a registered {@link IQueryCreationPagePart} corresponding to the given type name. - * - * @param managedTypeName - * the type we need a part for. - * @return a registered {@link IQueryCreationPagePart} corresponding to the given type name. - */ - public IQueryCreationPagePart2 getWizardPagePartFor(EClass managedQueryType); - - /** - * Returns every registered {@link IQueryCreationPagePart} associated with their managed type. - * - * @return - */ - public Map<String, IQueryCreationPagePart2> getRegisteredWizardPageParts(); - -}
diff --git a/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/emf/facet/efacet/ui/internal/ImageProvider.java b/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/emf/facet/efacet/ui/internal/ImageProvider.java deleted file mode 100644 index a829a1c..0000000 --- a/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/emf/facet/efacet/ui/internal/ImageProvider.java +++ /dev/null
@@ -1,106 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2012 Mia-Software. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Grégoire Dupé (Mia-Software) - * Nicolas Bros (Mia-Software) - * Nicolas Guyomar (Mia-Software) - Bug 339874 - Infra QuerySelectionDialog should have a "querySet" icon - * Gregoire Dupe (Mia-Software) - Bug 364325 - [Restructuring] The user must be able to navigate into a model using the Facet. - ********************************************************************************/ -package org.eclipse.emf.facet.efacet.ui.internal; - -import org.eclipse.emf.facet.util.core.Logger; -import org.eclipse.jface.resource.ImageDescriptor; -import org.eclipse.osgi.util.NLS; -import org.eclipse.swt.graphics.Image; -import org.eclipse.ui.plugin.AbstractUIPlugin; - -/** - * @author Grégoire Dupé (Mia-Software) - */ -@Deprecated -//Copied from org.eclipse.emf.facet.infra.query.ui.ImageProvider -public final class ImageProvider { - // private static final String MODEL_QUERY = "icons/modelQuery.png"; //$NON-NLS-1$ - private static final String REMOVE = "icons/remove.gif"; //$NON-NLS-1$ - private static final String REMOVE_ALL = "icons/removeAll.gif"; //$NON-NLS-1$ - private static final String MODEL_QUERY_SET = "icons/ModelQuerySet.gif"; //$NON-NLS-1$ - - private static ImageProvider singleton; - - private Image modelQuerySet; - // private Image modelQuery; - // private Image remove; - // private Image removeAll; - - private ImageProvider() { - // This method must not be instantiated - } - - /** - * Create an image descriptor from a resource - * - * @param resourcePath - * the path of the resource (in the bundle) - * @return the image descriptor - */ - private ImageDescriptor createImageDescriptor(final String resourcePath) { - ImageDescriptor imageDescriptor = AbstractUIPlugin.imageDescriptorFromPlugin( - Activator.PLUGIN_ID, resourcePath); - if (imageDescriptor == null) { - Logger.logError(NLS.bind("Resource not found: {0}", resourcePath), Activator //$NON-NLS-1$ - .getDefault()); - return ImageDescriptor.getMissingImageDescriptor(); - } - return imageDescriptor; - } - - public static ImageProvider getInstance() { - if (ImageProvider.singleton == null) { - ImageProvider.singleton = new ImageProvider(); - } - return ImageProvider.singleton; - } - - public Image getModelQuerySet() { - if (this.modelQuerySet == null) { - this.modelQuerySet = createImageDescriptor(ImageProvider.MODEL_QUERY_SET).createImage(); - } - return this.modelQuerySet; - } - // - // public Image getModelQuery() { - // if (this.modelQuery == null) { - // this.modelQuery = - // createImageDescriptor(ImageProvider.MODEL_QUERY).createImage(); - // } - // return this.modelQuery; - // } - - // public Image getRemove() { - // if (this.remove == null) { - // this.remove = createImageDescriptor(ImageProvider.REMOVE).createImage(); - // } - // return this.remove; - // } - // - // public Image getRemoveAll() { - // if (this.removeAll == null) { - // this.removeAll = - // createImageDescriptor(ImageProvider.REMOVE_ALL).createImage(); - // } - // return this.removeAll; - // } - - public ImageDescriptor getRemoveImageDescriptor() { - return createImageDescriptor(ImageProvider.REMOVE); - } - - public ImageDescriptor getRemoveAllImageDescriptor() { - return createImageDescriptor(ImageProvider.REMOVE_ALL); - } -}
diff --git a/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/emf/facet/efacet/ui/internal/Messages.java b/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/emf/facet/efacet/ui/internal/Messages.java deleted file mode 100644 index 4fd47e5..0000000 --- a/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/emf/facet/efacet/ui/internal/Messages.java +++ /dev/null
@@ -1,174 +0,0 @@ -/** - * Copyright (c) 2011, 2015 Mia-Software, CEA-LIST, and Soft-Maint. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Nicolas Guyomar (Mia-Software) - Bug 349546 - EMF Facet facetSet editor - * Nicolas Bros (Mia-Software) - Bug 370442 - rewrite the Facet loading dialog for v0.2 - * Grégoire Dupé (Mia-Software) - copied from org.eclipse.emf.facet.infra.query.ui.Messages - * Nicolas Bros (Mia-Software) - copied from org.eclipse.emf.facet.infra.query.ui.Messages - * Gregoire Dupe (Mia-Software) - Bug 364325 - [Restructuring] The user must be able to navigate into a model using the Facet. - * Nicolas Bros (Mia-Software) - Bug 372732 - [Facet] Rewrite the catalog views for 0.2 - * Nicolas Bros (Mia-Software) - Bug 372865 - FacetSet selection dialog - * Vincent Lorenzo (CEA-LIST) - Bug 357621 - Improve the label displayed for Customization and Facets - * Nicolas Bros (Mia-Software) - Bug 379518 - NLS missing messages - * Jonathan Pepin (Soft-Maint) - Bug 463907 - Command for load and save Facet serialization - * Grégoire Dupé (Mia-Software) - Bug 480654 - IllegalStateException in NavigationView.addEObjects (611) - */ -package org.eclipse.emf.facet.efacet.ui.internal; - -import org.eclipse.osgi.util.NLS; - -public class Messages extends NLS { - private static final String BUNDLE_NAME = "org.eclipse.emf.facet.efacet.ui.internal.messages"; //$NON-NLS-1$ - - public static String Enter_a_nsUri; - public static String Please_enter_nsUri; - - public static String Enter_a_prefix; - public static String ETypedElementSelectionControl_FlatView; - - public static String ETypedElementSelectionControl_invalidSelectionAtLeastOneElement; - public static String ETypedElementSelectionControl_invalidSelection; - public static String ETypedElementSelectionControl_invalidSelectionAtMostXElements; - public static String ETypedElementSelectionControl_invalidSelectionETypedElementsOnly; - public static String ETypedElementSelectionDialog_dialogTitle; - public static String ETypedElementSelectionDialog_dialogTitleMultiSelection; - public static String ETypedElementSelectionDialog_radioButtonMultiSelection; - public static String ETypedElementSelectionDialog_radioButtonNoSelection; - public static String ETypedElementSelectionDialog_radioButtonSingleSelection; - - public static String ETypedElementSelectionSortedControl_groupByMetamodelView; - - public static String ETypedElementSelectionSortedControl_toolTip; - - public static String Please_enter_prefix; - - public static String Please_select_EPackage; - public static String SaveStructuralFeatureInstanceModelHandler_FailedToSaveTheStructuralFeatureInstanceModel; - - public static String Select_EPackage; - - public static String Operation; - public static String Parameter_name; - public static String Operation_name; - public static String Reference_name; - public static String Attribute_name; - - public static String Add_an_Attribute; - public static String Add_an_Attribute_desc; - public static String Add_a_Reference; - public static String Add_a_Reference_desc; - public static String Add_an_Operation; - public static String Add_an_Operation_desc; - public static String Add_an_Operation_Parameter; - public static String Add_an_Operation_Parameter_desc; - - public static String FacetSet; - public static String FacetSetsCatalogView_categoriesColumn; - public static String FacetSetsCatalogView_documentationColumn; - public static String FacetSetsCatalogView_extendsColumn; - public static String FacetSetsCatalogView_nameColumn; - public static String FacetSetsCatalogView_viewTitle; - public static String FacetSetSelectionControl_mustSelectAtLeastOneElement; - public static String FacetSetSelectionControl_mustSelectAtMostNElements; - public static String FacetSetSelectionControl_onlyFacetSetsAllowedInSelection; - public static String FacetSetSelectionControl_selectionContainsInvalidElements; - public static String FacetSetSelectionDialog_deselectAll; - public static String FacetSetSelectionDialog_selectAll; - public static String FacetSetSelectionDialog_titleSelectFacetSet; - public static String FacetSetSelectionDialog_titleSelectFacetSets; - public static String Facet; - - public static String Changeable; - public static String Derived; - public static String Ordered; - public static String Transient; - public static String Unique; - public static String Volatile; - - public static String Lower_bound; - public static String Upper_bound; - - public static String UriWidget_EmfUri; - - public static String Select_EClass; - public static String Select_EClassifier; - public static String Select_EDataType; - - public static String NavigationView_eObjectsMustBeInTheSameResourceSet; - - public static String No_result_found; - - public static String Select; - public static String Type; - - public static String Create_FacetSet_Model; - - public static String CreateFacetInFacetSetWizardPage_could_not_find_wizard_page; - public static String Please_enter_value_for; - public static String Create_facet_in_facetSet; - - public static String CreateFacetInFacetSetWizardPage_Please_fill_extendedMetaClass; - public static String CreateFacetInFacetSetWizardPage_Sub_Typing_Facet; - public static String CreateFacetInFacetSetWizardPage_wizard_description; - public static String CreateFacetSetWizardImpl_Create_new_facet_Set; - public static String CreateFacetSetWizardImpl_FacetModel; - public static String CreateFacetSetWizardImpl_File_extension_restriction; - - public static String CreateFacetSetWizardPage_Not_a_Plugin_project; - public static String Create_Query; - public static String FilteredElementSelectionControl_type_filter_text; - public static String Load_MetaModel_Resource; - public static String FacetSetSelectionDialog_selectFacetSetsMessage; - public static String FacetSetSelectionDialog_selectFacetSetsTitle; - public static String Package_Selection; - public static String Select_Registered_URI; - - public static String ExtendedMetaClass; - public static String SelectQueryTypeWizardPage_No_wizard_found; - public static String SelectQueryTypeWizardPage_Query_Type; - - public static String SetStructuralFeatureInstanceResourceHandler_SerializationUriSettigFailed; - public static String JavaQueryWizardPage_Can_be_cached; - public static String JavaQueryWizardPage_has_side_effect; - public static String JavaQueryWizardPage_Query_name; - - //Begin copied from org.eclipse.emf.facet.infra.query.ui.Messages - public static String QueryExecutionView_0; - public static String QueryExecutionView_1; - public static String QueryExecutionView_classpathWarning; - public static String QueryExecutionView_errorInBundleClasspath; - public static String QueryExecutionView_execEnvNotAvailable; - public static String QueryExecutionView_execEnvError; - public static String QueryExecutionView_Context; - public static String QueryExecutionView_DisplayResultIn; - public static String QueryExecutionView_dragAndDropHint; - public static String QueryExecutionView_ErrorExecutingQuery; - - public static String QueryExecutionView_ETypedElementsGroup; - public static String QueryExecutionView_ExecuteButton; - public static String QueryExecutionView_ExecuteGroup; - public static String QueryExecutionView_NoQueryDisplayer; - public static String QueryExecutionView_NoQuerySelected; - public static String QueryExecutionView_NullQueryResult; - public static String QueryExecutionView_notImplementedYet; - public static String QueryExecutionView_Parameters; - public static String QueryExecutionView_Query; - public static String QueryExecutionView_QueryException; - public static String QueryExecutionView_QueryReturnedNull; - public static String QueryExecutionView_SelectQueryToExecute; - //End copied from org.eclipse.emf.facet.infra.query.ui.Messages - - static { - // initialize resource bundle - NLS.initializeMessages(Messages.BUNDLE_NAME, Messages.class); - } - - private Messages() { - } -}
diff --git a/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/emf/facet/efacet/ui/internal/actions/LoadMetaModelResourceAction.java b/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/emf/facet/efacet/ui/internal/actions/LoadMetaModelResourceAction.java deleted file mode 100644 index 00f2f86..0000000 --- a/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/emf/facet/efacet/ui/internal/actions/LoadMetaModelResourceAction.java +++ /dev/null
@@ -1,100 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009,2011 Mia-Software. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Gregoire DUPE (Mia-Software) - initial API and implementation - *******************************************************************************/ -package org.eclipse.emf.facet.efacet.ui.internal.actions; - -import java.util.Arrays; - -import org.eclipse.emf.common.util.URI; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.EPackage; -import org.eclipse.emf.ecore.EPackage.Registry; -import org.eclipse.emf.ecore.provider.EcoreEditPlugin; -import org.eclipse.emf.ecore.resource.Resource; -import org.eclipse.emf.ecore.resource.ResourceSet; -import org.eclipse.emf.edit.ui.action.LoadResourceAction; -import org.eclipse.emf.edit.ui.provider.ExtendedImageRegistry; -import org.eclipse.emf.facet.common.ui.internal.widgets.AnywhereFilterMatcher; -import org.eclipse.emf.facet.efacet.ui.internal.Messages; -import org.eclipse.jface.viewers.LabelProvider; -import org.eclipse.swt.graphics.Image; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Control; -import org.eclipse.swt.widgets.Shell; -import org.eclipse.ui.PlatformUI; -import org.eclipse.ui.dialogs.ElementListSelectionDialog; - -// This class has been copied from org.eclipse.emf.facet.infra.facet.editor.presentation.LoadMetaModelResourceAction - -/** - * @author Gregoire Dupe - * - */ -public class LoadMetaModelResourceAction extends LoadResourceAction { - - public LoadMetaModelResourceAction() { - super(); - setText(Messages.Load_MetaModel_Resource); - } - - @Override - public void run() { - Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(); - - RegisteredPackageDialog registeredPackageDialog = new RegisteredPackageDialog(shell); - registeredPackageDialog.open(); - Object[] results = registeredPackageDialog.getResult(); - // if user cancel the selection of meta models, results = null - if (results != null) { - ResourceSet resourceSet = this.domain.getResourceSet(); - for (Object result : results) { - URI uri = URI.createURI(result.toString()); - Resource r = resourceSet.getResource(uri, true); - if (!resourceSet.getResources().contains(r)) { - Registry packageRegistry = resourceSet.getPackageRegistry(); - for (EObject eObject : r.getContents()) { - if (eObject instanceof EPackage) { - EPackage ePackage = (EPackage) eObject; - packageRegistry.put(ePackage.getNsURI(), ePackage); - } - } - resourceSet.getResources().add(r); - } - } - } - } - - public class RegisteredPackageDialog extends ElementListSelectionDialog { - - public RegisteredPackageDialog(final Shell parent) { - super(parent, new LabelProvider() { - @Override - public Image getImage(final Object element) { - return ExtendedImageRegistry.getInstance().getImage(EcoreEditPlugin.INSTANCE.getImage("full/obj16/EPackage")); //$NON-NLS-1$ - } - }); - - setMultipleSelection(true); - setMessage(Messages.Select_Registered_URI); - setTitle(Messages.Package_Selection); - Object[] result = EPackage.Registry.INSTANCE.keySet().toArray(new Object[EPackage.Registry.INSTANCE.size()]); - Arrays.sort(result); - setElements(result); - } - - @Override - protected Control createDialogArea(final Composite parent) { - Composite composite = (Composite) super.createDialogArea(parent); - this.fFilteredList.setFilterMatcher(new AnywhereFilterMatcher()); - return composite; - } - } - -}
diff --git a/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/emf/facet/efacet/ui/internal/actions/ShortcutFacetSetAction.java b/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/emf/facet/efacet/ui/internal/actions/ShortcutFacetSetAction.java deleted file mode 100644 index 29950a3..0000000 --- a/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/emf/facet/efacet/ui/internal/actions/ShortcutFacetSetAction.java +++ /dev/null
@@ -1,59 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2015 Mia-Software - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Thomas Cicognani (Mia-Software) - Bug 472075 - Update API to create UI shortcuts to activate FacetSets - *******************************************************************************/ -package org.eclipse.emf.facet.efacet.ui.internal.actions; - -import java.util.HashSet; -import java.util.List; -import java.util.Set; - -import org.eclipse.emf.ecore.resource.ResourceSet; -import org.eclipse.emf.facet.efacet.core.IFacetManager; -import org.eclipse.emf.facet.efacet.core.IFacetSetCatalogManager; -import org.eclipse.emf.facet.efacet.core.IFacetSetCatalogManagerFactory; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.FacetSet; -import org.eclipse.emf.facet.efacet.ui.FacetSetShortcutActionUtils; -import org.eclipse.jface.action.Action; -import org.eclipse.jface.resource.ImageDescriptor; - -public class ShortcutFacetSetAction extends Action { - - private final String actionId; - private final IFacetManager facetManager; - - public ShortcutFacetSetAction(final String actionId, final String label, - final ImageDescriptor imageDescriptor, - final IFacetManager facetManager) { - super(label, AS_CHECK_BOX); - this.actionId = actionId; - this.facetManager = facetManager; - FacetSetShortcutActionUtils.setImageDescriptor(this, imageDescriptor); - } - - @Override - public void run() { - FacetSetShortcutActionUtils.runAction(this, this.actionId, - getAvailableFacetSets(), getAppliedFacetSets()); - } - - private Set<FacetSet> getAvailableFacetSets() { - final ResourceSet resourceSet = this.facetManager.getResourceSet(); - final IFacetSetCatalogManager catalog = IFacetSetCatalogManagerFactory.DEFAULT - .getOrCreateFacetSetCatalogManager(resourceSet); - final HashSet<FacetSet> availableFS = new HashSet<FacetSet>(); - availableFS.addAll(catalog.getRegisteredFacetSets()); - return availableFS; - } - - private List<FacetSet> getAppliedFacetSets() { - return this.facetManager.getManagedFacetSets(); - } - -}
diff --git a/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/emf/facet/efacet/ui/internal/composites/BrowseComposite.java b/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/emf/facet/efacet/ui/internal/composites/BrowseComposite.java deleted file mode 100644 index 743ab0c..0000000 --- a/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/emf/facet/efacet/ui/internal/composites/BrowseComposite.java +++ /dev/null
@@ -1,124 +0,0 @@ -/** - * Copyright (c) 2011 Mia-Software. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Nicolas Guyomar (Mia-Software) - Bug 349546 - EMF Facet facetSet editor - * Gregoire Dupe (Mia-Software) - Bug 373248 - Clean PMD errors - */ -package org.eclipse.emf.facet.efacet.ui.internal.composites; - -import org.eclipse.swt.SWT; -import org.eclipse.swt.events.KeyEvent; -import org.eclipse.swt.events.KeyListener; -import org.eclipse.swt.events.ModifyListener; -import org.eclipse.swt.events.SelectionEvent; -import org.eclipse.swt.events.SelectionListener; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.layout.GridLayout; -import org.eclipse.swt.widgets.Button; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Display; -import org.eclipse.swt.widgets.Text; - -@SuppressWarnings("PMD.ConstructorCallsOverridableMethod") -//@SuppressWarnings("PMD.ConstructorCallsOverridableMethod") Temporary: this class must be deeply refactored. -//TODO remove the @SuppressWarnings("PMD.ConstructorCallsOverridableMethod") -//cf. bug https://bugs.eclipse.org/bugs/show_bug.cgi?id=373248 -public class BrowseComposite extends Composite { - - private Text textField; - private Button browseButton; - private String browseButtonText = "..."; //$NON-NLS-1$ - - public BrowseComposite(final Composite parent, final int style) { - this(parent, style, null, true); - } - - public BrowseComposite(final Composite parent, final int style, final String buttonName, final boolean canBeChanged) { - super(parent, SWT.NONE); - if (buttonName != null) { - this.browseButtonText = buttonName; - } - setEnabled(canBeChanged); - GridLayout layout = new GridLayout(); - layout.marginHeight = 0; - layout.marginWidth = 0; - final int horizontalSpacing = 4; - layout.horizontalSpacing = horizontalSpacing; - layout.verticalSpacing = 0; - layout.makeColumnsEqualWidth = false; - layout.numColumns = 2; - setLayout(layout); - setLayoutData(new GridData(SWT.FILL, SWT.NONE, true, false)); - createWidgets(style); - init(); - } - - public void addModifyListener(final ModifyListener modifyListener) { - if (this.textField != null) { - this.textField.addModifyListener(modifyListener); - } - } - - public void removeModifyListener(final ModifyListener modifyListener) { - if (this.textField != null) { - this.textField.removeModifyListener(modifyListener); - } - } - - protected void createWidgets(final int style) { - this.textField = new Text(this, SWT.SINGLE | style); - this.browseButton = new Button(this, SWT.PUSH); - } - - private void init() { - this.textField.setEditable(false); - // We want the background white so that the user notices that there is something missing in - // the textField, but he has to use the "..." button - this.textField.setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_WHITE)); - this.textField.setBounds(getBounds()); - this.textField.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false)); - this.textField.addKeyListener(new KeyListener() { - public void keyReleased(final KeyEvent e) { - // Nothing on release - } - - public void keyPressed(final KeyEvent event) { - // Enter key pressed - if ((event.keyCode == SWT.CR && event.stateMask == 0) || (event.keyCode == SWT.KEYPAD_CR && event.stateMask == 0)) { - handleBrowse(); - } - } - }); - - this.browseButton.setText(this.browseButtonText); - this.browseButton.setEnabled(isEnabled()); - GridData data = new GridData(SWT.FILL, SWT.FILL, false, true); - this.browseButton.setLayoutData(data); - this.browseButton.addSelectionListener(new SelectionListener() { - public void widgetSelected(final SelectionEvent e) { - handleBrowse(); - } - - public void widgetDefaultSelected(final SelectionEvent e) { - // Nothing - } - }); - } - - protected void handleBrowse() { - // Meant to be overridden - } - - public void updateTextFieldContent(final String content) { - if (this.textField != null) { - this.textField.setText(content); - this.textField.setFocus(); - } - } -}
diff --git a/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/emf/facet/efacet/ui/internal/composites/FilteredElementSelectionComposite.java b/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/emf/facet/efacet/ui/internal/composites/FilteredElementSelectionComposite.java deleted file mode 100644 index c9f3857..0000000 --- a/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/emf/facet/efacet/ui/internal/composites/FilteredElementSelectionComposite.java +++ /dev/null
@@ -1,134 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010, 2011 Mia-Software. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Nicolas Bros (Mia-Software) - initial API and implementation - *******************************************************************************/ -package org.eclipse.emf.facet.efacet.ui.internal.composites; - -import org.eclipse.emf.facet.efacet.ui.internal.Messages; -import org.eclipse.jface.viewers.LabelProvider; -import org.eclipse.swt.SWT; -import org.eclipse.swt.events.KeyEvent; -import org.eclipse.swt.events.KeyListener; -import org.eclipse.swt.events.ModifyEvent; -import org.eclipse.swt.events.ModifyListener; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.layout.GridLayout; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Text; -import org.eclipse.ui.dialogs.FilteredList; - -/** - * A control for selecting an element from a list of elements, that can be filtered using the - * associated text field. - */ -public class FilteredElementSelectionComposite extends Composite { - - private final Text filterText; - private final FilteredList fFilteredList; - - public FilteredElementSelectionComposite(final Composite parent, final boolean matchAnywhere, final boolean multiSelection) { - super(parent, SWT.BORDER); - setLayout(new GridLayout()); - - this.filterText = createFilterText(this); - this.fFilteredList = createFilteredList(this, multiSelection); - - final String matchPrefix; - if (matchAnywhere) { - matchPrefix = "*"; //$NON-NLS-1$ - } else { - matchPrefix = ""; //$NON-NLS-1$ - } - - this.filterText.addModifyListener(new ModifyListener() { - public void modifyText(final ModifyEvent e) { - getfFilteredList().setFilter(matchPrefix + getFilterText().getText()); - } - }); - - this.filterText.addKeyListener(new KeyListener() { - public void keyPressed(final KeyEvent e) { - if (e.keyCode == SWT.ARROW_DOWN) { - getfFilteredList().setFocus(); - } - } - - public void keyReleased(final KeyEvent e) { - // nothing - } - }); - } - - public void setElements(final Object[] elements) { - this.fFilteredList.setElements(elements); - } - - protected static FilteredList createFilteredList(final Composite parent, final boolean multiSelection) { - int multi; - if (multiSelection) { - multi = SWT.MULTI; - } else { - multi = SWT.SINGLE; - } - final FilteredList filteredList = new FilteredList(parent, SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL | multi, new LabelProvider(), true, - false, true); - - final GridData data = new GridData(); - data.grabExcessVerticalSpace = true; - data.grabExcessHorizontalSpace = true; - data.horizontalAlignment = GridData.FILL; - data.verticalAlignment = GridData.FILL; - filteredList.setLayoutData(data); - filteredList.setFilter(""); //$NON-NLS-1$ - - return filteredList; - } - - protected static Text createFilterText(final Composite parent) { - final Text text = new Text(parent, SWT.BORDER); - text.setMessage(Messages.FilteredElementSelectionControl_type_filter_text); - - final GridData data = new GridData(); - data.grabExcessVerticalSpace = false; - data.grabExcessHorizontalSpace = true; - data.horizontalAlignment = GridData.FILL; - data.verticalAlignment = GridData.BEGINNING; - text.setLayoutData(data); - - return text; - } - - public Object getFirstSelectedElement() { - final Object[] selection = this.fFilteredList.getSelection(); - if (selection.length > 0) { - return selection[0]; - } - return null; - } - - public Object[] getSelectedElements() { - Object[] selection = this.fFilteredList.getSelection(); - if (selection.length == 0) { - return null; - } - return selection; - } - - public FilteredList getFilteredList() { - return this.fFilteredList; - } - - public Text getFilterText() { - return this.filterText; - } - - protected FilteredList getfFilteredList() { - return this.fFilteredList; - } -}
diff --git a/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/emf/facet/efacet/ui/internal/composites/SelectETypeComposite.java b/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/emf/facet/efacet/ui/internal/composites/SelectETypeComposite.java deleted file mode 100644 index f73439a..0000000 --- a/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/emf/facet/efacet/ui/internal/composites/SelectETypeComposite.java +++ /dev/null
@@ -1,172 +0,0 @@ -/** - * Copyright (c) 2011 Mia-Software. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Nicolas Guyomar (Mia-Software) - Bug 349546 - EMF Facet facetSet editor - * Gregoire Dupe (Mia-Software) - Bug 373248 - Clean PMD errors - */ -package org.eclipse.emf.facet.efacet.ui.internal.composites; - -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.ecore.EClassifier; -import org.eclipse.emf.ecore.EPackage; -import org.eclipse.emf.edit.domain.EditingDomain; -import org.eclipse.emf.facet.efacet.ui.internal.Messages; -import org.eclipse.emf.facet.efacet.ui.internal.wizards.SelectETypeWizardImpl; -import org.eclipse.jface.window.Window; -import org.eclipse.swt.SWT; -import org.eclipse.swt.events.SelectionAdapter; -import org.eclipse.swt.events.SelectionEvent; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.layout.GridLayout; -import org.eclipse.swt.widgets.Button; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Label; -import org.eclipse.swt.widgets.Text; - -@SuppressWarnings("PMD.ConstructorCallsOverridableMethod") -//@SuppressWarnings("PMD.ConstructorCallsOverridableMethod") Temporary: this class must be deeply refactored. -//TODO remove the @SuppressWarnings("PMD.ConstructorCallsOverridableMethod") -//cf. bug https://bugs.eclipse.org/bugs/show_bug.cgi?id=373248 -public class SelectETypeComposite extends Composite { - - private static final int NUMBER_COLUMN = 3; - - /** to be returned by the composite */ - private EClassifier selectedEType = null; - - private EditingDomain editingDomain; - - private Label eTypeLabel; - private Button selectButton; - private Text eTypedTextField; - - private ETypeSelectionOptions eTypeSelectionOption; - - private boolean canChangeEPackage = true; - - private final EPackage ePackage; - - public enum ETypeSelectionOptions { - ECLASSIFIER, EDATATYPE, ECLASS - } - - public SelectETypeComposite(final Composite parent, final int style, final ETypeSelectionOptions option, final boolean canChangeEPackage, - final EPackage ePackage) { - super(parent, style); - this.eTypeSelectionOption = option; - this.ePackage = ePackage; - this.canChangeEPackage = canChangeEPackage; - init(); - } - - protected void createCompositeWidget() { - this.eTypeLabel = new Label(this, SWT.NULL); - this.eTypedTextField = new Text(this, SWT.BORDER | SWT.SINGLE); - this.selectButton = new Button(this, SWT.PUSH); - } - - private void init() { - GridLayout gridLayout = new GridLayout(SelectETypeComposite.NUMBER_COLUMN, false); - setLayout(gridLayout); - createCompositeWidget(); - initializeWidgets(); - initializeLabelText(); - } - - private void initializeLabelText() { - this.eTypeLabel.setText(Messages.Type); - this.selectButton.setText(Messages.Select); - } - - protected void initializeWidgets() { - GridData gd = new GridData(GridData.FILL_HORIZONTAL); - this.eTypedTextField.setLayoutData(gd); - - this.selectButton.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(final SelectionEvent e) { - SelectETypeComposite.this.handleBrowse(); - } - }); - } - - /** - * This method call the SelectETypeWizardImpl - */ - protected void handleBrowse() { - if (this.eTypeSelectionOption == null) { - this.eTypeSelectionOption = SelectETypeComposite.ETypeSelectionOptions.ECLASSIFIER; - } - SelectETypeWizardImpl dialog = new SelectETypeWizardImpl(this.editingDomain, this.eTypeSelectionOption, this.canChangeEPackage, this.ePackage); - if (dialog.open() != Window.CANCEL) { - setEClass(dialog.getSelectedEType()); - eTypeSelected(); - } - } - - protected void eTypeSelected() { - // Meant to be implemented - } - - public void setEClass(final EClassifier eClass) { - this.selectedEType = eClass; - if (eClass != null) { - this.eTypedTextField.setText(eClass.getName()); - this.eTypedTextField.redraw(); - this.eTypedTextField.setFocus(); - } - } - - public void canChangeEType(final boolean canChange) { - // this.eTypedTextField.setEditable(true); - // this.eTypedTextField.setEnabled(false); - this.selectButton.setEnabled(canChange); - } - - public EClassifier getEType() { - return this.selectedEType; - } - - protected void setQueryLabel(final Label queryLabel) { - this.eTypeLabel = queryLabel; - } - - protected void setBrowseButton(final Button browseButton) { - this.selectButton = browseButton; - } - - protected void setQueryNameTextField(final Text queryNameTextField) { - this.eTypedTextField = queryNameTextField; - } - - public void setETypeLabel(final Label eTypeLabel) { - this.eTypeLabel = eTypeLabel; - } - - public void setSelectButton(final Button selectButton) { - this.selectButton = selectButton; - } - - public void setETypedTextField(final Text eTypedTextField) { - this.eTypedTextField = eTypedTextField; - } - - public void setEditingDomain(final EditingDomain editingDomain2) { - this.editingDomain = editingDomain2; - } - - public void setEType(final EClass type) { - this.selectedEType = type; - if (this.eTypedTextField != null) { - this.eTypedTextField.setText(this.selectedEType.getName()); - this.eTypedTextField.redraw(); - } - } - -}
diff --git a/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/emf/facet/efacet/ui/internal/dialogs/DefaultFacetLabelProvider.java b/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/emf/facet/efacet/ui/internal/dialogs/DefaultFacetLabelProvider.java deleted file mode 100644 index 6af9af9..0000000 --- a/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/emf/facet/efacet/ui/internal/dialogs/DefaultFacetLabelProvider.java +++ /dev/null
@@ -1,46 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2012 Mia-Software. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Nicolas Bros (Mia-Software) - Bug 370442 - rewrite the Facet loading dialog for v0.2 - * Nicolas Bros(Mia-Software) - Bug 370806 - [table] rewrite the "allowed contents" query selection dialog for v0.2 - *******************************************************************************/ -package org.eclipse.emf.facet.efacet.ui.internal.dialogs; - -import org.eclipse.emf.ecore.ENamedElement; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.Facet; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.FacetSet; -import org.eclipse.emf.facet.util.emf.ui.internal.utils.ImageUtils; -import org.eclipse.jface.viewers.LabelProvider; -import org.eclipse.swt.graphics.Image; - -public class DefaultFacetLabelProvider extends LabelProvider { - @Override - public String getText(final Object element) { - String label; - if (element instanceof FacetSet) { - final FacetSet facetSet = (FacetSet) element; - label = facetSet.getName(); - } else if (element instanceof Facet) { - final Facet facet = (Facet) element; - label = facet.getName(); - } else if (element instanceof ENamedElement) { - final ENamedElement namedElement = (ENamedElement) element; - label = namedElement.getName(); - } else if (element == null) { - label = "null"; //$NON-NLS-1$ - } else { - label = element.getClass().getName(); - } - return label; - } - - @Override - public Image getImage(final Object element) { - return ImageUtils.getImage(element); - } -}
diff --git a/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/emf/facet/efacet/ui/internal/dialogs/ETypedElementSelectionDialog.java b/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/emf/facet/efacet/ui/internal/dialogs/ETypedElementSelectionDialog.java deleted file mode 100644 index 1b7c50f..0000000 --- a/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/emf/facet/efacet/ui/internal/dialogs/ETypedElementSelectionDialog.java +++ /dev/null
@@ -1,241 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2015 Mia-Software, and CEA-LIST. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Nicolas Bros (Mia-Software) - * Nicolas Guyomar (Mia-Software) - Bug 339874 - Infra QuerySelectionDialog should have a "querySet" icon - * Nicolas Bros (Mia-Software) - Bug 366367 - To be able to change the "CanBePresentedInTheTable" query - * Nicolas Bros (Mia-Software) - Bug 370806 - [table] rewrite the "allowed contents" query selection dialog for v0.2 - * Vincent Lorenzo (CEA-LIST) - Bug 372644 - Create Customizable tooltips for the TreeViewer using a CustomizableLabelProvider - * Vincent Lorenzo (CEA-LIST) - Bug 357621 - Improve the label displayed for Customization and Facets - * Gregoire Dupe (Mia-Software) - Bug 375087 - [Table] ITableWidget.addColumn(List<ETypedElement>, List<FacetSet>) - * Gregoire Dupe (Mia-Software) - Bug 372626 - Aggregates - * Nicolas Bros (Mia-Software) - Bug 370806 - [table] rewrite the "allowed contents" query selection dialog for v0.2 - * Thomas Cicognani (Mia-Software) - Bug 472075 - Update API to create UI shortcuts to activate FacetSets - *******************************************************************************/ -package org.eclipse.emf.facet.efacet.ui.internal.dialogs; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.Collections; -import java.util.List; - -import org.eclipse.core.runtime.IStatus; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.EPackage; -import org.eclipse.emf.ecore.ETypedElement; -import org.eclipse.emf.facet.efacet.ui.internal.Activator; -import org.eclipse.emf.facet.efacet.ui.internal.Messages; -import org.eclipse.emf.facet.efacet.ui.internal.exported.dialog.IETypedElementSelectionDialogInternal; -import org.eclipse.emf.facet.efacet.ui.internal.widget.ETypedElementSelectionControlManager; -import org.eclipse.emf.facet.efacet.ui.internal.widget.IETypedElementSelectionControlManager; -import org.eclipse.emf.facet.util.ui.internal.exported.dialog.IDialogCallbackWithPreCommit; -import org.eclipse.jface.dialogs.IDialogSettings; -import org.eclipse.jface.viewers.IOpenListener; -import org.eclipse.jface.viewers.ISelectionChangedListener; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.jface.viewers.OpenEvent; -import org.eclipse.jface.viewers.SelectionChangedEvent; -import org.eclipse.jface.window.Window; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Control; -import org.eclipse.swt.widgets.Shell; -import org.eclipse.ui.dialogs.SelectionStatusDialog; - -/** - * A dialog to select an {@link ETypedElement} among a tree of {@link EObject}s that are children of a given set of root - * {@link EObject}s - */ -public class ETypedElementSelectionDialog<T2, D> extends SelectionStatusDialog - implements IETypedElementSelectionDialogInternal<D> { // NOPMD - - // note: the dialog should be large enough to see the validator message - private static final int DEFAULT_WIDTH = 550; - private static final int DEFAULT_HEIGHT = 550; - - private final boolean allowEmpty; - private final IDialogCallbackWithPreCommit<List<ETypedElement>, T2, D> callback; - private final Collection<? extends ETypedElement> availableElements; - private final int selectionMaxSize; - private IETypedElementSelectionControlManager manager; - private final Collection<? extends EPackage> knownEPackage; - - /** - * @param eTypedElements - * the list of ETypedElements that can be selected - * @param selectionMaxSize - * the maximum number of typed elements that the user can select - * @param allowEmpty - * whether to allow the user to select no ETypedElement (i.e : select <code>null</code>) - * @param callback - * called when the dialog closes - * @param parentShell - * the parent shell - * @param customManager - * the customization manager used by the ICustomizableLabelProvider - */ - public ETypedElementSelectionDialog(final Collection<? extends ETypedElement> eTypedElements, - final int selectionMaxSize, final boolean allowEmpty, - final IDialogCallbackWithPreCommit<List<ETypedElement>, T2, D> callback, - final Shell parentShell, - final Collection<? extends EPackage> knownEPackage) { - super(parentShell); - this.availableElements = eTypedElements; - this.selectionMaxSize = selectionMaxSize; - this.allowEmpty = allowEmpty; - this.callback = callback; - this.knownEPackage = knownEPackage; - setHelpAvailable(false); - - } - - @Override - protected Control createDialogArea(final Composite parent) { - final Composite composite = (Composite) super.createDialogArea(parent); - this.manager = new ETypedElementSelectionControlManager(composite, - this.selectionMaxSize, this.allowEmpty, this.knownEPackage); - this.manager.createContents(); - this.manager.setAvailableETypedElements(this.availableElements); - - // double-click or enter to choose the selected typed element - this.manager.addOpenListener(new IOpenListener() { - public void open(final OpenEvent event) { - ETypedElementSelectionDialog.this.okPressed(); - } - }); - - this.manager.addSelectionChangedListener(new ISelectionChangedListener() { - public void selectionChanged(final SelectionChangedEvent event) { - updateValidationStatus(); - } - }); - return composite; - } - - protected void updateValidationStatus() { - updateStatus(this.manager.getValidationStatus()); - } - - @Override - protected void configureShell(final Shell shell) { - super.configureShell(shell); - if (this.selectionMaxSize > 1) { - shell.setText(Messages.ETypedElementSelectionDialog_dialogTitleMultiSelection); - } else { - shell.setText(Messages.ETypedElementSelectionDialog_dialogTitle); - } - // TODO: image for ETypedElement - // shell.setImage(...); - } - - @Override - protected boolean isResizable() { - return true; - } - - @Override - protected IDialogSettings getDialogBoundsSettings() { - final String sectionName = this.getClass().getName() + ".settings"; //$NON-NLS-1$ - final IDialogSettings settings = Activator.getDefault().getDialogSettings(); - IDialogSettings section = settings.getSection(sectionName); - if (section == null) { - section = settings.addNewSection(sectionName); - // cf Dialog#DIALOG_WIDTH - section.put("DIALOG_WIDTH", ETypedElementSelectionDialog.DEFAULT_WIDTH); //$NON-NLS-1$ - section.put("DIALOG_HEIGHT", ETypedElementSelectionDialog.DEFAULT_HEIGHT); //$NON-NLS-1$ - } - return section; - } - - public boolean isErrorStatus() { - final IStatus validationStatus = this.manager.getValidationStatus(); - return validationStatus == null || validationStatus.getSeverity() >= IStatus.ERROR; - } - - @Override - protected void okPressed() { - if (isErrorStatus()) { - throw new IllegalStateException("The current selection is not valid"); //$NON-NLS-1$ - } - super.okPressed(); - } - - public D pressOk() { - okPressed(); - return null; - } - - public void pressCancel() { - setReturnCode(Window.CANCEL); - close(); - } - - @Override - public boolean close() { - final boolean result = super.close(); - invokeCallback(); - return result; - } - - private void invokeCallback() { - if (this.callback == null) { - return; - } - if (getReturnCode() == Window.OK) { - this.callback.committed(getSelectedETypedElements(), null); - } - } - - public List<ETypedElement> getSelectedETypedElements() { - List<ETypedElement> currentlySelected = new ArrayList<ETypedElement>(); - if (this.manager.isDisposed()) { - final Object[] result = getResult(); - if (result == null) { - throw new UnsupportedOperationException("No selection available because the dialog was canceled"); //$NON-NLS-1$ - } - for (Object current : result) { - currentlySelected.add((ETypedElement) current); - } - } else { - currentlySelected = this.manager.computeResult(); - } - return Collections.unmodifiableList(currentlySelected); - } - - public ETypedElement getFirstSelectedETypedElement() { - ETypedElement result = null; - final List<ETypedElement> typedElements = getSelectedETypedElements(); - if (typedElements != null && !typedElements.isEmpty()) { - result = typedElements.get(0); - } - return result; - } - - public void setSelectedETypedElements(final List<? extends ETypedElement> newSelection) { - if (newSelection == null) { - throw new IllegalArgumentException(); - } - this.manager.setSelectedETypedElements(newSelection); - updateValidationStatus(); - } - - public void setSelection(final IStructuredSelection selection) { - this.manager.setSelection(selection); - updateValidationStatus(); - } - - @Override - protected void computeResult() { - // we build the result - final List<ETypedElement> currentSelection = this.manager.computeResult(); - setResult(currentSelection); - } - - public boolean isOkButtonEnabled() { - return getOkButton().isEnabled(); - } -}
diff --git a/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/emf/facet/efacet/ui/internal/dialogs/ETypedElementSelectionDialogFactory.java b/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/emf/facet/efacet/ui/internal/dialogs/ETypedElementSelectionDialogFactory.java deleted file mode 100644 index 29437d7..0000000 --- a/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/emf/facet/efacet/ui/internal/dialogs/ETypedElementSelectionDialogFactory.java +++ /dev/null
@@ -1,51 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2012, 2015 Mia-Software, and CEA-LIST. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Nicolas Bros (Mia-Software) - Bug 370442 - rewrite the Facet loading dialog for v0.2 - * Nicolas Bros (Mia-Software) - Bug 370806 - [table] rewrite the "allowed contents" query selection dialog for v0.2 - * Vincent Lorenzo (CEA-LIST) - Bug 372644 - Create Customizable tooltips for the TreeViewer using a CustomizableLabelProvider - * Gregoire Dupe (Mia-Software) - Bug 375087 - [Table] ITableWidget.addColumn(List<ETypedElement>, List<FacetSet>) - * Gregoire Dupe (Mia-Software) - Bug 372626 - Aggregates - * Thomas Cicognani (Mia-Software) - Bug 472075 - Update API to create UI shortcuts to activate FacetSets - *******************************************************************************/ -package org.eclipse.emf.facet.efacet.ui.internal.dialogs; - -import java.util.Collection; -import java.util.List; - -import org.eclipse.emf.ecore.EPackage; -import org.eclipse.emf.ecore.ETypedElement; -import org.eclipse.emf.facet.custom.core.ICustomizationManager; -import org.eclipse.emf.facet.efacet.ui.internal.exported.dialog.IETypedElementSelectionDialog; -import org.eclipse.emf.facet.efacet.ui.internal.exported.dialog.IETypedElementSelectionDialogFactory; -import org.eclipse.emf.facet.util.ui.internal.exported.dialog.IDialogCallbackWithPreCommit; -import org.eclipse.swt.widgets.Display; -import org.eclipse.swt.widgets.Shell; - -public class ETypedElementSelectionDialogFactory implements IETypedElementSelectionDialogFactory { - - public <T2, D> IETypedElementSelectionDialog<D> openETypedElementSelectionDialog( - final Collection<? extends ETypedElement> eTypedElements, - final int selectionMaxSize, - final boolean allowEmpty, - final IDialogCallbackWithPreCommit<List<ETypedElement>, T2, D> callback, - final Shell parentShell, final ICustomizationManager customManager, - final Collection<? extends EPackage> knownFacetSets) { - final ETypedElementSelectionDialog<T2, D> dialog = new ETypedElementSelectionDialog<T2, D>( - eTypedElements, selectionMaxSize, allowEmpty, callback, - parentShell, knownFacetSets); - // must be synchronous, otherwise the shell is not created before SynchronizedETypedElementSelectionDialog, and SynchronizedComposite throws a NPE - Display.getDefault().syncExec(new Runnable() { - public void run() { - dialog.setBlockOnOpen(false); - dialog.open(); - } - }); - return new SynchronizedETypedElementSelectionDialog<T2, D>(dialog); - } -}
diff --git a/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/emf/facet/efacet/ui/internal/dialogs/FacetSetSelectionDialog.java b/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/emf/facet/efacet/ui/internal/dialogs/FacetSetSelectionDialog.java deleted file mode 100644 index 638918b..0000000 --- a/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/emf/facet/efacet/ui/internal/dialogs/FacetSetSelectionDialog.java +++ /dev/null
@@ -1,229 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2012 CEA LIST. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Nicolas Bros (Mia-Software) - Bug 372865 - FacetSet selection dialog - * Gregoire Dupe (Mia-Software) - Bug 372626 - Aggregates - *******************************************************************************/ -package org.eclipse.emf.facet.efacet.ui.internal.dialogs; - -import java.util.Collection; -import java.util.List; - -import org.eclipse.core.runtime.Assert; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.FacetSet; -import org.eclipse.emf.facet.efacet.ui.internal.Activator; -import org.eclipse.emf.facet.efacet.ui.internal.Messages; -import org.eclipse.emf.facet.efacet.ui.internal.exported.dialog.IFacetSetSelectionDialogInternal; -import org.eclipse.emf.facet.efacet.ui.internal.widget.FacetSetSelectionControl; -import org.eclipse.emf.facet.util.ui.internal.exported.dialog.IDialogCallback; -import org.eclipse.emf.facet.util.ui.internal.exported.dialog.IDialogCallbackWithPreCommit; -import org.eclipse.jface.dialogs.IDialogConstants; -import org.eclipse.jface.dialogs.IDialogSettings; -import org.eclipse.jface.viewers.TreeViewer; -import org.eclipse.jface.window.Window; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Control; -import org.eclipse.swt.widgets.Display; -import org.eclipse.swt.widgets.Shell; -import org.eclipse.ui.dialogs.SelectionStatusDialog; - -/** - * A dialog to select {@link FacetSet}s - * - * @param <T> - * the type of a pre-commit dialog - */ -public class FacetSetSelectionDialog<T> extends SelectionStatusDialog implements IFacetSetSelectionDialogInternal<T> { - - // note: the dialog should be large enough to see the validator message - private static final int DEFAULT_WIDTH = 800; - private static final int DEFAULT_HEIGHT = 600; - - private final Collection<FacetSet> available; - private final int selectionMaxSize; - private final boolean allowEmpty; - private final IDialogCallbackWithPreCommit<List<FacetSet>, Boolean, T> callback; - private FacetSetSelectionControl selectionControl; - - public FacetSetSelectionDialog(final Collection<FacetSet> available, - final int selectionMaxSize, final boolean allowEmpty, - final IDialogCallbackWithPreCommit<List<FacetSet>, Boolean, T> callback, final Shell parentShell) { - super(parentShell); - Assert.isLegal(callback != null, "available cannot be null"); //$NON-NLS-1$ - Assert.isLegal(callback != null, "callback cannot be null"); //$NON-NLS-1$ - Assert.isLegal(selectionMaxSize > 0, "selectionMaxSize must be > 0"); //$NON-NLS-1$ - this.available = available; - this.selectionMaxSize = selectionMaxSize; - this.allowEmpty = allowEmpty; - this.callback = callback; - setHelpAvailable(false); - } - - @Override - protected Control createDialogArea(final Composite parent) { - final Composite composite = (Composite) super.createDialogArea(parent); - final Runnable onChange = new Runnable() { - public void run() { - updateValidationStatus(); - } - }; - this.selectionControl = createFacetSetSelectionControl(composite, onChange); - this.selectionControl.createContents(); - this.selectionControl.setAvailableFacetSets(this.available); - updateValidationStatus(); - return composite; - } - - protected FacetSetSelectionControl createFacetSetSelectionControl(final Composite parentComposite, final Runnable onChange) { - return new FacetSetSelectionControl(parentComposite, this.selectionMaxSize, this.allowEmpty, onChange); - } - - @Override - protected void createButtonsForButtonBar(final Composite parent) { - createButton(parent, IDialogConstants.SELECT_ALL_ID, Messages.FacetSetSelectionDialog_selectAll, false); - createButton(parent, IDialogConstants.DESELECT_ALL_ID, Messages.FacetSetSelectionDialog_deselectAll, false); - super.createButtonsForButtonBar(parent); - } - - @Override - protected void buttonPressed(final int buttonId) { - super.buttonPressed(buttonId); - if (IDialogConstants.SELECT_ALL_ID == buttonId) { - selectAll(); - } else if (IDialogConstants.DESELECT_ALL_ID == buttonId) { - deselectAll(); - } - } - - protected void updateValidationStatus() { - updateStatus(this.selectionControl.getValidationStatus()); - } - - @Override - protected void configureShell(final Shell shell) { - super.configureShell(shell); - if (this.selectionMaxSize > 1) { - shell.setText(Messages.FacetSetSelectionDialog_titleSelectFacetSets); - } else { - shell.setText(Messages.FacetSetSelectionDialog_titleSelectFacetSet); - } - } - - @Override - protected boolean isResizable() { - return true; - } - - @Override - protected IDialogSettings getDialogBoundsSettings() { - final String sectionName = this.getClass().getName() + ".settings"; //$NON-NLS-1$ - final IDialogSettings settings = Activator.getDefault().getDialogSettings(); - IDialogSettings section = settings.getSection(sectionName); - if (section == null) { - section = settings.addNewSection(sectionName); - // cf Dialog#DIALOG_WIDTH - section.put("DIALOG_WIDTH", FacetSetSelectionDialog.DEFAULT_WIDTH); //$NON-NLS-1$ - section.put("DIALOG_HEIGHT", FacetSetSelectionDialog.DEFAULT_HEIGHT); //$NON-NLS-1$ - } - return section; - } - - public boolean isErrorStatus() { - final IStatus validationStatus = this.selectionControl.getValidationStatus(); - return validationStatus == null || validationStatus.getSeverity() >= IStatus.ERROR; - } - - public T pressOk() { - final IDialogCallback<Boolean> precommitCallBack = new IDialogCallback<Boolean>() { - public void committed(final Boolean precommitResult) { - commit(precommitResult); - } - }; - final T dialog = this.callback.openPrecommitDialog( - getSelectedFacetSets(), - precommitCallBack); - if (dialog == null) { - commit(Boolean.TRUE); - } - return dialog; - } - - public void pressCancel() { - setReturnCode(Window.CANCEL); - close(); - } - - @Override - protected void okPressed() { - pressOk(); - } - - @Override - protected void cancelPressed() { - pressCancel(); - } - - protected void commit(final Boolean precommitResult) { - // since the callback is called from client code, we need to ensure we are running on the UI thread - Display.getDefault().syncExec(new Runnable() { - public void run() { - commitOnUIThread(precommitResult); - } - }); - } - - protected void commitOnUIThread(final Boolean precommitResult) { - final List<FacetSet> selectedFacetSets = getSelectedFacetSets(); - setReturnCode(Window.OK); - close(); - this.callback.committed(selectedFacetSets, precommitResult); - } - - @Override - public int open() { - // so that this dialog can be manipulated programmatically - setBlockOnOpen(false); - return super.open(); - } - - public List<FacetSet> getSelectedFacetSets() { - if (this.selectionControl.isDisposed()) { - throw new UnsupportedOperationException("No selection available because the dialog is closed"); //$NON-NLS-1$ - } - return this.selectionControl.getSelectedFacetSets(); - } - - public void setSelectedFacetSets(final List<? extends FacetSet> newSelection) { - this.selectionControl.setSelectedFacetSets(newSelection); - updateValidationStatus(); - } - - public void selectAll() { - this.selectionControl.selectAll(); - updateValidationStatus(); - } - - public void deselectAll() { - this.selectionControl.deselectAll(); - updateValidationStatus(); - } - - public boolean isOkButtonEnabled() { - return getOkButton().isEnabled(); - } - - @Override - protected void computeResult() { - // nothing : the dialog is not used in a standard way : use the callback - } - - public TreeViewer getTreeViewer() { - return this.selectionControl.getTreeViewer(); - } -} \ No newline at end of file
diff --git a/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/emf/facet/efacet/ui/internal/dialogs/FacetSetSelectionDialogFactory.java b/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/emf/facet/efacet/ui/internal/dialogs/FacetSetSelectionDialogFactory.java deleted file mode 100644 index a197483..0000000 --- a/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/emf/facet/efacet/ui/internal/dialogs/FacetSetSelectionDialogFactory.java +++ /dev/null
@@ -1,72 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2012 CEA LIST. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Nicolas Bros (Mia-Software) - Bug 372865 - FacetSet selection dialog - *******************************************************************************/ -package org.eclipse.emf.facet.efacet.ui.internal.dialogs; - -import java.util.Collection; -import java.util.List; - -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.FacetSet; -import org.eclipse.emf.facet.efacet.ui.internal.exported.dialog.IFacetSetSelectionDialog; -import org.eclipse.emf.facet.efacet.ui.internal.exported.dialog.IFacetSetSelectionDialogFactory; -import org.eclipse.emf.facet.util.ui.internal.exported.dialog.IDialogCallback; -import org.eclipse.emf.facet.util.ui.internal.exported.dialog.IDialogCallbackWithPreCommit; -import org.eclipse.swt.widgets.Display; -import org.eclipse.swt.widgets.Shell; - -public class FacetSetSelectionDialogFactory implements IFacetSetSelectionDialogFactory { - - private class DummyPrecommitDialog { // NOPMD - // placeholder type - } - - public IFacetSetSelectionDialog<?> openFacetSetSelectionDialog( - final Collection<FacetSet> available, final int selectionMaxSize, final boolean allowEmpty, - final IDialogCallback<List<FacetSet>> callback, final Shell parentShell) { - - final IDialogCallbackWithPreCommit<List<FacetSet>, Boolean, FacetSetSelectionDialogFactory.DummyPrecommitDialog> wrappedCallback = - new IDialogCallbackWithPreCommit<List<FacetSet>, Boolean, FacetSetSelectionDialogFactory.DummyPrecommitDialog>() { - public void committed(final List<FacetSet> result, final Boolean precommitResult) { - callback.committed(result); - } - - public DummyPrecommitDialog openPrecommitDialog(final List<FacetSet> result, final IDialogCallback<Boolean> precommitCallback) { - return null; - } - }; - - final FacetSetSelectionDialog<FacetSetSelectionDialogFactory.DummyPrecommitDialog> dialog = - new FacetSetSelectionDialog<FacetSetSelectionDialogFactory.DummyPrecommitDialog>( - available, selectionMaxSize, allowEmpty, wrappedCallback, parentShell); - // must be synchronous, otherwise the shell is not created before SynchronizedFacetSetsSelectionDialog, and - // SynchronizedComposite throws a NPE - Display.getDefault().syncExec(new Runnable() { - public void run() { - dialog.open(); - } - }); - return new SynchronizedFacetSetSelectionDialog<FacetSetSelectionDialogFactory.DummyPrecommitDialog>(dialog); - } - - public <T> IFacetSetSelectionDialog<T> openFacetSetSelectionDialog( - final Collection<FacetSet> available, final int selectionMaxSize, final boolean allowEmpty, - final IDialogCallbackWithPreCommit<List<FacetSet>, Boolean, T> callback, final Shell parentShell) { - final FacetSetSelectionDialog<T> dialog = new FacetSetSelectionDialog<T>(available, - selectionMaxSize, allowEmpty, callback, parentShell); - // must be synchronous, otherwise the shell is not created before SynchronizedFacetSetsSelectionDialog, and - // SynchronizedComposite throws a NPE - Display.getDefault().syncExec(new Runnable() { - public void run() { - dialog.open(); - } - }); - return new SynchronizedFacetSetSelectionDialog<T>(dialog); - } -}
diff --git a/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/emf/facet/efacet/ui/internal/dialogs/FacetSetTreeContentProvider.java b/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/emf/facet/efacet/ui/internal/dialogs/FacetSetTreeContentProvider.java deleted file mode 100644 index d7972b2..0000000 --- a/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/emf/facet/efacet/ui/internal/dialogs/FacetSetTreeContentProvider.java +++ /dev/null
@@ -1,94 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2012 Mia-Software. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Nicolas Bros (Mia-Software) - Bug 370442 - rewrite the Facet loading dialog for v0.2 - * Nicolas Bros (Mia-Software) - Bug 371367 - Hierarchical FacetSets - * Nicolas Bros (Mia-Software) - Bug 372626 - Aggregates - * Nicolas Bros (Mia-Software) - Bug 372865 - FacetSet selection dialog - * Gregoire Dupe (Mia-Software) - Bug 373078 - API Cleaning - *******************************************************************************/ -package org.eclipse.emf.facet.efacet.ui.internal.dialogs; - -import java.util.ArrayList; -import java.util.List; - -import org.eclipse.emf.ecore.EPackage; -import org.eclipse.emf.facet.efacet.core.FacetUtils; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.Facet; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.FacetSet; -import org.eclipse.jface.viewers.ITreeContentProvider; -import org.eclipse.jface.viewers.Viewer; - -public class FacetSetTreeContentProvider implements ITreeContentProvider { - - private final boolean bFacets; - private final boolean bContainedFS; - private final boolean bSubpackages; - - public FacetSetTreeContentProvider(final boolean facets, final boolean containedFSs, final boolean subpackages) { - this.bFacets = facets; - this.bContainedFS = containedFSs; - this.bSubpackages = subpackages; - } - - public FacetSetTreeContentProvider() { - this(true, true, true); - } - - public Object[] getElements(final Object inputElement) { - if (inputElement == null) { - throw new IllegalArgumentException("inputElement must not be null"); //$NON-NLS-1$ - } - if (!(inputElement instanceof Object[])) { - throw new IllegalArgumentException("inputElement must be an array"); //$NON-NLS-1$ - } - return (Object[]) inputElement; - } - - public void inputChanged(final Viewer viewer, final Object oldInput, final Object newInput) { - // Nothing to do - } - - public Object[] getChildren(final Object parentElement) { - final List<Object> children = new ArrayList<Object>(); - if (parentElement instanceof FacetSet) { - final FacetSet facetSet = (FacetSet) parentElement; - if (this.bContainedFS) { - children.addAll(facetSet.getFacetSets()); - } - if (this.bFacets) { - children.addAll(FacetUtils.getFacets(facetSet)); - } - if (this.bSubpackages) { - children.addAll(facetSet.getESubpackages()); - } - } - return children.toArray(); - } - - public Object getParent(final Object element) { - Object parent = null; - if (element instanceof Facet) { - final Facet facet = (Facet) element; - parent = FacetUtils.getFacetSet(facet); - } else if (element instanceof EPackage) { - final EPackage ePackage = (EPackage) element; - parent = ePackage.getESuperPackage(); - } - return parent; - } - - public boolean hasChildren(final Object element) { - return getChildren(element).length > 0; - } - - public void dispose() { - // Nothing to do - } - -}
diff --git a/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/emf/facet/efacet/ui/internal/dialogs/SynchronizedETypedElementSelectionDialog.java b/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/emf/facet/efacet/ui/internal/dialogs/SynchronizedETypedElementSelectionDialog.java deleted file mode 100644 index c1330f6..0000000 --- a/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/emf/facet/efacet/ui/internal/dialogs/SynchronizedETypedElementSelectionDialog.java +++ /dev/null
@@ -1,101 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2012 Mia-Software. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Nicolas Bros (Mia-Software) - Bug 370442 - rewrite the Facet loading dialog for v0.2 - * Nicolas Bros (Mia-Software) - Bug 370806 - [table] rewrite the "allowed contents" query selection dialog for v0.2 - * Gregoire Dupe (Mia-Software) - Bug 375087 - [Table] ITableWidget.addColumn(List<ETypedElement>, List<FacetSet>) - *******************************************************************************/ -package org.eclipse.emf.facet.efacet.ui.internal.dialogs; - -import java.util.List; - -import org.eclipse.emf.ecore.ETypedElement; -import org.eclipse.emf.facet.efacet.ui.internal.exported.dialog.IETypedElementSelectionDialog; -import org.eclipse.emf.facet.efacet.ui.internal.exported.dialog.IETypedElementSelectionDialogInternal; -import org.eclipse.emf.facet.util.ui.internal.exported.displaysync.AbstractExceptionFreeRunnable; -import org.eclipse.emf.facet.util.ui.internal.exported.displaysync.AbstractVoidExceptionFreeRunnable; -import org.eclipse.emf.facet.util.ui.internal.exported.displaysync.SynchronizedComposite; -import org.eclipse.swt.widgets.Shell; - -/** A synchronization facade for {@link IETypedElementSelectionDialog}. */ -public class SynchronizedETypedElementSelectionDialog<T2, D> extends - SynchronizedComposite<Shell> implements - IETypedElementSelectionDialogInternal<D> { - - private final IETypedElementSelectionDialogInternal<D> dialog; - - public IETypedElementSelectionDialogInternal<D> getDialog() { - return this.dialog; - } - - public SynchronizedETypedElementSelectionDialog( - final ETypedElementSelectionDialog<T2, D> delegate) { - super(delegate.getShell()); - this.dialog = delegate; - } - - public D pressOk() { - return safeSyncExec(new AbstractExceptionFreeRunnable<D>() { - @Override - public D safeRun() { - return getDialog().pressOk(); - } - }); - } - - public void pressCancel() { - voidExceptionFreeRunnable(new AbstractVoidExceptionFreeRunnable() { - @Override - public void voidSafeRun() { - getDialog().pressCancel(); - } - }); - - } - - public List<ETypedElement> getSelectedETypedElements() { - return safeSyncExec(new AbstractExceptionFreeRunnable<List<ETypedElement>>() { - @Override - public List<ETypedElement> safeRun() { - return getDialog().getSelectedETypedElements(); - } - }); - } - - public ETypedElement getFirstSelectedETypedElement() { - return safeSyncExec(new AbstractExceptionFreeRunnable<ETypedElement>() { - @Override - public ETypedElement safeRun() { - return getDialog().getFirstSelectedETypedElement(); - } - }); - } - - public void setSelectedETypedElements(final List<? extends ETypedElement> newSelection) { - voidExceptionFreeRunnable(new AbstractVoidExceptionFreeRunnable() { - @Override - public void voidSafeRun() { - getDialog().setSelectedETypedElements(newSelection); - - } - }); - } - - public int getReturnCode() { - return getDialog().getReturnCode(); - } - - public boolean isOkButtonEnabled() { - return safeSyncExec(new AbstractExceptionFreeRunnable<Boolean>() { - @Override - public Boolean safeRun() { - return Boolean.valueOf(getDialog().isOkButtonEnabled()); - } - }).booleanValue(); - } -}
diff --git a/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/emf/facet/efacet/ui/internal/dialogs/SynchronizedFacetSetSelectionDialog.java b/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/emf/facet/efacet/ui/internal/dialogs/SynchronizedFacetSetSelectionDialog.java deleted file mode 100644 index abd2b17..0000000 --- a/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/emf/facet/efacet/ui/internal/dialogs/SynchronizedFacetSetSelectionDialog.java +++ /dev/null
@@ -1,102 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2012 CEA LIST. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Nicolas Bros (Mia-Software) - Bug 372865 - FacetSet selection dialog - *******************************************************************************/ -package org.eclipse.emf.facet.efacet.ui.internal.dialogs; - -import java.util.List; - -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.FacetSet; -import org.eclipse.emf.facet.efacet.ui.internal.exported.dialog.IFacetSetSelectionDialog; -import org.eclipse.emf.facet.efacet.ui.internal.exported.dialog.IFacetSetSelectionDialogInternal; -import org.eclipse.emf.facet.util.ui.internal.exported.displaysync.AbstractExceptionFreeRunnable; -import org.eclipse.emf.facet.util.ui.internal.exported.displaysync.AbstractVoidExceptionFreeRunnable; -import org.eclipse.emf.facet.util.ui.internal.exported.displaysync.SynchronizedComposite; -import org.eclipse.jface.viewers.TreeViewer; -import org.eclipse.swt.widgets.Shell; - -/** A synchronization facade for {@link IFacetSetSelectionDialog}. */ -public class SynchronizedFacetSetSelectionDialog<T> extends SynchronizedComposite<Shell> implements IFacetSetSelectionDialogInternal<T> { - - private final IFacetSetSelectionDialogInternal<T> dialog; - - public IFacetSetSelectionDialogInternal<T> getDialog() { - return this.dialog; - } - - public SynchronizedFacetSetSelectionDialog(final FacetSetSelectionDialog<T> delegate) { - super(delegate.getShell()); - this.dialog = delegate; - } - - public void setSelectedFacetSets(final List<? extends FacetSet> newSelection) { - voidExceptionFreeRunnable(new AbstractVoidExceptionFreeRunnable() { - @Override - public void voidSafeRun() { - getDialog().setSelectedFacetSets(newSelection); - - } - }); - } - - public T pressOk() { - return safeSyncExec(new AbstractExceptionFreeRunnable<T>() { - @Override - public T safeRun() { - return getDialog().pressOk(); - } - }); - } - - public void pressCancel() { - voidExceptionFreeRunnable(new AbstractVoidExceptionFreeRunnable() { - @Override - public void voidSafeRun() { - getDialog().pressCancel(); - } - }); - } - - public void selectAll() { - voidExceptionFreeRunnable(new AbstractVoidExceptionFreeRunnable() { - @Override - public void voidSafeRun() { - getDialog().selectAll(); - } - }); - } - - public void deselectAll() { - voidExceptionFreeRunnable(new AbstractVoidExceptionFreeRunnable() { - @Override - public void voidSafeRun() { - getDialog().deselectAll(); - } - }); - } - - public boolean isOkButtonEnabled() { - return safeSyncExec(new AbstractExceptionFreeRunnable<Boolean>() { - @Override - public Boolean safeRun() { - return Boolean.valueOf(getDialog().isOkButtonEnabled()); - } - }).booleanValue(); - } - - public TreeViewer getTreeViewer() { - return safeSyncExec(new AbstractExceptionFreeRunnable<TreeViewer>() { - @Override - public TreeViewer safeRun() { - return getDialog().getTreeViewer(); - } - }); - } - -}
diff --git a/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/emf/facet/efacet/ui/internal/dialogs/UriDialog.java b/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/emf/facet/efacet/ui/internal/dialogs/UriDialog.java deleted file mode 100644 index 9465f35..0000000 --- a/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/emf/facet/efacet/ui/internal/dialogs/UriDialog.java +++ /dev/null
@@ -1,72 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2015 Soft-Maint. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Jonathan Pepin (Soft-Maint) - Bug 463907 - Command for load and save Facet serialization - *******************************************************************************/ -package org.eclipse.emf.facet.efacet.ui.internal.dialogs; - -import org.eclipse.emf.common.util.URI; -import org.eclipse.emf.facet.efacet.ui.internal.exported.widget.IUriWidget; -import org.eclipse.emf.facet.efacet.ui.internal.exported.widget.IUriWidgetFactory; -import org.eclipse.emf.facet.util.ui.internal.exported.dialog.IDialog; -import org.eclipse.emf.facet.util.ui.internal.exported.dialog.IDialogCallback; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Control; -import org.eclipse.swt.widgets.Shell; -import org.eclipse.ui.dialogs.SelectionStatusDialog; - -public class UriDialog extends SelectionStatusDialog implements IDialog<IUriWidget> { - - private IUriWidget widget; - private final IDialogCallback<URI> callback; - private final URI initialUri; - - public UriDialog(final URI uri, final IDialogCallback<URI> callback, - final Shell parentShell) { - super(parentShell); - this.initialUri = uri; - this.callback = callback; - } - - @Override - protected Control createDialogArea(final Composite parent) { - final Composite composite = (Composite) super.createDialogArea(parent); - this.widget = IUriWidgetFactory.DEFAULT.createUriWidget(composite); - this.widget.setURI(this.initialUri); - return super.createDialogArea(parent); - } - - @Override - protected void computeResult() { - // Nothing to do - } - - public void commit() { - final URI uri = this.widget.getURI(); - this.callback.committed(uri); - super.okPressed(); - } - - @Override - protected void okPressed() { - commit(); - } - - public void cancel() { - cancelPressed(); - } - - public boolean isDialogValid() { - return this.widget.getURI() != null; - } - - public IUriWidget getWidget() { - return this.widget; - } - -}
diff --git a/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/emf/facet/efacet/ui/internal/dialogs/UriDialogFactory.java b/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/emf/facet/efacet/ui/internal/dialogs/UriDialogFactory.java deleted file mode 100644 index 0978133..0000000 --- a/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/emf/facet/efacet/ui/internal/dialogs/UriDialogFactory.java +++ /dev/null
@@ -1,35 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2015 Soft-Maint. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Jonathan Pepin (Soft-Maint) - Bug 463907 - Command for load and save Facet serialization - *******************************************************************************/ -package org.eclipse.emf.facet.efacet.ui.internal.dialogs; - -import org.eclipse.emf.common.util.URI; -import org.eclipse.emf.facet.efacet.ui.internal.exported.dialog.IUriDialogFactory; -import org.eclipse.emf.facet.efacet.ui.internal.exported.widget.IUriWidget; -import org.eclipse.emf.facet.util.ui.internal.exported.dialog.IDialog; -import org.eclipse.emf.facet.util.ui.internal.exported.dialog.IDialogCallback; -import org.eclipse.swt.widgets.Display; -import org.eclipse.swt.widgets.Shell; - -public class UriDialogFactory implements IUriDialogFactory { - - public IDialog<IUriWidget> openUriDialog(final URI uri, - final IDialogCallback<URI> callback, final Shell parentShell, - final Display display) { - final UriDialog dialog = new UriDialog(uri, callback, parentShell); - display.asyncExec(new Runnable() { - public void run() { - dialog.open(); - } - }); - return dialog; - } - -}
diff --git a/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/emf/facet/efacet/ui/internal/exported/EFacetUIConstants.java b/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/emf/facet/efacet/ui/internal/exported/EFacetUIConstants.java deleted file mode 100644 index 219df11..0000000 --- a/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/emf/facet/efacet/ui/internal/exported/EFacetUIConstants.java +++ /dev/null
@@ -1,24 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2012 CEA LIST. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Nicolas Bros (Mia-Software) - Bug 372626 - Aggregates - *******************************************************************************/ -package org.eclipse.emf.facet.efacet.ui.internal.exported; - -public final class EFacetUIConstants { - - private static final String CATALOG_VIEW_ID = "org.eclipse.emf.facet.efacet.ui.view.catalog"; //$NON-NLS-1$ - - private EFacetUIConstants() { - // utility class - } - - public static String getFacetSetsCatalogViewId() { - return EFacetUIConstants.CATALOG_VIEW_ID; - } -}
diff --git a/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/emf/facet/efacet/ui/internal/exported/dialog/IETypedElementSelectionDialog.java b/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/emf/facet/efacet/ui/internal/exported/dialog/IETypedElementSelectionDialog.java deleted file mode 100644 index 08811d9..0000000 --- a/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/emf/facet/efacet/ui/internal/exported/dialog/IETypedElementSelectionDialog.java +++ /dev/null
@@ -1,35 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2012 Mia-Software. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Nicolas Bros (Mia-Software) - Bug 370806 - [table] rewrite the "allowed contents" query selection dialog for v0.2 - * Gregoire Dupe (Mia-Software) - Bug 375087 - [Table] ITableWidget.addColumn(List<ETypedElement>, List<FacetSet>) - *******************************************************************************/ -package org.eclipse.emf.facet.efacet.ui.internal.exported.dialog; - -import java.util.List; - -import org.eclipse.emf.ecore.ETypedElement; - -/** - * A dialog to let the user select ETypedElements. - * - * @noextend This interface is not intended to be extended by clients. - * @noimplement This interface is not intended to be implemented by clients. - * @since 0.2.0 - */ -public interface IETypedElementSelectionDialog<D> { - - /** Set the selection to the given list of ETypedElements */ - void setSelectedETypedElements(List<? extends ETypedElement> newSelection); - - /** Emulate a press on the OK button */ - D pressOk(); - - /** Emulate a press on the Cancel button */ - void pressCancel(); -}
diff --git a/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/emf/facet/efacet/ui/internal/exported/dialog/IETypedElementSelectionDialogCallback.java b/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/emf/facet/efacet/ui/internal/exported/dialog/IETypedElementSelectionDialogCallback.java deleted file mode 100644 index 5eebec0..0000000 --- a/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/emf/facet/efacet/ui/internal/exported/dialog/IETypedElementSelectionDialogCallback.java +++ /dev/null
@@ -1,30 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2012 Mia-Software. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Nicolas Bros (Mia-Software) - Bug 370806 - [table] rewrite the "allowed contents" query selection dialog for v0.2 - *******************************************************************************/ -package org.eclipse.emf.facet.efacet.ui.internal.exported.dialog; - -import java.util.List; - -import org.eclipse.emf.ecore.ETypedElement; - -/** - * Called when a {@link IETypedElementSelectionDialog} is closed, either by OK or Cancel. - * <p> - * This interface is intended to be implemented by clients. - * - * @since 0.2.0 - */ -public interface IETypedElementSelectionDialogCallback { - /** The user canceled the dialog */ - void canceled(); - - /** The user committed their selection in the dialog */ - void committed(List<ETypedElement> selection); -}
diff --git a/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/emf/facet/efacet/ui/internal/exported/dialog/IETypedElementSelectionDialogFactory.java b/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/emf/facet/efacet/ui/internal/exported/dialog/IETypedElementSelectionDialogFactory.java deleted file mode 100644 index 2e72669..0000000 --- a/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/emf/facet/efacet/ui/internal/exported/dialog/IETypedElementSelectionDialogFactory.java +++ /dev/null
@@ -1,62 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2012 Mia-Software. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Nicolas Bros (Mia-Software) - Bug 370806 - [table] rewrite the "allowed contents" query selection dialog for v0.2 - * Vincent Lorenzo (CEA-LIST) - Bug 372644 - Create Customizable tooltips for the TreeViewer using a CustomizableLabelProvider - * Gregoire Dupe (Mia-Software) - Bug 375087 - [Table] ITableWidget.addColumn(List<ETypedElement>, List<FacetSet>) - * Gregoire Dupe (Mia-Software) - Bug 372626 - Aggregates - *******************************************************************************/ -package org.eclipse.emf.facet.efacet.ui.internal.exported.dialog; - -import java.util.Collection; -import java.util.List; - -import org.eclipse.emf.ecore.EPackage; -import org.eclipse.emf.ecore.ETypedElement; -import org.eclipse.emf.facet.custom.core.ICustomizationManager; -import org.eclipse.emf.facet.efacet.ui.internal.dialogs.ETypedElementSelectionDialogFactory; -import org.eclipse.emf.facet.util.ui.internal.exported.dialog.IDialogCallbackWithPreCommit; -import org.eclipse.swt.widgets.Shell; - -/** - * A factory to create {@link IETypedElementSelectionDialog}s - * - * @noextend This interface is not intended to be extended by clients. - * @noimplement This interface is not intended to be implemented by clients. - * @since 0.2.0 - */ -public interface IETypedElementSelectionDialogFactory { - - /** This is the default instance of this interface. */ - IETypedElementSelectionDialogFactory DEFAULT = new ETypedElementSelectionDialogFactory(); - - /** - * Open a dialog to let the user select ETypedElements to load. - * - * @param eTypedElements - * the list of ETypedElements that can be selected using this dialog - * @param selectionMaxSize - * the maximum number of typed elements that the user can select - * @param allowEmpty - * whether to allow the user to select no ETypedElement (i.e : select <code>null</code>) - * @param callback - * called when the dialog closes - * @param parentShell - * the parent shell - * @param customManager - * the customization manager used by the - * ICustomizableLabelProvider. Can be null. - */ - <T2, D> IETypedElementSelectionDialog<D> openETypedElementSelectionDialog( - Collection<? extends ETypedElement> eTypedElements, - int selectionMaxSize, boolean allowEmpty, - IDialogCallbackWithPreCommit<List<ETypedElement>, T2, D> callback, - Shell parentShell, - ICustomizationManager customManager, - Collection<? extends EPackage> knownFacetSets); -}
diff --git a/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/emf/facet/efacet/ui/internal/exported/dialog/IETypedElementSelectionDialogInternal.java b/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/emf/facet/efacet/ui/internal/exported/dialog/IETypedElementSelectionDialogInternal.java deleted file mode 100644 index aefe12d..0000000 --- a/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/emf/facet/efacet/ui/internal/exported/dialog/IETypedElementSelectionDialogInternal.java +++ /dev/null
@@ -1,53 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2012 Mia-Software. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Nicolas Bros (Mia-Software) - Bug 370806 - [table] rewrite the "allowed contents" query selection dialog for v0.2 - * Gregoire Dupe (Mia-Software) - Bug 375087 - [Table] ITableWidget.addColumn(List<ETypedElement>, List<FacetSet>) - *******************************************************************************/ -package org.eclipse.emf.facet.efacet.ui.internal.exported.dialog; - -import java.util.List; - -import org.eclipse.emf.ecore.ETypedElement; -import org.eclipse.jface.window.Window; - -/** - * Internal interface for a dialog to let the user select ETypedElements. - * - * @noextend This interface is not intended to be extended by clients. - * @noimplement This interface is not intended to be implemented by clients. - * @since 0.2.0 - */ -public interface IETypedElementSelectionDialogInternal<D> extends - IETypedElementSelectionDialog<D> { - - /** - * @return whether the "OK" button is currently enabled. It can be disabled if a validator is set, and the current - * selection is not valid. - */ - boolean isOkButtonEnabled(); - - /** - * @return the selected ETypedElements. - * @throws UnsupportedOperationException - * if the dialog was cancelled (check {@link IETypedElementSelectionDialogInternal#getReturnCode() - * getReturnCode} before calling this method - */ - List<ETypedElement> getSelectedETypedElements(); - - /** - * @return the first selected ETypedElements or <code>null</code> if none. - * @throws UnsupportedOperationException - * if the dialog was cancelled (check {@link IETypedElementSelectionDialogInternal#getReturnCode() - * getReturnCode} before calling this method - */ - ETypedElement getFirstSelectedETypedElement(); - - /** @return {@link Window#OK} or {@link Window#CANCEL}. */ - int getReturnCode(); -}
diff --git a/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/emf/facet/efacet/ui/internal/exported/dialog/IFacetSetSelectionDialog.java b/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/emf/facet/efacet/ui/internal/exported/dialog/IFacetSetSelectionDialog.java deleted file mode 100644 index 91cd10c..0000000 --- a/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/emf/facet/efacet/ui/internal/exported/dialog/IFacetSetSelectionDialog.java +++ /dev/null
@@ -1,47 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2012 CEA LIST. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Nicolas Bros (Mia-Software) - Bug 372865 - FacetSet selection dialog - *******************************************************************************/ -package org.eclipse.emf.facet.efacet.ui.internal.exported.dialog; - -import java.util.List; - -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.FacetSet; - -/** - * A dialog to let the user select facet sets to load. - * - * @param <T> - * the type of a pre-commit dialog - * - * @noextend This interface is not intended to be extended by clients. - * @noimplement This interface is not intended to be implemented by clients. - * @since 0.2.0 - */ -public interface IFacetSetSelectionDialog<T> { - - /** Set the selection to the given list of {@link FacetSet}s */ - void setSelectedFacetSets(List<? extends FacetSet> newSelection); - - /** - * Emulate a press on the OK button - * - * @return a pre-commit dialog, or <code>null</code> if no pre-commit dialog was opened - */ - T pressOk(); - - /** Emulate a press on the Cancel button */ - void pressCancel(); - - /** Check all {@link FacetSet}s */ - void selectAll(); - - /** Uncheck all {@link FacetSet}s */ - void deselectAll(); -}
diff --git a/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/emf/facet/efacet/ui/internal/exported/dialog/IFacetSetSelectionDialogFactory.java b/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/emf/facet/efacet/ui/internal/exported/dialog/IFacetSetSelectionDialogFactory.java deleted file mode 100644 index fa75a93..0000000 --- a/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/emf/facet/efacet/ui/internal/exported/dialog/IFacetSetSelectionDialogFactory.java +++ /dev/null
@@ -1,72 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2012 CEA LIST. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Nicolas Bros (Mia-Software) - Bug 372865 - FacetSet selection dialog - *******************************************************************************/ -package org.eclipse.emf.facet.efacet.ui.internal.exported.dialog; - -import java.util.Collection; -import java.util.List; - -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.FacetSet; -import org.eclipse.emf.facet.efacet.ui.internal.dialogs.FacetSetSelectionDialogFactory; -import org.eclipse.emf.facet.util.ui.internal.exported.dialog.IDialogCallback; -import org.eclipse.emf.facet.util.ui.internal.exported.dialog.IDialogCallbackWithPreCommit; -import org.eclipse.swt.widgets.Shell; - -/** - * A factory to create {@link IFacetSetSelectionDialog}s - * - * @noextend This interface is not intended to be extended by clients. - * @noimplement This interface is not intended to be implemented by clients. - * @since 0.2.0 - */ -public interface IFacetSetSelectionDialogFactory { - - /** This is the default instance of this interface. */ - IFacetSetSelectionDialogFactory DEFAULT = new FacetSetSelectionDialogFactory(); - - /** - * Open a dialog to let the user select facet sets. - * - * @param available - * the {@link FacetSet}s the user will be able to select in the dialog - * @param selectionMaxSize - * the maximum number of {@link FacetSet}s that the user can select - * @param allowEmpty - * whether to allow the user to select no FacetSet (i.e : select <code>null</code>) - * @param callback - * called when the dialog closes - * @param parentShell - * the parent shell - * @return an instance of the dialog being opened - */ - IFacetSetSelectionDialog<?> openFacetSetSelectionDialog(Collection<FacetSet> available, - int selectionMaxSize, boolean allowEmpty, IDialogCallback<List<FacetSet>> callback, - Shell parentShell); - - /** - * Open a dialog to let the user select facet sets. The callback will be called before the dialog closes, to let you - * open a "pre-commit" dialog, to ask the user for confirmation for example. - * - * @param available - * the {@link FacetSet}s the user will be able to select in the dialog - * @param selectionMaxSize - * the maximum number of {@link FacetSet}s that the user can select - * @param allowEmpty - * whether to allow the user to select no FacetSet (i.e : select <code>null</code>) - * @param callback - * called before the dialog is committed, and again when the dialog is committed - * @param parentShell - * the parent shell - * @return an instance of the dialog being opened - */ - <T> IFacetSetSelectionDialog<T> openFacetSetSelectionDialog(Collection<FacetSet> available, - int selectionMaxSize, boolean allowEmpty, IDialogCallbackWithPreCommit<List<FacetSet>, Boolean, T> callback, - Shell parentShell); -}
diff --git a/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/emf/facet/efacet/ui/internal/exported/dialog/IFacetSetSelectionDialogInternal.java b/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/emf/facet/efacet/ui/internal/exported/dialog/IFacetSetSelectionDialogInternal.java deleted file mode 100644 index e8e584b..0000000 --- a/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/emf/facet/efacet/ui/internal/exported/dialog/IFacetSetSelectionDialogInternal.java +++ /dev/null
@@ -1,35 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2012 CEA LIST. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Nicolas Bros (Mia-Software) - Bug 372865 - FacetSet selection dialog - *******************************************************************************/ -package org.eclipse.emf.facet.efacet.ui.internal.exported.dialog; - -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.FacetSet; -import org.eclipse.jface.viewers.TreeViewer; - -/** - * Internal interface for a dialog to let the user select {@link FacetSet}s. - * - * @noextend This interface is not intended to be extended by clients. - * @noimplement This interface is not intended to be implemented by clients. - * - * @param <T> - * the type of a pre-commit dialog (can be <code>null</code> if there is no pre-commit dialog) - */ -public interface IFacetSetSelectionDialogInternal<T> extends IFacetSetSelectionDialog<T> { - - /** - * @return whether the "OK" button is currently enabled. It can be disabled if a validator is set, and the current - * selection is not valid. - */ - boolean isOkButtonEnabled(); - - /** @return the tree viewer */ - TreeViewer getTreeViewer(); -}
diff --git a/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/emf/facet/efacet/ui/internal/exported/dialog/IUriDialogFactory.java b/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/emf/facet/efacet/ui/internal/exported/dialog/IUriDialogFactory.java deleted file mode 100644 index 319994a..0000000 --- a/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/emf/facet/efacet/ui/internal/exported/dialog/IUriDialogFactory.java +++ /dev/null
@@ -1,35 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2015 Soft-Maint. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Jonathan Pepin (Soft-Maint) - Bug 463907 - Command for load and save Facet serialization - *******************************************************************************/ -package org.eclipse.emf.facet.efacet.ui.internal.exported.dialog; - -import org.eclipse.emf.common.util.URI; -import org.eclipse.emf.facet.efacet.ui.internal.dialogs.UriDialogFactory; -import org.eclipse.emf.facet.efacet.ui.internal.exported.widget.IUriWidget; -import org.eclipse.emf.facet.util.ui.internal.exported.dialog.IDialog; -import org.eclipse.emf.facet.util.ui.internal.exported.dialog.IDialogCallback; -import org.eclipse.swt.widgets.Display; -import org.eclipse.swt.widgets.Shell; - -/** - * A factory to create {@link IETypedElementSelectionDialog}s - * - * @noextend This interface is not intended to be extended by clients. - * @noimplement This interface is not intended to be implemented by clients. - * @since 1.0 - */ -public interface IUriDialogFactory { - - /** This is the default instance of this interface. */ - IUriDialogFactory DEFAULT = new UriDialogFactory(); - - IDialog<IUriWidget> openUriDialog(URI uri, - IDialogCallback<URI> callback, Shell parentShell, Display display); -}
diff --git a/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/emf/facet/efacet/ui/internal/exported/view/INavigationView.java b/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/emf/facet/efacet/ui/internal/exported/view/INavigationView.java deleted file mode 100644 index fb1e6b2..0000000 --- a/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/emf/facet/efacet/ui/internal/exported/view/INavigationView.java +++ /dev/null
@@ -1,139 +0,0 @@ -/** - * Copyright (c) 2011, 2015 Mia-Software. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Grégoire Dupé (Mia-Software) - Bug 364325 - [Restructuring] The user must be able to navigate into a model using the Facet. - * Nicolas Bros (Mia-Software) - Bug 379395 - Navigate should replace elements - * Grégoire Dupé (Mia-Software) - Bug 480654 - IllegalStateException in NavigationView.addEObjects (611) - */ -package org.eclipse.emf.facet.efacet.ui.internal.exported.view; - -import java.io.NotActiveException; -import java.util.Collection; -import java.util.List; - -import org.eclipse.emf.ecore.EClassifier; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.ETypedElement; -import org.eclipse.emf.facet.efacet.ui.IETypedElementResultDisplayerOpener; -import org.eclipse.emf.facet.util.ui.internal.exported.dialog.IOkDialog; -import org.eclipse.ui.part.WorkbenchPart; - -/** - * This interface presents the services provided by a navigation view. - * - * @author Gregoire Dupe - * - */ -public interface INavigationView { - - /** - * Add {@link EObject}s to the list of sources. - * <p> - * This method is called by the drop listener to fill the the navigation source {@link EObject} list - * - * @param eObjects - * the model elements to add to the list of sources - */ - void addEObjects(Collection<? extends EObject> eObjects); - - /** - * Add {@link EObject}s to the list of sources. - * <p> - * This method is called by the drop listener to fill the the navigation source {@link EObject} list - * - * @since 1.1 - * @param eObjects - * the model elements to add to the list of sources - * @return an IOKDialog instance if an error happened, null otherwise. - */ - IOkDialog addEObjects2(Collection<? extends EObject> eObjects); - - /** - * This method removes one eObject from the navigation source {@link EObject} list - * - * This method must be called by the "Delete" command handler. - * - * @param eObject - * eObject to remove from the navigation source {@link EObject} list - */ - void removeEObject(EObject eObject); - - /** - * This method remove a list of eObject from the navigation source {@link EObject} list - * This method must be called by the "Delete" command handler - * - * @param eObjects - * eObjects to remove from the navigation source {@link EObject} list - */ - void removeEObjects(List<? extends EObject> eObjects); - - /** - * This method clear the navigation source {@link EObject} list - */ - void removeAllEObjects(); - - /** - * The methods must return the classifier for which each selected EObject conforms to. - * - * @return classifiers usable to the navigation - */ - List<EClassifier> getUsableEClassifiers(); - - /** - * This method selects the eTypedElement that we want to navigate through. We can navigate - * through an eStructuralFeature (or an eOperation) owned by a Facet or owned by an EClass. - * - * @param eTypedElement - * must a contained by one of the classifier returned by getUsableEClassifiers(). - * @throws IllegalArgumentException - * if eTypedElement is {@link NotActiveException} contained by one of the classifier - * returned by getUsableEClassifiers(). - */ - void selectETypedElement(ETypedElement eTypedElement); - - /** - * This method returns the eTypedElement that we want to navigate through. - * - * @return the eTypedElement that we want to navigate through. - */ - ETypedElement getSelectedETypedElement(); - - /** - * This method returns the list of {@link IETypedElementResultDisplayerOpener} which have - * been resisted using the org.eclipse.emf.facet.efacet.ui.displayeropener extension point. - * - * @return a list of {@link IETypedElementResultDisplayerOpener} - */ - List<IETypedElementResultDisplayerOpener> getAvailableSelectedDisplayers(); - - /** - * This method has to be used to select a {@link IETypedElementResultDisplayerOpener} - * - * @param resultDisplayer - * must be contained in the list returned by getAvailableSelectedDisplayers(). - */ - void setSelectDisplayer( - IETypedElementResultDisplayerOpener resultDisplayer); - - /** - * This method the selected {@link IETypedElementResultDisplayerOpener} - * - * @return an {@link IETypedElementResultDisplayerOpener} which is contained by the list - * returned by getAvailableSelectedDisplayers(). - */ - IETypedElementResultDisplayerOpener getSelectedDisplayer(); - - /** - * This method performs the navigation and return the {@link WorkbenchPart} in which the result is presented. - * - * @return - */ - WorkbenchPart preform(); - -}
diff --git a/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/emf/facet/efacet/ui/internal/exported/view/INavigationViewFactory.java b/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/emf/facet/efacet/ui/internal/exported/view/INavigationViewFactory.java deleted file mode 100644 index b8b0d1d..0000000 --- a/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/emf/facet/efacet/ui/internal/exported/view/INavigationViewFactory.java +++ /dev/null
@@ -1,45 +0,0 @@ -/** - * Copyright (c) 2011, 2015 Mia-Software. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Grégoire Dupé (Mia-Software) - Bug 364325 - [Restructuring] The user must be able to navigate into a model using the Facet. - * Grégoire Dupé (Mia-Software) - Bug 480654 - IllegalStateException in NavigationView.addEObjects (611) - */ -package org.eclipse.emf.facet.efacet.ui.internal.exported.view; - -import org.eclipse.emf.edit.domain.EditingDomain; -import org.eclipse.emf.facet.efacet.ui.internal.sync.generated.SynchronizedNavigationViewFactory; -import org.eclipse.emf.facet.efacet.ui.internal.view.NavigationViewFactory; -import org.eclipse.swt.widgets.Display; - -/** - * This interface allows to get an instance of the {@link INavigationView} interface - * - * @author Gregoire Dupe - * - */ -public interface INavigationViewFactory { - - /** - * This is the default instance of this interface. - */ - INavigationViewFactory DEFAULT = new SynchronizedNavigationViewFactory(new NavigationViewFactory(), Display.getDefault()); - - /** - * This method is the only way to open and access the navigation view. - * @param editingDomain - * - * @return an instance of {@link INavigationView} - */ - /* - * FIXME gdupe> It would be better if that method would be able to throw an - * exception, rather than to "silently" log the problems. - */ - INavigationView openNavigationView(EditingDomain editingDomain); - -}
diff --git a/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/emf/facet/efacet/ui/internal/exported/widget/IETypedElementSelectionWidget.java b/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/emf/facet/efacet/ui/internal/exported/widget/IETypedElementSelectionWidget.java deleted file mode 100644 index 44f047d..0000000 --- a/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/emf/facet/efacet/ui/internal/exported/widget/IETypedElementSelectionWidget.java +++ /dev/null
@@ -1,42 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2012 Mia-Software. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Gregoire Dupe (Mia-Software) - Bug 370442 - rewrite the Facet loading dialog for v0.2 - * Nicolas Bros (Mia-Software) - Bug 370806 - [table] rewrite the "allowed contents" query selection dialog for v0.2 - *******************************************************************************/ -package org.eclipse.emf.facet.efacet.ui.internal.exported.widget; - -import java.util.Collection; -import java.util.List; - -import org.eclipse.emf.ecore.ETypedElement; - -/** - * A widget to select one or more {@link ETypedElement}s from a list - * - * @noextend This interface is not intended to be extended by clients. - * @noimplement This interface is not intended to be implemented by clients. - * @since 0.2.0 - */ -public interface IETypedElementSelectionWidget { - - /** - * This method can be called at any time to change the {@link ETypedElement}s which can be selected by the user. - * - * @param available - * the {@link ETypedElement}s that can be selected in this widget - */ - void setAvailableETypedElements(Collection<? extends ETypedElement> available); - - /** @return the list of selected {@link ETypedElement}s */ - List<ETypedElement> getSelectedETypedElements(); - - /** Select the given {@link ETypedElement}s in this widget. */ - void setSelectedETypedElements(Collection<? extends ETypedElement> elementsToSelect); - -}
diff --git a/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/emf/facet/efacet/ui/internal/exported/widget/IETypedElementSelectionWidgetFactory.java b/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/emf/facet/efacet/ui/internal/exported/widget/IETypedElementSelectionWidgetFactory.java deleted file mode 100644 index 37faec5..0000000 --- a/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/emf/facet/efacet/ui/internal/exported/widget/IETypedElementSelectionWidgetFactory.java +++ /dev/null
@@ -1,55 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2012 Mia-Software. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Gregoire Dupe (Mia-Software) - Bug 370442 - rewrite the Facet loading dialog for v0.2 - * Nicolas Bros (Mia-Software) - Bug 370806 - [table] rewrite the "allowed contents" query selection dialog for v0.2 - * Vincent Lorenzo (CEA-LIST) - Bug 372644 - Create Customizable tooltips for the TreeViewer using a CustomizableLabelProvider - * Gregoire Dupe (Mia-Software) - Bug 372626 - Aggregates - *******************************************************************************/ -package org.eclipse.emf.facet.efacet.ui.internal.exported.widget; - -import java.util.Collection; - -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.facet.custom.core.ICustomizationManager; -import org.eclipse.emf.facet.efacet.ui.internal.widget.ETypedElementSelectionWidgetFactory; -import org.eclipse.swt.widgets.Composite; - -/** - * Factory for {@link IETypedElementSelectionWidget} - * - * @noextend This interface is not intended to be extended by clients. - * @noimplement This interface is not intended to be implemented by clients. - * @since 0.2.0 - */ -public interface IETypedElementSelectionWidgetFactory { - /** This is the default instance of this interface. */ - IETypedElementSelectionWidgetFactory DEFAULT = new ETypedElementSelectionWidgetFactory(); - - /** - * Open a dialog to let the user select ETypedElements - * - * @param selectionMaxSize - * the maximum number of typed elements that the user can select. - * @param allowEmpty - * whether to allow the user to select no ETypedElement (i.e : - * select <code>null</code>) - * @param parentComposite - * the parent composite - * @param customManager - * the customization manager used by the - * ICustomizableLabelProvider - * @since 0.2 - */ - IETypedElementSelectionWidget createETypedElementSelectionWidget( - int selectionMaxSize, - boolean allowEmpty, - Composite parentComposite, - ICustomizationManager customManager, - Collection<? extends EObject> knownEPackage); -}
diff --git a/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/emf/facet/efacet/ui/internal/exported/widget/IFacetSetSelectionWidget.java b/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/emf/facet/efacet/ui/internal/exported/widget/IFacetSetSelectionWidget.java deleted file mode 100644 index cb3ddf3..0000000 --- a/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/emf/facet/efacet/ui/internal/exported/widget/IFacetSetSelectionWidget.java +++ /dev/null
@@ -1,51 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2012 CEA LIST. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Nicolas Bros (Mia-Software) - Bug 372865 - FacetSet selection dialog - *******************************************************************************/ -package org.eclipse.emf.facet.efacet.ui.internal.exported.widget; - -import java.util.Collection; -import java.util.List; - -import org.eclipse.core.runtime.IStatus; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.FacetSet; -import org.eclipse.swt.widgets.Control; - -/** - * A widget to select one or more {@link FacetSet}s from a tree - * - * @since 0.2.0 - * @noextend This interface is not intended to be extended by clients. - * @noimplement This interface is not intended to be implemented by clients. - */ -public interface IFacetSetSelectionWidget { - - /** - * This method can be called at any time to change the {@link FacetSet}s which can be selected by the user. - * - * @param available - * the {@link FacetSet}s that can be selected in this widget - */ - void setAvailableFacetSets(Collection<? extends FacetSet> available); - - /** @return the list of selected {@link FacetSet}s */ - List<FacetSet> getSelectedFacetSets(); - - /** Select the given {@link FacetSet}s in this widget. */ - void setSelectedFacetSets(Collection<? extends FacetSet> newSelection); - - /** - * @return the validation status : the selection is not valid if {@link IStatus#getSeverity()} >= - * {@link IStatus#ERROR} - */ - IStatus getValidationStatus(); - - /** @return the SWT control */ - Control getControl(); -}
diff --git a/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/emf/facet/efacet/ui/internal/exported/widget/IFacetSetSelectionWidgetFactory.java b/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/emf/facet/efacet/ui/internal/exported/widget/IFacetSetSelectionWidgetFactory.java deleted file mode 100644 index c52bc43..0000000 --- a/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/emf/facet/efacet/ui/internal/exported/widget/IFacetSetSelectionWidgetFactory.java +++ /dev/null
@@ -1,44 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2012 CEA LIST. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Nicolas Bros (Mia-Software) - Bug 372865 - FacetSet selection dialog - *******************************************************************************/ -package org.eclipse.emf.facet.efacet.ui.internal.exported.widget; - -import org.eclipse.emf.facet.efacet.ui.internal.widget.FacetSetSelectionWidgetFactory; -import org.eclipse.swt.widgets.Composite; - -/** - * Factory for {@link IFacetSetSelectionWidget} - * - * @since 0.2.0 - * @noextend This interface is not intended to be extended by clients. - * @noimplement This interface is not intended to be implemented by clients. - */ -public interface IFacetSetSelectionWidgetFactory { - /** This is the default instance of this interface. */ - IFacetSetSelectionWidgetFactory DEFAULT = new FacetSetSelectionWidgetFactory(); - - /** - * Open a dialog to let the user select ETypedElements - * - * @param selectionMaxSize - * the maximum number of typed elements that the user can select. - * @param allowEmpty - * whether to allow the user to select no ETypedElement (i.e : select <code>null</code>) - * @param parentComposite - * the parent composite - * @param onChange - * called when the selection changes - */ - IFacetSetSelectionWidget createFacetSetSelectionWidget( - int selectionMaxSize, - boolean allowEmpty, - Composite parentComposite, - Runnable onChange); -}
diff --git a/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/emf/facet/efacet/ui/internal/exported/widget/IUriWidget.java b/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/emf/facet/efacet/ui/internal/exported/widget/IUriWidget.java deleted file mode 100644 index 3986246..0000000 --- a/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/emf/facet/efacet/ui/internal/exported/widget/IUriWidget.java +++ /dev/null
@@ -1,20 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2015 Soft-Maint. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Jonathan Pepin (Soft-Maint) - Bug 463907 - Command for load and save Facet serialization - *******************************************************************************/ -package org.eclipse.emf.facet.efacet.ui.internal.exported.widget; - -import org.eclipse.emf.common.util.URI; - -public interface IUriWidget { - - URI getURI(); - void setURI(URI uri); - -}
diff --git a/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/emf/facet/efacet/ui/internal/exported/widget/IUriWidgetFactory.java b/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/emf/facet/efacet/ui/internal/exported/widget/IUriWidgetFactory.java deleted file mode 100644 index c7f6584..0000000 --- a/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/emf/facet/efacet/ui/internal/exported/widget/IUriWidgetFactory.java +++ /dev/null
@@ -1,26 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2015 Soft-Maint. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Jonathan Pepin (Soft-Maint) - Bug 463907 - Command for load and save Facet serialization - *******************************************************************************/ -package org.eclipse.emf.facet.efacet.ui.internal.exported.widget; - - -import org.eclipse.emf.facet.efacet.ui.internal.widget.UriWidgetFactory; -import org.eclipse.swt.widgets.Composite; - -/* - * @since 1.0 - */ -public interface IUriWidgetFactory { - - IUriWidgetFactory DEFAULT = new UriWidgetFactory(); - - IUriWidget createUriWidget(Composite parent); - -}
diff --git a/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/emf/facet/efacet/ui/internal/exported/wizard/ICreateFacetInFacetSetWizard2.java b/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/emf/facet/efacet/ui/internal/exported/wizard/ICreateFacetInFacetSetWizard2.java deleted file mode 100644 index 7bdb509..0000000 --- a/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/emf/facet/efacet/ui/internal/exported/wizard/ICreateFacetInFacetSetWizard2.java +++ /dev/null
@@ -1,34 +0,0 @@ -/** - * Copyright (c) 2011 Mia-Software. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Nicolas Guyomar (Mia-Software) - Bug 349546 - EMF Facet facetSet editor - * Gregoire Dupe (Mia-Software) - Bug 361617 - Deprecation of APIs for the old Facet metamodels - */ -package org.eclipse.emf.facet.efacet.ui.internal.exported.wizard; - -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.FacetSet; - -/** - * TODO This interface has to be renamed to ICreateFacetInFacetSetWizard before the release of 0.2 - * @since 0.2 - */ -//TODO This interface has to be renamed to ICreateFacetInFacetSetWizard before the release of 0.2 -public interface ICreateFacetInFacetSetWizard2 { - - public void setFacetSet(FacetSet facetSet); - - public void canChangeFacetSet(boolean canChange); - - public void setExtendedMetaClass(EClass extendedMetaClass); - - public void canChangeExtendedMetaClass(boolean canChange); - - public int open(); -}
diff --git a/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/emf/facet/efacet/ui/internal/exported/wizard/ICreateFacetSetWizard.java b/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/emf/facet/efacet/ui/internal/exported/wizard/ICreateFacetSetWizard.java deleted file mode 100644 index 178d1f9..0000000 --- a/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/emf/facet/efacet/ui/internal/exported/wizard/ICreateFacetSetWizard.java +++ /dev/null
@@ -1,18 +0,0 @@ -/** - * Copyright (c) 2011 Mia-Software. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Nicolas Guyomar (Mia-Software) - Bug 349546 - EMF Facet facetSet editor - */ -package org.eclipse.emf.facet.efacet.ui.internal.exported.wizard; - -public interface ICreateFacetSetWizard { - - public int open(); - -}
diff --git a/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/emf/facet/efacet/ui/internal/exported/wizard/IFacetChildrenWizard2.java b/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/emf/facet/efacet/ui/internal/exported/wizard/IFacetChildrenWizard2.java deleted file mode 100644 index 68106cb..0000000 --- a/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/emf/facet/efacet/ui/internal/exported/wizard/IFacetChildrenWizard2.java +++ /dev/null
@@ -1,47 +0,0 @@ -/** - * Copyright (c) 2011 Mia-Software. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Nicolas Guyomar (Mia-Software) - Bug 349546 - EMF Facet facetSet editor - * Gregoire Dupe (Mia-Software) - Bug 361617 - Deprecation of APIs for the old Facet metamodels - */ -package org.eclipse.emf.facet.efacet.ui.internal.exported.wizard; - -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.Facet; - -/** - * - * @since 0.2 - */ -//TODO This interface has to be renamed to ICreateFacetInFacetSetWizard before the release of 0.2 -public interface IFacetChildrenWizard2 { - - public int open(); - - public void setFacet(Facet facet); - - public void setChildrenName(String name); - - public void setUpperBound(int upperBound); - - public void setLowerBound(int lowerBound); - - public void setType(EClass type); - - public void canChangeFacet(boolean canChange); - - public void canChangeChildrenName(boolean canChange); - - public void canChangeUpperBound(boolean canChange); - - public void canChangeLowerBound(boolean canChange); - - public void canChangeType(boolean canChange); - -}
diff --git a/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/emf/facet/efacet/ui/internal/exported/wizard/ISelectETypeWizard.java b/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/emf/facet/efacet/ui/internal/exported/wizard/ISelectETypeWizard.java deleted file mode 100644 index 6b8a15c..0000000 --- a/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/emf/facet/efacet/ui/internal/exported/wizard/ISelectETypeWizard.java +++ /dev/null
@@ -1,20 +0,0 @@ -/** - * Copyright (c) 2011 Mia-Software. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Nicolas Guyomar (Mia-Software) - Bug 349546 - EMF Facet facetSet editor - */ -package org.eclipse.emf.facet.efacet.ui.internal.exported.wizard; - -import org.eclipse.emf.ecore.EClassifier; - -public interface ISelectETypeWizard { - public int open(); - - public EClassifier getSelectedEType(); -}
diff --git a/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/emf/facet/efacet/ui/internal/handlers/LoadFacetHandler.java b/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/emf/facet/efacet/ui/internal/handlers/LoadFacetHandler.java deleted file mode 100644 index 918cca8..0000000 --- a/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/emf/facet/efacet/ui/internal/handlers/LoadFacetHandler.java +++ /dev/null
@@ -1,78 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2014, 2015 Mia-Software, and Soft-Maint. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Gregoire Dupe (Mia-Software) - Bug 441051 - Reusable customization and facet loading dialogs - * Thomas Cicognani (Soft-Maint) - Bug 471681 - Error when accepting FacetSet selection dialog - *******************************************************************************/ -package org.eclipse.emf.facet.efacet.ui.internal.handlers; - -import java.util.ArrayList; -import java.util.HashSet; -import java.util.List; - -import org.eclipse.core.commands.AbstractHandler; -import org.eclipse.core.commands.ExecutionEvent; -import org.eclipse.core.commands.ExecutionException; -import org.eclipse.emf.ecore.resource.ResourceSet; -import org.eclipse.emf.facet.efacet.core.IFacetManager; -import org.eclipse.emf.facet.efacet.core.IFacetManagerProvider; -import org.eclipse.emf.facet.efacet.core.IFacetSetCatalogManager; -import org.eclipse.emf.facet.efacet.core.IFacetSetCatalogManagerFactory; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.FacetSet; -import org.eclipse.emf.facet.efacet.ui.internal.exported.dialog.IFacetSetSelectionDialog; -import org.eclipse.emf.facet.efacet.ui.internal.exported.dialog.IFacetSetSelectionDialogFactory; -import org.eclipse.emf.facet.util.ui.internal.exported.dialog.IDialogCallback; -import org.eclipse.emf.facet.util.ui.internal.exported.dialog.IDialogCallbackWithPreCommit; -import org.eclipse.emf.facet.util.ui.internal.exported.dialog.IQuestionDialog; -import org.eclipse.swt.widgets.Shell; -import org.eclipse.ui.IWorkbenchPart; -import org.eclipse.ui.handlers.HandlerUtil; - -public class LoadFacetHandler extends AbstractHandler { - - public Object execute(final ExecutionEvent event) throws ExecutionException { - final IWorkbenchPart activePart = HandlerUtil.getActivePart(event); - if (activePart != null) { - final IFacetManagerProvider facetMgrProvider = (IFacetManagerProvider) activePart - .getAdapter(IFacetManagerProvider.class); - final IFacetManager facetManager = facetMgrProvider.getFacetManager(); - if (facetManager != null) { - final ResourceSet resourceSet = facetManager.getResourceSet(); - final IFacetSetCatalogManager catalog = IFacetSetCatalogManagerFactory.DEFAULT - .getOrCreateFacetSetCatalogManager(resourceSet); - final HashSet<FacetSet> availableFS = new HashSet<FacetSet>(); - availableFS.addAll(catalog.getRegisteredFacetSets()); - final IDialogCallbackWithPreCommit<List<FacetSet>, Boolean, IQuestionDialog> callback = new IDialogCallbackWithPreCommit<List<FacetSet>, Boolean, IQuestionDialog>() { - - public void committed(final List<FacetSet> result, - final Boolean precommitResult) { - final List<FacetSet> toBeRemoved = new ArrayList<FacetSet>(); - toBeRemoved.addAll(facetManager.getManagedFacetSets()); - toBeRemoved.removeAll(result); - facetManager.getManagedFacetSets().removeAll(toBeRemoved); - facetManager.getManagedFacetSets().addAll(result); - } - - public IQuestionDialog openPrecommitDialog( - final List<FacetSet> result, - final IDialogCallback<Boolean> precommitCallback) { - return null; - } - }; - - final Shell shell = activePart.getSite().getShell(); - final IFacetSetSelectionDialog<IQuestionDialog> dialog = IFacetSetSelectionDialogFactory.DEFAULT - .openFacetSetSelectionDialog(availableFS, - Integer.MAX_VALUE, true, callback, shell); - dialog.setSelectedFacetSets(facetManager.getManagedFacetSets()); - } - } - return null; - } -}
diff --git a/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/emf/facet/efacet/ui/internal/handlers/NavigationHandler.java b/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/emf/facet/efacet/ui/internal/handlers/NavigationHandler.java deleted file mode 100644 index c2cba81..0000000 --- a/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/emf/facet/efacet/ui/internal/handlers/NavigationHandler.java +++ /dev/null
@@ -1,70 +0,0 @@ -/** - * Copyright (c) 2011, 2015 Mia-Software. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Grégoire Dupé (Mia-Software) - Bug 364325 - [Restructuring] The user must be able to navigate into a model using the Facet. - * Nicolas Bros (Mia-Software) - Bug 379395 - Navigate should replace elements - * Grégoire Dupé (Mia-Software) - Bug 480654 - IllegalStateException in NavigationView.addEObjects (611) - */ -package org.eclipse.emf.facet.efacet.ui.internal.handlers; - -import java.util.LinkedList; -import java.util.List; - -import org.eclipse.core.commands.AbstractHandler; -import org.eclipse.core.commands.ExecutionEvent; -import org.eclipse.core.commands.ExecutionException; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.edit.domain.EditingDomain; -import org.eclipse.emf.edit.domain.IEditingDomainProvider; -import org.eclipse.emf.facet.efacet.ui.internal.exported.view.INavigationView; -import org.eclipse.emf.facet.efacet.ui.internal.exported.view.INavigationViewFactory; -import org.eclipse.jface.viewers.ISelection; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.ui.IEditorPart; -import org.eclipse.ui.PlatformUI; - -/** - * This class handle the action "Add facet attribute" - */ -public class NavigationHandler extends AbstractHandler { - - public Object execute(final ExecutionEvent event) throws ExecutionException { - final ISelection selection = PlatformUI.getWorkbench() - .getActiveWorkbenchWindow().getSelectionService() - .getSelection(); - - // Retrieve the editor - final IEditorPart editor = PlatformUI.getWorkbench() - .getActiveWorkbenchWindow().getActivePage().getActiveEditor(); - // Retrieve the editing domain - - EditingDomain editingDomain = null; - if (editor instanceof IEditingDomainProvider) { - final IEditingDomainProvider edProvider = (IEditingDomainProvider) editor; - editingDomain = edProvider.getEditingDomain(); - } - - final List<EObject> eObjects = new LinkedList<EObject>(); - final INavigationView view = INavigationViewFactory.DEFAULT - .openNavigationView(editingDomain); - if (selection instanceof IStructuredSelection) { - final IStructuredSelection sSelection = (IStructuredSelection) selection; - for (Object object : sSelection.toList()) { - if (object instanceof EObject) { - final EObject eObject = (EObject) object; - eObjects.add(eObject); - } - } - } - view.removeAllEObjects(); - view.addEObjects2(eObjects); - return null; - } - -}
diff --git a/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/emf/facet/efacet/ui/internal/handlers/SaveStructuralFeatureInstanceModelHandler.java b/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/emf/facet/efacet/ui/internal/handlers/SaveStructuralFeatureInstanceModelHandler.java deleted file mode 100644 index 7709bc0..0000000 --- a/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/emf/facet/efacet/ui/internal/handlers/SaveStructuralFeatureInstanceModelHandler.java +++ /dev/null
@@ -1,67 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2015 Soft-Maint. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Jonathan Pepin (Soft-Maint) - Bug 463907 - Command for load and save Facet serialization - * Grégoire Dupé (Soft-Maint) - Bug 469959 - NullPointerException in SetStructuralFeatureInstanceResourceHandler.execute (42) - *******************************************************************************/ -package org.eclipse.emf.facet.efacet.ui.internal.handlers; - -import org.eclipse.core.commands.AbstractHandler; -import org.eclipse.core.commands.ExecutionEvent; -import org.eclipse.core.commands.ExecutionException; -import org.eclipse.emf.facet.efacet.core.IFacetManager; -import org.eclipse.emf.facet.efacet.core.exception.FacetManagerException; -import org.eclipse.emf.facet.efacet.ui.internal.Activator; -import org.eclipse.emf.facet.efacet.ui.internal.Messages; -import org.eclipse.emf.facet.util.core.Logger; -import org.eclipse.emf.facet.util.ui.internal.exported.dialog.IOkDialogFactory; -import org.eclipse.swt.widgets.Shell; -import org.eclipse.ui.IWorkbenchPart; -import org.eclipse.ui.IWorkbenchPartSite; -import org.eclipse.ui.handlers.HandlerUtil; - -public class SaveStructuralFeatureInstanceModelHandler extends AbstractHandler { - - @Override - public boolean isEnabled() { - final IFacetManager facetManager = Utils.getFacetManager(); - return (facetManager != null) - && (facetManager.getSerializationResource() != null); - } - - @Override - public boolean isHandled() { - final IFacetManager facetManager = Utils.getFacetManager(); - return (facetManager != null) - && (facetManager.getSerializationResource() != null); - } - - public Object execute(final ExecutionEvent event) throws ExecutionException { - Object result = null; - final IFacetManager facetManager = Utils.getFacetManager(event); - if (facetManager != null) { - try { - facetManager.saveStructuralFeatureInstanceModel(); - } catch (FacetManagerException e) { - Logger.logError( - e, - "Failed to save the \"structural feature instance model\".", //$NON-NLS-1$ - Activator.getDefault()); - final IWorkbenchPart activePart = HandlerUtil.getActivePart(event); - final IWorkbenchPartSite site = activePart.getSite(); - final Shell shell = site.getShell(); - result = IOkDialogFactory.DEFAULT.openErrorDialog( - shell, - e, - Messages.SaveStructuralFeatureInstanceModelHandler_FailedToSaveTheStructuralFeatureInstanceModel); - } - } - return result; - } -} -
diff --git a/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/emf/facet/efacet/ui/internal/handlers/SetStructuralFeatureInstanceResourceHandler.java b/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/emf/facet/efacet/ui/internal/handlers/SetStructuralFeatureInstanceResourceHandler.java deleted file mode 100644 index 16ae947..0000000 --- a/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/emf/facet/efacet/ui/internal/handlers/SetStructuralFeatureInstanceResourceHandler.java +++ /dev/null
@@ -1,91 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2015 Soft-Maint. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Jonathan Pepin (Soft-Maint) - Bug 463907 - Command for load and save Facet serialization - * Grégoire Dupé (Soft-Maint) - Bug 469959 - NullPointerException in SetStructuralFeatureInstanceResourceHandler.execute (42) - *******************************************************************************/ -package org.eclipse.emf.facet.efacet.ui.internal.handlers; - -import org.eclipse.core.commands.AbstractHandler; -import org.eclipse.core.commands.ExecutionEvent; -import org.eclipse.core.commands.ExecutionException; -import org.eclipse.emf.common.util.URI; -import org.eclipse.emf.ecore.resource.Resource; -import org.eclipse.emf.ecore.resource.ResourceSet; -import org.eclipse.emf.facet.efacet.core.IFacetManager; -import org.eclipse.emf.facet.efacet.core.exception.FacetManagerException; -import org.eclipse.emf.facet.efacet.ui.internal.Messages; -import org.eclipse.emf.facet.efacet.ui.internal.exported.dialog.IUriDialogFactory; -import org.eclipse.emf.facet.util.ui.internal.exported.dialog.IDialogCallback; -import org.eclipse.emf.facet.util.ui.internal.exported.dialog.IOkDialogFactory; -import org.eclipse.swt.widgets.Display; -import org.eclipse.swt.widgets.Shell; -import org.eclipse.ui.IWorkbenchPart; -import org.eclipse.ui.IWorkbenchPartSite; -import org.eclipse.ui.handlers.HandlerUtil; - -public class SetStructuralFeatureInstanceResourceHandler extends - AbstractHandler { - - @Override - public boolean isEnabled() { - return Utils.getFacetManager() != null; - } - - @Override - public boolean isHandled() { - return Utils.getFacetManager() != null; - } - - public Object execute(final ExecutionEvent event) throws ExecutionException { - Object result = null; - final IFacetManager facetManager = Utils.getFacetManager(event); - if (facetManager != null) { - final IWorkbenchPart activePart = HandlerUtil.getActivePart(event); - final IWorkbenchPartSite site = activePart.getSite(); - final Shell shell = site.getShell(); - final URI uri = getSResourceUri(facetManager); - final IDialogCallback<URI> callback = new IDialogCallback<URI>() { - public void committed(final URI resultUri) { - changeSerializationMgrURI(facetManager, resultUri); - } - }; - result = IUriDialogFactory.DEFAULT.openUriDialog(uri, - callback, shell, Display.getDefault()); - } - return result; - } - - private static URI getSResourceUri(final IFacetManager facetManager) { - final Resource sResource = facetManager.getSerializationResource(); - URI uri = null; - if (sResource != null) { - uri = sResource.getURI(); - } - return uri; - } - - public static void changeSerializationMgrURI(final IFacetManager facetManager, - final URI uri) { - Resource sResource = null; - final ResourceSet resourceSet = facetManager.getResourceSet(); - try { - sResource = resourceSet.getResource(uri, true); - } catch (Exception e) { - sResource = resourceSet.createResource(uri); - } - try { - facetManager.setSerializationResource(sResource); - } catch (FacetManagerException e) { - IOkDialogFactory.DEFAULT.openErrorDialog( - new Shell(), - e, - Messages.SetStructuralFeatureInstanceResourceHandler_SerializationUriSettigFailed); - } - } -}
diff --git a/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/emf/facet/efacet/ui/internal/handlers/Utils.java b/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/emf/facet/efacet/ui/internal/handlers/Utils.java deleted file mode 100644 index 08ad357..0000000 --- a/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/emf/facet/efacet/ui/internal/handlers/Utils.java +++ /dev/null
@@ -1,48 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2015 Mia-Software. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Grégoire Dupé (Soft-Maint) - Bug 469959 - NullPointerException in SetStructuralFeatureInstanceResourceHandler.execute (42) - *******************************************************************************/ -package org.eclipse.emf.facet.efacet.ui.internal.handlers; - -import org.eclipse.core.commands.ExecutionEvent; -import org.eclipse.emf.facet.efacet.core.IFacetManager; -import org.eclipse.emf.facet.efacet.core.IFacetManagerProvider; -import org.eclipse.emf.facet.util.ui.internal.exported.handler.HandlerUtils; -import org.eclipse.ui.IWorkbenchPart; -import org.eclipse.ui.handlers.HandlerUtil; - -public final class Utils { - - private Utils() { - // Must not be used - } - - public static IFacetManager getFacetManager() { - final IWorkbenchPart activePart = HandlerUtils.getActivePart(); - return getFacetManager(activePart); - } - - public static IFacetManager getFacetManager(final ExecutionEvent event) { - final IWorkbenchPart activePart = HandlerUtil.getActivePart(event); - return getFacetManager(activePart); - } - - private static IFacetManager getFacetManager(final IWorkbenchPart activePart) { - IFacetManager result = null; - if (activePart != null) { - final IFacetManagerProvider facetMgrProvider = (IFacetManagerProvider) activePart - .getAdapter(IFacetManagerProvider.class); - if (facetMgrProvider != null) { - result = facetMgrProvider.getFacetManager(); - } - } - return result; - } - -}
diff --git a/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/emf/facet/efacet/ui/internal/preferences/PreferenceConstants.java b/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/emf/facet/efacet/ui/internal/preferences/PreferenceConstants.java deleted file mode 100644 index 1900ee3..0000000 --- a/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/emf/facet/efacet/ui/internal/preferences/PreferenceConstants.java +++ /dev/null
@@ -1,22 +0,0 @@ -/** - * Copyright (c) 2012 CEA-LIST. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Vincent Lorenzo (CEA-LIST) - Bug 357621 - Improve the label displayed for Customization and Facets - * Gregoire Dupe (CEA-LIST) - Bug 357621 - Improve the label displayed for Customization and Facets - */ -package org.eclipse.emf.facet.efacet.ui.internal.preferences; - -public final class PreferenceConstants { - - public static final String TE_SELECTION_TAB = "ETypedElementSelectionDialogPreferedTab"; //$NON-NLS-1$ - - private PreferenceConstants() { - //nothing to do - } -}
diff --git a/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/emf/facet/efacet/ui/internal/preferences/PreferencesInitializer.java b/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/emf/facet/efacet/ui/internal/preferences/PreferencesInitializer.java deleted file mode 100644 index 01fd27e..0000000 --- a/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/emf/facet/efacet/ui/internal/preferences/PreferencesInitializer.java +++ /dev/null
@@ -1,27 +0,0 @@ -/** - * Copyright (c) 2012 CEA-LIST. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Vincent Lorenzo (CEA-LIST) - Bug 357621 - Improve the label displayed for Customization and Facets - */ -package org.eclipse.emf.facet.efacet.ui.internal.preferences; - -import org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer; -import org.eclipse.emf.facet.efacet.ui.internal.Activator; -import org.eclipse.emf.facet.efacet.ui.internal.widget.ETypedElementSelectionControl; -import org.eclipse.jface.preference.IPreferenceStore; - -public class PreferencesInitializer extends AbstractPreferenceInitializer { - - @Override - public void initializeDefaultPreferences() { - IPreferenceStore store = Activator.getDefault().getPreferenceStore(); - store.setDefault(PreferenceConstants.TE_SELECTION_TAB,ETypedElementSelectionControl.TAB_ID ); - } - -}
diff --git a/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/emf/facet/efacet/ui/internal/sync/generated/SynchronizedNavigationView.java b/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/emf/facet/efacet/ui/internal/sync/generated/SynchronizedNavigationView.java deleted file mode 100644 index 527fc0e..0000000 --- a/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/emf/facet/efacet/ui/internal/sync/generated/SynchronizedNavigationView.java +++ /dev/null
@@ -1,134 +0,0 @@ -/** - * Copyright (c) 2015 Mia-Software. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Grégoire Dupé (Mia-Software) - Bug 480654 - IllegalStateException in NavigationView.addEObjects (611) - */ - -package org.eclipse.emf.facet.efacet.ui.internal.sync.generated; - -import org.eclipse.emf.facet.util.ui.internal.exported.displaysync.SynchronizedObject; -import org.eclipse.swt.widgets.Display; -import org.eclipse.emf.facet.util.ui.internal.exported.displaysync.AbstractVoidExceptionFreeRunnable; -import org.eclipse.emf.facet.util.ui.internal.exported.displaysync.AbstractExceptionFreeRunnable; - -@SuppressWarnings("PMD.ExcessivePublicCount") -public class SynchronizedNavigationView extends SynchronizedObject<org.eclipse.emf.facet.efacet.ui.internal.exported.view.INavigationView> implements org.eclipse.emf.facet.efacet.ui.internal.exported.view.INavigationView { - - public SynchronizedNavigationView(final org.eclipse.emf.facet.efacet.ui.internal.exported.view.INavigationView object, final Display display) { - super(object, display); - } - public final void addEObjects(final java.util.Collection<? extends org.eclipse.emf.ecore.EObject> parm0) { - voidExceptionFreeRunnable(new AbstractVoidExceptionFreeRunnable() { - @Override - public void voidSafeRun() { - SynchronizedNavigationView.this.getSynchronizedObject().addEObjects(parm0); - } - }); - } - - public final org.eclipse.emf.facet.util.ui.internal.exported.dialog.IOkDialog addEObjects2(final java.util.Collection<? extends org.eclipse.emf.ecore.EObject> parm0) { - return safeSyncExec(new AbstractExceptionFreeRunnable<org.eclipse.emf.facet.util.ui.internal.exported.dialog.IOkDialog>() { - @Override - public org.eclipse.emf.facet.util.ui.internal.exported.dialog.IOkDialog safeRun() { - return SynchronizedNavigationView.this.getSynchronizedObject().addEObjects2(parm0); - } - }); - } - - public final java.util.List<org.eclipse.emf.facet.efacet.ui.IETypedElementResultDisplayerOpener> getAvailableSelectedDisplayers() { - return safeSyncExec(new AbstractExceptionFreeRunnable<java.util.List<org.eclipse.emf.facet.efacet.ui.IETypedElementResultDisplayerOpener>>() { - @Override - public java.util.List<org.eclipse.emf.facet.efacet.ui.IETypedElementResultDisplayerOpener> safeRun() { - return SynchronizedNavigationView.this.getSynchronizedObject().getAvailableSelectedDisplayers(); - } - }); - } - - public final org.eclipse.emf.facet.efacet.ui.IETypedElementResultDisplayerOpener getSelectedDisplayer() { - return safeSyncExec(new AbstractExceptionFreeRunnable<org.eclipse.emf.facet.efacet.ui.IETypedElementResultDisplayerOpener>() { - @Override - public org.eclipse.emf.facet.efacet.ui.IETypedElementResultDisplayerOpener safeRun() { - return SynchronizedNavigationView.this.getSynchronizedObject().getSelectedDisplayer(); - } - }); - } - - public final org.eclipse.emf.ecore.ETypedElement getSelectedETypedElement() { - return safeSyncExec(new AbstractExceptionFreeRunnable<org.eclipse.emf.ecore.ETypedElement>() { - @Override - public org.eclipse.emf.ecore.ETypedElement safeRun() { - return SynchronizedNavigationView.this.getSynchronizedObject().getSelectedETypedElement(); - } - }); - } - - public final java.util.List<org.eclipse.emf.ecore.EClassifier> getUsableEClassifiers() { - return safeSyncExec(new AbstractExceptionFreeRunnable<java.util.List<org.eclipse.emf.ecore.EClassifier>>() { - @Override - public java.util.List<org.eclipse.emf.ecore.EClassifier> safeRun() { - return SynchronizedNavigationView.this.getSynchronizedObject().getUsableEClassifiers(); - } - }); - } - - public final org.eclipse.ui.part.WorkbenchPart preform() { - return safeSyncExec(new AbstractExceptionFreeRunnable<org.eclipse.ui.part.WorkbenchPart>() { - @Override - public org.eclipse.ui.part.WorkbenchPart safeRun() { - return SynchronizedNavigationView.this.getSynchronizedObject().preform(); - } - }); - } - - public final void removeAllEObjects() { - voidExceptionFreeRunnable(new AbstractVoidExceptionFreeRunnable() { - @Override - public void voidSafeRun() { - SynchronizedNavigationView.this.getSynchronizedObject().removeAllEObjects(); - } - }); - } - - public final void removeEObject(final org.eclipse.emf.ecore.EObject parm0) { - voidExceptionFreeRunnable(new AbstractVoidExceptionFreeRunnable() { - @Override - public void voidSafeRun() { - SynchronizedNavigationView.this.getSynchronizedObject().removeEObject(parm0); - } - }); - } - - public final void removeEObjects(final java.util.List<? extends org.eclipse.emf.ecore.EObject> parm0) { - voidExceptionFreeRunnable(new AbstractVoidExceptionFreeRunnable() { - @Override - public void voidSafeRun() { - SynchronizedNavigationView.this.getSynchronizedObject().removeEObjects(parm0); - } - }); - } - - public final void selectETypedElement(final org.eclipse.emf.ecore.ETypedElement parm0) { - voidExceptionFreeRunnable(new AbstractVoidExceptionFreeRunnable() { - @Override - public void voidSafeRun() { - SynchronizedNavigationView.this.getSynchronizedObject().selectETypedElement(parm0); - } - }); - } - - public final void setSelectDisplayer(final org.eclipse.emf.facet.efacet.ui.IETypedElementResultDisplayerOpener parm0) { - voidExceptionFreeRunnable(new AbstractVoidExceptionFreeRunnable() { - @Override - public void voidSafeRun() { - SynchronizedNavigationView.this.getSynchronizedObject().setSelectDisplayer(parm0); - } - }); - } - -}
diff --git a/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/emf/facet/efacet/ui/internal/sync/generated/SynchronizedNavigationViewFactory.java b/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/emf/facet/efacet/ui/internal/sync/generated/SynchronizedNavigationViewFactory.java deleted file mode 100644 index 7dcaefa..0000000 --- a/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/emf/facet/efacet/ui/internal/sync/generated/SynchronizedNavigationViewFactory.java +++ /dev/null
@@ -1,35 +0,0 @@ -/** - * Copyright (c) 2015 Mia-Software. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Grégoire Dupé (Mia-Software) - Bug 480654 - IllegalStateException in NavigationView.addEObjects (611) - */ - -package org.eclipse.emf.facet.efacet.ui.internal.sync.generated; - -import org.eclipse.emf.facet.util.ui.internal.exported.displaysync.SynchronizedObject; -import org.eclipse.swt.widgets.Display; -import org.eclipse.emf.facet.util.ui.internal.exported.displaysync.AbstractVoidExceptionFreeRunnable; -import org.eclipse.emf.facet.util.ui.internal.exported.displaysync.AbstractExceptionFreeRunnable; - -@SuppressWarnings("PMD.ExcessivePublicCount") -public class SynchronizedNavigationViewFactory extends SynchronizedObject<org.eclipse.emf.facet.efacet.ui.internal.exported.view.INavigationViewFactory> implements org.eclipse.emf.facet.efacet.ui.internal.exported.view.INavigationViewFactory { - - public SynchronizedNavigationViewFactory(final org.eclipse.emf.facet.efacet.ui.internal.exported.view.INavigationViewFactory object, final Display display) { - super(object, display); - } - public final org.eclipse.emf.facet.efacet.ui.internal.exported.view.INavigationView openNavigationView(final org.eclipse.emf.edit.domain.EditingDomain parm0) { - return safeSyncExec(new AbstractExceptionFreeRunnable<org.eclipse.emf.facet.efacet.ui.internal.exported.view.INavigationView>() { - @Override - public org.eclipse.emf.facet.efacet.ui.internal.exported.view.INavigationView safeRun() { - return SynchronizedNavigationViewFactory.this.getSynchronizedObject().openNavigationView(parm0); - } - }); - } - -}
diff --git a/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/emf/facet/efacet/ui/internal/utils/ImageProvider.java b/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/emf/facet/efacet/ui/internal/utils/ImageProvider.java deleted file mode 100644 index b3a31b1..0000000 --- a/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/emf/facet/efacet/ui/internal/utils/ImageProvider.java +++ /dev/null
@@ -1,95 +0,0 @@ -/** - * Copyright (c) 2011 Mia-Software. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Nicolas Guyomar (Mia-Software) - Bug 349546 - EMF Facet facetSet editor - * Vincent Lorenzo (CEA-LIST) - Bug 357621 - Improve the label displayed for Customization and Facets - */ -package org.eclipse.emf.facet.efacet.ui.internal.utils; - -import java.net.URL; - -import org.eclipse.emf.facet.efacet.ui.internal.Activator; -import org.eclipse.emf.facet.util.core.Logger; -import org.eclipse.jface.resource.ImageDescriptor; -import org.eclipse.osgi.util.NLS; -import org.eclipse.swt.graphics.Image; - -public class ImageProvider { - - private static ImageProvider instance; - - public static ImageProvider getInstance() { - if (ImageProvider.instance == null) { - ImageProvider.instance = new ImageProvider(); - } - return ImageProvider.instance; - } - - private static final String QUERY_SET_ICON_PATH = "/icons/querySet.gif"; //$NON-NLS-1$ - private static final String FACET_ICON_PATH = "/icons/facet.gif"; //$NON-NLS-1$ - private static final String FLAT_VIEW_ICON_PATH = "/icons/flatView.gif"; //$NON-NLS-1$ - private static final String TREE_VIEW_ICON_PATH = "/icons/treeView.gif"; //$NON-NLS-1$ - - private Image facetIcon; - private Image queryIcon; - private Image flatViewIcon; - private Image treeViewIcon; - - /** - * Create an image descriptor from a resource - * - * @param resourcePath - * the path of the resource (in the bundle) - * @return the image descriptor - */ - private static ImageDescriptor createImageDescriptor(final String resourcePath) { - final URL url = Activator.getDefault().getBundle().getResource(resourcePath); - if (url == null) { - Logger.logError(NLS.bind("Resource not found: {0}", //$NON-NLS-1$ - resourcePath), Activator.getDefault()); - return ImageDescriptor.getMissingImageDescriptor(); - } - return ImageDescriptor.createFromURL(url); - } - - /** Return the icon representing a query */ - public Image getFacetIcon() { - if (this.facetIcon == null) { - this.facetIcon = createImageDescriptor(ImageProvider.FACET_ICON_PATH).createImage(); - } - return this.facetIcon; - } - - /** Return the descriptor representing a query */ - public static ImageDescriptor getFacetIconDescriptor() { - return createImageDescriptor(ImageProvider.FACET_ICON_PATH); - } - - /** Return the icon representing a querySet */ - public Image getQuerySetIcon() { - if (this.queryIcon == null) { - this.queryIcon = createImageDescriptor(ImageProvider.QUERY_SET_ICON_PATH).createImage(); - } - return this.queryIcon; - } - - public Image getFlatViewIcon(){ - if (this.flatViewIcon == null) { - this.flatViewIcon = createImageDescriptor(ImageProvider.FLAT_VIEW_ICON_PATH).createImage(); - } - return this.flatViewIcon; - } - public Image getTreeViewIcon(){ - if (this.treeViewIcon == null) { - this.treeViewIcon = createImageDescriptor(ImageProvider.TREE_VIEW_ICON_PATH).createImage(); - } - return this.treeViewIcon; - } - -}
diff --git a/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/emf/facet/efacet/ui/internal/view/ContextPaneMenuManager.java b/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/emf/facet/efacet/ui/internal/view/ContextPaneMenuManager.java deleted file mode 100644 index d873799..0000000 --- a/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/emf/facet/efacet/ui/internal/view/ContextPaneMenuManager.java +++ /dev/null
@@ -1,94 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010, 2012 Mia-Software. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Nicolas Bros (Mia-Software) - * Gregoire Dupe (Mia-Software) - Bug 364325 - [Restructuring] The user must be able to navigate into a model using the Facet. - *******************************************************************************/ -package org.eclipse.emf.facet.efacet.ui.internal.view; - -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.facet.efacet.ui.internal.ImageProvider; -import org.eclipse.emf.facet.efacet.ui.internal.view.NavigationView.ContextInfo; -import org.eclipse.jface.action.Action; -import org.eclipse.jface.action.IAction; -import org.eclipse.jface.action.IMenuListener; -import org.eclipse.jface.action.IMenuManager; -import org.eclipse.jface.action.MenuManager; -import org.eclipse.jface.viewers.TreeViewer; -import org.eclipse.swt.SWT; -import org.eclipse.swt.events.KeyAdapter; -import org.eclipse.swt.events.KeyEvent; - -@SuppressWarnings("synthetic-access") -//Copied from org.eclipse.emf.facet.infra.query.ui.views.queryExecution.internal.ContextPaneMenuManager -public class ContextPaneMenuManager extends MenuManager implements IMenuListener { - - private final EditableContext context; - private final NavigationView queryExecutionView; - - public ContextPaneMenuManager(final NavigationView queryExecutionView, - final EditableContext context, final TreeViewer treeViewer) { - this.queryExecutionView = queryExecutionView; - this.context = context; - addMenuActions(); - addMenuListener(this); - addKeyShortcuts(treeViewer); - } - - private void addKeyShortcuts(final TreeViewer treeViewer) { - treeViewer.getTree().addKeyListener(new KeyAdapter() { - @Override - public void keyPressed(final KeyEvent e) { - if (e.keyCode == SWT.DEL) { - ContextPaneMenuManager.this.removeSelectedElementsAction.run(); - } - } - }); - } - - private void addMenuActions() { - this.add(this.removeSelectedElementsAction); - this.add(this.removeAllAction); - } - - /** This action removes all model elements from the context */ - private final IAction removeAllAction = new Action("Remove all") { - { - setImageDescriptor(ImageProvider.getInstance().getRemoveAllImageDescriptor()); - } - - @Override - public void run() { - ContextPaneMenuManager.this.context.clear(); - ContextPaneMenuManager.this.context.done(); - } - }; - - /** This action removes selected model elements from the context */ - private final IAction removeSelectedElementsAction = new Action("Remove") { - { - setImageDescriptor(ImageProvider.getInstance().getRemoveImageDescriptor()); - } - - @Override - public void run() { - ContextInfo contextInfo = ContextPaneMenuManager.this.queryExecutionView - .getContextInfo(); - for (EObject eObject : contextInfo.getSelectedEObjects()) { - ContextPaneMenuManager.this.context.remove(eObject); - } - ContextPaneMenuManager.this.context.done(); - } - }; - - public void menuAboutToShow(final IMenuManager manager) { - ContextInfo contextInfo = ContextPaneMenuManager.this.queryExecutionView.getContextInfo(); - this.removeAllAction.setEnabled(contextInfo.getEObjects().size() > 0); - this.removeSelectedElementsAction.setEnabled(contextInfo.getSelectedEObjects().size() > 0); - } -} \ No newline at end of file
diff --git a/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/emf/facet/efacet/ui/internal/view/DropAdapter.java b/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/emf/facet/efacet/ui/internal/view/DropAdapter.java deleted file mode 100644 index 16c62c1..0000000 --- a/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/emf/facet/efacet/ui/internal/view/DropAdapter.java +++ /dev/null
@@ -1,93 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010, 2012 Mia-Software. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Nicolas Bros (Mia-Software) - * Gregoire Dupe (Mia-Software) - Bug 364325 - [Restructuring] The user must be able to navigate into a model using the Facet. - *******************************************************************************/ -package org.eclipse.emf.facet.efacet.ui.internal.view; - -import java.util.HashSet; -import java.util.Iterator; -import java.util.Set; - -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.edit.ui.dnd.LocalTransfer; -import org.eclipse.jface.viewers.StructuredSelection; -import org.eclipse.swt.dnd.DND; -import org.eclipse.swt.dnd.DropTargetEvent; -import org.eclipse.swt.dnd.DropTargetListener; - -/** - * Implements a {@link DropTargetListener} that accepts {@link EObject}s - * transferred locally (i.e. through {@link LocalTransfer}), and calls the given - * {@link DropAction} with the dropped {@link EObject}s. - */ -//Copied from org.eclipse.emf.facet.infra.query.ui.views.queryExecution.internal.DropAdapter -public class DropAdapter implements DropTargetListener { - - private final DropAction dropAction; - - public abstract static class DropAction { - /** The given EObjects are being dropped */ - public abstract void dropped(Set<EObject> eObjects); - } - - /** - * @param dropAction - * the action that will be called when model elements are dropped - */ - public DropAdapter(final DropAction dropAction) { - this.dropAction = dropAction; - } - - public void drop(final DropTargetEvent event) { - this.dropAction.dropped(getTransferredEObjects(event)); - } - - private Set<EObject> getTransferredEObjects(final DropTargetEvent event) { - Set<EObject> eObjects = new HashSet<EObject>(); - if (LocalTransfer.getInstance().isSupportedType(event.currentDataType)) { - if (event.data instanceof StructuredSelection) { - StructuredSelection structuredSelection = (StructuredSelection) event.data; - Iterator<?> iterator = structuredSelection.iterator(); - while (iterator.hasNext()) { - Object element = iterator.next(); - if (element instanceof EObject) { - EObject eObject = (EObject) element; - eObjects.add(eObject); - } - } - } - } - return eObjects; - } - - public void dropAccept(final DropTargetEvent event) { - // nothing - } - - public void dragOver(final DropTargetEvent event) { - // if (getTransferredEObjects(event).size() == 0) { - // // don't allow the drop - // event.detail = DND.DROP_NONE; - // } - // event.feedback = DND.FEEDBACK_SELECT | DND.FEEDBACK_SCROLL; - } - - public void dragOperationChanged(final DropTargetEvent event) { - // nothing - } - - public void dragLeave(final DropTargetEvent event) { - // nothing - } - - public void dragEnter(final DropTargetEvent event) { - event.detail = DND.DROP_LINK; - } -} \ No newline at end of file
diff --git a/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/emf/facet/efacet/ui/internal/view/EditableContext.java b/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/emf/facet/efacet/ui/internal/view/EditableContext.java deleted file mode 100644 index 7379f78..0000000 --- a/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/emf/facet/efacet/ui/internal/view/EditableContext.java +++ /dev/null
@@ -1,27 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010, 2012 Mia-Software. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Nicolas Bros (Mia-Software) - * Gregoire Dupe (Mia-Software) - Bug 364325 - [Restructuring] The user must be able to navigate into a model using the Facet. - *******************************************************************************/ -package org.eclipse.emf.facet.efacet.ui.internal.view; - -import org.eclipse.emf.ecore.EObject; - -/** An interface that supports editing the query context */ -//Copied from org.eclipse.emf.facet.infra.query.ui.views.queryExecution.internal.EditableContext -public interface EditableContext { - void add(EObject eObject); - - void remove(EObject eObject); - - void clear(); - - /** must be called after editing to refresh the viewers */ - void done(); -}
diff --git a/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/emf/facet/efacet/ui/internal/view/FacetSetsCatalogView.java b/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/emf/facet/efacet/ui/internal/view/FacetSetsCatalogView.java deleted file mode 100644 index 585524a..0000000 --- a/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/emf/facet/efacet/ui/internal/view/FacetSetsCatalogView.java +++ /dev/null
@@ -1,211 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009-2012 Mia-Software. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Nicolas Bros (Mia-Software) - initial API and implementation - * Grégoire Dupé (Mia-Software) - initial API and implementation - * Nicolas Bros (Mia-Software) - Bug 372732 - [Facet] Rewrite the catalog views for 0.2 - * Gregoire Dupe (Mia-Software) - Bug 373078 - API Cleaning - *******************************************************************************/ - -package org.eclipse.emf.facet.efacet.ui.internal.view; - -import java.util.ArrayList; -import java.util.Collection; - -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IExecutableExtensionFactory; -import org.eclipse.emf.common.util.EList; -import org.eclipse.emf.ecore.EPackage; -import org.eclipse.emf.ecore.EStructuralFeature; -import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl; -import org.eclipse.emf.facet.common.ui.internal.exported.views.IColumnDescription; -import org.eclipse.emf.facet.common.ui.internal.exported.views.IElementsViewFactory; -import org.eclipse.emf.facet.efacet.core.FacetUtils; -import org.eclipse.emf.facet.efacet.core.IFacetSetCatalogManagerFactory; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.Category; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.DocumentedElement; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.Facet; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.FacetSet; -import org.eclipse.emf.facet.efacet.ui.internal.Messages; -import org.eclipse.emf.facet.efacet.ui.internal.dialogs.FacetSetTreeContentProvider; -import org.eclipse.emf.facet.efacet.ui.internal.utils.ImageProvider; -import org.eclipse.emf.facet.util.emf.ui.internal.utils.ImageUtils; -import org.eclipse.jface.viewers.ColumnLabelProvider; -import org.eclipse.jface.viewers.IOpenListener; -import org.eclipse.jface.viewers.ITreeContentProvider; -import org.eclipse.jface.viewers.OpenEvent; -import org.eclipse.swt.graphics.Image; - -/** - * An Eclipse view that displays a list of available facet sets. Clicking on a facet set opens it in the facet set - * editor. - */ -public class FacetSetsCatalogView implements IExecutableExtensionFactory, IOpenListener { - - public Object create() throws CoreException { - final Collection<IColumnDescription> columnDescriptions = new ArrayList<IColumnDescription>(); - columnDescriptions.add(createNameColumnDescription()); - columnDescriptions.add(createExtendsColumnDescription()); - columnDescriptions.add(createCategoriesColumnDescription()); - columnDescriptions.add(createDocumentationColumnDescription()); - return IElementsViewFactory.DEFAULT.createElementsView(columnDescriptions, getContentProvider(), getInput(), - Messages.FacetSetsCatalogView_viewTitle, ImageProvider.getInstance().getFacetIcon(), this); - } - - private static final String NAME_COLUMN = "FacetView_NameColumn"; //$NON-NLS-1$ - private static final String DOCUMENTATION_COLUMN = "FacetView_LocationColumn"; //$NON-NLS-1$ - private static final String CATEGORIES_COLUMN = "FacetView_DefaultColumn"; //$NON-NLS-1$ - private static final String EXTENDS_COLUMN = "FacetView_ExtendsColumn"; //$NON-NLS-1$ - - private static final int NAME_COLUMN_WIDTH = 300; - private static final int EXTENDS_COLUMN_WIDTH = 200; - private static final int CATEGORIES_COLUMN_WIDTH = 200; - private static final int DOCUMENTATION_COLUMN_WIDTH = 400; - - private static IColumnDescription createNameColumnDescription() { - final ColumnLabelProvider columnLabelProvider = new ColumnLabelProvider() { - @Override - public String getText(final Object element) { - if (element instanceof FacetSet) { - final FacetSet facetSet = (FacetSet) element; - return facetSet.getName(); - } else if (element instanceof Facet) { - final Facet facet = (Facet) element; - return facet.getName(); - } else if (element instanceof EStructuralFeature) { - final EStructuralFeature feature = (EStructuralFeature) element; - return feature.getName(); - } else { - return ""; //$NON-NLS-1$ - } - - } - - @Override - public Image getImage(final Object element) { - return ImageUtils.getImage(element); - } - }; - return IElementsViewFactory.DEFAULT.createColumnDescription(Messages.FacetSetsCatalogView_nameColumn, FacetSetsCatalogView.NAME_COLUMN, FacetSetsCatalogView.NAME_COLUMN_WIDTH, - columnLabelProvider); - } - - private static IColumnDescription createExtendsColumnDescription() { - final ColumnLabelProvider columnLabelProvider = new ColumnLabelProvider() { - @Override - public String getText(final Object element) { - String result = null; - if (element instanceof FacetSet) { - final FacetSet facetSet = (FacetSet) element; - final EPackage extendedEPackage = FacetUtils - .getExtendedEPackage(facetSet); - if (extendedEPackage != null) { - result = extendedEPackage.getName() + " " + extendedEPackage.getNsURI(); //$NON-NLS-1$ - } - } - return result; - } - - }; - return IElementsViewFactory.DEFAULT.createColumnDescription(Messages.FacetSetsCatalogView_extendsColumn, FacetSetsCatalogView.EXTENDS_COLUMN, FacetSetsCatalogView.EXTENDS_COLUMN_WIDTH, - columnLabelProvider); - - } - - private static IColumnDescription createCategoriesColumnDescription() { - final ColumnLabelProvider columnLabelProvider = new ColumnLabelProvider() { - @Override - public String getText(final Object element) { - String result = null; - if (element instanceof FacetSet) { - final FacetSet facetSet = (FacetSet) element; - final StringBuilder strCategories = new StringBuilder(); - final EList<Category> categories = facetSet.getCategories(); - for (final Category category : categories) { - if (strCategories.length() > 0) { - strCategories.append("; "); //$NON-NLS-1$ - } - strCategories.append(category.getName()); - } - result = strCategories.toString(); - } - return result; - } - }; - return IElementsViewFactory.DEFAULT.createColumnDescription(Messages.FacetSetsCatalogView_categoriesColumn, FacetSetsCatalogView.CATEGORIES_COLUMN, FacetSetsCatalogView.CATEGORIES_COLUMN_WIDTH, - columnLabelProvider); - } - - private static IColumnDescription createDocumentationColumnDescription() { - final ColumnLabelProvider columnLabelProvider = new ColumnLabelProvider() { - @Override - public String getText(final Object element) { - String result = null; - if (element instanceof DocumentedElement) { - final DocumentedElement documentedElement = (DocumentedElement) element; - result = documentedElement.getDocumentation(); - } - return result; - } - }; - return IElementsViewFactory.DEFAULT.createColumnDescription(Messages.FacetSetsCatalogView_documentationColumn, FacetSetsCatalogView.DOCUMENTATION_COLUMN, - FacetSetsCatalogView.DOCUMENTATION_COLUMN_WIDTH, columnLabelProvider); - - } - - protected static ITreeContentProvider getContentProvider() { - return new FacetSetTreeContentProvider(); - } - - public void open(final OpenEvent event) { - // TODO: re-enable when there is a FacetSet editor - - // final EObject modelElement = (EObject) element; - // EPackage facetSet = null; - // if (modelElement instanceof FacetSet) { - // facetSet = (FacetSet) modelElement; - // } else if (modelElement instanceof Facet) { - // Facet facet = (Facet) modelElement; - // facetSet = facet.getEPackage(); - // } - // if (facetSet != null) { - // // open facet set in editor - // URI uri = null; - // try { - // String uriString = FacetSetCatalog.getSingleton().getURI(facetSet.getName()) - // .toString(); - // uri = URI.create(uriString); - // IEditorPart editor = null; - // if ("file".equals(uri.getScheme())) { //$NON-NLS-1$ - // editor = IDE.openEditor(PlatformUI.getWorkbench().getActiveWorkbenchWindow() - // .getActivePage(), new URI(facetSet.eResource().getURI().toString()), - // Activator.FACET_EDITOR_ID, true); - // } else { - // URIEditorInput uriEditorInput = new URIEditorInput( - // org.eclipse.emf.common.util.URI.createURI(uri.toString())); - // editor = IDE.openEditor(PlatformUI.getWorkbench().getActiveWorkbenchWindow() - // .getActivePage(), uriEditorInput, Activator.FACET_EDITOR_ID, true); - // } - // if (editor instanceof FacetEditor) { - // FacetEditor facetEditor = (FacetEditor) editor; - // facetEditor.setSelectionToViewer(modelElement); - // } - // - // } catch (Exception e) { - // Logger.logError(e, "Failed to open: " + uri, Activator.getDefault()); //$NON-NLS-1$ - // } - // } - } - - protected static Object getInput() { - return IFacetSetCatalogManagerFactory.DEFAULT - .getOrCreateFacetSetCatalogManager(new ResourceSetImpl()) - .getRegisteredFacetSets().toArray(); - } - -}
diff --git a/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/emf/facet/efacet/ui/internal/view/NavigationView.java b/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/emf/facet/efacet/ui/internal/view/NavigationView.java deleted file mode 100644 index 51faff5..0000000 --- a/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/emf/facet/efacet/ui/internal/view/NavigationView.java +++ /dev/null
@@ -1,760 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010, 2015 Mia-Software, and CEA-LIST. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Nicolas Bros (Mia-Software) - * Grégoire Dupé (Mia-Software) - Bug 364325 - [Restructuring] The user must be able to navigate into a model using the Facet. - * Vincent Lorenzo (CEA-LIST) - Bug 372644 - Create Customizable tooltips for the TreeViewer using a CustomizableLabelProvider - * Grégoire Dupé (Mia-Software) - Bug 364325 - [Restructuring] The user must be able to navigate into a model using the Facet. - * Grégoire Dupé (Mia-Software) - Bug 373510 - EditingDomain, ResourceSet, Catalogs, etc. have to be properly managed between editors and views - * Grégoire Dupé (Mia-Software) - Bug 373078 - API Cleaning - * Grégoire Dupé (Mia-Software) - Bug 372626 - Aggregates - * Olivier Remaud (Soft-Maint) - Bug 377615 - Query View filtering - * Grégoire Dupé (Mia-Software) - Bug 378498 - Navigation view sometimes lacks an EditingDomain - * Nicolas Bros (Mia-Software) - Bug 379395 - Navigate should replace elements - * Thomas Cicognani (Mia-Software) - Bug 472075 - Update API to create UI shortcuts to activate FacetSets - * Grégoire Dupé (Mia-Software) - Bug 480879 - Label provider instance already in use - * Grégoire Dupé (Mia-Software) - Bug 480879 - Label provider instance already in use - * Grégoire Dupé (Mia-Software) - Bug 480654 - IllegalStateException in NavigationView.addEObjects (611) - *******************************************************************************/ -package org.eclipse.emf.facet.efacet.ui.internal.view; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.Collections; -import java.util.HashMap; -import java.util.HashSet; -import java.util.Iterator; -import java.util.List; -import java.util.Set; - -import org.eclipse.emf.common.command.BasicCommandStack; -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.ecore.EClassifier; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.EPackage; -import org.eclipse.emf.ecore.ETypedElement; -import org.eclipse.emf.ecore.EcorePackage; -import org.eclipse.emf.ecore.resource.Resource; -import org.eclipse.emf.ecore.resource.ResourceSet; -import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl; -import org.eclipse.emf.edit.domain.AdapterFactoryEditingDomain; -import org.eclipse.emf.edit.domain.EditingDomain; -import org.eclipse.emf.edit.domain.IEditingDomainProvider; -import org.eclipse.emf.edit.provider.ComposedAdapterFactory; -import org.eclipse.emf.edit.ui.dnd.LocalTransfer; -import org.eclipse.emf.facet.custom.core.ICustomizationManager; -import org.eclipse.emf.facet.custom.core.ICustomizationManagerFactory; -import org.eclipse.emf.facet.efacet.core.FacetUtils; -import org.eclipse.emf.facet.efacet.core.IFacetManager; -import org.eclipse.emf.facet.efacet.core.IFacetManagerFactory; -import org.eclipse.emf.facet.efacet.core.IFacetSetCatalogManager; -import org.eclipse.emf.facet.efacet.core.IFacetSetCatalogManagerFactory; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.Facet; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.FacetSet; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.runtime.ETypedElementResult; -import org.eclipse.emf.facet.efacet.ui.IETypedElementResultDisplayer; -import org.eclipse.emf.facet.efacet.ui.IETypedElementResultDisplayerOpener; -import org.eclipse.emf.facet.efacet.ui.internal.Activator; -import org.eclipse.emf.facet.efacet.ui.internal.Messages; -import org.eclipse.emf.facet.efacet.ui.internal.exported.view.INavigationView; -import org.eclipse.emf.facet.efacet.ui.internal.exported.widget.IETypedElementSelectionWidget; -import org.eclipse.emf.facet.efacet.ui.internal.exported.widget.IETypedElementSelectionWidgetFactory; -import org.eclipse.emf.facet.efacet.ui.internal.view.DropAdapter.DropAction; -import org.eclipse.emf.facet.util.core.Logger; -import org.eclipse.emf.facet.util.emf.ui.internal.exported.IEmfLabelProviderFactory; -import org.eclipse.emf.facet.util.ui.internal.exported.dialog.IOkDialog; -import org.eclipse.emf.facet.util.ui.internal.exported.dialog.IOkDialogFactory; -import org.eclipse.jface.action.GroupMarker; -import org.eclipse.jface.action.MenuManager; -import org.eclipse.jface.dialogs.MessageDialog; -import org.eclipse.jface.viewers.IContentProvider; -import org.eclipse.jface.viewers.ILabelProvider; -import org.eclipse.jface.viewers.ISelection; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.jface.viewers.ITreeContentProvider; -import org.eclipse.jface.viewers.TreeViewer; -import org.eclipse.jface.viewers.Viewer; -import org.eclipse.jface.viewers.ViewerComparator; -import org.eclipse.osgi.util.NLS; -import org.eclipse.swt.SWT; -import org.eclipse.swt.custom.SashForm; -import org.eclipse.swt.dnd.DND; -import org.eclipse.swt.dnd.DropTargetListener; -import org.eclipse.swt.dnd.Transfer; -import org.eclipse.swt.events.ControlAdapter; -import org.eclipse.swt.events.ControlEvent; -import org.eclipse.swt.events.SelectionAdapter; -import org.eclipse.swt.events.SelectionEvent; -import org.eclipse.swt.graphics.Point; -import org.eclipse.swt.layout.FillLayout; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.layout.GridLayout; -import org.eclipse.swt.widgets.Button; -import org.eclipse.swt.widgets.Combo; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Group; -import org.eclipse.swt.widgets.Label; -import org.eclipse.swt.widgets.Menu; -import org.eclipse.swt.widgets.Shell; -import org.eclipse.ui.IWorkbenchActionConstants; -import org.eclipse.ui.IWorkbenchPage; -import org.eclipse.ui.IWorkbenchPart; -import org.eclipse.ui.IWorkbenchWindow; -import org.eclipse.ui.PlatformUI; -import org.eclipse.ui.part.ViewPart; -import org.eclipse.ui.part.WorkbenchPart; - -//Copied from org.eclipse.emf.facet.infra.query.ui.views.queryExecution.internal.QueryExecutionView -public class NavigationView extends ViewPart implements INavigationView { - - /** - * Execution button minimal width. - */ - private static final int EXEC_BT_MIN_WIDTH = 100; - - private TreeViewer contextViewer; - private Composite mainComposite; - private Composite parentComposite; - - private final Set<EObject> context = new HashSet<EObject>(); - private LayoutStyle layoutStyle = NavigationView.LayoutStyle.Horizontal; - private IETypedElementSelectionWidget navSelection; - private Combo comboDisplayer; - private EditingDomain editingDomain = null; - private ILabelProvider labelProvider; - private final IContentProvider contextCP = new ITreeContentProvider() { - - public void inputChanged(final Viewer viewer, final Object oldInput, - final Object newInput) { - // nothing - } - - public void dispose() { - // nothing - } - - public Object[] getElements(final Object inputElement) { - Object[] result = new Object[0]; - if (inputElement instanceof Set<?>) { - final Set<?> set = ((Set<?>) inputElement); - if (set.isEmpty()) { - result = new Object[] { Messages.QueryExecutionView_dragAndDropHint }; - } else { - result = set.toArray(); - } - } - return result; - } - - public boolean hasChildren(final Object element) { - return false; - } - - public Object getParent(final Object element) { - return null; - } - - public Object[] getChildren(final Object parentElement) { - return new Object[]{}; - } - }; - - private enum LayoutStyle { - Horizontal, Vertical - } - - public NavigationView() { - super(); - updateEditingDomain(); - } - - @Override - public void createPartControl(final Composite parent) { - this.parentComposite = parent; - parent.setLayout(gridLayoutWithNoMargins()); - this.layoutStyle = NavigationView.LayoutStyle.Horizontal; - createMainComposite(); - parent.addControlListener(new ControlAdapter() { - @Override - public void controlResized(final ControlEvent event) { - NavigationView.this.controlResized(parent); - } - }); - createContextMenu(); - } - - public void controlResized(final Composite parent) { - final LayoutStyle oldLayoutStyle = NavigationView.this.layoutStyle; - final Point size = parent.getSize(); - if (size.x > size.y) { - this.layoutStyle = NavigationView.LayoutStyle.Horizontal; - } else { - this.layoutStyle = NavigationView.LayoutStyle.Vertical; - } - if (this.layoutStyle != oldLayoutStyle) { - createMainComposite(); - } - } - - protected static void createContextMenu() { - final MenuManager contextMenu = new MenuManager("#PopUp"); //$NON-NLS-1$ - contextMenu.add(new GroupMarker(IWorkbenchActionConstants.MB_ADDITIONS)); - } - - private void createMainComposite() { - if (this.mainComposite != null) { - this.mainComposite.dispose(); - } - this.mainComposite = new Composite(this.parentComposite, SWT.NONE); - this.mainComposite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true)); - this.mainComposite.setLayout(gridLayoutWithNoMargins()); - - int direction; - if (this.layoutStyle == NavigationView.LayoutStyle.Horizontal) { - direction = SWT.HORIZONTAL; - } else { - direction = SWT.VERTICAL; - } - - final SashForm sashForm = new SashForm(this.mainComposite, SWT.SMOOTH - | direction); - sashForm.setLayout(new FillLayout()); - sashForm.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true)); - - createContextGroup(sashForm); - // createQueryGroup(sashForm); - final Composite lastGroup = new Composite(sashForm, SWT.NONE); - createQueryGroup(lastGroup); - lastGroup.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true)); - - GridLayout gridLayout; - if (this.layoutStyle == NavigationView.LayoutStyle.Horizontal) { - gridLayout = new GridLayout(2, false); - } else { - gridLayout = new GridLayout(); - } - gridLayout.marginHeight = 0; - gridLayout.marginWidth = 0; - lastGroup.setLayout(gridLayout); - // TODO: implement parameters (hidden in the meantime) - // /!\ when it is added back, put the QueryGroup back in the sashForm - // instead of lastGroup - // createParametersGroup(lastGroup); - createExecuteGroup(lastGroup); - } - - private static GridLayout gridLayoutWithNoMargins() { - final GridLayout gridLayout = new GridLayout(); - gridLayout.marginWidth = 0; - gridLayout.marginHeight = 0; - return gridLayout; - } - - private void createQueryGroup(final Composite parent) { - final Group queryGroup = new Group(parent, SWT.NONE); - queryGroup.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true)); - queryGroup.setText(Messages.QueryExecutionView_ETypedElementsGroup); - final GridLayout groupLayout = new GridLayout(); - queryGroup.setLayout(groupLayout); - Collection<ETypedElement> eTypedElements = Collections.emptyList(); - Collection<? extends EObject> knownEPackages = Collections.emptyList(); - if (getResourceSet() != null) { - eTypedElements = new ArrayList<ETypedElement>( - FacetUtils.getETypedElements(getResourceSet())); - knownEPackages = IFacetSetCatalogManagerFactory.DEFAULT - .getOrCreateFacetSetCatalogManager(this.getResourceSet()) - .getRegisteredFacetSets(); - } - this.navSelection = IETypedElementSelectionWidgetFactory.DEFAULT - .createETypedElementSelectionWidget( - 1, - false, - queryGroup, - getCustomizationManager(), - knownEPackages); - this.navSelection.setAvailableETypedElements(eTypedElements); - } - - private void createContextGroup(final Composite parent) { - final Group contextGroup = new Group(parent, SWT.NONE); - contextGroup.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true)); - contextGroup.setText(Messages.QueryExecutionView_Context); - final GridLayout groupLayout = new GridLayout(); - contextGroup.setLayout(groupLayout); - createContextViewer(contextGroup); - } - - private void createContextViewer(final Group contextGroup) { - this.contextViewer = new TreeViewer(contextGroup, SWT.MULTI | SWT.BORDER); - final GridData listData = new GridData(SWT.FILL, SWT.FILL, true, true); - this.contextViewer.getTree().setLayoutData(listData); - addDropSupport(this.contextViewer); - createContextMenu(this.contextViewer); - this.contextViewer.setContentProvider(this.contextCP); - changeEditingDomain(this.editingDomain); - this.contextViewer.setLabelProvider(this.labelProvider); - this.contextViewer.setInput(this.context); - this.contextViewer.setComparator(new ViewerComparator() { - @Override - public int compare(final Viewer viewer, final Object object1, - final Object object2) { - return NavigationView.this.compare(object1, object2); - } - }); - } - - protected int compare(final Object object1, final Object object2) { - final String label1 = this.labelProvider.getText(object1); - final String label2 = this.labelProvider.getText(object2); - return label1.compareToIgnoreCase(label2); - } - - private EditableContext createEditableContext() { - return new EditableContext() { - public void add(final EObject eObject) { - NavigationView.this.dropEObject(eObject); - } - - public void remove(final EObject eObject) { - NavigationView.this.removeEObject(eObject); - } - - public void clear() { - NavigationView.this.removeAllEObjects(); - } - - public void done() { - NavigationView.this.refreshContextViewer(); - } - }; - } - - protected final IOkDialog dropEObject(final EObject eObject) { - return addEObject(eObject); - } - - /** Create a context menu on the context pane */ - private void createContextMenu(final TreeViewer treeViewer) { - final ContextPaneMenuManager menuManager = new ContextPaneMenuManager(this, - createEditableContext(), treeViewer); - final Menu menu = menuManager.createContextMenu(treeViewer.getTree()); - treeViewer.getTree().setMenu(menu); - } - - private void addDropSupport(final TreeViewer viewer) { - final DropTargetListener dropListener = new DropAdapter( - new DropAction() { - @Override - public void dropped(final Set<EObject> eObjects) { - addEObjects2(eObjects); - } - }); - final int dndOperations = DND.DROP_LINK | DND.DROP_COPY | DND.DROP_MOVE; - final Transfer[] transfers = new Transfer[] { LocalTransfer - .getInstance() }; - viewer.addDropSupport(dndOperations, transfers, dropListener); - } - - protected final void refreshContextViewer() { - if (this.contextViewer != null) { - this.contextViewer.refresh(); - final Set<EObject> toBeRemoved = new HashSet<EObject>(); - for (EObject eObject : this.context) { - if (eObject.eResource().getResourceSet() != getResourceSet()) { - toBeRemoved.add(eObject); - } - } - this.context.remove(toBeRemoved); - this.contextViewer.setInput(this.context); - if (this.contextViewer.getLabelProvider() != this.labelProvider) { - this.contextViewer.setLabelProvider(this.labelProvider); - } - updateQueriesInput(); - } - } - - private void updateQueriesInput() { - final Collection<ETypedElement> result = new ArrayList<ETypedElement>(); - final ResourceSet resourceSet = this.editingDomain.getResourceSet(); - final IFacetSetCatalogManager catalog = IFacetSetCatalogManagerFactory.DEFAULT - .getOrCreateFacetSetCatalogManager(resourceSet); - final Collection<FacetSet> registeredFS = catalog - .getRegisteredFacetSets(); - for (FacetSet facetSet : registeredFS) { - result.addAll(getETypedElements(facetSet)); - } - this.navSelection.setAvailableETypedElements(result); - } - - private Collection<? extends ETypedElement> getETypedElements( - final FacetSet facetSet) { - final Collection<ETypedElement> result = new ArrayList<ETypedElement>(); - for (EClassifier eClassifier : facetSet.getEClassifiers()) { - if (eClassifier instanceof Facet) { - final Facet facet = (Facet) eClassifier; - if (isApplicableFacet(facet)) { - result.addAll(facet.getFacetElements()); - result.addAll(facet.getFacetOperations()); - } - } - } - for (FacetSet subFacetSet : facetSet.getFacetSets()) { - result.addAll(getETypedElements(subFacetSet)); - } - for (EPackage subPackage : facetSet.getESubpackages()) { - if (subPackage instanceof FacetSet) { - final FacetSet subFacetSet = (FacetSet) subPackage; - result.addAll(getETypedElements(subFacetSet)); - } - } - return result; - } - - private void createExecuteGroup(final Composite parent) { - final Group executeGroup = new Group(parent, SWT.NONE); - executeGroup.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, false)); - executeGroup.setText(Messages.QueryExecutionView_ExecuteGroup); - executeGroup.setLayout(new GridLayout()); - createDisplayStyleComposite(executeGroup); - final Button buttonExecute = new Button(executeGroup, SWT.PUSH); - buttonExecute.setText(Messages.QueryExecutionView_ExecuteButton); - final GridData buttonData = new GridData(SWT.CENTER, SWT.NONE, true, - false); - buttonData.minimumWidth = NavigationView.EXEC_BT_MIN_WIDTH; - buttonExecute.setLayoutData(buttonData); - buttonExecute.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(final SelectionEvent event) { - executeClicked(); - } - }); - } - - protected void executeClicked() { - final ETypedElement selectedQuery = getSelectedQuery(); - if (selectedQuery == null) { - MessageDialog.openInformation(getSite().getShell(), - Messages.QueryExecutionView_NoQuerySelected, - Messages.QueryExecutionView_SelectQueryToExecute); - } else { - try { - final IFacetManager facetMgr = IFacetManagerFactory.DEFAULT - .getOrCreateDefaultFacetManager(getResourceSet()); - final List<ETypedElementResult> results = facetMgr - .batchGetOrInvoke(this.context, selectedQuery, - Object.class); - if (checkResult(results)) { - displayResult(results); - } - } catch (final Exception e) { - final StackTraceElement[] stackTrace = e.getStackTrace(); - String stack = ""; //$NON-NLS-1$ - if (stackTrace.length > 0) { - stack = "\nat:" + stackTrace[0].toString(); //$NON-NLS-1$ - } - String message; - if (e.getMessage() == null) { - message = ""; //$NON-NLS-1$ - } else { - message = " : " + e.getMessage(); //$NON-NLS-1$ - } - MessageDialog.openError(getSite().getShell(), - Messages.QueryExecutionView_ErrorExecutingQuery, e.getClass() - .getSimpleName() + message + stack); - Logger.logError(e, Activator.getDefault()); - } - } - } - - private boolean checkResult(final List<ETypedElementResult> results) { - boolean result = true; - for (ETypedElementResult modelQueryResult : results) { - final Throwable exc = modelQueryResult.getException(); - if (exc != null) { - Logger.logError(exc, "Query exception", Activator.getDefault()); //$NON-NLS-1$ - MessageDialog.openError(this.mainComposite.getShell(), - Messages.QueryExecutionView_QueryException, exc.getClass().getSimpleName() - + " : " + exc.getMessage()); //$NON-NLS-1$ - result = false; - break; - } - } - return result; - } - - private void displayResult(final List<ETypedElementResult> result) { - final String displayerName = this.comboDisplayer.getText(); - final IETypedElementResultDisplayer displayer = QueryResultDisplayersRegistry - .getInstance().getQueryResultDisplayer(displayerName); - if (displayer == null) { - final String message = NLS - .bind("Query Displayer with name \"{0}\" not found", displayerName); //$NON-NLS-1$ - Logger.logError(message, Activator.getDefault()); - MessageDialog.openWarning(getSite().getShell(), - Messages.QueryExecutionView_NoQueryDisplayer, message); - } else { - displayer.displayETypedElementResults(result, this.editingDomain); - } - } - - private ETypedElement getSelectedQuery() { - final ETypedElement selectedQuery = this.navSelection - .getSelectedETypedElements().get(0); - return selectedQuery; - } - - private void createDisplayStyleComposite(final Group executeGroup) { - final Composite displayStyle = new Composite(executeGroup, - SWT.NONE); - displayStyle.setLayoutData(new GridData(SWT.FILL, SWT.NONE, true, false)); - displayStyle.setLayout(new GridLayout(2, false)); - final Label label = new Label(displayStyle, SWT.NONE); - label.setText(Messages.QueryExecutionView_DisplayResultIn); - this.comboDisplayer = new Combo(displayStyle, SWT.DROP_DOWN | SWT.READ_ONLY); - - final List<IETypedElementResultDisplayer> resultDisplayers = QueryResultDisplayersRegistry - .getInstance().getQueryResultDisplayers(); - for (IETypedElementResultDisplayer namedQueryResultDisplayer : resultDisplayers) { - this.comboDisplayer.add(namedQueryResultDisplayer.getName()); - } - - this.comboDisplayer.select(0); - this.comboDisplayer.setLayoutData(new GridData(SWT.FILL, SWT.NONE, true, false)); - } - - @Override - public void setFocus() { - updateEditingDomain(); - this.refreshContextViewer(); - } - - private void updateEditingDomain() { - IWorkbenchWindow activeWindow = PlatformUI.getWorkbench() - .getActiveWorkbenchWindow(); - if (activeWindow == null) { - if (PlatformUI.getWorkbench().getWorkbenchWindows().length > 0) { - activeWindow = PlatformUI.getWorkbench().getWorkbenchWindows()[0]; - } else { - throw new IllegalStateException("No windows available."); //$NON-NLS-1$ - } - } - final IWorkbenchPage activePage = activeWindow.getActivePage(); - if (activePage != null) { - final IWorkbenchPart part = activePage.getActivePart(); - if (part instanceof IEditingDomainProvider) { - final IEditingDomainProvider edProvider = (IEditingDomainProvider) part; - final EditingDomain newEditingDomain = edProvider - .getEditingDomain(); - if ((this.editingDomain != newEditingDomain) - || (this.editingDomain == null)) { - changeEditingDomain(newEditingDomain); - } - } - } - } - - private void changeEditingDomain(final EditingDomain newEditingDomain) { - this.editingDomain = newEditingDomain; - if (this.editingDomain == null) { - final ComposedAdapterFactory adapterFactory = new ComposedAdapterFactory( - ComposedAdapterFactory.Descriptor.Registry.INSTANCE); - final BasicCommandStack commandStack = new BasicCommandStack(); - this.editingDomain = new AdapterFactoryEditingDomain( - adapterFactory, commandStack, - new HashMap<Resource, Boolean>()); - } - this.labelProvider = IEmfLabelProviderFactory.DEFAULT - .createLabelProvider(); - } - - public void setContext(final List<EObject> eObjects) { - this.context.clear(); - addEObjects(eObjects); - refreshContextViewer(); - } - - public void setSelectedQueries(final List<ETypedElement> queries) { - this.navSelection.setSelectedETypedElements(queries); - } - - public ContextInfo getContextInfo() { - final ContextInfo contextInfo = new ContextInfo( - new ArrayList<EObject>(this.context)); - final ISelection selection = this.contextViewer.getSelection(); - if (selection instanceof IStructuredSelection) { - final IStructuredSelection structSelection = (IStructuredSelection) selection; - final Iterator<?> iterator = structSelection.iterator(); - while (iterator.hasNext()) { - final Object selectedElement = iterator.next(); - if (selectedElement instanceof EObject) { - final EObject eObject = (EObject) selectedElement; - contextInfo.addSelectedEObject(eObject); - } - } - } - return contextInfo; - } - - public final class ContextInfo { - private final List<EObject> eObjects; - private final List<EObject> selectedEObjects = new ArrayList<EObject>(); - - public ContextInfo(final List<EObject> eObjects) { - this.eObjects = eObjects; - } - - public List<EObject> getEObjects() { - return this.eObjects; - } - - public void addSelectedEObject(final EObject eObject) { - this.selectedEObjects.add(eObject); - } - - public List<EObject> getSelectedEObjects() { - return this.selectedEObjects; - } - - } - - public void addEObjects(final Collection<? extends EObject> eObjects) { - addEObjects2(eObjects); - } - - public IOkDialog addEObjects2(final Collection<? extends EObject> eObjects) { - IOkDialog dialog = null; - try { - basicAddEObjects(eObjects); - } catch (NavigationViewResourceSetException e) { - dialog = openResourceSetPbDialog(e); - Logger.logError(e, Activator.getDefault()); - } - return dialog; - } - - private void basicAddEObjects(final Collection<? extends EObject> eObjects) - throws NavigationViewResourceSetException { - updateEditingDomain(); - for (EObject eObject : eObjects) { - basicAddEObject(eObject); - } - refreshContextViewer(); - } - - public IOkDialog addEObject(final EObject eObject) { - IOkDialog dialog = null; - try { - basicAddEObject(eObject); - } catch (NavigationViewResourceSetException e) { - dialog = openResourceSetPbDialog(e); - } - return dialog; - } - - private static IOkDialog openResourceSetPbDialog( - final NavigationViewResourceSetException exception) { - return IOkDialogFactory.DEFAULT.openErrorDialog(new Shell(), exception, - Messages.NavigationView_eObjectsMustBeInTheSameResourceSet); - } - - private void basicAddEObject(final EObject eObject) throws NavigationViewResourceSetException { - final Resource resource = eObject.eResource(); - final ResourceSet eObjectRS = resource.getResourceSet(); - if (eObjectRS == null - || (getResourceSet() != null && !eObjectRS.equals(getResourceSet()))) { - throw new NavigationViewResourceSetException( - "Invalid resourceSet: all the eObjects added in the navigation view must be owned by the same resource set." //$NON-NLS-1$ - ); - } - this.context.add(eObject); - } - - public void removeEObject(final EObject eObject) { - this.context.remove(eObject); - } - - public void removeEObjects(final List<? extends EObject> eObjects) { - this.context.removeAll(eObjects); - } - - public void removeAllEObjects() { - this.context.clear(); - } - - public List<EClassifier> getUsableEClassifiers() { - // TODO Auto-generated method stub - return null; - } - - public void selectETypedElement(final ETypedElement eTypedElement) { - // TODO Auto-generated method stub - - } - - public ETypedElement getSelectedETypedElement() { - // TODO Auto-generated method stub - return null; - } - - public List<IETypedElementResultDisplayerOpener> getAvailableSelectedDisplayers() { - // TODO Auto-generated method stub - return null; - } - - public void setSelectDisplayer(final IETypedElementResultDisplayerOpener resultDisplayer) { - // TODO Auto-generated method stub - - } - - public IETypedElementResultDisplayerOpener getSelectedDisplayer() { - // TODO Auto-generated method stub - return null; - } - - public WorkbenchPart preform() { - // TODO Auto-generated method stub - return null; - } - - private ResourceSet getResourceSet() { - ResourceSet resourceSet = null; - if (this.context.size() != 0) { - final EObject firstEObject = this.context.iterator().next(); - final Resource eResource = firstEObject.eResource(); - if (eResource != null) { - resourceSet = eResource.getResourceSet(); - } - } - return resourceSet; - } - - private ICustomizationManager getCustomizationManager() { - ResourceSet resourceSet = getResourceSet(); - if (resourceSet == null) { - resourceSet = new ResourceSetImpl(); - } - return ICustomizationManagerFactory.DEFAULT - .getOrCreateICustomizationManager(resourceSet); - } - - private boolean isApplicableFacet(final Facet facet) { - final EClass eobjectClass = EcorePackage.eINSTANCE.getEObject(); - boolean result = false; - for (final EObject object : this.context) { - if (facet.getExtendedMetaclass() == null - || facet.getExtendedMetaclass() == eobjectClass - || facet.getExtendedMetaclass().isSuperTypeOf(object.eClass()) - ) { - result = true; - break; - } - } - return result; - } - -}
diff --git a/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/emf/facet/efacet/ui/internal/view/NavigationViewFactory.java b/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/emf/facet/efacet/ui/internal/view/NavigationViewFactory.java deleted file mode 100644 index 2afe50b..0000000 --- a/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/emf/facet/efacet/ui/internal/view/NavigationViewFactory.java +++ /dev/null
@@ -1,65 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2012, 2015 Mia-Software. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Nicolas Bros (Mia-Software) - * Grégoire Dupé (Mia-Software) - Bug 364325 - [Restructuring] The user must be able to navigate into a model using the Facet. - * Grégoire Dupé (Mia-Software) - Bug 474286 - ClassCastException in NavigationViewFactory.openNavigationView (36) - * Grégoire Dupé (Mia-Software) - Bug 480654 - IllegalStateException in NavigationView.addEObjects (611) - *******************************************************************************/ -package org.eclipse.emf.facet.efacet.ui.internal.view; - -import org.eclipse.emf.edit.domain.EditingDomain; -import org.eclipse.emf.facet.efacet.ui.internal.Activator; -import org.eclipse.emf.facet.efacet.ui.internal.exported.view.INavigationView; -import org.eclipse.emf.facet.efacet.ui.internal.exported.view.INavigationViewFactory; -import org.eclipse.emf.facet.efacet.ui.internal.sync.generated.SynchronizedNavigationView; -import org.eclipse.emf.facet.util.core.Logger; -import org.eclipse.ui.IViewPart; -import org.eclipse.ui.IWorkbenchPage; -import org.eclipse.ui.IWorkbenchWindow; -import org.eclipse.ui.PartInitException; -import org.eclipse.ui.PlatformUI; - -public class NavigationViewFactory implements INavigationViewFactory { - - public static final String VIEW_ID = "org.eclipse.emf.facet.efacet.ui.view.navigation"; //$NON-NLS-1$ - - /* - * FIXME gdupe> It would be better if that method would be able to throw an - * exception, rather than to "silently" log the problems. - */ - public INavigationView openNavigationView(final EditingDomain editingDomain) { - INavigationView result = null; - try { - final IWorkbenchWindow window = PlatformUI.getWorkbench().getWorkbenchWindows()[0]; - if (window != null) { - final IWorkbenchPage activePage = window.getActivePage(); - if (activePage != null) { - final IViewPart view = activePage.showView( - NavigationViewFactory.VIEW_ID); - if (view instanceof INavigationView) { - result = new SynchronizedNavigationView( - (INavigationView) view, - window.getShell().getDisplay()); - } else { - final String message = String.format( - "Something wrong happend when trying to open the EMF Facet navigation view. The view was expected to be of type %s but is of type %s", //$NON-NLS-1$ - INavigationView.class.getName(), - view.getClass().getName() - ); - Logger.logError(message, Activator.getDefault()); - } - } - } - } catch (final PartInitException e) { - Logger.logError(e, Activator.getDefault()); - } - return result; - } - -}
diff --git a/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/emf/facet/efacet/ui/internal/view/NavigationViewResourceSetException.java b/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/emf/facet/efacet/ui/internal/view/NavigationViewResourceSetException.java deleted file mode 100644 index 1004817..0000000 --- a/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/emf/facet/efacet/ui/internal/view/NavigationViewResourceSetException.java +++ /dev/null
@@ -1,34 +0,0 @@ - /******************************************************************************* - * Copyright (c) 2015 Mia-Software. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Grégoire Dupé (Mia-Software) - Bug 480654 - IllegalStateException in NavigationView.addEObjects (611) - *******************************************************************************/ -package org.eclipse.emf.facet.efacet.ui.internal.view; - -public class NavigationViewResourceSetException extends Exception { - - private static final long serialVersionUID = -2247657462989799934L; - - public NavigationViewResourceSetException() { - super(); - } - - public NavigationViewResourceSetException(final String message) { - super(message); - } - - public NavigationViewResourceSetException(final Throwable cause) { - super(cause); - } - - public NavigationViewResourceSetException(final String message, - final Throwable cause) { - super(message, cause); - } - -}
diff --git a/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/emf/facet/efacet/ui/internal/view/QueryResultDisplayersRegistry.java b/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/emf/facet/efacet/ui/internal/view/QueryResultDisplayersRegistry.java deleted file mode 100644 index d76f115..0000000 --- a/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/emf/facet/efacet/ui/internal/view/QueryResultDisplayersRegistry.java +++ /dev/null
@@ -1,108 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 2010, 2012 Mia-Software. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Nicolas Bros (Mia-Software) - initial API and implementation - * Gregoire Dupe (Mia-Software) - Bug 364325 - [Restructuring] The user must be able to navigate into a model using the Facet. - *******************************************************************************/ - -package org.eclipse.emf.facet.efacet.ui.internal.view; - -import java.util.ArrayList; -import java.util.List; - -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IConfigurationElement; -import org.eclipse.emf.facet.efacet.ui.IETypedElementResultDisplayer; -import org.eclipse.emf.facet.efacet.ui.internal.Activator; -import org.eclipse.emf.facet.util.core.Logger; -import org.eclipse.emf.facet.util.core.internal.exported.AbstractRegistry; -import org.eclipse.osgi.util.NLS; - -/** - * The singleton registry of {@link IETypedElementResultDisplayer}s, which initializes - * the registry by reading extensions when first accessed. - */ -//Copied from org.eclipse.emf.facet.infra.query.ui.views.queryExecution.internal.QueryResultDisplayersRegistry -public class QueryResultDisplayersRegistry extends AbstractRegistry { - - private static final String EXTENSION_POINT_NAME = "eTypedElementResultDisplay"; //$NON-NLS-1$ - private static final String ELEMENT_QUERY_RESULT_DISPLAYER = "displayer"; //$NON-NLS-1$ - private static final String ATTRIBUTE_CLASS = "class"; //$NON-NLS-1$ - - private static QueryResultDisplayersRegistry instance = null; - - private final List<IETypedElementResultDisplayer> queryResultDisplayers; - - public QueryResultDisplayersRegistry() { - this.queryResultDisplayers = new ArrayList<IETypedElementResultDisplayer>(); - initialize(); - } - - public static QueryResultDisplayersRegistry getInstance() { - if (QueryResultDisplayersRegistry.instance == null) { - QueryResultDisplayersRegistry.instance = new QueryResultDisplayersRegistry(); - } - return QueryResultDisplayersRegistry.instance; - } - - public List<IETypedElementResultDisplayer> getQueryResultDisplayers() { - return this.queryResultDisplayers; - } - - public IETypedElementResultDisplayer getQueryResultDisplayer(final String name) { - for (IETypedElementResultDisplayer namedQueryResultDisplayer : this.queryResultDisplayers) { - if (name.equals(namedQueryResultDisplayer.getName())) { - return namedQueryResultDisplayer; - } - } - return null; - } - - @Override - protected String getExtensionPointName() { - return QueryResultDisplayersRegistry.EXTENSION_POINT_NAME; - } - - @Override - protected String getExtensionPointNamespace() { - return Activator.getDefault().getBundle().getSymbolicName(); - } - - @Override - protected void handleRootElement(final IConfigurationElement configurationElement) { - final String name = configurationElement.getName(); - if (name.equalsIgnoreCase(QueryResultDisplayersRegistry.ELEMENT_QUERY_RESULT_DISPLAYER)) { - readQueryResultDisplayer(configurationElement); - } else { - logUnknownElement(configurationElement); - } - } - - private void readQueryResultDisplayer(final IConfigurationElement configurationElement) { - Object queryResultDisplayerObject = null; - try { - queryResultDisplayerObject = configurationElement - .createExecutableExtension(QueryResultDisplayersRegistry.ATTRIBUTE_CLASS); - } catch (final CoreException e) { - Logger.logError(e, Activator.getDefault()); - } - if (queryResultDisplayerObject == null) { - logMissingAttribute(configurationElement, QueryResultDisplayersRegistry.ATTRIBUTE_CLASS); - return; - } - - if (queryResultDisplayerObject instanceof IETypedElementResultDisplayer) { - IETypedElementResultDisplayer queryResultDisplayer = (IETypedElementResultDisplayer) queryResultDisplayerObject; - this.queryResultDisplayers.add(queryResultDisplayer); - } else { - logError(configurationElement, NLS.bind("The given class is not a {0}.", //$NON-NLS-1$ - IETypedElementResultDisplayer.class.getSimpleName())); - } - - } -}
diff --git a/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/emf/facet/efacet/ui/internal/widget/EClassifierSelectionControl.java b/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/emf/facet/efacet/ui/internal/widget/EClassifierSelectionControl.java deleted file mode 100644 index 3f8b925..0000000 --- a/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/emf/facet/efacet/ui/internal/widget/EClassifierSelectionControl.java +++ /dev/null
@@ -1,90 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2011 Mia-Software. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Nicolas Bros (Mia-Software) - initial API and implementation - * Nicolas Guyomar (Mia-Software) - Bug 349546 - EMF Facet facetSet editor - *******************************************************************************/ -package org.eclipse.emf.facet.efacet.ui.internal.widget; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import org.eclipse.emf.common.util.EList; -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.ecore.EClassifier; -import org.eclipse.emf.ecore.EDataType; -import org.eclipse.emf.ecore.EPackage; -import org.eclipse.emf.facet.efacet.ui.internal.Messages; -import org.eclipse.emf.facet.efacet.ui.internal.composites.FilteredElementSelectionComposite; -import org.eclipse.emf.facet.efacet.ui.internal.composites.SelectETypeComposite.ETypeSelectionOptions; -import org.eclipse.swt.widgets.Composite; - -/** - * A control to select an {@link EClass}, that can be filtered using the associated text field. - */ -public class EClassifierSelectionControl extends FilteredElementSelectionComposite { - - private final Map<String, EClassifier> stringToEClassifierMap = new HashMap<String, EClassifier>(); - private final ETypeSelectionOptions eTypeSelectionOption; - private String metamodelNsUri; - - public EClassifierSelectionControl(final Composite parent, final String metamodelNsUri, final ETypeSelectionOptions eTypeSelectionOption) { - super(parent, true, false); - this.eTypeSelectionOption = eTypeSelectionOption; - this.metamodelNsUri = metamodelNsUri; - } - - public void updateList(final String metamodelNsUri2) { - this.metamodelNsUri = metamodelNsUri2; - EPackage ePackage = EPackage.Registry.INSTANCE.getEPackage(this.metamodelNsUri); - if (ePackage != null) { - List<String> eClasses = new ArrayList<String>(); - EList<EClassifier> eClassifiers = ePackage.getEClassifiers(); - if (this.eTypeSelectionOption == ETypeSelectionOptions.ECLASS) { - for (EClassifier eClassifier : eClassifiers) { - if (eClassifier instanceof EClass) { - eClasses.add(eClassifier.getName()); - this.stringToEClassifierMap.put(eClassifier.getName(), eClassifier); - } - } - } else if (this.eTypeSelectionOption == ETypeSelectionOptions.EDATATYPE) { - for (EClassifier eClassifier : eClassifiers) { - if (eClassifier instanceof EDataType) { - eClasses.add(eClassifier.getName()); - this.stringToEClassifierMap.put(eClassifier.getName(), eClassifier); - } - } - - } else { - for (EClassifier eClassifier : eClassifiers) { - eClasses.add(eClassifier.getName()); - this.stringToEClassifierMap.put(eClassifier.getName(), eClassifier); - } - } - if (eClasses.isEmpty()) { - eClasses.add(Messages.No_result_found); - setEnabled(false); - } else { - setEnabled(true); - } - setElements(eClasses.toArray()); - } - } - - public EClassifier getSelectedEClassifier() { - Object[] selectElements = getSelectedElements(); - if (selectElements != null && selectElements.length > 0) { - if (this.stringToEClassifierMap.containsKey(selectElements[0])) { - return this.stringToEClassifierMap.get(selectElements[0]); - } - } - return null; - } -}
diff --git a/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/emf/facet/efacet/ui/internal/widget/ETypedElementSelectionControl.java b/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/emf/facet/efacet/ui/internal/widget/ETypedElementSelectionControl.java deleted file mode 100644 index 07faa74..0000000 --- a/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/emf/facet/efacet/ui/internal/widget/ETypedElementSelectionControl.java +++ /dev/null
@@ -1,421 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010, 2015 Mia-Software, CEA-LIST, and Soft-Maint. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Nicolas Bros (Mia-Software) - Bug 370806 - [table] rewrite the "allowed contents" query selection dialog for v0.2 - * Vincent Lorenzo (CEA-LIST) - Bug 372644 - Create Customizable tooltips for the TreeViewer using a CustomizableLabelProvider - * Gregoire Dupe (Mia-Software) - Bug 372644 - Create Customizable tooltips for the TreeViewer using a CustomizableLabelProvider - * Gregoire Dupe (Mia-Software) - Bug 373078 - API Cleaning - * Vincent Lorenzo (CEA-LIST) - Bug 357621 - Improve the label displayed for Customization and Facets - * Gregoire Dupe (Mia-Software) - Bug 372626 - Aggregates - * Olivier Remaud (Soft-Maint) - Bug 377615 - Query View filtering - * Vincent Lorenzo (CEA-LIST) - Bug 357621 - Improve the label displayed for Customization and Facets - * Vincent Lorenzo (CEA-LIST) - Bug 377909 - The elements displayed in the ETypedElement dialog are not sorted by alphabetic order - * Thomas Cicognani (Mia-Software) - Bug 472075 - Update API to create UI shortcuts to activate FacetSets -*******************************************************************************/ -package org.eclipse.emf.facet.efacet.ui.internal.widget; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.HashSet; -import java.util.Iterator; -import java.util.List; -import java.util.Set; - -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.Status; -import org.eclipse.emf.common.util.TreeIterator; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.ETypedElement; -import org.eclipse.emf.facet.efacet.ui.internal.Activator; -import org.eclipse.emf.facet.efacet.ui.internal.Messages; -import org.eclipse.emf.facet.efacet.ui.internal.utils.ImageProvider; -import org.eclipse.emf.facet.util.core.internal.exported.IFilter; -import org.eclipse.emf.facet.util.emf.ui.internal.exported.IEmfLabelProviderFactory; -import org.eclipse.jface.viewers.ColumnViewerToolTipSupport; -import org.eclipse.jface.viewers.IBaseLabelProvider; -import org.eclipse.jface.viewers.IContentProvider; -import org.eclipse.jface.viewers.ILabelProvider; -import org.eclipse.jface.viewers.IOpenListener; -import org.eclipse.jface.viewers.ISelectionChangedListener; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.jface.viewers.ITreeContentProvider; -import org.eclipse.jface.viewers.OpenEvent; -import org.eclipse.jface.viewers.SelectionChangedEvent; -import org.eclipse.jface.viewers.StructuredSelection; -import org.eclipse.jface.viewers.StructuredViewer; -import org.eclipse.jface.viewers.Viewer; -import org.eclipse.jface.viewers.ViewerComparator; -import org.eclipse.jface.viewers.ViewerFilter; -import org.eclipse.osgi.util.NLS; -import org.eclipse.swt.SWT; -import org.eclipse.swt.events.SelectionAdapter; -import org.eclipse.swt.events.SelectionEvent; -import org.eclipse.swt.graphics.Image; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.layout.GridLayout; -import org.eclipse.swt.widgets.Button; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.ui.dialogs.FilteredTree; -import org.eclipse.ui.dialogs.PatternFilter; - -/** - * A control that displays a tree of ETypedElements under a list of containers (EPackages for example), with a filter - * text field. - */ -public class ETypedElementSelectionControl implements IETypedElementTabSelectionWidgetInternal { - - public static final String TAB_ID = "flat.view.id"; //$NON-NLS-1$ - - public static final String TITLE = Messages.ETypedElementSelectionControl_FlatView; - - /** An OK status, but without the "OK" message, because we don't want "OK" to appear in the status bar */ - private static final IStatus OK_STATUS = new Status(IStatus.OK, Activator.PLUGIN_ID, ""); //$NON-NLS-1$ - - private FilteredTree filteredTree; - protected Collection<? extends ETypedElement> available; - private final int selectionMaxSize; - private final boolean allowEmpty; - private Button rbNoSelection; - private Button rbSelection; - private IStatus validationStatus; - private final IBaseLabelProvider labelProvider; - private final Composite cParent; - private final Collection<? extends EObject> knownEPackage; - - /** Create a tree with a filter text field to select ETypedElements. */ - public ETypedElementSelectionControl(final Composite parentComposite, - final int selectionMaxSize, final boolean allowEmpty, - final Collection<? extends EObject> knownEPackage) { - this.cParent = parentComposite; - this.knownEPackage = knownEPackage; - this.selectionMaxSize = selectionMaxSize; - this.allowEmpty = allowEmpty; - this.labelProvider = IEmfLabelProviderFactory.DEFAULT.createLabelProvider(); - } - - public void createContents() { - final Composite composite = new Composite(this.cParent, SWT.NONE); - composite.setLayout(new GridLayout()); - composite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true)); - - if (this.allowEmpty) { - this.rbNoSelection = new Button(composite, SWT.RADIO); - this.rbNoSelection.setText(Messages.ETypedElementSelectionDialog_radioButtonNoSelection); - this.rbNoSelection.setSelection(true); - this.rbNoSelection.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(final SelectionEvent event) { - final boolean selected = getRadioButtonNoSelection().getSelection(); - setETypedElementSelectionEnabled(!selected); - if (selected) { - setSelection(StructuredSelection.EMPTY); - } - } - }); - this.rbSelection = new Button(composite, SWT.RADIO); - if (this.selectionMaxSize > 1) { - this.rbSelection.setText(Messages.ETypedElementSelectionDialog_radioButtonMultiSelection); - } else { - this.rbSelection.setText(Messages.ETypedElementSelectionDialog_radioButtonSingleSelection); - } - this.rbSelection.setSelection(false); - this.rbSelection.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(final SelectionEvent event) { - final boolean selected = getRadioButtonSelection().getSelection(); - setETypedElementSelectionEnabled(selected); - if (!selected) { - setSelection(StructuredSelection.EMPTY); - } - } - }); - } - - createFilteredTree(composite); - - this.filteredTree.getViewer().addSelectionChangedListener(new ISelectionChangedListener() { - public void selectionChanged(final SelectionChangedEvent event) { - updateValidationStatus(); - } - }); - - if (this.allowEmpty) { - setETypedElementSelectionEnabled(false); - } - - updateValidationStatus(); - } - - public void addOpenListener(final IOpenListener openListener) { - // double-click or enter to choose the selected typed element - this.filteredTree.getViewer().addOpenListener(new IOpenListener() { - public void open(final OpenEvent event) { - // only if the selection is valid - if (!isErrorStatus()) { - openListener.open(event); - } - } - }); - } - - public void addSelectionChangedListener(final ISelectionChangedListener listener) { - this.filteredTree.getViewer().addSelectionChangedListener(listener); - } - - private void createFilteredTree(final Composite parentComposite) { - this.filteredTree = new FilteredTree(parentComposite, selectionStyle(this.selectionMaxSize) | SWT.H_SCROLL | SWT.V_SCROLL - | SWT.BORDER, createPatternFilter(), true); - // allow tooltip for this viewer - ColumnViewerToolTipSupport.enableFor(this.filteredTree.getViewer()); - this.filteredTree.getViewer().setContentProvider(createContentProvider()); - this.filteredTree.getViewer().setLabelProvider(this.labelProvider); - this.filteredTree.getViewer().setFilters(new ViewerFilter[] { this.filteredTree.getPatternFilter() }); - this.filteredTree.getViewer().setComparator(new ViewerComparator()); - } - - protected void updateValidationStatus() { - if (this.filteredTree == null) { - return; - } - - final Status errorElements = new Status(IStatus.ERROR, Activator.PLUGIN_ID, - Messages.ETypedElementSelectionControl_invalidSelectionETypedElementsOnly); - final Status errorSelection = new Status(IStatus.ERROR, Activator.PLUGIN_ID, Messages.ETypedElementSelectionControl_invalidSelection); - - final IStructuredSelection selection = (IStructuredSelection) this.filteredTree.getViewer().getSelection(); - IStatus newStatus = ETypedElementSelectionControl.OK_STATUS; - if (!this.allowEmpty && selection.isEmpty()) { - newStatus = new Status(IStatus.ERROR, Activator.PLUGIN_ID, NLS.bind(Messages.ETypedElementSelectionControl_invalidSelectionAtLeastOneElement, - Integer.valueOf(this.selectionMaxSize))); - } else if (selection.size() > this.selectionMaxSize) { - newStatus = new Status(IStatus.ERROR, Activator.PLUGIN_ID, NLS.bind(Messages.ETypedElementSelectionControl_invalidSelectionAtMostXElements, - Integer.valueOf(this.selectionMaxSize))); - } else { - final Iterator<?> iterator = selection.iterator(); - while (iterator.hasNext()) { - final Object selectedElement = iterator.next(); - if (!(selectedElement instanceof ETypedElement)) { - newStatus = errorElements; - break; - } - } - } - setValidationStatus(newStatus); - } - - protected void setValidationStatus(final IStatus status) { - this.validationStatus = status; - } - - public IStatus getValidationStatus() { - return this.validationStatus; - } - - public boolean isErrorStatus() { - return this.validationStatus == null || this.validationStatus.getSeverity() >= IStatus.ERROR; - } - - public void setAvailableETypedElements(final Collection<? extends ETypedElement> newAvailable) { - this.available = newAvailable; - final Set<EObject> containers = new HashSet<EObject>(); - for (final ETypedElement eTypedElement : newAvailable) { - final EObject container = getTopmostContainer(eTypedElement); - if (container != null && containsETypedElement(container)) { - containers.add(container); - } - } - for (EObject eObject : this.knownEPackage) { - if (containsETypedElement(eObject)) { - containers.add(eObject); - } - } - setInput(containers); - } - - protected static EObject getTopmostContainer(final EObject eObject) { - EObject container = eObject.eContainer(); - EObject result = container; - while (container != null) { - result = container; - container = container.eContainer(); - } - return result; - } - - public List<ETypedElement> getSelectedETypedElements() { - final List<ETypedElement> currentlySelected = new ArrayList<ETypedElement>(); - if (this.filteredTree.isDisposed()) { - throw new IllegalStateException("Cannot get the selection since the viewer is disposed."); //$NON-NLS-1$ - } - final IStructuredSelection selection = (IStructuredSelection) this.filteredTree.getViewer() - .getSelection(); - final Iterator<?> iterator = selection.iterator(); - while (iterator.hasNext()) { - final Object element = iterator.next(); - if (element instanceof ETypedElement) { - final ETypedElement eTypedElement = (ETypedElement) element; - currentlySelected.add(eTypedElement); - } - } - return currentlySelected; - } - - public void setSelectedETypedElements(final Collection<? extends ETypedElement> newSelection) { - if (newSelection == null) { - throw new IllegalArgumentException(); - } - final List<ETypedElement> filteredSelection = new ArrayList<ETypedElement>(); - filteredSelection.addAll(newSelection); - // only keep available elements - filteredSelection.retainAll(this.available); - setSelection(new StructuredSelection(filteredSelection)); - } - - public void setSelection(final IStructuredSelection selection) { - setETypedElementSelectionEnabled(!selection.isEmpty()); - this.filteredTree.getViewer().setSelection(selection); - updateValidationStatus(); - } - - protected void setETypedElementSelectionEnabled(final boolean enabled) { - getRadioButtonNoSelection().setSelection(!enabled); - getRadioButtonSelection().setSelection(enabled); - this.filteredTree.getViewer().getTree().setEnabled(enabled); - this.filteredTree.getFilterControl().setEnabled(enabled); - } - - public void setInput(final Collection<? extends EObject> containers) { - this.filteredTree.getViewer().setInput(containers); - } - - // @SuppressWarnings("unchecked") : this is the input type - @SuppressWarnings("unchecked") - public Collection<? extends EObject> getInput() { - return (Collection<? extends EObject>) this.filteredTree.getViewer().getInput(); - } - - protected IContentProvider createContentProvider() { - return new ETypedElementSelectionControlContentProvider(new IFilter<EObject>() { - public boolean filter(final EObject eObject) { - return filterChild(eObject); - } - }); - } - - protected boolean filterChild(final EObject eObject) { - boolean selected; - if (containsETypedElement(eObject)) { - selected = true; - } else if (eObject instanceof ETypedElement) { - selected = isAvailable(eObject); - } else { - selected = false; - } - return selected; - } - - protected boolean isAvailable(final EObject eObject) { - return this.available.contains(eObject); - } - - protected boolean containsETypedElement(final EObject eObject) { - boolean result = false; - final TreeIterator<EObject> eAllContents = eObject.eAllContents(); - while (eAllContents.hasNext()) { - final EObject element = eAllContents.next(); - if (element instanceof ETypedElement) { - final ETypedElement typedElement = (ETypedElement) element; - if (isAvailable(typedElement)) { - result = true; - break; - } - } else { - result = containsETypedElement(element); - if (result) { - break; - } - } - } - return result; - } - - private static int selectionStyle(final int selectionMaxSize) { - int selectionStyle; - if (selectionMaxSize > 1) { - selectionStyle = SWT.MULTI; - } else { - selectionStyle = SWT.SINGLE; - } - return selectionStyle; - } - - private static PatternFilter createPatternFilter() { - return new PatternFilter() { - @Override - protected boolean isLeafMatch(final Viewer viewer, final Object element) { - final String labelText = ((ILabelProvider) ((StructuredViewer) viewer).getLabelProvider()) - .getText(element); - - if (labelText == null) { - return false; - } - return wordMatches(labelText) || parentMatches(viewer, element); - } - - private boolean parentMatches(final Viewer viewer, final Object element) { - final ITreeContentProvider contentProvider = (ITreeContentProvider) ((StructuredViewer) viewer) - .getContentProvider(); - final Object parent = contentProvider.getParent(element); - if (parent == null) { - return false; - } - return isLeafMatch(viewer, parent); - } - }; - } - - public IStructuredSelection getSelection() { - return (IStructuredSelection) this.filteredTree.getViewer().getSelection(); - } - - protected Button getRadioButtonNoSelection() { - return this.rbNoSelection; - } - - protected Button getRadioButtonSelection() { - return this.rbSelection; - } - - public FilteredTree getFilteredTree() { - return this.filteredTree; - } - - public boolean isDisposed() { - return this.filteredTree.isDisposed(); - } - - public String getTitle() { - return ETypedElementSelectionControl.TITLE; - } - - public String getToolTipText() { - return getTitle(); - } - - public Image getImage() { - return ImageProvider.getInstance().getFlatViewIcon(); - } - - public String getTabId() { - return ETypedElementSelectionControl.TAB_ID; - } - - public Collection<? extends EObject> getKnownEPackage() { - return this.knownEPackage; - } -}
diff --git a/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/emf/facet/efacet/ui/internal/widget/ETypedElementSelectionControlContentProvider.java b/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/emf/facet/efacet/ui/internal/widget/ETypedElementSelectionControlContentProvider.java deleted file mode 100644 index 08a2d76..0000000 --- a/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/emf/facet/efacet/ui/internal/widget/ETypedElementSelectionControlContentProvider.java +++ /dev/null
@@ -1,99 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2012 CEA LIST. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Nicolas Bros (Mia-Software) - Bug 370806 - [table] rewrite the "allowed contents" query selection dialog for v0.2 - * Gregoire Dupe (Mia-Software) - Bug 372626 - Aggregates - *******************************************************************************/ -package org.eclipse.emf.facet.efacet.ui.internal.widget; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.List; - -import org.eclipse.emf.common.util.EList; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.facet.util.core.internal.exported.IFilter; -import org.eclipse.jface.viewers.ITreeContentProvider; -import org.eclipse.jface.viewers.Viewer; - -public class ETypedElementSelectionControlContentProvider implements ITreeContentProvider { - - private final IFilter<EObject> childrenFilter; - - public ETypedElementSelectionControlContentProvider(final IFilter<EObject> childrenFilter) { - this.childrenFilter = childrenFilter; - } - - private Object input; - - public Object[] getElements(final Object inputElement) { - // @SuppressWarnings("unchecked") : this is the type setInput accepts - @SuppressWarnings("unchecked") - final Collection<? extends EObject> containers = (Collection<? extends EObject>) inputElement; - return containers.toArray(); - } - - public Object[] getChildren(final Object parentElement) { - Object[] children; - if (parentElement instanceof EObject) { - final EObject container = (EObject) parentElement; - final List<EObject> filteredChildren = computeFilteredChildren(container); - children = filteredChildren.toArray(); - } else { - children = new Object[0]; - } - return children; - } - - public Object getParent(final Object element) { - Object parent = null; - if (element instanceof EObject) { - parent = ((EObject) element).eContainer(); - } - return parent; - } - - // @SuppressWarnings("unchecked") : the input type is checked by setInput - @SuppressWarnings("unchecked") - public boolean hasChildren(final Object element) { - boolean result; - final Collection<? extends EObject> rootElements = (Collection<? extends EObject>) this.input; - if (rootElements.contains(element)) { - // avoid computing all the children of all the top-level elements - // since this could be very expensive - result = true; - } else if (element instanceof EObject) { - result = getChildren(element).length > 0; - } else { - result = false; - } - return result; - } - - public void inputChanged(final Viewer viewer, final Object oldInput, - final Object newInput) { - this.input = newInput; - } - - public void dispose() { - // nothing - } - - protected List<EObject> computeFilteredChildren(final EObject parentEObject) { - final List<EObject> children = new ArrayList<EObject>(); - final EList<EObject> eContents = parentEObject.eContents(); - children.addAll(eContents); - final List<EObject> filteredChildren = new ArrayList<EObject>(); - for (final EObject eObject : children) { - if (this.childrenFilter.filter(eObject)) { - filteredChildren.add(eObject); - } - } - return filteredChildren; - } -} \ No newline at end of file
diff --git a/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/emf/facet/efacet/ui/internal/widget/ETypedElementSelectionControlManager.java b/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/emf/facet/efacet/ui/internal/widget/ETypedElementSelectionControlManager.java deleted file mode 100644 index 3487fcb..0000000 --- a/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/emf/facet/efacet/ui/internal/widget/ETypedElementSelectionControlManager.java +++ /dev/null
@@ -1,215 +0,0 @@ -/** - * Copyright (c) 2012, 2015 CEA-LIST, and Mia-Software. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Vincent Lorenzo (CEA-LIST) - Bug 357621 - Improve the label displayed for Customization and Facets - * Gregoire Dupe (Mia-Software) - Bug 357621 - Improve the label displayed for Customization and Facets - * Gregoire Dupe (Mia-Software) - Bug 372626 - Aggregates - * Nicolas Bros (Mia-Software) - Bug 370806 - [table] rewrite the "allowed contents" query selection dialog for v0.2 - * Thomas Cicognani (Mia-Software) - Bug 472075 - Update API to create UI shortcuts to activate FacetSets - */ -package org.eclipse.emf.facet.efacet.ui.internal.widget; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import org.eclipse.core.runtime.IStatus; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.ETypedElement; -import org.eclipse.emf.facet.efacet.ui.internal.Activator; -import org.eclipse.emf.facet.efacet.ui.internal.preferences.PreferenceConstants; -import org.eclipse.jface.preference.IPreferenceStore; -import org.eclipse.jface.viewers.IOpenListener; -import org.eclipse.jface.viewers.ISelectionChangedListener; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.jface.viewers.StructuredSelection; -import org.eclipse.swt.SWT; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.layout.GridLayout; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.TabFolder; -import org.eclipse.swt.widgets.TabItem; -import org.eclipse.ui.dialogs.FilteredTree; - -public class ETypedElementSelectionControlManager implements - IETypedElementSelectionControlManager { - - // this map does the link between the tabItem and the filtered trees - private final Map<TabItem, IETypedElementTabSelectionWidgetInternal> trees; - private TabFolder tabFolder; - private final Composite parentComposite; - private final int selectionMaxSize; - - /** - * true if empty selection is allowed - */ - private final boolean emptySelection; - private Collection<? extends ETypedElement> availableElements; - private final Collection<? extends EObject> knownEPackage; - - public ETypedElementSelectionControlManager( - final Composite parentComposite, final int selectionMaxSize, - final boolean emptySelection, - final Collection<? extends EObject> knownEPackage) { - - this.trees = new HashMap<TabItem, IETypedElementTabSelectionWidgetInternal>(); - this.parentComposite = parentComposite; - this.selectionMaxSize = selectionMaxSize; - this.emptySelection = emptySelection; - this.knownEPackage = knownEPackage; - } - - private static Composite createComposite(final Composite parent) { - final Composite composite = new Composite(parent, SWT.NONE); - final GridLayout layout = new GridLayout(); - composite.setLayout(layout); - composite.setLayoutData(new GridData(GridData.FILL_BOTH)); - return composite; - } - - private void init() { - this.tabFolder = new TabFolder(this.parentComposite, SWT.TOP); - this.tabFolder.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, - true)); - - // we create the flat tree - final TabItem flatItem = new TabItem(this.tabFolder, SWT.NONE); - - final Composite flatComposite = createComposite(this.tabFolder); - IETypedElementTabSelectionWidgetInternal filteredTree = new ETypedElementSelectionControl( - flatComposite, this.selectionMaxSize, this.emptySelection, - this.knownEPackage); - flatItem.setText(filteredTree.getTitle()); - flatItem.setToolTipText(filteredTree.getToolTipText()); - flatItem.setImage(filteredTree.getImage()); - this.trees.put(flatItem, filteredTree); - flatItem.setControl(flatComposite); - // we create the sortedTabItem - final TabItem sortedItem = new TabItem(this.tabFolder, SWT.NONE); - final Composite sortedComposite = createComposite(this.tabFolder); - filteredTree = new ETypedElementSelectionSortedControl(sortedComposite, - this.selectionMaxSize, this.emptySelection, this.knownEPackage); - sortedItem.setText(filteredTree.getTitle()); - sortedItem.setToolTipText(filteredTree.getToolTipText()); - sortedItem.setImage(filteredTree.getImage()); - sortedItem.setControl(sortedComposite); - this.trees.put(sortedItem, filteredTree); - initSelectedTabItem(); - } - - private IETypedElementTabSelectionWidgetInternal getActiveTree() { - // selectionIndex: Index of the selected tab - final int selectionIndex = this.tabFolder.getSelectionIndex(); - final TabItem currentTabItem = this.tabFolder - .getItem(selectionIndex); - return this.trees.get(currentTabItem); - } - - public void addOpenListener(final IOpenListener openListener) { - for (IETypedElementSelectionWidgetInternal tree : this.trees.values()) { - tree.addOpenListener(openListener); - } - } - - public void addSelectionChangedListener( - final ISelectionChangedListener listener) { - for (IETypedElementSelectionWidgetInternal tree : this.trees.values()) { - tree.addSelectionChangedListener(listener); - } - } - - /** - * Set the focus on the last selected TabItem - */ - private void initSelectedTabItem() { - final IPreferenceStore store = Activator.getDefault() - .getPreferenceStore(); - final String value = store - .getString(PreferenceConstants.TE_SELECTION_TAB); - for (TabItem item : this.tabFolder.getItems()) { - if (item.getText().equals(value)) { - this.tabFolder.setSelection(item); - return; - } - } - } - - public IStatus getValidationStatus() { - return getActiveTree().getValidationStatus(); - } - - public void setAvailableETypedElements( - final Collection<? extends ETypedElement> availableTE) { - this.availableElements = availableTE; - for (IETypedElementSelectionWidgetInternal current : this.trees - .values()) { - current.setAvailableETypedElements(availableTE); - } - } - - public List<ETypedElement> getSelectedETypedElements() { - return getActiveTree().getSelectedETypedElements(); - } - - private void updatePreferenceValue() { - final IPreferenceStore store = Activator.getDefault() - .getPreferenceStore(); - final String value = getActiveTree().getTitle(); - store.setValue( - PreferenceConstants.TE_SELECTION_TAB, - value); - } - - public void setSelectedETypedElements( - final Collection<? extends ETypedElement> newSelection) { - if (newSelection == null) { - throw new IllegalArgumentException(); - } - // only select elements that match the filter - final List<ETypedElement> filteredSelection = new ArrayList<ETypedElement>(); - for (ETypedElement typedElement : newSelection) { - if (this.availableElements.contains(typedElement)) { - filteredSelection.add(typedElement); - } - } - setSelection(new StructuredSelection(filteredSelection)); - } - - public void setSelection(final IStructuredSelection selection) { - for (IETypedElementSelectionWidgetInternal filteredTree : this.trees - .values()) { - filteredTree.setSelection(selection); - } - } - - public List<ETypedElement> computeResult() { - // we save the last visible item : - updatePreferenceValue(); - return getActiveTree().getSelectedETypedElements(); - } - - public boolean isDisposed() { - return this.tabFolder == null || this.tabFolder.isDisposed() || getActiveTree().isDisposed(); - } - - public FilteredTree getFilteredTree() { - return getActiveTree().getFilteredTree(); - } - - public void createContents() { - init(); - for (IETypedElementSelectionWidgetInternal current : this.trees - .values()) { - current.createContents(); - } - } - -} \ No newline at end of file
diff --git a/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/emf/facet/efacet/ui/internal/widget/ETypedElementSelectionSortedControl.java b/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/emf/facet/efacet/ui/internal/widget/ETypedElementSelectionSortedControl.java deleted file mode 100644 index fb1ee2b..0000000 --- a/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/emf/facet/efacet/ui/internal/widget/ETypedElementSelectionSortedControl.java +++ /dev/null
@@ -1,204 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2012, 2015 CEA-LIST, and Mia-Software. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Vincent Lorenzo (CEA-LIST) - Bug 357621 - Improve the label displayed for Customization and Facets - * Gregoire Dupe (Mia-Software) - Bug 373078 - API Cleaning - * Gregoire Dupe (Mia-Software) - Bug 375087 - [Table] ITableWidget.addColumn(List<ETypedElement>, List<FacetSet>) - * Gregoire Dupe (Mia-Software) - Bug 372626 - Aggregates - * Vincent Lorenzo (CEA-LIST) - Bug 357621 - Improve the label displayed for Customization and Facets - * Thomas Cicognani (Mia-Software) - Bug 472075 - Update API to create UI shortcuts to activate FacetSets - *******************************************************************************/ -package org.eclipse.emf.facet.efacet.ui.internal.widget; - -import java.util.Collection; -import java.util.HashMap; -import java.util.HashSet; -import java.util.Map; -import java.util.Set; - -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.EPackage; -import org.eclipse.emf.ecore.ETypedElement; -import org.eclipse.emf.facet.efacet.core.FacetUtils; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.FacetSet; -import org.eclipse.emf.facet.efacet.ui.internal.Activator; -import org.eclipse.emf.facet.efacet.ui.internal.Messages; -import org.eclipse.emf.facet.efacet.ui.internal.utils.ImageProvider; -import org.eclipse.emf.facet.util.core.Logger; -import org.eclipse.emf.facet.util.core.internal.exported.IFilter; -import org.eclipse.jface.viewers.IContentProvider; -import org.eclipse.osgi.util.NLS; -import org.eclipse.swt.graphics.Image; -import org.eclipse.swt.widgets.Composite; - -/** - * A control that displays a tree of ETypedElements under a list of containers - * (EPackages for example), with a filter text field. - * - * the result should be : Ecore - FacetSet/Custom/... UML - FacetSet/Custom/... - * Aggregate - FacetSet/Custom/... - */ -public class ETypedElementSelectionSortedControl extends - ETypedElementSelectionControl { - - /** this groupByMap is used to define the input of the treeviewer */ - private final Map<EPackage, Set<EObject>> groupByMap; - - /** the name of the tabs */ - private static final String NAME = Messages.ETypedElementSelectionSortedControl_groupByMetamodelView; - - public static final String GROUPED_TAB_ID = "group.by.metamodel.view.id"; //$NON-NLS-1$ - - public static final String TOOLTIP = Messages.ETypedElementSelectionSortedControl_toolTip; - - /** - * - * @param parentComposite - * @param selectionMaxSize - * @param allowEmptySelection - * @param customizationMgr - */ - public ETypedElementSelectionSortedControl(final Composite parentComposite, - final int selectionMaxSize, final boolean allowEmpty, - final Collection<? extends EObject> knownEPackage) { - super(parentComposite, selectionMaxSize, allowEmpty, knownEPackage); - this.groupByMap = new HashMap<EPackage, Set<EObject>>(); - } - - @Override - public void setAvailableETypedElements( - final Collection<? extends ETypedElement> newAvailable) { - this.available = newAvailable; - prepareInput(); - setInput(this.groupByMap.keySet()); - } - - /** - * this method is used to organize the input - */ - private void prepareInput() { - if (this.available != null) { - for (ETypedElement eTypedElement : this.available) { - final EObject container = getTopmostContainer(eTypedElement); - if (container != null && containsETypedElement(container)) { - addContainer(container); - } - } - } - for (EObject current : getKnownEPackage()) { - if (containsETypedElement(current)) { - addContainer(current); - } - } - } - - - /** - * Add a container to the groupByMap - * - * @param container - * a container to add - */ - private void addContainer(final EObject container) { - if (container instanceof FacetSet) { //we show only FacetSet in this view - final FacetSet facetSet = (FacetSet) container; - final Set<EPackage> packs = FacetUtils - .getAllExtendedEPackage(facetSet); - if (packs.isEmpty()) { - Logger.logError(NLS.bind("Package not found: {0}", //$NON-NLS-1$ - container), Activator.getDefault()); - } - for (EPackage current : packs) { - getValues(current).add(container); - } - } - } - - /** - * - * @param pack - * an EPackage - * @return the values associated to the EPackage - */ - private Collection<EObject> getValues(final EPackage pack) { - if (!this.groupByMap.containsKey(pack)) { - final Set<EObject> values = new HashSet<EObject>(); - this.groupByMap.put(pack, values); - } - return this.groupByMap.get(pack); - } - - @Override - protected IContentProvider createContentProvider() { - return new SortedContentProvider(new IFilter<EObject>() { - public boolean filter(final EObject eObject) { - return filterChild(eObject); - } - }); - } - - @Override - public String getTitle() { - return ETypedElementSelectionSortedControl.NAME; - } - - @Override - public Image getImage() { - return ImageProvider.getInstance().getTreeViewIcon(); - } - - @Override - public String getToolTipText() { - return ETypedElementSelectionSortedControl.TOOLTIP; - } - - @Override - public String getTabId() { - return ETypedElementSelectionSortedControl.GROUPED_TAB_ID; - } - - public Set<EObject> getChlidren(final Object parentElement) { - return this.groupByMap - .get(parentElement); - } - - private class SortedContentProvider extends - ETypedElementSelectionControlContentProvider { - - public SortedContentProvider(final IFilter<EObject> childrenFilter) { - super(childrenFilter); - } - - @Override - public Object[] getChildren(final Object parentElement) { - Object[] children; - final Set<EObject> list = ETypedElementSelectionSortedControl.this - .getChlidren(parentElement); - if (list == null) { - children = super.getChildren(parentElement); - } else { - children = list.toArray(); - } - return children; - } - - @Override - public Object getParent(final Object element) { - Object parent = super.getParent(element); - if (parent == null && element instanceof FacetSet) { - final Set<EPackage> packs = FacetUtils - .getAllExtendedEPackage((FacetSet) element); - if (!packs.isEmpty()) { - parent = packs.iterator().next(); - } - } - return parent; - } - - } -}
diff --git a/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/emf/facet/efacet/ui/internal/widget/ETypedElementSelectionWidgetFactory.java b/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/emf/facet/efacet/ui/internal/widget/ETypedElementSelectionWidgetFactory.java deleted file mode 100644 index 7c42a3e..0000000 --- a/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/emf/facet/efacet/ui/internal/widget/ETypedElementSelectionWidgetFactory.java +++ /dev/null
@@ -1,44 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2012, 2015 Mia-Software, and CEA-LIST. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Nicolas Bros (Mia-Software) - Bug 370806 - [table] rewrite the "allowed contents" query selection dialog for v0.2 - * Vincent Lorenzo (CEA-LIST) - Bug 372644 - Create Customizable tooltips for the TreeViewer using a CustomizableLabelProvider - * Gregoire Dupe (Mia-Software) - Bug 372626 - Aggregates - * Thomas Cicognani (Mia-Software) - Bug 472075 - Update API to create UI shortcuts to activate FacetSets - *******************************************************************************/ -package org.eclipse.emf.facet.efacet.ui.internal.widget; - -import java.util.Collection; - -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.facet.custom.core.ICustomizationManager; -import org.eclipse.emf.facet.efacet.ui.internal.exported.widget.IETypedElementSelectionWidget; -import org.eclipse.emf.facet.efacet.ui.internal.exported.widget.IETypedElementSelectionWidgetFactory; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Display; - -public class ETypedElementSelectionWidgetFactory implements IETypedElementSelectionWidgetFactory { - - public IETypedElementSelectionWidget createETypedElementSelectionWidget( - final int selectionMaxSize, final boolean allowEmpty, - final Composite parentComposite, - final ICustomizationManager customManager, - final Collection<? extends EObject> knownEPackage) { - final ETypedElementSelectionControlManager[] control = new ETypedElementSelectionControlManager[1]; - // must be synchronous, otherwise the shell is not created before SynchronizedETypedElementSelectionWidget, and SynchronizedComposite throws a NPE - Display.getDefault().syncExec(new Runnable() { - public void run() { - control[0] = new ETypedElementSelectionControlManager( - parentComposite, selectionMaxSize, allowEmpty, - knownEPackage); - control[0].createContents(); - } - }); - return new SynchronizedETypedElementSelectionWidget(control[0]); - } -}
diff --git a/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/emf/facet/efacet/ui/internal/widget/FacetSetSelectionControl.java b/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/emf/facet/efacet/ui/internal/widget/FacetSetSelectionControl.java deleted file mode 100644 index 876b61b..0000000 --- a/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/emf/facet/efacet/ui/internal/widget/FacetSetSelectionControl.java +++ /dev/null
@@ -1,333 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2012 CEA LIST. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Nicolas Bros (Mia-Software) - Bug 372865 - FacetSet selection dialog - * Gregoire Dupe (Mia-Software) - Bug 372626 - Aggregates - * Nicolas Bros (Mia-Software) - Bug 372626 - Aggregates - *******************************************************************************/ -package org.eclipse.emf.facet.efacet.ui.internal.widget; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.Collections; -import java.util.HashSet; -import java.util.Iterator; -import java.util.List; -import java.util.Set; - -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.Status; -import org.eclipse.emf.ecore.ENamedElement; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.EPackage; -import org.eclipse.emf.facet.efacet.core.internal.exported.IResolverManager; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.FacetSet; -import org.eclipse.emf.facet.efacet.ui.internal.Activator; -import org.eclipse.emf.facet.efacet.ui.internal.Messages; -import org.eclipse.emf.facet.efacet.ui.internal.dialogs.FacetSetTreeContentProvider; -import org.eclipse.emf.facet.efacet.ui.internal.exported.widget.IFacetSetSelectionWidget; -import org.eclipse.emf.facet.util.emf.ui.internal.utils.ImageUtils; -import org.eclipse.jface.viewers.CheckStateChangedEvent; -import org.eclipse.jface.viewers.CheckboxTreeViewer; -import org.eclipse.jface.viewers.ICheckStateListener; -import org.eclipse.jface.viewers.ICheckStateProvider; -import org.eclipse.jface.viewers.IContentProvider; -import org.eclipse.jface.viewers.ILabelProvider; -import org.eclipse.jface.viewers.LabelProvider; -import org.eclipse.osgi.util.NLS; -import org.eclipse.swt.SWT; -import org.eclipse.swt.graphics.Image; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.layout.GridLayout; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Control; - -/** A control that displays a tree of FacetSets with checkboxes to select them. */ -public class FacetSetSelectionControl implements IFacetSetSelectionWidget { - - /** An OK status, but without the "OK" message, because we don't want "OK" to appear in the status bar */ - protected static final IStatus OK_STATUS = new Status(IStatus.OK, Activator.PLUGIN_ID, ""); //$NON-NLS-1$ - protected static final String INVALID_ELEMENTS = Messages.FacetSetSelectionControl_selectionContainsInvalidElements; - protected static final String ONLY_FACET_SETS = Messages.FacetSetSelectionControl_onlyFacetSetsAllowedInSelection; - - private final Composite cParent; - private CheckboxTreeViewer treeViewer; - private Collection<? extends FacetSet> available; - - private final int selectionMaxSize; - private final boolean allowEmpty; - private IStatus validationStatus; - private final Runnable onChange; - private final Set<FacetSet> selected = new HashSet<FacetSet>(); - - /** Create a checkbox tree to select FacetSets. */ - public FacetSetSelectionControl(final Composite parentComposite, final int selectionMaxSize, final boolean allowEmpty, final Runnable onChange) { - this.cParent = parentComposite; - this.selectionMaxSize = selectionMaxSize; - this.allowEmpty = allowEmpty; - this.onChange = onChange; - } - - public void createContents() { - final Composite composite = new Composite(this.cParent, SWT.NONE); - composite.setLayout(new GridLayout()); - composite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true)); - createCheckboxTreeViewer(composite); - updateValidationStatus(); - } - - protected void notifyChanged() { - if (this.onChange != null) { - this.onChange.run(); - } - } - - public void setAvailableFacetSets(final Collection<? extends FacetSet> newAvailable) { - this.available = newAvailable; - this.treeViewer.setInput(newAvailable.toArray()); - updateValidationStatus(); - notifyChanged(); - } - - public Collection<? extends FacetSet> getAvailableFacetSets() { - return Collections.unmodifiableCollection(this.available); - } - - public List<FacetSet> getSelectedFacetSets() { - return Collections.unmodifiableList(new ArrayList<FacetSet>(this.selected)); - } - - public void setSelectedFacetSets(final Collection<? extends FacetSet> facetSetsToSelect) { - if (facetSetsToSelect == null) { - throw new IllegalArgumentException(); - } - this.selected.clear(); - this.selected.addAll(facetSetsToSelect); - updateValidationStatus(); - notifyChanged(); - this.treeViewer.refresh(); - } - - public final void addCheckStateListener(final ICheckStateListener listener) { - this.treeViewer.addCheckStateListener(listener); - } - - protected void createCheckboxTreeViewer(final Composite parentComposite) { - this.treeViewer = new CheckboxTreeViewer(parentComposite, SWT.BORDER); - this.treeViewer.setContentProvider(createContentProvider()); - this.treeViewer.setLabelProvider(createLabelProvider()); - this.treeViewer.getTree().setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true)); - - getTreeViewer().setCheckStateProvider(createCheckStateProvider()); - addCheckStateListener(new ICheckStateListener() { - public void checkStateChanged(final CheckStateChangedEvent event) { - FacetSetSelectionControl.this.checkStateChanged(event); - } - }); - getTreeViewer().refresh(); - } - - protected void checkStateChanged(final CheckStateChangedEvent event) { - handleCheckStateChange(event); - getTreeViewer().refresh(); - updateValidationStatus(); - notifyChanged(); - } - - protected void handleCheckStateChange(final CheckStateChangedEvent event) { - final Object element = event.getElement(); - if (event.getElement() instanceof FacetSet) { - final FacetSet facetSet = (FacetSet) event.getElement(); - FacetSet propagation = IResolverManager.DEFAULT - .selectionRoot(element, FacetSet.class); - if (propagation == null) { - propagation = facetSet; - } - if (event.getChecked()) { - this.selected.add(propagation); - } else { - this.selected.remove(propagation); - } - } - this.treeViewer.refresh(); - } - - protected boolean isUnderCheckedSuperPackage(final Object element) { - boolean result = false; - if (element instanceof FacetSet) { - final FacetSet facetSet = (FacetSet) element; - EObject eSuperPackage = facetSet.eContainer(); - while (eSuperPackage != null) { - if (this.selected.contains(eSuperPackage)) { - result = true; - break; - } - eSuperPackage = eSuperPackage.eContainer(); - } - } - return result; - } - - protected ICheckStateProvider createCheckStateProvider() { - return new ICheckStateProvider() { - public boolean isGrayed(final Object element) { - return FacetSetSelectionControl.this.isGrayed(element); - } - - public boolean isChecked(final Object element) { - return FacetSetSelectionControl.this.isChecked(element); - } - }; - } - - protected boolean isGrayed(final Object element) { - final List<FacetSet> propagation = IResolverManager.DEFAULT - .selectionPropagation(element, FacetSet.class); - boolean contains = false; - if (element instanceof EObject) { - final EObject eObject = (EObject) element; - contains = containsSelectedElement(eObject); - } - return (contains || isUnderCheckedSuperPackage(element) || propagation - .contains(element)) && !this.selected.contains(element); - } - - protected boolean containsSelectedElement(final EObject eObject) { - boolean contains = false; - final Iterator<EObject> iterator = eObject.eAllContents(); - while (iterator.hasNext()) { - final EObject subObject = iterator.next(); - contains = this.selected.contains(subObject); - if (contains) { - break; - } - } - return contains; - } - - protected boolean isChecked(final Object element) { - // This "|| isGrayed(element)" has been added avoid problems with - // Windows 7. - return this.selected.contains(element) || isGrayed(element); - } - - protected void updateValidationStatus() { - if (this.treeViewer == null) { - return; - } - final Object[] checkedElements = this.treeViewer.getCheckedElements(); - IStatus newStatus = FacetSetSelectionControl.OK_STATUS; - if (!this.allowEmpty && checkedElements.length == 0) { - newStatus = new Status(IStatus.ERROR, Activator.PLUGIN_ID, NLS.bind(Messages.FacetSetSelectionControl_mustSelectAtLeastOneElement, - Integer.valueOf(this.selectionMaxSize))); - } else if (checkedElements.length > this.selectionMaxSize) { - newStatus = new Status(IStatus.ERROR, Activator.PLUGIN_ID, NLS.bind(Messages.FacetSetSelectionControl_mustSelectAtMostNElements, - Integer.valueOf(this.selectionMaxSize))); - } else { - for (final Object checkedElement : checkedElements) { - final IStatus elementStatus = validateElement(checkedElement); - if (elementStatus.getSeverity() >= IStatus.ERROR) { - newStatus = elementStatus; - break; - } - } - } - setValidationStatus(newStatus); - } - - protected static IStatus validateElement(final Object checkedElement) { - IStatus status = FacetSetSelectionControl.OK_STATUS; - if (!(checkedElement instanceof FacetSet)) { - status = new Status(IStatus.ERROR, Activator.PLUGIN_ID, FacetSetSelectionControl.ONLY_FACET_SETS); - } - return status; - } - - protected boolean isAvailable(final FacetSet facetSet) { - boolean bAvailable = false; - if (this.available.contains(facetSet)) { - bAvailable = true; - } else { - EPackage parent = facetSet.getESuperPackage(); - while (parent != null) { - if (this.available.contains(parent)) { - bAvailable = true; - break; - } - parent = parent.getESuperPackage(); - } - } - return bAvailable; - } - - protected void setValidationStatus(final IStatus status) { - this.validationStatus = status; - } - - public IStatus getValidationStatus() { - return this.validationStatus; - } - - public boolean isErrorStatus() { - return this.validationStatus == null || this.validationStatus.getSeverity() >= IStatus.ERROR; - } - - protected ILabelProvider createLabelProvider() { - return new LabelProvider() { - @Override - public String getText(final Object element) { - String text; - if (element instanceof ENamedElement) { - final ENamedElement namedElement = (ENamedElement) element; - text = namedElement.getName(); - } else { - text = super.getText(element); - } - return text; - } - - @Override - public Image getImage(final Object element) { - return ImageUtils.getImage(element); - } - }; - } - - // @SuppressWarnings("static-method") : meant to be overridden - @SuppressWarnings("static-method") - protected IContentProvider createContentProvider() { - return new FacetSetTreeContentProvider(false, true, true); - } - - public CheckboxTreeViewer getTreeViewer() { - return this.treeViewer; - } - - public boolean isDisposed() { - return this.treeViewer.getTree().isDisposed(); - } - - public void selectAll() { - this.selected.clear(); - this.selected.addAll(this.available); - this.treeViewer.refresh(); - } - - public void deselectAll() { - this.selected.clear(); - this.treeViewer.refresh(); - } - - public Control getControl() { - Control control = null; - if (this.treeViewer != null) { - control = this.treeViewer.getTree(); - } - return control; - } -}
diff --git a/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/emf/facet/efacet/ui/internal/widget/FacetSetSelectionWidgetFactory.java b/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/emf/facet/efacet/ui/internal/widget/FacetSetSelectionWidgetFactory.java deleted file mode 100644 index 1950fb7..0000000 --- a/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/emf/facet/efacet/ui/internal/widget/FacetSetSelectionWidgetFactory.java +++ /dev/null
@@ -1,33 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2012 CEA LIST. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Nicolas Bros (Mia-Software) - Bug 372865 - FacetSet selection dialog - *******************************************************************************/ -package org.eclipse.emf.facet.efacet.ui.internal.widget; - -import org.eclipse.emf.facet.efacet.ui.internal.exported.widget.IFacetSetSelectionWidget; -import org.eclipse.emf.facet.efacet.ui.internal.exported.widget.IFacetSetSelectionWidgetFactory; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Display; - -public class FacetSetSelectionWidgetFactory implements IFacetSetSelectionWidgetFactory { - - public IFacetSetSelectionWidget createFacetSetSelectionWidget(final int selectionMaxSize, final boolean allowEmpty, - final Composite parentComposite, final Runnable onChange) { - final FacetSetSelectionControl[] control = new FacetSetSelectionControl[1]; - // must be synchronous, otherwise the shell is not created before SynchronizedFacetSetSelectionWidget, and - // SynchronizedComposite throws a NPE - Display.getDefault().syncExec(new Runnable() { - public void run() { - control[0] = new FacetSetSelectionControl(parentComposite, selectionMaxSize, allowEmpty, onChange); - control[0].createContents(); - } - }); - return new SynchronizedFacetSetSelectionWidget(control[0]); - } -}
diff --git a/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/emf/facet/efacet/ui/internal/widget/IETypedElementSelectionControlManager.java b/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/emf/facet/efacet/ui/internal/widget/IETypedElementSelectionControlManager.java deleted file mode 100644 index 31aabee..0000000 --- a/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/emf/facet/efacet/ui/internal/widget/IETypedElementSelectionControlManager.java +++ /dev/null
@@ -1,51 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2012 CEA-LIST. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Vincent Lorenzo (CEA-LIST) - Bug 372644 - Create Customizable tooltips for the TreeViewer using a CustomizableLabelProvider - * Gregoire Dupe (Mia-Software) - Bug 372644 - Create Customizable tooltips for the TreeViewer using a CustomizableLabelProvider - *******************************************************************************/ -package org.eclipse.emf.facet.efacet.ui.internal.widget; - -import java.util.Collection; -import java.util.List; - -import org.eclipse.core.runtime.IStatus; -import org.eclipse.emf.ecore.ETypedElement; -import org.eclipse.jface.viewers.IStructuredSelection; - -public interface IETypedElementSelectionControlManager extends - IETypedElementSelectionWidgetInternal { - - /** - * @return the validation status - */ - IStatus getValidationStatus(); - - /** - * Set the available elements - * - * @param eTypedElements - * available eTypedElements - */ - void setAvailableETypedElements( - Collection<? extends ETypedElement> eTypedElements); - - /** - * - * @param selection - * the selection - */ - void setSelection(final IStructuredSelection selection); - - /** - * - * @return the selection - */ - List<ETypedElement> computeResult(); - -}
diff --git a/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/emf/facet/efacet/ui/internal/widget/IETypedElementSelectionWidgetInternal.java b/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/emf/facet/efacet/ui/internal/widget/IETypedElementSelectionWidgetInternal.java deleted file mode 100644 index b94c8b2..0000000 --- a/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/emf/facet/efacet/ui/internal/widget/IETypedElementSelectionWidgetInternal.java +++ /dev/null
@@ -1,41 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2012 Mia-Software. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Nicolas Bros (Mia-Software) - Bug 370806 - [table] rewrite the "allowed contents" query selection dialog for v0.2 - * Vincent Lorenzo (CEA-LIST) - Bug 372644 - Create Customizable tooltips for the TreeViewer using a CustomizableLabelProvider - *******************************************************************************/ -package org.eclipse.emf.facet.efacet.ui.internal.widget; - -import org.eclipse.core.runtime.IStatus; -import org.eclipse.emf.facet.efacet.ui.internal.exported.widget.IETypedElementSelectionWidget; -import org.eclipse.jface.viewers.IOpenListener; -import org.eclipse.jface.viewers.ISelectionChangedListener; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.ui.dialogs.FilteredTree; - -public interface IETypedElementSelectionWidgetInternal extends IETypedElementSelectionWidget { - - /** Adds a listener that is notified when an element is double-clicked or the Enter key is pressed */ - void addOpenListener(IOpenListener openListener); - - /** Adds a listener that is notified when the selection changes */ - void addSelectionChangedListener(ISelectionChangedListener listener); - - /** @return the validation status : the selection is not valid if {@link IStatus#getSeverity()} >= {@link IStatus#ERROR} */ - IStatus getValidationStatus(); - - /** @return whether the widget is disposed */ - boolean isDisposed(); - - FilteredTree getFilteredTree(); - - void createContents(); - - void setSelection(IStructuredSelection selection); - -} \ No newline at end of file
diff --git a/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/emf/facet/efacet/ui/internal/widget/IETypedElementTabSelectionWidgetInternal.java b/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/emf/facet/efacet/ui/internal/widget/IETypedElementTabSelectionWidgetInternal.java deleted file mode 100644 index a80eb5e..0000000 --- a/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/emf/facet/efacet/ui/internal/widget/IETypedElementTabSelectionWidgetInternal.java +++ /dev/null
@@ -1,47 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2012 CEA-LIST. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Vincent Lorenzo (CEA-LIST) - Bug 372644 - Create Customizable tooltips for the TreeViewer using a CustomizableLabelProvider - *******************************************************************************/ -package org.eclipse.emf.facet.efacet.ui.internal.widget; - -import org.eclipse.swt.graphics.Image; - -/** - * - * Each tab in ETypedElementSectionDialog should implements this interface - * - */ -public interface IETypedElementTabSelectionWidgetInternal extends - IETypedElementSelectionWidgetInternal { - - /** - * - * @return the title for the tab - */ - String getTitle(); - - /** - * - * @return the tooltip for the tab - */ - String getToolTipText(); - - /** - * - * @return the image for the tab - */ - Image getImage(); - - /** - * - * @return the id for the tab - */ - String getTabId(); - -} \ No newline at end of file
diff --git a/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/emf/facet/efacet/ui/internal/widget/MetamodelSelectionControl.java b/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/emf/facet/efacet/ui/internal/widget/MetamodelSelectionControl.java deleted file mode 100644 index e63b058..0000000 --- a/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/emf/facet/efacet/ui/internal/widget/MetamodelSelectionControl.java +++ /dev/null
@@ -1,37 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2011 Mia-Software. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Nicolas Bros (Mia-Software) - initial API and implementation - * Nicolas Guyomar (Mia-Software) - Bug 349546 - EMF Facet facetSet editor - *******************************************************************************/ -package org.eclipse.emf.facet.efacet.ui.internal.widget; - -import java.util.Map; -import java.util.Set; -import java.util.TreeSet; - -import org.eclipse.emf.ecore.EPackage; -import org.eclipse.emf.facet.efacet.ui.internal.composites.FilteredElementSelectionComposite; -import org.eclipse.swt.widgets.Composite; - -/** - * A control to select a metamodel from a list of metamodels, that can be filtered using the - * associated text field. - */ -public class MetamodelSelectionControl extends FilteredElementSelectionComposite { - - public MetamodelSelectionControl(final Composite parent) { - super(parent, true, false); - - final Set<String> uris = new TreeSet<String>(); - for (final Object name : ((Map<?, ?>) EPackage.Registry.INSTANCE).keySet()) { - uris.add((name).toString()); - } - setElements(uris.toArray()); - } -}
diff --git a/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/emf/facet/efacet/ui/internal/widget/SynchronizedETypedElementSelectionWidget.java b/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/emf/facet/efacet/ui/internal/widget/SynchronizedETypedElementSelectionWidget.java deleted file mode 100644 index 4e59a92..0000000 --- a/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/emf/facet/efacet/ui/internal/widget/SynchronizedETypedElementSelectionWidget.java +++ /dev/null
@@ -1,123 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2012 Mia-Software. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Nicolas Bros (Mia-Software) - Bug 370806 - [table] rewrite the "allowed contents" query selection dialog for v0.2 - * Vincent Lorenzo (CEA-LIST) - Bug 372644 - Create Customizable tooltips for the TreeViewer using a CustomizableLabelProvider - *******************************************************************************/ -package org.eclipse.emf.facet.efacet.ui.internal.widget; - -import java.util.Collection; -import java.util.List; - -import org.eclipse.core.runtime.IStatus; -import org.eclipse.emf.ecore.ETypedElement; -import org.eclipse.emf.facet.util.ui.internal.exported.displaysync.AbstractExceptionFreeRunnable; -import org.eclipse.emf.facet.util.ui.internal.exported.displaysync.AbstractVoidExceptionFreeRunnable; -import org.eclipse.emf.facet.util.ui.internal.exported.displaysync.SynchronizedObject; -import org.eclipse.jface.viewers.IOpenListener; -import org.eclipse.jface.viewers.ISelectionChangedListener; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.ui.dialogs.FilteredTree; - -public class SynchronizedETypedElementSelectionWidget extends SynchronizedObject<ETypedElementSelectionControlManager> implements - IETypedElementSelectionWidgetInternal { - - private final ETypedElementSelectionControlManager control; - - protected IETypedElementSelectionWidgetInternal getControl() { - return this.control; - } - - public SynchronizedETypedElementSelectionWidget(final ETypedElementSelectionControlManager control) { - super(control, control.getFilteredTree().getDisplay()); - this.control = control; - } - - public void setAvailableETypedElements(final Collection<? extends ETypedElement> available) { - voidExceptionFreeRunnable(new AbstractVoidExceptionFreeRunnable() { - @Override - public void voidSafeRun() { - getControl().setAvailableETypedElements(available); - } - }); - } - - public List<ETypedElement> getSelectedETypedElements() { - return safeSyncExec(new AbstractExceptionFreeRunnable<List<ETypedElement>>() { - @Override - public List<ETypedElement> safeRun() { - return getControl().getSelectedETypedElements(); - } - }); - } - - public void setSelectedETypedElements(final Collection<? extends ETypedElement> elementsToSelect) { - voidExceptionFreeRunnable(new AbstractVoidExceptionFreeRunnable() { - @Override - public void voidSafeRun() { - getControl().setSelectedETypedElements(elementsToSelect); - } - }); - } - - public void addOpenListener(final IOpenListener openListener) { - voidExceptionFreeRunnable(new AbstractVoidExceptionFreeRunnable() { - @Override - public void voidSafeRun() { - getControl().addOpenListener(openListener); - } - }); - } - - public void addSelectionChangedListener(final ISelectionChangedListener listener) { - voidExceptionFreeRunnable(new AbstractVoidExceptionFreeRunnable() { - @Override - public void voidSafeRun() { - getControl().addSelectionChangedListener(listener); - } - }); - } - - public IStatus getValidationStatus() { - return safeSyncExec(new AbstractExceptionFreeRunnable<IStatus>() { - @Override - public IStatus safeRun() { - return getControl().getValidationStatus(); - } - }); - } - - public boolean isDisposed() { - return safeSyncExec(new AbstractExceptionFreeRunnable<Boolean>() { - @Override - public Boolean safeRun() { - return Boolean.valueOf(getControl().isDisposed()); - } - }).booleanValue(); - } - - public FilteredTree getFilteredTree() { - // should not be used! - throw new UnsupportedOperationException(); - } - - public void createContents() { - // //nothing to do - throw new UnsupportedOperationException(); - } - - public void setSelection(final IStructuredSelection selection) { - voidExceptionFreeRunnable(new AbstractVoidExceptionFreeRunnable() { - @Override - public void voidSafeRun() { - getControl().setSelection(selection); - } - }); - } - -}
diff --git a/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/emf/facet/efacet/ui/internal/widget/SynchronizedFacetSetSelectionWidget.java b/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/emf/facet/efacet/ui/internal/widget/SynchronizedFacetSetSelectionWidget.java deleted file mode 100644 index 4a01661..0000000 --- a/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/emf/facet/efacet/ui/internal/widget/SynchronizedFacetSetSelectionWidget.java +++ /dev/null
@@ -1,90 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2012 CEA LIST. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Nicolas Bros (Mia-Software) - Bug 372865 - FacetSet selection dialog - *******************************************************************************/ -package org.eclipse.emf.facet.efacet.ui.internal.widget; - -import java.util.Collection; -import java.util.List; - -import org.eclipse.core.runtime.IStatus; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.FacetSet; -import org.eclipse.emf.facet.efacet.ui.internal.exported.widget.IFacetSetSelectionWidget; -import org.eclipse.emf.facet.util.ui.internal.exported.displaysync.AbstractExceptionFreeRunnable; -import org.eclipse.emf.facet.util.ui.internal.exported.displaysync.AbstractVoidExceptionFreeRunnable; -import org.eclipse.emf.facet.util.ui.internal.exported.displaysync.SynchronizedObject; -import org.eclipse.swt.widgets.Control; - -public class SynchronizedFacetSetSelectionWidget extends SynchronizedObject<FacetSetSelectionControl> implements IFacetSetSelectionWidget { - - private final FacetSetSelectionControl control; - - protected FacetSetSelectionControl getDelegate() { - return this.control; - } - - public SynchronizedFacetSetSelectionWidget(final FacetSetSelectionControl control) { - super(control, control.getTreeViewer().getTree().getDisplay()); - this.control = control; - } - - public void setAvailableFacetSets(final Collection<? extends FacetSet> available) { - voidExceptionFreeRunnable(new AbstractVoidExceptionFreeRunnable() { - @Override - public void voidSafeRun() { - getDelegate().setAvailableFacetSets(available); - } - }); - } - - public List<FacetSet> getSelectedFacetSets() { - return safeSyncExec(new AbstractExceptionFreeRunnable<List<FacetSet>>() { - @Override - public List<FacetSet> safeRun() { - return getDelegate().getSelectedFacetSets(); - } - }); - } - - public void setSelectedFacetSets(final Collection<? extends FacetSet> facetSetsToSelect) { - voidExceptionFreeRunnable(new AbstractVoidExceptionFreeRunnable() { - @Override - public void voidSafeRun() { - getDelegate().setSelectedFacetSets(facetSetsToSelect); - } - }); - } - - public IStatus getValidationStatus() { - return safeSyncExec(new AbstractExceptionFreeRunnable<IStatus>() { - @Override - public IStatus safeRun() { - return getDelegate().getValidationStatus(); - } - }); - } - - public boolean isDisposed() { - return safeSyncExec(new AbstractExceptionFreeRunnable<Boolean>() { - @Override - public Boolean safeRun() { - return Boolean.valueOf(getDelegate().isDisposed()); - } - }).booleanValue(); - } - - public Control getControl() { - return safeSyncExec(new AbstractExceptionFreeRunnable<Control>() { - @Override - public Control safeRun() { - return getDelegate().getControl(); - } - }); - } -}
diff --git a/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/emf/facet/efacet/ui/internal/widget/UriWidget.java b/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/emf/facet/efacet/ui/internal/widget/UriWidget.java deleted file mode 100644 index 36fc47c..0000000 --- a/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/emf/facet/efacet/ui/internal/widget/UriWidget.java +++ /dev/null
@@ -1,63 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2015 Soft-Maint. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Jonathan Pepin (Soft-Maint) - Bug 463907 - Command for load and save Facet serialization - *******************************************************************************/ -package org.eclipse.emf.facet.efacet.ui.internal.widget; - -import org.eclipse.emf.common.util.URI; -import org.eclipse.emf.facet.efacet.ui.internal.Activator; -import org.eclipse.emf.facet.efacet.ui.internal.Messages; -import org.eclipse.emf.facet.efacet.ui.internal.exported.widget.IUriWidget; -import org.eclipse.emf.facet.util.core.Logger; -import org.eclipse.emf.facet.util.ui.internal.exported.dialog.IOkDialogFactory; -import org.eclipse.emf.facet.util.ui.utils.UIUtils; -import org.eclipse.jface.layout.GridDataFactory; -import org.eclipse.osgi.util.NLS; -import org.eclipse.swt.SWT; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Label; -import org.eclipse.swt.widgets.Shell; -import org.eclipse.swt.widgets.Text; - -public class UriWidget extends Composite implements IUriWidget { - - private final Text textWidget; - - public UriWidget(final Composite parent) { - super(parent, SWT.NONE); - final Label labelWidget = UIUtils.createLabel(parent, - Messages.UriWidget_EmfUri); - labelWidget.setLayoutData(GridDataFactory.swtDefaults() - .grab(true, false).create()); - this.textWidget = UIUtils.createTextField(parent, - "", true, null); //$NON-NLS-1$ - } - - public URI getURI() { - URI result = null; - final String text = this.textWidget.getText(); - try { - result = URI.createURI(text); - } catch (IllegalArgumentException e) { - final String message = NLS.bind("The URI '{0}' in malformed.", text); //$NON-NLS-1$ - IOkDialogFactory.DEFAULT.openErrorDialog(new Shell(), e, message); - Logger.logError(e, Activator.getDefault()); - } - return result; - } - - public void setURI(final URI uri) { - String uriStr = "platform:/resource/<your_project>/<your_file>.xmi"; //$NON-NLS-1$ - if (uri != null) { - uriStr = uri.toString(); - } - this.textWidget.setText(uriStr); - } - -}
diff --git a/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/emf/facet/efacet/ui/internal/widget/UriWidgetFactory.java b/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/emf/facet/efacet/ui/internal/widget/UriWidgetFactory.java deleted file mode 100644 index cc0b233..0000000 --- a/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/emf/facet/efacet/ui/internal/widget/UriWidgetFactory.java +++ /dev/null
@@ -1,22 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2015 Soft-Maint. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Jonathan Pepin (Soft-Maint) - Bug 463907 - Command for load and save Facet serialization - *******************************************************************************/ -package org.eclipse.emf.facet.efacet.ui.internal.widget; - -import org.eclipse.emf.facet.efacet.ui.internal.exported.widget.IUriWidget; -import org.eclipse.emf.facet.efacet.ui.internal.exported.widget.IUriWidgetFactory; -import org.eclipse.swt.widgets.Composite; - -public class UriWidgetFactory implements IUriWidgetFactory { - - public IUriWidget createUriWidget(final Composite parent) { - return new UriWidget(parent); - } -}
diff --git a/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/emf/facet/efacet/ui/internal/wizards/SelectETypeWizardImpl.java b/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/emf/facet/efacet/ui/internal/wizards/SelectETypeWizardImpl.java deleted file mode 100644 index 6c1b4a3..0000000 --- a/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/emf/facet/efacet/ui/internal/wizards/SelectETypeWizardImpl.java +++ /dev/null
@@ -1,82 +0,0 @@ -/** - * Copyright (c) 2011 Mia-Software. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Nicolas Guyomar (Mia-Software) - Bug 349546 - EMF Facet facetSet editor - */ -package org.eclipse.emf.facet.efacet.ui.internal.wizards; - -import org.eclipse.emf.ecore.EClassifier; -import org.eclipse.emf.ecore.EPackage; -import org.eclipse.emf.edit.domain.EditingDomain; -import org.eclipse.emf.facet.efacet.ui.internal.Messages; -import org.eclipse.emf.facet.efacet.ui.internal.composites.SelectETypeComposite.ETypeSelectionOptions; -import org.eclipse.emf.facet.efacet.ui.internal.exported.wizard.ISelectETypeWizard; -import org.eclipse.emf.facet.efacet.ui.internal.wizards.pages.SelectEClassifierWizardPage; -import org.eclipse.emf.facet.efacet.ui.internal.wizards.pages.SelectEPackageWizardPage; -import org.eclipse.jface.window.Window; -import org.eclipse.jface.wizard.Wizard; -import org.eclipse.jface.wizard.WizardDialog; -import org.eclipse.ui.PlatformUI; - -public class SelectETypeWizardImpl extends Wizard implements ISelectETypeWizard { - - private final WizardDialog dialog; - - private final SelectEPackageWizardPage selectEPackagePage; - private final SelectEClassifierWizardPage selectETypePage; - - private final EditingDomain editingDomain; - - private EClassifier selectedEType; - - private boolean canChangeEPackage = true; - - public SelectETypeWizardImpl(final EditingDomain editingDomain, final ETypeSelectionOptions eTypeSelectionOption, - final boolean canChangeEPackage, final EPackage ePackage) { - super(); - this.editingDomain = editingDomain; - this.canChangeEPackage = canChangeEPackage; - this.dialog = new WizardDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), this); - this.selectEPackagePage = new SelectEPackageWizardPage(this.editingDomain); - this.selectETypePage = new SelectEClassifierWizardPage(eTypeSelectionOption, ePackage); - if (eTypeSelectionOption == ETypeSelectionOptions.ECLASS) { - setWindowTitle(Messages.Select_EClass); - } else if (eTypeSelectionOption == ETypeSelectionOptions.EDATATYPE) { - setWindowTitle(Messages.Select_EDataType); - } else { - setWindowTitle(Messages.Select_EClassifier); - } - } - - @Override - public void addPages() { - if (this.canChangeEPackage) { - addPage(this.selectEPackagePage); - } - addPage(this.selectETypePage); - } - - public int open() { - if (this.dialog != null) { - return this.dialog.open(); - } - return Window.CANCEL; - } - - @Override - public boolean performFinish() { - this.selectedEType = this.selectETypePage.getSelectedEclassifier(); - return true; - } - - public EClassifier getSelectedEType() { - return this.selectedEType; - } - -}
diff --git a/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/emf/facet/efacet/ui/internal/wizards/pages/FacetSetPropertyWizardPage.java b/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/emf/facet/efacet/ui/internal/wizards/pages/FacetSetPropertyWizardPage.java deleted file mode 100644 index dbafcfc..0000000 --- a/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/emf/facet/efacet/ui/internal/wizards/pages/FacetSetPropertyWizardPage.java +++ /dev/null
@@ -1,106 +0,0 @@ -/** - * Copyright (c) 2011 Mia-Software. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Nicolas Guyomar (Mia-Software) - Bug 349546 - EMF Facet facetSet editor - */ -package org.eclipse.emf.facet.efacet.ui.internal.wizards.pages; - -import org.eclipse.emf.edit.domain.EditingDomain; -import org.eclipse.emf.facet.efacet.ui.internal.Messages; -import org.eclipse.swt.SWT; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.layout.GridLayout; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Event; -import org.eclipse.swt.widgets.Label; -import org.eclipse.swt.widgets.Listener; -import org.eclipse.swt.widgets.Text; - -/** - * Wizard page to enter a NsURI, a prefix and an extended EPackage to a facetSet - */ -public class FacetSetPropertyWizardPage extends SelectEPackageWizardPage { - - private Text nsUriTextField; - private Text prefixTextField; - - public FacetSetPropertyWizardPage(final EditingDomain editingDomain) { - super(editingDomain); - } - - @Override - public void createControl(final Composite parent) { - - // Extends the SelectEPackageWizardPage to add a NsURI and a Prefix textField - Composite container = new Composite(parent, SWT.NONE); - container.setLayout(new GridLayout(1, false)); - container.setLayoutData(new GridData(GridData.FILL_HORIZONTAL, GridData.FILL_VERTICAL, true, true)); - - Composite nsURiContainer = new Composite(container, SWT.NONE); - nsURiContainer.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); - nsURiContainer.setLayout(new GridLayout(2, false)); - - // NsURI - Label nsUriLabel = new Label(nsURiContainer, SWT.NONE); - nsUriLabel.setText(Messages.Enter_a_nsUri); - this.nsUriTextField = new Text(nsURiContainer, SWT.BORDER | SWT.SINGLE); - this.nsUriTextField.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); - this.nsUriTextField.addListener(SWT.Modify, new Listener() { - public void handleEvent(final Event event) { - updateButtons(); - } - }); - - // PREFIX - Label prefixLabel = new Label(nsURiContainer, SWT.NONE); - prefixLabel.setText(Messages.Enter_a_prefix); - this.prefixTextField = new Text(nsURiContainer, SWT.BORDER | SWT.SINGLE); - this.prefixTextField.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); - this.prefixTextField.addListener(SWT.Modify, new Listener() { - public void handleEvent(final Event event) { - updateButtons(); - } - }); - - super.createControl(container); - } - - @Override - public boolean isPageComplete() { - if (this.nsUriTextField.getText().length() == 0) { - setErrorMessage(Messages.Please_enter_nsUri); - return false; - } - - if (this.prefixTextField.getText().length() == 0) { - setErrorMessage(Messages.Please_enter_prefix); - return false; - } - if (super.isPageComplete()) { - setErrorMessage(null); - return true; - } - setErrorMessage(Messages.Please_select_EPackage); - - return false; - } - - public String getNsUri() { - return this.nsUriTextField.getText(); - } - - public String getPrefix() { - return this.prefixTextField.getText(); - } - - protected void updateButtons() { - getContainer().updateButtons(); - } - -}
diff --git a/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/emf/facet/efacet/ui/internal/wizards/pages/SelectEClassifierWizardPage.java b/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/emf/facet/efacet/ui/internal/wizards/pages/SelectEClassifierWizardPage.java deleted file mode 100644 index 7ab88aa..0000000 --- a/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/emf/facet/efacet/ui/internal/wizards/pages/SelectEClassifierWizardPage.java +++ /dev/null
@@ -1,114 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2011 Mia-Software. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Nicolas Bros (Mia-Software) - initial API and implementation - *******************************************************************************/ -package org.eclipse.emf.facet.efacet.ui.internal.wizards.pages; - -import org.eclipse.emf.ecore.EClassifier; -import org.eclipse.emf.ecore.EPackage; -import org.eclipse.emf.facet.efacet.ui.internal.Messages; -import org.eclipse.emf.facet.efacet.ui.internal.composites.SelectETypeComposite.ETypeSelectionOptions; -import org.eclipse.emf.facet.efacet.ui.internal.widget.EClassifierSelectionControl; -import org.eclipse.jface.wizard.WizardPage; -import org.eclipse.swt.events.ModifyEvent; -import org.eclipse.swt.events.ModifyListener; -import org.eclipse.swt.events.SelectionEvent; -import org.eclipse.swt.events.SelectionListener; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.ui.dialogs.FilteredList; - -public class SelectEClassifierWizardPage extends WizardPage { - - private EClassifierSelectionControl eClassSelectionControl; - private final ETypeSelectionOptions eTypeSelectionOption; - private String metamodelNsUri; - - public SelectEClassifierWizardPage(final ETypeSelectionOptions eTypeSelectionOption, final EPackage ePackage) { - super("Whatever"); //$NON-NLS-1$ - if (eTypeSelectionOption == ETypeSelectionOptions.ECLASS) { - setTitle(Messages.Select_EClass); - } else if (eTypeSelectionOption == ETypeSelectionOptions.EDATATYPE) { - setTitle(Messages.Select_EDataType); - } else { - setTitle(Messages.Select_EClassifier); - } - if (ePackage != null) { - this.metamodelNsUri = ePackage.getNsURI(); - } - this.eTypeSelectionOption = eTypeSelectionOption; - } - - @Override - public boolean isPageComplete() { - return this.eClassSelectionControl.getSelectedEClassifier() != null; - } - - @Override - public void setVisible(final boolean visible) { - super.setVisible(visible); - if (getPreviousPage() instanceof SelectEPackageWizardPage) { - SelectEPackageWizardPage selectEPackageWizardPage = (SelectEPackageWizardPage) getPreviousPage(); - this.metamodelNsUri = selectEPackageWizardPage.getFirstSelectedEPackage().getNsURI(); - if (this.metamodelNsUri != null) { - setDescription(selectEPackageWizardPage.getFirstSelectedEPackage().getNsURI()); - } - } - this.eClassSelectionControl.updateList(this.metamodelNsUri); - } - - public void createControl(final Composite parent) { - this.eClassSelectionControl = new EClassifierSelectionControl(parent, this.metamodelNsUri, this.eTypeSelectionOption); - final FilteredList filteredList = this.eClassSelectionControl.getFilteredList(); - - filteredList.addSelectionListener(new SelectionListener() { - public void widgetSelected(final SelectionEvent e) { - if (e.item != null) { - updateButton(); - // setPageComplete(filteredList.getSelection().length == 1); - } - } - - public void widgetDefaultSelected(final SelectionEvent e) { - if (getWizard().canFinish()) { - getWizard().performFinish(); - } - if (getNextPage() != null) { - goToNextPage(); - } - } - }); - - this.eClassSelectionControl.getFilterText().addModifyListener(new ModifyListener() { - - public void modifyText(final ModifyEvent e) { - updateButton(); - } - }); - - // avoid the page being "complete" when still on a previous page - filteredList.setSelection(new int[0]); - setPageComplete(false); - - setControl(this.eClassSelectionControl); - } - - protected void goToNextPage() { - getContainer().showPage(getNextPage()); - } - - protected void updateButton() { - if (getContainer() != null && getContainer().getCurrentPage() != null) { - getContainer().updateButtons(); - } - } - - public EClassifier getSelectedEclassifier() { - return this.eClassSelectionControl.getSelectedEClassifier(); - } -} \ No newline at end of file
diff --git a/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/emf/facet/efacet/ui/internal/wizards/pages/SelectEPackageWizardPage.java b/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/emf/facet/efacet/ui/internal/wizards/pages/SelectEPackageWizardPage.java deleted file mode 100644 index 195cece..0000000 --- a/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/emf/facet/efacet/ui/internal/wizards/pages/SelectEPackageWizardPage.java +++ /dev/null
@@ -1,114 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2011 Mia-Software. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Nicolas Bros (Mia-Software) - initial API and implementation - *******************************************************************************/ -package org.eclipse.emf.facet.efacet.ui.internal.wizards.pages; - -import org.eclipse.emf.common.util.URI; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.EPackage; -import org.eclipse.emf.ecore.EPackage.Registry; -import org.eclipse.emf.ecore.resource.Resource; -import org.eclipse.emf.ecore.resource.ResourceSet; -import org.eclipse.emf.edit.domain.EditingDomain; -import org.eclipse.emf.facet.efacet.ui.internal.Messages; -import org.eclipse.emf.facet.efacet.ui.internal.widget.MetamodelSelectionControl; -import org.eclipse.jface.wizard.WizardPage; -import org.eclipse.swt.events.SelectionEvent; -import org.eclipse.swt.events.SelectionListener; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.ui.dialogs.FilteredList; - -public class SelectEPackageWizardPage extends WizardPage { - - private MetamodelSelectionControl metamodelSelectionControl; - private final EditingDomain editingDomain; - - public SelectEPackageWizardPage(final EditingDomain editingDomain) { - super("Whatever"); //$NON-NLS-1$ - setTitle(Messages.Select_EPackage); - this.editingDomain = editingDomain; - } - - @Override - public void setVisible(final boolean visible) { - super.setVisible(visible); - if (visible) { - this.metamodelSelectionControl.getFilterText().setFocus(); - setPageComplete(true); - } - } - - public void createControl(final Composite parent) { - this.metamodelSelectionControl = new MetamodelSelectionControl(parent); - this.metamodelSelectionControl.setLayoutData(new GridData(GridData.FILL_BOTH)); - final FilteredList filteredList = this.metamodelSelectionControl.getFilteredList(); - - filteredList.addSelectionListener(new SelectionListener() { - public void widgetSelected(final SelectionEvent e) { - if (e.item != null) { - setPageComplete(filteredList.getSelection().length == 1); - } - } - - public void widgetDefaultSelected(final SelectionEvent e) { - if (getWizard().canFinish()) { - getWizard().performFinish(); - } - if (getNextPage() != null) { - goToNextPage(); - } - } - }); - - // prevent the page from being "complete" when still on a previous page - filteredList.setSelection(new int[0]); - setPageComplete(false); - - setControl(this.metamodelSelectionControl); - } - - protected void goToNextPage() { - getContainer().showPage(getNextPage()); - } - - public EPackage getFirstSelectedEPackage() { - // Only one result - if (this.metamodelSelectionControl.getSelectedElements() != null) { - Object result = this.metamodelSelectionControl.getSelectedElements()[0]; - if (EPackage.Registry.INSTANCE.containsKey(result.toString())) { - return EPackage.Registry.INSTANCE.getEPackage(result.toString()); - } - } - return null; - } - - public void loadSelectedMetamodel() { - Object[] results = this.metamodelSelectionControl.getSelectedElements(); - // if user cancel the selection of meta models, results = null - if (results != null) { - ResourceSet resourceSet = this.editingDomain.getResourceSet(); - for (Object result : results) { - URI uri = URI.createURI(result.toString()); - Resource r = resourceSet.getResource(uri, true); - if (!resourceSet.getResources().contains(r)) { - Registry packageRegistry = resourceSet.getPackageRegistry(); - for (EObject eObject : r.getContents()) { - if (eObject instanceof EPackage) { - EPackage ePackage = (EPackage) eObject; - packageRegistry.put(ePackage.getNsURI(), ePackage); - } - } - resourceSet.getResources().add(r); - } - } - } - } -}
diff --git a/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/modisco/facet/efacet/ui/FacetSetLoaderHandlerUtils.java b/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/modisco/facet/efacet/ui/FacetSetLoaderHandlerUtils.java new file mode 100644 index 0000000..9d0ead1 --- /dev/null +++ b/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/modisco/facet/efacet/ui/FacetSetLoaderHandlerUtils.java
@@ -0,0 +1,94 @@ +/** + * Copyright (c) 2015 Soft-Maint, and Mia-Software. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Thomas Cicognani (Soft-Maint) - Bug 472075 - Update API to create UI shortcuts to activate FacetSets + * Grégoire Dupé (Mia-Software) - Bug 472075 - Update API to create UI shortcuts to activate FacetSets + */ +package org.eclipse.modisco.facet.efacet.ui; + +import java.util.List; + +import org.eclipse.core.commands.ExecutionEvent; +import org.eclipse.core.commands.ExecutionException; +import org.eclipse.modisco.facet.custom.core.ICustomizationManager; +import org.eclipse.modisco.facet.custom.core.ICustomizationManagerProvider; +import org.eclipse.modisco.facet.efacet.core.IFacetManager; +import org.eclipse.modisco.facet.efacet.core.IFacetSetCatalogManager; +import org.eclipse.modisco.facet.efacet.core.IFacetSetCatalogManagerFactory; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.FacetSet; +import org.eclipse.ui.IWorkbenchPart; +import org.eclipse.ui.handlers.HandlerUtil; + +/** + * Utilitarian to manage Handlers which will (un)load FacetSets: allow users to + * (des)activate facet sets (customizations are facet sets). If you want to + * create a menu shortcut, your Handler must extends this class + * @noinstantiate This class is not intended to be instantiated by clients. + * @since 1.1 + */ +public final class FacetSetLoaderHandlerUtils { + + private FacetSetLoaderHandlerUtils() { + // Must not be used. + } + + /** + * Execute the Handler + * + * @param event + * The execution event that contains the application context + * @param facetSetID + * ID of the facet set linked to this Handler + * @return the result of the execution. Reserved for future use, can be + * <code>null</code>. + * @throws ExecutionException + */ + public static Object execute(final ExecutionEvent event, + final String facetSetID) throws ExecutionException { + final boolean toggle = HandlerUtil.toggleCommandState(event + .getCommand()); + final IWorkbenchPart activePart = HandlerUtil.getActivePart(event); + if (activePart != null) { + final ICustomizationManagerProvider customMgrProvider = (ICustomizationManagerProvider) activePart + .getAdapter(ICustomizationManagerProvider.class); + if (customMgrProvider != null) { + execute(facetSetID, toggle, customMgrProvider); + } + } + return null; + } + + private static void execute(final String facetSetID, final boolean toggle, + final ICustomizationManagerProvider customMgrProvider) { + final ICustomizationManager manager = customMgrProvider + .getCustomizationManager(); + + final IFacetSetCatalogManager catalog = IFacetSetCatalogManagerFactory.DEFAULT + .getOrCreateFacetSetCatalogManager(manager.getResourceSet()); + + FacetSet facetSetToActive = null; + for (FacetSet facetSet : catalog.getRegisteredFacetSets()) { + if (facetSetID.equals(facetSet.getName())) { + facetSetToActive = facetSet; + break; + } + } + if (facetSetToActive != null) { + final IFacetManager facetManager = manager.getFacetManager(); + final List<FacetSet> managedFacetSets = facetManager + .getManagedFacetSets(); + if (toggle) { + managedFacetSets.remove(facetSetToActive); + } else { + if (!managedFacetSets.contains(facetSetToActive)) { + managedFacetSets.add(0, facetSetToActive); + } + } + } + } +}
diff --git a/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/modisco/facet/efacet/ui/FacetSetShortcutActionUtils.java b/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/modisco/facet/efacet/ui/FacetSetShortcutActionUtils.java new file mode 100644 index 0000000..aa35b23 --- /dev/null +++ b/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/modisco/facet/efacet/ui/FacetSetShortcutActionUtils.java
@@ -0,0 +1,63 @@ +/******************************************************************************* + * Copyright (c) 2015 Mia-Software + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Thomas Cicognani (Mia-Software) - Bug 472075 - Update API to create UI shortcuts to activate FacetSets + * Grégoire Dupé (Mia-Software) - Bug 472075 - Update API to create UI shortcuts to activate FacetSets + *******************************************************************************/ +package org.eclipse.modisco.facet.efacet.ui; + +import java.util.List; +import java.util.Set; + +import org.eclipse.jface.action.Action; +import org.eclipse.jface.resource.ImageDescriptor; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.FacetSet; + +/** + * @since 1.1 + * @noinstantiate This class is not intended to be instantiated by clients. + */ +public final class FacetSetShortcutActionUtils { + + private FacetSetShortcutActionUtils() { + // NOT TO BE USED + } + + public static void setImageDescriptor(final Action action, + final ImageDescriptor imageDescriptor) { + if (imageDescriptor != null) { + action.setImageDescriptor(imageDescriptor); + } + } + + public static <T extends FacetSet> void runAction(final Action action, + final String actionId, final Set<T> availableFS, + final List<T> activatedFS) { + for (T facetSet : availableFS) { + final String facetSetName = facetSet.getName(); + if (facetSetName.equals(actionId)) { + setActivatedFacetSets(action, facetSet, activatedFS); + break; + } + } + } + + private static <T extends FacetSet> void setActivatedFacetSets( + final Action action, final T facetSet, final List<T> activatedFS) { + /* + * The condition is inverted because the toggle state changes before + * launching the run method + */ + if (action.isChecked()) { + activatedFS.add(0, facetSet); + } else { + activatedFS.remove(facetSet); + } + } + +}
diff --git a/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/modisco/facet/efacet/ui/IETypedElementResultDisplayer.java b/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/modisco/facet/efacet/ui/IETypedElementResultDisplayer.java new file mode 100644 index 0000000..96dc966 --- /dev/null +++ b/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/modisco/facet/efacet/ui/IETypedElementResultDisplayer.java
@@ -0,0 +1,28 @@ +/******************************************************************************* + * Copyright (c) 2010, 2012 Mia-Software. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Nicolas Bros (Mia-Software) + * Gregoire Dupe (Mia-Software) - Bug 364325 - [Restructuring] The user must be able to navigate into a model using the Facet. + *******************************************************************************/ +package org.eclipse.modisco.facet.efacet.ui; + +import java.util.List; + +import org.eclipse.emf.edit.domain.EditingDomain; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.runtime.ETypedElementResult; + +/** + * Implemented by a view or editor that wants to be used to display the results + * of a model query. + */ +//Copied from org.eclipse.emf.facet.infra.query.ui.views.queryExecution.QueryResultDisplayer +public interface IETypedElementResultDisplayer { + void displayETypedElementResults(final List<ETypedElementResult> result, EditingDomain editingDomain); + + String getName(); +}
diff --git a/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/modisco/facet/efacet/ui/IETypedElementResultDisplayerOpener.java b/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/modisco/facet/efacet/ui/IETypedElementResultDisplayerOpener.java new file mode 100644 index 0000000..124074d --- /dev/null +++ b/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/modisco/facet/efacet/ui/IETypedElementResultDisplayerOpener.java
@@ -0,0 +1,29 @@ +/** + * Copyright (c) 2011, 2012 Mia-Software. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Gregoire Dupe (Mia-Software) - Bug 364325 - [Restructuring] The user must be able to navigate into a model using the Facet. + */ +package org.eclipse.modisco.facet.efacet.ui; + +import java.util.List; + +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.runtime.ETypedElementResult; +import org.eclipse.ui.IWorkbenchPart; + + +/** + * This method must be implemented and referenced by the extension point org.eclipse.emf.facet.efacet.ui.displayeropener + * + * This is a new version of the org.eclipse.emf.facet.infra.query.ui.views.queryExecution.QueryResultDisplayer. + * @author Gregoire Dupe + * + */ +public interface IETypedElementResultDisplayerOpener { + IWorkbenchPart open(List<ETypedElementResult> results); +}
diff --git a/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/modisco/facet/efacet/ui/IFacetManagerProvider2.java b/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/modisco/facet/efacet/ui/IFacetManagerProvider2.java new file mode 100644 index 0000000..da4a3d4 --- /dev/null +++ b/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/modisco/facet/efacet/ui/IFacetManagerProvider2.java
@@ -0,0 +1,34 @@ +/******************************************************************************* + * Copyright (c) 2015 Mia-Software + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Thomas Cicognani (Mia-Software) - Bug 472075 - Update API to create UI shortcuts to activate FacetSets + *******************************************************************************/ +package org.eclipse.modisco.facet.efacet.ui; + +import java.util.List; + +import org.eclipse.jface.resource.ImageDescriptor; +import org.eclipse.modisco.facet.efacet.core.IFacetManagerProvider; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.FacetSet; + +/** + * @since 1.1 + */ +public interface IFacetManagerProvider2 extends IFacetManagerProvider { + + interface IFacetSetShortcut { + FacetSet getFacetSet(); + + String getLabel(); + + ImageDescriptor getIcon(); + } + + List<IFacetSetShortcut> getFacetSetShortcuts(); + +}
diff --git a/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/modisco/facet/efacet/ui/LoadFacetSetShortcutsMenuUtils.java b/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/modisco/facet/efacet/ui/LoadFacetSetShortcutsMenuUtils.java new file mode 100644 index 0000000..7b0681e --- /dev/null +++ b/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/modisco/facet/efacet/ui/LoadFacetSetShortcutsMenuUtils.java
@@ -0,0 +1,124 @@ +/******************************************************************************* + * Copyright (c) 2015 Mia-Software + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Thomas Cicognani (Mia-Software) - Bug 472075 - Update API to create UI shortcuts to activate FacetSets + * Grégoire Dupé (Mia-Software) - Bug 472075 - Update API to create UI shortcuts to activate FacetSets + *******************************************************************************/ +package org.eclipse.modisco.facet.efacet.ui; + +import java.util.ArrayList; +import java.util.List; + +import org.eclipse.jface.action.Action; +import org.eclipse.jface.action.ActionContributionItem; +import org.eclipse.jface.action.IContributionItem; +import org.eclipse.modisco.facet.efacet.core.IFacetManager; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.FacetSet; +import org.eclipse.modisco.facet.efacet.ui.IFacetManagerProvider2.IFacetSetShortcut; +import org.eclipse.modisco.facet.efacet.ui.internal.actions.ShortcutFacetSetAction; +import org.eclipse.modisco.facet.util.ui.internal.exported.handler.HandlerUtils; +import org.eclipse.ui.IEditorPart; +import org.eclipse.ui.IWorkbenchPage; +import org.eclipse.ui.IWorkbenchPart; + +/** + * @since 1.1 + * @noinstantiate This class is not intended to be instantiated by clients. + */ +public final class LoadFacetSetShortcutsMenuUtils { + + private LoadFacetSetShortcutsMenuUtils() { + // NOT TO BE USED + } + + public static IContributionItem[] getFacetSetItemsFromCurrentPart() { + final IFacetManagerProvider2 facetMgrPrv = getProviderFromCurrentPart(IFacetManagerProvider2.class); + return getFacetSetItems(facetMgrPrv); + } + + public static IContributionItem[] getFacetSetItemsFromCurrentEditor() { + final IFacetManagerProvider2 facetMgrPrv = getProviderFromCurrentEditor(IFacetManagerProvider2.class); + return getFacetSetItems(facetMgrPrv); + } + + private static IContributionItem[] getFacetSetItems( + final IFacetManagerProvider2 facetMgrPrv) { + final List<IContributionItem> menuList = new ArrayList<IContributionItem>(); + if (facetMgrPrv != null) { + final List<IFacetSetShortcut> shortcuts = facetMgrPrv + .getFacetSetShortcuts(); + final IFacetManager facetManager = facetMgrPrv.getFacetManager(); + for (IFacetSetShortcut shortcut : shortcuts) { + final ActionContributionItem action = createFacetSetMenuItem( + shortcut, facetManager); + menuList.add(action); + } + } + return menuList.toArray(new IContributionItem[menuList.size()]); + } + + public static <T> T getProviderFromCurrentPart(final Class<T> providerType) { + final IWorkbenchPart activePart = HandlerUtils.getActivePart(); + return getProviderFromCurrentPart(providerType, activePart); + } + + public static <T> T getProviderFromCurrentEditor( + final Class<T> providerType) { + T result = null; + final IWorkbenchPage activePage = HandlerUtils.getActivePage(); + if (activePage != null) { + final IEditorPart activeEditor = activePage.getActiveEditor(); + if (activeEditor != null) { + result = getProviderFromCurrentPart(providerType, activeEditor); + } + } + return result; + } + + private static <T> T getProviderFromCurrentPart( + final Class<T> providerType, final IWorkbenchPart activePart) { + T result = null; + if (activePart != null) { + final Object adapt = activePart.getAdapter(providerType); + if (adapt != null) { + /* + * @SuppressWarnings("unchecked") Cast safe thanks to the + * getAdapter method + */ + @SuppressWarnings("unchecked") + final T adapted = (T) adapt; + result = adapted; + } + } + return result; + } + + private static ActionContributionItem createFacetSetMenuItem( + final IFacetSetShortcut shortcut, final IFacetManager facetManager) { + final FacetSet facetSet = shortcut.getFacetSet(); + final String facetSetId = facetSet.getName(); + final Action action = new ShortcutFacetSetAction(facetSetId, + shortcut.getLabel(), shortcut.getIcon(), facetManager); + final List<FacetSet> activeFacetSets = facetManager + .getManagedFacetSets(); + return createMenuItem(facetSetId, activeFacetSets, action); + } + + public static ActionContributionItem createMenuItem(final String itemId, + final List<? extends FacetSet> activeFacetSets, + final Action newAction) { + for (FacetSet activeCustom : activeFacetSets) { + final String facetSetName = activeCustom.getName(); + if (facetSetName.equals(itemId)) { + newAction.setChecked(true); + break; + } + } + return new ActionContributionItem(newAction); + } +}
diff --git a/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/modisco/facet/efacet/ui/internal/Activator.java b/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/modisco/facet/efacet/ui/internal/Activator.java new file mode 100644 index 0000000..2c7a2aa --- /dev/null +++ b/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/modisco/facet/efacet/ui/internal/Activator.java
@@ -0,0 +1,59 @@ +/** + * Copyright (c) 2011 Mia-Software. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Nicolas Guyomar (Mia-Software) - Bug 349546 - EMF Facet facetSet editor + * Nicolas Bros (Mia-Software) - Bug 379439 - Missing icons for Navigation view actions + */ +package org.eclipse.modisco.facet.efacet.ui.internal; + +import org.eclipse.ui.plugin.AbstractUIPlugin; +import org.osgi.framework.BundleContext; + +/** + * The activator class controls the plug-in life cycle + */ +public class Activator extends AbstractUIPlugin { + + public static final String PLUGIN_ID = "org.eclipse.emf.facet.efacet.ui"; //$NON-NLS-1$ + + // The shared instance + private static Activator plugin; + + /* + * (non-Javadoc) + * + * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext ) + */ + @Override + public void start(final BundleContext context) throws Exception { + super.start(context); + Activator.plugin = this; + } + + /* + * (non-Javadoc) + * + * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext ) + */ + @Override + public void stop(final BundleContext context) throws Exception { + Activator.plugin = null; + super.stop(context); + } + + /** + * Returns the shared instance + * + * @return the shared instance + */ + public static Activator getDefault() { + return Activator.plugin; + } + +}
diff --git a/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/modisco/facet/efacet/ui/internal/IFacetUIFactory2.java b/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/modisco/facet/efacet/ui/internal/IFacetUIFactory2.java new file mode 100644 index 0000000..46889fd --- /dev/null +++ b/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/modisco/facet/efacet/ui/internal/IFacetUIFactory2.java
@@ -0,0 +1,116 @@ +/** + * Copyright (c) 2011 Mia-Software. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Nicolas Guyomar (Mia-Software) - Bug 349546 - EMF Facet facetSet editor + * Gregoire Dupe (Mia-Software) - Bug 361617 - Deprecation of APIs for the old Facet metamodels + */ +package org.eclipse.modisco.facet.efacet.ui.internal; + +import org.eclipse.emf.ecore.EParameter; +import org.eclipse.emf.edit.domain.EditingDomain; +import org.eclipse.jface.viewers.ISelection; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.Facet; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.FacetAttribute; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.FacetOperation; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.FacetReference; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.FacetSet; +import org.eclipse.modisco.facet.efacet.ui.internal.exported.wizard.ICreateFacetInFacetSetWizard2; +import org.eclipse.modisco.facet.efacet.ui.internal.exported.wizard.ICreateFacetSetWizard; +import org.eclipse.modisco.facet.efacet.ui.internal.exported.wizard.IFacetChildrenWizard2; + +/** + * This interface provides methods used to create wizards that create {@link Facet}s and Facet elements. + * + * TODO: This interface has to be renamed to IFacetUIFactory before the release of 0.2 + * + * @since 0.2 + */ +//TODO: This interface has to be renamed to IFacetUIFactory before the release of 0.2 +public interface IFacetUIFactory2 { + + /** + * Returns an instance of a {@link FacetUIFactoryImpl} + */ + IFacetUIFactory2 INSTANCE = null; //TODO cf. https://bugs.eclipse.org/bugs/show_bug.cgi?id=364601 + + /** + * Create a wizard dialog dedicated to the addition of a {@link Facet} in a {@link FacetSet} + * + * @param selection + * the current selection, should be a FacetSet + * @param editingDomain + * the editing domain used to perform the EMF command + * @return the newly created wizard + */ + public ICreateFacetInFacetSetWizard2 createCreateFacetInFacetSetWizardDialog(ISelection selection, EditingDomain editingDomain); + + /** + * Create a wizard dialog dedicated to the creation of a {@link FacetSet} + * + * @param selection + * the current selection + * @return the newly created wizard + */ + public ICreateFacetSetWizard createCreateFacetSetWizardDialog(ISelection selection); + + /** + * Create a wizard dialog dedicated to the creation of a {@link FacetSet} + * + * @param selection + * the current selection + * @param openCreatedFacetSetInEditor + * @return the newly created wizard + */ + public ICreateFacetSetWizard createCreateFacetSetWizardDialog(ISelection selection, boolean openCreatedFacetSetInEditor); + + /** + * Create a wizard dialog dedicated to the addition of a {@link FacetAttribute} in a {@link Facet} + * + * @param selection + * the current selection, should be a Facet + * @param editingDomain + * the editing domain used to perform the EMF command + * @return the newly created wizard + */ + public IFacetChildrenWizard2 createAddFacetAttributeWizardDialog(ISelection selection, EditingDomain editingDomain); + + /** + * Create a wizard dialog dedicated to the addition of a {@link FacetOperation} in a {@link Facet} + * + * @param selection + * the current selection, should be a Facet + * @param editingDomain + * the editing domain used to perform the EMF command + * @return the newly created wizard + */ + public IFacetChildrenWizard2 createAddFacetOperationWizardDialog(ISelection selection, EditingDomain editingDomain); + + /** + * Create a wizard dialog dedicated to the addition of a {@link EParameter} to a {@link FacetOperation} + * + * @param selection + * the current selection, should be a FacetOperation + * @param editingDomain + * the editing domain used to perform the EMF command + * @return the newly created wizard + */ + public IFacetChildrenWizard2 createAddFacetOperationParameterWizardDialog(ISelection selection, EditingDomain editingDomain); + + /** + * Create a wizard dialog dedicated to the addition of a {@link FacetReference} in a {@link Facet} + * + * @param selection + * the current selection, should be a Facet Reference + * @param editingDomain + * the editing domain used to perform the EMF command + * @return the newly created wizard + */ + public IFacetChildrenWizard2 createAddFacetReferenceWizardDialog(ISelection selection, EditingDomain editingDomain); + +}
diff --git a/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/modisco/facet/efacet/ui/internal/IQueryCreationPagePart2.java b/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/modisco/facet/efacet/ui/internal/IQueryCreationPagePart2.java new file mode 100644 index 0000000..584e4c4 --- /dev/null +++ b/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/modisco/facet/efacet/ui/internal/IQueryCreationPagePart2.java
@@ -0,0 +1,168 @@ +/** + * Copyright (c) 2011 Mia-Software. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Nicolas Guyomar (Mia-Software) - Bug 349546 - EMF Facet facetSet editor + * Gregoire Dupe (Mia-Software) - Bug 361617 - Deprecation of APIs for the old Facet metamodels + */ +package org.eclipse.modisco.facet.efacet.ui.internal; + +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.EClassifier; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.FacetSet; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.extensible.Query; +import org.eclipse.swt.events.ModifyListener; +import org.eclipse.swt.widgets.Composite; + +/** + * This interface has to be implemented by {@link Query} factory UI Class. It is used to complete a + * generic {@link Query} creation wizard with specific widget. + * + * TODO: This interface has to be renamed to IQueryCreationPagePart before the release of 0.2 + * + * @since 0.2 + */ +//TODO: This interface has to be renamed to IQueryCreationPagePart before the release of 0.2 +public interface IQueryCreationPagePart2 { + + /** + * Set the {@link Query}'s {@link FacetSet}. + * + * @param facetSet + * the given {@link FacetSet} + */ + public void setFacetSet(FacetSet facetSet); + + /** + * Set the {@link Query}'s upperBound. + * + * @param upperBound + * the upperBound. + */ + public void setUpperBound(int upperBound); + + /** + * Set the {@link Query}'s lowerBound. + * + * @param lowerBound + * the lowerBound. + */ + public void setLowerBound(int lowerBound); + + /** + * Set the {@link Query}'s {@link Query#isOrdered() <em>attribute</em>} attribute. + * + * @param ordered + * whether + */ + public void setOrdered(final boolean ordered); + + /** + * Set the {@link Query}'s {@link Query#isUnique() <em>unique</em>} attribute. + * + * @param unique + * Whether the query is unique or not. + */ + public void setUnique(final boolean unique); + + /** + * Set the {@link Query}'s type. + * + * @param queryType + * the {@link Query}'s type. + */ + public void setQueryType(EClassifier queryType); + + /** + * Set the {@link Query}'s name. + * + * @param name + * the query's name. + */ + public void setQueryName(String name); + + /** + * Set the {@link Query}'s {@link Query#isCanBeCached() <em>Can Be Cached</em>}. + * + * @param canBeCached + * whether the query result can be cached. + */ + public void setCanBeCached(boolean canBeCached); + + /** + * Set the {@link Query}'s {@link Query#isHasSideEffect() <em>Has Side Effect</em>}. + * + * @param hasSideEffect + * whether the query has side effect, such as modifying a model when applied on it. + */ + public void setHasSideEffect(boolean hasSideEffect); + + /** + * Set the {@link Query}'s '{@link Query#getScope <em>Scope</em>}'. + * + * @param type + * the {@link Query}'s '{@link Query#getScope <em>Scope</em>}'. + */ + public void setQueryScope(EClass scope); + + /** + * This method is dedicated to create a {@link Query} with every attribute set by the others + * methods of {@link IQueryCreationPagePart2}. + * + * @return the newly created {@link Query} + */ + public Query performFinish(); + + /** + * This method is called by the {@link org.eclipse.emf.facet.efacet.ui.internal.wizards.pages.CreateQueryWizardPage}. + * + * @param parent + * the Wizard's composite to be completed with specific widget for this {@link Query} creation. + */ + public void completeComposite(Composite parent); + + /** + * Returns <code>true</code> if the composite is complete. + * + * @return <code>true</code> if the composite is complete. + */ + public boolean isCompositeComplete(); + + /** + * Returns the error messages generated by the part, or null if none. + * + * @return the error messages generated by the part, or null if none. + */ + public String getErrorMessage(); + + /** + * Add a {@link ModifyListener} on the part. + * + * @param listener + * a {@link ModifyListener} + */ + public void addModifyListener(ModifyListener listener); + + /** + * Remove an existing {@link ModifyListener} from the part's listener. + * + * @param listener + * an existing {@link ModifyListener} listener. + */ + public void removeModifyListener(ModifyListener listener); + + /** + * Notify the registered listener that something has been modified in the part. It should only + * be used as a way to update the buttons' state of the containing wizard dialog. + * + * @param modifiedComposite + * the composite on which the modification occured. + */ + public void notifyCompositeListeners(Composite modifiedComposite); + +}
diff --git a/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/modisco/facet/efacet/ui/internal/IQueryCreationPagePart2Registry.java b/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/modisco/facet/efacet/ui/internal/IQueryCreationPagePart2Registry.java new file mode 100644 index 0000000..7e85c23 --- /dev/null +++ b/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/modisco/facet/efacet/ui/internal/IQueryCreationPagePart2Registry.java
@@ -0,0 +1,50 @@ +/** + * Copyright (c) 2011 Mia-Software. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Nicolas Guyomar (Mia-Software) - Bug 349546 - EMF Facet facetSet editor + * Gregoire Dupe (Mia-Software) - Bug 361617 - Deprecation of APIs for the old Facet metamodels + */ +package org.eclipse.modisco.facet.efacet.ui.internal; + +import java.util.Map; + +import org.eclipse.emf.ecore.EClass; + +/** + * This interface is dedicated to the registry + * + * TODO: This interface has to be renamed to IQueryCreationPagePartRegistry before the release of 0.2 + * + * @since 0.2 + */ +//TODO: This interface has to be renamed to IQueryCreationPagePartRegistry before the release of 0.2 +public interface IQueryCreationPagePart2Registry { + + /** + * Returns an instance of {@link QueryCreationPagePartRegistryImpl}. + */ + IQueryCreationPagePart2Registry INSTANCE = null; //TODO cf. https://bugs.eclipse.org/bugs/show_bug.cgi?id=364601 + + /** + * Return a registered {@link IQueryCreationPagePart} corresponding to the given type name. + * + * @param managedTypeName + * the type we need a part for. + * @return a registered {@link IQueryCreationPagePart} corresponding to the given type name. + */ + public IQueryCreationPagePart2 getWizardPagePartFor(EClass managedQueryType); + + /** + * Returns every registered {@link IQueryCreationPagePart} associated with their managed type. + * + * @return + */ + public Map<String, IQueryCreationPagePart2> getRegisteredWizardPageParts(); + +}
diff --git a/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/modisco/facet/efacet/ui/internal/ImageProvider.java b/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/modisco/facet/efacet/ui/internal/ImageProvider.java new file mode 100644 index 0000000..c7888be --- /dev/null +++ b/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/modisco/facet/efacet/ui/internal/ImageProvider.java
@@ -0,0 +1,106 @@ +/******************************************************************************* + * Copyright (c) 2009, 2012 Mia-Software. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Grégoire Dupé (Mia-Software) + * Nicolas Bros (Mia-Software) + * Nicolas Guyomar (Mia-Software) - Bug 339874 - Infra QuerySelectionDialog should have a "querySet" icon + * Gregoire Dupe (Mia-Software) - Bug 364325 - [Restructuring] The user must be able to navigate into a model using the Facet. + ********************************************************************************/ +package org.eclipse.modisco.facet.efacet.ui.internal; + +import org.eclipse.jface.resource.ImageDescriptor; +import org.eclipse.modisco.facet.util.core.Logger; +import org.eclipse.osgi.util.NLS; +import org.eclipse.swt.graphics.Image; +import org.eclipse.ui.plugin.AbstractUIPlugin; + +/** + * @author Grégoire Dupé (Mia-Software) + */ +@Deprecated +//Copied from org.eclipse.emf.facet.infra.query.ui.ImageProvider +public final class ImageProvider { + // private static final String MODEL_QUERY = "icons/modelQuery.png"; //$NON-NLS-1$ + private static final String REMOVE = "icons/remove.gif"; //$NON-NLS-1$ + private static final String REMOVE_ALL = "icons/removeAll.gif"; //$NON-NLS-1$ + private static final String MODEL_QUERY_SET = "icons/ModelQuerySet.gif"; //$NON-NLS-1$ + + private static ImageProvider singleton; + + private Image modelQuerySet; + // private Image modelQuery; + // private Image remove; + // private Image removeAll; + + private ImageProvider() { + // This method must not be instantiated + } + + /** + * Create an image descriptor from a resource + * + * @param resourcePath + * the path of the resource (in the bundle) + * @return the image descriptor + */ + private ImageDescriptor createImageDescriptor(final String resourcePath) { + ImageDescriptor imageDescriptor = AbstractUIPlugin.imageDescriptorFromPlugin( + Activator.PLUGIN_ID, resourcePath); + if (imageDescriptor == null) { + Logger.logError(NLS.bind("Resource not found: {0}", resourcePath), Activator //$NON-NLS-1$ + .getDefault()); + return ImageDescriptor.getMissingImageDescriptor(); + } + return imageDescriptor; + } + + public static ImageProvider getInstance() { + if (ImageProvider.singleton == null) { + ImageProvider.singleton = new ImageProvider(); + } + return ImageProvider.singleton; + } + + public Image getModelQuerySet() { + if (this.modelQuerySet == null) { + this.modelQuerySet = createImageDescriptor(ImageProvider.MODEL_QUERY_SET).createImage(); + } + return this.modelQuerySet; + } + // + // public Image getModelQuery() { + // if (this.modelQuery == null) { + // this.modelQuery = + // createImageDescriptor(ImageProvider.MODEL_QUERY).createImage(); + // } + // return this.modelQuery; + // } + + // public Image getRemove() { + // if (this.remove == null) { + // this.remove = createImageDescriptor(ImageProvider.REMOVE).createImage(); + // } + // return this.remove; + // } + // + // public Image getRemoveAll() { + // if (this.removeAll == null) { + // this.removeAll = + // createImageDescriptor(ImageProvider.REMOVE_ALL).createImage(); + // } + // return this.removeAll; + // } + + public ImageDescriptor getRemoveImageDescriptor() { + return createImageDescriptor(ImageProvider.REMOVE); + } + + public ImageDescriptor getRemoveAllImageDescriptor() { + return createImageDescriptor(ImageProvider.REMOVE_ALL); + } +}
diff --git a/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/modisco/facet/efacet/ui/internal/Messages.java b/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/modisco/facet/efacet/ui/internal/Messages.java new file mode 100644 index 0000000..af1cb04 --- /dev/null +++ b/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/modisco/facet/efacet/ui/internal/Messages.java
@@ -0,0 +1,174 @@ +/** + * Copyright (c) 2011, 2015 Mia-Software, CEA-LIST, and Soft-Maint. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Nicolas Guyomar (Mia-Software) - Bug 349546 - EMF Facet facetSet editor + * Nicolas Bros (Mia-Software) - Bug 370442 - rewrite the Facet loading dialog for v0.2 + * Grégoire Dupé (Mia-Software) - copied from org.eclipse.emf.facet.infra.query.ui.Messages + * Nicolas Bros (Mia-Software) - copied from org.eclipse.emf.facet.infra.query.ui.Messages + * Gregoire Dupe (Mia-Software) - Bug 364325 - [Restructuring] The user must be able to navigate into a model using the Facet. + * Nicolas Bros (Mia-Software) - Bug 372732 - [Facet] Rewrite the catalog views for 0.2 + * Nicolas Bros (Mia-Software) - Bug 372865 - FacetSet selection dialog + * Vincent Lorenzo (CEA-LIST) - Bug 357621 - Improve the label displayed for Customization and Facets + * Nicolas Bros (Mia-Software) - Bug 379518 - NLS missing messages + * Jonathan Pepin (Soft-Maint) - Bug 463907 - Command for load and save Facet serialization + * Grégoire Dupé (Mia-Software) - Bug 480654 - IllegalStateException in NavigationView.addEObjects (611) + */ +package org.eclipse.modisco.facet.efacet.ui.internal; + +import org.eclipse.osgi.util.NLS; + +public class Messages extends NLS { + private static final String BUNDLE_NAME = "org.eclipse.emf.facet.efacet.ui.internal.messages"; //$NON-NLS-1$ + + public static String Enter_a_nsUri; + public static String Please_enter_nsUri; + + public static String Enter_a_prefix; + public static String ETypedElementSelectionControl_FlatView; + + public static String ETypedElementSelectionControl_invalidSelectionAtLeastOneElement; + public static String ETypedElementSelectionControl_invalidSelection; + public static String ETypedElementSelectionControl_invalidSelectionAtMostXElements; + public static String ETypedElementSelectionControl_invalidSelectionETypedElementsOnly; + public static String ETypedElementSelectionDialog_dialogTitle; + public static String ETypedElementSelectionDialog_dialogTitleMultiSelection; + public static String ETypedElementSelectionDialog_radioButtonMultiSelection; + public static String ETypedElementSelectionDialog_radioButtonNoSelection; + public static String ETypedElementSelectionDialog_radioButtonSingleSelection; + + public static String ETypedElementSelectionSortedControl_groupByMetamodelView; + + public static String ETypedElementSelectionSortedControl_toolTip; + + public static String Please_enter_prefix; + + public static String Please_select_EPackage; + public static String SaveStructuralFeatureInstanceModelHandler_FailedToSaveTheStructuralFeatureInstanceModel; + + public static String Select_EPackage; + + public static String Operation; + public static String Parameter_name; + public static String Operation_name; + public static String Reference_name; + public static String Attribute_name; + + public static String Add_an_Attribute; + public static String Add_an_Attribute_desc; + public static String Add_a_Reference; + public static String Add_a_Reference_desc; + public static String Add_an_Operation; + public static String Add_an_Operation_desc; + public static String Add_an_Operation_Parameter; + public static String Add_an_Operation_Parameter_desc; + + public static String FacetSet; + public static String FacetSetsCatalogView_categoriesColumn; + public static String FacetSetsCatalogView_documentationColumn; + public static String FacetSetsCatalogView_extendsColumn; + public static String FacetSetsCatalogView_nameColumn; + public static String FacetSetsCatalogView_viewTitle; + public static String FacetSetSelectionControl_mustSelectAtLeastOneElement; + public static String FacetSetSelectionControl_mustSelectAtMostNElements; + public static String FacetSetSelectionControl_onlyFacetSetsAllowedInSelection; + public static String FacetSetSelectionControl_selectionContainsInvalidElements; + public static String FacetSetSelectionDialog_deselectAll; + public static String FacetSetSelectionDialog_selectAll; + public static String FacetSetSelectionDialog_titleSelectFacetSet; + public static String FacetSetSelectionDialog_titleSelectFacetSets; + public static String Facet; + + public static String Changeable; + public static String Derived; + public static String Ordered; + public static String Transient; + public static String Unique; + public static String Volatile; + + public static String Lower_bound; + public static String Upper_bound; + + public static String UriWidget_EmfUri; + + public static String Select_EClass; + public static String Select_EClassifier; + public static String Select_EDataType; + + public static String NavigationView_eObjectsMustBeInTheSameResourceSet; + + public static String No_result_found; + + public static String Select; + public static String Type; + + public static String Create_FacetSet_Model; + + public static String CreateFacetInFacetSetWizardPage_could_not_find_wizard_page; + public static String Please_enter_value_for; + public static String Create_facet_in_facetSet; + + public static String CreateFacetInFacetSetWizardPage_Please_fill_extendedMetaClass; + public static String CreateFacetInFacetSetWizardPage_Sub_Typing_Facet; + public static String CreateFacetInFacetSetWizardPage_wizard_description; + public static String CreateFacetSetWizardImpl_Create_new_facet_Set; + public static String CreateFacetSetWizardImpl_FacetModel; + public static String CreateFacetSetWizardImpl_File_extension_restriction; + + public static String CreateFacetSetWizardPage_Not_a_Plugin_project; + public static String Create_Query; + public static String FilteredElementSelectionControl_type_filter_text; + public static String Load_MetaModel_Resource; + public static String FacetSetSelectionDialog_selectFacetSetsMessage; + public static String FacetSetSelectionDialog_selectFacetSetsTitle; + public static String Package_Selection; + public static String Select_Registered_URI; + + public static String ExtendedMetaClass; + public static String SelectQueryTypeWizardPage_No_wizard_found; + public static String SelectQueryTypeWizardPage_Query_Type; + + public static String SetStructuralFeatureInstanceResourceHandler_SerializationUriSettigFailed; + public static String JavaQueryWizardPage_Can_be_cached; + public static String JavaQueryWizardPage_has_side_effect; + public static String JavaQueryWizardPage_Query_name; + + //Begin copied from org.eclipse.emf.facet.infra.query.ui.Messages + public static String QueryExecutionView_0; + public static String QueryExecutionView_1; + public static String QueryExecutionView_classpathWarning; + public static String QueryExecutionView_errorInBundleClasspath; + public static String QueryExecutionView_execEnvNotAvailable; + public static String QueryExecutionView_execEnvError; + public static String QueryExecutionView_Context; + public static String QueryExecutionView_DisplayResultIn; + public static String QueryExecutionView_dragAndDropHint; + public static String QueryExecutionView_ErrorExecutingQuery; + + public static String QueryExecutionView_ETypedElementsGroup; + public static String QueryExecutionView_ExecuteButton; + public static String QueryExecutionView_ExecuteGroup; + public static String QueryExecutionView_NoQueryDisplayer; + public static String QueryExecutionView_NoQuerySelected; + public static String QueryExecutionView_NullQueryResult; + public static String QueryExecutionView_notImplementedYet; + public static String QueryExecutionView_Parameters; + public static String QueryExecutionView_Query; + public static String QueryExecutionView_QueryException; + public static String QueryExecutionView_QueryReturnedNull; + public static String QueryExecutionView_SelectQueryToExecute; + //End copied from org.eclipse.emf.facet.infra.query.ui.Messages + + static { + // initialize resource bundle + NLS.initializeMessages(Messages.BUNDLE_NAME, Messages.class); + } + + private Messages() { + } +}
diff --git a/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/modisco/facet/efacet/ui/internal/actions/LoadMetaModelResourceAction.java b/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/modisco/facet/efacet/ui/internal/actions/LoadMetaModelResourceAction.java new file mode 100644 index 0000000..b492ac5 --- /dev/null +++ b/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/modisco/facet/efacet/ui/internal/actions/LoadMetaModelResourceAction.java
@@ -0,0 +1,100 @@ +/******************************************************************************* + * Copyright (c) 2009,2011 Mia-Software. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Gregoire DUPE (Mia-Software) - initial API and implementation + *******************************************************************************/ +package org.eclipse.modisco.facet.efacet.ui.internal.actions; + +import java.util.Arrays; + +import org.eclipse.emf.common.util.URI; +import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.ecore.EPackage; +import org.eclipse.emf.ecore.EPackage.Registry; +import org.eclipse.emf.ecore.provider.EcoreEditPlugin; +import org.eclipse.emf.ecore.resource.Resource; +import org.eclipse.emf.ecore.resource.ResourceSet; +import org.eclipse.emf.edit.ui.action.LoadResourceAction; +import org.eclipse.emf.edit.ui.provider.ExtendedImageRegistry; +import org.eclipse.jface.viewers.LabelProvider; +import org.eclipse.modisco.facet.common.ui.internal.widgets.AnywhereFilterMatcher; +import org.eclipse.modisco.facet.efacet.ui.internal.Messages; +import org.eclipse.swt.graphics.Image; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Control; +import org.eclipse.swt.widgets.Shell; +import org.eclipse.ui.PlatformUI; +import org.eclipse.ui.dialogs.ElementListSelectionDialog; + +// This class has been copied from org.eclipse.emf.facet.infra.facet.editor.presentation.LoadMetaModelResourceAction + +/** + * @author Gregoire Dupe + * + */ +public class LoadMetaModelResourceAction extends LoadResourceAction { + + public LoadMetaModelResourceAction() { + super(); + setText(Messages.Load_MetaModel_Resource); + } + + @Override + public void run() { + Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(); + + RegisteredPackageDialog registeredPackageDialog = new RegisteredPackageDialog(shell); + registeredPackageDialog.open(); + Object[] results = registeredPackageDialog.getResult(); + // if user cancel the selection of meta models, results = null + if (results != null) { + ResourceSet resourceSet = this.domain.getResourceSet(); + for (Object result : results) { + URI uri = URI.createURI(result.toString()); + Resource r = resourceSet.getResource(uri, true); + if (!resourceSet.getResources().contains(r)) { + Registry packageRegistry = resourceSet.getPackageRegistry(); + for (EObject eObject : r.getContents()) { + if (eObject instanceof EPackage) { + EPackage ePackage = (EPackage) eObject; + packageRegistry.put(ePackage.getNsURI(), ePackage); + } + } + resourceSet.getResources().add(r); + } + } + } + } + + public class RegisteredPackageDialog extends ElementListSelectionDialog { + + public RegisteredPackageDialog(final Shell parent) { + super(parent, new LabelProvider() { + @Override + public Image getImage(final Object element) { + return ExtendedImageRegistry.getInstance().getImage(EcoreEditPlugin.INSTANCE.getImage("full/obj16/EPackage")); //$NON-NLS-1$ + } + }); + + setMultipleSelection(true); + setMessage(Messages.Select_Registered_URI); + setTitle(Messages.Package_Selection); + Object[] result = EPackage.Registry.INSTANCE.keySet().toArray(new Object[EPackage.Registry.INSTANCE.size()]); + Arrays.sort(result); + setElements(result); + } + + @Override + protected Control createDialogArea(final Composite parent) { + Composite composite = (Composite) super.createDialogArea(parent); + this.fFilteredList.setFilterMatcher(new AnywhereFilterMatcher()); + return composite; + } + } + +}
diff --git a/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/modisco/facet/efacet/ui/internal/actions/ShortcutFacetSetAction.java b/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/modisco/facet/efacet/ui/internal/actions/ShortcutFacetSetAction.java new file mode 100644 index 0000000..2f1985b --- /dev/null +++ b/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/modisco/facet/efacet/ui/internal/actions/ShortcutFacetSetAction.java
@@ -0,0 +1,59 @@ +/******************************************************************************* + * Copyright (c) 2015 Mia-Software + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Thomas Cicognani (Mia-Software) - Bug 472075 - Update API to create UI shortcuts to activate FacetSets + *******************************************************************************/ +package org.eclipse.modisco.facet.efacet.ui.internal.actions; + +import java.util.HashSet; +import java.util.List; +import java.util.Set; + +import org.eclipse.emf.ecore.resource.ResourceSet; +import org.eclipse.jface.action.Action; +import org.eclipse.jface.resource.ImageDescriptor; +import org.eclipse.modisco.facet.efacet.core.IFacetManager; +import org.eclipse.modisco.facet.efacet.core.IFacetSetCatalogManager; +import org.eclipse.modisco.facet.efacet.core.IFacetSetCatalogManagerFactory; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.FacetSet; +import org.eclipse.modisco.facet.efacet.ui.FacetSetShortcutActionUtils; + +public class ShortcutFacetSetAction extends Action { + + private final String actionId; + private final IFacetManager facetManager; + + public ShortcutFacetSetAction(final String actionId, final String label, + final ImageDescriptor imageDescriptor, + final IFacetManager facetManager) { + super(label, AS_CHECK_BOX); + this.actionId = actionId; + this.facetManager = facetManager; + FacetSetShortcutActionUtils.setImageDescriptor(this, imageDescriptor); + } + + @Override + public void run() { + FacetSetShortcutActionUtils.runAction(this, this.actionId, + getAvailableFacetSets(), getAppliedFacetSets()); + } + + private Set<FacetSet> getAvailableFacetSets() { + final ResourceSet resourceSet = this.facetManager.getResourceSet(); + final IFacetSetCatalogManager catalog = IFacetSetCatalogManagerFactory.DEFAULT + .getOrCreateFacetSetCatalogManager(resourceSet); + final HashSet<FacetSet> availableFS = new HashSet<FacetSet>(); + availableFS.addAll(catalog.getRegisteredFacetSets()); + return availableFS; + } + + private List<FacetSet> getAppliedFacetSets() { + return this.facetManager.getManagedFacetSets(); + } + +}
diff --git a/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/modisco/facet/efacet/ui/internal/composites/BrowseComposite.java b/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/modisco/facet/efacet/ui/internal/composites/BrowseComposite.java new file mode 100644 index 0000000..c6e2451 --- /dev/null +++ b/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/modisco/facet/efacet/ui/internal/composites/BrowseComposite.java
@@ -0,0 +1,124 @@ +/** + * Copyright (c) 2011 Mia-Software. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Nicolas Guyomar (Mia-Software) - Bug 349546 - EMF Facet facetSet editor + * Gregoire Dupe (Mia-Software) - Bug 373248 - Clean PMD errors + */ +package org.eclipse.modisco.facet.efacet.ui.internal.composites; + +import org.eclipse.swt.SWT; +import org.eclipse.swt.events.KeyEvent; +import org.eclipse.swt.events.KeyListener; +import org.eclipse.swt.events.ModifyListener; +import org.eclipse.swt.events.SelectionEvent; +import org.eclipse.swt.events.SelectionListener; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.widgets.Button; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Display; +import org.eclipse.swt.widgets.Text; + +@SuppressWarnings("PMD.ConstructorCallsOverridableMethod") +//@SuppressWarnings("PMD.ConstructorCallsOverridableMethod") Temporary: this class must be deeply refactored. +//TODO remove the @SuppressWarnings("PMD.ConstructorCallsOverridableMethod") +//cf. bug https://bugs.eclipse.org/bugs/show_bug.cgi?id=373248 +public class BrowseComposite extends Composite { + + private Text textField; + private Button browseButton; + private String browseButtonText = "..."; //$NON-NLS-1$ + + public BrowseComposite(final Composite parent, final int style) { + this(parent, style, null, true); + } + + public BrowseComposite(final Composite parent, final int style, final String buttonName, final boolean canBeChanged) { + super(parent, SWT.NONE); + if (buttonName != null) { + this.browseButtonText = buttonName; + } + setEnabled(canBeChanged); + GridLayout layout = new GridLayout(); + layout.marginHeight = 0; + layout.marginWidth = 0; + final int horizontalSpacing = 4; + layout.horizontalSpacing = horizontalSpacing; + layout.verticalSpacing = 0; + layout.makeColumnsEqualWidth = false; + layout.numColumns = 2; + setLayout(layout); + setLayoutData(new GridData(SWT.FILL, SWT.NONE, true, false)); + createWidgets(style); + init(); + } + + public void addModifyListener(final ModifyListener modifyListener) { + if (this.textField != null) { + this.textField.addModifyListener(modifyListener); + } + } + + public void removeModifyListener(final ModifyListener modifyListener) { + if (this.textField != null) { + this.textField.removeModifyListener(modifyListener); + } + } + + protected void createWidgets(final int style) { + this.textField = new Text(this, SWT.SINGLE | style); + this.browseButton = new Button(this, SWT.PUSH); + } + + private void init() { + this.textField.setEditable(false); + // We want the background white so that the user notices that there is something missing in + // the textField, but he has to use the "..." button + this.textField.setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_WHITE)); + this.textField.setBounds(getBounds()); + this.textField.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false)); + this.textField.addKeyListener(new KeyListener() { + public void keyReleased(final KeyEvent e) { + // Nothing on release + } + + public void keyPressed(final KeyEvent event) { + // Enter key pressed + if ((event.keyCode == SWT.CR && event.stateMask == 0) || (event.keyCode == SWT.KEYPAD_CR && event.stateMask == 0)) { + handleBrowse(); + } + } + }); + + this.browseButton.setText(this.browseButtonText); + this.browseButton.setEnabled(isEnabled()); + GridData data = new GridData(SWT.FILL, SWT.FILL, false, true); + this.browseButton.setLayoutData(data); + this.browseButton.addSelectionListener(new SelectionListener() { + public void widgetSelected(final SelectionEvent e) { + handleBrowse(); + } + + public void widgetDefaultSelected(final SelectionEvent e) { + // Nothing + } + }); + } + + protected void handleBrowse() { + // Meant to be overridden + } + + public void updateTextFieldContent(final String content) { + if (this.textField != null) { + this.textField.setText(content); + this.textField.setFocus(); + } + } +}
diff --git a/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/modisco/facet/efacet/ui/internal/composites/FilteredElementSelectionComposite.java b/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/modisco/facet/efacet/ui/internal/composites/FilteredElementSelectionComposite.java new file mode 100644 index 0000000..1258317 --- /dev/null +++ b/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/modisco/facet/efacet/ui/internal/composites/FilteredElementSelectionComposite.java
@@ -0,0 +1,134 @@ +/******************************************************************************* + * Copyright (c) 2010, 2011 Mia-Software. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Nicolas Bros (Mia-Software) - initial API and implementation + *******************************************************************************/ +package org.eclipse.modisco.facet.efacet.ui.internal.composites; + +import org.eclipse.jface.viewers.LabelProvider; +import org.eclipse.modisco.facet.efacet.ui.internal.Messages; +import org.eclipse.swt.SWT; +import org.eclipse.swt.events.KeyEvent; +import org.eclipse.swt.events.KeyListener; +import org.eclipse.swt.events.ModifyEvent; +import org.eclipse.swt.events.ModifyListener; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Text; +import org.eclipse.ui.dialogs.FilteredList; + +/** + * A control for selecting an element from a list of elements, that can be filtered using the + * associated text field. + */ +public class FilteredElementSelectionComposite extends Composite { + + private final Text filterText; + private final FilteredList fFilteredList; + + public FilteredElementSelectionComposite(final Composite parent, final boolean matchAnywhere, final boolean multiSelection) { + super(parent, SWT.BORDER); + setLayout(new GridLayout()); + + this.filterText = createFilterText(this); + this.fFilteredList = createFilteredList(this, multiSelection); + + final String matchPrefix; + if (matchAnywhere) { + matchPrefix = "*"; //$NON-NLS-1$ + } else { + matchPrefix = ""; //$NON-NLS-1$ + } + + this.filterText.addModifyListener(new ModifyListener() { + public void modifyText(final ModifyEvent e) { + getfFilteredList().setFilter(matchPrefix + getFilterText().getText()); + } + }); + + this.filterText.addKeyListener(new KeyListener() { + public void keyPressed(final KeyEvent e) { + if (e.keyCode == SWT.ARROW_DOWN) { + getfFilteredList().setFocus(); + } + } + + public void keyReleased(final KeyEvent e) { + // nothing + } + }); + } + + public void setElements(final Object[] elements) { + this.fFilteredList.setElements(elements); + } + + protected static FilteredList createFilteredList(final Composite parent, final boolean multiSelection) { + int multi; + if (multiSelection) { + multi = SWT.MULTI; + } else { + multi = SWT.SINGLE; + } + final FilteredList filteredList = new FilteredList(parent, SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL | multi, new LabelProvider(), true, + false, true); + + final GridData data = new GridData(); + data.grabExcessVerticalSpace = true; + data.grabExcessHorizontalSpace = true; + data.horizontalAlignment = GridData.FILL; + data.verticalAlignment = GridData.FILL; + filteredList.setLayoutData(data); + filteredList.setFilter(""); //$NON-NLS-1$ + + return filteredList; + } + + protected static Text createFilterText(final Composite parent) { + final Text text = new Text(parent, SWT.BORDER); + text.setMessage(Messages.FilteredElementSelectionControl_type_filter_text); + + final GridData data = new GridData(); + data.grabExcessVerticalSpace = false; + data.grabExcessHorizontalSpace = true; + data.horizontalAlignment = GridData.FILL; + data.verticalAlignment = GridData.BEGINNING; + text.setLayoutData(data); + + return text; + } + + public Object getFirstSelectedElement() { + final Object[] selection = this.fFilteredList.getSelection(); + if (selection.length > 0) { + return selection[0]; + } + return null; + } + + public Object[] getSelectedElements() { + Object[] selection = this.fFilteredList.getSelection(); + if (selection.length == 0) { + return null; + } + return selection; + } + + public FilteredList getFilteredList() { + return this.fFilteredList; + } + + public Text getFilterText() { + return this.filterText; + } + + protected FilteredList getfFilteredList() { + return this.fFilteredList; + } +}
diff --git a/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/modisco/facet/efacet/ui/internal/composites/SelectETypeComposite.java b/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/modisco/facet/efacet/ui/internal/composites/SelectETypeComposite.java new file mode 100644 index 0000000..fe61078 --- /dev/null +++ b/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/modisco/facet/efacet/ui/internal/composites/SelectETypeComposite.java
@@ -0,0 +1,172 @@ +/** + * Copyright (c) 2011 Mia-Software. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Nicolas Guyomar (Mia-Software) - Bug 349546 - EMF Facet facetSet editor + * Gregoire Dupe (Mia-Software) - Bug 373248 - Clean PMD errors + */ +package org.eclipse.modisco.facet.efacet.ui.internal.composites; + +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.EClassifier; +import org.eclipse.emf.ecore.EPackage; +import org.eclipse.emf.edit.domain.EditingDomain; +import org.eclipse.jface.window.Window; +import org.eclipse.modisco.facet.efacet.ui.internal.Messages; +import org.eclipse.modisco.facet.efacet.ui.internal.wizards.SelectETypeWizardImpl; +import org.eclipse.swt.SWT; +import org.eclipse.swt.events.SelectionAdapter; +import org.eclipse.swt.events.SelectionEvent; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.widgets.Button; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Label; +import org.eclipse.swt.widgets.Text; + +@SuppressWarnings("PMD.ConstructorCallsOverridableMethod") +//@SuppressWarnings("PMD.ConstructorCallsOverridableMethod") Temporary: this class must be deeply refactored. +//TODO remove the @SuppressWarnings("PMD.ConstructorCallsOverridableMethod") +//cf. bug https://bugs.eclipse.org/bugs/show_bug.cgi?id=373248 +public class SelectETypeComposite extends Composite { + + private static final int NUMBER_COLUMN = 3; + + /** to be returned by the composite */ + private EClassifier selectedEType = null; + + private EditingDomain editingDomain; + + private Label eTypeLabel; + private Button selectButton; + private Text eTypedTextField; + + private ETypeSelectionOptions eTypeSelectionOption; + + private boolean canChangeEPackage = true; + + private final EPackage ePackage; + + public enum ETypeSelectionOptions { + ECLASSIFIER, EDATATYPE, ECLASS + } + + public SelectETypeComposite(final Composite parent, final int style, final ETypeSelectionOptions option, final boolean canChangeEPackage, + final EPackage ePackage) { + super(parent, style); + this.eTypeSelectionOption = option; + this.ePackage = ePackage; + this.canChangeEPackage = canChangeEPackage; + init(); + } + + protected void createCompositeWidget() { + this.eTypeLabel = new Label(this, SWT.NULL); + this.eTypedTextField = new Text(this, SWT.BORDER | SWT.SINGLE); + this.selectButton = new Button(this, SWT.PUSH); + } + + private void init() { + GridLayout gridLayout = new GridLayout(SelectETypeComposite.NUMBER_COLUMN, false); + setLayout(gridLayout); + createCompositeWidget(); + initializeWidgets(); + initializeLabelText(); + } + + private void initializeLabelText() { + this.eTypeLabel.setText(Messages.Type); + this.selectButton.setText(Messages.Select); + } + + protected void initializeWidgets() { + GridData gd = new GridData(GridData.FILL_HORIZONTAL); + this.eTypedTextField.setLayoutData(gd); + + this.selectButton.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(final SelectionEvent e) { + SelectETypeComposite.this.handleBrowse(); + } + }); + } + + /** + * This method call the SelectETypeWizardImpl + */ + protected void handleBrowse() { + if (this.eTypeSelectionOption == null) { + this.eTypeSelectionOption = SelectETypeComposite.ETypeSelectionOptions.ECLASSIFIER; + } + SelectETypeWizardImpl dialog = new SelectETypeWizardImpl(this.editingDomain, this.eTypeSelectionOption, this.canChangeEPackage, this.ePackage); + if (dialog.open() != Window.CANCEL) { + setEClass(dialog.getSelectedEType()); + eTypeSelected(); + } + } + + protected void eTypeSelected() { + // Meant to be implemented + } + + public void setEClass(final EClassifier eClass) { + this.selectedEType = eClass; + if (eClass != null) { + this.eTypedTextField.setText(eClass.getName()); + this.eTypedTextField.redraw(); + this.eTypedTextField.setFocus(); + } + } + + public void canChangeEType(final boolean canChange) { + // this.eTypedTextField.setEditable(true); + // this.eTypedTextField.setEnabled(false); + this.selectButton.setEnabled(canChange); + } + + public EClassifier getEType() { + return this.selectedEType; + } + + protected void setQueryLabel(final Label queryLabel) { + this.eTypeLabel = queryLabel; + } + + protected void setBrowseButton(final Button browseButton) { + this.selectButton = browseButton; + } + + protected void setQueryNameTextField(final Text queryNameTextField) { + this.eTypedTextField = queryNameTextField; + } + + public void setETypeLabel(final Label eTypeLabel) { + this.eTypeLabel = eTypeLabel; + } + + public void setSelectButton(final Button selectButton) { + this.selectButton = selectButton; + } + + public void setETypedTextField(final Text eTypedTextField) { + this.eTypedTextField = eTypedTextField; + } + + public void setEditingDomain(final EditingDomain editingDomain2) { + this.editingDomain = editingDomain2; + } + + public void setEType(final EClass type) { + this.selectedEType = type; + if (this.eTypedTextField != null) { + this.eTypedTextField.setText(this.selectedEType.getName()); + this.eTypedTextField.redraw(); + } + } + +}
diff --git a/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/modisco/facet/efacet/ui/internal/dialogs/DefaultFacetLabelProvider.java b/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/modisco/facet/efacet/ui/internal/dialogs/DefaultFacetLabelProvider.java new file mode 100644 index 0000000..78c2e4a --- /dev/null +++ b/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/modisco/facet/efacet/ui/internal/dialogs/DefaultFacetLabelProvider.java
@@ -0,0 +1,46 @@ +/******************************************************************************* + * Copyright (c) 2012 Mia-Software. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Nicolas Bros (Mia-Software) - Bug 370442 - rewrite the Facet loading dialog for v0.2 + * Nicolas Bros(Mia-Software) - Bug 370806 - [table] rewrite the "allowed contents" query selection dialog for v0.2 + *******************************************************************************/ +package org.eclipse.modisco.facet.efacet.ui.internal.dialogs; + +import org.eclipse.emf.ecore.ENamedElement; +import org.eclipse.jface.viewers.LabelProvider; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.Facet; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.FacetSet; +import org.eclipse.modisco.facet.util.emf.ui.internal.utils.ImageUtils; +import org.eclipse.swt.graphics.Image; + +public class DefaultFacetLabelProvider extends LabelProvider { + @Override + public String getText(final Object element) { + String label; + if (element instanceof FacetSet) { + final FacetSet facetSet = (FacetSet) element; + label = facetSet.getName(); + } else if (element instanceof Facet) { + final Facet facet = (Facet) element; + label = facet.getName(); + } else if (element instanceof ENamedElement) { + final ENamedElement namedElement = (ENamedElement) element; + label = namedElement.getName(); + } else if (element == null) { + label = "null"; //$NON-NLS-1$ + } else { + label = element.getClass().getName(); + } + return label; + } + + @Override + public Image getImage(final Object element) { + return ImageUtils.getImage(element); + } +}
diff --git a/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/modisco/facet/efacet/ui/internal/dialogs/ETypedElementSelectionDialog.java b/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/modisco/facet/efacet/ui/internal/dialogs/ETypedElementSelectionDialog.java new file mode 100644 index 0000000..cd19ab5 --- /dev/null +++ b/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/modisco/facet/efacet/ui/internal/dialogs/ETypedElementSelectionDialog.java
@@ -0,0 +1,241 @@ +/******************************************************************************* + * Copyright (c) 2009, 2015 Mia-Software, and CEA-LIST. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Nicolas Bros (Mia-Software) + * Nicolas Guyomar (Mia-Software) - Bug 339874 - Infra QuerySelectionDialog should have a "querySet" icon + * Nicolas Bros (Mia-Software) - Bug 366367 - To be able to change the "CanBePresentedInTheTable" query + * Nicolas Bros (Mia-Software) - Bug 370806 - [table] rewrite the "allowed contents" query selection dialog for v0.2 + * Vincent Lorenzo (CEA-LIST) - Bug 372644 - Create Customizable tooltips for the TreeViewer using a CustomizableLabelProvider + * Vincent Lorenzo (CEA-LIST) - Bug 357621 - Improve the label displayed for Customization and Facets + * Gregoire Dupe (Mia-Software) - Bug 375087 - [Table] ITableWidget.addColumn(List<ETypedElement>, List<FacetSet>) + * Gregoire Dupe (Mia-Software) - Bug 372626 - Aggregates + * Nicolas Bros (Mia-Software) - Bug 370806 - [table] rewrite the "allowed contents" query selection dialog for v0.2 + * Thomas Cicognani (Mia-Software) - Bug 472075 - Update API to create UI shortcuts to activate FacetSets + *******************************************************************************/ +package org.eclipse.modisco.facet.efacet.ui.internal.dialogs; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.Collections; +import java.util.List; + +import org.eclipse.core.runtime.IStatus; +import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.ecore.EPackage; +import org.eclipse.emf.ecore.ETypedElement; +import org.eclipse.jface.dialogs.IDialogSettings; +import org.eclipse.jface.viewers.IOpenListener; +import org.eclipse.jface.viewers.ISelectionChangedListener; +import org.eclipse.jface.viewers.IStructuredSelection; +import org.eclipse.jface.viewers.OpenEvent; +import org.eclipse.jface.viewers.SelectionChangedEvent; +import org.eclipse.jface.window.Window; +import org.eclipse.modisco.facet.efacet.ui.internal.Activator; +import org.eclipse.modisco.facet.efacet.ui.internal.Messages; +import org.eclipse.modisco.facet.efacet.ui.internal.exported.dialog.IETypedElementSelectionDialogInternal; +import org.eclipse.modisco.facet.efacet.ui.internal.widget.ETypedElementSelectionControlManager; +import org.eclipse.modisco.facet.efacet.ui.internal.widget.IETypedElementSelectionControlManager; +import org.eclipse.modisco.facet.util.ui.internal.exported.dialog.IDialogCallbackWithPreCommit; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Control; +import org.eclipse.swt.widgets.Shell; +import org.eclipse.ui.dialogs.SelectionStatusDialog; + +/** + * A dialog to select an {@link ETypedElement} among a tree of {@link EObject}s that are children of a given set of root + * {@link EObject}s + */ +public class ETypedElementSelectionDialog<T2, D> extends SelectionStatusDialog + implements IETypedElementSelectionDialogInternal<D> { // NOPMD + + // note: the dialog should be large enough to see the validator message + private static final int DEFAULT_WIDTH = 550; + private static final int DEFAULT_HEIGHT = 550; + + private final boolean allowEmpty; + private final IDialogCallbackWithPreCommit<List<ETypedElement>, T2, D> callback; + private final Collection<? extends ETypedElement> availableElements; + private final int selectionMaxSize; + private IETypedElementSelectionControlManager manager; + private final Collection<? extends EPackage> knownEPackage; + + /** + * @param eTypedElements + * the list of ETypedElements that can be selected + * @param selectionMaxSize + * the maximum number of typed elements that the user can select + * @param allowEmpty + * whether to allow the user to select no ETypedElement (i.e : select <code>null</code>) + * @param callback + * called when the dialog closes + * @param parentShell + * the parent shell + * @param customManager + * the customization manager used by the ICustomizableLabelProvider + */ + public ETypedElementSelectionDialog(final Collection<? extends ETypedElement> eTypedElements, + final int selectionMaxSize, final boolean allowEmpty, + final IDialogCallbackWithPreCommit<List<ETypedElement>, T2, D> callback, + final Shell parentShell, + final Collection<? extends EPackage> knownEPackage) { + super(parentShell); + this.availableElements = eTypedElements; + this.selectionMaxSize = selectionMaxSize; + this.allowEmpty = allowEmpty; + this.callback = callback; + this.knownEPackage = knownEPackage; + setHelpAvailable(false); + + } + + @Override + protected Control createDialogArea(final Composite parent) { + final Composite composite = (Composite) super.createDialogArea(parent); + this.manager = new ETypedElementSelectionControlManager(composite, + this.selectionMaxSize, this.allowEmpty, this.knownEPackage); + this.manager.createContents(); + this.manager.setAvailableETypedElements(this.availableElements); + + // double-click or enter to choose the selected typed element + this.manager.addOpenListener(new IOpenListener() { + public void open(final OpenEvent event) { + ETypedElementSelectionDialog.this.okPressed(); + } + }); + + this.manager.addSelectionChangedListener(new ISelectionChangedListener() { + public void selectionChanged(final SelectionChangedEvent event) { + updateValidationStatus(); + } + }); + return composite; + } + + protected void updateValidationStatus() { + updateStatus(this.manager.getValidationStatus()); + } + + @Override + protected void configureShell(final Shell shell) { + super.configureShell(shell); + if (this.selectionMaxSize > 1) { + shell.setText(Messages.ETypedElementSelectionDialog_dialogTitleMultiSelection); + } else { + shell.setText(Messages.ETypedElementSelectionDialog_dialogTitle); + } + // TODO: image for ETypedElement + // shell.setImage(...); + } + + @Override + protected boolean isResizable() { + return true; + } + + @Override + protected IDialogSettings getDialogBoundsSettings() { + final String sectionName = this.getClass().getName() + ".settings"; //$NON-NLS-1$ + final IDialogSettings settings = Activator.getDefault().getDialogSettings(); + IDialogSettings section = settings.getSection(sectionName); + if (section == null) { + section = settings.addNewSection(sectionName); + // cf Dialog#DIALOG_WIDTH + section.put("DIALOG_WIDTH", ETypedElementSelectionDialog.DEFAULT_WIDTH); //$NON-NLS-1$ + section.put("DIALOG_HEIGHT", ETypedElementSelectionDialog.DEFAULT_HEIGHT); //$NON-NLS-1$ + } + return section; + } + + public boolean isErrorStatus() { + final IStatus validationStatus = this.manager.getValidationStatus(); + return validationStatus == null || validationStatus.getSeverity() >= IStatus.ERROR; + } + + @Override + protected void okPressed() { + if (isErrorStatus()) { + throw new IllegalStateException("The current selection is not valid"); //$NON-NLS-1$ + } + super.okPressed(); + } + + public D pressOk() { + okPressed(); + return null; + } + + public void pressCancel() { + setReturnCode(Window.CANCEL); + close(); + } + + @Override + public boolean close() { + final boolean result = super.close(); + invokeCallback(); + return result; + } + + private void invokeCallback() { + if (this.callback == null) { + return; + } + if (getReturnCode() == Window.OK) { + this.callback.committed(getSelectedETypedElements(), null); + } + } + + public List<ETypedElement> getSelectedETypedElements() { + List<ETypedElement> currentlySelected = new ArrayList<ETypedElement>(); + if (this.manager.isDisposed()) { + final Object[] result = getResult(); + if (result == null) { + throw new UnsupportedOperationException("No selection available because the dialog was canceled"); //$NON-NLS-1$ + } + for (Object current : result) { + currentlySelected.add((ETypedElement) current); + } + } else { + currentlySelected = this.manager.computeResult(); + } + return Collections.unmodifiableList(currentlySelected); + } + + public ETypedElement getFirstSelectedETypedElement() { + ETypedElement result = null; + final List<ETypedElement> typedElements = getSelectedETypedElements(); + if (typedElements != null && !typedElements.isEmpty()) { + result = typedElements.get(0); + } + return result; + } + + public void setSelectedETypedElements(final List<? extends ETypedElement> newSelection) { + if (newSelection == null) { + throw new IllegalArgumentException(); + } + this.manager.setSelectedETypedElements(newSelection); + updateValidationStatus(); + } + + public void setSelection(final IStructuredSelection selection) { + this.manager.setSelection(selection); + updateValidationStatus(); + } + + @Override + protected void computeResult() { + // we build the result + final List<ETypedElement> currentSelection = this.manager.computeResult(); + setResult(currentSelection); + } + + public boolean isOkButtonEnabled() { + return getOkButton().isEnabled(); + } +}
diff --git a/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/modisco/facet/efacet/ui/internal/dialogs/ETypedElementSelectionDialogFactory.java b/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/modisco/facet/efacet/ui/internal/dialogs/ETypedElementSelectionDialogFactory.java new file mode 100644 index 0000000..95c691c --- /dev/null +++ b/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/modisco/facet/efacet/ui/internal/dialogs/ETypedElementSelectionDialogFactory.java
@@ -0,0 +1,51 @@ +/******************************************************************************* + * Copyright (c) 2012, 2015 Mia-Software, and CEA-LIST. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Nicolas Bros (Mia-Software) - Bug 370442 - rewrite the Facet loading dialog for v0.2 + * Nicolas Bros (Mia-Software) - Bug 370806 - [table] rewrite the "allowed contents" query selection dialog for v0.2 + * Vincent Lorenzo (CEA-LIST) - Bug 372644 - Create Customizable tooltips for the TreeViewer using a CustomizableLabelProvider + * Gregoire Dupe (Mia-Software) - Bug 375087 - [Table] ITableWidget.addColumn(List<ETypedElement>, List<FacetSet>) + * Gregoire Dupe (Mia-Software) - Bug 372626 - Aggregates + * Thomas Cicognani (Mia-Software) - Bug 472075 - Update API to create UI shortcuts to activate FacetSets + *******************************************************************************/ +package org.eclipse.modisco.facet.efacet.ui.internal.dialogs; + +import java.util.Collection; +import java.util.List; + +import org.eclipse.emf.ecore.EPackage; +import org.eclipse.emf.ecore.ETypedElement; +import org.eclipse.modisco.facet.custom.core.ICustomizationManager; +import org.eclipse.modisco.facet.efacet.ui.internal.exported.dialog.IETypedElementSelectionDialog; +import org.eclipse.modisco.facet.efacet.ui.internal.exported.dialog.IETypedElementSelectionDialogFactory; +import org.eclipse.modisco.facet.util.ui.internal.exported.dialog.IDialogCallbackWithPreCommit; +import org.eclipse.swt.widgets.Display; +import org.eclipse.swt.widgets.Shell; + +public class ETypedElementSelectionDialogFactory implements IETypedElementSelectionDialogFactory { + + public <T2, D> IETypedElementSelectionDialog<D> openETypedElementSelectionDialog( + final Collection<? extends ETypedElement> eTypedElements, + final int selectionMaxSize, + final boolean allowEmpty, + final IDialogCallbackWithPreCommit<List<ETypedElement>, T2, D> callback, + final Shell parentShell, final ICustomizationManager customManager, + final Collection<? extends EPackage> knownFacetSets) { + final ETypedElementSelectionDialog<T2, D> dialog = new ETypedElementSelectionDialog<T2, D>( + eTypedElements, selectionMaxSize, allowEmpty, callback, + parentShell, knownFacetSets); + // must be synchronous, otherwise the shell is not created before SynchronizedETypedElementSelectionDialog, and SynchronizedComposite throws a NPE + Display.getDefault().syncExec(new Runnable() { + public void run() { + dialog.setBlockOnOpen(false); + dialog.open(); + } + }); + return new SynchronizedETypedElementSelectionDialog<T2, D>(dialog); + } +}
diff --git a/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/modisco/facet/efacet/ui/internal/dialogs/FacetSetSelectionDialog.java b/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/modisco/facet/efacet/ui/internal/dialogs/FacetSetSelectionDialog.java new file mode 100644 index 0000000..afe10a6 --- /dev/null +++ b/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/modisco/facet/efacet/ui/internal/dialogs/FacetSetSelectionDialog.java
@@ -0,0 +1,229 @@ +/******************************************************************************* + * Copyright (c) 2012 CEA LIST. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Nicolas Bros (Mia-Software) - Bug 372865 - FacetSet selection dialog + * Gregoire Dupe (Mia-Software) - Bug 372626 - Aggregates + *******************************************************************************/ +package org.eclipse.modisco.facet.efacet.ui.internal.dialogs; + +import java.util.Collection; +import java.util.List; + +import org.eclipse.core.runtime.Assert; +import org.eclipse.core.runtime.IStatus; +import org.eclipse.jface.dialogs.IDialogConstants; +import org.eclipse.jface.dialogs.IDialogSettings; +import org.eclipse.jface.viewers.TreeViewer; +import org.eclipse.jface.window.Window; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.FacetSet; +import org.eclipse.modisco.facet.efacet.ui.internal.Activator; +import org.eclipse.modisco.facet.efacet.ui.internal.Messages; +import org.eclipse.modisco.facet.efacet.ui.internal.exported.dialog.IFacetSetSelectionDialogInternal; +import org.eclipse.modisco.facet.efacet.ui.internal.widget.FacetSetSelectionControl; +import org.eclipse.modisco.facet.util.ui.internal.exported.dialog.IDialogCallback; +import org.eclipse.modisco.facet.util.ui.internal.exported.dialog.IDialogCallbackWithPreCommit; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Control; +import org.eclipse.swt.widgets.Display; +import org.eclipse.swt.widgets.Shell; +import org.eclipse.ui.dialogs.SelectionStatusDialog; + +/** + * A dialog to select {@link FacetSet}s + * + * @param <T> + * the type of a pre-commit dialog + */ +public class FacetSetSelectionDialog<T> extends SelectionStatusDialog implements IFacetSetSelectionDialogInternal<T> { + + // note: the dialog should be large enough to see the validator message + private static final int DEFAULT_WIDTH = 800; + private static final int DEFAULT_HEIGHT = 600; + + private final Collection<FacetSet> available; + private final int selectionMaxSize; + private final boolean allowEmpty; + private final IDialogCallbackWithPreCommit<List<FacetSet>, Boolean, T> callback; + private FacetSetSelectionControl selectionControl; + + public FacetSetSelectionDialog(final Collection<FacetSet> available, + final int selectionMaxSize, final boolean allowEmpty, + final IDialogCallbackWithPreCommit<List<FacetSet>, Boolean, T> callback, final Shell parentShell) { + super(parentShell); + Assert.isLegal(callback != null, "available cannot be null"); //$NON-NLS-1$ + Assert.isLegal(callback != null, "callback cannot be null"); //$NON-NLS-1$ + Assert.isLegal(selectionMaxSize > 0, "selectionMaxSize must be > 0"); //$NON-NLS-1$ + this.available = available; + this.selectionMaxSize = selectionMaxSize; + this.allowEmpty = allowEmpty; + this.callback = callback; + setHelpAvailable(false); + } + + @Override + protected Control createDialogArea(final Composite parent) { + final Composite composite = (Composite) super.createDialogArea(parent); + final Runnable onChange = new Runnable() { + public void run() { + updateValidationStatus(); + } + }; + this.selectionControl = createFacetSetSelectionControl(composite, onChange); + this.selectionControl.createContents(); + this.selectionControl.setAvailableFacetSets(this.available); + updateValidationStatus(); + return composite; + } + + protected FacetSetSelectionControl createFacetSetSelectionControl(final Composite parentComposite, final Runnable onChange) { + return new FacetSetSelectionControl(parentComposite, this.selectionMaxSize, this.allowEmpty, onChange); + } + + @Override + protected void createButtonsForButtonBar(final Composite parent) { + createButton(parent, IDialogConstants.SELECT_ALL_ID, Messages.FacetSetSelectionDialog_selectAll, false); + createButton(parent, IDialogConstants.DESELECT_ALL_ID, Messages.FacetSetSelectionDialog_deselectAll, false); + super.createButtonsForButtonBar(parent); + } + + @Override + protected void buttonPressed(final int buttonId) { + super.buttonPressed(buttonId); + if (IDialogConstants.SELECT_ALL_ID == buttonId) { + selectAll(); + } else if (IDialogConstants.DESELECT_ALL_ID == buttonId) { + deselectAll(); + } + } + + protected void updateValidationStatus() { + updateStatus(this.selectionControl.getValidationStatus()); + } + + @Override + protected void configureShell(final Shell shell) { + super.configureShell(shell); + if (this.selectionMaxSize > 1) { + shell.setText(Messages.FacetSetSelectionDialog_titleSelectFacetSets); + } else { + shell.setText(Messages.FacetSetSelectionDialog_titleSelectFacetSet); + } + } + + @Override + protected boolean isResizable() { + return true; + } + + @Override + protected IDialogSettings getDialogBoundsSettings() { + final String sectionName = this.getClass().getName() + ".settings"; //$NON-NLS-1$ + final IDialogSettings settings = Activator.getDefault().getDialogSettings(); + IDialogSettings section = settings.getSection(sectionName); + if (section == null) { + section = settings.addNewSection(sectionName); + // cf Dialog#DIALOG_WIDTH + section.put("DIALOG_WIDTH", FacetSetSelectionDialog.DEFAULT_WIDTH); //$NON-NLS-1$ + section.put("DIALOG_HEIGHT", FacetSetSelectionDialog.DEFAULT_HEIGHT); //$NON-NLS-1$ + } + return section; + } + + public boolean isErrorStatus() { + final IStatus validationStatus = this.selectionControl.getValidationStatus(); + return validationStatus == null || validationStatus.getSeverity() >= IStatus.ERROR; + } + + public T pressOk() { + final IDialogCallback<Boolean> precommitCallBack = new IDialogCallback<Boolean>() { + public void committed(final Boolean precommitResult) { + commit(precommitResult); + } + }; + final T dialog = this.callback.openPrecommitDialog( + getSelectedFacetSets(), + precommitCallBack); + if (dialog == null) { + commit(Boolean.TRUE); + } + return dialog; + } + + public void pressCancel() { + setReturnCode(Window.CANCEL); + close(); + } + + @Override + protected void okPressed() { + pressOk(); + } + + @Override + protected void cancelPressed() { + pressCancel(); + } + + protected void commit(final Boolean precommitResult) { + // since the callback is called from client code, we need to ensure we are running on the UI thread + Display.getDefault().syncExec(new Runnable() { + public void run() { + commitOnUIThread(precommitResult); + } + }); + } + + protected void commitOnUIThread(final Boolean precommitResult) { + final List<FacetSet> selectedFacetSets = getSelectedFacetSets(); + setReturnCode(Window.OK); + close(); + this.callback.committed(selectedFacetSets, precommitResult); + } + + @Override + public int open() { + // so that this dialog can be manipulated programmatically + setBlockOnOpen(false); + return super.open(); + } + + public List<FacetSet> getSelectedFacetSets() { + if (this.selectionControl.isDisposed()) { + throw new UnsupportedOperationException("No selection available because the dialog is closed"); //$NON-NLS-1$ + } + return this.selectionControl.getSelectedFacetSets(); + } + + public void setSelectedFacetSets(final List<? extends FacetSet> newSelection) { + this.selectionControl.setSelectedFacetSets(newSelection); + updateValidationStatus(); + } + + public void selectAll() { + this.selectionControl.selectAll(); + updateValidationStatus(); + } + + public void deselectAll() { + this.selectionControl.deselectAll(); + updateValidationStatus(); + } + + public boolean isOkButtonEnabled() { + return getOkButton().isEnabled(); + } + + @Override + protected void computeResult() { + // nothing : the dialog is not used in a standard way : use the callback + } + + public TreeViewer getTreeViewer() { + return this.selectionControl.getTreeViewer(); + } +} \ No newline at end of file
diff --git a/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/modisco/facet/efacet/ui/internal/dialogs/FacetSetSelectionDialogFactory.java b/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/modisco/facet/efacet/ui/internal/dialogs/FacetSetSelectionDialogFactory.java new file mode 100644 index 0000000..7f7304b --- /dev/null +++ b/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/modisco/facet/efacet/ui/internal/dialogs/FacetSetSelectionDialogFactory.java
@@ -0,0 +1,72 @@ +/******************************************************************************* + * Copyright (c) 2012 CEA LIST. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Nicolas Bros (Mia-Software) - Bug 372865 - FacetSet selection dialog + *******************************************************************************/ +package org.eclipse.modisco.facet.efacet.ui.internal.dialogs; + +import java.util.Collection; +import java.util.List; + +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.FacetSet; +import org.eclipse.modisco.facet.efacet.ui.internal.exported.dialog.IFacetSetSelectionDialog; +import org.eclipse.modisco.facet.efacet.ui.internal.exported.dialog.IFacetSetSelectionDialogFactory; +import org.eclipse.modisco.facet.util.ui.internal.exported.dialog.IDialogCallback; +import org.eclipse.modisco.facet.util.ui.internal.exported.dialog.IDialogCallbackWithPreCommit; +import org.eclipse.swt.widgets.Display; +import org.eclipse.swt.widgets.Shell; + +public class FacetSetSelectionDialogFactory implements IFacetSetSelectionDialogFactory { + + private class DummyPrecommitDialog { // NOPMD + // placeholder type + } + + public IFacetSetSelectionDialog<?> openFacetSetSelectionDialog( + final Collection<FacetSet> available, final int selectionMaxSize, final boolean allowEmpty, + final IDialogCallback<List<FacetSet>> callback, final Shell parentShell) { + + final IDialogCallbackWithPreCommit<List<FacetSet>, Boolean, FacetSetSelectionDialogFactory.DummyPrecommitDialog> wrappedCallback = + new IDialogCallbackWithPreCommit<List<FacetSet>, Boolean, FacetSetSelectionDialogFactory.DummyPrecommitDialog>() { + public void committed(final List<FacetSet> result, final Boolean precommitResult) { + callback.committed(result); + } + + public DummyPrecommitDialog openPrecommitDialog(final List<FacetSet> result, final IDialogCallback<Boolean> precommitCallback) { + return null; + } + }; + + final FacetSetSelectionDialog<FacetSetSelectionDialogFactory.DummyPrecommitDialog> dialog = + new FacetSetSelectionDialog<FacetSetSelectionDialogFactory.DummyPrecommitDialog>( + available, selectionMaxSize, allowEmpty, wrappedCallback, parentShell); + // must be synchronous, otherwise the shell is not created before SynchronizedFacetSetsSelectionDialog, and + // SynchronizedComposite throws a NPE + Display.getDefault().syncExec(new Runnable() { + public void run() { + dialog.open(); + } + }); + return new SynchronizedFacetSetSelectionDialog<FacetSetSelectionDialogFactory.DummyPrecommitDialog>(dialog); + } + + public <T> IFacetSetSelectionDialog<T> openFacetSetSelectionDialog( + final Collection<FacetSet> available, final int selectionMaxSize, final boolean allowEmpty, + final IDialogCallbackWithPreCommit<List<FacetSet>, Boolean, T> callback, final Shell parentShell) { + final FacetSetSelectionDialog<T> dialog = new FacetSetSelectionDialog<T>(available, + selectionMaxSize, allowEmpty, callback, parentShell); + // must be synchronous, otherwise the shell is not created before SynchronizedFacetSetsSelectionDialog, and + // SynchronizedComposite throws a NPE + Display.getDefault().syncExec(new Runnable() { + public void run() { + dialog.open(); + } + }); + return new SynchronizedFacetSetSelectionDialog<T>(dialog); + } +}
diff --git a/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/modisco/facet/efacet/ui/internal/dialogs/FacetSetTreeContentProvider.java b/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/modisco/facet/efacet/ui/internal/dialogs/FacetSetTreeContentProvider.java new file mode 100644 index 0000000..edf9486 --- /dev/null +++ b/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/modisco/facet/efacet/ui/internal/dialogs/FacetSetTreeContentProvider.java
@@ -0,0 +1,94 @@ +/******************************************************************************* + * Copyright (c) 2012 Mia-Software. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Nicolas Bros (Mia-Software) - Bug 370442 - rewrite the Facet loading dialog for v0.2 + * Nicolas Bros (Mia-Software) - Bug 371367 - Hierarchical FacetSets + * Nicolas Bros (Mia-Software) - Bug 372626 - Aggregates + * Nicolas Bros (Mia-Software) - Bug 372865 - FacetSet selection dialog + * Gregoire Dupe (Mia-Software) - Bug 373078 - API Cleaning + *******************************************************************************/ +package org.eclipse.modisco.facet.efacet.ui.internal.dialogs; + +import java.util.ArrayList; +import java.util.List; + +import org.eclipse.emf.ecore.EPackage; +import org.eclipse.jface.viewers.ITreeContentProvider; +import org.eclipse.jface.viewers.Viewer; +import org.eclipse.modisco.facet.efacet.core.FacetUtils; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.Facet; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.FacetSet; + +public class FacetSetTreeContentProvider implements ITreeContentProvider { + + private final boolean bFacets; + private final boolean bContainedFS; + private final boolean bSubpackages; + + public FacetSetTreeContentProvider(final boolean facets, final boolean containedFSs, final boolean subpackages) { + this.bFacets = facets; + this.bContainedFS = containedFSs; + this.bSubpackages = subpackages; + } + + public FacetSetTreeContentProvider() { + this(true, true, true); + } + + public Object[] getElements(final Object inputElement) { + if (inputElement == null) { + throw new IllegalArgumentException("inputElement must not be null"); //$NON-NLS-1$ + } + if (!(inputElement instanceof Object[])) { + throw new IllegalArgumentException("inputElement must be an array"); //$NON-NLS-1$ + } + return (Object[]) inputElement; + } + + public void inputChanged(final Viewer viewer, final Object oldInput, final Object newInput) { + // Nothing to do + } + + public Object[] getChildren(final Object parentElement) { + final List<Object> children = new ArrayList<Object>(); + if (parentElement instanceof FacetSet) { + final FacetSet facetSet = (FacetSet) parentElement; + if (this.bContainedFS) { + children.addAll(facetSet.getFacetSets()); + } + if (this.bFacets) { + children.addAll(FacetUtils.getFacets(facetSet)); + } + if (this.bSubpackages) { + children.addAll(facetSet.getESubpackages()); + } + } + return children.toArray(); + } + + public Object getParent(final Object element) { + Object parent = null; + if (element instanceof Facet) { + final Facet facet = (Facet) element; + parent = FacetUtils.getFacetSet(facet); + } else if (element instanceof EPackage) { + final EPackage ePackage = (EPackage) element; + parent = ePackage.getESuperPackage(); + } + return parent; + } + + public boolean hasChildren(final Object element) { + return getChildren(element).length > 0; + } + + public void dispose() { + // Nothing to do + } + +}
diff --git a/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/modisco/facet/efacet/ui/internal/dialogs/SynchronizedETypedElementSelectionDialog.java b/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/modisco/facet/efacet/ui/internal/dialogs/SynchronizedETypedElementSelectionDialog.java new file mode 100644 index 0000000..10b885e --- /dev/null +++ b/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/modisco/facet/efacet/ui/internal/dialogs/SynchronizedETypedElementSelectionDialog.java
@@ -0,0 +1,101 @@ +/******************************************************************************* + * Copyright (c) 2012 Mia-Software. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Nicolas Bros (Mia-Software) - Bug 370442 - rewrite the Facet loading dialog for v0.2 + * Nicolas Bros (Mia-Software) - Bug 370806 - [table] rewrite the "allowed contents" query selection dialog for v0.2 + * Gregoire Dupe (Mia-Software) - Bug 375087 - [Table] ITableWidget.addColumn(List<ETypedElement>, List<FacetSet>) + *******************************************************************************/ +package org.eclipse.modisco.facet.efacet.ui.internal.dialogs; + +import java.util.List; + +import org.eclipse.emf.ecore.ETypedElement; +import org.eclipse.modisco.facet.efacet.ui.internal.exported.dialog.IETypedElementSelectionDialog; +import org.eclipse.modisco.facet.efacet.ui.internal.exported.dialog.IETypedElementSelectionDialogInternal; +import org.eclipse.modisco.facet.util.ui.internal.exported.displaysync.AbstractExceptionFreeRunnable; +import org.eclipse.modisco.facet.util.ui.internal.exported.displaysync.AbstractVoidExceptionFreeRunnable; +import org.eclipse.modisco.facet.util.ui.internal.exported.displaysync.SynchronizedComposite; +import org.eclipse.swt.widgets.Shell; + +/** A synchronization facade for {@link IETypedElementSelectionDialog}. */ +public class SynchronizedETypedElementSelectionDialog<T2, D> extends + SynchronizedComposite<Shell> implements + IETypedElementSelectionDialogInternal<D> { + + private final IETypedElementSelectionDialogInternal<D> dialog; + + public IETypedElementSelectionDialogInternal<D> getDialog() { + return this.dialog; + } + + public SynchronizedETypedElementSelectionDialog( + final ETypedElementSelectionDialog<T2, D> delegate) { + super(delegate.getShell()); + this.dialog = delegate; + } + + public D pressOk() { + return safeSyncExec(new AbstractExceptionFreeRunnable<D>() { + @Override + public D safeRun() { + return getDialog().pressOk(); + } + }); + } + + public void pressCancel() { + voidExceptionFreeRunnable(new AbstractVoidExceptionFreeRunnable() { + @Override + public void voidSafeRun() { + getDialog().pressCancel(); + } + }); + + } + + public List<ETypedElement> getSelectedETypedElements() { + return safeSyncExec(new AbstractExceptionFreeRunnable<List<ETypedElement>>() { + @Override + public List<ETypedElement> safeRun() { + return getDialog().getSelectedETypedElements(); + } + }); + } + + public ETypedElement getFirstSelectedETypedElement() { + return safeSyncExec(new AbstractExceptionFreeRunnable<ETypedElement>() { + @Override + public ETypedElement safeRun() { + return getDialog().getFirstSelectedETypedElement(); + } + }); + } + + public void setSelectedETypedElements(final List<? extends ETypedElement> newSelection) { + voidExceptionFreeRunnable(new AbstractVoidExceptionFreeRunnable() { + @Override + public void voidSafeRun() { + getDialog().setSelectedETypedElements(newSelection); + + } + }); + } + + public int getReturnCode() { + return getDialog().getReturnCode(); + } + + public boolean isOkButtonEnabled() { + return safeSyncExec(new AbstractExceptionFreeRunnable<Boolean>() { + @Override + public Boolean safeRun() { + return Boolean.valueOf(getDialog().isOkButtonEnabled()); + } + }).booleanValue(); + } +}
diff --git a/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/modisco/facet/efacet/ui/internal/dialogs/SynchronizedFacetSetSelectionDialog.java b/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/modisco/facet/efacet/ui/internal/dialogs/SynchronizedFacetSetSelectionDialog.java new file mode 100644 index 0000000..2cece7f --- /dev/null +++ b/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/modisco/facet/efacet/ui/internal/dialogs/SynchronizedFacetSetSelectionDialog.java
@@ -0,0 +1,102 @@ +/******************************************************************************* + * Copyright (c) 2012 CEA LIST. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Nicolas Bros (Mia-Software) - Bug 372865 - FacetSet selection dialog + *******************************************************************************/ +package org.eclipse.modisco.facet.efacet.ui.internal.dialogs; + +import java.util.List; + +import org.eclipse.jface.viewers.TreeViewer; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.FacetSet; +import org.eclipse.modisco.facet.efacet.ui.internal.exported.dialog.IFacetSetSelectionDialog; +import org.eclipse.modisco.facet.efacet.ui.internal.exported.dialog.IFacetSetSelectionDialogInternal; +import org.eclipse.modisco.facet.util.ui.internal.exported.displaysync.AbstractExceptionFreeRunnable; +import org.eclipse.modisco.facet.util.ui.internal.exported.displaysync.AbstractVoidExceptionFreeRunnable; +import org.eclipse.modisco.facet.util.ui.internal.exported.displaysync.SynchronizedComposite; +import org.eclipse.swt.widgets.Shell; + +/** A synchronization facade for {@link IFacetSetSelectionDialog}. */ +public class SynchronizedFacetSetSelectionDialog<T> extends SynchronizedComposite<Shell> implements IFacetSetSelectionDialogInternal<T> { + + private final IFacetSetSelectionDialogInternal<T> dialog; + + public IFacetSetSelectionDialogInternal<T> getDialog() { + return this.dialog; + } + + public SynchronizedFacetSetSelectionDialog(final FacetSetSelectionDialog<T> delegate) { + super(delegate.getShell()); + this.dialog = delegate; + } + + public void setSelectedFacetSets(final List<? extends FacetSet> newSelection) { + voidExceptionFreeRunnable(new AbstractVoidExceptionFreeRunnable() { + @Override + public void voidSafeRun() { + getDialog().setSelectedFacetSets(newSelection); + + } + }); + } + + public T pressOk() { + return safeSyncExec(new AbstractExceptionFreeRunnable<T>() { + @Override + public T safeRun() { + return getDialog().pressOk(); + } + }); + } + + public void pressCancel() { + voidExceptionFreeRunnable(new AbstractVoidExceptionFreeRunnable() { + @Override + public void voidSafeRun() { + getDialog().pressCancel(); + } + }); + } + + public void selectAll() { + voidExceptionFreeRunnable(new AbstractVoidExceptionFreeRunnable() { + @Override + public void voidSafeRun() { + getDialog().selectAll(); + } + }); + } + + public void deselectAll() { + voidExceptionFreeRunnable(new AbstractVoidExceptionFreeRunnable() { + @Override + public void voidSafeRun() { + getDialog().deselectAll(); + } + }); + } + + public boolean isOkButtonEnabled() { + return safeSyncExec(new AbstractExceptionFreeRunnable<Boolean>() { + @Override + public Boolean safeRun() { + return Boolean.valueOf(getDialog().isOkButtonEnabled()); + } + }).booleanValue(); + } + + public TreeViewer getTreeViewer() { + return safeSyncExec(new AbstractExceptionFreeRunnable<TreeViewer>() { + @Override + public TreeViewer safeRun() { + return getDialog().getTreeViewer(); + } + }); + } + +}
diff --git a/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/modisco/facet/efacet/ui/internal/dialogs/UriDialog.java b/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/modisco/facet/efacet/ui/internal/dialogs/UriDialog.java new file mode 100644 index 0000000..1be6c87 --- /dev/null +++ b/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/modisco/facet/efacet/ui/internal/dialogs/UriDialog.java
@@ -0,0 +1,72 @@ +/******************************************************************************* + * Copyright (c) 2015 Soft-Maint. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Jonathan Pepin (Soft-Maint) - Bug 463907 - Command for load and save Facet serialization + *******************************************************************************/ +package org.eclipse.modisco.facet.efacet.ui.internal.dialogs; + +import org.eclipse.emf.common.util.URI; +import org.eclipse.modisco.facet.efacet.ui.internal.exported.widget.IUriWidget; +import org.eclipse.modisco.facet.efacet.ui.internal.exported.widget.IUriWidgetFactory; +import org.eclipse.modisco.facet.util.ui.internal.exported.dialog.IDialog; +import org.eclipse.modisco.facet.util.ui.internal.exported.dialog.IDialogCallback; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Control; +import org.eclipse.swt.widgets.Shell; +import org.eclipse.ui.dialogs.SelectionStatusDialog; + +public class UriDialog extends SelectionStatusDialog implements IDialog<IUriWidget> { + + private IUriWidget widget; + private final IDialogCallback<URI> callback; + private final URI initialUri; + + public UriDialog(final URI uri, final IDialogCallback<URI> callback, + final Shell parentShell) { + super(parentShell); + this.initialUri = uri; + this.callback = callback; + } + + @Override + protected Control createDialogArea(final Composite parent) { + final Composite composite = (Composite) super.createDialogArea(parent); + this.widget = IUriWidgetFactory.DEFAULT.createUriWidget(composite); + this.widget.setURI(this.initialUri); + return super.createDialogArea(parent); + } + + @Override + protected void computeResult() { + // Nothing to do + } + + public void commit() { + final URI uri = this.widget.getURI(); + this.callback.committed(uri); + super.okPressed(); + } + + @Override + protected void okPressed() { + commit(); + } + + public void cancel() { + cancelPressed(); + } + + public boolean isDialogValid() { + return this.widget.getURI() != null; + } + + public IUriWidget getWidget() { + return this.widget; + } + +}
diff --git a/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/modisco/facet/efacet/ui/internal/dialogs/UriDialogFactory.java b/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/modisco/facet/efacet/ui/internal/dialogs/UriDialogFactory.java new file mode 100644 index 0000000..9b40ddd --- /dev/null +++ b/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/modisco/facet/efacet/ui/internal/dialogs/UriDialogFactory.java
@@ -0,0 +1,35 @@ +/******************************************************************************* + * Copyright (c) 2015 Soft-Maint. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Jonathan Pepin (Soft-Maint) - Bug 463907 - Command for load and save Facet serialization + *******************************************************************************/ +package org.eclipse.modisco.facet.efacet.ui.internal.dialogs; + +import org.eclipse.emf.common.util.URI; +import org.eclipse.modisco.facet.efacet.ui.internal.exported.dialog.IUriDialogFactory; +import org.eclipse.modisco.facet.efacet.ui.internal.exported.widget.IUriWidget; +import org.eclipse.modisco.facet.util.ui.internal.exported.dialog.IDialog; +import org.eclipse.modisco.facet.util.ui.internal.exported.dialog.IDialogCallback; +import org.eclipse.swt.widgets.Display; +import org.eclipse.swt.widgets.Shell; + +public class UriDialogFactory implements IUriDialogFactory { + + public IDialog<IUriWidget> openUriDialog(final URI uri, + final IDialogCallback<URI> callback, final Shell parentShell, + final Display display) { + final UriDialog dialog = new UriDialog(uri, callback, parentShell); + display.asyncExec(new Runnable() { + public void run() { + dialog.open(); + } + }); + return dialog; + } + +}
diff --git a/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/modisco/facet/efacet/ui/internal/exported/EFacetUIConstants.java b/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/modisco/facet/efacet/ui/internal/exported/EFacetUIConstants.java new file mode 100644 index 0000000..132687b --- /dev/null +++ b/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/modisco/facet/efacet/ui/internal/exported/EFacetUIConstants.java
@@ -0,0 +1,24 @@ +/******************************************************************************* + * Copyright (c) 2012 CEA LIST. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Nicolas Bros (Mia-Software) - Bug 372626 - Aggregates + *******************************************************************************/ +package org.eclipse.modisco.facet.efacet.ui.internal.exported; + +public final class EFacetUIConstants { + + private static final String CATALOG_VIEW_ID = "org.eclipse.emf.facet.efacet.ui.view.catalog"; //$NON-NLS-1$ + + private EFacetUIConstants() { + // utility class + } + + public static String getFacetSetsCatalogViewId() { + return EFacetUIConstants.CATALOG_VIEW_ID; + } +}
diff --git a/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/modisco/facet/efacet/ui/internal/exported/dialog/IETypedElementSelectionDialog.java b/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/modisco/facet/efacet/ui/internal/exported/dialog/IETypedElementSelectionDialog.java new file mode 100644 index 0000000..2950c86 --- /dev/null +++ b/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/modisco/facet/efacet/ui/internal/exported/dialog/IETypedElementSelectionDialog.java
@@ -0,0 +1,35 @@ +/******************************************************************************* + * Copyright (c) 2012 Mia-Software. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Nicolas Bros (Mia-Software) - Bug 370806 - [table] rewrite the "allowed contents" query selection dialog for v0.2 + * Gregoire Dupe (Mia-Software) - Bug 375087 - [Table] ITableWidget.addColumn(List<ETypedElement>, List<FacetSet>) + *******************************************************************************/ +package org.eclipse.modisco.facet.efacet.ui.internal.exported.dialog; + +import java.util.List; + +import org.eclipse.emf.ecore.ETypedElement; + +/** + * A dialog to let the user select ETypedElements. + * + * @noextend This interface is not intended to be extended by clients. + * @noimplement This interface is not intended to be implemented by clients. + * @since 0.2.0 + */ +public interface IETypedElementSelectionDialog<D> { + + /** Set the selection to the given list of ETypedElements */ + void setSelectedETypedElements(List<? extends ETypedElement> newSelection); + + /** Emulate a press on the OK button */ + D pressOk(); + + /** Emulate a press on the Cancel button */ + void pressCancel(); +}
diff --git a/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/modisco/facet/efacet/ui/internal/exported/dialog/IETypedElementSelectionDialogCallback.java b/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/modisco/facet/efacet/ui/internal/exported/dialog/IETypedElementSelectionDialogCallback.java new file mode 100644 index 0000000..ec0d0b3 --- /dev/null +++ b/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/modisco/facet/efacet/ui/internal/exported/dialog/IETypedElementSelectionDialogCallback.java
@@ -0,0 +1,30 @@ +/******************************************************************************* + * Copyright (c) 2012 Mia-Software. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Nicolas Bros (Mia-Software) - Bug 370806 - [table] rewrite the "allowed contents" query selection dialog for v0.2 + *******************************************************************************/ +package org.eclipse.modisco.facet.efacet.ui.internal.exported.dialog; + +import java.util.List; + +import org.eclipse.emf.ecore.ETypedElement; + +/** + * Called when a {@link IETypedElementSelectionDialog} is closed, either by OK or Cancel. + * <p> + * This interface is intended to be implemented by clients. + * + * @since 0.2.0 + */ +public interface IETypedElementSelectionDialogCallback { + /** The user canceled the dialog */ + void canceled(); + + /** The user committed their selection in the dialog */ + void committed(List<ETypedElement> selection); +}
diff --git a/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/modisco/facet/efacet/ui/internal/exported/dialog/IETypedElementSelectionDialogFactory.java b/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/modisco/facet/efacet/ui/internal/exported/dialog/IETypedElementSelectionDialogFactory.java new file mode 100644 index 0000000..492f3aa --- /dev/null +++ b/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/modisco/facet/efacet/ui/internal/exported/dialog/IETypedElementSelectionDialogFactory.java
@@ -0,0 +1,62 @@ +/******************************************************************************* + * Copyright (c) 2012 Mia-Software. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Nicolas Bros (Mia-Software) - Bug 370806 - [table] rewrite the "allowed contents" query selection dialog for v0.2 + * Vincent Lorenzo (CEA-LIST) - Bug 372644 - Create Customizable tooltips for the TreeViewer using a CustomizableLabelProvider + * Gregoire Dupe (Mia-Software) - Bug 375087 - [Table] ITableWidget.addColumn(List<ETypedElement>, List<FacetSet>) + * Gregoire Dupe (Mia-Software) - Bug 372626 - Aggregates + *******************************************************************************/ +package org.eclipse.modisco.facet.efacet.ui.internal.exported.dialog; + +import java.util.Collection; +import java.util.List; + +import org.eclipse.emf.ecore.EPackage; +import org.eclipse.emf.ecore.ETypedElement; +import org.eclipse.modisco.facet.custom.core.ICustomizationManager; +import org.eclipse.modisco.facet.efacet.ui.internal.dialogs.ETypedElementSelectionDialogFactory; +import org.eclipse.modisco.facet.util.ui.internal.exported.dialog.IDialogCallbackWithPreCommit; +import org.eclipse.swt.widgets.Shell; + +/** + * A factory to create {@link IETypedElementSelectionDialog}s + * + * @noextend This interface is not intended to be extended by clients. + * @noimplement This interface is not intended to be implemented by clients. + * @since 0.2.0 + */ +public interface IETypedElementSelectionDialogFactory { + + /** This is the default instance of this interface. */ + IETypedElementSelectionDialogFactory DEFAULT = new ETypedElementSelectionDialogFactory(); + + /** + * Open a dialog to let the user select ETypedElements to load. + * + * @param eTypedElements + * the list of ETypedElements that can be selected using this dialog + * @param selectionMaxSize + * the maximum number of typed elements that the user can select + * @param allowEmpty + * whether to allow the user to select no ETypedElement (i.e : select <code>null</code>) + * @param callback + * called when the dialog closes + * @param parentShell + * the parent shell + * @param customManager + * the customization manager used by the + * ICustomizableLabelProvider. Can be null. + */ + <T2, D> IETypedElementSelectionDialog<D> openETypedElementSelectionDialog( + Collection<? extends ETypedElement> eTypedElements, + int selectionMaxSize, boolean allowEmpty, + IDialogCallbackWithPreCommit<List<ETypedElement>, T2, D> callback, + Shell parentShell, + ICustomizationManager customManager, + Collection<? extends EPackage> knownFacetSets); +}
diff --git a/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/modisco/facet/efacet/ui/internal/exported/dialog/IETypedElementSelectionDialogInternal.java b/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/modisco/facet/efacet/ui/internal/exported/dialog/IETypedElementSelectionDialogInternal.java new file mode 100644 index 0000000..578c311 --- /dev/null +++ b/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/modisco/facet/efacet/ui/internal/exported/dialog/IETypedElementSelectionDialogInternal.java
@@ -0,0 +1,53 @@ +/******************************************************************************* + * Copyright (c) 2012 Mia-Software. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Nicolas Bros (Mia-Software) - Bug 370806 - [table] rewrite the "allowed contents" query selection dialog for v0.2 + * Gregoire Dupe (Mia-Software) - Bug 375087 - [Table] ITableWidget.addColumn(List<ETypedElement>, List<FacetSet>) + *******************************************************************************/ +package org.eclipse.modisco.facet.efacet.ui.internal.exported.dialog; + +import java.util.List; + +import org.eclipse.emf.ecore.ETypedElement; +import org.eclipse.jface.window.Window; + +/** + * Internal interface for a dialog to let the user select ETypedElements. + * + * @noextend This interface is not intended to be extended by clients. + * @noimplement This interface is not intended to be implemented by clients. + * @since 0.2.0 + */ +public interface IETypedElementSelectionDialogInternal<D> extends + IETypedElementSelectionDialog<D> { + + /** + * @return whether the "OK" button is currently enabled. It can be disabled if a validator is set, and the current + * selection is not valid. + */ + boolean isOkButtonEnabled(); + + /** + * @return the selected ETypedElements. + * @throws UnsupportedOperationException + * if the dialog was cancelled (check {@link IETypedElementSelectionDialogInternal#getReturnCode() + * getReturnCode} before calling this method + */ + List<ETypedElement> getSelectedETypedElements(); + + /** + * @return the first selected ETypedElements or <code>null</code> if none. + * @throws UnsupportedOperationException + * if the dialog was cancelled (check {@link IETypedElementSelectionDialogInternal#getReturnCode() + * getReturnCode} before calling this method + */ + ETypedElement getFirstSelectedETypedElement(); + + /** @return {@link Window#OK} or {@link Window#CANCEL}. */ + int getReturnCode(); +}
diff --git a/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/modisco/facet/efacet/ui/internal/exported/dialog/IFacetSetSelectionDialog.java b/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/modisco/facet/efacet/ui/internal/exported/dialog/IFacetSetSelectionDialog.java new file mode 100644 index 0000000..f26e15a --- /dev/null +++ b/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/modisco/facet/efacet/ui/internal/exported/dialog/IFacetSetSelectionDialog.java
@@ -0,0 +1,47 @@ +/******************************************************************************* + * Copyright (c) 2012 CEA LIST. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Nicolas Bros (Mia-Software) - Bug 372865 - FacetSet selection dialog + *******************************************************************************/ +package org.eclipse.modisco.facet.efacet.ui.internal.exported.dialog; + +import java.util.List; + +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.FacetSet; + +/** + * A dialog to let the user select facet sets to load. + * + * @param <T> + * the type of a pre-commit dialog + * + * @noextend This interface is not intended to be extended by clients. + * @noimplement This interface is not intended to be implemented by clients. + * @since 0.2.0 + */ +public interface IFacetSetSelectionDialog<T> { + + /** Set the selection to the given list of {@link FacetSet}s */ + void setSelectedFacetSets(List<? extends FacetSet> newSelection); + + /** + * Emulate a press on the OK button + * + * @return a pre-commit dialog, or <code>null</code> if no pre-commit dialog was opened + */ + T pressOk(); + + /** Emulate a press on the Cancel button */ + void pressCancel(); + + /** Check all {@link FacetSet}s */ + void selectAll(); + + /** Uncheck all {@link FacetSet}s */ + void deselectAll(); +}
diff --git a/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/modisco/facet/efacet/ui/internal/exported/dialog/IFacetSetSelectionDialogFactory.java b/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/modisco/facet/efacet/ui/internal/exported/dialog/IFacetSetSelectionDialogFactory.java new file mode 100644 index 0000000..20068a0 --- /dev/null +++ b/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/modisco/facet/efacet/ui/internal/exported/dialog/IFacetSetSelectionDialogFactory.java
@@ -0,0 +1,72 @@ +/******************************************************************************* + * Copyright (c) 2012 CEA LIST. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Nicolas Bros (Mia-Software) - Bug 372865 - FacetSet selection dialog + *******************************************************************************/ +package org.eclipse.modisco.facet.efacet.ui.internal.exported.dialog; + +import java.util.Collection; +import java.util.List; + +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.FacetSet; +import org.eclipse.modisco.facet.efacet.ui.internal.dialogs.FacetSetSelectionDialogFactory; +import org.eclipse.modisco.facet.util.ui.internal.exported.dialog.IDialogCallback; +import org.eclipse.modisco.facet.util.ui.internal.exported.dialog.IDialogCallbackWithPreCommit; +import org.eclipse.swt.widgets.Shell; + +/** + * A factory to create {@link IFacetSetSelectionDialog}s + * + * @noextend This interface is not intended to be extended by clients. + * @noimplement This interface is not intended to be implemented by clients. + * @since 0.2.0 + */ +public interface IFacetSetSelectionDialogFactory { + + /** This is the default instance of this interface. */ + IFacetSetSelectionDialogFactory DEFAULT = new FacetSetSelectionDialogFactory(); + + /** + * Open a dialog to let the user select facet sets. + * + * @param available + * the {@link FacetSet}s the user will be able to select in the dialog + * @param selectionMaxSize + * the maximum number of {@link FacetSet}s that the user can select + * @param allowEmpty + * whether to allow the user to select no FacetSet (i.e : select <code>null</code>) + * @param callback + * called when the dialog closes + * @param parentShell + * the parent shell + * @return an instance of the dialog being opened + */ + IFacetSetSelectionDialog<?> openFacetSetSelectionDialog(Collection<FacetSet> available, + int selectionMaxSize, boolean allowEmpty, IDialogCallback<List<FacetSet>> callback, + Shell parentShell); + + /** + * Open a dialog to let the user select facet sets. The callback will be called before the dialog closes, to let you + * open a "pre-commit" dialog, to ask the user for confirmation for example. + * + * @param available + * the {@link FacetSet}s the user will be able to select in the dialog + * @param selectionMaxSize + * the maximum number of {@link FacetSet}s that the user can select + * @param allowEmpty + * whether to allow the user to select no FacetSet (i.e : select <code>null</code>) + * @param callback + * called before the dialog is committed, and again when the dialog is committed + * @param parentShell + * the parent shell + * @return an instance of the dialog being opened + */ + <T> IFacetSetSelectionDialog<T> openFacetSetSelectionDialog(Collection<FacetSet> available, + int selectionMaxSize, boolean allowEmpty, IDialogCallbackWithPreCommit<List<FacetSet>, Boolean, T> callback, + Shell parentShell); +}
diff --git a/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/modisco/facet/efacet/ui/internal/exported/dialog/IFacetSetSelectionDialogInternal.java b/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/modisco/facet/efacet/ui/internal/exported/dialog/IFacetSetSelectionDialogInternal.java new file mode 100644 index 0000000..e464c2b --- /dev/null +++ b/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/modisco/facet/efacet/ui/internal/exported/dialog/IFacetSetSelectionDialogInternal.java
@@ -0,0 +1,35 @@ +/******************************************************************************* + * Copyright (c) 2012 CEA LIST. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Nicolas Bros (Mia-Software) - Bug 372865 - FacetSet selection dialog + *******************************************************************************/ +package org.eclipse.modisco.facet.efacet.ui.internal.exported.dialog; + +import org.eclipse.jface.viewers.TreeViewer; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.FacetSet; + +/** + * Internal interface for a dialog to let the user select {@link FacetSet}s. + * + * @noextend This interface is not intended to be extended by clients. + * @noimplement This interface is not intended to be implemented by clients. + * + * @param <T> + * the type of a pre-commit dialog (can be <code>null</code> if there is no pre-commit dialog) + */ +public interface IFacetSetSelectionDialogInternal<T> extends IFacetSetSelectionDialog<T> { + + /** + * @return whether the "OK" button is currently enabled. It can be disabled if a validator is set, and the current + * selection is not valid. + */ + boolean isOkButtonEnabled(); + + /** @return the tree viewer */ + TreeViewer getTreeViewer(); +}
diff --git a/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/modisco/facet/efacet/ui/internal/exported/dialog/IUriDialogFactory.java b/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/modisco/facet/efacet/ui/internal/exported/dialog/IUriDialogFactory.java new file mode 100644 index 0000000..6a3be27 --- /dev/null +++ b/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/modisco/facet/efacet/ui/internal/exported/dialog/IUriDialogFactory.java
@@ -0,0 +1,35 @@ +/******************************************************************************* + * Copyright (c) 2015 Soft-Maint. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Jonathan Pepin (Soft-Maint) - Bug 463907 - Command for load and save Facet serialization + *******************************************************************************/ +package org.eclipse.modisco.facet.efacet.ui.internal.exported.dialog; + +import org.eclipse.emf.common.util.URI; +import org.eclipse.modisco.facet.efacet.ui.internal.dialogs.UriDialogFactory; +import org.eclipse.modisco.facet.efacet.ui.internal.exported.widget.IUriWidget; +import org.eclipse.modisco.facet.util.ui.internal.exported.dialog.IDialog; +import org.eclipse.modisco.facet.util.ui.internal.exported.dialog.IDialogCallback; +import org.eclipse.swt.widgets.Display; +import org.eclipse.swt.widgets.Shell; + +/** + * A factory to create {@link IETypedElementSelectionDialog}s + * + * @noextend This interface is not intended to be extended by clients. + * @noimplement This interface is not intended to be implemented by clients. + * @since 1.0 + */ +public interface IUriDialogFactory { + + /** This is the default instance of this interface. */ + IUriDialogFactory DEFAULT = new UriDialogFactory(); + + IDialog<IUriWidget> openUriDialog(URI uri, + IDialogCallback<URI> callback, Shell parentShell, Display display); +}
diff --git a/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/modisco/facet/efacet/ui/internal/exported/view/INavigationView.java b/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/modisco/facet/efacet/ui/internal/exported/view/INavigationView.java new file mode 100644 index 0000000..82f2c34 --- /dev/null +++ b/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/modisco/facet/efacet/ui/internal/exported/view/INavigationView.java
@@ -0,0 +1,139 @@ +/** + * Copyright (c) 2011, 2015 Mia-Software. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Grégoire Dupé (Mia-Software) - Bug 364325 - [Restructuring] The user must be able to navigate into a model using the Facet. + * Nicolas Bros (Mia-Software) - Bug 379395 - Navigate should replace elements + * Grégoire Dupé (Mia-Software) - Bug 480654 - IllegalStateException in NavigationView.addEObjects (611) + */ +package org.eclipse.modisco.facet.efacet.ui.internal.exported.view; + +import java.io.NotActiveException; +import java.util.Collection; +import java.util.List; + +import org.eclipse.emf.ecore.EClassifier; +import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.ecore.ETypedElement; +import org.eclipse.modisco.facet.efacet.ui.IETypedElementResultDisplayerOpener; +import org.eclipse.modisco.facet.util.ui.internal.exported.dialog.IOkDialog; +import org.eclipse.ui.part.WorkbenchPart; + +/** + * This interface presents the services provided by a navigation view. + * + * @author Gregoire Dupe + * + */ +public interface INavigationView { + + /** + * Add {@link EObject}s to the list of sources. + * <p> + * This method is called by the drop listener to fill the the navigation source {@link EObject} list + * + * @param eObjects + * the model elements to add to the list of sources + */ + void addEObjects(Collection<? extends EObject> eObjects); + + /** + * Add {@link EObject}s to the list of sources. + * <p> + * This method is called by the drop listener to fill the the navigation source {@link EObject} list + * + * @since 1.1 + * @param eObjects + * the model elements to add to the list of sources + * @return an IOKDialog instance if an error happened, null otherwise. + */ + IOkDialog addEObjects2(Collection<? extends EObject> eObjects); + + /** + * This method removes one eObject from the navigation source {@link EObject} list + * + * This method must be called by the "Delete" command handler. + * + * @param eObject + * eObject to remove from the navigation source {@link EObject} list + */ + void removeEObject(EObject eObject); + + /** + * This method remove a list of eObject from the navigation source {@link EObject} list + * This method must be called by the "Delete" command handler + * + * @param eObjects + * eObjects to remove from the navigation source {@link EObject} list + */ + void removeEObjects(List<? extends EObject> eObjects); + + /** + * This method clear the navigation source {@link EObject} list + */ + void removeAllEObjects(); + + /** + * The methods must return the classifier for which each selected EObject conforms to. + * + * @return classifiers usable to the navigation + */ + List<EClassifier> getUsableEClassifiers(); + + /** + * This method selects the eTypedElement that we want to navigate through. We can navigate + * through an eStructuralFeature (or an eOperation) owned by a Facet or owned by an EClass. + * + * @param eTypedElement + * must a contained by one of the classifier returned by getUsableEClassifiers(). + * @throws IllegalArgumentException + * if eTypedElement is {@link NotActiveException} contained by one of the classifier + * returned by getUsableEClassifiers(). + */ + void selectETypedElement(ETypedElement eTypedElement); + + /** + * This method returns the eTypedElement that we want to navigate through. + * + * @return the eTypedElement that we want to navigate through. + */ + ETypedElement getSelectedETypedElement(); + + /** + * This method returns the list of {@link IETypedElementResultDisplayerOpener} which have + * been resisted using the org.eclipse.emf.facet.efacet.ui.displayeropener extension point. + * + * @return a list of {@link IETypedElementResultDisplayerOpener} + */ + List<IETypedElementResultDisplayerOpener> getAvailableSelectedDisplayers(); + + /** + * This method has to be used to select a {@link IETypedElementResultDisplayerOpener} + * + * @param resultDisplayer + * must be contained in the list returned by getAvailableSelectedDisplayers(). + */ + void setSelectDisplayer( + IETypedElementResultDisplayerOpener resultDisplayer); + + /** + * This method the selected {@link IETypedElementResultDisplayerOpener} + * + * @return an {@link IETypedElementResultDisplayerOpener} which is contained by the list + * returned by getAvailableSelectedDisplayers(). + */ + IETypedElementResultDisplayerOpener getSelectedDisplayer(); + + /** + * This method performs the navigation and return the {@link WorkbenchPart} in which the result is presented. + * + * @return + */ + WorkbenchPart preform(); + +}
diff --git a/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/modisco/facet/efacet/ui/internal/exported/view/INavigationViewFactory.java b/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/modisco/facet/efacet/ui/internal/exported/view/INavigationViewFactory.java new file mode 100644 index 0000000..d82be74 --- /dev/null +++ b/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/modisco/facet/efacet/ui/internal/exported/view/INavigationViewFactory.java
@@ -0,0 +1,45 @@ +/** + * Copyright (c) 2011, 2015 Mia-Software. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Grégoire Dupé (Mia-Software) - Bug 364325 - [Restructuring] The user must be able to navigate into a model using the Facet. + * Grégoire Dupé (Mia-Software) - Bug 480654 - IllegalStateException in NavigationView.addEObjects (611) + */ +package org.eclipse.modisco.facet.efacet.ui.internal.exported.view; + +import org.eclipse.emf.edit.domain.EditingDomain; +import org.eclipse.modisco.facet.efacet.ui.internal.sync.generated.SynchronizedNavigationViewFactory; +import org.eclipse.modisco.facet.efacet.ui.internal.view.NavigationViewFactory; +import org.eclipse.swt.widgets.Display; + +/** + * This interface allows to get an instance of the {@link INavigationView} interface + * + * @author Gregoire Dupe + * + */ +public interface INavigationViewFactory { + + /** + * This is the default instance of this interface. + */ + INavigationViewFactory DEFAULT = new SynchronizedNavigationViewFactory(new NavigationViewFactory(), Display.getDefault()); + + /** + * This method is the only way to open and access the navigation view. + * @param editingDomain + * + * @return an instance of {@link INavigationView} + */ + /* + * FIXME gdupe> It would be better if that method would be able to throw an + * exception, rather than to "silently" log the problems. + */ + INavigationView openNavigationView(EditingDomain editingDomain); + +}
diff --git a/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/modisco/facet/efacet/ui/internal/exported/widget/IETypedElementSelectionWidget.java b/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/modisco/facet/efacet/ui/internal/exported/widget/IETypedElementSelectionWidget.java new file mode 100644 index 0000000..b18632e --- /dev/null +++ b/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/modisco/facet/efacet/ui/internal/exported/widget/IETypedElementSelectionWidget.java
@@ -0,0 +1,42 @@ +/******************************************************************************* + * Copyright (c) 2012 Mia-Software. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Gregoire Dupe (Mia-Software) - Bug 370442 - rewrite the Facet loading dialog for v0.2 + * Nicolas Bros (Mia-Software) - Bug 370806 - [table] rewrite the "allowed contents" query selection dialog for v0.2 + *******************************************************************************/ +package org.eclipse.modisco.facet.efacet.ui.internal.exported.widget; + +import java.util.Collection; +import java.util.List; + +import org.eclipse.emf.ecore.ETypedElement; + +/** + * A widget to select one or more {@link ETypedElement}s from a list + * + * @noextend This interface is not intended to be extended by clients. + * @noimplement This interface is not intended to be implemented by clients. + * @since 0.2.0 + */ +public interface IETypedElementSelectionWidget { + + /** + * This method can be called at any time to change the {@link ETypedElement}s which can be selected by the user. + * + * @param available + * the {@link ETypedElement}s that can be selected in this widget + */ + void setAvailableETypedElements(Collection<? extends ETypedElement> available); + + /** @return the list of selected {@link ETypedElement}s */ + List<ETypedElement> getSelectedETypedElements(); + + /** Select the given {@link ETypedElement}s in this widget. */ + void setSelectedETypedElements(Collection<? extends ETypedElement> elementsToSelect); + +}
diff --git a/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/modisco/facet/efacet/ui/internal/exported/widget/IETypedElementSelectionWidgetFactory.java b/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/modisco/facet/efacet/ui/internal/exported/widget/IETypedElementSelectionWidgetFactory.java new file mode 100644 index 0000000..c399eb1 --- /dev/null +++ b/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/modisco/facet/efacet/ui/internal/exported/widget/IETypedElementSelectionWidgetFactory.java
@@ -0,0 +1,55 @@ +/******************************************************************************* + * Copyright (c) 2012 Mia-Software. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Gregoire Dupe (Mia-Software) - Bug 370442 - rewrite the Facet loading dialog for v0.2 + * Nicolas Bros (Mia-Software) - Bug 370806 - [table] rewrite the "allowed contents" query selection dialog for v0.2 + * Vincent Lorenzo (CEA-LIST) - Bug 372644 - Create Customizable tooltips for the TreeViewer using a CustomizableLabelProvider + * Gregoire Dupe (Mia-Software) - Bug 372626 - Aggregates + *******************************************************************************/ +package org.eclipse.modisco.facet.efacet.ui.internal.exported.widget; + +import java.util.Collection; + +import org.eclipse.emf.ecore.EObject; +import org.eclipse.modisco.facet.custom.core.ICustomizationManager; +import org.eclipse.modisco.facet.efacet.ui.internal.widget.ETypedElementSelectionWidgetFactory; +import org.eclipse.swt.widgets.Composite; + +/** + * Factory for {@link IETypedElementSelectionWidget} + * + * @noextend This interface is not intended to be extended by clients. + * @noimplement This interface is not intended to be implemented by clients. + * @since 0.2.0 + */ +public interface IETypedElementSelectionWidgetFactory { + /** This is the default instance of this interface. */ + IETypedElementSelectionWidgetFactory DEFAULT = new ETypedElementSelectionWidgetFactory(); + + /** + * Open a dialog to let the user select ETypedElements + * + * @param selectionMaxSize + * the maximum number of typed elements that the user can select. + * @param allowEmpty + * whether to allow the user to select no ETypedElement (i.e : + * select <code>null</code>) + * @param parentComposite + * the parent composite + * @param customManager + * the customization manager used by the + * ICustomizableLabelProvider + * @since 0.2 + */ + IETypedElementSelectionWidget createETypedElementSelectionWidget( + int selectionMaxSize, + boolean allowEmpty, + Composite parentComposite, + ICustomizationManager customManager, + Collection<? extends EObject> knownEPackage); +}
diff --git a/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/modisco/facet/efacet/ui/internal/exported/widget/IFacetSetSelectionWidget.java b/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/modisco/facet/efacet/ui/internal/exported/widget/IFacetSetSelectionWidget.java new file mode 100644 index 0000000..044b318 --- /dev/null +++ b/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/modisco/facet/efacet/ui/internal/exported/widget/IFacetSetSelectionWidget.java
@@ -0,0 +1,51 @@ +/******************************************************************************* + * Copyright (c) 2012 CEA LIST. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Nicolas Bros (Mia-Software) - Bug 372865 - FacetSet selection dialog + *******************************************************************************/ +package org.eclipse.modisco.facet.efacet.ui.internal.exported.widget; + +import java.util.Collection; +import java.util.List; + +import org.eclipse.core.runtime.IStatus; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.FacetSet; +import org.eclipse.swt.widgets.Control; + +/** + * A widget to select one or more {@link FacetSet}s from a tree + * + * @since 0.2.0 + * @noextend This interface is not intended to be extended by clients. + * @noimplement This interface is not intended to be implemented by clients. + */ +public interface IFacetSetSelectionWidget { + + /** + * This method can be called at any time to change the {@link FacetSet}s which can be selected by the user. + * + * @param available + * the {@link FacetSet}s that can be selected in this widget + */ + void setAvailableFacetSets(Collection<? extends FacetSet> available); + + /** @return the list of selected {@link FacetSet}s */ + List<FacetSet> getSelectedFacetSets(); + + /** Select the given {@link FacetSet}s in this widget. */ + void setSelectedFacetSets(Collection<? extends FacetSet> newSelection); + + /** + * @return the validation status : the selection is not valid if {@link IStatus#getSeverity()} >= + * {@link IStatus#ERROR} + */ + IStatus getValidationStatus(); + + /** @return the SWT control */ + Control getControl(); +}
diff --git a/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/modisco/facet/efacet/ui/internal/exported/widget/IFacetSetSelectionWidgetFactory.java b/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/modisco/facet/efacet/ui/internal/exported/widget/IFacetSetSelectionWidgetFactory.java new file mode 100644 index 0000000..5a3fc05 --- /dev/null +++ b/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/modisco/facet/efacet/ui/internal/exported/widget/IFacetSetSelectionWidgetFactory.java
@@ -0,0 +1,44 @@ +/******************************************************************************* + * Copyright (c) 2012 CEA LIST. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Nicolas Bros (Mia-Software) - Bug 372865 - FacetSet selection dialog + *******************************************************************************/ +package org.eclipse.modisco.facet.efacet.ui.internal.exported.widget; + +import org.eclipse.modisco.facet.efacet.ui.internal.widget.FacetSetSelectionWidgetFactory; +import org.eclipse.swt.widgets.Composite; + +/** + * Factory for {@link IFacetSetSelectionWidget} + * + * @since 0.2.0 + * @noextend This interface is not intended to be extended by clients. + * @noimplement This interface is not intended to be implemented by clients. + */ +public interface IFacetSetSelectionWidgetFactory { + /** This is the default instance of this interface. */ + IFacetSetSelectionWidgetFactory DEFAULT = new FacetSetSelectionWidgetFactory(); + + /** + * Open a dialog to let the user select ETypedElements + * + * @param selectionMaxSize + * the maximum number of typed elements that the user can select. + * @param allowEmpty + * whether to allow the user to select no ETypedElement (i.e : select <code>null</code>) + * @param parentComposite + * the parent composite + * @param onChange + * called when the selection changes + */ + IFacetSetSelectionWidget createFacetSetSelectionWidget( + int selectionMaxSize, + boolean allowEmpty, + Composite parentComposite, + Runnable onChange); +}
diff --git a/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/modisco/facet/efacet/ui/internal/exported/widget/IUriWidget.java b/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/modisco/facet/efacet/ui/internal/exported/widget/IUriWidget.java new file mode 100644 index 0000000..c3cbbb2 --- /dev/null +++ b/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/modisco/facet/efacet/ui/internal/exported/widget/IUriWidget.java
@@ -0,0 +1,20 @@ +/******************************************************************************* + * Copyright (c) 2015 Soft-Maint. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Jonathan Pepin (Soft-Maint) - Bug 463907 - Command for load and save Facet serialization + *******************************************************************************/ +package org.eclipse.modisco.facet.efacet.ui.internal.exported.widget; + +import org.eclipse.emf.common.util.URI; + +public interface IUriWidget { + + URI getURI(); + void setURI(URI uri); + +}
diff --git a/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/modisco/facet/efacet/ui/internal/exported/widget/IUriWidgetFactory.java b/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/modisco/facet/efacet/ui/internal/exported/widget/IUriWidgetFactory.java new file mode 100644 index 0000000..14505d8 --- /dev/null +++ b/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/modisco/facet/efacet/ui/internal/exported/widget/IUriWidgetFactory.java
@@ -0,0 +1,26 @@ +/******************************************************************************* + * Copyright (c) 2015 Soft-Maint. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Jonathan Pepin (Soft-Maint) - Bug 463907 - Command for load and save Facet serialization + *******************************************************************************/ +package org.eclipse.modisco.facet.efacet.ui.internal.exported.widget; + + +import org.eclipse.modisco.facet.efacet.ui.internal.widget.UriWidgetFactory; +import org.eclipse.swt.widgets.Composite; + +/* + * @since 1.0 + */ +public interface IUriWidgetFactory { + + IUriWidgetFactory DEFAULT = new UriWidgetFactory(); + + IUriWidget createUriWidget(Composite parent); + +}
diff --git a/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/modisco/facet/efacet/ui/internal/exported/wizard/ICreateFacetInFacetSetWizard2.java b/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/modisco/facet/efacet/ui/internal/exported/wizard/ICreateFacetInFacetSetWizard2.java new file mode 100644 index 0000000..58e5dc0 --- /dev/null +++ b/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/modisco/facet/efacet/ui/internal/exported/wizard/ICreateFacetInFacetSetWizard2.java
@@ -0,0 +1,34 @@ +/** + * Copyright (c) 2011 Mia-Software. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Nicolas Guyomar (Mia-Software) - Bug 349546 - EMF Facet facetSet editor + * Gregoire Dupe (Mia-Software) - Bug 361617 - Deprecation of APIs for the old Facet metamodels + */ +package org.eclipse.modisco.facet.efacet.ui.internal.exported.wizard; + +import org.eclipse.emf.ecore.EClass; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.FacetSet; + +/** + * TODO This interface has to be renamed to ICreateFacetInFacetSetWizard before the release of 0.2 + * @since 0.2 + */ +//TODO This interface has to be renamed to ICreateFacetInFacetSetWizard before the release of 0.2 +public interface ICreateFacetInFacetSetWizard2 { + + public void setFacetSet(FacetSet facetSet); + + public void canChangeFacetSet(boolean canChange); + + public void setExtendedMetaClass(EClass extendedMetaClass); + + public void canChangeExtendedMetaClass(boolean canChange); + + public int open(); +}
diff --git a/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/modisco/facet/efacet/ui/internal/exported/wizard/ICreateFacetSetWizard.java b/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/modisco/facet/efacet/ui/internal/exported/wizard/ICreateFacetSetWizard.java new file mode 100644 index 0000000..5841e7d --- /dev/null +++ b/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/modisco/facet/efacet/ui/internal/exported/wizard/ICreateFacetSetWizard.java
@@ -0,0 +1,18 @@ +/** + * Copyright (c) 2011 Mia-Software. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Nicolas Guyomar (Mia-Software) - Bug 349546 - EMF Facet facetSet editor + */ +package org.eclipse.modisco.facet.efacet.ui.internal.exported.wizard; + +public interface ICreateFacetSetWizard { + + public int open(); + +}
diff --git a/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/modisco/facet/efacet/ui/internal/exported/wizard/IFacetChildrenWizard2.java b/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/modisco/facet/efacet/ui/internal/exported/wizard/IFacetChildrenWizard2.java new file mode 100644 index 0000000..4f7cd03 --- /dev/null +++ b/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/modisco/facet/efacet/ui/internal/exported/wizard/IFacetChildrenWizard2.java
@@ -0,0 +1,47 @@ +/** + * Copyright (c) 2011 Mia-Software. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Nicolas Guyomar (Mia-Software) - Bug 349546 - EMF Facet facetSet editor + * Gregoire Dupe (Mia-Software) - Bug 361617 - Deprecation of APIs for the old Facet metamodels + */ +package org.eclipse.modisco.facet.efacet.ui.internal.exported.wizard; + +import org.eclipse.emf.ecore.EClass; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.Facet; + +/** + * + * @since 0.2 + */ +//TODO This interface has to be renamed to ICreateFacetInFacetSetWizard before the release of 0.2 +public interface IFacetChildrenWizard2 { + + public int open(); + + public void setFacet(Facet facet); + + public void setChildrenName(String name); + + public void setUpperBound(int upperBound); + + public void setLowerBound(int lowerBound); + + public void setType(EClass type); + + public void canChangeFacet(boolean canChange); + + public void canChangeChildrenName(boolean canChange); + + public void canChangeUpperBound(boolean canChange); + + public void canChangeLowerBound(boolean canChange); + + public void canChangeType(boolean canChange); + +}
diff --git a/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/modisco/facet/efacet/ui/internal/exported/wizard/ISelectETypeWizard.java b/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/modisco/facet/efacet/ui/internal/exported/wizard/ISelectETypeWizard.java new file mode 100644 index 0000000..37e71a7 --- /dev/null +++ b/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/modisco/facet/efacet/ui/internal/exported/wizard/ISelectETypeWizard.java
@@ -0,0 +1,20 @@ +/** + * Copyright (c) 2011 Mia-Software. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Nicolas Guyomar (Mia-Software) - Bug 349546 - EMF Facet facetSet editor + */ +package org.eclipse.modisco.facet.efacet.ui.internal.exported.wizard; + +import org.eclipse.emf.ecore.EClassifier; + +public interface ISelectETypeWizard { + public int open(); + + public EClassifier getSelectedEType(); +}
diff --git a/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/modisco/facet/efacet/ui/internal/handlers/LoadFacetHandler.java b/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/modisco/facet/efacet/ui/internal/handlers/LoadFacetHandler.java new file mode 100644 index 0000000..bdf6b33 --- /dev/null +++ b/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/modisco/facet/efacet/ui/internal/handlers/LoadFacetHandler.java
@@ -0,0 +1,78 @@ +/******************************************************************************* + * Copyright (c) 2014, 2015 Mia-Software, and Soft-Maint. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Gregoire Dupe (Mia-Software) - Bug 441051 - Reusable customization and facet loading dialogs + * Thomas Cicognani (Soft-Maint) - Bug 471681 - Error when accepting FacetSet selection dialog + *******************************************************************************/ +package org.eclipse.modisco.facet.efacet.ui.internal.handlers; + +import java.util.ArrayList; +import java.util.HashSet; +import java.util.List; + +import org.eclipse.core.commands.AbstractHandler; +import org.eclipse.core.commands.ExecutionEvent; +import org.eclipse.core.commands.ExecutionException; +import org.eclipse.emf.ecore.resource.ResourceSet; +import org.eclipse.modisco.facet.efacet.core.IFacetManager; +import org.eclipse.modisco.facet.efacet.core.IFacetManagerProvider; +import org.eclipse.modisco.facet.efacet.core.IFacetSetCatalogManager; +import org.eclipse.modisco.facet.efacet.core.IFacetSetCatalogManagerFactory; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.FacetSet; +import org.eclipse.modisco.facet.efacet.ui.internal.exported.dialog.IFacetSetSelectionDialog; +import org.eclipse.modisco.facet.efacet.ui.internal.exported.dialog.IFacetSetSelectionDialogFactory; +import org.eclipse.modisco.facet.util.ui.internal.exported.dialog.IDialogCallback; +import org.eclipse.modisco.facet.util.ui.internal.exported.dialog.IDialogCallbackWithPreCommit; +import org.eclipse.modisco.facet.util.ui.internal.exported.dialog.IQuestionDialog; +import org.eclipse.swt.widgets.Shell; +import org.eclipse.ui.IWorkbenchPart; +import org.eclipse.ui.handlers.HandlerUtil; + +public class LoadFacetHandler extends AbstractHandler { + + public Object execute(final ExecutionEvent event) throws ExecutionException { + final IWorkbenchPart activePart = HandlerUtil.getActivePart(event); + if (activePart != null) { + final IFacetManagerProvider facetMgrProvider = (IFacetManagerProvider) activePart + .getAdapter(IFacetManagerProvider.class); + final IFacetManager facetManager = facetMgrProvider.getFacetManager(); + if (facetManager != null) { + final ResourceSet resourceSet = facetManager.getResourceSet(); + final IFacetSetCatalogManager catalog = IFacetSetCatalogManagerFactory.DEFAULT + .getOrCreateFacetSetCatalogManager(resourceSet); + final HashSet<FacetSet> availableFS = new HashSet<FacetSet>(); + availableFS.addAll(catalog.getRegisteredFacetSets()); + final IDialogCallbackWithPreCommit<List<FacetSet>, Boolean, IQuestionDialog> callback = new IDialogCallbackWithPreCommit<List<FacetSet>, Boolean, IQuestionDialog>() { + + public void committed(final List<FacetSet> result, + final Boolean precommitResult) { + final List<FacetSet> toBeRemoved = new ArrayList<FacetSet>(); + toBeRemoved.addAll(facetManager.getManagedFacetSets()); + toBeRemoved.removeAll(result); + facetManager.getManagedFacetSets().removeAll(toBeRemoved); + facetManager.getManagedFacetSets().addAll(result); + } + + public IQuestionDialog openPrecommitDialog( + final List<FacetSet> result, + final IDialogCallback<Boolean> precommitCallback) { + return null; + } + }; + + final Shell shell = activePart.getSite().getShell(); + final IFacetSetSelectionDialog<IQuestionDialog> dialog = IFacetSetSelectionDialogFactory.DEFAULT + .openFacetSetSelectionDialog(availableFS, + Integer.MAX_VALUE, true, callback, shell); + dialog.setSelectedFacetSets(facetManager.getManagedFacetSets()); + } + } + return null; + } +}
diff --git a/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/modisco/facet/efacet/ui/internal/handlers/NavigationHandler.java b/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/modisco/facet/efacet/ui/internal/handlers/NavigationHandler.java new file mode 100644 index 0000000..85e9c88 --- /dev/null +++ b/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/modisco/facet/efacet/ui/internal/handlers/NavigationHandler.java
@@ -0,0 +1,70 @@ +/** + * Copyright (c) 2011, 2015 Mia-Software. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Grégoire Dupé (Mia-Software) - Bug 364325 - [Restructuring] The user must be able to navigate into a model using the Facet. + * Nicolas Bros (Mia-Software) - Bug 379395 - Navigate should replace elements + * Grégoire Dupé (Mia-Software) - Bug 480654 - IllegalStateException in NavigationView.addEObjects (611) + */ +package org.eclipse.modisco.facet.efacet.ui.internal.handlers; + +import java.util.LinkedList; +import java.util.List; + +import org.eclipse.core.commands.AbstractHandler; +import org.eclipse.core.commands.ExecutionEvent; +import org.eclipse.core.commands.ExecutionException; +import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.edit.domain.EditingDomain; +import org.eclipse.emf.edit.domain.IEditingDomainProvider; +import org.eclipse.jface.viewers.ISelection; +import org.eclipse.jface.viewers.IStructuredSelection; +import org.eclipse.modisco.facet.efacet.ui.internal.exported.view.INavigationView; +import org.eclipse.modisco.facet.efacet.ui.internal.exported.view.INavigationViewFactory; +import org.eclipse.ui.IEditorPart; +import org.eclipse.ui.PlatformUI; + +/** + * This class handle the action "Add facet attribute" + */ +public class NavigationHandler extends AbstractHandler { + + public Object execute(final ExecutionEvent event) throws ExecutionException { + final ISelection selection = PlatformUI.getWorkbench() + .getActiveWorkbenchWindow().getSelectionService() + .getSelection(); + + // Retrieve the editor + final IEditorPart editor = PlatformUI.getWorkbench() + .getActiveWorkbenchWindow().getActivePage().getActiveEditor(); + // Retrieve the editing domain + + EditingDomain editingDomain = null; + if (editor instanceof IEditingDomainProvider) { + final IEditingDomainProvider edProvider = (IEditingDomainProvider) editor; + editingDomain = edProvider.getEditingDomain(); + } + + final List<EObject> eObjects = new LinkedList<EObject>(); + final INavigationView view = INavigationViewFactory.DEFAULT + .openNavigationView(editingDomain); + if (selection instanceof IStructuredSelection) { + final IStructuredSelection sSelection = (IStructuredSelection) selection; + for (Object object : sSelection.toList()) { + if (object instanceof EObject) { + final EObject eObject = (EObject) object; + eObjects.add(eObject); + } + } + } + view.removeAllEObjects(); + view.addEObjects2(eObjects); + return null; + } + +}
diff --git a/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/modisco/facet/efacet/ui/internal/handlers/SaveStructuralFeatureInstanceModelHandler.java b/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/modisco/facet/efacet/ui/internal/handlers/SaveStructuralFeatureInstanceModelHandler.java new file mode 100644 index 0000000..f865b9a --- /dev/null +++ b/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/modisco/facet/efacet/ui/internal/handlers/SaveStructuralFeatureInstanceModelHandler.java
@@ -0,0 +1,67 @@ +/******************************************************************************* + * Copyright (c) 2015 Soft-Maint. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Jonathan Pepin (Soft-Maint) - Bug 463907 - Command for load and save Facet serialization + * Grégoire Dupé (Soft-Maint) - Bug 469959 - NullPointerException in SetStructuralFeatureInstanceResourceHandler.execute (42) + *******************************************************************************/ +package org.eclipse.modisco.facet.efacet.ui.internal.handlers; + +import org.eclipse.core.commands.AbstractHandler; +import org.eclipse.core.commands.ExecutionEvent; +import org.eclipse.core.commands.ExecutionException; +import org.eclipse.modisco.facet.efacet.core.IFacetManager; +import org.eclipse.modisco.facet.efacet.core.exception.FacetManagerException; +import org.eclipse.modisco.facet.efacet.ui.internal.Activator; +import org.eclipse.modisco.facet.efacet.ui.internal.Messages; +import org.eclipse.modisco.facet.util.core.Logger; +import org.eclipse.modisco.facet.util.ui.internal.exported.dialog.IOkDialogFactory; +import org.eclipse.swt.widgets.Shell; +import org.eclipse.ui.IWorkbenchPart; +import org.eclipse.ui.IWorkbenchPartSite; +import org.eclipse.ui.handlers.HandlerUtil; + +public class SaveStructuralFeatureInstanceModelHandler extends AbstractHandler { + + @Override + public boolean isEnabled() { + final IFacetManager facetManager = Utils.getFacetManager(); + return (facetManager != null) + && (facetManager.getSerializationResource() != null); + } + + @Override + public boolean isHandled() { + final IFacetManager facetManager = Utils.getFacetManager(); + return (facetManager != null) + && (facetManager.getSerializationResource() != null); + } + + public Object execute(final ExecutionEvent event) throws ExecutionException { + Object result = null; + final IFacetManager facetManager = Utils.getFacetManager(event); + if (facetManager != null) { + try { + facetManager.saveStructuralFeatureInstanceModel(); + } catch (FacetManagerException e) { + Logger.logError( + e, + "Failed to save the \"structural feature instance model\".", //$NON-NLS-1$ + Activator.getDefault()); + final IWorkbenchPart activePart = HandlerUtil.getActivePart(event); + final IWorkbenchPartSite site = activePart.getSite(); + final Shell shell = site.getShell(); + result = IOkDialogFactory.DEFAULT.openErrorDialog( + shell, + e, + Messages.SaveStructuralFeatureInstanceModelHandler_FailedToSaveTheStructuralFeatureInstanceModel); + } + } + return result; + } +} +
diff --git a/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/modisco/facet/efacet/ui/internal/handlers/SetStructuralFeatureInstanceResourceHandler.java b/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/modisco/facet/efacet/ui/internal/handlers/SetStructuralFeatureInstanceResourceHandler.java new file mode 100644 index 0000000..79ee9b5 --- /dev/null +++ b/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/modisco/facet/efacet/ui/internal/handlers/SetStructuralFeatureInstanceResourceHandler.java
@@ -0,0 +1,91 @@ +/******************************************************************************* + * Copyright (c) 2015 Soft-Maint. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Jonathan Pepin (Soft-Maint) - Bug 463907 - Command for load and save Facet serialization + * Grégoire Dupé (Soft-Maint) - Bug 469959 - NullPointerException in SetStructuralFeatureInstanceResourceHandler.execute (42) + *******************************************************************************/ +package org.eclipse.modisco.facet.efacet.ui.internal.handlers; + +import org.eclipse.core.commands.AbstractHandler; +import org.eclipse.core.commands.ExecutionEvent; +import org.eclipse.core.commands.ExecutionException; +import org.eclipse.emf.common.util.URI; +import org.eclipse.emf.ecore.resource.Resource; +import org.eclipse.emf.ecore.resource.ResourceSet; +import org.eclipse.modisco.facet.efacet.core.IFacetManager; +import org.eclipse.modisco.facet.efacet.core.exception.FacetManagerException; +import org.eclipse.modisco.facet.efacet.ui.internal.Messages; +import org.eclipse.modisco.facet.efacet.ui.internal.exported.dialog.IUriDialogFactory; +import org.eclipse.modisco.facet.util.ui.internal.exported.dialog.IDialogCallback; +import org.eclipse.modisco.facet.util.ui.internal.exported.dialog.IOkDialogFactory; +import org.eclipse.swt.widgets.Display; +import org.eclipse.swt.widgets.Shell; +import org.eclipse.ui.IWorkbenchPart; +import org.eclipse.ui.IWorkbenchPartSite; +import org.eclipse.ui.handlers.HandlerUtil; + +public class SetStructuralFeatureInstanceResourceHandler extends + AbstractHandler { + + @Override + public boolean isEnabled() { + return Utils.getFacetManager() != null; + } + + @Override + public boolean isHandled() { + return Utils.getFacetManager() != null; + } + + public Object execute(final ExecutionEvent event) throws ExecutionException { + Object result = null; + final IFacetManager facetManager = Utils.getFacetManager(event); + if (facetManager != null) { + final IWorkbenchPart activePart = HandlerUtil.getActivePart(event); + final IWorkbenchPartSite site = activePart.getSite(); + final Shell shell = site.getShell(); + final URI uri = getSResourceUri(facetManager); + final IDialogCallback<URI> callback = new IDialogCallback<URI>() { + public void committed(final URI resultUri) { + changeSerializationMgrURI(facetManager, resultUri); + } + }; + result = IUriDialogFactory.DEFAULT.openUriDialog(uri, + callback, shell, Display.getDefault()); + } + return result; + } + + private static URI getSResourceUri(final IFacetManager facetManager) { + final Resource sResource = facetManager.getSerializationResource(); + URI uri = null; + if (sResource != null) { + uri = sResource.getURI(); + } + return uri; + } + + public static void changeSerializationMgrURI(final IFacetManager facetManager, + final URI uri) { + Resource sResource = null; + final ResourceSet resourceSet = facetManager.getResourceSet(); + try { + sResource = resourceSet.getResource(uri, true); + } catch (Exception e) { + sResource = resourceSet.createResource(uri); + } + try { + facetManager.setSerializationResource(sResource); + } catch (FacetManagerException e) { + IOkDialogFactory.DEFAULT.openErrorDialog( + new Shell(), + e, + Messages.SetStructuralFeatureInstanceResourceHandler_SerializationUriSettigFailed); + } + } +}
diff --git a/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/modisco/facet/efacet/ui/internal/handlers/Utils.java b/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/modisco/facet/efacet/ui/internal/handlers/Utils.java new file mode 100644 index 0000000..df89a9e --- /dev/null +++ b/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/modisco/facet/efacet/ui/internal/handlers/Utils.java
@@ -0,0 +1,48 @@ +/******************************************************************************* + * Copyright (c) 2015 Mia-Software. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Grégoire Dupé (Soft-Maint) - Bug 469959 - NullPointerException in SetStructuralFeatureInstanceResourceHandler.execute (42) + *******************************************************************************/ +package org.eclipse.modisco.facet.efacet.ui.internal.handlers; + +import org.eclipse.core.commands.ExecutionEvent; +import org.eclipse.modisco.facet.efacet.core.IFacetManager; +import org.eclipse.modisco.facet.efacet.core.IFacetManagerProvider; +import org.eclipse.modisco.facet.util.ui.internal.exported.handler.HandlerUtils; +import org.eclipse.ui.IWorkbenchPart; +import org.eclipse.ui.handlers.HandlerUtil; + +public final class Utils { + + private Utils() { + // Must not be used + } + + public static IFacetManager getFacetManager() { + final IWorkbenchPart activePart = HandlerUtils.getActivePart(); + return getFacetManager(activePart); + } + + public static IFacetManager getFacetManager(final ExecutionEvent event) { + final IWorkbenchPart activePart = HandlerUtil.getActivePart(event); + return getFacetManager(activePart); + } + + private static IFacetManager getFacetManager(final IWorkbenchPart activePart) { + IFacetManager result = null; + if (activePart != null) { + final IFacetManagerProvider facetMgrProvider = (IFacetManagerProvider) activePart + .getAdapter(IFacetManagerProvider.class); + if (facetMgrProvider != null) { + result = facetMgrProvider.getFacetManager(); + } + } + return result; + } + +}
diff --git a/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/emf/facet/efacet/ui/internal/messages.properties b/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/modisco/facet/efacet/ui/internal/messages.properties similarity index 100% rename from org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/emf/facet/efacet/ui/internal/messages.properties rename to org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/modisco/facet/efacet/ui/internal/messages.properties
diff --git a/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/modisco/facet/efacet/ui/internal/preferences/PreferenceConstants.java b/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/modisco/facet/efacet/ui/internal/preferences/PreferenceConstants.java new file mode 100644 index 0000000..27f769a --- /dev/null +++ b/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/modisco/facet/efacet/ui/internal/preferences/PreferenceConstants.java
@@ -0,0 +1,22 @@ +/** + * Copyright (c) 2012 CEA-LIST. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Vincent Lorenzo (CEA-LIST) - Bug 357621 - Improve the label displayed for Customization and Facets + * Gregoire Dupe (CEA-LIST) - Bug 357621 - Improve the label displayed for Customization and Facets + */ +package org.eclipse.modisco.facet.efacet.ui.internal.preferences; + +public final class PreferenceConstants { + + public static final String TE_SELECTION_TAB = "ETypedElementSelectionDialogPreferedTab"; //$NON-NLS-1$ + + private PreferenceConstants() { + //nothing to do + } +}
diff --git a/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/modisco/facet/efacet/ui/internal/preferences/PreferencesInitializer.java b/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/modisco/facet/efacet/ui/internal/preferences/PreferencesInitializer.java new file mode 100644 index 0000000..a195843 --- /dev/null +++ b/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/modisco/facet/efacet/ui/internal/preferences/PreferencesInitializer.java
@@ -0,0 +1,27 @@ +/** + * Copyright (c) 2012 CEA-LIST. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Vincent Lorenzo (CEA-LIST) - Bug 357621 - Improve the label displayed for Customization and Facets + */ +package org.eclipse.modisco.facet.efacet.ui.internal.preferences; + +import org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer; +import org.eclipse.jface.preference.IPreferenceStore; +import org.eclipse.modisco.facet.efacet.ui.internal.Activator; +import org.eclipse.modisco.facet.efacet.ui.internal.widget.ETypedElementSelectionControl; + +public class PreferencesInitializer extends AbstractPreferenceInitializer { + + @Override + public void initializeDefaultPreferences() { + IPreferenceStore store = Activator.getDefault().getPreferenceStore(); + store.setDefault(PreferenceConstants.TE_SELECTION_TAB,ETypedElementSelectionControl.TAB_ID ); + } + +}
diff --git a/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/modisco/facet/efacet/ui/internal/sync/generated/SynchronizedNavigationView.java b/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/modisco/facet/efacet/ui/internal/sync/generated/SynchronizedNavigationView.java new file mode 100644 index 0000000..1448777 --- /dev/null +++ b/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/modisco/facet/efacet/ui/internal/sync/generated/SynchronizedNavigationView.java
@@ -0,0 +1,134 @@ +/** + * Copyright (c) 2015 Mia-Software. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Grégoire Dupé (Mia-Software) - Bug 480654 - IllegalStateException in NavigationView.addEObjects (611) + */ + +package org.eclipse.modisco.facet.efacet.ui.internal.sync.generated; + +import org.eclipse.modisco.facet.util.ui.internal.exported.displaysync.AbstractExceptionFreeRunnable; +import org.eclipse.modisco.facet.util.ui.internal.exported.displaysync.AbstractVoidExceptionFreeRunnable; +import org.eclipse.modisco.facet.util.ui.internal.exported.displaysync.SynchronizedObject; +import org.eclipse.swt.widgets.Display; + +@SuppressWarnings("PMD.ExcessivePublicCount") +public class SynchronizedNavigationView extends SynchronizedObject<org.eclipse.modisco.facet.efacet.ui.internal.exported.view.INavigationView> implements org.eclipse.modisco.facet.efacet.ui.internal.exported.view.INavigationView { + + public SynchronizedNavigationView(final org.eclipse.modisco.facet.efacet.ui.internal.exported.view.INavigationView object, final Display display) { + super(object, display); + } + public final void addEObjects(final java.util.Collection<? extends org.eclipse.emf.ecore.EObject> parm0) { + voidExceptionFreeRunnable(new AbstractVoidExceptionFreeRunnable() { + @Override + public void voidSafeRun() { + SynchronizedNavigationView.this.getSynchronizedObject().addEObjects(parm0); + } + }); + } + + public final org.eclipse.modisco.facet.util.ui.internal.exported.dialog.IOkDialog addEObjects2(final java.util.Collection<? extends org.eclipse.emf.ecore.EObject> parm0) { + return safeSyncExec(new AbstractExceptionFreeRunnable<org.eclipse.modisco.facet.util.ui.internal.exported.dialog.IOkDialog>() { + @Override + public org.eclipse.modisco.facet.util.ui.internal.exported.dialog.IOkDialog safeRun() { + return SynchronizedNavigationView.this.getSynchronizedObject().addEObjects2(parm0); + } + }); + } + + public final java.util.List<org.eclipse.modisco.facet.efacet.ui.IETypedElementResultDisplayerOpener> getAvailableSelectedDisplayers() { + return safeSyncExec(new AbstractExceptionFreeRunnable<java.util.List<org.eclipse.modisco.facet.efacet.ui.IETypedElementResultDisplayerOpener>>() { + @Override + public java.util.List<org.eclipse.modisco.facet.efacet.ui.IETypedElementResultDisplayerOpener> safeRun() { + return SynchronizedNavigationView.this.getSynchronizedObject().getAvailableSelectedDisplayers(); + } + }); + } + + public final org.eclipse.modisco.facet.efacet.ui.IETypedElementResultDisplayerOpener getSelectedDisplayer() { + return safeSyncExec(new AbstractExceptionFreeRunnable<org.eclipse.modisco.facet.efacet.ui.IETypedElementResultDisplayerOpener>() { + @Override + public org.eclipse.modisco.facet.efacet.ui.IETypedElementResultDisplayerOpener safeRun() { + return SynchronizedNavigationView.this.getSynchronizedObject().getSelectedDisplayer(); + } + }); + } + + public final org.eclipse.emf.ecore.ETypedElement getSelectedETypedElement() { + return safeSyncExec(new AbstractExceptionFreeRunnable<org.eclipse.emf.ecore.ETypedElement>() { + @Override + public org.eclipse.emf.ecore.ETypedElement safeRun() { + return SynchronizedNavigationView.this.getSynchronizedObject().getSelectedETypedElement(); + } + }); + } + + public final java.util.List<org.eclipse.emf.ecore.EClassifier> getUsableEClassifiers() { + return safeSyncExec(new AbstractExceptionFreeRunnable<java.util.List<org.eclipse.emf.ecore.EClassifier>>() { + @Override + public java.util.List<org.eclipse.emf.ecore.EClassifier> safeRun() { + return SynchronizedNavigationView.this.getSynchronizedObject().getUsableEClassifiers(); + } + }); + } + + public final org.eclipse.ui.part.WorkbenchPart preform() { + return safeSyncExec(new AbstractExceptionFreeRunnable<org.eclipse.ui.part.WorkbenchPart>() { + @Override + public org.eclipse.ui.part.WorkbenchPart safeRun() { + return SynchronizedNavigationView.this.getSynchronizedObject().preform(); + } + }); + } + + public final void removeAllEObjects() { + voidExceptionFreeRunnable(new AbstractVoidExceptionFreeRunnable() { + @Override + public void voidSafeRun() { + SynchronizedNavigationView.this.getSynchronizedObject().removeAllEObjects(); + } + }); + } + + public final void removeEObject(final org.eclipse.emf.ecore.EObject parm0) { + voidExceptionFreeRunnable(new AbstractVoidExceptionFreeRunnable() { + @Override + public void voidSafeRun() { + SynchronizedNavigationView.this.getSynchronizedObject().removeEObject(parm0); + } + }); + } + + public final void removeEObjects(final java.util.List<? extends org.eclipse.emf.ecore.EObject> parm0) { + voidExceptionFreeRunnable(new AbstractVoidExceptionFreeRunnable() { + @Override + public void voidSafeRun() { + SynchronizedNavigationView.this.getSynchronizedObject().removeEObjects(parm0); + } + }); + } + + public final void selectETypedElement(final org.eclipse.emf.ecore.ETypedElement parm0) { + voidExceptionFreeRunnable(new AbstractVoidExceptionFreeRunnable() { + @Override + public void voidSafeRun() { + SynchronizedNavigationView.this.getSynchronizedObject().selectETypedElement(parm0); + } + }); + } + + public final void setSelectDisplayer(final org.eclipse.modisco.facet.efacet.ui.IETypedElementResultDisplayerOpener parm0) { + voidExceptionFreeRunnable(new AbstractVoidExceptionFreeRunnable() { + @Override + public void voidSafeRun() { + SynchronizedNavigationView.this.getSynchronizedObject().setSelectDisplayer(parm0); + } + }); + } + +}
diff --git a/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/modisco/facet/efacet/ui/internal/sync/generated/SynchronizedNavigationViewFactory.java b/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/modisco/facet/efacet/ui/internal/sync/generated/SynchronizedNavigationViewFactory.java new file mode 100644 index 0000000..f586c0d --- /dev/null +++ b/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/modisco/facet/efacet/ui/internal/sync/generated/SynchronizedNavigationViewFactory.java
@@ -0,0 +1,35 @@ +/** + * Copyright (c) 2015 Mia-Software. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Grégoire Dupé (Mia-Software) - Bug 480654 - IllegalStateException in NavigationView.addEObjects (611) + */ + +package org.eclipse.modisco.facet.efacet.ui.internal.sync.generated; + +import org.eclipse.modisco.facet.util.ui.internal.exported.displaysync.AbstractExceptionFreeRunnable; +import org.eclipse.modisco.facet.util.ui.internal.exported.displaysync.AbstractVoidExceptionFreeRunnable; +import org.eclipse.modisco.facet.util.ui.internal.exported.displaysync.SynchronizedObject; +import org.eclipse.swt.widgets.Display; + +@SuppressWarnings("PMD.ExcessivePublicCount") +public class SynchronizedNavigationViewFactory extends SynchronizedObject<org.eclipse.modisco.facet.efacet.ui.internal.exported.view.INavigationViewFactory> implements org.eclipse.modisco.facet.efacet.ui.internal.exported.view.INavigationViewFactory { + + public SynchronizedNavigationViewFactory(final org.eclipse.modisco.facet.efacet.ui.internal.exported.view.INavigationViewFactory object, final Display display) { + super(object, display); + } + public final org.eclipse.modisco.facet.efacet.ui.internal.exported.view.INavigationView openNavigationView(final org.eclipse.emf.edit.domain.EditingDomain parm0) { + return safeSyncExec(new AbstractExceptionFreeRunnable<org.eclipse.modisco.facet.efacet.ui.internal.exported.view.INavigationView>() { + @Override + public org.eclipse.modisco.facet.efacet.ui.internal.exported.view.INavigationView safeRun() { + return SynchronizedNavigationViewFactory.this.getSynchronizedObject().openNavigationView(parm0); + } + }); + } + +}
diff --git a/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/modisco/facet/efacet/ui/internal/utils/ImageProvider.java b/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/modisco/facet/efacet/ui/internal/utils/ImageProvider.java new file mode 100644 index 0000000..7de1ea1 --- /dev/null +++ b/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/modisco/facet/efacet/ui/internal/utils/ImageProvider.java
@@ -0,0 +1,95 @@ +/** + * Copyright (c) 2011 Mia-Software. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Nicolas Guyomar (Mia-Software) - Bug 349546 - EMF Facet facetSet editor + * Vincent Lorenzo (CEA-LIST) - Bug 357621 - Improve the label displayed for Customization and Facets + */ +package org.eclipse.modisco.facet.efacet.ui.internal.utils; + +import java.net.URL; + +import org.eclipse.jface.resource.ImageDescriptor; +import org.eclipse.modisco.facet.efacet.ui.internal.Activator; +import org.eclipse.modisco.facet.util.core.Logger; +import org.eclipse.osgi.util.NLS; +import org.eclipse.swt.graphics.Image; + +public class ImageProvider { + + private static ImageProvider instance; + + public static ImageProvider getInstance() { + if (ImageProvider.instance == null) { + ImageProvider.instance = new ImageProvider(); + } + return ImageProvider.instance; + } + + private static final String QUERY_SET_ICON_PATH = "/icons/querySet.gif"; //$NON-NLS-1$ + private static final String FACET_ICON_PATH = "/icons/facet.gif"; //$NON-NLS-1$ + private static final String FLAT_VIEW_ICON_PATH = "/icons/flatView.gif"; //$NON-NLS-1$ + private static final String TREE_VIEW_ICON_PATH = "/icons/treeView.gif"; //$NON-NLS-1$ + + private Image facetIcon; + private Image queryIcon; + private Image flatViewIcon; + private Image treeViewIcon; + + /** + * Create an image descriptor from a resource + * + * @param resourcePath + * the path of the resource (in the bundle) + * @return the image descriptor + */ + private static ImageDescriptor createImageDescriptor(final String resourcePath) { + final URL url = Activator.getDefault().getBundle().getResource(resourcePath); + if (url == null) { + Logger.logError(NLS.bind("Resource not found: {0}", //$NON-NLS-1$ + resourcePath), Activator.getDefault()); + return ImageDescriptor.getMissingImageDescriptor(); + } + return ImageDescriptor.createFromURL(url); + } + + /** Return the icon representing a query */ + public Image getFacetIcon() { + if (this.facetIcon == null) { + this.facetIcon = createImageDescriptor(ImageProvider.FACET_ICON_PATH).createImage(); + } + return this.facetIcon; + } + + /** Return the descriptor representing a query */ + public static ImageDescriptor getFacetIconDescriptor() { + return createImageDescriptor(ImageProvider.FACET_ICON_PATH); + } + + /** Return the icon representing a querySet */ + public Image getQuerySetIcon() { + if (this.queryIcon == null) { + this.queryIcon = createImageDescriptor(ImageProvider.QUERY_SET_ICON_PATH).createImage(); + } + return this.queryIcon; + } + + public Image getFlatViewIcon(){ + if (this.flatViewIcon == null) { + this.flatViewIcon = createImageDescriptor(ImageProvider.FLAT_VIEW_ICON_PATH).createImage(); + } + return this.flatViewIcon; + } + public Image getTreeViewIcon(){ + if (this.treeViewIcon == null) { + this.treeViewIcon = createImageDescriptor(ImageProvider.TREE_VIEW_ICON_PATH).createImage(); + } + return this.treeViewIcon; + } + +}
diff --git a/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/modisco/facet/efacet/ui/internal/view/ContextPaneMenuManager.java b/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/modisco/facet/efacet/ui/internal/view/ContextPaneMenuManager.java new file mode 100644 index 0000000..0643a79 --- /dev/null +++ b/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/modisco/facet/efacet/ui/internal/view/ContextPaneMenuManager.java
@@ -0,0 +1,94 @@ +/******************************************************************************* + * Copyright (c) 2010, 2012 Mia-Software. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Nicolas Bros (Mia-Software) + * Gregoire Dupe (Mia-Software) - Bug 364325 - [Restructuring] The user must be able to navigate into a model using the Facet. + *******************************************************************************/ +package org.eclipse.modisco.facet.efacet.ui.internal.view; + +import org.eclipse.emf.ecore.EObject; +import org.eclipse.jface.action.Action; +import org.eclipse.jface.action.IAction; +import org.eclipse.jface.action.IMenuListener; +import org.eclipse.jface.action.IMenuManager; +import org.eclipse.jface.action.MenuManager; +import org.eclipse.jface.viewers.TreeViewer; +import org.eclipse.modisco.facet.efacet.ui.internal.ImageProvider; +import org.eclipse.modisco.facet.efacet.ui.internal.view.NavigationView.ContextInfo; +import org.eclipse.swt.SWT; +import org.eclipse.swt.events.KeyAdapter; +import org.eclipse.swt.events.KeyEvent; + +@SuppressWarnings("synthetic-access") +//Copied from org.eclipse.emf.facet.infra.query.ui.views.queryExecution.internal.ContextPaneMenuManager +public class ContextPaneMenuManager extends MenuManager implements IMenuListener { + + private final EditableContext context; + private final NavigationView queryExecutionView; + + public ContextPaneMenuManager(final NavigationView queryExecutionView, + final EditableContext context, final TreeViewer treeViewer) { + this.queryExecutionView = queryExecutionView; + this.context = context; + addMenuActions(); + addMenuListener(this); + addKeyShortcuts(treeViewer); + } + + private void addKeyShortcuts(final TreeViewer treeViewer) { + treeViewer.getTree().addKeyListener(new KeyAdapter() { + @Override + public void keyPressed(final KeyEvent e) { + if (e.keyCode == SWT.DEL) { + ContextPaneMenuManager.this.removeSelectedElementsAction.run(); + } + } + }); + } + + private void addMenuActions() { + this.add(this.removeSelectedElementsAction); + this.add(this.removeAllAction); + } + + /** This action removes all model elements from the context */ + private final IAction removeAllAction = new Action("Remove all") { + { + setImageDescriptor(ImageProvider.getInstance().getRemoveAllImageDescriptor()); + } + + @Override + public void run() { + ContextPaneMenuManager.this.context.clear(); + ContextPaneMenuManager.this.context.done(); + } + }; + + /** This action removes selected model elements from the context */ + private final IAction removeSelectedElementsAction = new Action("Remove") { + { + setImageDescriptor(ImageProvider.getInstance().getRemoveImageDescriptor()); + } + + @Override + public void run() { + ContextInfo contextInfo = ContextPaneMenuManager.this.queryExecutionView + .getContextInfo(); + for (EObject eObject : contextInfo.getSelectedEObjects()) { + ContextPaneMenuManager.this.context.remove(eObject); + } + ContextPaneMenuManager.this.context.done(); + } + }; + + public void menuAboutToShow(final IMenuManager manager) { + ContextInfo contextInfo = ContextPaneMenuManager.this.queryExecutionView.getContextInfo(); + this.removeAllAction.setEnabled(contextInfo.getEObjects().size() > 0); + this.removeSelectedElementsAction.setEnabled(contextInfo.getSelectedEObjects().size() > 0); + } +} \ No newline at end of file
diff --git a/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/modisco/facet/efacet/ui/internal/view/DropAdapter.java b/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/modisco/facet/efacet/ui/internal/view/DropAdapter.java new file mode 100644 index 0000000..e27d07b --- /dev/null +++ b/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/modisco/facet/efacet/ui/internal/view/DropAdapter.java
@@ -0,0 +1,93 @@ +/******************************************************************************* + * Copyright (c) 2010, 2012 Mia-Software. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Nicolas Bros (Mia-Software) + * Gregoire Dupe (Mia-Software) - Bug 364325 - [Restructuring] The user must be able to navigate into a model using the Facet. + *******************************************************************************/ +package org.eclipse.modisco.facet.efacet.ui.internal.view; + +import java.util.HashSet; +import java.util.Iterator; +import java.util.Set; + +import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.edit.ui.dnd.LocalTransfer; +import org.eclipse.jface.viewers.StructuredSelection; +import org.eclipse.swt.dnd.DND; +import org.eclipse.swt.dnd.DropTargetEvent; +import org.eclipse.swt.dnd.DropTargetListener; + +/** + * Implements a {@link DropTargetListener} that accepts {@link EObject}s + * transferred locally (i.e. through {@link LocalTransfer}), and calls the given + * {@link DropAction} with the dropped {@link EObject}s. + */ +//Copied from org.eclipse.emf.facet.infra.query.ui.views.queryExecution.internal.DropAdapter +public class DropAdapter implements DropTargetListener { + + private final DropAction dropAction; + + public abstract static class DropAction { + /** The given EObjects are being dropped */ + public abstract void dropped(Set<EObject> eObjects); + } + + /** + * @param dropAction + * the action that will be called when model elements are dropped + */ + public DropAdapter(final DropAction dropAction) { + this.dropAction = dropAction; + } + + public void drop(final DropTargetEvent event) { + this.dropAction.dropped(getTransferredEObjects(event)); + } + + private Set<EObject> getTransferredEObjects(final DropTargetEvent event) { + Set<EObject> eObjects = new HashSet<EObject>(); + if (LocalTransfer.getInstance().isSupportedType(event.currentDataType)) { + if (event.data instanceof StructuredSelection) { + StructuredSelection structuredSelection = (StructuredSelection) event.data; + Iterator<?> iterator = structuredSelection.iterator(); + while (iterator.hasNext()) { + Object element = iterator.next(); + if (element instanceof EObject) { + EObject eObject = (EObject) element; + eObjects.add(eObject); + } + } + } + } + return eObjects; + } + + public void dropAccept(final DropTargetEvent event) { + // nothing + } + + public void dragOver(final DropTargetEvent event) { + // if (getTransferredEObjects(event).size() == 0) { + // // don't allow the drop + // event.detail = DND.DROP_NONE; + // } + // event.feedback = DND.FEEDBACK_SELECT | DND.FEEDBACK_SCROLL; + } + + public void dragOperationChanged(final DropTargetEvent event) { + // nothing + } + + public void dragLeave(final DropTargetEvent event) { + // nothing + } + + public void dragEnter(final DropTargetEvent event) { + event.detail = DND.DROP_LINK; + } +} \ No newline at end of file
diff --git a/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/modisco/facet/efacet/ui/internal/view/EditableContext.java b/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/modisco/facet/efacet/ui/internal/view/EditableContext.java new file mode 100644 index 0000000..94f04d7 --- /dev/null +++ b/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/modisco/facet/efacet/ui/internal/view/EditableContext.java
@@ -0,0 +1,27 @@ +/******************************************************************************* + * Copyright (c) 2010, 2012 Mia-Software. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Nicolas Bros (Mia-Software) + * Gregoire Dupe (Mia-Software) - Bug 364325 - [Restructuring] The user must be able to navigate into a model using the Facet. + *******************************************************************************/ +package org.eclipse.modisco.facet.efacet.ui.internal.view; + +import org.eclipse.emf.ecore.EObject; + +/** An interface that supports editing the query context */ +//Copied from org.eclipse.emf.facet.infra.query.ui.views.queryExecution.internal.EditableContext +public interface EditableContext { + void add(EObject eObject); + + void remove(EObject eObject); + + void clear(); + + /** must be called after editing to refresh the viewers */ + void done(); +}
diff --git a/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/modisco/facet/efacet/ui/internal/view/FacetSetsCatalogView.java b/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/modisco/facet/efacet/ui/internal/view/FacetSetsCatalogView.java new file mode 100644 index 0000000..5d1b1df --- /dev/null +++ b/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/modisco/facet/efacet/ui/internal/view/FacetSetsCatalogView.java
@@ -0,0 +1,211 @@ +/******************************************************************************* + * Copyright (c) 2009-2012 Mia-Software. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Nicolas Bros (Mia-Software) - initial API and implementation + * Grégoire Dupé (Mia-Software) - initial API and implementation + * Nicolas Bros (Mia-Software) - Bug 372732 - [Facet] Rewrite the catalog views for 0.2 + * Gregoire Dupe (Mia-Software) - Bug 373078 - API Cleaning + *******************************************************************************/ + +package org.eclipse.modisco.facet.efacet.ui.internal.view; + +import java.util.ArrayList; +import java.util.Collection; + +import org.eclipse.core.runtime.CoreException; +import org.eclipse.core.runtime.IExecutableExtensionFactory; +import org.eclipse.emf.common.util.EList; +import org.eclipse.emf.ecore.EPackage; +import org.eclipse.emf.ecore.EStructuralFeature; +import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl; +import org.eclipse.jface.viewers.ColumnLabelProvider; +import org.eclipse.jface.viewers.IOpenListener; +import org.eclipse.jface.viewers.ITreeContentProvider; +import org.eclipse.jface.viewers.OpenEvent; +import org.eclipse.modisco.facet.common.ui.internal.exported.views.IColumnDescription; +import org.eclipse.modisco.facet.common.ui.internal.exported.views.IElementsViewFactory; +import org.eclipse.modisco.facet.efacet.core.FacetUtils; +import org.eclipse.modisco.facet.efacet.core.IFacetSetCatalogManagerFactory; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.Category; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.DocumentedElement; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.Facet; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.FacetSet; +import org.eclipse.modisco.facet.efacet.ui.internal.Messages; +import org.eclipse.modisco.facet.efacet.ui.internal.dialogs.FacetSetTreeContentProvider; +import org.eclipse.modisco.facet.efacet.ui.internal.utils.ImageProvider; +import org.eclipse.modisco.facet.util.emf.ui.internal.utils.ImageUtils; +import org.eclipse.swt.graphics.Image; + +/** + * An Eclipse view that displays a list of available facet sets. Clicking on a facet set opens it in the facet set + * editor. + */ +public class FacetSetsCatalogView implements IExecutableExtensionFactory, IOpenListener { + + public Object create() throws CoreException { + final Collection<IColumnDescription> columnDescriptions = new ArrayList<IColumnDescription>(); + columnDescriptions.add(createNameColumnDescription()); + columnDescriptions.add(createExtendsColumnDescription()); + columnDescriptions.add(createCategoriesColumnDescription()); + columnDescriptions.add(createDocumentationColumnDescription()); + return IElementsViewFactory.DEFAULT.createElementsView(columnDescriptions, getContentProvider(), getInput(), + Messages.FacetSetsCatalogView_viewTitle, ImageProvider.getInstance().getFacetIcon(), this); + } + + private static final String NAME_COLUMN = "FacetView_NameColumn"; //$NON-NLS-1$ + private static final String DOCUMENTATION_COLUMN = "FacetView_LocationColumn"; //$NON-NLS-1$ + private static final String CATEGORIES_COLUMN = "FacetView_DefaultColumn"; //$NON-NLS-1$ + private static final String EXTENDS_COLUMN = "FacetView_ExtendsColumn"; //$NON-NLS-1$ + + private static final int NAME_COLUMN_WIDTH = 300; + private static final int EXTENDS_COLUMN_WIDTH = 200; + private static final int CATEGORIES_COLUMN_WIDTH = 200; + private static final int DOCUMENTATION_COLUMN_WIDTH = 400; + + private static IColumnDescription createNameColumnDescription() { + final ColumnLabelProvider columnLabelProvider = new ColumnLabelProvider() { + @Override + public String getText(final Object element) { + if (element instanceof FacetSet) { + final FacetSet facetSet = (FacetSet) element; + return facetSet.getName(); + } else if (element instanceof Facet) { + final Facet facet = (Facet) element; + return facet.getName(); + } else if (element instanceof EStructuralFeature) { + final EStructuralFeature feature = (EStructuralFeature) element; + return feature.getName(); + } else { + return ""; //$NON-NLS-1$ + } + + } + + @Override + public Image getImage(final Object element) { + return ImageUtils.getImage(element); + } + }; + return IElementsViewFactory.DEFAULT.createColumnDescription(Messages.FacetSetsCatalogView_nameColumn, FacetSetsCatalogView.NAME_COLUMN, FacetSetsCatalogView.NAME_COLUMN_WIDTH, + columnLabelProvider); + } + + private static IColumnDescription createExtendsColumnDescription() { + final ColumnLabelProvider columnLabelProvider = new ColumnLabelProvider() { + @Override + public String getText(final Object element) { + String result = null; + if (element instanceof FacetSet) { + final FacetSet facetSet = (FacetSet) element; + final EPackage extendedEPackage = FacetUtils + .getExtendedEPackage(facetSet); + if (extendedEPackage != null) { + result = extendedEPackage.getName() + " " + extendedEPackage.getNsURI(); //$NON-NLS-1$ + } + } + return result; + } + + }; + return IElementsViewFactory.DEFAULT.createColumnDescription(Messages.FacetSetsCatalogView_extendsColumn, FacetSetsCatalogView.EXTENDS_COLUMN, FacetSetsCatalogView.EXTENDS_COLUMN_WIDTH, + columnLabelProvider); + + } + + private static IColumnDescription createCategoriesColumnDescription() { + final ColumnLabelProvider columnLabelProvider = new ColumnLabelProvider() { + @Override + public String getText(final Object element) { + String result = null; + if (element instanceof FacetSet) { + final FacetSet facetSet = (FacetSet) element; + final StringBuilder strCategories = new StringBuilder(); + final EList<Category> categories = facetSet.getCategories(); + for (final Category category : categories) { + if (strCategories.length() > 0) { + strCategories.append("; "); //$NON-NLS-1$ + } + strCategories.append(category.getName()); + } + result = strCategories.toString(); + } + return result; + } + }; + return IElementsViewFactory.DEFAULT.createColumnDescription(Messages.FacetSetsCatalogView_categoriesColumn, FacetSetsCatalogView.CATEGORIES_COLUMN, FacetSetsCatalogView.CATEGORIES_COLUMN_WIDTH, + columnLabelProvider); + } + + private static IColumnDescription createDocumentationColumnDescription() { + final ColumnLabelProvider columnLabelProvider = new ColumnLabelProvider() { + @Override + public String getText(final Object element) { + String result = null; + if (element instanceof DocumentedElement) { + final DocumentedElement documentedElement = (DocumentedElement) element; + result = documentedElement.getDocumentation(); + } + return result; + } + }; + return IElementsViewFactory.DEFAULT.createColumnDescription(Messages.FacetSetsCatalogView_documentationColumn, FacetSetsCatalogView.DOCUMENTATION_COLUMN, + FacetSetsCatalogView.DOCUMENTATION_COLUMN_WIDTH, columnLabelProvider); + + } + + protected static ITreeContentProvider getContentProvider() { + return new FacetSetTreeContentProvider(); + } + + public void open(final OpenEvent event) { + // TODO: re-enable when there is a FacetSet editor + + // final EObject modelElement = (EObject) element; + // EPackage facetSet = null; + // if (modelElement instanceof FacetSet) { + // facetSet = (FacetSet) modelElement; + // } else if (modelElement instanceof Facet) { + // Facet facet = (Facet) modelElement; + // facetSet = facet.getEPackage(); + // } + // if (facetSet != null) { + // // open facet set in editor + // URI uri = null; + // try { + // String uriString = FacetSetCatalog.getSingleton().getURI(facetSet.getName()) + // .toString(); + // uri = URI.create(uriString); + // IEditorPart editor = null; + // if ("file".equals(uri.getScheme())) { //$NON-NLS-1$ + // editor = IDE.openEditor(PlatformUI.getWorkbench().getActiveWorkbenchWindow() + // .getActivePage(), new URI(facetSet.eResource().getURI().toString()), + // Activator.FACET_EDITOR_ID, true); + // } else { + // URIEditorInput uriEditorInput = new URIEditorInput( + // org.eclipse.emf.common.util.URI.createURI(uri.toString())); + // editor = IDE.openEditor(PlatformUI.getWorkbench().getActiveWorkbenchWindow() + // .getActivePage(), uriEditorInput, Activator.FACET_EDITOR_ID, true); + // } + // if (editor instanceof FacetEditor) { + // FacetEditor facetEditor = (FacetEditor) editor; + // facetEditor.setSelectionToViewer(modelElement); + // } + // + // } catch (Exception e) { + // Logger.logError(e, "Failed to open: " + uri, Activator.getDefault()); //$NON-NLS-1$ + // } + // } + } + + protected static Object getInput() { + return IFacetSetCatalogManagerFactory.DEFAULT + .getOrCreateFacetSetCatalogManager(new ResourceSetImpl()) + .getRegisteredFacetSets().toArray(); + } + +}
diff --git a/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/modisco/facet/efacet/ui/internal/view/NavigationView.java b/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/modisco/facet/efacet/ui/internal/view/NavigationView.java new file mode 100644 index 0000000..4934f53 --- /dev/null +++ b/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/modisco/facet/efacet/ui/internal/view/NavigationView.java
@@ -0,0 +1,760 @@ +/******************************************************************************* + * Copyright (c) 2010, 2015 Mia-Software, and CEA-LIST. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Nicolas Bros (Mia-Software) + * Grégoire Dupé (Mia-Software) - Bug 364325 - [Restructuring] The user must be able to navigate into a model using the Facet. + * Vincent Lorenzo (CEA-LIST) - Bug 372644 - Create Customizable tooltips for the TreeViewer using a CustomizableLabelProvider + * Grégoire Dupé (Mia-Software) - Bug 364325 - [Restructuring] The user must be able to navigate into a model using the Facet. + * Grégoire Dupé (Mia-Software) - Bug 373510 - EditingDomain, ResourceSet, Catalogs, etc. have to be properly managed between editors and views + * Grégoire Dupé (Mia-Software) - Bug 373078 - API Cleaning + * Grégoire Dupé (Mia-Software) - Bug 372626 - Aggregates + * Olivier Remaud (Soft-Maint) - Bug 377615 - Query View filtering + * Grégoire Dupé (Mia-Software) - Bug 378498 - Navigation view sometimes lacks an EditingDomain + * Nicolas Bros (Mia-Software) - Bug 379395 - Navigate should replace elements + * Thomas Cicognani (Mia-Software) - Bug 472075 - Update API to create UI shortcuts to activate FacetSets + * Grégoire Dupé (Mia-Software) - Bug 480879 - Label provider instance already in use + * Grégoire Dupé (Mia-Software) - Bug 480879 - Label provider instance already in use + * Grégoire Dupé (Mia-Software) - Bug 480654 - IllegalStateException in NavigationView.addEObjects (611) + *******************************************************************************/ +package org.eclipse.modisco.facet.efacet.ui.internal.view; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.Collections; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Iterator; +import java.util.List; +import java.util.Set; + +import org.eclipse.emf.common.command.BasicCommandStack; +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.EClassifier; +import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.ecore.EPackage; +import org.eclipse.emf.ecore.ETypedElement; +import org.eclipse.emf.ecore.EcorePackage; +import org.eclipse.emf.ecore.resource.Resource; +import org.eclipse.emf.ecore.resource.ResourceSet; +import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl; +import org.eclipse.emf.edit.domain.AdapterFactoryEditingDomain; +import org.eclipse.emf.edit.domain.EditingDomain; +import org.eclipse.emf.edit.domain.IEditingDomainProvider; +import org.eclipse.emf.edit.provider.ComposedAdapterFactory; +import org.eclipse.emf.edit.ui.dnd.LocalTransfer; +import org.eclipse.jface.action.GroupMarker; +import org.eclipse.jface.action.MenuManager; +import org.eclipse.jface.dialogs.MessageDialog; +import org.eclipse.jface.viewers.IContentProvider; +import org.eclipse.jface.viewers.ILabelProvider; +import org.eclipse.jface.viewers.ISelection; +import org.eclipse.jface.viewers.IStructuredSelection; +import org.eclipse.jface.viewers.ITreeContentProvider; +import org.eclipse.jface.viewers.TreeViewer; +import org.eclipse.jface.viewers.Viewer; +import org.eclipse.jface.viewers.ViewerComparator; +import org.eclipse.modisco.facet.custom.core.ICustomizationManager; +import org.eclipse.modisco.facet.custom.core.ICustomizationManagerFactory; +import org.eclipse.modisco.facet.efacet.core.FacetUtils; +import org.eclipse.modisco.facet.efacet.core.IFacetManager; +import org.eclipse.modisco.facet.efacet.core.IFacetManagerFactory; +import org.eclipse.modisco.facet.efacet.core.IFacetSetCatalogManager; +import org.eclipse.modisco.facet.efacet.core.IFacetSetCatalogManagerFactory; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.Facet; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.FacetSet; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.runtime.ETypedElementResult; +import org.eclipse.modisco.facet.efacet.ui.IETypedElementResultDisplayer; +import org.eclipse.modisco.facet.efacet.ui.IETypedElementResultDisplayerOpener; +import org.eclipse.modisco.facet.efacet.ui.internal.Activator; +import org.eclipse.modisco.facet.efacet.ui.internal.Messages; +import org.eclipse.modisco.facet.efacet.ui.internal.exported.view.INavigationView; +import org.eclipse.modisco.facet.efacet.ui.internal.exported.widget.IETypedElementSelectionWidget; +import org.eclipse.modisco.facet.efacet.ui.internal.exported.widget.IETypedElementSelectionWidgetFactory; +import org.eclipse.modisco.facet.efacet.ui.internal.view.DropAdapter.DropAction; +import org.eclipse.modisco.facet.util.core.Logger; +import org.eclipse.modisco.facet.util.emf.ui.internal.exported.IEmfLabelProviderFactory; +import org.eclipse.modisco.facet.util.ui.internal.exported.dialog.IOkDialog; +import org.eclipse.modisco.facet.util.ui.internal.exported.dialog.IOkDialogFactory; +import org.eclipse.osgi.util.NLS; +import org.eclipse.swt.SWT; +import org.eclipse.swt.custom.SashForm; +import org.eclipse.swt.dnd.DND; +import org.eclipse.swt.dnd.DropTargetListener; +import org.eclipse.swt.dnd.Transfer; +import org.eclipse.swt.events.ControlAdapter; +import org.eclipse.swt.events.ControlEvent; +import org.eclipse.swt.events.SelectionAdapter; +import org.eclipse.swt.events.SelectionEvent; +import org.eclipse.swt.graphics.Point; +import org.eclipse.swt.layout.FillLayout; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.widgets.Button; +import org.eclipse.swt.widgets.Combo; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Group; +import org.eclipse.swt.widgets.Label; +import org.eclipse.swt.widgets.Menu; +import org.eclipse.swt.widgets.Shell; +import org.eclipse.ui.IWorkbenchActionConstants; +import org.eclipse.ui.IWorkbenchPage; +import org.eclipse.ui.IWorkbenchPart; +import org.eclipse.ui.IWorkbenchWindow; +import org.eclipse.ui.PlatformUI; +import org.eclipse.ui.part.ViewPart; +import org.eclipse.ui.part.WorkbenchPart; + +//Copied from org.eclipse.emf.facet.infra.query.ui.views.queryExecution.internal.QueryExecutionView +public class NavigationView extends ViewPart implements INavigationView { + + /** + * Execution button minimal width. + */ + private static final int EXEC_BT_MIN_WIDTH = 100; + + private TreeViewer contextViewer; + private Composite mainComposite; + private Composite parentComposite; + + private final Set<EObject> context = new HashSet<EObject>(); + private LayoutStyle layoutStyle = NavigationView.LayoutStyle.Horizontal; + private IETypedElementSelectionWidget navSelection; + private Combo comboDisplayer; + private EditingDomain editingDomain = null; + private ILabelProvider labelProvider; + private final IContentProvider contextCP = new ITreeContentProvider() { + + public void inputChanged(final Viewer viewer, final Object oldInput, + final Object newInput) { + // nothing + } + + public void dispose() { + // nothing + } + + public Object[] getElements(final Object inputElement) { + Object[] result = new Object[0]; + if (inputElement instanceof Set<?>) { + final Set<?> set = ((Set<?>) inputElement); + if (set.isEmpty()) { + result = new Object[] { Messages.QueryExecutionView_dragAndDropHint }; + } else { + result = set.toArray(); + } + } + return result; + } + + public boolean hasChildren(final Object element) { + return false; + } + + public Object getParent(final Object element) { + return null; + } + + public Object[] getChildren(final Object parentElement) { + return new Object[]{}; + } + }; + + private enum LayoutStyle { + Horizontal, Vertical + } + + public NavigationView() { + super(); + updateEditingDomain(); + } + + @Override + public void createPartControl(final Composite parent) { + this.parentComposite = parent; + parent.setLayout(gridLayoutWithNoMargins()); + this.layoutStyle = NavigationView.LayoutStyle.Horizontal; + createMainComposite(); + parent.addControlListener(new ControlAdapter() { + @Override + public void controlResized(final ControlEvent event) { + NavigationView.this.controlResized(parent); + } + }); + createContextMenu(); + } + + public void controlResized(final Composite parent) { + final LayoutStyle oldLayoutStyle = NavigationView.this.layoutStyle; + final Point size = parent.getSize(); + if (size.x > size.y) { + this.layoutStyle = NavigationView.LayoutStyle.Horizontal; + } else { + this.layoutStyle = NavigationView.LayoutStyle.Vertical; + } + if (this.layoutStyle != oldLayoutStyle) { + createMainComposite(); + } + } + + protected static void createContextMenu() { + final MenuManager contextMenu = new MenuManager("#PopUp"); //$NON-NLS-1$ + contextMenu.add(new GroupMarker(IWorkbenchActionConstants.MB_ADDITIONS)); + } + + private void createMainComposite() { + if (this.mainComposite != null) { + this.mainComposite.dispose(); + } + this.mainComposite = new Composite(this.parentComposite, SWT.NONE); + this.mainComposite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true)); + this.mainComposite.setLayout(gridLayoutWithNoMargins()); + + int direction; + if (this.layoutStyle == NavigationView.LayoutStyle.Horizontal) { + direction = SWT.HORIZONTAL; + } else { + direction = SWT.VERTICAL; + } + + final SashForm sashForm = new SashForm(this.mainComposite, SWT.SMOOTH + | direction); + sashForm.setLayout(new FillLayout()); + sashForm.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true)); + + createContextGroup(sashForm); + // createQueryGroup(sashForm); + final Composite lastGroup = new Composite(sashForm, SWT.NONE); + createQueryGroup(lastGroup); + lastGroup.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true)); + + GridLayout gridLayout; + if (this.layoutStyle == NavigationView.LayoutStyle.Horizontal) { + gridLayout = new GridLayout(2, false); + } else { + gridLayout = new GridLayout(); + } + gridLayout.marginHeight = 0; + gridLayout.marginWidth = 0; + lastGroup.setLayout(gridLayout); + // TODO: implement parameters (hidden in the meantime) + // /!\ when it is added back, put the QueryGroup back in the sashForm + // instead of lastGroup + // createParametersGroup(lastGroup); + createExecuteGroup(lastGroup); + } + + private static GridLayout gridLayoutWithNoMargins() { + final GridLayout gridLayout = new GridLayout(); + gridLayout.marginWidth = 0; + gridLayout.marginHeight = 0; + return gridLayout; + } + + private void createQueryGroup(final Composite parent) { + final Group queryGroup = new Group(parent, SWT.NONE); + queryGroup.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true)); + queryGroup.setText(Messages.QueryExecutionView_ETypedElementsGroup); + final GridLayout groupLayout = new GridLayout(); + queryGroup.setLayout(groupLayout); + Collection<ETypedElement> eTypedElements = Collections.emptyList(); + Collection<? extends EObject> knownEPackages = Collections.emptyList(); + if (getResourceSet() != null) { + eTypedElements = new ArrayList<ETypedElement>( + FacetUtils.getETypedElements(getResourceSet())); + knownEPackages = IFacetSetCatalogManagerFactory.DEFAULT + .getOrCreateFacetSetCatalogManager(this.getResourceSet()) + .getRegisteredFacetSets(); + } + this.navSelection = IETypedElementSelectionWidgetFactory.DEFAULT + .createETypedElementSelectionWidget( + 1, + false, + queryGroup, + getCustomizationManager(), + knownEPackages); + this.navSelection.setAvailableETypedElements(eTypedElements); + } + + private void createContextGroup(final Composite parent) { + final Group contextGroup = new Group(parent, SWT.NONE); + contextGroup.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true)); + contextGroup.setText(Messages.QueryExecutionView_Context); + final GridLayout groupLayout = new GridLayout(); + contextGroup.setLayout(groupLayout); + createContextViewer(contextGroup); + } + + private void createContextViewer(final Group contextGroup) { + this.contextViewer = new TreeViewer(contextGroup, SWT.MULTI | SWT.BORDER); + final GridData listData = new GridData(SWT.FILL, SWT.FILL, true, true); + this.contextViewer.getTree().setLayoutData(listData); + addDropSupport(this.contextViewer); + createContextMenu(this.contextViewer); + this.contextViewer.setContentProvider(this.contextCP); + changeEditingDomain(this.editingDomain); + this.contextViewer.setLabelProvider(this.labelProvider); + this.contextViewer.setInput(this.context); + this.contextViewer.setComparator(new ViewerComparator() { + @Override + public int compare(final Viewer viewer, final Object object1, + final Object object2) { + return NavigationView.this.compare(object1, object2); + } + }); + } + + protected int compare(final Object object1, final Object object2) { + final String label1 = this.labelProvider.getText(object1); + final String label2 = this.labelProvider.getText(object2); + return label1.compareToIgnoreCase(label2); + } + + private EditableContext createEditableContext() { + return new EditableContext() { + public void add(final EObject eObject) { + NavigationView.this.dropEObject(eObject); + } + + public void remove(final EObject eObject) { + NavigationView.this.removeEObject(eObject); + } + + public void clear() { + NavigationView.this.removeAllEObjects(); + } + + public void done() { + NavigationView.this.refreshContextViewer(); + } + }; + } + + protected final IOkDialog dropEObject(final EObject eObject) { + return addEObject(eObject); + } + + /** Create a context menu on the context pane */ + private void createContextMenu(final TreeViewer treeViewer) { + final ContextPaneMenuManager menuManager = new ContextPaneMenuManager(this, + createEditableContext(), treeViewer); + final Menu menu = menuManager.createContextMenu(treeViewer.getTree()); + treeViewer.getTree().setMenu(menu); + } + + private void addDropSupport(final TreeViewer viewer) { + final DropTargetListener dropListener = new DropAdapter( + new DropAction() { + @Override + public void dropped(final Set<EObject> eObjects) { + addEObjects2(eObjects); + } + }); + final int dndOperations = DND.DROP_LINK | DND.DROP_COPY | DND.DROP_MOVE; + final Transfer[] transfers = new Transfer[] { LocalTransfer + .getInstance() }; + viewer.addDropSupport(dndOperations, transfers, dropListener); + } + + protected final void refreshContextViewer() { + if (this.contextViewer != null) { + this.contextViewer.refresh(); + final Set<EObject> toBeRemoved = new HashSet<EObject>(); + for (EObject eObject : this.context) { + if (eObject.eResource().getResourceSet() != getResourceSet()) { + toBeRemoved.add(eObject); + } + } + this.context.remove(toBeRemoved); + this.contextViewer.setInput(this.context); + if (this.contextViewer.getLabelProvider() != this.labelProvider) { + this.contextViewer.setLabelProvider(this.labelProvider); + } + updateQueriesInput(); + } + } + + private void updateQueriesInput() { + final Collection<ETypedElement> result = new ArrayList<ETypedElement>(); + final ResourceSet resourceSet = this.editingDomain.getResourceSet(); + final IFacetSetCatalogManager catalog = IFacetSetCatalogManagerFactory.DEFAULT + .getOrCreateFacetSetCatalogManager(resourceSet); + final Collection<FacetSet> registeredFS = catalog + .getRegisteredFacetSets(); + for (FacetSet facetSet : registeredFS) { + result.addAll(getETypedElements(facetSet)); + } + this.navSelection.setAvailableETypedElements(result); + } + + private Collection<? extends ETypedElement> getETypedElements( + final FacetSet facetSet) { + final Collection<ETypedElement> result = new ArrayList<ETypedElement>(); + for (EClassifier eClassifier : facetSet.getEClassifiers()) { + if (eClassifier instanceof Facet) { + final Facet facet = (Facet) eClassifier; + if (isApplicableFacet(facet)) { + result.addAll(facet.getFacetElements()); + result.addAll(facet.getFacetOperations()); + } + } + } + for (FacetSet subFacetSet : facetSet.getFacetSets()) { + result.addAll(getETypedElements(subFacetSet)); + } + for (EPackage subPackage : facetSet.getESubpackages()) { + if (subPackage instanceof FacetSet) { + final FacetSet subFacetSet = (FacetSet) subPackage; + result.addAll(getETypedElements(subFacetSet)); + } + } + return result; + } + + private void createExecuteGroup(final Composite parent) { + final Group executeGroup = new Group(parent, SWT.NONE); + executeGroup.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, false)); + executeGroup.setText(Messages.QueryExecutionView_ExecuteGroup); + executeGroup.setLayout(new GridLayout()); + createDisplayStyleComposite(executeGroup); + final Button buttonExecute = new Button(executeGroup, SWT.PUSH); + buttonExecute.setText(Messages.QueryExecutionView_ExecuteButton); + final GridData buttonData = new GridData(SWT.CENTER, SWT.NONE, true, + false); + buttonData.minimumWidth = NavigationView.EXEC_BT_MIN_WIDTH; + buttonExecute.setLayoutData(buttonData); + buttonExecute.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(final SelectionEvent event) { + executeClicked(); + } + }); + } + + protected void executeClicked() { + final ETypedElement selectedQuery = getSelectedQuery(); + if (selectedQuery == null) { + MessageDialog.openInformation(getSite().getShell(), + Messages.QueryExecutionView_NoQuerySelected, + Messages.QueryExecutionView_SelectQueryToExecute); + } else { + try { + final IFacetManager facetMgr = IFacetManagerFactory.DEFAULT + .getOrCreateDefaultFacetManager(getResourceSet()); + final List<ETypedElementResult> results = facetMgr + .batchGetOrInvoke(this.context, selectedQuery, + Object.class); + if (checkResult(results)) { + displayResult(results); + } + } catch (final Exception e) { + final StackTraceElement[] stackTrace = e.getStackTrace(); + String stack = ""; //$NON-NLS-1$ + if (stackTrace.length > 0) { + stack = "\nat:" + stackTrace[0].toString(); //$NON-NLS-1$ + } + String message; + if (e.getMessage() == null) { + message = ""; //$NON-NLS-1$ + } else { + message = " : " + e.getMessage(); //$NON-NLS-1$ + } + MessageDialog.openError(getSite().getShell(), + Messages.QueryExecutionView_ErrorExecutingQuery, e.getClass() + .getSimpleName() + message + stack); + Logger.logError(e, Activator.getDefault()); + } + } + } + + private boolean checkResult(final List<ETypedElementResult> results) { + boolean result = true; + for (ETypedElementResult modelQueryResult : results) { + final Throwable exc = modelQueryResult.getException(); + if (exc != null) { + Logger.logError(exc, "Query exception", Activator.getDefault()); //$NON-NLS-1$ + MessageDialog.openError(this.mainComposite.getShell(), + Messages.QueryExecutionView_QueryException, exc.getClass().getSimpleName() + + " : " + exc.getMessage()); //$NON-NLS-1$ + result = false; + break; + } + } + return result; + } + + private void displayResult(final List<ETypedElementResult> result) { + final String displayerName = this.comboDisplayer.getText(); + final IETypedElementResultDisplayer displayer = QueryResultDisplayersRegistry + .getInstance().getQueryResultDisplayer(displayerName); + if (displayer == null) { + final String message = NLS + .bind("Query Displayer with name \"{0}\" not found", displayerName); //$NON-NLS-1$ + Logger.logError(message, Activator.getDefault()); + MessageDialog.openWarning(getSite().getShell(), + Messages.QueryExecutionView_NoQueryDisplayer, message); + } else { + displayer.displayETypedElementResults(result, this.editingDomain); + } + } + + private ETypedElement getSelectedQuery() { + final ETypedElement selectedQuery = this.navSelection + .getSelectedETypedElements().get(0); + return selectedQuery; + } + + private void createDisplayStyleComposite(final Group executeGroup) { + final Composite displayStyle = new Composite(executeGroup, + SWT.NONE); + displayStyle.setLayoutData(new GridData(SWT.FILL, SWT.NONE, true, false)); + displayStyle.setLayout(new GridLayout(2, false)); + final Label label = new Label(displayStyle, SWT.NONE); + label.setText(Messages.QueryExecutionView_DisplayResultIn); + this.comboDisplayer = new Combo(displayStyle, SWT.DROP_DOWN | SWT.READ_ONLY); + + final List<IETypedElementResultDisplayer> resultDisplayers = QueryResultDisplayersRegistry + .getInstance().getQueryResultDisplayers(); + for (IETypedElementResultDisplayer namedQueryResultDisplayer : resultDisplayers) { + this.comboDisplayer.add(namedQueryResultDisplayer.getName()); + } + + this.comboDisplayer.select(0); + this.comboDisplayer.setLayoutData(new GridData(SWT.FILL, SWT.NONE, true, false)); + } + + @Override + public void setFocus() { + updateEditingDomain(); + this.refreshContextViewer(); + } + + private void updateEditingDomain() { + IWorkbenchWindow activeWindow = PlatformUI.getWorkbench() + .getActiveWorkbenchWindow(); + if (activeWindow == null) { + if (PlatformUI.getWorkbench().getWorkbenchWindows().length > 0) { + activeWindow = PlatformUI.getWorkbench().getWorkbenchWindows()[0]; + } else { + throw new IllegalStateException("No windows available."); //$NON-NLS-1$ + } + } + final IWorkbenchPage activePage = activeWindow.getActivePage(); + if (activePage != null) { + final IWorkbenchPart part = activePage.getActivePart(); + if (part instanceof IEditingDomainProvider) { + final IEditingDomainProvider edProvider = (IEditingDomainProvider) part; + final EditingDomain newEditingDomain = edProvider + .getEditingDomain(); + if ((this.editingDomain != newEditingDomain) + || (this.editingDomain == null)) { + changeEditingDomain(newEditingDomain); + } + } + } + } + + private void changeEditingDomain(final EditingDomain newEditingDomain) { + this.editingDomain = newEditingDomain; + if (this.editingDomain == null) { + final ComposedAdapterFactory adapterFactory = new ComposedAdapterFactory( + ComposedAdapterFactory.Descriptor.Registry.INSTANCE); + final BasicCommandStack commandStack = new BasicCommandStack(); + this.editingDomain = new AdapterFactoryEditingDomain( + adapterFactory, commandStack, + new HashMap<Resource, Boolean>()); + } + this.labelProvider = IEmfLabelProviderFactory.DEFAULT + .createLabelProvider(); + } + + public void setContext(final List<EObject> eObjects) { + this.context.clear(); + addEObjects(eObjects); + refreshContextViewer(); + } + + public void setSelectedQueries(final List<ETypedElement> queries) { + this.navSelection.setSelectedETypedElements(queries); + } + + public ContextInfo getContextInfo() { + final ContextInfo contextInfo = new ContextInfo( + new ArrayList<EObject>(this.context)); + final ISelection selection = this.contextViewer.getSelection(); + if (selection instanceof IStructuredSelection) { + final IStructuredSelection structSelection = (IStructuredSelection) selection; + final Iterator<?> iterator = structSelection.iterator(); + while (iterator.hasNext()) { + final Object selectedElement = iterator.next(); + if (selectedElement instanceof EObject) { + final EObject eObject = (EObject) selectedElement; + contextInfo.addSelectedEObject(eObject); + } + } + } + return contextInfo; + } + + public final class ContextInfo { + private final List<EObject> eObjects; + private final List<EObject> selectedEObjects = new ArrayList<EObject>(); + + public ContextInfo(final List<EObject> eObjects) { + this.eObjects = eObjects; + } + + public List<EObject> getEObjects() { + return this.eObjects; + } + + public void addSelectedEObject(final EObject eObject) { + this.selectedEObjects.add(eObject); + } + + public List<EObject> getSelectedEObjects() { + return this.selectedEObjects; + } + + } + + public void addEObjects(final Collection<? extends EObject> eObjects) { + addEObjects2(eObjects); + } + + public IOkDialog addEObjects2(final Collection<? extends EObject> eObjects) { + IOkDialog dialog = null; + try { + basicAddEObjects(eObjects); + } catch (NavigationViewResourceSetException e) { + dialog = openResourceSetPbDialog(e); + Logger.logError(e, Activator.getDefault()); + } + return dialog; + } + + private void basicAddEObjects(final Collection<? extends EObject> eObjects) + throws NavigationViewResourceSetException { + updateEditingDomain(); + for (EObject eObject : eObjects) { + basicAddEObject(eObject); + } + refreshContextViewer(); + } + + public IOkDialog addEObject(final EObject eObject) { + IOkDialog dialog = null; + try { + basicAddEObject(eObject); + } catch (NavigationViewResourceSetException e) { + dialog = openResourceSetPbDialog(e); + } + return dialog; + } + + private static IOkDialog openResourceSetPbDialog( + final NavigationViewResourceSetException exception) { + return IOkDialogFactory.DEFAULT.openErrorDialog(new Shell(), exception, + Messages.NavigationView_eObjectsMustBeInTheSameResourceSet); + } + + private void basicAddEObject(final EObject eObject) throws NavigationViewResourceSetException { + final Resource resource = eObject.eResource(); + final ResourceSet eObjectRS = resource.getResourceSet(); + if (eObjectRS == null + || (getResourceSet() != null && !eObjectRS.equals(getResourceSet()))) { + throw new NavigationViewResourceSetException( + "Invalid resourceSet: all the eObjects added in the navigation view must be owned by the same resource set." //$NON-NLS-1$ + ); + } + this.context.add(eObject); + } + + public void removeEObject(final EObject eObject) { + this.context.remove(eObject); + } + + public void removeEObjects(final List<? extends EObject> eObjects) { + this.context.removeAll(eObjects); + } + + public void removeAllEObjects() { + this.context.clear(); + } + + public List<EClassifier> getUsableEClassifiers() { + // TODO Auto-generated method stub + return null; + } + + public void selectETypedElement(final ETypedElement eTypedElement) { + // TODO Auto-generated method stub + + } + + public ETypedElement getSelectedETypedElement() { + // TODO Auto-generated method stub + return null; + } + + public List<IETypedElementResultDisplayerOpener> getAvailableSelectedDisplayers() { + // TODO Auto-generated method stub + return null; + } + + public void setSelectDisplayer(final IETypedElementResultDisplayerOpener resultDisplayer) { + // TODO Auto-generated method stub + + } + + public IETypedElementResultDisplayerOpener getSelectedDisplayer() { + // TODO Auto-generated method stub + return null; + } + + public WorkbenchPart preform() { + // TODO Auto-generated method stub + return null; + } + + private ResourceSet getResourceSet() { + ResourceSet resourceSet = null; + if (this.context.size() != 0) { + final EObject firstEObject = this.context.iterator().next(); + final Resource eResource = firstEObject.eResource(); + if (eResource != null) { + resourceSet = eResource.getResourceSet(); + } + } + return resourceSet; + } + + private ICustomizationManager getCustomizationManager() { + ResourceSet resourceSet = getResourceSet(); + if (resourceSet == null) { + resourceSet = new ResourceSetImpl(); + } + return ICustomizationManagerFactory.DEFAULT + .getOrCreateICustomizationManager(resourceSet); + } + + private boolean isApplicableFacet(final Facet facet) { + final EClass eobjectClass = EcorePackage.eINSTANCE.getEObject(); + boolean result = false; + for (final EObject object : this.context) { + if (facet.getExtendedMetaclass() == null + || facet.getExtendedMetaclass() == eobjectClass + || facet.getExtendedMetaclass().isSuperTypeOf(object.eClass()) + ) { + result = true; + break; + } + } + return result; + } + +}
diff --git a/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/modisco/facet/efacet/ui/internal/view/NavigationViewFactory.java b/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/modisco/facet/efacet/ui/internal/view/NavigationViewFactory.java new file mode 100644 index 0000000..e9b24da --- /dev/null +++ b/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/modisco/facet/efacet/ui/internal/view/NavigationViewFactory.java
@@ -0,0 +1,65 @@ +/******************************************************************************* + * Copyright (c) 2012, 2015 Mia-Software. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Nicolas Bros (Mia-Software) + * Grégoire Dupé (Mia-Software) - Bug 364325 - [Restructuring] The user must be able to navigate into a model using the Facet. + * Grégoire Dupé (Mia-Software) - Bug 474286 - ClassCastException in NavigationViewFactory.openNavigationView (36) + * Grégoire Dupé (Mia-Software) - Bug 480654 - IllegalStateException in NavigationView.addEObjects (611) + *******************************************************************************/ +package org.eclipse.modisco.facet.efacet.ui.internal.view; + +import org.eclipse.emf.edit.domain.EditingDomain; +import org.eclipse.modisco.facet.efacet.ui.internal.Activator; +import org.eclipse.modisco.facet.efacet.ui.internal.exported.view.INavigationView; +import org.eclipse.modisco.facet.efacet.ui.internal.exported.view.INavigationViewFactory; +import org.eclipse.modisco.facet.efacet.ui.internal.sync.generated.SynchronizedNavigationView; +import org.eclipse.modisco.facet.util.core.Logger; +import org.eclipse.ui.IViewPart; +import org.eclipse.ui.IWorkbenchPage; +import org.eclipse.ui.IWorkbenchWindow; +import org.eclipse.ui.PartInitException; +import org.eclipse.ui.PlatformUI; + +public class NavigationViewFactory implements INavigationViewFactory { + + public static final String VIEW_ID = "org.eclipse.emf.facet.efacet.ui.view.navigation"; //$NON-NLS-1$ + + /* + * FIXME gdupe> It would be better if that method would be able to throw an + * exception, rather than to "silently" log the problems. + */ + public INavigationView openNavigationView(final EditingDomain editingDomain) { + INavigationView result = null; + try { + final IWorkbenchWindow window = PlatformUI.getWorkbench().getWorkbenchWindows()[0]; + if (window != null) { + final IWorkbenchPage activePage = window.getActivePage(); + if (activePage != null) { + final IViewPart view = activePage.showView( + NavigationViewFactory.VIEW_ID); + if (view instanceof INavigationView) { + result = new SynchronizedNavigationView( + (INavigationView) view, + window.getShell().getDisplay()); + } else { + final String message = String.format( + "Something wrong happend when trying to open the EMF Facet navigation view. The view was expected to be of type %s but is of type %s", //$NON-NLS-1$ + INavigationView.class.getName(), + view.getClass().getName() + ); + Logger.logError(message, Activator.getDefault()); + } + } + } + } catch (final PartInitException e) { + Logger.logError(e, Activator.getDefault()); + } + return result; + } + +}
diff --git a/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/modisco/facet/efacet/ui/internal/view/NavigationViewResourceSetException.java b/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/modisco/facet/efacet/ui/internal/view/NavigationViewResourceSetException.java new file mode 100644 index 0000000..c5d45e4 --- /dev/null +++ b/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/modisco/facet/efacet/ui/internal/view/NavigationViewResourceSetException.java
@@ -0,0 +1,34 @@ + /******************************************************************************* + * Copyright (c) 2015 Mia-Software. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Grégoire Dupé (Mia-Software) - Bug 480654 - IllegalStateException in NavigationView.addEObjects (611) + *******************************************************************************/ +package org.eclipse.modisco.facet.efacet.ui.internal.view; + +public class NavigationViewResourceSetException extends Exception { + + private static final long serialVersionUID = -2247657462989799934L; + + public NavigationViewResourceSetException() { + super(); + } + + public NavigationViewResourceSetException(final String message) { + super(message); + } + + public NavigationViewResourceSetException(final Throwable cause) { + super(cause); + } + + public NavigationViewResourceSetException(final String message, + final Throwable cause) { + super(message, cause); + } + +}
diff --git a/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/modisco/facet/efacet/ui/internal/view/QueryResultDisplayersRegistry.java b/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/modisco/facet/efacet/ui/internal/view/QueryResultDisplayersRegistry.java new file mode 100644 index 0000000..ad2bb5c --- /dev/null +++ b/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/modisco/facet/efacet/ui/internal/view/QueryResultDisplayersRegistry.java
@@ -0,0 +1,108 @@ +/******************************************************************************* + * Copyright (c) 2008, 2010, 2012 Mia-Software. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Nicolas Bros (Mia-Software) - initial API and implementation + * Gregoire Dupe (Mia-Software) - Bug 364325 - [Restructuring] The user must be able to navigate into a model using the Facet. + *******************************************************************************/ + +package org.eclipse.modisco.facet.efacet.ui.internal.view; + +import java.util.ArrayList; +import java.util.List; + +import org.eclipse.core.runtime.CoreException; +import org.eclipse.core.runtime.IConfigurationElement; +import org.eclipse.modisco.facet.efacet.ui.IETypedElementResultDisplayer; +import org.eclipse.modisco.facet.efacet.ui.internal.Activator; +import org.eclipse.modisco.facet.util.core.Logger; +import org.eclipse.modisco.facet.util.core.internal.exported.AbstractRegistry; +import org.eclipse.osgi.util.NLS; + +/** + * The singleton registry of {@link IETypedElementResultDisplayer}s, which initializes + * the registry by reading extensions when first accessed. + */ +//Copied from org.eclipse.emf.facet.infra.query.ui.views.queryExecution.internal.QueryResultDisplayersRegistry +public class QueryResultDisplayersRegistry extends AbstractRegistry { + + private static final String EXTENSION_POINT_NAME = "eTypedElementResultDisplay"; //$NON-NLS-1$ + private static final String ELEMENT_QUERY_RESULT_DISPLAYER = "displayer"; //$NON-NLS-1$ + private static final String ATTRIBUTE_CLASS = "class"; //$NON-NLS-1$ + + private static QueryResultDisplayersRegistry instance = null; + + private final List<IETypedElementResultDisplayer> queryResultDisplayers; + + public QueryResultDisplayersRegistry() { + this.queryResultDisplayers = new ArrayList<IETypedElementResultDisplayer>(); + initialize(); + } + + public static QueryResultDisplayersRegistry getInstance() { + if (QueryResultDisplayersRegistry.instance == null) { + QueryResultDisplayersRegistry.instance = new QueryResultDisplayersRegistry(); + } + return QueryResultDisplayersRegistry.instance; + } + + public List<IETypedElementResultDisplayer> getQueryResultDisplayers() { + return this.queryResultDisplayers; + } + + public IETypedElementResultDisplayer getQueryResultDisplayer(final String name) { + for (IETypedElementResultDisplayer namedQueryResultDisplayer : this.queryResultDisplayers) { + if (name.equals(namedQueryResultDisplayer.getName())) { + return namedQueryResultDisplayer; + } + } + return null; + } + + @Override + protected String getExtensionPointName() { + return QueryResultDisplayersRegistry.EXTENSION_POINT_NAME; + } + + @Override + protected String getExtensionPointNamespace() { + return Activator.getDefault().getBundle().getSymbolicName(); + } + + @Override + protected void handleRootElement(final IConfigurationElement configurationElement) { + final String name = configurationElement.getName(); + if (name.equalsIgnoreCase(QueryResultDisplayersRegistry.ELEMENT_QUERY_RESULT_DISPLAYER)) { + readQueryResultDisplayer(configurationElement); + } else { + logUnknownElement(configurationElement); + } + } + + private void readQueryResultDisplayer(final IConfigurationElement configurationElement) { + Object queryResultDisplayerObject = null; + try { + queryResultDisplayerObject = configurationElement + .createExecutableExtension(QueryResultDisplayersRegistry.ATTRIBUTE_CLASS); + } catch (final CoreException e) { + Logger.logError(e, Activator.getDefault()); + } + if (queryResultDisplayerObject == null) { + logMissingAttribute(configurationElement, QueryResultDisplayersRegistry.ATTRIBUTE_CLASS); + return; + } + + if (queryResultDisplayerObject instanceof IETypedElementResultDisplayer) { + IETypedElementResultDisplayer queryResultDisplayer = (IETypedElementResultDisplayer) queryResultDisplayerObject; + this.queryResultDisplayers.add(queryResultDisplayer); + } else { + logError(configurationElement, NLS.bind("The given class is not a {0}.", //$NON-NLS-1$ + IETypedElementResultDisplayer.class.getSimpleName())); + } + + } +}
diff --git a/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/modisco/facet/efacet/ui/internal/widget/EClassifierSelectionControl.java b/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/modisco/facet/efacet/ui/internal/widget/EClassifierSelectionControl.java new file mode 100644 index 0000000..772ac3b --- /dev/null +++ b/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/modisco/facet/efacet/ui/internal/widget/EClassifierSelectionControl.java
@@ -0,0 +1,90 @@ +/******************************************************************************* + * Copyright (c) 2009, 2011 Mia-Software. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Nicolas Bros (Mia-Software) - initial API and implementation + * Nicolas Guyomar (Mia-Software) - Bug 349546 - EMF Facet facetSet editor + *******************************************************************************/ +package org.eclipse.modisco.facet.efacet.ui.internal.widget; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import org.eclipse.emf.common.util.EList; +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.EClassifier; +import org.eclipse.emf.ecore.EDataType; +import org.eclipse.emf.ecore.EPackage; +import org.eclipse.modisco.facet.efacet.ui.internal.Messages; +import org.eclipse.modisco.facet.efacet.ui.internal.composites.FilteredElementSelectionComposite; +import org.eclipse.modisco.facet.efacet.ui.internal.composites.SelectETypeComposite.ETypeSelectionOptions; +import org.eclipse.swt.widgets.Composite; + +/** + * A control to select an {@link EClass}, that can be filtered using the associated text field. + */ +public class EClassifierSelectionControl extends FilteredElementSelectionComposite { + + private final Map<String, EClassifier> stringToEClassifierMap = new HashMap<String, EClassifier>(); + private final ETypeSelectionOptions eTypeSelectionOption; + private String metamodelNsUri; + + public EClassifierSelectionControl(final Composite parent, final String metamodelNsUri, final ETypeSelectionOptions eTypeSelectionOption) { + super(parent, true, false); + this.eTypeSelectionOption = eTypeSelectionOption; + this.metamodelNsUri = metamodelNsUri; + } + + public void updateList(final String metamodelNsUri2) { + this.metamodelNsUri = metamodelNsUri2; + EPackage ePackage = EPackage.Registry.INSTANCE.getEPackage(this.metamodelNsUri); + if (ePackage != null) { + List<String> eClasses = new ArrayList<String>(); + EList<EClassifier> eClassifiers = ePackage.getEClassifiers(); + if (this.eTypeSelectionOption == ETypeSelectionOptions.ECLASS) { + for (EClassifier eClassifier : eClassifiers) { + if (eClassifier instanceof EClass) { + eClasses.add(eClassifier.getName()); + this.stringToEClassifierMap.put(eClassifier.getName(), eClassifier); + } + } + } else if (this.eTypeSelectionOption == ETypeSelectionOptions.EDATATYPE) { + for (EClassifier eClassifier : eClassifiers) { + if (eClassifier instanceof EDataType) { + eClasses.add(eClassifier.getName()); + this.stringToEClassifierMap.put(eClassifier.getName(), eClassifier); + } + } + + } else { + for (EClassifier eClassifier : eClassifiers) { + eClasses.add(eClassifier.getName()); + this.stringToEClassifierMap.put(eClassifier.getName(), eClassifier); + } + } + if (eClasses.isEmpty()) { + eClasses.add(Messages.No_result_found); + setEnabled(false); + } else { + setEnabled(true); + } + setElements(eClasses.toArray()); + } + } + + public EClassifier getSelectedEClassifier() { + Object[] selectElements = getSelectedElements(); + if (selectElements != null && selectElements.length > 0) { + if (this.stringToEClassifierMap.containsKey(selectElements[0])) { + return this.stringToEClassifierMap.get(selectElements[0]); + } + } + return null; + } +}
diff --git a/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/modisco/facet/efacet/ui/internal/widget/ETypedElementSelectionControl.java b/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/modisco/facet/efacet/ui/internal/widget/ETypedElementSelectionControl.java new file mode 100644 index 0000000..09b0773 --- /dev/null +++ b/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/modisco/facet/efacet/ui/internal/widget/ETypedElementSelectionControl.java
@@ -0,0 +1,421 @@ +/******************************************************************************* + * Copyright (c) 2010, 2015 Mia-Software, CEA-LIST, and Soft-Maint. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Nicolas Bros (Mia-Software) - Bug 370806 - [table] rewrite the "allowed contents" query selection dialog for v0.2 + * Vincent Lorenzo (CEA-LIST) - Bug 372644 - Create Customizable tooltips for the TreeViewer using a CustomizableLabelProvider + * Gregoire Dupe (Mia-Software) - Bug 372644 - Create Customizable tooltips for the TreeViewer using a CustomizableLabelProvider + * Gregoire Dupe (Mia-Software) - Bug 373078 - API Cleaning + * Vincent Lorenzo (CEA-LIST) - Bug 357621 - Improve the label displayed for Customization and Facets + * Gregoire Dupe (Mia-Software) - Bug 372626 - Aggregates + * Olivier Remaud (Soft-Maint) - Bug 377615 - Query View filtering + * Vincent Lorenzo (CEA-LIST) - Bug 357621 - Improve the label displayed for Customization and Facets + * Vincent Lorenzo (CEA-LIST) - Bug 377909 - The elements displayed in the ETypedElement dialog are not sorted by alphabetic order + * Thomas Cicognani (Mia-Software) - Bug 472075 - Update API to create UI shortcuts to activate FacetSets +*******************************************************************************/ +package org.eclipse.modisco.facet.efacet.ui.internal.widget; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.HashSet; +import java.util.Iterator; +import java.util.List; +import java.util.Set; + +import org.eclipse.core.runtime.IStatus; +import org.eclipse.core.runtime.Status; +import org.eclipse.emf.common.util.TreeIterator; +import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.ecore.ETypedElement; +import org.eclipse.jface.viewers.ColumnViewerToolTipSupport; +import org.eclipse.jface.viewers.IBaseLabelProvider; +import org.eclipse.jface.viewers.IContentProvider; +import org.eclipse.jface.viewers.ILabelProvider; +import org.eclipse.jface.viewers.IOpenListener; +import org.eclipse.jface.viewers.ISelectionChangedListener; +import org.eclipse.jface.viewers.IStructuredSelection; +import org.eclipse.jface.viewers.ITreeContentProvider; +import org.eclipse.jface.viewers.OpenEvent; +import org.eclipse.jface.viewers.SelectionChangedEvent; +import org.eclipse.jface.viewers.StructuredSelection; +import org.eclipse.jface.viewers.StructuredViewer; +import org.eclipse.jface.viewers.Viewer; +import org.eclipse.jface.viewers.ViewerComparator; +import org.eclipse.jface.viewers.ViewerFilter; +import org.eclipse.modisco.facet.efacet.ui.internal.Activator; +import org.eclipse.modisco.facet.efacet.ui.internal.Messages; +import org.eclipse.modisco.facet.efacet.ui.internal.utils.ImageProvider; +import org.eclipse.modisco.facet.util.core.internal.exported.IFilter; +import org.eclipse.modisco.facet.util.emf.ui.internal.exported.IEmfLabelProviderFactory; +import org.eclipse.osgi.util.NLS; +import org.eclipse.swt.SWT; +import org.eclipse.swt.events.SelectionAdapter; +import org.eclipse.swt.events.SelectionEvent; +import org.eclipse.swt.graphics.Image; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.widgets.Button; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.ui.dialogs.FilteredTree; +import org.eclipse.ui.dialogs.PatternFilter; + +/** + * A control that displays a tree of ETypedElements under a list of containers (EPackages for example), with a filter + * text field. + */ +public class ETypedElementSelectionControl implements IETypedElementTabSelectionWidgetInternal { + + public static final String TAB_ID = "flat.view.id"; //$NON-NLS-1$ + + public static final String TITLE = Messages.ETypedElementSelectionControl_FlatView; + + /** An OK status, but without the "OK" message, because we don't want "OK" to appear in the status bar */ + private static final IStatus OK_STATUS = new Status(IStatus.OK, Activator.PLUGIN_ID, ""); //$NON-NLS-1$ + + private FilteredTree filteredTree; + protected Collection<? extends ETypedElement> available; + private final int selectionMaxSize; + private final boolean allowEmpty; + private Button rbNoSelection; + private Button rbSelection; + private IStatus validationStatus; + private final IBaseLabelProvider labelProvider; + private final Composite cParent; + private final Collection<? extends EObject> knownEPackage; + + /** Create a tree with a filter text field to select ETypedElements. */ + public ETypedElementSelectionControl(final Composite parentComposite, + final int selectionMaxSize, final boolean allowEmpty, + final Collection<? extends EObject> knownEPackage) { + this.cParent = parentComposite; + this.knownEPackage = knownEPackage; + this.selectionMaxSize = selectionMaxSize; + this.allowEmpty = allowEmpty; + this.labelProvider = IEmfLabelProviderFactory.DEFAULT.createLabelProvider(); + } + + public void createContents() { + final Composite composite = new Composite(this.cParent, SWT.NONE); + composite.setLayout(new GridLayout()); + composite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true)); + + if (this.allowEmpty) { + this.rbNoSelection = new Button(composite, SWT.RADIO); + this.rbNoSelection.setText(Messages.ETypedElementSelectionDialog_radioButtonNoSelection); + this.rbNoSelection.setSelection(true); + this.rbNoSelection.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(final SelectionEvent event) { + final boolean selected = getRadioButtonNoSelection().getSelection(); + setETypedElementSelectionEnabled(!selected); + if (selected) { + setSelection(StructuredSelection.EMPTY); + } + } + }); + this.rbSelection = new Button(composite, SWT.RADIO); + if (this.selectionMaxSize > 1) { + this.rbSelection.setText(Messages.ETypedElementSelectionDialog_radioButtonMultiSelection); + } else { + this.rbSelection.setText(Messages.ETypedElementSelectionDialog_radioButtonSingleSelection); + } + this.rbSelection.setSelection(false); + this.rbSelection.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(final SelectionEvent event) { + final boolean selected = getRadioButtonSelection().getSelection(); + setETypedElementSelectionEnabled(selected); + if (!selected) { + setSelection(StructuredSelection.EMPTY); + } + } + }); + } + + createFilteredTree(composite); + + this.filteredTree.getViewer().addSelectionChangedListener(new ISelectionChangedListener() { + public void selectionChanged(final SelectionChangedEvent event) { + updateValidationStatus(); + } + }); + + if (this.allowEmpty) { + setETypedElementSelectionEnabled(false); + } + + updateValidationStatus(); + } + + public void addOpenListener(final IOpenListener openListener) { + // double-click or enter to choose the selected typed element + this.filteredTree.getViewer().addOpenListener(new IOpenListener() { + public void open(final OpenEvent event) { + // only if the selection is valid + if (!isErrorStatus()) { + openListener.open(event); + } + } + }); + } + + public void addSelectionChangedListener(final ISelectionChangedListener listener) { + this.filteredTree.getViewer().addSelectionChangedListener(listener); + } + + private void createFilteredTree(final Composite parentComposite) { + this.filteredTree = new FilteredTree(parentComposite, selectionStyle(this.selectionMaxSize) | SWT.H_SCROLL | SWT.V_SCROLL + | SWT.BORDER, createPatternFilter(), true); + // allow tooltip for this viewer + ColumnViewerToolTipSupport.enableFor(this.filteredTree.getViewer()); + this.filteredTree.getViewer().setContentProvider(createContentProvider()); + this.filteredTree.getViewer().setLabelProvider(this.labelProvider); + this.filteredTree.getViewer().setFilters(new ViewerFilter[] { this.filteredTree.getPatternFilter() }); + this.filteredTree.getViewer().setComparator(new ViewerComparator()); + } + + protected void updateValidationStatus() { + if (this.filteredTree == null) { + return; + } + + final Status errorElements = new Status(IStatus.ERROR, Activator.PLUGIN_ID, + Messages.ETypedElementSelectionControl_invalidSelectionETypedElementsOnly); + final Status errorSelection = new Status(IStatus.ERROR, Activator.PLUGIN_ID, Messages.ETypedElementSelectionControl_invalidSelection); + + final IStructuredSelection selection = (IStructuredSelection) this.filteredTree.getViewer().getSelection(); + IStatus newStatus = ETypedElementSelectionControl.OK_STATUS; + if (!this.allowEmpty && selection.isEmpty()) { + newStatus = new Status(IStatus.ERROR, Activator.PLUGIN_ID, NLS.bind(Messages.ETypedElementSelectionControl_invalidSelectionAtLeastOneElement, + Integer.valueOf(this.selectionMaxSize))); + } else if (selection.size() > this.selectionMaxSize) { + newStatus = new Status(IStatus.ERROR, Activator.PLUGIN_ID, NLS.bind(Messages.ETypedElementSelectionControl_invalidSelectionAtMostXElements, + Integer.valueOf(this.selectionMaxSize))); + } else { + final Iterator<?> iterator = selection.iterator(); + while (iterator.hasNext()) { + final Object selectedElement = iterator.next(); + if (!(selectedElement instanceof ETypedElement)) { + newStatus = errorElements; + break; + } + } + } + setValidationStatus(newStatus); + } + + protected void setValidationStatus(final IStatus status) { + this.validationStatus = status; + } + + public IStatus getValidationStatus() { + return this.validationStatus; + } + + public boolean isErrorStatus() { + return this.validationStatus == null || this.validationStatus.getSeverity() >= IStatus.ERROR; + } + + public void setAvailableETypedElements(final Collection<? extends ETypedElement> newAvailable) { + this.available = newAvailable; + final Set<EObject> containers = new HashSet<EObject>(); + for (final ETypedElement eTypedElement : newAvailable) { + final EObject container = getTopmostContainer(eTypedElement); + if (container != null && containsETypedElement(container)) { + containers.add(container); + } + } + for (EObject eObject : this.knownEPackage) { + if (containsETypedElement(eObject)) { + containers.add(eObject); + } + } + setInput(containers); + } + + protected static EObject getTopmostContainer(final EObject eObject) { + EObject container = eObject.eContainer(); + EObject result = container; + while (container != null) { + result = container; + container = container.eContainer(); + } + return result; + } + + public List<ETypedElement> getSelectedETypedElements() { + final List<ETypedElement> currentlySelected = new ArrayList<ETypedElement>(); + if (this.filteredTree.isDisposed()) { + throw new IllegalStateException("Cannot get the selection since the viewer is disposed."); //$NON-NLS-1$ + } + final IStructuredSelection selection = (IStructuredSelection) this.filteredTree.getViewer() + .getSelection(); + final Iterator<?> iterator = selection.iterator(); + while (iterator.hasNext()) { + final Object element = iterator.next(); + if (element instanceof ETypedElement) { + final ETypedElement eTypedElement = (ETypedElement) element; + currentlySelected.add(eTypedElement); + } + } + return currentlySelected; + } + + public void setSelectedETypedElements(final Collection<? extends ETypedElement> newSelection) { + if (newSelection == null) { + throw new IllegalArgumentException(); + } + final List<ETypedElement> filteredSelection = new ArrayList<ETypedElement>(); + filteredSelection.addAll(newSelection); + // only keep available elements + filteredSelection.retainAll(this.available); + setSelection(new StructuredSelection(filteredSelection)); + } + + public void setSelection(final IStructuredSelection selection) { + setETypedElementSelectionEnabled(!selection.isEmpty()); + this.filteredTree.getViewer().setSelection(selection); + updateValidationStatus(); + } + + protected void setETypedElementSelectionEnabled(final boolean enabled) { + getRadioButtonNoSelection().setSelection(!enabled); + getRadioButtonSelection().setSelection(enabled); + this.filteredTree.getViewer().getTree().setEnabled(enabled); + this.filteredTree.getFilterControl().setEnabled(enabled); + } + + public void setInput(final Collection<? extends EObject> containers) { + this.filteredTree.getViewer().setInput(containers); + } + + // @SuppressWarnings("unchecked") : this is the input type + @SuppressWarnings("unchecked") + public Collection<? extends EObject> getInput() { + return (Collection<? extends EObject>) this.filteredTree.getViewer().getInput(); + } + + protected IContentProvider createContentProvider() { + return new ETypedElementSelectionControlContentProvider(new IFilter<EObject>() { + public boolean filter(final EObject eObject) { + return filterChild(eObject); + } + }); + } + + protected boolean filterChild(final EObject eObject) { + boolean selected; + if (containsETypedElement(eObject)) { + selected = true; + } else if (eObject instanceof ETypedElement) { + selected = isAvailable(eObject); + } else { + selected = false; + } + return selected; + } + + protected boolean isAvailable(final EObject eObject) { + return this.available.contains(eObject); + } + + protected boolean containsETypedElement(final EObject eObject) { + boolean result = false; + final TreeIterator<EObject> eAllContents = eObject.eAllContents(); + while (eAllContents.hasNext()) { + final EObject element = eAllContents.next(); + if (element instanceof ETypedElement) { + final ETypedElement typedElement = (ETypedElement) element; + if (isAvailable(typedElement)) { + result = true; + break; + } + } else { + result = containsETypedElement(element); + if (result) { + break; + } + } + } + return result; + } + + private static int selectionStyle(final int selectionMaxSize) { + int selectionStyle; + if (selectionMaxSize > 1) { + selectionStyle = SWT.MULTI; + } else { + selectionStyle = SWT.SINGLE; + } + return selectionStyle; + } + + private static PatternFilter createPatternFilter() { + return new PatternFilter() { + @Override + protected boolean isLeafMatch(final Viewer viewer, final Object element) { + final String labelText = ((ILabelProvider) ((StructuredViewer) viewer).getLabelProvider()) + .getText(element); + + if (labelText == null) { + return false; + } + return wordMatches(labelText) || parentMatches(viewer, element); + } + + private boolean parentMatches(final Viewer viewer, final Object element) { + final ITreeContentProvider contentProvider = (ITreeContentProvider) ((StructuredViewer) viewer) + .getContentProvider(); + final Object parent = contentProvider.getParent(element); + if (parent == null) { + return false; + } + return isLeafMatch(viewer, parent); + } + }; + } + + public IStructuredSelection getSelection() { + return (IStructuredSelection) this.filteredTree.getViewer().getSelection(); + } + + protected Button getRadioButtonNoSelection() { + return this.rbNoSelection; + } + + protected Button getRadioButtonSelection() { + return this.rbSelection; + } + + public FilteredTree getFilteredTree() { + return this.filteredTree; + } + + public boolean isDisposed() { + return this.filteredTree.isDisposed(); + } + + public String getTitle() { + return ETypedElementSelectionControl.TITLE; + } + + public String getToolTipText() { + return getTitle(); + } + + public Image getImage() { + return ImageProvider.getInstance().getFlatViewIcon(); + } + + public String getTabId() { + return ETypedElementSelectionControl.TAB_ID; + } + + public Collection<? extends EObject> getKnownEPackage() { + return this.knownEPackage; + } +}
diff --git a/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/modisco/facet/efacet/ui/internal/widget/ETypedElementSelectionControlContentProvider.java b/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/modisco/facet/efacet/ui/internal/widget/ETypedElementSelectionControlContentProvider.java new file mode 100644 index 0000000..5fd991f --- /dev/null +++ b/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/modisco/facet/efacet/ui/internal/widget/ETypedElementSelectionControlContentProvider.java
@@ -0,0 +1,99 @@ +/******************************************************************************* + * Copyright (c) 2012 CEA LIST. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Nicolas Bros (Mia-Software) - Bug 370806 - [table] rewrite the "allowed contents" query selection dialog for v0.2 + * Gregoire Dupe (Mia-Software) - Bug 372626 - Aggregates + *******************************************************************************/ +package org.eclipse.modisco.facet.efacet.ui.internal.widget; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.List; + +import org.eclipse.emf.common.util.EList; +import org.eclipse.emf.ecore.EObject; +import org.eclipse.jface.viewers.ITreeContentProvider; +import org.eclipse.jface.viewers.Viewer; +import org.eclipse.modisco.facet.util.core.internal.exported.IFilter; + +public class ETypedElementSelectionControlContentProvider implements ITreeContentProvider { + + private final IFilter<EObject> childrenFilter; + + public ETypedElementSelectionControlContentProvider(final IFilter<EObject> childrenFilter) { + this.childrenFilter = childrenFilter; + } + + private Object input; + + public Object[] getElements(final Object inputElement) { + // @SuppressWarnings("unchecked") : this is the type setInput accepts + @SuppressWarnings("unchecked") + final Collection<? extends EObject> containers = (Collection<? extends EObject>) inputElement; + return containers.toArray(); + } + + public Object[] getChildren(final Object parentElement) { + Object[] children; + if (parentElement instanceof EObject) { + final EObject container = (EObject) parentElement; + final List<EObject> filteredChildren = computeFilteredChildren(container); + children = filteredChildren.toArray(); + } else { + children = new Object[0]; + } + return children; + } + + public Object getParent(final Object element) { + Object parent = null; + if (element instanceof EObject) { + parent = ((EObject) element).eContainer(); + } + return parent; + } + + // @SuppressWarnings("unchecked") : the input type is checked by setInput + @SuppressWarnings("unchecked") + public boolean hasChildren(final Object element) { + boolean result; + final Collection<? extends EObject> rootElements = (Collection<? extends EObject>) this.input; + if (rootElements.contains(element)) { + // avoid computing all the children of all the top-level elements + // since this could be very expensive + result = true; + } else if (element instanceof EObject) { + result = getChildren(element).length > 0; + } else { + result = false; + } + return result; + } + + public void inputChanged(final Viewer viewer, final Object oldInput, + final Object newInput) { + this.input = newInput; + } + + public void dispose() { + // nothing + } + + protected List<EObject> computeFilteredChildren(final EObject parentEObject) { + final List<EObject> children = new ArrayList<EObject>(); + final EList<EObject> eContents = parentEObject.eContents(); + children.addAll(eContents); + final List<EObject> filteredChildren = new ArrayList<EObject>(); + for (final EObject eObject : children) { + if (this.childrenFilter.filter(eObject)) { + filteredChildren.add(eObject); + } + } + return filteredChildren; + } +} \ No newline at end of file
diff --git a/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/modisco/facet/efacet/ui/internal/widget/ETypedElementSelectionControlManager.java b/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/modisco/facet/efacet/ui/internal/widget/ETypedElementSelectionControlManager.java new file mode 100644 index 0000000..a90a819 --- /dev/null +++ b/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/modisco/facet/efacet/ui/internal/widget/ETypedElementSelectionControlManager.java
@@ -0,0 +1,215 @@ +/** + * Copyright (c) 2012, 2015 CEA-LIST, and Mia-Software. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Vincent Lorenzo (CEA-LIST) - Bug 357621 - Improve the label displayed for Customization and Facets + * Gregoire Dupe (Mia-Software) - Bug 357621 - Improve the label displayed for Customization and Facets + * Gregoire Dupe (Mia-Software) - Bug 372626 - Aggregates + * Nicolas Bros (Mia-Software) - Bug 370806 - [table] rewrite the "allowed contents" query selection dialog for v0.2 + * Thomas Cicognani (Mia-Software) - Bug 472075 - Update API to create UI shortcuts to activate FacetSets + */ +package org.eclipse.modisco.facet.efacet.ui.internal.widget; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import org.eclipse.core.runtime.IStatus; +import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.ecore.ETypedElement; +import org.eclipse.jface.preference.IPreferenceStore; +import org.eclipse.jface.viewers.IOpenListener; +import org.eclipse.jface.viewers.ISelectionChangedListener; +import org.eclipse.jface.viewers.IStructuredSelection; +import org.eclipse.jface.viewers.StructuredSelection; +import org.eclipse.modisco.facet.efacet.ui.internal.Activator; +import org.eclipse.modisco.facet.efacet.ui.internal.preferences.PreferenceConstants; +import org.eclipse.swt.SWT; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.TabFolder; +import org.eclipse.swt.widgets.TabItem; +import org.eclipse.ui.dialogs.FilteredTree; + +public class ETypedElementSelectionControlManager implements + IETypedElementSelectionControlManager { + + // this map does the link between the tabItem and the filtered trees + private final Map<TabItem, IETypedElementTabSelectionWidgetInternal> trees; + private TabFolder tabFolder; + private final Composite parentComposite; + private final int selectionMaxSize; + + /** + * true if empty selection is allowed + */ + private final boolean emptySelection; + private Collection<? extends ETypedElement> availableElements; + private final Collection<? extends EObject> knownEPackage; + + public ETypedElementSelectionControlManager( + final Composite parentComposite, final int selectionMaxSize, + final boolean emptySelection, + final Collection<? extends EObject> knownEPackage) { + + this.trees = new HashMap<TabItem, IETypedElementTabSelectionWidgetInternal>(); + this.parentComposite = parentComposite; + this.selectionMaxSize = selectionMaxSize; + this.emptySelection = emptySelection; + this.knownEPackage = knownEPackage; + } + + private static Composite createComposite(final Composite parent) { + final Composite composite = new Composite(parent, SWT.NONE); + final GridLayout layout = new GridLayout(); + composite.setLayout(layout); + composite.setLayoutData(new GridData(GridData.FILL_BOTH)); + return composite; + } + + private void init() { + this.tabFolder = new TabFolder(this.parentComposite, SWT.TOP); + this.tabFolder.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, + true)); + + // we create the flat tree + final TabItem flatItem = new TabItem(this.tabFolder, SWT.NONE); + + final Composite flatComposite = createComposite(this.tabFolder); + IETypedElementTabSelectionWidgetInternal filteredTree = new ETypedElementSelectionControl( + flatComposite, this.selectionMaxSize, this.emptySelection, + this.knownEPackage); + flatItem.setText(filteredTree.getTitle()); + flatItem.setToolTipText(filteredTree.getToolTipText()); + flatItem.setImage(filteredTree.getImage()); + this.trees.put(flatItem, filteredTree); + flatItem.setControl(flatComposite); + // we create the sortedTabItem + final TabItem sortedItem = new TabItem(this.tabFolder, SWT.NONE); + final Composite sortedComposite = createComposite(this.tabFolder); + filteredTree = new ETypedElementSelectionSortedControl(sortedComposite, + this.selectionMaxSize, this.emptySelection, this.knownEPackage); + sortedItem.setText(filteredTree.getTitle()); + sortedItem.setToolTipText(filteredTree.getToolTipText()); + sortedItem.setImage(filteredTree.getImage()); + sortedItem.setControl(sortedComposite); + this.trees.put(sortedItem, filteredTree); + initSelectedTabItem(); + } + + private IETypedElementTabSelectionWidgetInternal getActiveTree() { + // selectionIndex: Index of the selected tab + final int selectionIndex = this.tabFolder.getSelectionIndex(); + final TabItem currentTabItem = this.tabFolder + .getItem(selectionIndex); + return this.trees.get(currentTabItem); + } + + public void addOpenListener(final IOpenListener openListener) { + for (IETypedElementSelectionWidgetInternal tree : this.trees.values()) { + tree.addOpenListener(openListener); + } + } + + public void addSelectionChangedListener( + final ISelectionChangedListener listener) { + for (IETypedElementSelectionWidgetInternal tree : this.trees.values()) { + tree.addSelectionChangedListener(listener); + } + } + + /** + * Set the focus on the last selected TabItem + */ + private void initSelectedTabItem() { + final IPreferenceStore store = Activator.getDefault() + .getPreferenceStore(); + final String value = store + .getString(PreferenceConstants.TE_SELECTION_TAB); + for (TabItem item : this.tabFolder.getItems()) { + if (item.getText().equals(value)) { + this.tabFolder.setSelection(item); + return; + } + } + } + + public IStatus getValidationStatus() { + return getActiveTree().getValidationStatus(); + } + + public void setAvailableETypedElements( + final Collection<? extends ETypedElement> availableTE) { + this.availableElements = availableTE; + for (IETypedElementSelectionWidgetInternal current : this.trees + .values()) { + current.setAvailableETypedElements(availableTE); + } + } + + public List<ETypedElement> getSelectedETypedElements() { + return getActiveTree().getSelectedETypedElements(); + } + + private void updatePreferenceValue() { + final IPreferenceStore store = Activator.getDefault() + .getPreferenceStore(); + final String value = getActiveTree().getTitle(); + store.setValue( + PreferenceConstants.TE_SELECTION_TAB, + value); + } + + public void setSelectedETypedElements( + final Collection<? extends ETypedElement> newSelection) { + if (newSelection == null) { + throw new IllegalArgumentException(); + } + // only select elements that match the filter + final List<ETypedElement> filteredSelection = new ArrayList<ETypedElement>(); + for (ETypedElement typedElement : newSelection) { + if (this.availableElements.contains(typedElement)) { + filteredSelection.add(typedElement); + } + } + setSelection(new StructuredSelection(filteredSelection)); + } + + public void setSelection(final IStructuredSelection selection) { + for (IETypedElementSelectionWidgetInternal filteredTree : this.trees + .values()) { + filteredTree.setSelection(selection); + } + } + + public List<ETypedElement> computeResult() { + // we save the last visible item : + updatePreferenceValue(); + return getActiveTree().getSelectedETypedElements(); + } + + public boolean isDisposed() { + return this.tabFolder == null || this.tabFolder.isDisposed() || getActiveTree().isDisposed(); + } + + public FilteredTree getFilteredTree() { + return getActiveTree().getFilteredTree(); + } + + public void createContents() { + init(); + for (IETypedElementSelectionWidgetInternal current : this.trees + .values()) { + current.createContents(); + } + } + +} \ No newline at end of file
diff --git a/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/modisco/facet/efacet/ui/internal/widget/ETypedElementSelectionSortedControl.java b/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/modisco/facet/efacet/ui/internal/widget/ETypedElementSelectionSortedControl.java new file mode 100644 index 0000000..cab5a91 --- /dev/null +++ b/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/modisco/facet/efacet/ui/internal/widget/ETypedElementSelectionSortedControl.java
@@ -0,0 +1,204 @@ +/******************************************************************************* + * Copyright (c) 2012, 2015 CEA-LIST, and Mia-Software. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Vincent Lorenzo (CEA-LIST) - Bug 357621 - Improve the label displayed for Customization and Facets + * Gregoire Dupe (Mia-Software) - Bug 373078 - API Cleaning + * Gregoire Dupe (Mia-Software) - Bug 375087 - [Table] ITableWidget.addColumn(List<ETypedElement>, List<FacetSet>) + * Gregoire Dupe (Mia-Software) - Bug 372626 - Aggregates + * Vincent Lorenzo (CEA-LIST) - Bug 357621 - Improve the label displayed for Customization and Facets + * Thomas Cicognani (Mia-Software) - Bug 472075 - Update API to create UI shortcuts to activate FacetSets + *******************************************************************************/ +package org.eclipse.modisco.facet.efacet.ui.internal.widget; + +import java.util.Collection; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Map; +import java.util.Set; + +import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.ecore.EPackage; +import org.eclipse.emf.ecore.ETypedElement; +import org.eclipse.jface.viewers.IContentProvider; +import org.eclipse.modisco.facet.efacet.core.FacetUtils; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.FacetSet; +import org.eclipse.modisco.facet.efacet.ui.internal.Activator; +import org.eclipse.modisco.facet.efacet.ui.internal.Messages; +import org.eclipse.modisco.facet.efacet.ui.internal.utils.ImageProvider; +import org.eclipse.modisco.facet.util.core.Logger; +import org.eclipse.modisco.facet.util.core.internal.exported.IFilter; +import org.eclipse.osgi.util.NLS; +import org.eclipse.swt.graphics.Image; +import org.eclipse.swt.widgets.Composite; + +/** + * A control that displays a tree of ETypedElements under a list of containers + * (EPackages for example), with a filter text field. + * + * the result should be : Ecore - FacetSet/Custom/... UML - FacetSet/Custom/... + * Aggregate - FacetSet/Custom/... + */ +public class ETypedElementSelectionSortedControl extends + ETypedElementSelectionControl { + + /** this groupByMap is used to define the input of the treeviewer */ + private final Map<EPackage, Set<EObject>> groupByMap; + + /** the name of the tabs */ + private static final String NAME = Messages.ETypedElementSelectionSortedControl_groupByMetamodelView; + + public static final String GROUPED_TAB_ID = "group.by.metamodel.view.id"; //$NON-NLS-1$ + + public static final String TOOLTIP = Messages.ETypedElementSelectionSortedControl_toolTip; + + /** + * + * @param parentComposite + * @param selectionMaxSize + * @param allowEmptySelection + * @param customizationMgr + */ + public ETypedElementSelectionSortedControl(final Composite parentComposite, + final int selectionMaxSize, final boolean allowEmpty, + final Collection<? extends EObject> knownEPackage) { + super(parentComposite, selectionMaxSize, allowEmpty, knownEPackage); + this.groupByMap = new HashMap<EPackage, Set<EObject>>(); + } + + @Override + public void setAvailableETypedElements( + final Collection<? extends ETypedElement> newAvailable) { + this.available = newAvailable; + prepareInput(); + setInput(this.groupByMap.keySet()); + } + + /** + * this method is used to organize the input + */ + private void prepareInput() { + if (this.available != null) { + for (ETypedElement eTypedElement : this.available) { + final EObject container = getTopmostContainer(eTypedElement); + if (container != null && containsETypedElement(container)) { + addContainer(container); + } + } + } + for (EObject current : getKnownEPackage()) { + if (containsETypedElement(current)) { + addContainer(current); + } + } + } + + + /** + * Add a container to the groupByMap + * + * @param container + * a container to add + */ + private void addContainer(final EObject container) { + if (container instanceof FacetSet) { //we show only FacetSet in this view + final FacetSet facetSet = (FacetSet) container; + final Set<EPackage> packs = FacetUtils + .getAllExtendedEPackage(facetSet); + if (packs.isEmpty()) { + Logger.logError(NLS.bind("Package not found: {0}", //$NON-NLS-1$ + container), Activator.getDefault()); + } + for (EPackage current : packs) { + getValues(current).add(container); + } + } + } + + /** + * + * @param pack + * an EPackage + * @return the values associated to the EPackage + */ + private Collection<EObject> getValues(final EPackage pack) { + if (!this.groupByMap.containsKey(pack)) { + final Set<EObject> values = new HashSet<EObject>(); + this.groupByMap.put(pack, values); + } + return this.groupByMap.get(pack); + } + + @Override + protected IContentProvider createContentProvider() { + return new SortedContentProvider(new IFilter<EObject>() { + public boolean filter(final EObject eObject) { + return filterChild(eObject); + } + }); + } + + @Override + public String getTitle() { + return ETypedElementSelectionSortedControl.NAME; + } + + @Override + public Image getImage() { + return ImageProvider.getInstance().getTreeViewIcon(); + } + + @Override + public String getToolTipText() { + return ETypedElementSelectionSortedControl.TOOLTIP; + } + + @Override + public String getTabId() { + return ETypedElementSelectionSortedControl.GROUPED_TAB_ID; + } + + public Set<EObject> getChlidren(final Object parentElement) { + return this.groupByMap + .get(parentElement); + } + + private class SortedContentProvider extends + ETypedElementSelectionControlContentProvider { + + public SortedContentProvider(final IFilter<EObject> childrenFilter) { + super(childrenFilter); + } + + @Override + public Object[] getChildren(final Object parentElement) { + Object[] children; + final Set<EObject> list = ETypedElementSelectionSortedControl.this + .getChlidren(parentElement); + if (list == null) { + children = super.getChildren(parentElement); + } else { + children = list.toArray(); + } + return children; + } + + @Override + public Object getParent(final Object element) { + Object parent = super.getParent(element); + if (parent == null && element instanceof FacetSet) { + final Set<EPackage> packs = FacetUtils + .getAllExtendedEPackage((FacetSet) element); + if (!packs.isEmpty()) { + parent = packs.iterator().next(); + } + } + return parent; + } + + } +}
diff --git a/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/modisco/facet/efacet/ui/internal/widget/ETypedElementSelectionWidgetFactory.java b/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/modisco/facet/efacet/ui/internal/widget/ETypedElementSelectionWidgetFactory.java new file mode 100644 index 0000000..0c8ddf2 --- /dev/null +++ b/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/modisco/facet/efacet/ui/internal/widget/ETypedElementSelectionWidgetFactory.java
@@ -0,0 +1,44 @@ +/******************************************************************************* + * Copyright (c) 2012, 2015 Mia-Software, and CEA-LIST. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Nicolas Bros (Mia-Software) - Bug 370806 - [table] rewrite the "allowed contents" query selection dialog for v0.2 + * Vincent Lorenzo (CEA-LIST) - Bug 372644 - Create Customizable tooltips for the TreeViewer using a CustomizableLabelProvider + * Gregoire Dupe (Mia-Software) - Bug 372626 - Aggregates + * Thomas Cicognani (Mia-Software) - Bug 472075 - Update API to create UI shortcuts to activate FacetSets + *******************************************************************************/ +package org.eclipse.modisco.facet.efacet.ui.internal.widget; + +import java.util.Collection; + +import org.eclipse.emf.ecore.EObject; +import org.eclipse.modisco.facet.custom.core.ICustomizationManager; +import org.eclipse.modisco.facet.efacet.ui.internal.exported.widget.IETypedElementSelectionWidget; +import org.eclipse.modisco.facet.efacet.ui.internal.exported.widget.IETypedElementSelectionWidgetFactory; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Display; + +public class ETypedElementSelectionWidgetFactory implements IETypedElementSelectionWidgetFactory { + + public IETypedElementSelectionWidget createETypedElementSelectionWidget( + final int selectionMaxSize, final boolean allowEmpty, + final Composite parentComposite, + final ICustomizationManager customManager, + final Collection<? extends EObject> knownEPackage) { + final ETypedElementSelectionControlManager[] control = new ETypedElementSelectionControlManager[1]; + // must be synchronous, otherwise the shell is not created before SynchronizedETypedElementSelectionWidget, and SynchronizedComposite throws a NPE + Display.getDefault().syncExec(new Runnable() { + public void run() { + control[0] = new ETypedElementSelectionControlManager( + parentComposite, selectionMaxSize, allowEmpty, + knownEPackage); + control[0].createContents(); + } + }); + return new SynchronizedETypedElementSelectionWidget(control[0]); + } +}
diff --git a/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/modisco/facet/efacet/ui/internal/widget/FacetSetSelectionControl.java b/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/modisco/facet/efacet/ui/internal/widget/FacetSetSelectionControl.java new file mode 100644 index 0000000..e3944a5 --- /dev/null +++ b/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/modisco/facet/efacet/ui/internal/widget/FacetSetSelectionControl.java
@@ -0,0 +1,333 @@ +/******************************************************************************* + * Copyright (c) 2012 CEA LIST. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Nicolas Bros (Mia-Software) - Bug 372865 - FacetSet selection dialog + * Gregoire Dupe (Mia-Software) - Bug 372626 - Aggregates + * Nicolas Bros (Mia-Software) - Bug 372626 - Aggregates + *******************************************************************************/ +package org.eclipse.modisco.facet.efacet.ui.internal.widget; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.Collections; +import java.util.HashSet; +import java.util.Iterator; +import java.util.List; +import java.util.Set; + +import org.eclipse.core.runtime.IStatus; +import org.eclipse.core.runtime.Status; +import org.eclipse.emf.ecore.ENamedElement; +import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.ecore.EPackage; +import org.eclipse.jface.viewers.CheckStateChangedEvent; +import org.eclipse.jface.viewers.CheckboxTreeViewer; +import org.eclipse.jface.viewers.ICheckStateListener; +import org.eclipse.jface.viewers.ICheckStateProvider; +import org.eclipse.jface.viewers.IContentProvider; +import org.eclipse.jface.viewers.ILabelProvider; +import org.eclipse.jface.viewers.LabelProvider; +import org.eclipse.modisco.facet.efacet.core.internal.exported.IResolverManager; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.FacetSet; +import org.eclipse.modisco.facet.efacet.ui.internal.Activator; +import org.eclipse.modisco.facet.efacet.ui.internal.Messages; +import org.eclipse.modisco.facet.efacet.ui.internal.dialogs.FacetSetTreeContentProvider; +import org.eclipse.modisco.facet.efacet.ui.internal.exported.widget.IFacetSetSelectionWidget; +import org.eclipse.modisco.facet.util.emf.ui.internal.utils.ImageUtils; +import org.eclipse.osgi.util.NLS; +import org.eclipse.swt.SWT; +import org.eclipse.swt.graphics.Image; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Control; + +/** A control that displays a tree of FacetSets with checkboxes to select them. */ +public class FacetSetSelectionControl implements IFacetSetSelectionWidget { + + /** An OK status, but without the "OK" message, because we don't want "OK" to appear in the status bar */ + protected static final IStatus OK_STATUS = new Status(IStatus.OK, Activator.PLUGIN_ID, ""); //$NON-NLS-1$ + protected static final String INVALID_ELEMENTS = Messages.FacetSetSelectionControl_selectionContainsInvalidElements; + protected static final String ONLY_FACET_SETS = Messages.FacetSetSelectionControl_onlyFacetSetsAllowedInSelection; + + private final Composite cParent; + private CheckboxTreeViewer treeViewer; + private Collection<? extends FacetSet> available; + + private final int selectionMaxSize; + private final boolean allowEmpty; + private IStatus validationStatus; + private final Runnable onChange; + private final Set<FacetSet> selected = new HashSet<FacetSet>(); + + /** Create a checkbox tree to select FacetSets. */ + public FacetSetSelectionControl(final Composite parentComposite, final int selectionMaxSize, final boolean allowEmpty, final Runnable onChange) { + this.cParent = parentComposite; + this.selectionMaxSize = selectionMaxSize; + this.allowEmpty = allowEmpty; + this.onChange = onChange; + } + + public void createContents() { + final Composite composite = new Composite(this.cParent, SWT.NONE); + composite.setLayout(new GridLayout()); + composite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true)); + createCheckboxTreeViewer(composite); + updateValidationStatus(); + } + + protected void notifyChanged() { + if (this.onChange != null) { + this.onChange.run(); + } + } + + public void setAvailableFacetSets(final Collection<? extends FacetSet> newAvailable) { + this.available = newAvailable; + this.treeViewer.setInput(newAvailable.toArray()); + updateValidationStatus(); + notifyChanged(); + } + + public Collection<? extends FacetSet> getAvailableFacetSets() { + return Collections.unmodifiableCollection(this.available); + } + + public List<FacetSet> getSelectedFacetSets() { + return Collections.unmodifiableList(new ArrayList<FacetSet>(this.selected)); + } + + public void setSelectedFacetSets(final Collection<? extends FacetSet> facetSetsToSelect) { + if (facetSetsToSelect == null) { + throw new IllegalArgumentException(); + } + this.selected.clear(); + this.selected.addAll(facetSetsToSelect); + updateValidationStatus(); + notifyChanged(); + this.treeViewer.refresh(); + } + + public final void addCheckStateListener(final ICheckStateListener listener) { + this.treeViewer.addCheckStateListener(listener); + } + + protected void createCheckboxTreeViewer(final Composite parentComposite) { + this.treeViewer = new CheckboxTreeViewer(parentComposite, SWT.BORDER); + this.treeViewer.setContentProvider(createContentProvider()); + this.treeViewer.setLabelProvider(createLabelProvider()); + this.treeViewer.getTree().setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true)); + + getTreeViewer().setCheckStateProvider(createCheckStateProvider()); + addCheckStateListener(new ICheckStateListener() { + public void checkStateChanged(final CheckStateChangedEvent event) { + FacetSetSelectionControl.this.checkStateChanged(event); + } + }); + getTreeViewer().refresh(); + } + + protected void checkStateChanged(final CheckStateChangedEvent event) { + handleCheckStateChange(event); + getTreeViewer().refresh(); + updateValidationStatus(); + notifyChanged(); + } + + protected void handleCheckStateChange(final CheckStateChangedEvent event) { + final Object element = event.getElement(); + if (event.getElement() instanceof FacetSet) { + final FacetSet facetSet = (FacetSet) event.getElement(); + FacetSet propagation = IResolverManager.DEFAULT + .selectionRoot(element, FacetSet.class); + if (propagation == null) { + propagation = facetSet; + } + if (event.getChecked()) { + this.selected.add(propagation); + } else { + this.selected.remove(propagation); + } + } + this.treeViewer.refresh(); + } + + protected boolean isUnderCheckedSuperPackage(final Object element) { + boolean result = false; + if (element instanceof FacetSet) { + final FacetSet facetSet = (FacetSet) element; + EObject eSuperPackage = facetSet.eContainer(); + while (eSuperPackage != null) { + if (this.selected.contains(eSuperPackage)) { + result = true; + break; + } + eSuperPackage = eSuperPackage.eContainer(); + } + } + return result; + } + + protected ICheckStateProvider createCheckStateProvider() { + return new ICheckStateProvider() { + public boolean isGrayed(final Object element) { + return FacetSetSelectionControl.this.isGrayed(element); + } + + public boolean isChecked(final Object element) { + return FacetSetSelectionControl.this.isChecked(element); + } + }; + } + + protected boolean isGrayed(final Object element) { + final List<FacetSet> propagation = IResolverManager.DEFAULT + .selectionPropagation(element, FacetSet.class); + boolean contains = false; + if (element instanceof EObject) { + final EObject eObject = (EObject) element; + contains = containsSelectedElement(eObject); + } + return (contains || isUnderCheckedSuperPackage(element) || propagation + .contains(element)) && !this.selected.contains(element); + } + + protected boolean containsSelectedElement(final EObject eObject) { + boolean contains = false; + final Iterator<EObject> iterator = eObject.eAllContents(); + while (iterator.hasNext()) { + final EObject subObject = iterator.next(); + contains = this.selected.contains(subObject); + if (contains) { + break; + } + } + return contains; + } + + protected boolean isChecked(final Object element) { + // This "|| isGrayed(element)" has been added avoid problems with + // Windows 7. + return this.selected.contains(element) || isGrayed(element); + } + + protected void updateValidationStatus() { + if (this.treeViewer == null) { + return; + } + final Object[] checkedElements = this.treeViewer.getCheckedElements(); + IStatus newStatus = FacetSetSelectionControl.OK_STATUS; + if (!this.allowEmpty && checkedElements.length == 0) { + newStatus = new Status(IStatus.ERROR, Activator.PLUGIN_ID, NLS.bind(Messages.FacetSetSelectionControl_mustSelectAtLeastOneElement, + Integer.valueOf(this.selectionMaxSize))); + } else if (checkedElements.length > this.selectionMaxSize) { + newStatus = new Status(IStatus.ERROR, Activator.PLUGIN_ID, NLS.bind(Messages.FacetSetSelectionControl_mustSelectAtMostNElements, + Integer.valueOf(this.selectionMaxSize))); + } else { + for (final Object checkedElement : checkedElements) { + final IStatus elementStatus = validateElement(checkedElement); + if (elementStatus.getSeverity() >= IStatus.ERROR) { + newStatus = elementStatus; + break; + } + } + } + setValidationStatus(newStatus); + } + + protected static IStatus validateElement(final Object checkedElement) { + IStatus status = FacetSetSelectionControl.OK_STATUS; + if (!(checkedElement instanceof FacetSet)) { + status = new Status(IStatus.ERROR, Activator.PLUGIN_ID, FacetSetSelectionControl.ONLY_FACET_SETS); + } + return status; + } + + protected boolean isAvailable(final FacetSet facetSet) { + boolean bAvailable = false; + if (this.available.contains(facetSet)) { + bAvailable = true; + } else { + EPackage parent = facetSet.getESuperPackage(); + while (parent != null) { + if (this.available.contains(parent)) { + bAvailable = true; + break; + } + parent = parent.getESuperPackage(); + } + } + return bAvailable; + } + + protected void setValidationStatus(final IStatus status) { + this.validationStatus = status; + } + + public IStatus getValidationStatus() { + return this.validationStatus; + } + + public boolean isErrorStatus() { + return this.validationStatus == null || this.validationStatus.getSeverity() >= IStatus.ERROR; + } + + protected ILabelProvider createLabelProvider() { + return new LabelProvider() { + @Override + public String getText(final Object element) { + String text; + if (element instanceof ENamedElement) { + final ENamedElement namedElement = (ENamedElement) element; + text = namedElement.getName(); + } else { + text = super.getText(element); + } + return text; + } + + @Override + public Image getImage(final Object element) { + return ImageUtils.getImage(element); + } + }; + } + + // @SuppressWarnings("static-method") : meant to be overridden + @SuppressWarnings("static-method") + protected IContentProvider createContentProvider() { + return new FacetSetTreeContentProvider(false, true, true); + } + + public CheckboxTreeViewer getTreeViewer() { + return this.treeViewer; + } + + public boolean isDisposed() { + return this.treeViewer.getTree().isDisposed(); + } + + public void selectAll() { + this.selected.clear(); + this.selected.addAll(this.available); + this.treeViewer.refresh(); + } + + public void deselectAll() { + this.selected.clear(); + this.treeViewer.refresh(); + } + + public Control getControl() { + Control control = null; + if (this.treeViewer != null) { + control = this.treeViewer.getTree(); + } + return control; + } +}
diff --git a/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/modisco/facet/efacet/ui/internal/widget/FacetSetSelectionWidgetFactory.java b/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/modisco/facet/efacet/ui/internal/widget/FacetSetSelectionWidgetFactory.java new file mode 100644 index 0000000..04707cd --- /dev/null +++ b/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/modisco/facet/efacet/ui/internal/widget/FacetSetSelectionWidgetFactory.java
@@ -0,0 +1,33 @@ +/******************************************************************************* + * Copyright (c) 2012 CEA LIST. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Nicolas Bros (Mia-Software) - Bug 372865 - FacetSet selection dialog + *******************************************************************************/ +package org.eclipse.modisco.facet.efacet.ui.internal.widget; + +import org.eclipse.modisco.facet.efacet.ui.internal.exported.widget.IFacetSetSelectionWidget; +import org.eclipse.modisco.facet.efacet.ui.internal.exported.widget.IFacetSetSelectionWidgetFactory; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Display; + +public class FacetSetSelectionWidgetFactory implements IFacetSetSelectionWidgetFactory { + + public IFacetSetSelectionWidget createFacetSetSelectionWidget(final int selectionMaxSize, final boolean allowEmpty, + final Composite parentComposite, final Runnable onChange) { + final FacetSetSelectionControl[] control = new FacetSetSelectionControl[1]; + // must be synchronous, otherwise the shell is not created before SynchronizedFacetSetSelectionWidget, and + // SynchronizedComposite throws a NPE + Display.getDefault().syncExec(new Runnable() { + public void run() { + control[0] = new FacetSetSelectionControl(parentComposite, selectionMaxSize, allowEmpty, onChange); + control[0].createContents(); + } + }); + return new SynchronizedFacetSetSelectionWidget(control[0]); + } +}
diff --git a/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/modisco/facet/efacet/ui/internal/widget/IETypedElementSelectionControlManager.java b/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/modisco/facet/efacet/ui/internal/widget/IETypedElementSelectionControlManager.java new file mode 100644 index 0000000..cf3d1f1 --- /dev/null +++ b/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/modisco/facet/efacet/ui/internal/widget/IETypedElementSelectionControlManager.java
@@ -0,0 +1,51 @@ +/******************************************************************************* + * Copyright (c) 2012 CEA-LIST. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Vincent Lorenzo (CEA-LIST) - Bug 372644 - Create Customizable tooltips for the TreeViewer using a CustomizableLabelProvider + * Gregoire Dupe (Mia-Software) - Bug 372644 - Create Customizable tooltips for the TreeViewer using a CustomizableLabelProvider + *******************************************************************************/ +package org.eclipse.modisco.facet.efacet.ui.internal.widget; + +import java.util.Collection; +import java.util.List; + +import org.eclipse.core.runtime.IStatus; +import org.eclipse.emf.ecore.ETypedElement; +import org.eclipse.jface.viewers.IStructuredSelection; + +public interface IETypedElementSelectionControlManager extends + IETypedElementSelectionWidgetInternal { + + /** + * @return the validation status + */ + IStatus getValidationStatus(); + + /** + * Set the available elements + * + * @param eTypedElements + * available eTypedElements + */ + void setAvailableETypedElements( + Collection<? extends ETypedElement> eTypedElements); + + /** + * + * @param selection + * the selection + */ + void setSelection(final IStructuredSelection selection); + + /** + * + * @return the selection + */ + List<ETypedElement> computeResult(); + +}
diff --git a/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/modisco/facet/efacet/ui/internal/widget/IETypedElementSelectionWidgetInternal.java b/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/modisco/facet/efacet/ui/internal/widget/IETypedElementSelectionWidgetInternal.java new file mode 100644 index 0000000..2fee516 --- /dev/null +++ b/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/modisco/facet/efacet/ui/internal/widget/IETypedElementSelectionWidgetInternal.java
@@ -0,0 +1,41 @@ +/******************************************************************************* + * Copyright (c) 2012 Mia-Software. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Nicolas Bros (Mia-Software) - Bug 370806 - [table] rewrite the "allowed contents" query selection dialog for v0.2 + * Vincent Lorenzo (CEA-LIST) - Bug 372644 - Create Customizable tooltips for the TreeViewer using a CustomizableLabelProvider + *******************************************************************************/ +package org.eclipse.modisco.facet.efacet.ui.internal.widget; + +import org.eclipse.core.runtime.IStatus; +import org.eclipse.jface.viewers.IOpenListener; +import org.eclipse.jface.viewers.ISelectionChangedListener; +import org.eclipse.jface.viewers.IStructuredSelection; +import org.eclipse.modisco.facet.efacet.ui.internal.exported.widget.IETypedElementSelectionWidget; +import org.eclipse.ui.dialogs.FilteredTree; + +public interface IETypedElementSelectionWidgetInternal extends IETypedElementSelectionWidget { + + /** Adds a listener that is notified when an element is double-clicked or the Enter key is pressed */ + void addOpenListener(IOpenListener openListener); + + /** Adds a listener that is notified when the selection changes */ + void addSelectionChangedListener(ISelectionChangedListener listener); + + /** @return the validation status : the selection is not valid if {@link IStatus#getSeverity()} >= {@link IStatus#ERROR} */ + IStatus getValidationStatus(); + + /** @return whether the widget is disposed */ + boolean isDisposed(); + + FilteredTree getFilteredTree(); + + void createContents(); + + void setSelection(IStructuredSelection selection); + +} \ No newline at end of file
diff --git a/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/modisco/facet/efacet/ui/internal/widget/IETypedElementTabSelectionWidgetInternal.java b/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/modisco/facet/efacet/ui/internal/widget/IETypedElementTabSelectionWidgetInternal.java new file mode 100644 index 0000000..cdf2870 --- /dev/null +++ b/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/modisco/facet/efacet/ui/internal/widget/IETypedElementTabSelectionWidgetInternal.java
@@ -0,0 +1,47 @@ +/******************************************************************************* + * Copyright (c) 2012 CEA-LIST. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Vincent Lorenzo (CEA-LIST) - Bug 372644 - Create Customizable tooltips for the TreeViewer using a CustomizableLabelProvider + *******************************************************************************/ +package org.eclipse.modisco.facet.efacet.ui.internal.widget; + +import org.eclipse.swt.graphics.Image; + +/** + * + * Each tab in ETypedElementSectionDialog should implements this interface + * + */ +public interface IETypedElementTabSelectionWidgetInternal extends + IETypedElementSelectionWidgetInternal { + + /** + * + * @return the title for the tab + */ + String getTitle(); + + /** + * + * @return the tooltip for the tab + */ + String getToolTipText(); + + /** + * + * @return the image for the tab + */ + Image getImage(); + + /** + * + * @return the id for the tab + */ + String getTabId(); + +} \ No newline at end of file
diff --git a/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/modisco/facet/efacet/ui/internal/widget/MetamodelSelectionControl.java b/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/modisco/facet/efacet/ui/internal/widget/MetamodelSelectionControl.java new file mode 100644 index 0000000..cd60c52 --- /dev/null +++ b/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/modisco/facet/efacet/ui/internal/widget/MetamodelSelectionControl.java
@@ -0,0 +1,37 @@ +/******************************************************************************* + * Copyright (c) 2009, 2011 Mia-Software. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Nicolas Bros (Mia-Software) - initial API and implementation + * Nicolas Guyomar (Mia-Software) - Bug 349546 - EMF Facet facetSet editor + *******************************************************************************/ +package org.eclipse.modisco.facet.efacet.ui.internal.widget; + +import java.util.Map; +import java.util.Set; +import java.util.TreeSet; + +import org.eclipse.emf.ecore.EPackage; +import org.eclipse.modisco.facet.efacet.ui.internal.composites.FilteredElementSelectionComposite; +import org.eclipse.swt.widgets.Composite; + +/** + * A control to select a metamodel from a list of metamodels, that can be filtered using the + * associated text field. + */ +public class MetamodelSelectionControl extends FilteredElementSelectionComposite { + + public MetamodelSelectionControl(final Composite parent) { + super(parent, true, false); + + final Set<String> uris = new TreeSet<String>(); + for (final Object name : ((Map<?, ?>) EPackage.Registry.INSTANCE).keySet()) { + uris.add((name).toString()); + } + setElements(uris.toArray()); + } +}
diff --git a/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/modisco/facet/efacet/ui/internal/widget/SynchronizedETypedElementSelectionWidget.java b/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/modisco/facet/efacet/ui/internal/widget/SynchronizedETypedElementSelectionWidget.java new file mode 100644 index 0000000..b752025 --- /dev/null +++ b/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/modisco/facet/efacet/ui/internal/widget/SynchronizedETypedElementSelectionWidget.java
@@ -0,0 +1,123 @@ +/******************************************************************************* + * Copyright (c) 2012 Mia-Software. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Nicolas Bros (Mia-Software) - Bug 370806 - [table] rewrite the "allowed contents" query selection dialog for v0.2 + * Vincent Lorenzo (CEA-LIST) - Bug 372644 - Create Customizable tooltips for the TreeViewer using a CustomizableLabelProvider + *******************************************************************************/ +package org.eclipse.modisco.facet.efacet.ui.internal.widget; + +import java.util.Collection; +import java.util.List; + +import org.eclipse.core.runtime.IStatus; +import org.eclipse.emf.ecore.ETypedElement; +import org.eclipse.jface.viewers.IOpenListener; +import org.eclipse.jface.viewers.ISelectionChangedListener; +import org.eclipse.jface.viewers.IStructuredSelection; +import org.eclipse.modisco.facet.util.ui.internal.exported.displaysync.AbstractExceptionFreeRunnable; +import org.eclipse.modisco.facet.util.ui.internal.exported.displaysync.AbstractVoidExceptionFreeRunnable; +import org.eclipse.modisco.facet.util.ui.internal.exported.displaysync.SynchronizedObject; +import org.eclipse.ui.dialogs.FilteredTree; + +public class SynchronizedETypedElementSelectionWidget extends SynchronizedObject<ETypedElementSelectionControlManager> implements + IETypedElementSelectionWidgetInternal { + + private final ETypedElementSelectionControlManager control; + + protected IETypedElementSelectionWidgetInternal getControl() { + return this.control; + } + + public SynchronizedETypedElementSelectionWidget(final ETypedElementSelectionControlManager control) { + super(control, control.getFilteredTree().getDisplay()); + this.control = control; + } + + public void setAvailableETypedElements(final Collection<? extends ETypedElement> available) { + voidExceptionFreeRunnable(new AbstractVoidExceptionFreeRunnable() { + @Override + public void voidSafeRun() { + getControl().setAvailableETypedElements(available); + } + }); + } + + public List<ETypedElement> getSelectedETypedElements() { + return safeSyncExec(new AbstractExceptionFreeRunnable<List<ETypedElement>>() { + @Override + public List<ETypedElement> safeRun() { + return getControl().getSelectedETypedElements(); + } + }); + } + + public void setSelectedETypedElements(final Collection<? extends ETypedElement> elementsToSelect) { + voidExceptionFreeRunnable(new AbstractVoidExceptionFreeRunnable() { + @Override + public void voidSafeRun() { + getControl().setSelectedETypedElements(elementsToSelect); + } + }); + } + + public void addOpenListener(final IOpenListener openListener) { + voidExceptionFreeRunnable(new AbstractVoidExceptionFreeRunnable() { + @Override + public void voidSafeRun() { + getControl().addOpenListener(openListener); + } + }); + } + + public void addSelectionChangedListener(final ISelectionChangedListener listener) { + voidExceptionFreeRunnable(new AbstractVoidExceptionFreeRunnable() { + @Override + public void voidSafeRun() { + getControl().addSelectionChangedListener(listener); + } + }); + } + + public IStatus getValidationStatus() { + return safeSyncExec(new AbstractExceptionFreeRunnable<IStatus>() { + @Override + public IStatus safeRun() { + return getControl().getValidationStatus(); + } + }); + } + + public boolean isDisposed() { + return safeSyncExec(new AbstractExceptionFreeRunnable<Boolean>() { + @Override + public Boolean safeRun() { + return Boolean.valueOf(getControl().isDisposed()); + } + }).booleanValue(); + } + + public FilteredTree getFilteredTree() { + // should not be used! + throw new UnsupportedOperationException(); + } + + public void createContents() { + // //nothing to do + throw new UnsupportedOperationException(); + } + + public void setSelection(final IStructuredSelection selection) { + voidExceptionFreeRunnable(new AbstractVoidExceptionFreeRunnable() { + @Override + public void voidSafeRun() { + getControl().setSelection(selection); + } + }); + } + +}
diff --git a/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/modisco/facet/efacet/ui/internal/widget/SynchronizedFacetSetSelectionWidget.java b/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/modisco/facet/efacet/ui/internal/widget/SynchronizedFacetSetSelectionWidget.java new file mode 100644 index 0000000..da2617d --- /dev/null +++ b/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/modisco/facet/efacet/ui/internal/widget/SynchronizedFacetSetSelectionWidget.java
@@ -0,0 +1,90 @@ +/******************************************************************************* + * Copyright (c) 2012 CEA LIST. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Nicolas Bros (Mia-Software) - Bug 372865 - FacetSet selection dialog + *******************************************************************************/ +package org.eclipse.modisco.facet.efacet.ui.internal.widget; + +import java.util.Collection; +import java.util.List; + +import org.eclipse.core.runtime.IStatus; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.FacetSet; +import org.eclipse.modisco.facet.efacet.ui.internal.exported.widget.IFacetSetSelectionWidget; +import org.eclipse.modisco.facet.util.ui.internal.exported.displaysync.AbstractExceptionFreeRunnable; +import org.eclipse.modisco.facet.util.ui.internal.exported.displaysync.AbstractVoidExceptionFreeRunnable; +import org.eclipse.modisco.facet.util.ui.internal.exported.displaysync.SynchronizedObject; +import org.eclipse.swt.widgets.Control; + +public class SynchronizedFacetSetSelectionWidget extends SynchronizedObject<FacetSetSelectionControl> implements IFacetSetSelectionWidget { + + private final FacetSetSelectionControl control; + + protected FacetSetSelectionControl getDelegate() { + return this.control; + } + + public SynchronizedFacetSetSelectionWidget(final FacetSetSelectionControl control) { + super(control, control.getTreeViewer().getTree().getDisplay()); + this.control = control; + } + + public void setAvailableFacetSets(final Collection<? extends FacetSet> available) { + voidExceptionFreeRunnable(new AbstractVoidExceptionFreeRunnable() { + @Override + public void voidSafeRun() { + getDelegate().setAvailableFacetSets(available); + } + }); + } + + public List<FacetSet> getSelectedFacetSets() { + return safeSyncExec(new AbstractExceptionFreeRunnable<List<FacetSet>>() { + @Override + public List<FacetSet> safeRun() { + return getDelegate().getSelectedFacetSets(); + } + }); + } + + public void setSelectedFacetSets(final Collection<? extends FacetSet> facetSetsToSelect) { + voidExceptionFreeRunnable(new AbstractVoidExceptionFreeRunnable() { + @Override + public void voidSafeRun() { + getDelegate().setSelectedFacetSets(facetSetsToSelect); + } + }); + } + + public IStatus getValidationStatus() { + return safeSyncExec(new AbstractExceptionFreeRunnable<IStatus>() { + @Override + public IStatus safeRun() { + return getDelegate().getValidationStatus(); + } + }); + } + + public boolean isDisposed() { + return safeSyncExec(new AbstractExceptionFreeRunnable<Boolean>() { + @Override + public Boolean safeRun() { + return Boolean.valueOf(getDelegate().isDisposed()); + } + }).booleanValue(); + } + + public Control getControl() { + return safeSyncExec(new AbstractExceptionFreeRunnable<Control>() { + @Override + public Control safeRun() { + return getDelegate().getControl(); + } + }); + } +}
diff --git a/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/modisco/facet/efacet/ui/internal/widget/UriWidget.java b/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/modisco/facet/efacet/ui/internal/widget/UriWidget.java new file mode 100644 index 0000000..1596668 --- /dev/null +++ b/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/modisco/facet/efacet/ui/internal/widget/UriWidget.java
@@ -0,0 +1,63 @@ +/******************************************************************************* + * Copyright (c) 2015 Soft-Maint. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Jonathan Pepin (Soft-Maint) - Bug 463907 - Command for load and save Facet serialization + *******************************************************************************/ +package org.eclipse.modisco.facet.efacet.ui.internal.widget; + +import org.eclipse.emf.common.util.URI; +import org.eclipse.jface.layout.GridDataFactory; +import org.eclipse.modisco.facet.efacet.ui.internal.Activator; +import org.eclipse.modisco.facet.efacet.ui.internal.Messages; +import org.eclipse.modisco.facet.efacet.ui.internal.exported.widget.IUriWidget; +import org.eclipse.modisco.facet.util.core.Logger; +import org.eclipse.modisco.facet.util.ui.internal.exported.dialog.IOkDialogFactory; +import org.eclipse.modisco.facet.util.ui.utils.UIUtils; +import org.eclipse.osgi.util.NLS; +import org.eclipse.swt.SWT; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Label; +import org.eclipse.swt.widgets.Shell; +import org.eclipse.swt.widgets.Text; + +public class UriWidget extends Composite implements IUriWidget { + + private final Text textWidget; + + public UriWidget(final Composite parent) { + super(parent, SWT.NONE); + final Label labelWidget = UIUtils.createLabel(parent, + Messages.UriWidget_EmfUri); + labelWidget.setLayoutData(GridDataFactory.swtDefaults() + .grab(true, false).create()); + this.textWidget = UIUtils.createTextField(parent, + "", true, null); //$NON-NLS-1$ + } + + public URI getURI() { + URI result = null; + final String text = this.textWidget.getText(); + try { + result = URI.createURI(text); + } catch (IllegalArgumentException e) { + final String message = NLS.bind("The URI '{0}' in malformed.", text); //$NON-NLS-1$ + IOkDialogFactory.DEFAULT.openErrorDialog(new Shell(), e, message); + Logger.logError(e, Activator.getDefault()); + } + return result; + } + + public void setURI(final URI uri) { + String uriStr = "platform:/resource/<your_project>/<your_file>.xmi"; //$NON-NLS-1$ + if (uri != null) { + uriStr = uri.toString(); + } + this.textWidget.setText(uriStr); + } + +}
diff --git a/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/modisco/facet/efacet/ui/internal/widget/UriWidgetFactory.java b/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/modisco/facet/efacet/ui/internal/widget/UriWidgetFactory.java new file mode 100644 index 0000000..ddc1eb5 --- /dev/null +++ b/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/modisco/facet/efacet/ui/internal/widget/UriWidgetFactory.java
@@ -0,0 +1,22 @@ +/******************************************************************************* + * Copyright (c) 2015 Soft-Maint. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Jonathan Pepin (Soft-Maint) - Bug 463907 - Command for load and save Facet serialization + *******************************************************************************/ +package org.eclipse.modisco.facet.efacet.ui.internal.widget; + +import org.eclipse.modisco.facet.efacet.ui.internal.exported.widget.IUriWidget; +import org.eclipse.modisco.facet.efacet.ui.internal.exported.widget.IUriWidgetFactory; +import org.eclipse.swt.widgets.Composite; + +public class UriWidgetFactory implements IUriWidgetFactory { + + public IUriWidget createUriWidget(final Composite parent) { + return new UriWidget(parent); + } +}
diff --git a/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/modisco/facet/efacet/ui/internal/wizards/SelectETypeWizardImpl.java b/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/modisco/facet/efacet/ui/internal/wizards/SelectETypeWizardImpl.java new file mode 100644 index 0000000..188d1ad --- /dev/null +++ b/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/modisco/facet/efacet/ui/internal/wizards/SelectETypeWizardImpl.java
@@ -0,0 +1,82 @@ +/** + * Copyright (c) 2011 Mia-Software. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Nicolas Guyomar (Mia-Software) - Bug 349546 - EMF Facet facetSet editor + */ +package org.eclipse.modisco.facet.efacet.ui.internal.wizards; + +import org.eclipse.emf.ecore.EClassifier; +import org.eclipse.emf.ecore.EPackage; +import org.eclipse.emf.edit.domain.EditingDomain; +import org.eclipse.jface.window.Window; +import org.eclipse.jface.wizard.Wizard; +import org.eclipse.jface.wizard.WizardDialog; +import org.eclipse.modisco.facet.efacet.ui.internal.Messages; +import org.eclipse.modisco.facet.efacet.ui.internal.composites.SelectETypeComposite.ETypeSelectionOptions; +import org.eclipse.modisco.facet.efacet.ui.internal.exported.wizard.ISelectETypeWizard; +import org.eclipse.modisco.facet.efacet.ui.internal.wizards.pages.SelectEClassifierWizardPage; +import org.eclipse.modisco.facet.efacet.ui.internal.wizards.pages.SelectEPackageWizardPage; +import org.eclipse.ui.PlatformUI; + +public class SelectETypeWizardImpl extends Wizard implements ISelectETypeWizard { + + private final WizardDialog dialog; + + private final SelectEPackageWizardPage selectEPackagePage; + private final SelectEClassifierWizardPage selectETypePage; + + private final EditingDomain editingDomain; + + private EClassifier selectedEType; + + private boolean canChangeEPackage = true; + + public SelectETypeWizardImpl(final EditingDomain editingDomain, final ETypeSelectionOptions eTypeSelectionOption, + final boolean canChangeEPackage, final EPackage ePackage) { + super(); + this.editingDomain = editingDomain; + this.canChangeEPackage = canChangeEPackage; + this.dialog = new WizardDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), this); + this.selectEPackagePage = new SelectEPackageWizardPage(this.editingDomain); + this.selectETypePage = new SelectEClassifierWizardPage(eTypeSelectionOption, ePackage); + if (eTypeSelectionOption == ETypeSelectionOptions.ECLASS) { + setWindowTitle(Messages.Select_EClass); + } else if (eTypeSelectionOption == ETypeSelectionOptions.EDATATYPE) { + setWindowTitle(Messages.Select_EDataType); + } else { + setWindowTitle(Messages.Select_EClassifier); + } + } + + @Override + public void addPages() { + if (this.canChangeEPackage) { + addPage(this.selectEPackagePage); + } + addPage(this.selectETypePage); + } + + public int open() { + if (this.dialog != null) { + return this.dialog.open(); + } + return Window.CANCEL; + } + + @Override + public boolean performFinish() { + this.selectedEType = this.selectETypePage.getSelectedEclassifier(); + return true; + } + + public EClassifier getSelectedEType() { + return this.selectedEType; + } + +}
diff --git a/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/modisco/facet/efacet/ui/internal/wizards/pages/FacetSetPropertyWizardPage.java b/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/modisco/facet/efacet/ui/internal/wizards/pages/FacetSetPropertyWizardPage.java new file mode 100644 index 0000000..c63065e --- /dev/null +++ b/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/modisco/facet/efacet/ui/internal/wizards/pages/FacetSetPropertyWizardPage.java
@@ -0,0 +1,106 @@ +/** + * Copyright (c) 2011 Mia-Software. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Nicolas Guyomar (Mia-Software) - Bug 349546 - EMF Facet facetSet editor + */ +package org.eclipse.modisco.facet.efacet.ui.internal.wizards.pages; + +import org.eclipse.emf.edit.domain.EditingDomain; +import org.eclipse.modisco.facet.efacet.ui.internal.Messages; +import org.eclipse.swt.SWT; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Event; +import org.eclipse.swt.widgets.Label; +import org.eclipse.swt.widgets.Listener; +import org.eclipse.swt.widgets.Text; + +/** + * Wizard page to enter a NsURI, a prefix and an extended EPackage to a facetSet + */ +public class FacetSetPropertyWizardPage extends SelectEPackageWizardPage { + + private Text nsUriTextField; + private Text prefixTextField; + + public FacetSetPropertyWizardPage(final EditingDomain editingDomain) { + super(editingDomain); + } + + @Override + public void createControl(final Composite parent) { + + // Extends the SelectEPackageWizardPage to add a NsURI and a Prefix textField + Composite container = new Composite(parent, SWT.NONE); + container.setLayout(new GridLayout(1, false)); + container.setLayoutData(new GridData(GridData.FILL_HORIZONTAL, GridData.FILL_VERTICAL, true, true)); + + Composite nsURiContainer = new Composite(container, SWT.NONE); + nsURiContainer.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); + nsURiContainer.setLayout(new GridLayout(2, false)); + + // NsURI + Label nsUriLabel = new Label(nsURiContainer, SWT.NONE); + nsUriLabel.setText(Messages.Enter_a_nsUri); + this.nsUriTextField = new Text(nsURiContainer, SWT.BORDER | SWT.SINGLE); + this.nsUriTextField.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); + this.nsUriTextField.addListener(SWT.Modify, new Listener() { + public void handleEvent(final Event event) { + updateButtons(); + } + }); + + // PREFIX + Label prefixLabel = new Label(nsURiContainer, SWT.NONE); + prefixLabel.setText(Messages.Enter_a_prefix); + this.prefixTextField = new Text(nsURiContainer, SWT.BORDER | SWT.SINGLE); + this.prefixTextField.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); + this.prefixTextField.addListener(SWT.Modify, new Listener() { + public void handleEvent(final Event event) { + updateButtons(); + } + }); + + super.createControl(container); + } + + @Override + public boolean isPageComplete() { + if (this.nsUriTextField.getText().length() == 0) { + setErrorMessage(Messages.Please_enter_nsUri); + return false; + } + + if (this.prefixTextField.getText().length() == 0) { + setErrorMessage(Messages.Please_enter_prefix); + return false; + } + if (super.isPageComplete()) { + setErrorMessage(null); + return true; + } + setErrorMessage(Messages.Please_select_EPackage); + + return false; + } + + public String getNsUri() { + return this.nsUriTextField.getText(); + } + + public String getPrefix() { + return this.prefixTextField.getText(); + } + + protected void updateButtons() { + getContainer().updateButtons(); + } + +}
diff --git a/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/modisco/facet/efacet/ui/internal/wizards/pages/SelectEClassifierWizardPage.java b/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/modisco/facet/efacet/ui/internal/wizards/pages/SelectEClassifierWizardPage.java new file mode 100644 index 0000000..1f9c45b --- /dev/null +++ b/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/modisco/facet/efacet/ui/internal/wizards/pages/SelectEClassifierWizardPage.java
@@ -0,0 +1,114 @@ +/******************************************************************************* + * Copyright (c) 2009, 2011 Mia-Software. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Nicolas Bros (Mia-Software) - initial API and implementation + *******************************************************************************/ +package org.eclipse.modisco.facet.efacet.ui.internal.wizards.pages; + +import org.eclipse.emf.ecore.EClassifier; +import org.eclipse.emf.ecore.EPackage; +import org.eclipse.jface.wizard.WizardPage; +import org.eclipse.modisco.facet.efacet.ui.internal.Messages; +import org.eclipse.modisco.facet.efacet.ui.internal.composites.SelectETypeComposite.ETypeSelectionOptions; +import org.eclipse.modisco.facet.efacet.ui.internal.widget.EClassifierSelectionControl; +import org.eclipse.swt.events.ModifyEvent; +import org.eclipse.swt.events.ModifyListener; +import org.eclipse.swt.events.SelectionEvent; +import org.eclipse.swt.events.SelectionListener; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.ui.dialogs.FilteredList; + +public class SelectEClassifierWizardPage extends WizardPage { + + private EClassifierSelectionControl eClassSelectionControl; + private final ETypeSelectionOptions eTypeSelectionOption; + private String metamodelNsUri; + + public SelectEClassifierWizardPage(final ETypeSelectionOptions eTypeSelectionOption, final EPackage ePackage) { + super("Whatever"); //$NON-NLS-1$ + if (eTypeSelectionOption == ETypeSelectionOptions.ECLASS) { + setTitle(Messages.Select_EClass); + } else if (eTypeSelectionOption == ETypeSelectionOptions.EDATATYPE) { + setTitle(Messages.Select_EDataType); + } else { + setTitle(Messages.Select_EClassifier); + } + if (ePackage != null) { + this.metamodelNsUri = ePackage.getNsURI(); + } + this.eTypeSelectionOption = eTypeSelectionOption; + } + + @Override + public boolean isPageComplete() { + return this.eClassSelectionControl.getSelectedEClassifier() != null; + } + + @Override + public void setVisible(final boolean visible) { + super.setVisible(visible); + if (getPreviousPage() instanceof SelectEPackageWizardPage) { + SelectEPackageWizardPage selectEPackageWizardPage = (SelectEPackageWizardPage) getPreviousPage(); + this.metamodelNsUri = selectEPackageWizardPage.getFirstSelectedEPackage().getNsURI(); + if (this.metamodelNsUri != null) { + setDescription(selectEPackageWizardPage.getFirstSelectedEPackage().getNsURI()); + } + } + this.eClassSelectionControl.updateList(this.metamodelNsUri); + } + + public void createControl(final Composite parent) { + this.eClassSelectionControl = new EClassifierSelectionControl(parent, this.metamodelNsUri, this.eTypeSelectionOption); + final FilteredList filteredList = this.eClassSelectionControl.getFilteredList(); + + filteredList.addSelectionListener(new SelectionListener() { + public void widgetSelected(final SelectionEvent e) { + if (e.item != null) { + updateButton(); + // setPageComplete(filteredList.getSelection().length == 1); + } + } + + public void widgetDefaultSelected(final SelectionEvent e) { + if (getWizard().canFinish()) { + getWizard().performFinish(); + } + if (getNextPage() != null) { + goToNextPage(); + } + } + }); + + this.eClassSelectionControl.getFilterText().addModifyListener(new ModifyListener() { + + public void modifyText(final ModifyEvent e) { + updateButton(); + } + }); + + // avoid the page being "complete" when still on a previous page + filteredList.setSelection(new int[0]); + setPageComplete(false); + + setControl(this.eClassSelectionControl); + } + + protected void goToNextPage() { + getContainer().showPage(getNextPage()); + } + + protected void updateButton() { + if (getContainer() != null && getContainer().getCurrentPage() != null) { + getContainer().updateButtons(); + } + } + + public EClassifier getSelectedEclassifier() { + return this.eClassSelectionControl.getSelectedEClassifier(); + } +} \ No newline at end of file
diff --git a/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/modisco/facet/efacet/ui/internal/wizards/pages/SelectEPackageWizardPage.java b/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/modisco/facet/efacet/ui/internal/wizards/pages/SelectEPackageWizardPage.java new file mode 100644 index 0000000..23daecf --- /dev/null +++ b/org.eclipse.modisco.facet.efacet.ui/src/org/eclipse/modisco/facet/efacet/ui/internal/wizards/pages/SelectEPackageWizardPage.java
@@ -0,0 +1,114 @@ +/******************************************************************************* + * Copyright (c) 2009, 2011 Mia-Software. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Nicolas Bros (Mia-Software) - initial API and implementation + *******************************************************************************/ +package org.eclipse.modisco.facet.efacet.ui.internal.wizards.pages; + +import org.eclipse.emf.common.util.URI; +import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.ecore.EPackage; +import org.eclipse.emf.ecore.EPackage.Registry; +import org.eclipse.emf.ecore.resource.Resource; +import org.eclipse.emf.ecore.resource.ResourceSet; +import org.eclipse.emf.edit.domain.EditingDomain; +import org.eclipse.jface.wizard.WizardPage; +import org.eclipse.modisco.facet.efacet.ui.internal.Messages; +import org.eclipse.modisco.facet.efacet.ui.internal.widget.MetamodelSelectionControl; +import org.eclipse.swt.events.SelectionEvent; +import org.eclipse.swt.events.SelectionListener; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.ui.dialogs.FilteredList; + +public class SelectEPackageWizardPage extends WizardPage { + + private MetamodelSelectionControl metamodelSelectionControl; + private final EditingDomain editingDomain; + + public SelectEPackageWizardPage(final EditingDomain editingDomain) { + super("Whatever"); //$NON-NLS-1$ + setTitle(Messages.Select_EPackage); + this.editingDomain = editingDomain; + } + + @Override + public void setVisible(final boolean visible) { + super.setVisible(visible); + if (visible) { + this.metamodelSelectionControl.getFilterText().setFocus(); + setPageComplete(true); + } + } + + public void createControl(final Composite parent) { + this.metamodelSelectionControl = new MetamodelSelectionControl(parent); + this.metamodelSelectionControl.setLayoutData(new GridData(GridData.FILL_BOTH)); + final FilteredList filteredList = this.metamodelSelectionControl.getFilteredList(); + + filteredList.addSelectionListener(new SelectionListener() { + public void widgetSelected(final SelectionEvent e) { + if (e.item != null) { + setPageComplete(filteredList.getSelection().length == 1); + } + } + + public void widgetDefaultSelected(final SelectionEvent e) { + if (getWizard().canFinish()) { + getWizard().performFinish(); + } + if (getNextPage() != null) { + goToNextPage(); + } + } + }); + + // prevent the page from being "complete" when still on a previous page + filteredList.setSelection(new int[0]); + setPageComplete(false); + + setControl(this.metamodelSelectionControl); + } + + protected void goToNextPage() { + getContainer().showPage(getNextPage()); + } + + public EPackage getFirstSelectedEPackage() { + // Only one result + if (this.metamodelSelectionControl.getSelectedElements() != null) { + Object result = this.metamodelSelectionControl.getSelectedElements()[0]; + if (EPackage.Registry.INSTANCE.containsKey(result.toString())) { + return EPackage.Registry.INSTANCE.getEPackage(result.toString()); + } + } + return null; + } + + public void loadSelectedMetamodel() { + Object[] results = this.metamodelSelectionControl.getSelectedElements(); + // if user cancel the selection of meta models, results = null + if (results != null) { + ResourceSet resourceSet = this.editingDomain.getResourceSet(); + for (Object result : results) { + URI uri = URI.createURI(result.toString()); + Resource r = resourceSet.getResource(uri, true); + if (!resourceSet.getResources().contains(r)) { + Registry packageRegistry = resourceSet.getPackageRegistry(); + for (EObject eObject : r.getContents()) { + if (eObject instanceof EPackage) { + EPackage ePackage = (EPackage) eObject; + packageRegistry.put(ePackage.getNsURI(), ePackage); + } + } + resourceSet.getResources().add(r); + } + } + } + } +}
diff --git a/org.eclipse.modisco.facet.query.java.core/META-INF/MANIFEST.MF b/org.eclipse.modisco.facet.query.java.core/META-INF/MANIFEST.MF index 0a42355..0530dee 100644 --- a/org.eclipse.modisco.facet.query.java.core/META-INF/MANIFEST.MF +++ b/org.eclipse.modisco.facet.query.java.core/META-INF/MANIFEST.MF
@@ -3,7 +3,7 @@ Bundle-Name: %Bundle-Name Bundle-SymbolicName: org.eclipse.emf.facet.query.java.core;singleton:=true Bundle-Version: 1.3.0.qualifier -Bundle-Activator: org.eclipse.emf.facet.query.java.core.internal.plugin.Activator +Bundle-Activator: org.eclipse.modisco.facet.query.java.core.internal.plugin.Activator Bundle-Vendor: %Bundle-Vendor Require-Bundle: org.eclipse.emf.facet.efacet.core;bundle-version="0.1.0";visibility:=reexport, org.eclipse.ui, @@ -15,6 +15,6 @@ org.eclipse.emf.ecore;bundle-version="2.6.0" Bundle-RequiredExecutionEnvironment: JavaSE-1.8 Bundle-ActivationPolicy: lazy -Export-Package: org.eclipse.emf.facet.query.java.core, - org.eclipse.emf.facet.query.java.core.internal.exceptions +Export-Package: org.eclipse.modisco.facet.query.java.core, + org.eclipse.modisco.facet.query.java.core.internal.exceptions Automatic-Module-Name: org.eclipse.emf.facet.query.java.core
diff --git a/org.eclipse.modisco.facet.query.java.core/src/org/eclipse/emf/facet/query/java/core/IJavaQuery2.java b/org.eclipse.modisco.facet.query.java.core/src/org/eclipse/emf/facet/query/java/core/IJavaQuery2.java deleted file mode 100644 index 89895d0..0000000 --- a/org.eclipse.modisco.facet.query.java.core/src/org/eclipse/emf/facet/query/java/core/IJavaQuery2.java +++ /dev/null
@@ -1,46 +0,0 @@ -/** - * Copyright (c) 2009 Mia-Software. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Gregoire Dupe (Mia-Software) - initial API and implementation - * Emmanuelle Rouillé (Mia-Software) - Bug 352618 - To be able to use non derived facet structural features and save them values. - * Nicolas Bros (Mia-Software) - Bug 361612 - New core for new version of the Facet metamodel - * Nicolas Bros (Mia-Software) - Bug 362191 - [Restructuring] Query mechanism for eFacet2 - */ -package org.eclipse.emf.facet.query.java.core; - -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.facet.efacet.core.IFacetManager; -import org.eclipse.emf.facet.efacet.core.exception.DerivedTypedElementException; - -/** - * This interface is implemented by each Java query (a Java query is a query written in Java). - * - * @param <T> - * the source type of the query - * @param <R> - * the return type of the query - * @since 0.2 - */ -public interface IJavaQuery2<T extends EObject, R> { - // This interface is a copy of - // org.eclipse.emf.facet.infra.query.core.java.IJavaModelQuery<T, R> - - /** - * This method must be implemented by each sub class to implement query - * evaluation. - * - * @param source - * The model element on which the query will be evaluated - * @param parameterValues - * The query parameter values (only used for queries that implement operations) - * @return the result of the query - * @throws DerivedTypedElementException - */ - R evaluate(T source, IParameterValueList2 parameterValues, IFacetManager facetManager) - throws DerivedTypedElementException; -}
diff --git a/org.eclipse.modisco.facet.query.java.core/src/org/eclipse/emf/facet/query/java/core/IJavaQuery3.java b/org.eclipse.modisco.facet.query.java.core/src/org/eclipse/emf/facet/query/java/core/IJavaQuery3.java deleted file mode 100644 index 27526f7..0000000 --- a/org.eclipse.modisco.facet.query.java.core/src/org/eclipse/emf/facet/query/java/core/IJavaQuery3.java +++ /dev/null
@@ -1,49 +0,0 @@ -/** - * Copyright (c) 2009, 2014 Mia-Software. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Gregoire Dupe (Mia-Software) - initial API and implementation - * Emmanuelle Rouillé (Mia-Software) - Bug 352618 - To be able to use non derived facet structural features and save them values. - * Nicolas Bros (Mia-Software) - Bug 361612 - New core for new version of the Facet metamodel - * Nicolas Bros (Mia-Software) - Bug 362191 - [Restructuring] Query mechanism for eFacet2 - * Gregoire Dupe (Mia-Software) - Bug 443682 - Access to the super facet - */ -package org.eclipse.emf.facet.query.java.core; - -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.facet.efacet.core.IFacetManager; -import org.eclipse.emf.facet.efacet.core.exception.DerivedTypedElementException; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.DerivedTypedElement; - -/** - * This interface is implemented by each Java query (a Java query is a query written in Java). - * - * @param <T> - * the source type of the query - * @param <R> - * the return type of the query - * @since 0.5 - */ -public interface IJavaQuery3<T extends EObject, R> { - // This interface is a copy of - // org.eclipse.emf.facet.infra.query.core.java.IJavaModelQuery<T, R> - - /** - * This method must be implemented by each sub class to implement query - * evaluation. - * - * @param source - * The model element on which the query will be evaluated - * @param parameterValues - * The query parameter values (only used for queries that implement operations) - * @return the result of the query - * @throws DerivedTypedElementException - */ - R evaluate(T source, IParameterValueList2 parameterValues, - IFacetManager facetManager, DerivedTypedElement feature) - throws DerivedTypedElementException; -}
diff --git a/org.eclipse.modisco.facet.query.java.core/src/org/eclipse/emf/facet/query/java/core/IParameterValueList2.java b/org.eclipse.modisco.facet.query.java.core/src/org/eclipse/emf/facet/query/java/core/IParameterValueList2.java deleted file mode 100644 index b638643..0000000 --- a/org.eclipse.modisco.facet.query.java.core/src/org/eclipse/emf/facet/query/java/core/IParameterValueList2.java +++ /dev/null
@@ -1,68 +0,0 @@ -/** - * Copyright (c) 2009, 2011 Mia-Software. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Bertrand Daru (Mia-Software) - initial API and implementation - * Gregoire Dupe (Mia-Software) - initial API and implementation - * Emmanuelle Rouillé (Mia-Software) - Bug 352618 - To be able to use non derived facet structural features and save them values. - * Nicolas Bros (Mia-Software) - Bug 361612 - New core for new version of the Facet metamodel - */ -package org.eclipse.emf.facet.query.java.core; - -import java.util.List; - -import org.eclipse.emf.ecore.EParameter; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.ParameterValue; - -/** - * @since 0.2 - * @noimplement This interface is not intended to be implemented by clients. - * @noextend This interface is not intended to be extended by clients. - */ -public interface IParameterValueList2 extends List<ParameterValue> { - // This interface is a rewrite of - // org.eclipse.emf.facet.infra.query.core.java.ParameterValueList - - /** - * Return the value of the parameter with the specified name. - * - * @param name - * the name of the parameter - * @return the value, or <code>null</code> if there is no parameter with - * that name. - */ - public Object getValueByParameterName(final String name); - - /** - * Return the parameter with the specified name. - * - * @param name - * the name of the parameter - * @return the parameter, or <code>null</code> if there is no parameter with - * that name. - */ - public ParameterValue getParameterValueByName(final String name); - - /** - * Return the parameter corresponding to the given parameter declaration. - * - * @param parameter - * the parameter declaration - * @return the parameter, or <code>null</code> if the given parameter - * declaration is unknown. - */ - public ParameterValue getParameterValue(final EParameter parameter); - - /** - * Return the value of a parameter - * - * @param parameter - * the parameter - * @return the value of the parameter - */ - public Object getValue(final EParameter parameter); -} \ No newline at end of file
diff --git a/org.eclipse.modisco.facet.query.java.core/src/org/eclipse/emf/facet/query/java/core/IParameterValueListFactory2.java b/org.eclipse.modisco.facet.query.java.core/src/org/eclipse/emf/facet/query/java/core/IParameterValueListFactory2.java deleted file mode 100644 index 3663939..0000000 --- a/org.eclipse.modisco.facet.query.java.core/src/org/eclipse/emf/facet/query/java/core/IParameterValueListFactory2.java +++ /dev/null
@@ -1,37 +0,0 @@ -/** - * Copyright (c) 2011 Mia-Software. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Nicolas Guyomar (Mia-Software) - Bug 334615 - Java Query for EMF Facet - * Emmanuelle Rouillé (Mia-Software) - Bug 352618 - To be able to use non derived facet structural features and save them values. - * Nicolas Bros (Mia-Software) - Bug 361612 - New core for new version of the Facet metamodel - */ -package org.eclipse.emf.facet.query.java.core; - -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.ParameterValue; -import org.eclipse.emf.facet.query.java.core.internal.ParameterValueListFactoryImpl2; - -/** - * @since 0.2 - * @noimplement This interface is not intended to be implemented by clients. - * @noextend This interface is not intended to be extended by clients. - */ -public interface IParameterValueListFactory2 { - /** Factory singleton */ - public static final IParameterValueListFactory2 INSTANCE = new ParameterValueListFactoryImpl2(); - - /** - * This method has to be used to get a new instance of {@link IParameterValueList2} - * - * @param values - * the list of parameters - * @return an {@link IParameterValueList2} instance containing the provided - * parameter values - */ - public IParameterValueList2 createParameterValueList( - final ParameterValue... values); -}
diff --git a/org.eclipse.modisco.facet.query.java.core/src/org/eclipse/emf/facet/query/java/core/internal/ParameterValueList2.java b/org.eclipse.modisco.facet.query.java.core/src/org/eclipse/emf/facet/query/java/core/internal/ParameterValueList2.java deleted file mode 100644 index 25d9e31..0000000 --- a/org.eclipse.modisco.facet.query.java.core/src/org/eclipse/emf/facet/query/java/core/internal/ParameterValueList2.java +++ /dev/null
@@ -1,107 +0,0 @@ -/** - * Copyright (c) 2009 Mia-Software. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Bertrand Daru (Mia-Software) - initial API and implementation - * Gregoire Dupe (Mia-Software) - initial API and implementation - * Emmanuelle Rouillé (Mia-Software) - Bug 352618 - To be able to use non derived facet structural features and save them values. - * Nicolas Bros (Mia-Software) - Bug 361612 - New core for new version of the Facet metamodel - * David Couvrand (Soft-Maint) - Bug 418813 - [Query] Optimization in creation of ParameterValueList2 - */ -package org.eclipse.emf.facet.query.java.core.internal; - -import java.util.ArrayList; -import java.util.Arrays; - -import org.eclipse.emf.ecore.EParameter; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.EFacetFactory; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.ParameterValue; -import org.eclipse.emf.facet.query.java.core.IParameterValueList2; - -public class ParameterValueList2 extends ArrayList<ParameterValue> implements IParameterValueList2 { - // This class is a copy of - // org.eclipse.emf.facet.infra.query.core.java.ParameterValueList - - private static final long serialVersionUID = 1L; - - ParameterValueList2(final ParameterValue... values) { - super(Arrays.asList(values)); - } - - /** - * Return the value of the parameter with the specified name. - * - * @param name - * the name of the parameter - * @return the value, or <code>null</code> if there is no parameter with - * that name. - */ - public Object getValueByParameterName(final String name) { - ParameterValue param = getParameterValueByName(name); - if (param == null) { - return null; - } - return param.getValue(); - } - - /** - * Return the parameter with the specified name. - * - * @param name - * the name of the parameter - * @return the parameter, or <code>null</code> if there is no parameter with - * that name. - */ - public ParameterValue getParameterValueByName(final String name) { - for (ParameterValue param : this) { - EParameter parameter = param.getParameter(); - if (parameter != null) { - if (name.equals(parameter.getName())) { - return param; - } - } - } - return null; - } - - public static ParameterValue createParameterValue(final Object value, - final EParameter parameter) { - ParameterValue paramValue = EFacetFactory.eINSTANCE - .createParameterValue(); - paramValue.setParameter(parameter); - paramValue.setValue(value); - return paramValue; - } - - /** - * Return the parameter corresponding to the given parameter declaration. - * - * @param parameter - * the parameter declaration - * @return the parameter, or <code>null</code> if the given parameter - * declaration is unknown. - */ - public ParameterValue getParameterValue(final EParameter parameter) { - for (ParameterValue paramValue : this) { - if (paramValue.getParameter() == parameter) { - return paramValue; - } - } - return null; - } - - /** - * Return the value of a parameter - * - * @param parameter - * the parameter - * @return the value of the parameter - */ - public Object getValue(final EParameter parameter) { - return getParameterValue(parameter).getValue(); - } -}
diff --git a/org.eclipse.modisco.facet.query.java.core/src/org/eclipse/emf/facet/query/java/core/internal/ParameterValueListFactoryImpl2.java b/org.eclipse.modisco.facet.query.java.core/src/org/eclipse/emf/facet/query/java/core/internal/ParameterValueListFactoryImpl2.java deleted file mode 100644 index 16ad2f1..0000000 --- a/org.eclipse.modisco.facet.query.java.core/src/org/eclipse/emf/facet/query/java/core/internal/ParameterValueListFactoryImpl2.java +++ /dev/null
@@ -1,25 +0,0 @@ -/** - * Copyright (c) 2011 Mia-Software. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Nicolas Guyomar (Mia-Software) - Bug 334615 - Java Query for EMF Facet - * Emmanuelle Rouillé (Mia-Software) - Bug 352618 - To be able to use non derived facet structural features and save them values. - */ -package org.eclipse.emf.facet.query.java.core.internal; - -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.ParameterValue; -import org.eclipse.emf.facet.query.java.core.IParameterValueList2; -import org.eclipse.emf.facet.query.java.core.IParameterValueListFactory2; - -public class ParameterValueListFactoryImpl2 implements - IParameterValueListFactory2 { - - public IParameterValueList2 createParameterValueList( - final ParameterValue... values) { - return new ParameterValueList2(values); - } -}
diff --git a/org.eclipse.modisco.facet.query.java.core/src/org/eclipse/emf/facet/query/java/core/internal/evaluator/JavaQueryImplementation.java b/org.eclipse.modisco.facet.query.java.core/src/org/eclipse/emf/facet/query/java/core/internal/evaluator/JavaQueryImplementation.java deleted file mode 100644 index 5ec80b1..0000000 --- a/org.eclipse.modisco.facet.query.java.core/src/org/eclipse/emf/facet/query/java/core/internal/evaluator/JavaQueryImplementation.java +++ /dev/null
@@ -1,100 +0,0 @@ -/** - * Copyright (c) 2009 Mia-Software. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Gregoire Dupe (Mia-Software) - initial API and implementation - * Emmanuelle Rouillé (Mia-Software) - Bug 352618 - To be able to use non derived facet structural features and save them values. - * Nicolas Bros (Mia-Software) - Bug 361612 - New core for new version of the Facet metamodel - * Nicolas Bros (Mia-Software) - Bug 362191 - [Restructuring] Query mechanism for eFacet2 - * Nicolas Bros (Mia-Software) - Bug 376941 - [EFacet] Facet operation arguments in Facet model - * Gregoire Dupe (Mia-Software) - Bug 443682 - Access to the super facet - */ -package org.eclipse.emf.facet.query.java.core.internal.evaluator; - -import java.util.List; - -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.facet.efacet.core.IFacetManager; -import org.eclipse.emf.facet.efacet.core.exception.DerivedTypedElementException; -import org.eclipse.emf.facet.efacet.core.query.IQueryImplementation; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.DerivedTypedElement; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.ParameterValue; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.extensible.Query; -import org.eclipse.emf.facet.query.java.core.IJavaQuery2; -import org.eclipse.emf.facet.query.java.core.IJavaQuery3; -import org.eclipse.emf.facet.query.java.core.IParameterValueList2; -import org.eclipse.emf.facet.query.java.core.IParameterValueListFactory2; - -public class JavaQueryImplementation implements IQueryImplementation { - - // This class is a modified copy of : - // org.eclipse.emf.facet.infra.query.core.java.internal.JavaModelQueryAdapter - - private final IJavaQuery2<EObject, ?> javaQuery2; - private final IJavaQuery3<EObject, ?> javaQuery3; - private boolean checkResultType = false; - - /** - * @param query - * @param javaQuery - * the javaQuery to be evaluated - */ - public JavaQueryImplementation(final IJavaQuery2<EObject, ?> javaQuery) { - this.javaQuery2 = javaQuery; - this.javaQuery3 = null; - } - - public JavaQueryImplementation(final IJavaQuery3<EObject, ?> javaQuery) { - this.javaQuery2 = null; - this.javaQuery3 = javaQuery; - } - - public JavaQueryImplementation(final Object query) { - if (query instanceof IJavaQuery2) { - final IJavaQuery2<EObject, ?> javaQuery = (IJavaQuery2<EObject, ?>) query; - this.javaQuery2 = javaQuery; - this.javaQuery3 = null; - } else if (query instanceof IJavaQuery3) { - final IJavaQuery3<EObject, ?> javaQuery = (IJavaQuery3<EObject, ?>) query; - this.javaQuery2 = null; - this.javaQuery3 = javaQuery; - } else { - throw new IllegalArgumentException(); - } - } - - public Object getValue(final Query query, final DerivedTypedElement feature, final EObject source, final List<ParameterValue> parameterValues, final IFacetManager facetManager) - throws DerivedTypedElementException { - final IParameterValueList2 plist = IParameterValueListFactory2.INSTANCE - .createParameterValueList(); - if (parameterValues != null) { - plist.addAll(parameterValues); - } - Object result; - if (this.javaQuery3 != null) { - result = this.javaQuery3.evaluate(source, plist, facetManager, feature); - } else if (this.javaQuery2 != null) { - result = this.javaQuery2.evaluate(source, plist, facetManager); - } else { - throw new IllegalStateException("This instance of JavaQueryImplementation has not be initialized properly."); //$NON-NLS-1$ - } - return result; - } - - public void setValue(final Query query, final DerivedTypedElement feature, final EObject source, final List<ParameterValue> parameterValues, final Object newValue) - throws DerivedTypedElementException { - throw new UnsupportedOperationException("not implemented yet"); //$NON-NLS-1$ - } - - public boolean isCheckResultType() { - return this.checkResultType; - } - - public void setCheckResultType(final boolean checkResultType) { - this.checkResultType = checkResultType; - } -}
diff --git a/org.eclipse.modisco.facet.query.java.core/src/org/eclipse/emf/facet/query/java/core/internal/evaluator/JavaQueryImplementationFactory.java b/org.eclipse.modisco.facet.query.java.core/src/org/eclipse/emf/facet/query/java/core/internal/evaluator/JavaQueryImplementationFactory.java deleted file mode 100644 index d70f0ec..0000000 --- a/org.eclipse.modisco.facet.query.java.core/src/org/eclipse/emf/facet/query/java/core/internal/evaluator/JavaQueryImplementationFactory.java +++ /dev/null
@@ -1,88 +0,0 @@ -/** - * Copyright (c) 2011 Mia-Software. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Nicolas Guyomar (Mia-Software) - Bug 334615 - Java Query for EMF Facet - * Emmanuelle Rouillé (Mia-Software) - Bug 352618 - To be able to use non derived facet structural features and save them values. - * Nicolas Bros (Mia-Software) - Bug 361612 - New core for new version of the Facet metamodel - * Nicolas Bros (Mia-Software) - Bug 362191 - [Restructuring] Query mechanism for eFacet2 - * Nicolas Bros (Mia-Software) - Bug 376941 - [EFacet] Facet operation arguments in Facet model - * Gregoire Dupe (Mia-Software) - Bug 443682 - Access to the super facet - */ -package org.eclipse.emf.facet.query.java.core.internal.evaluator; - -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.facet.efacet.core.IDerivedTypedElementManager; -import org.eclipse.emf.facet.efacet.core.exception.DerivedTypedElementException; -import org.eclipse.emf.facet.efacet.core.internal.query.QueryUtils; -import org.eclipse.emf.facet.efacet.core.query.IQueryImplementation; -import org.eclipse.emf.facet.efacet.core.query.IQueryImplementationFactory; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.extensible.Query; -import org.eclipse.emf.facet.query.java.core.IJavaQuery2; -import org.eclipse.emf.facet.query.java.core.IJavaQuery3; -import org.eclipse.emf.facet.query.java.core.internal.plugin.Activator; -import org.eclipse.emf.facet.query.java.metamodel.v0_2_0.javaquery.JavaQuery; -import org.eclipse.emf.facet.query.java.metamodel.v0_2_0.javaquery.JavaQueryPackage; -import org.eclipse.emf.facet.util.core.Logger; -import org.osgi.framework.Bundle; - -public class JavaQueryImplementationFactory implements IQueryImplementationFactory { - - public IQueryImplementation create(final Query query, final Bundle bundle, final IDerivedTypedElementManager manager) throws DerivedTypedElementException { - if (!(query instanceof JavaQuery)) { - throw new IllegalArgumentException("The given DerivedTypedElement does not have a JavaQuery"); //$NON-NLS-1$ - } - JavaQuery javaQuery = (JavaQuery) query; - - if (bundle == null) { - throw new DerivedTypedElementException("Java query implementation class '" //$NON-NLS-1$ - + javaQuery.getClass().getName() - + "' should be created within a bundle."); //$NON-NLS-1$ - } - JavaQueryImplementation javaQueryEvaluator = null; - try { - String className = javaQuery.getImplementationClassName(); - if (className == null || className.length() == 0) { - throw new DerivedTypedElementException("The Java query's implementationClassName must not be empty"); //$NON-NLS-1$ - } - Class<?> javaQueryClass = bundle.loadClass(className); - if (!IJavaQuery2.class.isAssignableFrom(javaQueryClass) - && !IJavaQuery3.class.isAssignableFrom(javaQueryClass)) { - final String message = String.format( - "Java query implementation class '%s' does not implement %s or %s.", //$NON-NLS-1$ - className, IJavaQuery2.class.getSimpleName(), - IJavaQuery3.class.getSimpleName()); - throw new Exception(message); - } - javaQueryEvaluator = createJavaQueryImpl(javaQueryClass); - // Initially a null test was performed on bundle to determine whether - // to check the result type. Now we need a bundle so - // checkResultType=true - javaQueryEvaluator.setCheckResultType(true); - } catch (Exception e) { - DerivedTypedElementException queryException = new DerivedTypedElementException( - "The bundle " + bundle.getSymbolicName() + " failed to load the java query: " //$NON-NLS-1$ //$NON-NLS-2$ - + QueryUtils.getQueryDescription(javaQuery), e); - Logger.logError(queryException, Activator.getDefault()); - throw queryException; - } - return javaQueryEvaluator; - } - - /** This method is dedicated to isolate the "Unchecked cast" warning. */ - @SuppressWarnings("unchecked") - private static JavaQueryImplementation createJavaQueryImpl(final Class<?> javaQueryClass) - throws InstantiationException, IllegalAccessException { - final Object query = javaQueryClass.newInstance(); - final JavaQueryImplementation javaQueryEvaluator = new JavaQueryImplementation(query); - return javaQueryEvaluator; - } - - public EClass getManagedQueryType() { - return JavaQueryPackage.eINSTANCE.getJavaQuery(); - } -}
diff --git a/org.eclipse.modisco.facet.query.java.core/src/org/eclipse/emf/facet/query/java/core/internal/exceptions/ClassAlreadyExistsException.java b/org.eclipse.modisco.facet.query.java.core/src/org/eclipse/emf/facet/query/java/core/internal/exceptions/ClassAlreadyExistsException.java deleted file mode 100644 index 64fadf9..0000000 --- a/org.eclipse.modisco.facet.query.java.core/src/org/eclipse/emf/facet/query/java/core/internal/exceptions/ClassAlreadyExistsException.java +++ /dev/null
@@ -1,21 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2011 Mia-Software. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Nicolas Guyomar (Mia-Software) - Bug 349569 - Need new exceptions for java query class creation - *******************************************************************************/ -package org.eclipse.emf.facet.query.java.core.internal.exceptions; - -/** - * This exception is raised whenever the class being created already exists. - * @since 0.2 - */ -public class ClassAlreadyExistsException extends Exception { - - private static final long serialVersionUID = -7352916272441579074L; - -} \ No newline at end of file
diff --git a/org.eclipse.modisco.facet.query.java.core/src/org/eclipse/emf/facet/query/java/core/internal/exceptions/ResourceURIExpectedException.java b/org.eclipse.modisco.facet.query.java.core/src/org/eclipse/emf/facet/query/java/core/internal/exceptions/ResourceURIExpectedException.java deleted file mode 100644 index 7a539f1..0000000 --- a/org.eclipse.modisco.facet.query.java.core/src/org/eclipse/emf/facet/query/java/core/internal/exceptions/ResourceURIExpectedException.java +++ /dev/null
@@ -1,21 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2011 Mia-Software. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Nicolas Guyomar (Mia-Software) - Bug 349569 - Need new exceptions for java query class creation - *******************************************************************************/ -package org.eclipse.emf.facet.query.java.core.internal.exceptions; - -/** - * This exception is raised whenever an URI is not a resource URI as expected - * @since 0.2 - */ -public class ResourceURIExpectedException extends Exception { - - private static final long serialVersionUID = 6891585699949077305L; - -}
diff --git a/org.eclipse.modisco.facet.query.java.core/src/org/eclipse/emf/facet/query/java/core/internal/plugin/Activator.java b/org.eclipse.modisco.facet.query.java.core/src/org/eclipse/emf/facet/query/java/core/internal/plugin/Activator.java deleted file mode 100644 index 25c2cd7..0000000 --- a/org.eclipse.modisco.facet.query.java.core/src/org/eclipse/emf/facet/query/java/core/internal/plugin/Activator.java +++ /dev/null
@@ -1,68 +0,0 @@ -/** - * Copyright (c) 2011 Mia-Software. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Nicolas Guyomar (Mia-Software) - Bug 334615 - Java Query for EMF Facet - */ -package org.eclipse.emf.facet.query.java.core.internal.plugin; - -import org.eclipse.ui.plugin.AbstractUIPlugin; -import org.osgi.framework.BundleContext; - -/** - * The activator class controls the plug-in life cycle - */ -public class Activator extends AbstractUIPlugin { - - // The plug-in ID - public static final String PLUGIN_ID = "org.eclipse.emf.facet.query.java.core"; //$NON-NLS-1$ - - // The shared instance - private static Activator plugin; - - /** - * The constructor - */ - public Activator() { - } - - /* - * (non-Javadoc) - * - * @see - * org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext - * ) - */ - @Override - public void start(final BundleContext context) throws Exception { - super.start(context); - Activator.plugin = this; - } - - /* - * (non-Javadoc) - * - * @see - * org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext - * ) - */ - @Override - public void stop(final BundleContext context) throws Exception { - Activator.plugin = null; - super.stop(context); - } - - /** - * Returns the shared instance - * - * @return the shared instance - */ - public static Activator getDefault() { - return Activator.plugin; - } - -}
diff --git a/org.eclipse.modisco.facet.query.java.core/src/org/eclipse/modisco/facet/query/java/core/IJavaQuery2.java b/org.eclipse.modisco.facet.query.java.core/src/org/eclipse/modisco/facet/query/java/core/IJavaQuery2.java new file mode 100644 index 0000000..d099049 --- /dev/null +++ b/org.eclipse.modisco.facet.query.java.core/src/org/eclipse/modisco/facet/query/java/core/IJavaQuery2.java
@@ -0,0 +1,46 @@ +/** + * Copyright (c) 2009 Mia-Software. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Gregoire Dupe (Mia-Software) - initial API and implementation + * Emmanuelle Rouillé (Mia-Software) - Bug 352618 - To be able to use non derived facet structural features and save them values. + * Nicolas Bros (Mia-Software) - Bug 361612 - New core for new version of the Facet metamodel + * Nicolas Bros (Mia-Software) - Bug 362191 - [Restructuring] Query mechanism for eFacet2 + */ +package org.eclipse.modisco.facet.query.java.core; + +import org.eclipse.emf.ecore.EObject; +import org.eclipse.modisco.facet.efacet.core.IFacetManager; +import org.eclipse.modisco.facet.efacet.core.exception.DerivedTypedElementException; + +/** + * This interface is implemented by each Java query (a Java query is a query written in Java). + * + * @param <T> + * the source type of the query + * @param <R> + * the return type of the query + * @since 0.2 + */ +public interface IJavaQuery2<T extends EObject, R> { + // This interface is a copy of + // org.eclipse.emf.facet.infra.query.core.java.IJavaModelQuery<T, R> + + /** + * This method must be implemented by each sub class to implement query + * evaluation. + * + * @param source + * The model element on which the query will be evaluated + * @param parameterValues + * The query parameter values (only used for queries that implement operations) + * @return the result of the query + * @throws DerivedTypedElementException + */ + R evaluate(T source, IParameterValueList2 parameterValues, IFacetManager facetManager) + throws DerivedTypedElementException; +}
diff --git a/org.eclipse.modisco.facet.query.java.core/src/org/eclipse/modisco/facet/query/java/core/IJavaQuery3.java b/org.eclipse.modisco.facet.query.java.core/src/org/eclipse/modisco/facet/query/java/core/IJavaQuery3.java new file mode 100644 index 0000000..48d46e7 --- /dev/null +++ b/org.eclipse.modisco.facet.query.java.core/src/org/eclipse/modisco/facet/query/java/core/IJavaQuery3.java
@@ -0,0 +1,49 @@ +/** + * Copyright (c) 2009, 2014 Mia-Software. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Gregoire Dupe (Mia-Software) - initial API and implementation + * Emmanuelle Rouillé (Mia-Software) - Bug 352618 - To be able to use non derived facet structural features and save them values. + * Nicolas Bros (Mia-Software) - Bug 361612 - New core for new version of the Facet metamodel + * Nicolas Bros (Mia-Software) - Bug 362191 - [Restructuring] Query mechanism for eFacet2 + * Gregoire Dupe (Mia-Software) - Bug 443682 - Access to the super facet + */ +package org.eclipse.modisco.facet.query.java.core; + +import org.eclipse.emf.ecore.EObject; +import org.eclipse.modisco.facet.efacet.core.IFacetManager; +import org.eclipse.modisco.facet.efacet.core.exception.DerivedTypedElementException; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.DerivedTypedElement; + +/** + * This interface is implemented by each Java query (a Java query is a query written in Java). + * + * @param <T> + * the source type of the query + * @param <R> + * the return type of the query + * @since 0.5 + */ +public interface IJavaQuery3<T extends EObject, R> { + // This interface is a copy of + // org.eclipse.emf.facet.infra.query.core.java.IJavaModelQuery<T, R> + + /** + * This method must be implemented by each sub class to implement query + * evaluation. + * + * @param source + * The model element on which the query will be evaluated + * @param parameterValues + * The query parameter values (only used for queries that implement operations) + * @return the result of the query + * @throws DerivedTypedElementException + */ + R evaluate(T source, IParameterValueList2 parameterValues, + IFacetManager facetManager, DerivedTypedElement feature) + throws DerivedTypedElementException; +}
diff --git a/org.eclipse.modisco.facet.query.java.core/src/org/eclipse/modisco/facet/query/java/core/IParameterValueList2.java b/org.eclipse.modisco.facet.query.java.core/src/org/eclipse/modisco/facet/query/java/core/IParameterValueList2.java new file mode 100644 index 0000000..9046888 --- /dev/null +++ b/org.eclipse.modisco.facet.query.java.core/src/org/eclipse/modisco/facet/query/java/core/IParameterValueList2.java
@@ -0,0 +1,68 @@ +/** + * Copyright (c) 2009, 2011 Mia-Software. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Bertrand Daru (Mia-Software) - initial API and implementation + * Gregoire Dupe (Mia-Software) - initial API and implementation + * Emmanuelle Rouillé (Mia-Software) - Bug 352618 - To be able to use non derived facet structural features and save them values. + * Nicolas Bros (Mia-Software) - Bug 361612 - New core for new version of the Facet metamodel + */ +package org.eclipse.modisco.facet.query.java.core; + +import java.util.List; + +import org.eclipse.emf.ecore.EParameter; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.ParameterValue; + +/** + * @since 0.2 + * @noimplement This interface is not intended to be implemented by clients. + * @noextend This interface is not intended to be extended by clients. + */ +public interface IParameterValueList2 extends List<ParameterValue> { + // This interface is a rewrite of + // org.eclipse.emf.facet.infra.query.core.java.ParameterValueList + + /** + * Return the value of the parameter with the specified name. + * + * @param name + * the name of the parameter + * @return the value, or <code>null</code> if there is no parameter with + * that name. + */ + public Object getValueByParameterName(final String name); + + /** + * Return the parameter with the specified name. + * + * @param name + * the name of the parameter + * @return the parameter, or <code>null</code> if there is no parameter with + * that name. + */ + public ParameterValue getParameterValueByName(final String name); + + /** + * Return the parameter corresponding to the given parameter declaration. + * + * @param parameter + * the parameter declaration + * @return the parameter, or <code>null</code> if the given parameter + * declaration is unknown. + */ + public ParameterValue getParameterValue(final EParameter parameter); + + /** + * Return the value of a parameter + * + * @param parameter + * the parameter + * @return the value of the parameter + */ + public Object getValue(final EParameter parameter); +} \ No newline at end of file
diff --git a/org.eclipse.modisco.facet.query.java.core/src/org/eclipse/modisco/facet/query/java/core/IParameterValueListFactory2.java b/org.eclipse.modisco.facet.query.java.core/src/org/eclipse/modisco/facet/query/java/core/IParameterValueListFactory2.java new file mode 100644 index 0000000..6c0ac8c --- /dev/null +++ b/org.eclipse.modisco.facet.query.java.core/src/org/eclipse/modisco/facet/query/java/core/IParameterValueListFactory2.java
@@ -0,0 +1,37 @@ +/** + * Copyright (c) 2011 Mia-Software. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Nicolas Guyomar (Mia-Software) - Bug 334615 - Java Query for EMF Facet + * Emmanuelle Rouillé (Mia-Software) - Bug 352618 - To be able to use non derived facet structural features and save them values. + * Nicolas Bros (Mia-Software) - Bug 361612 - New core for new version of the Facet metamodel + */ +package org.eclipse.modisco.facet.query.java.core; + +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.ParameterValue; +import org.eclipse.modisco.facet.query.java.core.internal.ParameterValueListFactoryImpl2; + +/** + * @since 0.2 + * @noimplement This interface is not intended to be implemented by clients. + * @noextend This interface is not intended to be extended by clients. + */ +public interface IParameterValueListFactory2 { + /** Factory singleton */ + public static final IParameterValueListFactory2 INSTANCE = new ParameterValueListFactoryImpl2(); + + /** + * This method has to be used to get a new instance of {@link IParameterValueList2} + * + * @param values + * the list of parameters + * @return an {@link IParameterValueList2} instance containing the provided + * parameter values + */ + public IParameterValueList2 createParameterValueList( + final ParameterValue... values); +}
diff --git a/org.eclipse.modisco.facet.query.java.core/src/org/eclipse/modisco/facet/query/java/core/internal/ParameterValueList2.java b/org.eclipse.modisco.facet.query.java.core/src/org/eclipse/modisco/facet/query/java/core/internal/ParameterValueList2.java new file mode 100644 index 0000000..8d9b49a --- /dev/null +++ b/org.eclipse.modisco.facet.query.java.core/src/org/eclipse/modisco/facet/query/java/core/internal/ParameterValueList2.java
@@ -0,0 +1,107 @@ +/** + * Copyright (c) 2009 Mia-Software. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Bertrand Daru (Mia-Software) - initial API and implementation + * Gregoire Dupe (Mia-Software) - initial API and implementation + * Emmanuelle Rouillé (Mia-Software) - Bug 352618 - To be able to use non derived facet structural features and save them values. + * Nicolas Bros (Mia-Software) - Bug 361612 - New core for new version of the Facet metamodel + * David Couvrand (Soft-Maint) - Bug 418813 - [Query] Optimization in creation of ParameterValueList2 + */ +package org.eclipse.modisco.facet.query.java.core.internal; + +import java.util.ArrayList; +import java.util.Arrays; + +import org.eclipse.emf.ecore.EParameter; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.EFacetFactory; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.ParameterValue; +import org.eclipse.modisco.facet.query.java.core.IParameterValueList2; + +public class ParameterValueList2 extends ArrayList<ParameterValue> implements IParameterValueList2 { + // This class is a copy of + // org.eclipse.emf.facet.infra.query.core.java.ParameterValueList + + private static final long serialVersionUID = 1L; + + ParameterValueList2(final ParameterValue... values) { + super(Arrays.asList(values)); + } + + /** + * Return the value of the parameter with the specified name. + * + * @param name + * the name of the parameter + * @return the value, or <code>null</code> if there is no parameter with + * that name. + */ + public Object getValueByParameterName(final String name) { + ParameterValue param = getParameterValueByName(name); + if (param == null) { + return null; + } + return param.getValue(); + } + + /** + * Return the parameter with the specified name. + * + * @param name + * the name of the parameter + * @return the parameter, or <code>null</code> if there is no parameter with + * that name. + */ + public ParameterValue getParameterValueByName(final String name) { + for (ParameterValue param : this) { + EParameter parameter = param.getParameter(); + if (parameter != null) { + if (name.equals(parameter.getName())) { + return param; + } + } + } + return null; + } + + public static ParameterValue createParameterValue(final Object value, + final EParameter parameter) { + ParameterValue paramValue = EFacetFactory.eINSTANCE + .createParameterValue(); + paramValue.setParameter(parameter); + paramValue.setValue(value); + return paramValue; + } + + /** + * Return the parameter corresponding to the given parameter declaration. + * + * @param parameter + * the parameter declaration + * @return the parameter, or <code>null</code> if the given parameter + * declaration is unknown. + */ + public ParameterValue getParameterValue(final EParameter parameter) { + for (ParameterValue paramValue : this) { + if (paramValue.getParameter() == parameter) { + return paramValue; + } + } + return null; + } + + /** + * Return the value of a parameter + * + * @param parameter + * the parameter + * @return the value of the parameter + */ + public Object getValue(final EParameter parameter) { + return getParameterValue(parameter).getValue(); + } +}
diff --git a/org.eclipse.modisco.facet.query.java.core/src/org/eclipse/modisco/facet/query/java/core/internal/ParameterValueListFactoryImpl2.java b/org.eclipse.modisco.facet.query.java.core/src/org/eclipse/modisco/facet/query/java/core/internal/ParameterValueListFactoryImpl2.java new file mode 100644 index 0000000..1f8332a --- /dev/null +++ b/org.eclipse.modisco.facet.query.java.core/src/org/eclipse/modisco/facet/query/java/core/internal/ParameterValueListFactoryImpl2.java
@@ -0,0 +1,25 @@ +/** + * Copyright (c) 2011 Mia-Software. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Nicolas Guyomar (Mia-Software) - Bug 334615 - Java Query for EMF Facet + * Emmanuelle Rouillé (Mia-Software) - Bug 352618 - To be able to use non derived facet structural features and save them values. + */ +package org.eclipse.modisco.facet.query.java.core.internal; + +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.ParameterValue; +import org.eclipse.modisco.facet.query.java.core.IParameterValueList2; +import org.eclipse.modisco.facet.query.java.core.IParameterValueListFactory2; + +public class ParameterValueListFactoryImpl2 implements + IParameterValueListFactory2 { + + public IParameterValueList2 createParameterValueList( + final ParameterValue... values) { + return new ParameterValueList2(values); + } +}
diff --git a/org.eclipse.modisco.facet.query.java.core/src/org/eclipse/modisco/facet/query/java/core/internal/evaluator/JavaQueryImplementation.java b/org.eclipse.modisco.facet.query.java.core/src/org/eclipse/modisco/facet/query/java/core/internal/evaluator/JavaQueryImplementation.java new file mode 100644 index 0000000..0b7ba85 --- /dev/null +++ b/org.eclipse.modisco.facet.query.java.core/src/org/eclipse/modisco/facet/query/java/core/internal/evaluator/JavaQueryImplementation.java
@@ -0,0 +1,100 @@ +/** + * Copyright (c) 2009 Mia-Software. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Gregoire Dupe (Mia-Software) - initial API and implementation + * Emmanuelle Rouillé (Mia-Software) - Bug 352618 - To be able to use non derived facet structural features and save them values. + * Nicolas Bros (Mia-Software) - Bug 361612 - New core for new version of the Facet metamodel + * Nicolas Bros (Mia-Software) - Bug 362191 - [Restructuring] Query mechanism for eFacet2 + * Nicolas Bros (Mia-Software) - Bug 376941 - [EFacet] Facet operation arguments in Facet model + * Gregoire Dupe (Mia-Software) - Bug 443682 - Access to the super facet + */ +package org.eclipse.modisco.facet.query.java.core.internal.evaluator; + +import java.util.List; + +import org.eclipse.emf.ecore.EObject; +import org.eclipse.modisco.facet.efacet.core.IFacetManager; +import org.eclipse.modisco.facet.efacet.core.exception.DerivedTypedElementException; +import org.eclipse.modisco.facet.efacet.core.query.IQueryImplementation; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.DerivedTypedElement; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.ParameterValue; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.extensible.Query; +import org.eclipse.modisco.facet.query.java.core.IJavaQuery2; +import org.eclipse.modisco.facet.query.java.core.IJavaQuery3; +import org.eclipse.modisco.facet.query.java.core.IParameterValueList2; +import org.eclipse.modisco.facet.query.java.core.IParameterValueListFactory2; + +public class JavaQueryImplementation implements IQueryImplementation { + + // This class is a modified copy of : + // org.eclipse.emf.facet.infra.query.core.java.internal.JavaModelQueryAdapter + + private final IJavaQuery2<EObject, ?> javaQuery2; + private final IJavaQuery3<EObject, ?> javaQuery3; + private boolean checkResultType = false; + + /** + * @param query + * @param javaQuery + * the javaQuery to be evaluated + */ + public JavaQueryImplementation(final IJavaQuery2<EObject, ?> javaQuery) { + this.javaQuery2 = javaQuery; + this.javaQuery3 = null; + } + + public JavaQueryImplementation(final IJavaQuery3<EObject, ?> javaQuery) { + this.javaQuery2 = null; + this.javaQuery3 = javaQuery; + } + + public JavaQueryImplementation(final Object query) { + if (query instanceof IJavaQuery2) { + final IJavaQuery2<EObject, ?> javaQuery = (IJavaQuery2<EObject, ?>) query; + this.javaQuery2 = javaQuery; + this.javaQuery3 = null; + } else if (query instanceof IJavaQuery3) { + final IJavaQuery3<EObject, ?> javaQuery = (IJavaQuery3<EObject, ?>) query; + this.javaQuery2 = null; + this.javaQuery3 = javaQuery; + } else { + throw new IllegalArgumentException(); + } + } + + public Object getValue(final Query query, final DerivedTypedElement feature, final EObject source, final List<ParameterValue> parameterValues, final IFacetManager facetManager) + throws DerivedTypedElementException { + final IParameterValueList2 plist = IParameterValueListFactory2.INSTANCE + .createParameterValueList(); + if (parameterValues != null) { + plist.addAll(parameterValues); + } + Object result; + if (this.javaQuery3 != null) { + result = this.javaQuery3.evaluate(source, plist, facetManager, feature); + } else if (this.javaQuery2 != null) { + result = this.javaQuery2.evaluate(source, plist, facetManager); + } else { + throw new IllegalStateException("This instance of JavaQueryImplementation has not be initialized properly."); //$NON-NLS-1$ + } + return result; + } + + public void setValue(final Query query, final DerivedTypedElement feature, final EObject source, final List<ParameterValue> parameterValues, final Object newValue) + throws DerivedTypedElementException { + throw new UnsupportedOperationException("not implemented yet"); //$NON-NLS-1$ + } + + public boolean isCheckResultType() { + return this.checkResultType; + } + + public void setCheckResultType(final boolean checkResultType) { + this.checkResultType = checkResultType; + } +}
diff --git a/org.eclipse.modisco.facet.query.java.core/src/org/eclipse/modisco/facet/query/java/core/internal/evaluator/JavaQueryImplementationFactory.java b/org.eclipse.modisco.facet.query.java.core/src/org/eclipse/modisco/facet/query/java/core/internal/evaluator/JavaQueryImplementationFactory.java new file mode 100644 index 0000000..efb6dc0 --- /dev/null +++ b/org.eclipse.modisco.facet.query.java.core/src/org/eclipse/modisco/facet/query/java/core/internal/evaluator/JavaQueryImplementationFactory.java
@@ -0,0 +1,88 @@ +/** + * Copyright (c) 2011 Mia-Software. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Nicolas Guyomar (Mia-Software) - Bug 334615 - Java Query for EMF Facet + * Emmanuelle Rouillé (Mia-Software) - Bug 352618 - To be able to use non derived facet structural features and save them values. + * Nicolas Bros (Mia-Software) - Bug 361612 - New core for new version of the Facet metamodel + * Nicolas Bros (Mia-Software) - Bug 362191 - [Restructuring] Query mechanism for eFacet2 + * Nicolas Bros (Mia-Software) - Bug 376941 - [EFacet] Facet operation arguments in Facet model + * Gregoire Dupe (Mia-Software) - Bug 443682 - Access to the super facet + */ +package org.eclipse.modisco.facet.query.java.core.internal.evaluator; + +import org.eclipse.emf.ecore.EClass; +import org.eclipse.modisco.facet.efacet.core.IDerivedTypedElementManager; +import org.eclipse.modisco.facet.efacet.core.exception.DerivedTypedElementException; +import org.eclipse.modisco.facet.efacet.core.internal.query.QueryUtils; +import org.eclipse.modisco.facet.efacet.core.query.IQueryImplementation; +import org.eclipse.modisco.facet.efacet.core.query.IQueryImplementationFactory; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.extensible.Query; +import org.eclipse.modisco.facet.query.java.core.IJavaQuery2; +import org.eclipse.modisco.facet.query.java.core.IJavaQuery3; +import org.eclipse.modisco.facet.query.java.core.internal.plugin.Activator; +import org.eclipse.modisco.facet.query.java.metamodel.v0_2_0.javaquery.JavaQuery; +import org.eclipse.modisco.facet.query.java.metamodel.v0_2_0.javaquery.JavaQueryPackage; +import org.eclipse.modisco.facet.util.core.Logger; +import org.osgi.framework.Bundle; + +public class JavaQueryImplementationFactory implements IQueryImplementationFactory { + + public IQueryImplementation create(final Query query, final Bundle bundle, final IDerivedTypedElementManager manager) throws DerivedTypedElementException { + if (!(query instanceof JavaQuery)) { + throw new IllegalArgumentException("The given DerivedTypedElement does not have a JavaQuery"); //$NON-NLS-1$ + } + JavaQuery javaQuery = (JavaQuery) query; + + if (bundle == null) { + throw new DerivedTypedElementException("Java query implementation class '" //$NON-NLS-1$ + + javaQuery.getClass().getName() + + "' should be created within a bundle."); //$NON-NLS-1$ + } + JavaQueryImplementation javaQueryEvaluator = null; + try { + String className = javaQuery.getImplementationClassName(); + if (className == null || className.length() == 0) { + throw new DerivedTypedElementException("The Java query's implementationClassName must not be empty"); //$NON-NLS-1$ + } + Class<?> javaQueryClass = bundle.loadClass(className); + if (!IJavaQuery2.class.isAssignableFrom(javaQueryClass) + && !IJavaQuery3.class.isAssignableFrom(javaQueryClass)) { + final String message = String.format( + "Java query implementation class '%s' does not implement %s or %s.", //$NON-NLS-1$ + className, IJavaQuery2.class.getSimpleName(), + IJavaQuery3.class.getSimpleName()); + throw new Exception(message); + } + javaQueryEvaluator = createJavaQueryImpl(javaQueryClass); + // Initially a null test was performed on bundle to determine whether + // to check the result type. Now we need a bundle so + // checkResultType=true + javaQueryEvaluator.setCheckResultType(true); + } catch (Exception e) { + DerivedTypedElementException queryException = new DerivedTypedElementException( + "The bundle " + bundle.getSymbolicName() + " failed to load the java query: " //$NON-NLS-1$ //$NON-NLS-2$ + + QueryUtils.getQueryDescription(javaQuery), e); + Logger.logError(queryException, Activator.getDefault()); + throw queryException; + } + return javaQueryEvaluator; + } + + /** This method is dedicated to isolate the "Unchecked cast" warning. */ + @SuppressWarnings("unchecked") + private static JavaQueryImplementation createJavaQueryImpl(final Class<?> javaQueryClass) + throws InstantiationException, IllegalAccessException { + final Object query = javaQueryClass.newInstance(); + final JavaQueryImplementation javaQueryEvaluator = new JavaQueryImplementation(query); + return javaQueryEvaluator; + } + + public EClass getManagedQueryType() { + return JavaQueryPackage.eINSTANCE.getJavaQuery(); + } +}
diff --git a/org.eclipse.modisco.facet.query.java.core/src/org/eclipse/modisco/facet/query/java/core/internal/exceptions/ClassAlreadyExistsException.java b/org.eclipse.modisco.facet.query.java.core/src/org/eclipse/modisco/facet/query/java/core/internal/exceptions/ClassAlreadyExistsException.java new file mode 100644 index 0000000..8fd584f --- /dev/null +++ b/org.eclipse.modisco.facet.query.java.core/src/org/eclipse/modisco/facet/query/java/core/internal/exceptions/ClassAlreadyExistsException.java
@@ -0,0 +1,21 @@ +/******************************************************************************* + * Copyright (c) 2011 Mia-Software. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Nicolas Guyomar (Mia-Software) - Bug 349569 - Need new exceptions for java query class creation + *******************************************************************************/ +package org.eclipse.modisco.facet.query.java.core.internal.exceptions; + +/** + * This exception is raised whenever the class being created already exists. + * @since 0.2 + */ +public class ClassAlreadyExistsException extends Exception { + + private static final long serialVersionUID = -7352916272441579074L; + +} \ No newline at end of file
diff --git a/org.eclipse.modisco.facet.query.java.core/src/org/eclipse/modisco/facet/query/java/core/internal/exceptions/ResourceURIExpectedException.java b/org.eclipse.modisco.facet.query.java.core/src/org/eclipse/modisco/facet/query/java/core/internal/exceptions/ResourceURIExpectedException.java new file mode 100644 index 0000000..f50d5d4 --- /dev/null +++ b/org.eclipse.modisco.facet.query.java.core/src/org/eclipse/modisco/facet/query/java/core/internal/exceptions/ResourceURIExpectedException.java
@@ -0,0 +1,21 @@ +/******************************************************************************* + * Copyright (c) 2011 Mia-Software. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Nicolas Guyomar (Mia-Software) - Bug 349569 - Need new exceptions for java query class creation + *******************************************************************************/ +package org.eclipse.modisco.facet.query.java.core.internal.exceptions; + +/** + * This exception is raised whenever an URI is not a resource URI as expected + * @since 0.2 + */ +public class ResourceURIExpectedException extends Exception { + + private static final long serialVersionUID = 6891585699949077305L; + +}
diff --git a/org.eclipse.modisco.facet.query.java.core/src/org/eclipse/modisco/facet/query/java/core/internal/plugin/Activator.java b/org.eclipse.modisco.facet.query.java.core/src/org/eclipse/modisco/facet/query/java/core/internal/plugin/Activator.java new file mode 100644 index 0000000..08a30ca --- /dev/null +++ b/org.eclipse.modisco.facet.query.java.core/src/org/eclipse/modisco/facet/query/java/core/internal/plugin/Activator.java
@@ -0,0 +1,68 @@ +/** + * Copyright (c) 2011 Mia-Software. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Nicolas Guyomar (Mia-Software) - Bug 334615 - Java Query for EMF Facet + */ +package org.eclipse.modisco.facet.query.java.core.internal.plugin; + +import org.eclipse.ui.plugin.AbstractUIPlugin; +import org.osgi.framework.BundleContext; + +/** + * The activator class controls the plug-in life cycle + */ +public class Activator extends AbstractUIPlugin { + + // The plug-in ID + public static final String PLUGIN_ID = "org.eclipse.emf.facet.query.java.core"; //$NON-NLS-1$ + + // The shared instance + private static Activator plugin; + + /** + * The constructor + */ + public Activator() { + } + + /* + * (non-Javadoc) + * + * @see + * org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext + * ) + */ + @Override + public void start(final BundleContext context) throws Exception { + super.start(context); + Activator.plugin = this; + } + + /* + * (non-Javadoc) + * + * @see + * org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext + * ) + */ + @Override + public void stop(final BundleContext context) throws Exception { + Activator.plugin = null; + super.stop(context); + } + + /** + * Returns the shared instance + * + * @return the shared instance + */ + public static Activator getDefault() { + return Activator.plugin; + } + +}
diff --git a/org.eclipse.modisco.facet.query.java.metamodel/META-INF/MANIFEST.MF b/org.eclipse.modisco.facet.query.java.metamodel/META-INF/MANIFEST.MF index c199a49..c2d1baf 100644 --- a/org.eclipse.modisco.facet.query.java.metamodel/META-INF/MANIFEST.MF +++ b/org.eclipse.modisco.facet.query.java.metamodel/META-INF/MANIFEST.MF
@@ -3,13 +3,13 @@ Bundle-Name: %Bundle-Name Bundle-SymbolicName: org.eclipse.emf.facet.query.java.metamodel;singleton:=true Bundle-Version: 1.3.0.qualifier -Bundle-Activator: org.eclipse.emf.facet.query.java.metamodel.internal.Activator +Bundle-Activator: org.eclipse.modisco.facet.query.java.metamodel.internal.Activator Bundle-Vendor: %Bundle-Vendor Bundle-RequiredExecutionEnvironment: JavaSE-1.8 Bundle-ActivationPolicy: lazy -Export-Package: org.eclipse.emf.facet.query.java.metamodel.v0_2_0.javaquery, - org.eclipse.emf.facet.query.java.metamodel.v0_2_0.javaquery.impl;x-internal:=true, - org.eclipse.emf.facet.query.java.metamodel.v0_2_0.javaquery.util;x-internal:=true +Export-Package: org.eclipse.modisco.facet.query.java.metamodel.v0_2_0.javaquery, + org.eclipse.modisco.facet.query.java.metamodel.v0_2_0.javaquery.impl;x-internal:=true, + org.eclipse.modisco.facet.query.java.metamodel.v0_2_0.javaquery.util;x-internal:=true Require-Bundle: org.eclipse.core.runtime, org.eclipse.emf.ecore, org.eclipse.emf.facet.efacet.metamodel;bundle-version="0.2.0"
diff --git a/org.eclipse.modisco.facet.query.java.metamodel/plugin.xml b/org.eclipse.modisco.facet.query.java.metamodel/plugin.xml index a2ff788..40a5b9d 100644 --- a/org.eclipse.modisco.facet.query.java.metamodel/plugin.xml +++ b/org.eclipse.modisco.facet.query.java.metamodel/plugin.xml
@@ -4,13 +4,13 @@ <extension point="org.eclipse.emf.ecore.generated_package"> <package uri="http://www.eclipse.org/emf/facet/query/java/0.2.incubation/javaquery" - class="org.eclipse.emf.facet.query.java.metamodel.v0_2_0.javaquery.JavaQueryPackage" + class="org.eclipse.modisco.facet.query.java.metamodel.v0_2_0.javaquery.JavaQueryPackage" genModel="model/javaQuery-0.2.0.genmodel"/> </extension> <extension point="org.eclipse.emf.ecore.generated_package"> <package uri="http://www.eclipse.org/emf/facet/query/java/0.2.incubation" - class="org.eclipse.emf.facet.query.java.metamodel.v0_2_0.javaquery.JavaQueryPackage" + class="org.eclipse.modisco.facet.query.java.metamodel.v0_2_0.javaquery.JavaQueryPackage" genModel="model/javaQuery-0.2.0.genmodel"/> </extension> </plugin>
diff --git a/org.eclipse.modisco.facet.query.java.metamodel/src/org/eclipse/emf/facet/query/java/metamodel/internal/Activator.java b/org.eclipse.modisco.facet.query.java.metamodel/src/org/eclipse/emf/facet/query/java/metamodel/internal/Activator.java deleted file mode 100644 index b903b4b..0000000 --- a/org.eclipse.modisco.facet.query.java.metamodel/src/org/eclipse/emf/facet/query/java/metamodel/internal/Activator.java +++ /dev/null
@@ -1,35 +0,0 @@ -package org.eclipse.emf.facet.query.java.metamodel.internal; - -import org.eclipse.core.runtime.Plugin; -import org.osgi.framework.BundleContext; - -/** The activator class controls the plug-in life cycle */ -public class Activator extends Plugin { - - // The plug-in ID - public static final String PLUGIN_ID = "org.eclipse.emf.facet.query.java.metamodel"; //$NON-NLS-1$ - - // The shared instance - private static Activator plugin; - - @Override - public void start(final BundleContext context) throws Exception { - super.start(context); - Activator.plugin = this; - } - - @Override - public void stop(final BundleContext context) throws Exception { - Activator.plugin = null; - super.stop(context); - } - - /** - * Returns the shared instance - * - * @return the shared instance - */ - public static Activator getDefault() { - return Activator.plugin; - } -}
diff --git a/org.eclipse.modisco.facet.query.java.metamodel/src/org/eclipse/emf/facet/query/java/metamodel/v0_2_0/javaquery/JavaQuery.java b/org.eclipse.modisco.facet.query.java.metamodel/src/org/eclipse/emf/facet/query/java/metamodel/v0_2_0/javaquery/JavaQuery.java deleted file mode 100644 index 4271f17..0000000 --- a/org.eclipse.modisco.facet.query.java.metamodel/src/org/eclipse/emf/facet/query/java/metamodel/v0_2_0/javaquery/JavaQuery.java +++ /dev/null
@@ -1,61 +0,0 @@ -/** - * Copyright (c) 2011 Mia-Software. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Nicolas Guyomar (Mia-Software) - Bug 334615 - Java Query for EMF Facet - * Emmanuelle Rouillé (Mia-Software) - Bug 352618 - To be able to use non derived facet structural features and save them values. - * - */ -package org.eclipse.emf.facet.query.java.metamodel.v0_2_0.javaquery; - -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.extensible.Query; - -/** - * <!-- begin-user-doc --> - * A representation of the model object '<em><b>Java Query</b></em>'. - * <!-- end-user-doc --> - * - * <p> - * The following features are supported: - * <ul> - * <li>{@link org.eclipse.emf.facet.query.java.metamodel.v0_2_0.javaquery.JavaQuery#getImplementationClassName <em>Implementation Class Name</em>}</li> - * </ul> - * </p> - * - * @see org.eclipse.emf.facet.query.java.metamodel.v0_2_0.javaquery.JavaQueryPackage#getJavaQuery() - * @model - * @generated - */ -public interface JavaQuery extends Query { - /** - * Returns the value of the '<em><b>Implementation Class Name</b></em>' attribute. - * <!-- begin-user-doc --> - * <p> - * If the meaning of the '<em>Implementation Class Name</em>' attribute isn't clear, - * there really should be more of a description here... - * </p> - * <!-- end-user-doc --> - * @return the value of the '<em>Implementation Class Name</em>' attribute. - * @see #setImplementationClassName(String) - * @see org.eclipse.emf.facet.query.java.metamodel.v0_2_0.javaquery.JavaQueryPackage#getJavaQuery_ImplementationClassName() - * @model - * @generated - */ - String getImplementationClassName(); - - /** - * Sets the value of the '{@link org.eclipse.emf.facet.query.java.metamodel.v0_2_0.javaquery.JavaQuery#getImplementationClassName <em>Implementation Class Name</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @param value the new value of the '<em>Implementation Class Name</em>' attribute. - * @see #getImplementationClassName() - * @generated - */ - void setImplementationClassName(String value); - -} // JavaQuery
diff --git a/org.eclipse.modisco.facet.query.java.metamodel/src/org/eclipse/emf/facet/query/java/metamodel/v0_2_0/javaquery/JavaQueryFactory.java b/org.eclipse.modisco.facet.query.java.metamodel/src/org/eclipse/emf/facet/query/java/metamodel/v0_2_0/javaquery/JavaQueryFactory.java deleted file mode 100644 index 433c1b9..0000000 --- a/org.eclipse.modisco.facet.query.java.metamodel/src/org/eclipse/emf/facet/query/java/metamodel/v0_2_0/javaquery/JavaQueryFactory.java +++ /dev/null
@@ -1,56 +0,0 @@ -/** - * Copyright (c) 2011 Mia-Software. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Nicolas Guyomar (Mia-Software) - Bug 334615 - Java Query for EMF Facet - * Emmanuelle Rouillé (Mia-Software) - Bug 352618 - To be able to use non derived facet structural features and save them values. - * - */ -package org.eclipse.emf.facet.query.java.metamodel.v0_2_0.javaquery; - -import org.eclipse.emf.ecore.EFactory; - -/** - * <!-- begin-user-doc --> - * The <b>Factory</b> for the model. - * It provides a create method for each non-abstract class of the model. - * <!-- end-user-doc --> - * - * @see org.eclipse.emf.facet.query.java.metamodel.v0_2_0.javaquery.JavaQueryPackage - * @generated - * @noextend This interface is not intended to be extended by clients. - * @noimplement This interface is not intended to be implemented by clients. - */ -public interface JavaQueryFactory extends EFactory { - /** - * The singleton instance of the factory. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - JavaQueryFactory eINSTANCE = org.eclipse.emf.facet.query.java.metamodel.v0_2_0.javaquery.impl.JavaQueryFactoryImpl.init(); - - /** - * Returns a new object of class '<em>Java Query</em>'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return a new object of class '<em>Java Query</em>'. - * @generated - */ - JavaQuery createJavaQuery(); - - /** - * Returns the package supported by this factory. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the package supported by this factory. - * @generated - */ - JavaQueryPackage getJavaQueryPackage(); - -} //JavaQueryFactory
diff --git a/org.eclipse.modisco.facet.query.java.metamodel/src/org/eclipse/emf/facet/query/java/metamodel/v0_2_0/javaquery/JavaQueryPackage.java b/org.eclipse.modisco.facet.query.java.metamodel/src/org/eclipse/emf/facet/query/java/metamodel/v0_2_0/javaquery/JavaQueryPackage.java deleted file mode 100644 index f436191..0000000 --- a/org.eclipse.modisco.facet.query.java.metamodel/src/org/eclipse/emf/facet/query/java/metamodel/v0_2_0/javaquery/JavaQueryPackage.java +++ /dev/null
@@ -1,182 +0,0 @@ -/** - * Copyright (c) 2011 Mia-Software. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Nicolas Guyomar (Mia-Software) - Bug 334615 - Java Query for EMF Facet - * Emmanuelle Rouillé (Mia-Software) - Bug 352618 - To be able to use non derived facet structural features and save them values. - * - */ -package org.eclipse.emf.facet.query.java.metamodel.v0_2_0.javaquery; - -import org.eclipse.emf.ecore.EAttribute; -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.ecore.EPackage; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.extensible.ExtensiblePackage; - -/** - * <!-- begin-user-doc --> - * The <b>Package</b> for the model. - * It contains accessors for the meta objects to represent - * <ul> - * <li>each class,</li> - * <li>each feature of each class,</li> - * <li>each enum,</li> - * <li>and each data type</li> - * </ul> - * <!-- end-user-doc --> - * - * @see org.eclipse.emf.facet.query.java.metamodel.v0_2_0.javaquery.JavaQueryFactory - * @model kind="package" - * @generated - * @noextend This interface is not intended to be extended by clients. - * @noimplement This interface is not intended to be implemented by clients. - */ -public interface JavaQueryPackage extends EPackage { - /** - * The package name. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - String eNAME = "javaquery"; //$NON-NLS-1$ - - /** - * The package namespace URI. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - String eNS_URI = "http://www.eclipse.org/emf/facet/query/java/0.2.incubation/javaquery"; //$NON-NLS-1$ - - /** - * The package namespace name. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - String eNS_PREFIX = "javaQuery"; //$NON-NLS-1$ - - /** - * The singleton instance of the package. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - JavaQueryPackage eINSTANCE = org.eclipse.emf.facet.query.java.metamodel.v0_2_0.javaquery.impl.JavaQueryPackageImpl.init(); - - /** - * The meta object id for the '{@link org.eclipse.emf.facet.query.java.metamodel.v0_2_0.javaquery.impl.JavaQueryImpl <em>Java Query</em>}' class. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see org.eclipse.emf.facet.query.java.metamodel.v0_2_0.javaquery.impl.JavaQueryImpl - * @see org.eclipse.emf.facet.query.java.metamodel.v0_2_0.javaquery.impl.JavaQueryPackageImpl#getJavaQuery() - * @generated - */ - int JAVA_QUERY = 0; - - /** - * The feature id for the '<em><b>Can Have Side Effects</b></em>' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int JAVA_QUERY__CAN_HAVE_SIDE_EFFECTS = ExtensiblePackage.QUERY__CAN_HAVE_SIDE_EFFECTS; - - /** - * The feature id for the '<em><b>Can Be Cached</b></em>' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int JAVA_QUERY__CAN_BE_CACHED = ExtensiblePackage.QUERY__CAN_BE_CACHED; - - /** - * The feature id for the '<em><b>Implementation Class Name</b></em>' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int JAVA_QUERY__IMPLEMENTATION_CLASS_NAME = ExtensiblePackage.QUERY_FEATURE_COUNT + 0; - - /** - * The number of structural features of the '<em>Java Query</em>' class. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int JAVA_QUERY_FEATURE_COUNT = ExtensiblePackage.QUERY_FEATURE_COUNT + 1; - - - /** - * Returns the meta object for class '{@link org.eclipse.emf.facet.query.java.metamodel.v0_2_0.javaquery.JavaQuery <em>Java Query</em>}'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the meta object for class '<em>Java Query</em>'. - * @see org.eclipse.emf.facet.query.java.metamodel.v0_2_0.javaquery.JavaQuery - * @generated - */ - EClass getJavaQuery(); - - /** - * Returns the meta object for the attribute '{@link org.eclipse.emf.facet.query.java.metamodel.v0_2_0.javaquery.JavaQuery#getImplementationClassName <em>Implementation Class Name</em>}'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the meta object for the attribute '<em>Implementation Class Name</em>'. - * @see org.eclipse.emf.facet.query.java.metamodel.v0_2_0.javaquery.JavaQuery#getImplementationClassName() - * @see #getJavaQuery() - * @generated - */ - EAttribute getJavaQuery_ImplementationClassName(); - - /** - * Returns the factory that creates the instances of the model. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the factory that creates the instances of the model. - * @generated - */ - JavaQueryFactory getJavaQueryFactory(); - - /** - * <!-- begin-user-doc --> - * Defines literals for the meta objects that represent - * <ul> - * <li>each class,</li> - * <li>each feature of each class,</li> - * <li>each enum,</li> - * <li>and each data type</li> - * </ul> - * <!-- end-user-doc --> - * @generated - */ - interface Literals { - /** - * The meta object literal for the '{@link org.eclipse.emf.facet.query.java.metamodel.v0_2_0.javaquery.impl.JavaQueryImpl <em>Java Query</em>}' class. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see org.eclipse.emf.facet.query.java.metamodel.v0_2_0.javaquery.impl.JavaQueryImpl - * @see org.eclipse.emf.facet.query.java.metamodel.v0_2_0.javaquery.impl.JavaQueryPackageImpl#getJavaQuery() - * @generated - */ - EClass JAVA_QUERY = eINSTANCE.getJavaQuery(); - - /** - * The meta object literal for the '<em><b>Implementation Class Name</b></em>' attribute feature. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - EAttribute JAVA_QUERY__IMPLEMENTATION_CLASS_NAME = eINSTANCE.getJavaQuery_ImplementationClassName(); - - } - -} //JavaQueryPackage
diff --git a/org.eclipse.modisco.facet.query.java.metamodel/src/org/eclipse/emf/facet/query/java/metamodel/v0_2_0/javaquery/impl/JavaQueryFactoryImpl.java b/org.eclipse.modisco.facet.query.java.metamodel/src/org/eclipse/emf/facet/query/java/metamodel/v0_2_0/javaquery/impl/JavaQueryFactoryImpl.java deleted file mode 100644 index 1e39ecb..0000000 --- a/org.eclipse.modisco.facet.query.java.metamodel/src/org/eclipse/emf/facet/query/java/metamodel/v0_2_0/javaquery/impl/JavaQueryFactoryImpl.java +++ /dev/null
@@ -1,106 +0,0 @@ -/** - * Copyright (c) 2011 Mia-Software. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Nicolas Guyomar (Mia-Software) - Bug 334615 - Java Query for EMF Facet - * Emmanuelle Rouillé (Mia-Software) - Bug 352618 - To be able to use non derived facet structural features and save them values. - * - */ -package org.eclipse.emf.facet.query.java.metamodel.v0_2_0.javaquery.impl; - -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.EPackage; - -import org.eclipse.emf.ecore.impl.EFactoryImpl; - -import org.eclipse.emf.ecore.plugin.EcorePlugin; - -import org.eclipse.emf.facet.query.java.metamodel.v0_2_0.javaquery.*; - -/** - * <!-- begin-user-doc --> - * An implementation of the model <b>Factory</b>. - * <!-- end-user-doc --> - * @generated - */ -public class JavaQueryFactoryImpl extends EFactoryImpl implements JavaQueryFactory { - /** - * Creates the default factory implementation. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public static JavaQueryFactory init() { - try { - JavaQueryFactory theJavaQueryFactory = (JavaQueryFactory)EPackage.Registry.INSTANCE.getEFactory("http://www.eclipse.org/emf/facet/query/java/0.2.incubation/javaquery"); //$NON-NLS-1$ - if (theJavaQueryFactory != null) { - return theJavaQueryFactory; - } - } - catch (Exception exception) { - EcorePlugin.INSTANCE.log(exception); - } - return new JavaQueryFactoryImpl(); - } - - /** - * Creates an instance of the factory. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public JavaQueryFactoryImpl() { - super(); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public EObject create(EClass eClass) { - switch (eClass.getClassifierID()) { - case JavaQueryPackage.JAVA_QUERY: return createJavaQuery(); - default: - throw new IllegalArgumentException("The class '" + eClass.getName() + "' is not a valid classifier"); //$NON-NLS-1$ //$NON-NLS-2$ - } - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public JavaQuery createJavaQuery() { - JavaQueryImpl javaQuery = new JavaQueryImpl(); - return javaQuery; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public JavaQueryPackage getJavaQueryPackage() { - return (JavaQueryPackage)getEPackage(); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @deprecated - * @generated - */ - @Deprecated - public static JavaQueryPackage getPackage() { - return JavaQueryPackage.eINSTANCE; - } - -} //JavaQueryFactoryImpl
diff --git a/org.eclipse.modisco.facet.query.java.metamodel/src/org/eclipse/emf/facet/query/java/metamodel/v0_2_0/javaquery/impl/JavaQueryImpl.java b/org.eclipse.modisco.facet.query.java.metamodel/src/org/eclipse/emf/facet/query/java/metamodel/v0_2_0/javaquery/impl/JavaQueryImpl.java deleted file mode 100644 index 6f1cd8a..0000000 --- a/org.eclipse.modisco.facet.query.java.metamodel/src/org/eclipse/emf/facet/query/java/metamodel/v0_2_0/javaquery/impl/JavaQueryImpl.java +++ /dev/null
@@ -1,175 +0,0 @@ -/** - * Copyright (c) 2011 Mia-Software. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Nicolas Guyomar (Mia-Software) - Bug 334615 - Java Query for EMF Facet - * Emmanuelle Rouillé (Mia-Software) - Bug 352618 - To be able to use non derived facet structural features and save them values. - * - */ -package org.eclipse.emf.facet.query.java.metamodel.v0_2_0.javaquery.impl; - -import org.eclipse.emf.common.notify.Notification; - -import org.eclipse.emf.ecore.EClass; - -import org.eclipse.emf.ecore.impl.ENotificationImpl; - -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.extensible.impl.QueryImpl; - -import org.eclipse.emf.facet.query.java.metamodel.v0_2_0.javaquery.JavaQuery; -import org.eclipse.emf.facet.query.java.metamodel.v0_2_0.javaquery.JavaQueryPackage; - -/** - * <!-- begin-user-doc --> - * An implementation of the model object '<em><b>Java Query</b></em>'. - * <!-- end-user-doc --> - * <p> - * The following features are implemented: - * <ul> - * <li>{@link org.eclipse.emf.facet.query.java.metamodel.v0_2_0.javaquery.impl.JavaQueryImpl#getImplementationClassName <em>Implementation Class Name</em>}</li> - * </ul> - * </p> - * - * @generated - */ -public class JavaQueryImpl extends QueryImpl implements JavaQuery { - /** - * The default value of the '{@link #getImplementationClassName() <em>Implementation Class Name</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #getImplementationClassName() - * @generated - * @ordered - */ - protected static final String IMPLEMENTATION_CLASS_NAME_EDEFAULT = null; - - /** - * The cached value of the '{@link #getImplementationClassName() <em>Implementation Class Name</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #getImplementationClassName() - * @generated - * @ordered - */ - protected String implementationClassName = IMPLEMENTATION_CLASS_NAME_EDEFAULT; - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected JavaQueryImpl() { - super(); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - protected EClass eStaticClass() { - return JavaQueryPackage.Literals.JAVA_QUERY; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public String getImplementationClassName() { - return implementationClassName; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public void setImplementationClassName(String newImplementationClassName) { - String oldImplementationClassName = implementationClassName; - implementationClassName = newImplementationClassName; - if (eNotificationRequired()) - eNotify(new ENotificationImpl(this, Notification.SET, JavaQueryPackage.JAVA_QUERY__IMPLEMENTATION_CLASS_NAME, oldImplementationClassName, implementationClassName)); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public Object eGet(int featureID, boolean resolve, boolean coreType) { - switch (featureID) { - case JavaQueryPackage.JAVA_QUERY__IMPLEMENTATION_CLASS_NAME: - return getImplementationClassName(); - } - return super.eGet(featureID, resolve, coreType); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public void eSet(int featureID, Object newValue) { - switch (featureID) { - case JavaQueryPackage.JAVA_QUERY__IMPLEMENTATION_CLASS_NAME: - setImplementationClassName((String)newValue); - return; - } - super.eSet(featureID, newValue); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public void eUnset(int featureID) { - switch (featureID) { - case JavaQueryPackage.JAVA_QUERY__IMPLEMENTATION_CLASS_NAME: - setImplementationClassName(IMPLEMENTATION_CLASS_NAME_EDEFAULT); - return; - } - super.eUnset(featureID); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public boolean eIsSet(int featureID) { - switch (featureID) { - case JavaQueryPackage.JAVA_QUERY__IMPLEMENTATION_CLASS_NAME: - return IMPLEMENTATION_CLASS_NAME_EDEFAULT == null ? implementationClassName != null : !IMPLEMENTATION_CLASS_NAME_EDEFAULT.equals(implementationClassName); - } - return super.eIsSet(featureID); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public String toString() { - if (eIsProxy()) return super.toString(); - - StringBuffer result = new StringBuffer(super.toString()); - result.append(" (implementationClassName: "); //$NON-NLS-1$ - result.append(implementationClassName); - result.append(')'); - return result.toString(); - } - -} //JavaQueryImpl
diff --git a/org.eclipse.modisco.facet.query.java.metamodel/src/org/eclipse/emf/facet/query/java/metamodel/v0_2_0/javaquery/impl/JavaQueryPackageImpl.java b/org.eclipse.modisco.facet.query.java.metamodel/src/org/eclipse/emf/facet/query/java/metamodel/v0_2_0/javaquery/impl/JavaQueryPackageImpl.java deleted file mode 100644 index 7498699..0000000 --- a/org.eclipse.modisco.facet.query.java.metamodel/src/org/eclipse/emf/facet/query/java/metamodel/v0_2_0/javaquery/impl/JavaQueryPackageImpl.java +++ /dev/null
@@ -1,199 +0,0 @@ -/** - * Copyright (c) 2011 Mia-Software. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Nicolas Guyomar (Mia-Software) - Bug 334615 - Java Query for EMF Facet - * Emmanuelle Rouillé (Mia-Software) - Bug 352618 - To be able to use non derived facet structural features and save them values. - * - */ -package org.eclipse.emf.facet.query.java.metamodel.v0_2_0.javaquery.impl; - -import org.eclipse.emf.ecore.EAttribute; -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.ecore.EPackage; - -import org.eclipse.emf.ecore.impl.EPackageImpl; - -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.EFacetPackage; - -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.extensible.ExtensiblePackage; - -import org.eclipse.emf.facet.query.java.metamodel.v0_2_0.javaquery.JavaQuery; -import org.eclipse.emf.facet.query.java.metamodel.v0_2_0.javaquery.JavaQueryFactory; -import org.eclipse.emf.facet.query.java.metamodel.v0_2_0.javaquery.JavaQueryPackage; - -/** - * <!-- begin-user-doc --> - * An implementation of the model <b>Package</b>. - * <!-- end-user-doc --> - * @generated - */ -public class JavaQueryPackageImpl extends EPackageImpl implements JavaQueryPackage { - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - private EClass javaQueryEClass = null; - - /** - * Creates an instance of the model <b>Package</b>, registered with - * {@link org.eclipse.emf.ecore.EPackage.Registry EPackage.Registry} by the package - * package URI value. - * <p>Note: the correct way to create the package is via the static - * factory method {@link #init init()}, which also performs - * initialization of the package, or returns the registered package, - * if one already exists. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see org.eclipse.emf.ecore.EPackage.Registry - * @see org.eclipse.emf.facet.query.java.metamodel.v0_2_0.javaquery.JavaQueryPackage#eNS_URI - * @see #init() - * @generated - */ - private JavaQueryPackageImpl() { - super(eNS_URI, JavaQueryFactory.eINSTANCE); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - private static boolean isInited = false; - - /** - * Creates, registers, and initializes the <b>Package</b> for this model, and for any others upon which it depends. - * - * <p>This method is used to initialize {@link JavaQueryPackage#eINSTANCE} when that field is accessed. - * Clients should not invoke it directly. Instead, they should simply access that field to obtain the package. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #eNS_URI - * @see #createPackageContents() - * @see #initializePackageContents() - * @generated - */ - public static JavaQueryPackage init() { - if (isInited) return (JavaQueryPackage)EPackage.Registry.INSTANCE.getEPackage(JavaQueryPackage.eNS_URI); - - // Obtain or create and register package - JavaQueryPackageImpl theJavaQueryPackage = (JavaQueryPackageImpl)(EPackage.Registry.INSTANCE.get(eNS_URI) instanceof JavaQueryPackageImpl ? EPackage.Registry.INSTANCE.get(eNS_URI) : new JavaQueryPackageImpl()); - - isInited = true; - - // Initialize simple dependencies - EFacetPackage.eINSTANCE.eClass(); - - // Create package meta-data objects - theJavaQueryPackage.createPackageContents(); - - // Initialize created meta-data - theJavaQueryPackage.initializePackageContents(); - - // Mark meta-data to indicate it can't be changed - theJavaQueryPackage.freeze(); - - - // Update the registry and return the package - EPackage.Registry.INSTANCE.put(JavaQueryPackage.eNS_URI, theJavaQueryPackage); - return theJavaQueryPackage; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EClass getJavaQuery() { - return javaQueryEClass; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EAttribute getJavaQuery_ImplementationClassName() { - return (EAttribute)javaQueryEClass.getEStructuralFeatures().get(0); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public JavaQueryFactory getJavaQueryFactory() { - return (JavaQueryFactory)getEFactoryInstance(); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - private boolean isCreated = false; - - /** - * Creates the meta-model objects for the package. This method is - * guarded to have no affect on any invocation but its first. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public void createPackageContents() { - if (isCreated) return; - isCreated = true; - - // Create classes and their features - javaQueryEClass = createEClass(JAVA_QUERY); - createEAttribute(javaQueryEClass, JAVA_QUERY__IMPLEMENTATION_CLASS_NAME); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - private boolean isInitialized = false; - - /** - * Complete the initialization of the package and its meta-model. This - * method is guarded to have no affect on any invocation but its first. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public void initializePackageContents() { - if (isInitialized) return; - isInitialized = true; - - // Initialize package - setName(eNAME); - setNsPrefix(eNS_PREFIX); - setNsURI(eNS_URI); - - // Obtain other dependent packages - ExtensiblePackage theExtensiblePackage = (ExtensiblePackage)EPackage.Registry.INSTANCE.getEPackage(ExtensiblePackage.eNS_URI); - - // Create type parameters - - // Set bounds for type parameters - - // Add supertypes to classes - javaQueryEClass.getESuperTypes().add(theExtensiblePackage.getQuery()); - - // Initialize classes and features; add operations and parameters - initEClass(javaQueryEClass, JavaQuery.class, "JavaQuery", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); //$NON-NLS-1$ - initEAttribute(getJavaQuery_ImplementationClassName(), ecorePackage.getEString(), "implementationClassName", null, 0, 1, JavaQuery.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); //$NON-NLS-1$ - - // Create resource - createResource(eNS_URI); - } - -} //JavaQueryPackageImpl
diff --git a/org.eclipse.modisco.facet.query.java.metamodel/src/org/eclipse/emf/facet/query/java/metamodel/v0_2_0/javaquery/util/JavaQueryAdapterFactory.java b/org.eclipse.modisco.facet.query.java.metamodel/src/org/eclipse/emf/facet/query/java/metamodel/v0_2_0/javaquery/util/JavaQueryAdapterFactory.java deleted file mode 100644 index c3bfbf7..0000000 --- a/org.eclipse.modisco.facet.query.java.metamodel/src/org/eclipse/emf/facet/query/java/metamodel/v0_2_0/javaquery/util/JavaQueryAdapterFactory.java +++ /dev/null
@@ -1,151 +0,0 @@ -/** - * Copyright (c) 2011 Mia-Software. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Nicolas Guyomar (Mia-Software) - Bug 334615 - Java Query for EMF Facet - * Emmanuelle Rouillé (Mia-Software) - Bug 352618 - To be able to use non derived facet structural features and save them values. - * - */ -package org.eclipse.emf.facet.query.java.metamodel.v0_2_0.javaquery.util; - -import org.eclipse.emf.common.notify.Adapter; -import org.eclipse.emf.common.notify.Notifier; - -import org.eclipse.emf.common.notify.impl.AdapterFactoryImpl; - -import org.eclipse.emf.ecore.EObject; - -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.extensible.Query; - -import org.eclipse.emf.facet.query.java.metamodel.v0_2_0.javaquery.*; - -/** - * <!-- begin-user-doc --> - * The <b>Adapter Factory</b> for the model. - * It provides an adapter <code>createXXX</code> method for each class of the model. - * <!-- end-user-doc --> - * @see org.eclipse.emf.facet.query.java.metamodel.v0_2_0.javaquery.JavaQueryPackage - * @generated - */ -public class JavaQueryAdapterFactory extends AdapterFactoryImpl { - /** - * The cached model package. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected static JavaQueryPackage modelPackage; - - /** - * Creates an instance of the adapter factory. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public JavaQueryAdapterFactory() { - if (modelPackage == null) { - modelPackage = JavaQueryPackage.eINSTANCE; - } - } - - /** - * Returns whether this factory is applicable for the type of the object. - * <!-- begin-user-doc --> - * This implementation returns <code>true</code> if the object is either the model's package or is an instance object of the model. - * <!-- end-user-doc --> - * @return whether this factory is applicable for the type of the object. - * @generated - */ - @Override - public boolean isFactoryForType(Object object) { - if (object == modelPackage) { - return true; - } - if (object instanceof EObject) { - return ((EObject)object).eClass().getEPackage() == modelPackage; - } - return false; - } - - /** - * The switch that delegates to the <code>createXXX</code> methods. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected JavaQuerySwitch<Adapter> modelSwitch = - new JavaQuerySwitch<Adapter>() { - @Override - public Adapter caseJavaQuery(JavaQuery object) { - return createJavaQueryAdapter(); - } - @Override - public Adapter caseQuery(Query object) { - return createQueryAdapter(); - } - @Override - public Adapter defaultCase(EObject object) { - return createEObjectAdapter(); - } - }; - - /** - * Creates an adapter for the <code>target</code>. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @param target the object to adapt. - * @return the adapter for the <code>target</code>. - * @generated - */ - @Override - public Adapter createAdapter(Notifier target) { - return modelSwitch.doSwitch((EObject)target); - } - - - /** - * Creates a new adapter for an object of class '{@link org.eclipse.emf.facet.query.java.metamodel.v0_2_0.javaquery.JavaQuery <em>Java Query</em>}'. - * <!-- begin-user-doc --> - * This default implementation returns null so that we can easily ignore cases; - * it's useful to ignore a case when inheritance will catch all the cases anyway. - * <!-- end-user-doc --> - * @return the new adapter. - * @see org.eclipse.emf.facet.query.java.metamodel.v0_2_0.javaquery.JavaQuery - * @generated - */ - public Adapter createJavaQueryAdapter() { - return null; - } - - /** - * Creates a new adapter for an object of class '{@link org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.extensible.Query <em>Query</em>}'. - * <!-- begin-user-doc --> - * This default implementation returns null so that we can easily ignore cases; - * it's useful to ignore a case when inheritance will catch all the cases anyway. - * <!-- end-user-doc --> - * @return the new adapter. - * @see org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.extensible.Query - * @generated - */ - public Adapter createQueryAdapter() { - return null; - } - - /** - * Creates a new adapter for the default case. - * <!-- begin-user-doc --> - * This default implementation returns null. - * <!-- end-user-doc --> - * @return the new adapter. - * @generated - */ - public Adapter createEObjectAdapter() { - return null; - } - -} //JavaQueryAdapterFactory
diff --git a/org.eclipse.modisco.facet.query.java.metamodel/src/org/eclipse/emf/facet/query/java/metamodel/v0_2_0/javaquery/util/JavaQuerySwitch.java b/org.eclipse.modisco.facet.query.java.metamodel/src/org/eclipse/emf/facet/query/java/metamodel/v0_2_0/javaquery/util/JavaQuerySwitch.java deleted file mode 100644 index 4381f16..0000000 --- a/org.eclipse.modisco.facet.query.java.metamodel/src/org/eclipse/emf/facet/query/java/metamodel/v0_2_0/javaquery/util/JavaQuerySwitch.java +++ /dev/null
@@ -1,155 +0,0 @@ -/** - * Copyright (c) 2011 Mia-Software. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Nicolas Guyomar (Mia-Software) - Bug 334615 - Java Query for EMF Facet - * Emmanuelle Rouillé (Mia-Software) - Bug 352618 - To be able to use non derived facet structural features and save them values. - * - */ -package org.eclipse.emf.facet.query.java.metamodel.v0_2_0.javaquery.util; - -import java.util.List; - -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.ecore.EObject; - -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.extensible.Query; - -import org.eclipse.emf.facet.query.java.metamodel.v0_2_0.javaquery.*; - -/** - * <!-- begin-user-doc --> - * The <b>Switch</b> for the model's inheritance hierarchy. - * It supports the call {@link #doSwitch(EObject) doSwitch(object)} - * to invoke the <code>caseXXX</code> method for each class of the model, - * starting with the actual class of the object - * and proceeding up the inheritance hierarchy - * until a non-null result is returned, - * which is the result of the switch. - * <!-- end-user-doc --> - * @see org.eclipse.emf.facet.query.java.metamodel.v0_2_0.javaquery.JavaQueryPackage - * @generated - */ -public class JavaQuerySwitch<T> { - /** - * The cached model package - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected static JavaQueryPackage modelPackage; - - /** - * Creates an instance of the switch. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public JavaQuerySwitch() { - if (modelPackage == null) { - modelPackage = JavaQueryPackage.eINSTANCE; - } - } - - /** - * Calls <code>caseXXX</code> for each class of the model until one returns a non null result; it yields that result. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the first non-null result returned by a <code>caseXXX</code> call. - * @generated - */ - public T doSwitch(EObject theEObject) { - return doSwitch(theEObject.eClass(), theEObject); - } - - /** - * Calls <code>caseXXX</code> for each class of the model until one returns a non null result; it yields that result. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the first non-null result returned by a <code>caseXXX</code> call. - * @generated - */ - protected T doSwitch(EClass theEClass, EObject theEObject) { - if (theEClass.eContainer() == modelPackage) { - return doSwitch(theEClass.getClassifierID(), theEObject); - } - else { - List<EClass> eSuperTypes = theEClass.getESuperTypes(); - return - eSuperTypes.isEmpty() ? - defaultCase(theEObject) : - doSwitch(eSuperTypes.get(0), theEObject); - } - } - - /** - * Calls <code>caseXXX</code> for each class of the model until one returns a non null result; it yields that result. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the first non-null result returned by a <code>caseXXX</code> call. - * @generated - */ - protected T doSwitch(int classifierID, EObject theEObject) { - switch (classifierID) { - case JavaQueryPackage.JAVA_QUERY: { - JavaQuery javaQuery = (JavaQuery)theEObject; - T result = caseJavaQuery(javaQuery); - if (result == null) result = caseQuery(javaQuery); - if (result == null) result = defaultCase(theEObject); - return result; - } - default: return defaultCase(theEObject); - } - } - - /** - * Returns the result of interpreting the object as an instance of '<em>Java Query</em>'. - * <!-- begin-user-doc --> - * This implementation returns null; - * returning a non-null result will terminate the switch. - * <!-- end-user-doc --> - * @param object the target of the switch. - * @return the result of interpreting the object as an instance of '<em>Java Query</em>'. - * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) - * @generated - */ - public T caseJavaQuery(JavaQuery object) { - return null; - } - - /** - * Returns the result of interpreting the object as an instance of '<em>Query</em>'. - * <!-- begin-user-doc --> - * This implementation returns null; - * returning a non-null result will terminate the switch. - * <!-- end-user-doc --> - * @param object the target of the switch. - * @return the result of interpreting the object as an instance of '<em>Query</em>'. - * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) - * @generated - */ - public T caseQuery(Query object) { - return null; - } - - /** - * Returns the result of interpreting the object as an instance of '<em>EObject</em>'. - * <!-- begin-user-doc --> - * This implementation returns null; - * returning a non-null result will terminate the switch, but this is the last case anyway. - * <!-- end-user-doc --> - * @param object the target of the switch. - * @return the result of interpreting the object as an instance of '<em>EObject</em>'. - * @see #doSwitch(org.eclipse.emf.ecore.EObject) - * @generated - */ - public T defaultCase(EObject object) { - return null; - } - -} //JavaQuerySwitch
diff --git a/org.eclipse.modisco.facet.query.java.metamodel/src/org/eclipse/modisco/facet/query/java/metamodel/internal/Activator.java b/org.eclipse.modisco.facet.query.java.metamodel/src/org/eclipse/modisco/facet/query/java/metamodel/internal/Activator.java new file mode 100644 index 0000000..2b00b56 --- /dev/null +++ b/org.eclipse.modisco.facet.query.java.metamodel/src/org/eclipse/modisco/facet/query/java/metamodel/internal/Activator.java
@@ -0,0 +1,35 @@ +package org.eclipse.modisco.facet.query.java.metamodel.internal; + +import org.eclipse.core.runtime.Plugin; +import org.osgi.framework.BundleContext; + +/** The activator class controls the plug-in life cycle */ +public class Activator extends Plugin { + + // The plug-in ID + public static final String PLUGIN_ID = "org.eclipse.emf.facet.query.java.metamodel"; //$NON-NLS-1$ + + // The shared instance + private static Activator plugin; + + @Override + public void start(final BundleContext context) throws Exception { + super.start(context); + Activator.plugin = this; + } + + @Override + public void stop(final BundleContext context) throws Exception { + Activator.plugin = null; + super.stop(context); + } + + /** + * Returns the shared instance + * + * @return the shared instance + */ + public static Activator getDefault() { + return Activator.plugin; + } +}
diff --git a/org.eclipse.modisco.facet.query.java.metamodel/src/org/eclipse/modisco/facet/query/java/metamodel/v0_2_0/javaquery/JavaQuery.java b/org.eclipse.modisco.facet.query.java.metamodel/src/org/eclipse/modisco/facet/query/java/metamodel/v0_2_0/javaquery/JavaQuery.java new file mode 100644 index 0000000..1e07b87 --- /dev/null +++ b/org.eclipse.modisco.facet.query.java.metamodel/src/org/eclipse/modisco/facet/query/java/metamodel/v0_2_0/javaquery/JavaQuery.java
@@ -0,0 +1,61 @@ +/** + * Copyright (c) 2011 Mia-Software. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Nicolas Guyomar (Mia-Software) - Bug 334615 - Java Query for EMF Facet + * Emmanuelle Rouillé (Mia-Software) - Bug 352618 - To be able to use non derived facet structural features and save them values. + * + */ +package org.eclipse.modisco.facet.query.java.metamodel.v0_2_0.javaquery; + +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.extensible.Query; + +/** + * <!-- begin-user-doc --> + * A representation of the model object '<em><b>Java Query</b></em>'. + * <!-- end-user-doc --> + * + * <p> + * The following features are supported: + * <ul> + * <li>{@link org.eclipse.modisco.facet.query.java.metamodel.v0_2_0.javaquery.JavaQuery#getImplementationClassName <em>Implementation Class Name</em>}</li> + * </ul> + * </p> + * + * @see org.eclipse.modisco.facet.query.java.metamodel.v0_2_0.javaquery.JavaQueryPackage#getJavaQuery() + * @model + * @generated + */ +public interface JavaQuery extends Query { + /** + * Returns the value of the '<em><b>Implementation Class Name</b></em>' attribute. + * <!-- begin-user-doc --> + * <p> + * If the meaning of the '<em>Implementation Class Name</em>' attribute isn't clear, + * there really should be more of a description here... + * </p> + * <!-- end-user-doc --> + * @return the value of the '<em>Implementation Class Name</em>' attribute. + * @see #setImplementationClassName(String) + * @see org.eclipse.modisco.facet.query.java.metamodel.v0_2_0.javaquery.JavaQueryPackage#getJavaQuery_ImplementationClassName() + * @model + * @generated + */ + String getImplementationClassName(); + + /** + * Sets the value of the '{@link org.eclipse.modisco.facet.query.java.metamodel.v0_2_0.javaquery.JavaQuery#getImplementationClassName <em>Implementation Class Name</em>}' attribute. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @param value the new value of the '<em>Implementation Class Name</em>' attribute. + * @see #getImplementationClassName() + * @generated + */ + void setImplementationClassName(String value); + +} // JavaQuery
diff --git a/org.eclipse.modisco.facet.query.java.metamodel/src/org/eclipse/modisco/facet/query/java/metamodel/v0_2_0/javaquery/JavaQueryFactory.java b/org.eclipse.modisco.facet.query.java.metamodel/src/org/eclipse/modisco/facet/query/java/metamodel/v0_2_0/javaquery/JavaQueryFactory.java new file mode 100644 index 0000000..d978291 --- /dev/null +++ b/org.eclipse.modisco.facet.query.java.metamodel/src/org/eclipse/modisco/facet/query/java/metamodel/v0_2_0/javaquery/JavaQueryFactory.java
@@ -0,0 +1,56 @@ +/** + * Copyright (c) 2011 Mia-Software. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Nicolas Guyomar (Mia-Software) - Bug 334615 - Java Query for EMF Facet + * Emmanuelle Rouillé (Mia-Software) - Bug 352618 - To be able to use non derived facet structural features and save them values. + * + */ +package org.eclipse.modisco.facet.query.java.metamodel.v0_2_0.javaquery; + +import org.eclipse.emf.ecore.EFactory; + +/** + * <!-- begin-user-doc --> + * The <b>Factory</b> for the model. + * It provides a create method for each non-abstract class of the model. + * <!-- end-user-doc --> + * + * @see org.eclipse.modisco.facet.query.java.metamodel.v0_2_0.javaquery.JavaQueryPackage + * @generated + * @noextend This interface is not intended to be extended by clients. + * @noimplement This interface is not intended to be implemented by clients. + */ +public interface JavaQueryFactory extends EFactory { + /** + * The singleton instance of the factory. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + JavaQueryFactory eINSTANCE = org.eclipse.modisco.facet.query.java.metamodel.v0_2_0.javaquery.impl.JavaQueryFactoryImpl.init(); + + /** + * Returns a new object of class '<em>Java Query</em>'. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @return a new object of class '<em>Java Query</em>'. + * @generated + */ + JavaQuery createJavaQuery(); + + /** + * Returns the package supported by this factory. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @return the package supported by this factory. + * @generated + */ + JavaQueryPackage getJavaQueryPackage(); + +} //JavaQueryFactory
diff --git a/org.eclipse.modisco.facet.query.java.metamodel/src/org/eclipse/modisco/facet/query/java/metamodel/v0_2_0/javaquery/JavaQueryPackage.java b/org.eclipse.modisco.facet.query.java.metamodel/src/org/eclipse/modisco/facet/query/java/metamodel/v0_2_0/javaquery/JavaQueryPackage.java new file mode 100644 index 0000000..0a8d282 --- /dev/null +++ b/org.eclipse.modisco.facet.query.java.metamodel/src/org/eclipse/modisco/facet/query/java/metamodel/v0_2_0/javaquery/JavaQueryPackage.java
@@ -0,0 +1,182 @@ +/** + * Copyright (c) 2011 Mia-Software. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Nicolas Guyomar (Mia-Software) - Bug 334615 - Java Query for EMF Facet + * Emmanuelle Rouillé (Mia-Software) - Bug 352618 - To be able to use non derived facet structural features and save them values. + * + */ +package org.eclipse.modisco.facet.query.java.metamodel.v0_2_0.javaquery; + +import org.eclipse.emf.ecore.EAttribute; +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.EPackage; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.extensible.ExtensiblePackage; + +/** + * <!-- begin-user-doc --> + * The <b>Package</b> for the model. + * It contains accessors for the meta objects to represent + * <ul> + * <li>each class,</li> + * <li>each feature of each class,</li> + * <li>each enum,</li> + * <li>and each data type</li> + * </ul> + * <!-- end-user-doc --> + * + * @see org.eclipse.modisco.facet.query.java.metamodel.v0_2_0.javaquery.JavaQueryFactory + * @model kind="package" + * @generated + * @noextend This interface is not intended to be extended by clients. + * @noimplement This interface is not intended to be implemented by clients. + */ +public interface JavaQueryPackage extends EPackage { + /** + * The package name. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + String eNAME = "javaquery"; //$NON-NLS-1$ + + /** + * The package namespace URI. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + String eNS_URI = "http://www.eclipse.org/emf/facet/query/java/0.2.incubation/javaquery"; //$NON-NLS-1$ + + /** + * The package namespace name. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + String eNS_PREFIX = "javaQuery"; //$NON-NLS-1$ + + /** + * The singleton instance of the package. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + JavaQueryPackage eINSTANCE = org.eclipse.modisco.facet.query.java.metamodel.v0_2_0.javaquery.impl.JavaQueryPackageImpl.init(); + + /** + * The meta object id for the '{@link org.eclipse.modisco.facet.query.java.metamodel.v0_2_0.javaquery.impl.JavaQueryImpl <em>Java Query</em>}' class. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @see org.eclipse.modisco.facet.query.java.metamodel.v0_2_0.javaquery.impl.JavaQueryImpl + * @see org.eclipse.modisco.facet.query.java.metamodel.v0_2_0.javaquery.impl.JavaQueryPackageImpl#getJavaQuery() + * @generated + */ + int JAVA_QUERY = 0; + + /** + * The feature id for the '<em><b>Can Have Side Effects</b></em>' attribute. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + */ + int JAVA_QUERY__CAN_HAVE_SIDE_EFFECTS = ExtensiblePackage.QUERY__CAN_HAVE_SIDE_EFFECTS; + + /** + * The feature id for the '<em><b>Can Be Cached</b></em>' attribute. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + */ + int JAVA_QUERY__CAN_BE_CACHED = ExtensiblePackage.QUERY__CAN_BE_CACHED; + + /** + * The feature id for the '<em><b>Implementation Class Name</b></em>' attribute. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + */ + int JAVA_QUERY__IMPLEMENTATION_CLASS_NAME = ExtensiblePackage.QUERY_FEATURE_COUNT + 0; + + /** + * The number of structural features of the '<em>Java Query</em>' class. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + */ + int JAVA_QUERY_FEATURE_COUNT = ExtensiblePackage.QUERY_FEATURE_COUNT + 1; + + + /** + * Returns the meta object for class '{@link org.eclipse.modisco.facet.query.java.metamodel.v0_2_0.javaquery.JavaQuery <em>Java Query</em>}'. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @return the meta object for class '<em>Java Query</em>'. + * @see org.eclipse.modisco.facet.query.java.metamodel.v0_2_0.javaquery.JavaQuery + * @generated + */ + EClass getJavaQuery(); + + /** + * Returns the meta object for the attribute '{@link org.eclipse.modisco.facet.query.java.metamodel.v0_2_0.javaquery.JavaQuery#getImplementationClassName <em>Implementation Class Name</em>}'. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @return the meta object for the attribute '<em>Implementation Class Name</em>'. + * @see org.eclipse.modisco.facet.query.java.metamodel.v0_2_0.javaquery.JavaQuery#getImplementationClassName() + * @see #getJavaQuery() + * @generated + */ + EAttribute getJavaQuery_ImplementationClassName(); + + /** + * Returns the factory that creates the instances of the model. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @return the factory that creates the instances of the model. + * @generated + */ + JavaQueryFactory getJavaQueryFactory(); + + /** + * <!-- begin-user-doc --> + * Defines literals for the meta objects that represent + * <ul> + * <li>each class,</li> + * <li>each feature of each class,</li> + * <li>each enum,</li> + * <li>and each data type</li> + * </ul> + * <!-- end-user-doc --> + * @generated + */ + interface Literals { + /** + * The meta object literal for the '{@link org.eclipse.modisco.facet.query.java.metamodel.v0_2_0.javaquery.impl.JavaQueryImpl <em>Java Query</em>}' class. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @see org.eclipse.modisco.facet.query.java.metamodel.v0_2_0.javaquery.impl.JavaQueryImpl + * @see org.eclipse.modisco.facet.query.java.metamodel.v0_2_0.javaquery.impl.JavaQueryPackageImpl#getJavaQuery() + * @generated + */ + EClass JAVA_QUERY = eINSTANCE.getJavaQuery(); + + /** + * The meta object literal for the '<em><b>Implementation Class Name</b></em>' attribute feature. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + EAttribute JAVA_QUERY__IMPLEMENTATION_CLASS_NAME = eINSTANCE.getJavaQuery_ImplementationClassName(); + + } + +} //JavaQueryPackage
diff --git a/org.eclipse.modisco.facet.query.java.metamodel/src/org/eclipse/modisco/facet/query/java/metamodel/v0_2_0/javaquery/impl/JavaQueryFactoryImpl.java b/org.eclipse.modisco.facet.query.java.metamodel/src/org/eclipse/modisco/facet/query/java/metamodel/v0_2_0/javaquery/impl/JavaQueryFactoryImpl.java new file mode 100644 index 0000000..ae45469 --- /dev/null +++ b/org.eclipse.modisco.facet.query.java.metamodel/src/org/eclipse/modisco/facet/query/java/metamodel/v0_2_0/javaquery/impl/JavaQueryFactoryImpl.java
@@ -0,0 +1,105 @@ +/** + * Copyright (c) 2011 Mia-Software. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Nicolas Guyomar (Mia-Software) - Bug 334615 - Java Query for EMF Facet + * Emmanuelle Rouillé (Mia-Software) - Bug 352618 - To be able to use non derived facet structural features and save them values. + * + */ +package org.eclipse.modisco.facet.query.java.metamodel.v0_2_0.javaquery.impl; + +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.ecore.EPackage; + +import org.eclipse.emf.ecore.impl.EFactoryImpl; + +import org.eclipse.emf.ecore.plugin.EcorePlugin; +import org.eclipse.modisco.facet.query.java.metamodel.v0_2_0.javaquery.*; + +/** + * <!-- begin-user-doc --> + * An implementation of the model <b>Factory</b>. + * <!-- end-user-doc --> + * @generated + */ +public class JavaQueryFactoryImpl extends EFactoryImpl implements JavaQueryFactory { + /** + * Creates the default factory implementation. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public static JavaQueryFactory init() { + try { + JavaQueryFactory theJavaQueryFactory = (JavaQueryFactory)EPackage.Registry.INSTANCE.getEFactory("http://www.eclipse.org/emf/facet/query/java/0.2.incubation/javaquery"); //$NON-NLS-1$ + if (theJavaQueryFactory != null) { + return theJavaQueryFactory; + } + } + catch (Exception exception) { + EcorePlugin.INSTANCE.log(exception); + } + return new JavaQueryFactoryImpl(); + } + + /** + * Creates an instance of the factory. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public JavaQueryFactoryImpl() { + super(); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + public EObject create(EClass eClass) { + switch (eClass.getClassifierID()) { + case JavaQueryPackage.JAVA_QUERY: return createJavaQuery(); + default: + throw new IllegalArgumentException("The class '" + eClass.getName() + "' is not a valid classifier"); //$NON-NLS-1$ //$NON-NLS-2$ + } + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public JavaQuery createJavaQuery() { + JavaQueryImpl javaQuery = new JavaQueryImpl(); + return javaQuery; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public JavaQueryPackage getJavaQueryPackage() { + return (JavaQueryPackage)getEPackage(); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @deprecated + * @generated + */ + @Deprecated + public static JavaQueryPackage getPackage() { + return JavaQueryPackage.eINSTANCE; + } + +} //JavaQueryFactoryImpl
diff --git a/org.eclipse.modisco.facet.query.java.metamodel/src/org/eclipse/modisco/facet/query/java/metamodel/v0_2_0/javaquery/impl/JavaQueryImpl.java b/org.eclipse.modisco.facet.query.java.metamodel/src/org/eclipse/modisco/facet/query/java/metamodel/v0_2_0/javaquery/impl/JavaQueryImpl.java new file mode 100644 index 0000000..2810910 --- /dev/null +++ b/org.eclipse.modisco.facet.query.java.metamodel/src/org/eclipse/modisco/facet/query/java/metamodel/v0_2_0/javaquery/impl/JavaQueryImpl.java
@@ -0,0 +1,173 @@ +/** + * Copyright (c) 2011 Mia-Software. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Nicolas Guyomar (Mia-Software) - Bug 334615 - Java Query for EMF Facet + * Emmanuelle Rouillé (Mia-Software) - Bug 352618 - To be able to use non derived facet structural features and save them values. + * + */ +package org.eclipse.modisco.facet.query.java.metamodel.v0_2_0.javaquery.impl; + +import org.eclipse.emf.common.notify.Notification; + +import org.eclipse.emf.ecore.EClass; + +import org.eclipse.emf.ecore.impl.ENotificationImpl; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.extensible.impl.QueryImpl; +import org.eclipse.modisco.facet.query.java.metamodel.v0_2_0.javaquery.JavaQuery; +import org.eclipse.modisco.facet.query.java.metamodel.v0_2_0.javaquery.JavaQueryPackage; + +/** + * <!-- begin-user-doc --> + * An implementation of the model object '<em><b>Java Query</b></em>'. + * <!-- end-user-doc --> + * <p> + * The following features are implemented: + * <ul> + * <li>{@link org.eclipse.modisco.facet.query.java.metamodel.v0_2_0.javaquery.impl.JavaQueryImpl#getImplementationClassName <em>Implementation Class Name</em>}</li> + * </ul> + * </p> + * + * @generated + */ +public class JavaQueryImpl extends QueryImpl implements JavaQuery { + /** + * The default value of the '{@link #getImplementationClassName() <em>Implementation Class Name</em>}' attribute. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @see #getImplementationClassName() + * @generated + * @ordered + */ + protected static final String IMPLEMENTATION_CLASS_NAME_EDEFAULT = null; + + /** + * The cached value of the '{@link #getImplementationClassName() <em>Implementation Class Name</em>}' attribute. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @see #getImplementationClassName() + * @generated + * @ordered + */ + protected String implementationClassName = IMPLEMENTATION_CLASS_NAME_EDEFAULT; + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + protected JavaQueryImpl() { + super(); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + protected EClass eStaticClass() { + return JavaQueryPackage.Literals.JAVA_QUERY; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public String getImplementationClassName() { + return implementationClassName; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public void setImplementationClassName(String newImplementationClassName) { + String oldImplementationClassName = implementationClassName; + implementationClassName = newImplementationClassName; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.SET, JavaQueryPackage.JAVA_QUERY__IMPLEMENTATION_CLASS_NAME, oldImplementationClassName, implementationClassName)); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + public Object eGet(int featureID, boolean resolve, boolean coreType) { + switch (featureID) { + case JavaQueryPackage.JAVA_QUERY__IMPLEMENTATION_CLASS_NAME: + return getImplementationClassName(); + } + return super.eGet(featureID, resolve, coreType); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + public void eSet(int featureID, Object newValue) { + switch (featureID) { + case JavaQueryPackage.JAVA_QUERY__IMPLEMENTATION_CLASS_NAME: + setImplementationClassName((String)newValue); + return; + } + super.eSet(featureID, newValue); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + public void eUnset(int featureID) { + switch (featureID) { + case JavaQueryPackage.JAVA_QUERY__IMPLEMENTATION_CLASS_NAME: + setImplementationClassName(IMPLEMENTATION_CLASS_NAME_EDEFAULT); + return; + } + super.eUnset(featureID); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + public boolean eIsSet(int featureID) { + switch (featureID) { + case JavaQueryPackage.JAVA_QUERY__IMPLEMENTATION_CLASS_NAME: + return IMPLEMENTATION_CLASS_NAME_EDEFAULT == null ? implementationClassName != null : !IMPLEMENTATION_CLASS_NAME_EDEFAULT.equals(implementationClassName); + } + return super.eIsSet(featureID); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + public String toString() { + if (eIsProxy()) return super.toString(); + + StringBuffer result = new StringBuffer(super.toString()); + result.append(" (implementationClassName: "); //$NON-NLS-1$ + result.append(implementationClassName); + result.append(')'); + return result.toString(); + } + +} //JavaQueryImpl
diff --git a/org.eclipse.modisco.facet.query.java.metamodel/src/org/eclipse/modisco/facet/query/java/metamodel/v0_2_0/javaquery/impl/JavaQueryPackageImpl.java b/org.eclipse.modisco.facet.query.java.metamodel/src/org/eclipse/modisco/facet/query/java/metamodel/v0_2_0/javaquery/impl/JavaQueryPackageImpl.java new file mode 100644 index 0000000..a311fb7 --- /dev/null +++ b/org.eclipse.modisco.facet.query.java.metamodel/src/org/eclipse/modisco/facet/query/java/metamodel/v0_2_0/javaquery/impl/JavaQueryPackageImpl.java
@@ -0,0 +1,196 @@ +/** + * Copyright (c) 2011 Mia-Software. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Nicolas Guyomar (Mia-Software) - Bug 334615 - Java Query for EMF Facet + * Emmanuelle Rouillé (Mia-Software) - Bug 352618 - To be able to use non derived facet structural features and save them values. + * + */ +package org.eclipse.modisco.facet.query.java.metamodel.v0_2_0.javaquery.impl; + +import org.eclipse.emf.ecore.EAttribute; +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.EPackage; + +import org.eclipse.emf.ecore.impl.EPackageImpl; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.EFacetPackage; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.extensible.ExtensiblePackage; +import org.eclipse.modisco.facet.query.java.metamodel.v0_2_0.javaquery.JavaQuery; +import org.eclipse.modisco.facet.query.java.metamodel.v0_2_0.javaquery.JavaQueryFactory; +import org.eclipse.modisco.facet.query.java.metamodel.v0_2_0.javaquery.JavaQueryPackage; + +/** + * <!-- begin-user-doc --> + * An implementation of the model <b>Package</b>. + * <!-- end-user-doc --> + * @generated + */ +public class JavaQueryPackageImpl extends EPackageImpl implements JavaQueryPackage { + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + private EClass javaQueryEClass = null; + + /** + * Creates an instance of the model <b>Package</b>, registered with + * {@link org.eclipse.emf.ecore.EPackage.Registry EPackage.Registry} by the package + * package URI value. + * <p>Note: the correct way to create the package is via the static + * factory method {@link #init init()}, which also performs + * initialization of the package, or returns the registered package, + * if one already exists. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @see org.eclipse.emf.ecore.EPackage.Registry + * @see org.eclipse.modisco.facet.query.java.metamodel.v0_2_0.javaquery.JavaQueryPackage#eNS_URI + * @see #init() + * @generated + */ + private JavaQueryPackageImpl() { + super(eNS_URI, JavaQueryFactory.eINSTANCE); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + private static boolean isInited = false; + + /** + * Creates, registers, and initializes the <b>Package</b> for this model, and for any others upon which it depends. + * + * <p>This method is used to initialize {@link JavaQueryPackage#eINSTANCE} when that field is accessed. + * Clients should not invoke it directly. Instead, they should simply access that field to obtain the package. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @see #eNS_URI + * @see #createPackageContents() + * @see #initializePackageContents() + * @generated + */ + public static JavaQueryPackage init() { + if (isInited) return (JavaQueryPackage)EPackage.Registry.INSTANCE.getEPackage(JavaQueryPackage.eNS_URI); + + // Obtain or create and register package + JavaQueryPackageImpl theJavaQueryPackage = (JavaQueryPackageImpl)(EPackage.Registry.INSTANCE.get(eNS_URI) instanceof JavaQueryPackageImpl ? EPackage.Registry.INSTANCE.get(eNS_URI) : new JavaQueryPackageImpl()); + + isInited = true; + + // Initialize simple dependencies + EFacetPackage.eINSTANCE.eClass(); + + // Create package meta-data objects + theJavaQueryPackage.createPackageContents(); + + // Initialize created meta-data + theJavaQueryPackage.initializePackageContents(); + + // Mark meta-data to indicate it can't be changed + theJavaQueryPackage.freeze(); + + + // Update the registry and return the package + EPackage.Registry.INSTANCE.put(JavaQueryPackage.eNS_URI, theJavaQueryPackage); + return theJavaQueryPackage; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public EClass getJavaQuery() { + return javaQueryEClass; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public EAttribute getJavaQuery_ImplementationClassName() { + return (EAttribute)javaQueryEClass.getEStructuralFeatures().get(0); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public JavaQueryFactory getJavaQueryFactory() { + return (JavaQueryFactory)getEFactoryInstance(); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + private boolean isCreated = false; + + /** + * Creates the meta-model objects for the package. This method is + * guarded to have no affect on any invocation but its first. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public void createPackageContents() { + if (isCreated) return; + isCreated = true; + + // Create classes and their features + javaQueryEClass = createEClass(JAVA_QUERY); + createEAttribute(javaQueryEClass, JAVA_QUERY__IMPLEMENTATION_CLASS_NAME); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + private boolean isInitialized = false; + + /** + * Complete the initialization of the package and its meta-model. This + * method is guarded to have no affect on any invocation but its first. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public void initializePackageContents() { + if (isInitialized) return; + isInitialized = true; + + // Initialize package + setName(eNAME); + setNsPrefix(eNS_PREFIX); + setNsURI(eNS_URI); + + // Obtain other dependent packages + ExtensiblePackage theExtensiblePackage = (ExtensiblePackage)EPackage.Registry.INSTANCE.getEPackage(ExtensiblePackage.eNS_URI); + + // Create type parameters + + // Set bounds for type parameters + + // Add supertypes to classes + javaQueryEClass.getESuperTypes().add(theExtensiblePackage.getQuery()); + + // Initialize classes and features; add operations and parameters + initEClass(javaQueryEClass, JavaQuery.class, "JavaQuery", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); //$NON-NLS-1$ + initEAttribute(getJavaQuery_ImplementationClassName(), ecorePackage.getEString(), "implementationClassName", null, 0, 1, JavaQuery.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); //$NON-NLS-1$ + + // Create resource + createResource(eNS_URI); + } + +} //JavaQueryPackageImpl
diff --git a/org.eclipse.modisco.facet.query.java.metamodel/src/org/eclipse/modisco/facet/query/java/metamodel/v0_2_0/javaquery/util/JavaQueryAdapterFactory.java b/org.eclipse.modisco.facet.query.java.metamodel/src/org/eclipse/modisco/facet/query/java/metamodel/v0_2_0/javaquery/util/JavaQueryAdapterFactory.java new file mode 100644 index 0000000..b7a4230 --- /dev/null +++ b/org.eclipse.modisco.facet.query.java.metamodel/src/org/eclipse/modisco/facet/query/java/metamodel/v0_2_0/javaquery/util/JavaQueryAdapterFactory.java
@@ -0,0 +1,149 @@ +/** + * Copyright (c) 2011 Mia-Software. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Nicolas Guyomar (Mia-Software) - Bug 334615 - Java Query for EMF Facet + * Emmanuelle Rouillé (Mia-Software) - Bug 352618 - To be able to use non derived facet structural features and save them values. + * + */ +package org.eclipse.modisco.facet.query.java.metamodel.v0_2_0.javaquery.util; + +import org.eclipse.emf.common.notify.Adapter; +import org.eclipse.emf.common.notify.Notifier; + +import org.eclipse.emf.common.notify.impl.AdapterFactoryImpl; + +import org.eclipse.emf.ecore.EObject; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.extensible.Query; +import org.eclipse.modisco.facet.query.java.metamodel.v0_2_0.javaquery.*; + +/** + * <!-- begin-user-doc --> + * The <b>Adapter Factory</b> for the model. + * It provides an adapter <code>createXXX</code> method for each class of the model. + * <!-- end-user-doc --> + * @see org.eclipse.modisco.facet.query.java.metamodel.v0_2_0.javaquery.JavaQueryPackage + * @generated + */ +public class JavaQueryAdapterFactory extends AdapterFactoryImpl { + /** + * The cached model package. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + protected static JavaQueryPackage modelPackage; + + /** + * Creates an instance of the adapter factory. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public JavaQueryAdapterFactory() { + if (modelPackage == null) { + modelPackage = JavaQueryPackage.eINSTANCE; + } + } + + /** + * Returns whether this factory is applicable for the type of the object. + * <!-- begin-user-doc --> + * This implementation returns <code>true</code> if the object is either the model's package or is an instance object of the model. + * <!-- end-user-doc --> + * @return whether this factory is applicable for the type of the object. + * @generated + */ + @Override + public boolean isFactoryForType(Object object) { + if (object == modelPackage) { + return true; + } + if (object instanceof EObject) { + return ((EObject)object).eClass().getEPackage() == modelPackage; + } + return false; + } + + /** + * The switch that delegates to the <code>createXXX</code> methods. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + protected JavaQuerySwitch<Adapter> modelSwitch = + new JavaQuerySwitch<Adapter>() { + @Override + public Adapter caseJavaQuery(JavaQuery object) { + return createJavaQueryAdapter(); + } + @Override + public Adapter caseQuery(Query object) { + return createQueryAdapter(); + } + @Override + public Adapter defaultCase(EObject object) { + return createEObjectAdapter(); + } + }; + + /** + * Creates an adapter for the <code>target</code>. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @param target the object to adapt. + * @return the adapter for the <code>target</code>. + * @generated + */ + @Override + public Adapter createAdapter(Notifier target) { + return modelSwitch.doSwitch((EObject)target); + } + + + /** + * Creates a new adapter for an object of class '{@link org.eclipse.modisco.facet.query.java.metamodel.v0_2_0.javaquery.JavaQuery <em>Java Query</em>}'. + * <!-- begin-user-doc --> + * This default implementation returns null so that we can easily ignore cases; + * it's useful to ignore a case when inheritance will catch all the cases anyway. + * <!-- end-user-doc --> + * @return the new adapter. + * @see org.eclipse.modisco.facet.query.java.metamodel.v0_2_0.javaquery.JavaQuery + * @generated + */ + public Adapter createJavaQueryAdapter() { + return null; + } + + /** + * Creates a new adapter for an object of class '{@link org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.extensible.Query <em>Query</em>}'. + * <!-- begin-user-doc --> + * This default implementation returns null so that we can easily ignore cases; + * it's useful to ignore a case when inheritance will catch all the cases anyway. + * <!-- end-user-doc --> + * @return the new adapter. + * @see org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.extensible.Query + * @generated + */ + public Adapter createQueryAdapter() { + return null; + } + + /** + * Creates a new adapter for the default case. + * <!-- begin-user-doc --> + * This default implementation returns null. + * <!-- end-user-doc --> + * @return the new adapter. + * @generated + */ + public Adapter createEObjectAdapter() { + return null; + } + +} //JavaQueryAdapterFactory
diff --git a/org.eclipse.modisco.facet.query.java.metamodel/src/org/eclipse/modisco/facet/query/java/metamodel/v0_2_0/javaquery/util/JavaQuerySwitch.java b/org.eclipse.modisco.facet.query.java.metamodel/src/org/eclipse/modisco/facet/query/java/metamodel/v0_2_0/javaquery/util/JavaQuerySwitch.java new file mode 100644 index 0000000..ec61841 --- /dev/null +++ b/org.eclipse.modisco.facet.query.java.metamodel/src/org/eclipse/modisco/facet/query/java/metamodel/v0_2_0/javaquery/util/JavaQuerySwitch.java
@@ -0,0 +1,153 @@ +/** + * Copyright (c) 2011 Mia-Software. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Nicolas Guyomar (Mia-Software) - Bug 334615 - Java Query for EMF Facet + * Emmanuelle Rouillé (Mia-Software) - Bug 352618 - To be able to use non derived facet structural features and save them values. + * + */ +package org.eclipse.modisco.facet.query.java.metamodel.v0_2_0.javaquery.util; + +import java.util.List; + +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.EObject; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.extensible.Query; +import org.eclipse.modisco.facet.query.java.metamodel.v0_2_0.javaquery.*; + +/** + * <!-- begin-user-doc --> + * The <b>Switch</b> for the model's inheritance hierarchy. + * It supports the call {@link #doSwitch(EObject) doSwitch(object)} + * to invoke the <code>caseXXX</code> method for each class of the model, + * starting with the actual class of the object + * and proceeding up the inheritance hierarchy + * until a non-null result is returned, + * which is the result of the switch. + * <!-- end-user-doc --> + * @see org.eclipse.modisco.facet.query.java.metamodel.v0_2_0.javaquery.JavaQueryPackage + * @generated + */ +public class JavaQuerySwitch<T> { + /** + * The cached model package + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + protected static JavaQueryPackage modelPackage; + + /** + * Creates an instance of the switch. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public JavaQuerySwitch() { + if (modelPackage == null) { + modelPackage = JavaQueryPackage.eINSTANCE; + } + } + + /** + * Calls <code>caseXXX</code> for each class of the model until one returns a non null result; it yields that result. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @return the first non-null result returned by a <code>caseXXX</code> call. + * @generated + */ + public T doSwitch(EObject theEObject) { + return doSwitch(theEObject.eClass(), theEObject); + } + + /** + * Calls <code>caseXXX</code> for each class of the model until one returns a non null result; it yields that result. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @return the first non-null result returned by a <code>caseXXX</code> call. + * @generated + */ + protected T doSwitch(EClass theEClass, EObject theEObject) { + if (theEClass.eContainer() == modelPackage) { + return doSwitch(theEClass.getClassifierID(), theEObject); + } + else { + List<EClass> eSuperTypes = theEClass.getESuperTypes(); + return + eSuperTypes.isEmpty() ? + defaultCase(theEObject) : + doSwitch(eSuperTypes.get(0), theEObject); + } + } + + /** + * Calls <code>caseXXX</code> for each class of the model until one returns a non null result; it yields that result. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @return the first non-null result returned by a <code>caseXXX</code> call. + * @generated + */ + protected T doSwitch(int classifierID, EObject theEObject) { + switch (classifierID) { + case JavaQueryPackage.JAVA_QUERY: { + JavaQuery javaQuery = (JavaQuery)theEObject; + T result = caseJavaQuery(javaQuery); + if (result == null) result = caseQuery(javaQuery); + if (result == null) result = defaultCase(theEObject); + return result; + } + default: return defaultCase(theEObject); + } + } + + /** + * Returns the result of interpreting the object as an instance of '<em>Java Query</em>'. + * <!-- begin-user-doc --> + * This implementation returns null; + * returning a non-null result will terminate the switch. + * <!-- end-user-doc --> + * @param object the target of the switch. + * @return the result of interpreting the object as an instance of '<em>Java Query</em>'. + * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) + * @generated + */ + public T caseJavaQuery(JavaQuery object) { + return null; + } + + /** + * Returns the result of interpreting the object as an instance of '<em>Query</em>'. + * <!-- begin-user-doc --> + * This implementation returns null; + * returning a non-null result will terminate the switch. + * <!-- end-user-doc --> + * @param object the target of the switch. + * @return the result of interpreting the object as an instance of '<em>Query</em>'. + * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) + * @generated + */ + public T caseQuery(Query object) { + return null; + } + + /** + * Returns the result of interpreting the object as an instance of '<em>EObject</em>'. + * <!-- begin-user-doc --> + * This implementation returns null; + * returning a non-null result will terminate the switch, but this is the last case anyway. + * <!-- end-user-doc --> + * @param object the target of the switch. + * @return the result of interpreting the object as an instance of '<em>EObject</em>'. + * @see #doSwitch(org.eclipse.emf.ecore.EObject) + * @generated + */ + public T defaultCase(EObject object) { + return null; + } + +} //JavaQuerySwitch
diff --git a/org.eclipse.modisco.facet.util.core/META-INF/MANIFEST.MF b/org.eclipse.modisco.facet.util.core/META-INF/MANIFEST.MF index 705f59e..a2d37d8 100644 --- a/org.eclipse.modisco.facet.util.core/META-INF/MANIFEST.MF +++ b/org.eclipse.modisco.facet.util.core/META-INF/MANIFEST.MF
@@ -3,15 +3,15 @@ Bundle-Name: %Bundle-Name Bundle-SymbolicName: org.eclipse.emf.facet.util.core;singleton:=true Bundle-Version: 1.3.0.qualifier -Bundle-Activator: org.eclipse.emf.facet.util.core.internal.Activator +Bundle-Activator: org.eclipse.modisco.facet.util.core.internal.Activator Bundle-Vendor: %Bundle-Vendor Require-Bundle: org.eclipse.core.runtime, org.eclipse.core.resources;bundle-version="3.6.0", com.ibm.icu;bundle-version="4.2.1" Bundle-RequiredExecutionEnvironment: JavaSE-1.8 Bundle-ActivationPolicy: lazy -Export-Package: org.eclipse.emf.facet.util.core, - org.eclipse.emf.facet.util.core.internal; +Export-Package: org.eclipse.modisco.facet.util.core, + org.eclipse.modisco.facet.util.core.internal; x-friends:="org.eclipse.emf.facet.common.core, org.eclipse.emf.facet.efacet.core, org.eclipse.emf.facet.efacet.ui, @@ -24,5 +24,5 @@ org.eclipse.emf.facet.efacet.core.tests, org.eclipse.emf.facet.efacet.tests, org.eclipse.emf.facet.infra.common.core", - org.eclipse.emf.facet.util.core.internal.exported + org.eclipse.modisco.facet.util.core.internal.exported Automatic-Module-Name: org.eclipse.emf.facet.util.core
diff --git a/org.eclipse.modisco.facet.util.core/src/org/eclipse/emf/facet/util/core/DebugUtils.java b/org.eclipse.modisco.facet.util.core/src/org/eclipse/emf/facet/util/core/DebugUtils.java deleted file mode 100644 index c24d97e..0000000 --- a/org.eclipse.modisco.facet.util.core/src/org/eclipse/emf/facet/util/core/DebugUtils.java +++ /dev/null
@@ -1,144 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2011 Mia-Software. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Grégoire Dupé (Mia-Software) - Bug 366804 - [Restructuring] Table widget upgrade - * Grégoire Dupé - Bug 365843 - [Unit Test Failure][0.2/3.8][0.2/4.2] org.eclipse.emf.facet.widgets.nattable.tests.swtbot.Bug344925Test.testBug344925 - * Grégoire Dupé - Bug 367613 - Table widget refactoring - * Grégoire Dupé (Mia-Software) - Bug 369987 - [Restructuring][Table] Switch to the new customization and facet framework - * Grégoire Dupé (Mia-Software) - Bug 373078 - API Cleaning - * Grégoire Dupé (Mia-Software) - Bug 483451 - Logger and DebugUtils : Add "String.format" API - *******************************************************************************/ -package org.eclipse.emf.facet.util.core; - -import org.eclipse.core.runtime.Platform; -import org.eclipse.core.runtime.Plugin; -import org.osgi.framework.Bundle; - -/** - * @since 0.2 - */ -public final class DebugUtils { - - /** - * Position of the caller in the stack. - */ - private static final int CALLER = 3; - - private DebugUtils() { - // Must not be used - } - - public static void debug(final boolean condition) { - if (condition) { - String location = getCallerLocation(0); - System.out.println(location); - } - } - - public static void debug(final boolean condition, final String message) { - if (condition) { - String location = getCallerLocation(0); - System.out.println(location + ": " //$NON-NLS-1$ - + message); - } - } - - /** - * @since 1.1 - * @param messageTemplate - * A format string (cf. java.util.Formatter) - * @param args - * Arguments referenced by messageTemplates - */ - public static void debug(final boolean condition, final String messageTemplate, - final Object... args) { - if (condition) { - debug(1, messageTemplate, args); - } - } - - /** - * This methods returns the qualified name of the calling method. - * @param stackOffset - * @return - */ - public static String getCallerLocation(final int stackOffset) { - StackTraceElement traceElement = Thread.currentThread().getStackTrace()[DebugUtils.CALLER + stackOffset]; - String location = traceElement.getClassName() + '.' - + traceElement.getMethodName(); - return location; - } - - public static boolean getDebugStatus(final Plugin plugin) { - final String debugOption = getDebugOption(plugin); - return internalGetDebugStatus(plugin, debugOption); - } - - public static boolean getDebugStatus(final Plugin plugin, final String suboption) { - final String debugOption = getDebugOption(plugin) + '/' + suboption; - return internalGetDebugStatus(plugin, debugOption); - } - - private static boolean internalGetDebugStatus(final Plugin plugin, - final String debugOption) { - final String debugOptionValue = Platform.getDebugOption(debugOption); - final boolean isDebuggingOption = Boolean.parseBoolean(debugOptionValue); - boolean result = plugin.isDebugging() && isDebuggingOption; - return result; - } - - private static String getDebugOption(final Plugin plugin) { - final Bundle bundle = plugin.getBundle(); - final StackTraceElement traceElement = Thread.currentThread().getStackTrace()[DebugUtils.CALLER]; - final String className = traceElement.getClassName(); - Class<?> classs; - try { - classs = bundle.loadClass(className); - } catch (ClassNotFoundException e) { - throw new RuntimeException(e); - } - final String debugOption = bundle.getSymbolicName() + "/debug/" + classs.getSimpleName(); //$NON-NLS-1$ - return debugOption; - } - - public static void debug(final String message) { - debug(message, 1); - } - - /** - * @since 1.1 - * @param messageTemplate - * A format string (cf. java.util.Formatter) - * @param args - * Arguments referenced by messageTemplates - */ - public static void debug(final String messageTemplate, - final Object... args) { - debug(1, messageTemplate, args); - } - - public static void debug(final String message, final int stackOffset) { - String location = getCallerLocation(stackOffset); - System.out.println(location + ": " //$NON-NLS-1$ - + message); - } - - /** - * @since 1.1 - * @param messageTemplate - * A format string (cf. java.util.Formatter) - * @param args - * Arguments referenced by messageTemplates - */ - public static void debug(final int stackOffset, - final String messageTemplate, final Object... args) { - final String message = String.format(messageTemplate, args); - debug(message, stackOffset + 1); - } -}
diff --git a/org.eclipse.modisco.facet.util.core/src/org/eclipse/emf/facet/util/core/Logger.java b/org.eclipse.modisco.facet.util.core/src/org/eclipse/emf/facet/util/core/Logger.java deleted file mode 100644 index 1572f1a..0000000 --- a/org.eclipse.modisco.facet.util.core/src/org/eclipse/emf/facet/util/core/Logger.java +++ /dev/null
@@ -1,206 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Mia-Software. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Fabien Giquel (Mia-Software) - initial API and implementation - * Nicolas Bros (Mia-Software) - * Nicolas Bros (Mia-Software) - Bug 339657 - Move Logger to org.eclipse.emf.facet.util.core - * Nicolas Bros (Mia-Software) - Bug 340031 - NPE in org.eclipse.emf.facet.util.core.Logger#log - * Grégoire Dupé (Mia-Software) - Bug 483451 - Logger and DebugUtils : Add "String.format" API - *******************************************************************************/ -package org.eclipse.emf.facet.util.core; - -import java.lang.reflect.InvocationTargetException; - -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.MultiStatus; -import org.eclipse.core.runtime.Plugin; -import org.eclipse.core.runtime.Status; -import org.eclipse.emf.facet.util.core.internal.Activator; - -/** - * Helper for logging using Eclipse API - * - * @author fgiquel - * - */ -public final class Logger { - - private Logger() { - // Nothing - } - - public static void logError(final Throwable e, final Plugin plugin) { - Logger.log(e, IStatus.ERROR, e.getMessage(), plugin); - } - - public static void logError(final String message, final Plugin plugin) { - Logger.log(null, IStatus.ERROR, message, plugin); - } - - public static void logError(final Throwable e, final String message, final Plugin plugin) { - Logger.log(e, IStatus.ERROR, message, plugin); - } - - public static void logWarning(final Throwable e, final Plugin plugin) { - Logger.log(e, IStatus.WARNING, e.getMessage(), plugin); - } - - public static void logWarning(final String message, final Plugin plugin) { - Logger.log(null, IStatus.WARNING, message, plugin); - } - - public static void logWarning(final Throwable e, final String message, final Plugin plugin) { - Logger.log(e, IStatus.WARNING, message, plugin); - } - - public static void logInfo(final Throwable e, final Plugin plugin) { - Logger.log(e, IStatus.INFO, e.getMessage(), plugin); - } - - public static void logInfo(final String message, final Plugin plugin) { - Logger.log(null, IStatus.INFO, message, plugin); - } - - /** - * @since 1.1 - * @param messageTemplate - * A format string (cf. java.util.Formatter) - * @param args - * Arguments referenced by messageTemplates - */ - public static void logError(final Plugin plugin, - final String messageTemplate, final Object... args) { - Logger.log(null, IStatus.ERROR, plugin, messageTemplate, args); - } - - /** - * @since 1.1 - * @param messageTemplate - * A format string (cf. java.util.Formatter) - * @param args - * Arguments referenced by messageTemplates - */ - public static void logError(final Throwable e, final Plugin plugin, - final String messageTemplate, final Object... args) { - Logger.log(e, IStatus.ERROR, plugin, messageTemplate, args); - } - - /** - * @since 1.1 - * @param messageTemplate - * A format string (cf. java.util.Formatter) - * @param args - * Arguments referenced by messageTemplates - */ - public static void logWarning(final Plugin plugin, - final String messageTemplace, final Object... args) { - Logger.log(null, IStatus.WARNING, plugin, messageTemplace, args); - } - - /** - * @since 1.1 - */ - public static void logWarning(final Throwable e, final Plugin plugin, - final String messageTemplace, final Object... args) { - Logger.log(e, IStatus.WARNING, plugin, messageTemplace, args); - } - - /** - * @since 1.1 - * @param messageTemplate - * A format string (cf. java.util.Formatter) - * @param args - * Arguments referenced by messageTemplates - */ - public static void logInfo(final Plugin plugin, - final String messageTemplace, final Object... args) { - Logger.log(null, IStatus.INFO, plugin, messageTemplace, args); - } - - /** - * An exception that is instantiated with the sole purpose of providing a - * stack trace when there wouldn't be one otherwise. - */ - protected static class LogStackTrace extends Exception { - private static final long serialVersionUID = 309882934616507415L; - } - - /** - * @since 1.1 - * @param messageTemplate - * A format string (cf. java.util.Formatter) - * @param args - * Arguments referenced by messageTemplates - */ - public static void log(final Throwable e, final int level, - final Plugin plugin, final String messageTemplate, - final Object... args) { - final String message = String.format(messageTemplate, args); - log(e, level, message, plugin); - } - - public static void log(final Throwable e, final int level, - final String message, final Plugin plugin) { - - Throwable effectiveE = e; - Plugin effectivePlugin = plugin; - String effectiveMessage = message; - IStatus status = null; - - if (effectiveE instanceof InvocationTargetException) { - effectiveE = ((InvocationTargetException) effectiveE).getTargetException(); - } - if (effectivePlugin == null) { - effectivePlugin = Activator.getDefault(); - } - - if (effectiveE instanceof CoreException) { - MultiStatus mstatus = new MultiStatus(plugin.getBundle().getSymbolicName(), level, - new IStatus[] { ((CoreException) effectiveE).getStatus() }, message, effectiveE); - status = mstatus; - } else { - if (effectiveMessage == null && effectiveE != null) { - effectiveMessage = effectiveE.getMessage(); - } - if (effectiveMessage == null && effectiveE != null) { - effectiveMessage = effectiveE.toString(); - } - if (effectiveMessage == null) { - effectiveMessage = ""; //$NON-NLS-1$ - } - try { - effectiveMessage = effectiveMessage + " (" //$NON-NLS-1$ - + effectivePlugin.getBundle().getSymbolicName() + "_" //$NON-NLS-1$ - + effectivePlugin.getBundle().getVersion() + ")"; //$NON-NLS-1$ - } catch (NullPointerException e2) { - effectiveMessage += " (activator class = " //$NON-NLS-1$ - + effectivePlugin.getClass().getName() + ")"; //$NON-NLS-1$ - } - if (effectiveE == null) { - // record a stacktrace - effectiveE = new LogStackTrace(); - } - status = new Status(level, effectivePlugin.getBundle().getSymbolicName(), - effectiveMessage, effectiveE); - } - effectivePlugin.getLog().log(status); - } - - // private static String getPosition() { - // try { - // // get the stack element corresponding to the caller of the log - // // method - // StackTraceElement element = new Exception().getStackTrace()[2]; - // return " \n[" + element.getClassName() + "#" + element.getMethodName() + " : " //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ - // + element.getLineNumber() + "]"; //$NON-NLS-1$ - // } catch (Throwable e) { - // return ""; //$NON-NLS-1$ - // } - // } -}
diff --git a/org.eclipse.modisco.facet.util.core/src/org/eclipse/emf/facet/util/core/exception/DebuggingRuntimeException.java b/org.eclipse.modisco.facet.util.core/src/org/eclipse/emf/facet/util/core/exception/DebuggingRuntimeException.java deleted file mode 100644 index 38c2d7d..0000000 --- a/org.eclipse.modisco.facet.util.core/src/org/eclipse/emf/facet/util/core/exception/DebuggingRuntimeException.java +++ /dev/null
@@ -1,34 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2011 Mia-Software. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Gregoire Dupe (Mia-Software) - Bug 366804 - [Restructuring] Table widget upgrade - *******************************************************************************/ -package org.eclipse.emf.facet.util.core.exception; - -public class DebuggingRuntimeException extends RuntimeException { - - private static final long serialVersionUID = 6192755421845020464L; - - public DebuggingRuntimeException() { - super(); - } - - public DebuggingRuntimeException(final String message) { - super(message); - } - - public DebuggingRuntimeException(final Throwable cause) { - super(cause); - } - - public DebuggingRuntimeException(final String message, final Throwable cause) { - super(message, cause); - } - -}
diff --git a/org.eclipse.modisco.facet.util.core/src/org/eclipse/emf/facet/util/core/internal/Activator.java b/org.eclipse.modisco.facet.util.core/src/org/eclipse/emf/facet/util/core/internal/Activator.java deleted file mode 100644 index ef8ebeb..0000000 --- a/org.eclipse.modisco.facet.util.core/src/org/eclipse/emf/facet/util/core/internal/Activator.java +++ /dev/null
@@ -1,47 +0,0 @@ -/** - * Copyright (c) 2011 Mia-Software. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Gregoire Dupe (Mia-Software) - Bug 338811 - A model registration method in the interface ICatalogSetManager - * Nicolas Bros (Mia-Software) - Bug 340031 - NPE in org.eclipse.emf.facet.util.core.Logger#log - * Nicolas Guyomar (Mia-Software) - Bug 340339 - Need some Utils class for Folder/File/Project management - */ -package org.eclipse.emf.facet.util.core.internal; - -import org.eclipse.core.runtime.Plugin; -import org.osgi.framework.BundleContext; - -public class Activator extends Plugin { - - public static final String PLUGIN_ID = "org.eclipse.emf.facet.util.core"; //$NON-NLS-1$ - private static BundleContext context; - private static Activator plugin; - - public static Plugin getDefault() { - return Activator.plugin; - } - - static BundleContext getContext() { - return Activator.context; - } - - @Override - public void start(final BundleContext bundleContext) throws Exception { - super.start(bundleContext); - Activator.context = bundleContext; - Activator.plugin = this; - } - - @Override - public void stop(final BundleContext bundleContext) throws Exception { - Activator.context = null; - Activator.plugin = null; - super.stop(bundleContext); - } - -}
diff --git a/org.eclipse.modisco.facet.util.core/src/org/eclipse/emf/facet/util/core/internal/ErrorHandlingUtils.java b/org.eclipse.modisco.facet.util.core/src/org/eclipse/emf/facet/util/core/internal/ErrorHandlingUtils.java deleted file mode 100644 index 587ec1e..0000000 --- a/org.eclipse.modisco.facet.util.core/src/org/eclipse/emf/facet/util/core/internal/ErrorHandlingUtils.java +++ /dev/null
@@ -1,50 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2011 Mia-Software - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Nicolas Bros (Mia-Software) - initial API and implementation - *******************************************************************************/ -package org.eclipse.emf.facet.util.core.internal; - -public final class ErrorHandlingUtils { - private ErrorHandlingUtils() { - // utility class - } - - /** - * Builds an error message for when an element doesn't have the expected type. - * - * @param baseMessage - * the beginning of the message - * @param expectedType - * the expected type - * @param element - * the element that doesn't match the expected type - * @return the full message - */ - public static String buildWrongTypeMessage(final String baseMessage, final Class<?> expectedType, final Object element) { - StringBuilder builder = new StringBuilder(); - builder.append(baseMessage); - builder.append("\n"); //$NON-NLS-1$ - if (expectedType != null) { - builder.append("Expected type: "); //$NON-NLS-1$ - builder.append(expectedType.getName()); - builder.append(". "); //$NON-NLS-1$ - } else { - builder.append("Expected type is null. "); //$NON-NLS-1$ - } - - if (element != null) { - builder.append("Got an instance of type: "); //$NON-NLS-1$ - builder.append(element.getClass().getName()); - builder.append("."); //$NON-NLS-1$ - } else { - builder.append("Got null."); //$NON-NLS-1$ - } - return builder.toString(); - } -}
diff --git a/org.eclipse.modisco.facet.util.core/src/org/eclipse/emf/facet/util/core/internal/JavaUtils.java b/org.eclipse.modisco.facet.util.core/src/org/eclipse/emf/facet/util/core/internal/JavaUtils.java deleted file mode 100644 index d55c467..0000000 --- a/org.eclipse.modisco.facet.util.core/src/org/eclipse/emf/facet/util/core/internal/JavaUtils.java +++ /dev/null
@@ -1,54 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2011 Mia-Software - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Nicolas Guyomar (Mia-Software) - Bug 349566 - Need some new query utils method for query creation - * Nicolas Bros (Mia-Software) - Bug 349566 - Need some new query utils method for query creation - *******************************************************************************/ -package org.eclipse.emf.facet.util.core.internal; - -public final class JavaUtils { - - private JavaUtils() { - // utility class - } - - /** - * Converts a Java primitive type to a Java object type. - * - * @param primitiveType - * the primitive type - * @return the object type - */ - public static String objectType(final String primitiveType) { - if ("byte".equals(primitiveType)) { //$NON-NLS-1$ - return "Byte"; //$NON-NLS-1$ - } - if ("short".equals(primitiveType)) { //$NON-NLS-1$ - return "Short"; //$NON-NLS-1$ - } - if ("int".equals(primitiveType)) { //$NON-NLS-1$ - return "Integer"; //$NON-NLS-1$ - } - if ("long".equals(primitiveType)) { //$NON-NLS-1$ - return "Long"; //$NON-NLS-1$ - } - if ("float".equals(primitiveType)) { //$NON-NLS-1$ - return "Float"; //$NON-NLS-1$ - } - if ("double".equals(primitiveType)) { //$NON-NLS-1$ - return "Double"; //$NON-NLS-1$ - } - if ("boolean".equals(primitiveType)) { //$NON-NLS-1$ - return "Boolean"; //$NON-NLS-1$ - } - if ("char".equals(primitiveType)) { //$NON-NLS-1$ - return "Character"; //$NON-NLS-1$ - } - return primitiveType; - } -}
diff --git a/org.eclipse.modisco.facet.util.core/src/org/eclipse/emf/facet/util/core/internal/Messages.java b/org.eclipse.modisco.facet.util.core/src/org/eclipse/emf/facet/util/core/internal/Messages.java deleted file mode 100644 index a94b919..0000000 --- a/org.eclipse.modisco.facet.util.core/src/org/eclipse/emf/facet/util/core/internal/Messages.java +++ /dev/null
@@ -1,34 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009 Mia-Software. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Nicolas Bros (Mia-Software) - * Gregoire Dupe (Mia-Software) - Bug 366804 - [Restructuring] Table widget upgrade - * Gregoire Dupe (Mia-Software) - Bug 369987 - [Restructuring][Table] Switch to the new customization and facet framework - *******************************************************************************/ -package org.eclipse.emf.facet.util.core.internal; - -import org.eclipse.osgi.util.NLS; - -public final class Messages extends NLS { - private static String BUNDLE_NAME = "org.eclipse.emf.facet.util.core.internal.messages"; //$NON-NLS-1$ - public static String AbstractRegistry_id; - public static String AbstractRegistry_colon; - public static String AbstractRegistry_requiredAttributeNotDefined; - public static String AbstractRegistry_unknownExtensionTag; - public static String AbstractRegistry_pluginExtension; - public static String StringUtils_ellipsis; - - static { - // initialize resource bundle - NLS.initializeMessages(Messages.BUNDLE_NAME, Messages.class); - } - - private Messages() { - // Nothing - } -}
diff --git a/org.eclipse.modisco.facet.util.core/src/org/eclipse/emf/facet/util/core/internal/exported/AbstractRegistry.java b/org.eclipse.modisco.facet.util.core/src/org/eclipse/emf/facet/util/core/internal/exported/AbstractRegistry.java deleted file mode 100644 index a2f266c..0000000 --- a/org.eclipse.modisco.facet.util.core/src/org/eclipse/emf/facet/util/core/internal/exported/AbstractRegistry.java +++ /dev/null
@@ -1,112 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009 Mia-Software. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Nicolas Bros (Mia-Software) - initial API and implementation - * Gregoire Dupe (Mia-Software) - Bug 369987 - [Restructuring][Table] Switch to the new customization and facet framework - * Gregoire Dupe (Mia-Software) - Bug 373078 - API Cleaning - *******************************************************************************/ - -package org.eclipse.emf.facet.util.core.internal.exported; - -import org.eclipse.core.runtime.IConfigurationElement; -import org.eclipse.core.runtime.IExtension; -import org.eclipse.core.runtime.IExtensionPoint; -import org.eclipse.core.runtime.IExtensionRegistry; -import org.eclipse.core.runtime.Platform; -import org.eclipse.emf.facet.util.core.Logger; -import org.eclipse.emf.facet.util.core.internal.Activator; -import org.eclipse.emf.facet.util.core.internal.Messages; -import org.eclipse.osgi.util.NLS; - -/** - * Provides common functionality for extension registries. Call - * {@link #initialize()} in a sub-class to read the extension points. Implement - * {@link #handleRootElement(IConfigurationElement)} to read the root - * configuration elements of each extension. - * @since 0.2 - */ -public abstract class AbstractRegistry { -// copy of org.eclipse.emf.facet.infra.common.core.internal.extensions.AbstractRegistry - /** - * Initialize the registry by reading the extension point to discover - * extensions. This method calls - * {@link #handleRootElement(IConfigurationElement)} on each root - * configuration element. - */ - protected void initialize() { - final IExtensionRegistry extensionRegistry = Platform.getExtensionRegistry(); - final IExtensionPoint extensionPoint = extensionRegistry.getExtensionPoint( - getExtensionPointNamespace(), getExtensionPointName()); - - if (extensionPoint == null) { - Logger.logError("Extension point not found:" + getExtensionPointNamespace() //$NON-NLS-1$ - + "." + getExtensionPointName(), Activator.getDefault()); //$NON-NLS-1$ - return; - } - - final IExtension[] extensions = extensionPoint.getExtensions(); - for (final IExtension extension : extensions) { - final IConfigurationElement[] configurationElements = extension - .getConfigurationElements(); - for (final IConfigurationElement configurationElement : configurationElements) { - try { - handleRootElement(configurationElement); - } catch (Exception e) { - final String errogMsg = NLS - .bind("An exception occurred while loading registry of the extension point {0}. The problem occurred with the an extension contributed by the plug-in {1}", //$NON-NLS-1$ - getExtensionPointNamespace() + '.' - + getExtensionPointName(), - extension.getContributor().getName()); - Logger.logError(e, errogMsg, Activator.getDefault()); - } - } - } - } - - protected abstract String getExtensionPointNamespace(); - - protected abstract String getExtensionPointName(); - - /** Called for each root {@link IConfigurationElement} in the extension */ - protected abstract void handleRootElement(IConfigurationElement configurationElement); - - /** - * Logs the error in the log using the provided text and the information in - * the configuration element. - */ - protected static void logError(final IConfigurationElement element, final String text) { - final IExtension extension = element.getDeclaringExtension(); - final StringBuffer buf = new StringBuffer(); - buf.append(NLS.bind(Messages.AbstractRegistry_pluginExtension, extension - .getNamespaceIdentifier(), extension.getExtensionPointUniqueIdentifier())); - // look for an ID if available - this should help debugging - final String id = element.getAttribute("id"); //$NON-NLS-1$ - if (id != null) { - buf.append(Messages.AbstractRegistry_id); - buf.append(id); - } - buf.append(Messages.AbstractRegistry_colon + text); - Logger.logError(buf.toString(), Activator.getDefault()); - } - - /** - * Logs a very common registry error when a required attribute is missing. - */ - protected static void logMissingAttribute(final IConfigurationElement element, - final String attributeName) { - logError(element, NLS.bind(Messages.AbstractRegistry_requiredAttributeNotDefined, - attributeName)); - } - - /** - * Logs a registry error when the configuration element is unknown. - */ - protected static void logUnknownElement(final IConfigurationElement element) { - logError(element, Messages.AbstractRegistry_unknownExtensionTag + element.getName()); - } -}
diff --git a/org.eclipse.modisco.facet.util.core/src/org/eclipse/emf/facet/util/core/internal/exported/FileUtils.java b/org.eclipse.modisco.facet.util.core/src/org/eclipse/emf/facet/util/core/internal/exported/FileUtils.java deleted file mode 100644 index f964962..0000000 --- a/org.eclipse.modisco.facet.util.core/src/org/eclipse/emf/facet/util/core/internal/exported/FileUtils.java +++ /dev/null
@@ -1,192 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 2009, 2011 Mia-Software. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Nicolas Bros (Mia-Software) - initial API and implementation - * Nicolas Guyomar (Mia-Software) - Bug 340339 - Need some Utils class for Folder/File/Project management - * Nicolas Guyomar (Mia-Software) - Bug 342451 - To be able to edit derived facet attributes and derived facet references in a table - * Gregoire Dupe (Mia-Software) - Bug 373078 - API Cleaning - * Thomas Cicognani (Soft-Maint) - Bug 398079 - org.eclipse.emf.facet.util.core.internal.exported.FileUtils.copyFolderFromBundle - *******************************************************************************/ -package org.eclipse.emf.facet.util.core.internal.exported; - -import java.io.File; -import java.io.FileInputStream; -import java.io.FileOutputStream; -import java.io.IOException; -import java.io.InputStream; -import java.io.InputStreamReader; -import java.io.Reader; -import java.net.URL; -import java.util.Enumeration; - -import org.eclipse.core.resources.IFile; -import org.eclipse.core.resources.IFolder; -import org.eclipse.core.resources.IProject; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.NullProgressMonitor; -import org.osgi.framework.Bundle; - -/** - * @since 0.2 - */ -public final class FileUtils { - - // This class has been copied from org.eclipse.emf.facet.infra.common.core.internal.utils.FileUtils - - private static final int COPY_BUFFER_SIZE = 512 * 1024; - - private FileUtils() { - // Nothing - } - - /** Get the contents of a file from a Bundle */ - public static String getFileContents(final Bundle bundle, final String path) throws IOException { - InputStream source; - URL url = bundle.getResource(path); - if (url == null) { - return null; - } - source = url.openStream(); - return FileUtils.readInputStream(source); - } - - public static String readInputStream(final InputStream stream) throws IOException { - return readInputStream(stream, "UTF-8"); //$NON-NLS-1$ - } - - public static String readInputStream(final InputStream stream, final String charset) - throws IOException { - final int bufferSize = 65536; - final char[] buffer = new char[bufferSize]; - StringBuilder builder = new StringBuilder(); - Reader reader = new InputStreamReader(stream, charset); - int read; - do { - read = reader.read(buffer, 0, buffer.length); - if (read > 0) { - builder.append(buffer, 0, read); - } - } while (read >= 0); - - reader.close(); - return builder.toString(); - } - - /** - * Copy a folder contents from a bundle - * - * @param folderPath - * Folder path to copy - * @param project - * Copy folder into this {@link IProject} - * @param destinationPath - * Destination path - * @param bundleContainingResources - * Bundle which has resources to copy - * @param recurse - * <code>true</code> to copy recursively - * @throws IOException - * @throws CoreException - * @since 0.3 - */ - public static void copyFolderFromBundle(final String folderPath, final IProject project, - final String destinationPath, final Bundle bundleContainingResources, - final boolean recurse) - throws IOException, CoreException { - @SuppressWarnings("unchecked") - // @SuppressWarnings("unchecked") findEntries returns a raw type. - final Enumeration<URL> files = bundleContainingResources.findEntries(folderPath, "*.*", recurse); //$NON-NLS-1$ - while (files.hasMoreElements()) { - final URL element = files.nextElement(); - String filename = element.getFile().replace(folderPath, ""); //$NON-NLS-1$ - if (!filename.startsWith("/")) { //$NON-NLS-1$ - filename = "/" + filename; //$NON-NLS-1$ - } - copyFileFromBundle(element.getFile(), project, destinationPath + filename, bundleContainingResources); - } - } - - public static IFile copyFileFromBundle(final String sourcePath, final IProject project, - final String destinationPath, final Bundle bundleContainingResources) - throws IOException, CoreException { - InputStream source; - URL url = bundleContainingResources.getResource(sourcePath); - if (url != null) { - source = url.openStream(); - } else { - url = bundleContainingResources.getEntry(sourcePath); - if (url == null) { - throw new IOException(sourcePath + " not found."); //$NON-NLS-1$ - } - source = url.openStream(); - } - IFile javaFile = project.getFile(destinationPath); - if (javaFile.exists()) { - try { - javaFile.delete(true, new NullProgressMonitor()); - } catch (CoreException e) { - // problem deleting the file : try to close the project before deleting - if (project.isOpen()) { - try { - project.close(new NullProgressMonitor()); - javaFile.delete(true, new NullProgressMonitor()); - } finally { - project.open(new NullProgressMonitor()); - } - } - } - } - if (!javaFile.getParent().exists()) { - FolderUtils.createFolder((IFolder) javaFile.getParent()); - } - javaFile.create(source, true, new NullProgressMonitor()); - return javaFile; - } - - /** - * Copies the source file to the target file. - * - * @return <code>true</code> if successful, <code>false</code> otherwise - */ - public static final boolean copyFile(final File source, final File destination) { - boolean result = false; - FileInputStream sourceFile = null; - FileOutputStream destinationFile = null; - try { - // File creation - destination.createNewFile(); - sourceFile = new FileInputStream(source); - destinationFile = new FileOutputStream(destination); - // 0.5 MiB buffer for reading - byte[] buffer = new byte[FileUtils.COPY_BUFFER_SIZE]; - int nbRead; - while ((nbRead = sourceFile.read(buffer)) != -1) { - destinationFile.write(buffer, 0, nbRead); - } - - // Copied - result = true; - } catch (java.io.FileNotFoundException f) { - result = false; - } catch (java.io.IOException e) { - result = false; - } finally { - try { - if (sourceFile != null) { - sourceFile.close(); - } - if (destinationFile != null) { - destinationFile.close(); - } - } catch (Exception e) { - result = false; - } - } - return result; - } -}
diff --git a/org.eclipse.modisco.facet.util.core/src/org/eclipse/emf/facet/util/core/internal/exported/FolderUtils.java b/org.eclipse.modisco.facet.util.core/src/org/eclipse/emf/facet/util/core/internal/exported/FolderUtils.java deleted file mode 100644 index d56753c..0000000 --- a/org.eclipse.modisco.facet.util.core/src/org/eclipse/emf/facet/util/core/internal/exported/FolderUtils.java +++ /dev/null
@@ -1,108 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 2009 Mia-Software. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Gabriel Barbier (Mia-Software) - initial API and implementation - * Fabien Giquel (Mia-Software) - * Nicolas Bros (Mia-Software) - * Nicolas Guyomar (Mia-Software) - Bug 340339 - Need some Utils class for Folder/File/Project management - *******************************************************************************/ - -package org.eclipse.emf.facet.util.core.internal.exported; - -import java.io.File; -import java.io.IOException; - -import org.eclipse.core.resources.IFolder; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.NullProgressMonitor; - -/** - * @author Gabriel Barbier - * @since 0.2 - */ -public final class FolderUtils { - - // This class has been copied from org.eclipse.emf.facet.infra.common.core.internal.utils.FolderUtils - - private FolderUtils() { - // prevent instantiation - } - - /** - * This method delete the content of the folder - * @param folder The folder that has to be emptied - */ - public static final void clearFolder(final File folder) { - assert folder != null; - assert folder.exists(); - assert folder.isDirectory(); - /* - * To delete the contents of this folder, we recurse on all elements (File) in this folder. - * In the case of a directory, we first delete its own contents before deleting it. In the - * case of a file, we just delete the file. - */ - File[] files = folder.listFiles(); - for (File file : files) { - if (file.isDirectory()) { - FolderUtils.clearFolder(file); - } - file.delete(); - } - } - - /** - * This method create a folder and it parents if they do not exists. - * @param folder The folder that have to be created. - * @throws CoreException - */ - public static void createFolder(final IFolder folder) throws CoreException { - if (!folder.getParent().exists()) { - FolderUtils.createFolder((IFolder) folder.getParent()); - } - if (!folder.exists()) { - folder.create(true, true, new NullProgressMonitor()); - } - } - - /** - * Copies the source directory to the target directory. The target is - * created if it does not exist. - */ - public static final void copyFolder(final File srcDir, final File destDir) - throws IOException { - FolderUtils.copyFolder(srcDir, destDir, new IFilter<String>() { - public boolean filter(final String object) { - return true; - } - }); - } - - /** - * Copies the source directory to the target directory. - */ - public static final void copyFolder(final File srcDir, final File destDir, - final IFilter<String> filter) throws IOException { - - if (!destDir.exists()) { - destDir.mkdirs(); - } - File[] filesList = srcDir.listFiles(); - File dest; - // Copies each file and directory, one by one - for (File src : filesList) { - dest = new File(destDir.getPath() + File.separator + src.getName()); - if (filter.filter(dest.getAbsolutePath())) { - if (src.isDirectory()) { - FolderUtils.copyFolder(src, dest, filter); - } else { - FileUtils.copyFile(src, dest); - } - } - } - } -}
diff --git a/org.eclipse.modisco.facet.util.core/src/org/eclipse/emf/facet/util/core/internal/exported/IFilter.java b/org.eclipse.modisco.facet.util.core/src/org/eclipse/emf/facet/util/core/internal/exported/IFilter.java deleted file mode 100644 index 831892d..0000000 --- a/org.eclipse.modisco.facet.util.core/src/org/eclipse/emf/facet/util/core/internal/exported/IFilter.java +++ /dev/null
@@ -1,29 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010, 2011 Mia-Software. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Gregoire DUPE (Mia-Software) - initial API and implementation - * Nicolas Bros (Mia-Software) - * Nicolas Guyomar (Mia-Software) - Bug 340339 - Need some Utils class for Folder/File/Project management - * Gregoire Dupe (Mia-Software) - Bug 340339 - Need some Utils class for Folder/File/Project management - *******************************************************************************/ -package org.eclipse.emf.facet.util.core.internal.exported; - -/** - * @since 0.2 - */ -public interface IFilter<T> { - // This class has been copied from org.eclipse.emf.facet.infra.common.core.internal.utils.IFilter - - /** - * @param object - * an element to be filtered - * @return false if the element must be filtered out. - */ - public boolean filter(T object); - -}
diff --git a/org.eclipse.modisco.facet.util.core/src/org/eclipse/emf/facet/util/core/internal/exported/ListUtils.java b/org.eclipse.modisco.facet.util.core/src/org/eclipse/emf/facet/util/core/internal/exported/ListUtils.java deleted file mode 100644 index 19adc68..0000000 --- a/org.eclipse.modisco.facet.util.core/src/org/eclipse/emf/facet/util/core/internal/exported/ListUtils.java +++ /dev/null
@@ -1,33 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2012 CEA-LIST - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Gregoire Dupe (Mia-Software) - Bug 375087 - [Table] ITableWidget.addColumn(List<ETypedElement>, List<FacetSet>) - *******************************************************************************/ -package org.eclipse.emf.facet.util.core.internal.exported; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.List; - -/** - * @since 0.2 - */ -public final class ListUtils { - - private ListUtils() { - // Must not be used. - } - - public static <T> List<T> cleanList(final Collection<T> collection) { - final List<T> cleanList = new ArrayList<T>(collection); - while (cleanList.contains(null)) { - cleanList.remove(null); - } - return cleanList; - } -}
diff --git a/org.eclipse.modisco.facet.util.core/src/org/eclipse/emf/facet/util/core/internal/exported/StringUtils.java b/org.eclipse.modisco.facet.util.core/src/org/eclipse/emf/facet/util/core/internal/exported/StringUtils.java deleted file mode 100644 index 0e64cb9..0000000 --- a/org.eclipse.modisco.facet.util.core/src/org/eclipse/emf/facet/util/core/internal/exported/StringUtils.java +++ /dev/null
@@ -1,108 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 2009 Mia-Software. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Gabriel Barbier (Mia-Software) - initial API and implementation - * Nicolas Bros (Mia-Software) - * Gregoire Dupe (Mia-Software) - Bug 366804 - [Restructuring] Table widget upgrade - * Gregoire Dupe (Mia-Software) - Bug 373078 - API Cleaning - *******************************************************************************/ - -package org.eclipse.emf.facet.util.core.internal.exported; - - -import org.eclipse.emf.facet.util.core.internal.Messages; - -import com.ibm.icu.lang.UCharacter; - -/** - * @author Gabriel Barbier - * @since 0.2 - */ -// Copied from org.eclipse.emf.facet.infra.common.core.internal.utils.StringUtils -public final class StringUtils { - public static final String ELLIPSIS = Messages.StringUtils_ellipsis; - private static final int TRUNCATE_AFTER = 150; - - private StringUtils() { - // prevent instantiation - } - - public static String firstLetterToLowerCase(final String source) { - String result; - if (source.length() == 0) { - result = source; - } else if (source.length() == 1) { - result = source.toLowerCase(); - } else { - result = source.substring(0, 1).toLowerCase() + source.substring(1); - } - return result; - } - - public static String firstLetterToUpperCase(final String source) { - String result; - if (source.length() == 0) { - result = source; - } else if (source.length() == 1) { - result = source.toUpperCase(); - } else { - result = source.substring(0, 1).toUpperCase() + source.substring(1); - } - return result; - } - - /** - * Truncate the given String before the first newline or a maximum number of - * characters, whichever comes first. Adds an ellipsis ("...") if it was - * effectively truncated. - * - * @param str - * the string to truncate - * @return the part of the given string before the first newline - */ - public static String truncateBeforeNewline(final String str) { - int endIndex = str.indexOf('\r'); - if (endIndex == -1) { - endIndex = str.indexOf('\n'); - } - if (endIndex != -1 && endIndex <= StringUtils.TRUNCATE_AFTER) { - return str.substring(0, endIndex) + StringUtils.ELLIPSIS; - } - if (endIndex == -1) { - endIndex = str.length(); - } - - if (endIndex > StringUtils.TRUNCATE_AFTER) { - return str.substring(0, StringUtils.TRUNCATE_AFTER / 2) + StringUtils.ELLIPSIS - + str.substring(str.length() - StringUtils.TRUNCATE_AFTER / 2, endIndex); - } - return str; - } - - /** - * Get a name suitable for a Java class from the given name. Capitalizes the - * first letter and each letter after a space, and removes spaces. - */ - public static String inferJavaClassName(final String name) { - String upperName = StringUtils.firstLetterToUpperCase(name.trim()); - StringBuilder javaName = new StringBuilder(); - boolean space = false; - for (int i = 0; i < upperName.length(); i++) { - char c = upperName.charAt(i); - if (c == ' ') { - space = true; - } else if (space) { - javaName.append(UCharacter.toUpperCase(c)); - space = false; - } else { - javaName.append(c); - } - } - return javaName.toString(); - } -}
diff --git a/org.eclipse.modisco.facet.util.core/src/org/eclipse/modisco/facet/util/core/DebugUtils.java b/org.eclipse.modisco.facet.util.core/src/org/eclipse/modisco/facet/util/core/DebugUtils.java new file mode 100644 index 0000000..5b504ac --- /dev/null +++ b/org.eclipse.modisco.facet.util.core/src/org/eclipse/modisco/facet/util/core/DebugUtils.java
@@ -0,0 +1,144 @@ +/******************************************************************************* + * Copyright (c) 2011 Mia-Software. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Grégoire Dupé (Mia-Software) - Bug 366804 - [Restructuring] Table widget upgrade + * Grégoire Dupé - Bug 365843 - [Unit Test Failure][0.2/3.8][0.2/4.2] org.eclipse.emf.facet.widgets.nattable.tests.swtbot.Bug344925Test.testBug344925 + * Grégoire Dupé - Bug 367613 - Table widget refactoring + * Grégoire Dupé (Mia-Software) - Bug 369987 - [Restructuring][Table] Switch to the new customization and facet framework + * Grégoire Dupé (Mia-Software) - Bug 373078 - API Cleaning + * Grégoire Dupé (Mia-Software) - Bug 483451 - Logger and DebugUtils : Add "String.format" API + *******************************************************************************/ +package org.eclipse.modisco.facet.util.core; + +import org.eclipse.core.runtime.Platform; +import org.eclipse.core.runtime.Plugin; +import org.osgi.framework.Bundle; + +/** + * @since 0.2 + */ +public final class DebugUtils { + + /** + * Position of the caller in the stack. + */ + private static final int CALLER = 3; + + private DebugUtils() { + // Must not be used + } + + public static void debug(final boolean condition) { + if (condition) { + String location = getCallerLocation(0); + System.out.println(location); + } + } + + public static void debug(final boolean condition, final String message) { + if (condition) { + String location = getCallerLocation(0); + System.out.println(location + ": " //$NON-NLS-1$ + + message); + } + } + + /** + * @since 1.1 + * @param messageTemplate + * A format string (cf. java.util.Formatter) + * @param args + * Arguments referenced by messageTemplates + */ + public static void debug(final boolean condition, final String messageTemplate, + final Object... args) { + if (condition) { + debug(1, messageTemplate, args); + } + } + + /** + * This methods returns the qualified name of the calling method. + * @param stackOffset + * @return + */ + public static String getCallerLocation(final int stackOffset) { + StackTraceElement traceElement = Thread.currentThread().getStackTrace()[DebugUtils.CALLER + stackOffset]; + String location = traceElement.getClassName() + '.' + + traceElement.getMethodName(); + return location; + } + + public static boolean getDebugStatus(final Plugin plugin) { + final String debugOption = getDebugOption(plugin); + return internalGetDebugStatus(plugin, debugOption); + } + + public static boolean getDebugStatus(final Plugin plugin, final String suboption) { + final String debugOption = getDebugOption(plugin) + '/' + suboption; + return internalGetDebugStatus(plugin, debugOption); + } + + private static boolean internalGetDebugStatus(final Plugin plugin, + final String debugOption) { + final String debugOptionValue = Platform.getDebugOption(debugOption); + final boolean isDebuggingOption = Boolean.parseBoolean(debugOptionValue); + boolean result = plugin.isDebugging() && isDebuggingOption; + return result; + } + + private static String getDebugOption(final Plugin plugin) { + final Bundle bundle = plugin.getBundle(); + final StackTraceElement traceElement = Thread.currentThread().getStackTrace()[DebugUtils.CALLER]; + final String className = traceElement.getClassName(); + Class<?> classs; + try { + classs = bundle.loadClass(className); + } catch (ClassNotFoundException e) { + throw new RuntimeException(e); + } + final String debugOption = bundle.getSymbolicName() + "/debug/" + classs.getSimpleName(); //$NON-NLS-1$ + return debugOption; + } + + public static void debug(final String message) { + debug(message, 1); + } + + /** + * @since 1.1 + * @param messageTemplate + * A format string (cf. java.util.Formatter) + * @param args + * Arguments referenced by messageTemplates + */ + public static void debug(final String messageTemplate, + final Object... args) { + debug(1, messageTemplate, args); + } + + public static void debug(final String message, final int stackOffset) { + String location = getCallerLocation(stackOffset); + System.out.println(location + ": " //$NON-NLS-1$ + + message); + } + + /** + * @since 1.1 + * @param messageTemplate + * A format string (cf. java.util.Formatter) + * @param args + * Arguments referenced by messageTemplates + */ + public static void debug(final int stackOffset, + final String messageTemplate, final Object... args) { + final String message = String.format(messageTemplate, args); + debug(message, stackOffset + 1); + } +}
diff --git a/org.eclipse.modisco.facet.util.core/src/org/eclipse/modisco/facet/util/core/Logger.java b/org.eclipse.modisco.facet.util.core/src/org/eclipse/modisco/facet/util/core/Logger.java new file mode 100644 index 0000000..05a6c53 --- /dev/null +++ b/org.eclipse.modisco.facet.util.core/src/org/eclipse/modisco/facet/util/core/Logger.java
@@ -0,0 +1,206 @@ +/******************************************************************************* + * Copyright (c) 2010 Mia-Software. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Fabien Giquel (Mia-Software) - initial API and implementation + * Nicolas Bros (Mia-Software) + * Nicolas Bros (Mia-Software) - Bug 339657 - Move Logger to org.eclipse.emf.facet.util.core + * Nicolas Bros (Mia-Software) - Bug 340031 - NPE in org.eclipse.emf.facet.util.core.Logger#log + * Grégoire Dupé (Mia-Software) - Bug 483451 - Logger and DebugUtils : Add "String.format" API + *******************************************************************************/ +package org.eclipse.modisco.facet.util.core; + +import java.lang.reflect.InvocationTargetException; + +import org.eclipse.core.runtime.CoreException; +import org.eclipse.core.runtime.IStatus; +import org.eclipse.core.runtime.MultiStatus; +import org.eclipse.core.runtime.Plugin; +import org.eclipse.core.runtime.Status; +import org.eclipse.modisco.facet.util.core.internal.Activator; + +/** + * Helper for logging using Eclipse API + * + * @author fgiquel + * + */ +public final class Logger { + + private Logger() { + // Nothing + } + + public static void logError(final Throwable e, final Plugin plugin) { + Logger.log(e, IStatus.ERROR, e.getMessage(), plugin); + } + + public static void logError(final String message, final Plugin plugin) { + Logger.log(null, IStatus.ERROR, message, plugin); + } + + public static void logError(final Throwable e, final String message, final Plugin plugin) { + Logger.log(e, IStatus.ERROR, message, plugin); + } + + public static void logWarning(final Throwable e, final Plugin plugin) { + Logger.log(e, IStatus.WARNING, e.getMessage(), plugin); + } + + public static void logWarning(final String message, final Plugin plugin) { + Logger.log(null, IStatus.WARNING, message, plugin); + } + + public static void logWarning(final Throwable e, final String message, final Plugin plugin) { + Logger.log(e, IStatus.WARNING, message, plugin); + } + + public static void logInfo(final Throwable e, final Plugin plugin) { + Logger.log(e, IStatus.INFO, e.getMessage(), plugin); + } + + public static void logInfo(final String message, final Plugin plugin) { + Logger.log(null, IStatus.INFO, message, plugin); + } + + /** + * @since 1.1 + * @param messageTemplate + * A format string (cf. java.util.Formatter) + * @param args + * Arguments referenced by messageTemplates + */ + public static void logError(final Plugin plugin, + final String messageTemplate, final Object... args) { + Logger.log(null, IStatus.ERROR, plugin, messageTemplate, args); + } + + /** + * @since 1.1 + * @param messageTemplate + * A format string (cf. java.util.Formatter) + * @param args + * Arguments referenced by messageTemplates + */ + public static void logError(final Throwable e, final Plugin plugin, + final String messageTemplate, final Object... args) { + Logger.log(e, IStatus.ERROR, plugin, messageTemplate, args); + } + + /** + * @since 1.1 + * @param messageTemplate + * A format string (cf. java.util.Formatter) + * @param args + * Arguments referenced by messageTemplates + */ + public static void logWarning(final Plugin plugin, + final String messageTemplace, final Object... args) { + Logger.log(null, IStatus.WARNING, plugin, messageTemplace, args); + } + + /** + * @since 1.1 + */ + public static void logWarning(final Throwable e, final Plugin plugin, + final String messageTemplace, final Object... args) { + Logger.log(e, IStatus.WARNING, plugin, messageTemplace, args); + } + + /** + * @since 1.1 + * @param messageTemplate + * A format string (cf. java.util.Formatter) + * @param args + * Arguments referenced by messageTemplates + */ + public static void logInfo(final Plugin plugin, + final String messageTemplace, final Object... args) { + Logger.log(null, IStatus.INFO, plugin, messageTemplace, args); + } + + /** + * An exception that is instantiated with the sole purpose of providing a + * stack trace when there wouldn't be one otherwise. + */ + protected static class LogStackTrace extends Exception { + private static final long serialVersionUID = 309882934616507415L; + } + + /** + * @since 1.1 + * @param messageTemplate + * A format string (cf. java.util.Formatter) + * @param args + * Arguments referenced by messageTemplates + */ + public static void log(final Throwable e, final int level, + final Plugin plugin, final String messageTemplate, + final Object... args) { + final String message = String.format(messageTemplate, args); + log(e, level, message, plugin); + } + + public static void log(final Throwable e, final int level, + final String message, final Plugin plugin) { + + Throwable effectiveE = e; + Plugin effectivePlugin = plugin; + String effectiveMessage = message; + IStatus status = null; + + if (effectiveE instanceof InvocationTargetException) { + effectiveE = ((InvocationTargetException) effectiveE).getTargetException(); + } + if (effectivePlugin == null) { + effectivePlugin = Activator.getDefault(); + } + + if (effectiveE instanceof CoreException) { + MultiStatus mstatus = new MultiStatus(plugin.getBundle().getSymbolicName(), level, + new IStatus[] { ((CoreException) effectiveE).getStatus() }, message, effectiveE); + status = mstatus; + } else { + if (effectiveMessage == null && effectiveE != null) { + effectiveMessage = effectiveE.getMessage(); + } + if (effectiveMessage == null && effectiveE != null) { + effectiveMessage = effectiveE.toString(); + } + if (effectiveMessage == null) { + effectiveMessage = ""; //$NON-NLS-1$ + } + try { + effectiveMessage = effectiveMessage + " (" //$NON-NLS-1$ + + effectivePlugin.getBundle().getSymbolicName() + "_" //$NON-NLS-1$ + + effectivePlugin.getBundle().getVersion() + ")"; //$NON-NLS-1$ + } catch (NullPointerException e2) { + effectiveMessage += " (activator class = " //$NON-NLS-1$ + + effectivePlugin.getClass().getName() + ")"; //$NON-NLS-1$ + } + if (effectiveE == null) { + // record a stacktrace + effectiveE = new LogStackTrace(); + } + status = new Status(level, effectivePlugin.getBundle().getSymbolicName(), + effectiveMessage, effectiveE); + } + effectivePlugin.getLog().log(status); + } + + // private static String getPosition() { + // try { + // // get the stack element corresponding to the caller of the log + // // method + // StackTraceElement element = new Exception().getStackTrace()[2]; + // return " \n[" + element.getClassName() + "#" + element.getMethodName() + " : " //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + // + element.getLineNumber() + "]"; //$NON-NLS-1$ + // } catch (Throwable e) { + // return ""; //$NON-NLS-1$ + // } + // } +}
diff --git a/org.eclipse.modisco.facet.util.core/src/org/eclipse/modisco/facet/util/core/exception/DebuggingRuntimeException.java b/org.eclipse.modisco.facet.util.core/src/org/eclipse/modisco/facet/util/core/exception/DebuggingRuntimeException.java new file mode 100644 index 0000000..fd4a943 --- /dev/null +++ b/org.eclipse.modisco.facet.util.core/src/org/eclipse/modisco/facet/util/core/exception/DebuggingRuntimeException.java
@@ -0,0 +1,34 @@ +/******************************************************************************* + * Copyright (c) 2011 Mia-Software. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Gregoire Dupe (Mia-Software) - Bug 366804 - [Restructuring] Table widget upgrade + *******************************************************************************/ +package org.eclipse.modisco.facet.util.core.exception; + +public class DebuggingRuntimeException extends RuntimeException { + + private static final long serialVersionUID = 6192755421845020464L; + + public DebuggingRuntimeException() { + super(); + } + + public DebuggingRuntimeException(final String message) { + super(message); + } + + public DebuggingRuntimeException(final Throwable cause) { + super(cause); + } + + public DebuggingRuntimeException(final String message, final Throwable cause) { + super(message, cause); + } + +}
diff --git a/org.eclipse.modisco.facet.util.core/src/org/eclipse/modisco/facet/util/core/internal/Activator.java b/org.eclipse.modisco.facet.util.core/src/org/eclipse/modisco/facet/util/core/internal/Activator.java new file mode 100644 index 0000000..11df62c --- /dev/null +++ b/org.eclipse.modisco.facet.util.core/src/org/eclipse/modisco/facet/util/core/internal/Activator.java
@@ -0,0 +1,47 @@ +/** + * Copyright (c) 2011 Mia-Software. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Gregoire Dupe (Mia-Software) - Bug 338811 - A model registration method in the interface ICatalogSetManager + * Nicolas Bros (Mia-Software) - Bug 340031 - NPE in org.eclipse.emf.facet.util.core.Logger#log + * Nicolas Guyomar (Mia-Software) - Bug 340339 - Need some Utils class for Folder/File/Project management + */ +package org.eclipse.modisco.facet.util.core.internal; + +import org.eclipse.core.runtime.Plugin; +import org.osgi.framework.BundleContext; + +public class Activator extends Plugin { + + public static final String PLUGIN_ID = "org.eclipse.emf.facet.util.core"; //$NON-NLS-1$ + private static BundleContext context; + private static Activator plugin; + + public static Plugin getDefault() { + return Activator.plugin; + } + + static BundleContext getContext() { + return Activator.context; + } + + @Override + public void start(final BundleContext bundleContext) throws Exception { + super.start(bundleContext); + Activator.context = bundleContext; + Activator.plugin = this; + } + + @Override + public void stop(final BundleContext bundleContext) throws Exception { + Activator.context = null; + Activator.plugin = null; + super.stop(bundleContext); + } + +}
diff --git a/org.eclipse.modisco.facet.util.core/src/org/eclipse/modisco/facet/util/core/internal/ErrorHandlingUtils.java b/org.eclipse.modisco.facet.util.core/src/org/eclipse/modisco/facet/util/core/internal/ErrorHandlingUtils.java new file mode 100644 index 0000000..ef732ef --- /dev/null +++ b/org.eclipse.modisco.facet.util.core/src/org/eclipse/modisco/facet/util/core/internal/ErrorHandlingUtils.java
@@ -0,0 +1,50 @@ +/******************************************************************************* + * Copyright (c) 2011 Mia-Software + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Nicolas Bros (Mia-Software) - initial API and implementation + *******************************************************************************/ +package org.eclipse.modisco.facet.util.core.internal; + +public final class ErrorHandlingUtils { + private ErrorHandlingUtils() { + // utility class + } + + /** + * Builds an error message for when an element doesn't have the expected type. + * + * @param baseMessage + * the beginning of the message + * @param expectedType + * the expected type + * @param element + * the element that doesn't match the expected type + * @return the full message + */ + public static String buildWrongTypeMessage(final String baseMessage, final Class<?> expectedType, final Object element) { + StringBuilder builder = new StringBuilder(); + builder.append(baseMessage); + builder.append("\n"); //$NON-NLS-1$ + if (expectedType != null) { + builder.append("Expected type: "); //$NON-NLS-1$ + builder.append(expectedType.getName()); + builder.append(". "); //$NON-NLS-1$ + } else { + builder.append("Expected type is null. "); //$NON-NLS-1$ + } + + if (element != null) { + builder.append("Got an instance of type: "); //$NON-NLS-1$ + builder.append(element.getClass().getName()); + builder.append("."); //$NON-NLS-1$ + } else { + builder.append("Got null."); //$NON-NLS-1$ + } + return builder.toString(); + } +}
diff --git a/org.eclipse.modisco.facet.util.core/src/org/eclipse/modisco/facet/util/core/internal/JavaUtils.java b/org.eclipse.modisco.facet.util.core/src/org/eclipse/modisco/facet/util/core/internal/JavaUtils.java new file mode 100644 index 0000000..b711dda --- /dev/null +++ b/org.eclipse.modisco.facet.util.core/src/org/eclipse/modisco/facet/util/core/internal/JavaUtils.java
@@ -0,0 +1,54 @@ +/******************************************************************************* + * Copyright (c) 2011 Mia-Software + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Nicolas Guyomar (Mia-Software) - Bug 349566 - Need some new query utils method for query creation + * Nicolas Bros (Mia-Software) - Bug 349566 - Need some new query utils method for query creation + *******************************************************************************/ +package org.eclipse.modisco.facet.util.core.internal; + +public final class JavaUtils { + + private JavaUtils() { + // utility class + } + + /** + * Converts a Java primitive type to a Java object type. + * + * @param primitiveType + * the primitive type + * @return the object type + */ + public static String objectType(final String primitiveType) { + if ("byte".equals(primitiveType)) { //$NON-NLS-1$ + return "Byte"; //$NON-NLS-1$ + } + if ("short".equals(primitiveType)) { //$NON-NLS-1$ + return "Short"; //$NON-NLS-1$ + } + if ("int".equals(primitiveType)) { //$NON-NLS-1$ + return "Integer"; //$NON-NLS-1$ + } + if ("long".equals(primitiveType)) { //$NON-NLS-1$ + return "Long"; //$NON-NLS-1$ + } + if ("float".equals(primitiveType)) { //$NON-NLS-1$ + return "Float"; //$NON-NLS-1$ + } + if ("double".equals(primitiveType)) { //$NON-NLS-1$ + return "Double"; //$NON-NLS-1$ + } + if ("boolean".equals(primitiveType)) { //$NON-NLS-1$ + return "Boolean"; //$NON-NLS-1$ + } + if ("char".equals(primitiveType)) { //$NON-NLS-1$ + return "Character"; //$NON-NLS-1$ + } + return primitiveType; + } +}
diff --git a/org.eclipse.modisco.facet.util.core/src/org/eclipse/modisco/facet/util/core/internal/Messages.java b/org.eclipse.modisco.facet.util.core/src/org/eclipse/modisco/facet/util/core/internal/Messages.java new file mode 100644 index 0000000..657cadf --- /dev/null +++ b/org.eclipse.modisco.facet.util.core/src/org/eclipse/modisco/facet/util/core/internal/Messages.java
@@ -0,0 +1,34 @@ +/******************************************************************************* + * Copyright (c) 2009 Mia-Software. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Nicolas Bros (Mia-Software) + * Gregoire Dupe (Mia-Software) - Bug 366804 - [Restructuring] Table widget upgrade + * Gregoire Dupe (Mia-Software) - Bug 369987 - [Restructuring][Table] Switch to the new customization and facet framework + *******************************************************************************/ +package org.eclipse.modisco.facet.util.core.internal; + +import org.eclipse.osgi.util.NLS; + +public final class Messages extends NLS { + private static String BUNDLE_NAME = "org.eclipse.emf.facet.util.core.internal.messages"; //$NON-NLS-1$ + public static String AbstractRegistry_id; + public static String AbstractRegistry_colon; + public static String AbstractRegistry_requiredAttributeNotDefined; + public static String AbstractRegistry_unknownExtensionTag; + public static String AbstractRegistry_pluginExtension; + public static String StringUtils_ellipsis; + + static { + // initialize resource bundle + NLS.initializeMessages(Messages.BUNDLE_NAME, Messages.class); + } + + private Messages() { + // Nothing + } +}
diff --git a/org.eclipse.modisco.facet.util.core/src/org/eclipse/modisco/facet/util/core/internal/exported/AbstractRegistry.java b/org.eclipse.modisco.facet.util.core/src/org/eclipse/modisco/facet/util/core/internal/exported/AbstractRegistry.java new file mode 100644 index 0000000..99a2ea5 --- /dev/null +++ b/org.eclipse.modisco.facet.util.core/src/org/eclipse/modisco/facet/util/core/internal/exported/AbstractRegistry.java
@@ -0,0 +1,112 @@ +/******************************************************************************* + * Copyright (c) 2009 Mia-Software. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Nicolas Bros (Mia-Software) - initial API and implementation + * Gregoire Dupe (Mia-Software) - Bug 369987 - [Restructuring][Table] Switch to the new customization and facet framework + * Gregoire Dupe (Mia-Software) - Bug 373078 - API Cleaning + *******************************************************************************/ + +package org.eclipse.modisco.facet.util.core.internal.exported; + +import org.eclipse.core.runtime.IConfigurationElement; +import org.eclipse.core.runtime.IExtension; +import org.eclipse.core.runtime.IExtensionPoint; +import org.eclipse.core.runtime.IExtensionRegistry; +import org.eclipse.core.runtime.Platform; +import org.eclipse.modisco.facet.util.core.Logger; +import org.eclipse.modisco.facet.util.core.internal.Activator; +import org.eclipse.modisco.facet.util.core.internal.Messages; +import org.eclipse.osgi.util.NLS; + +/** + * Provides common functionality for extension registries. Call + * {@link #initialize()} in a sub-class to read the extension points. Implement + * {@link #handleRootElement(IConfigurationElement)} to read the root + * configuration elements of each extension. + * @since 0.2 + */ +public abstract class AbstractRegistry { +// copy of org.eclipse.emf.facet.infra.common.core.internal.extensions.AbstractRegistry + /** + * Initialize the registry by reading the extension point to discover + * extensions. This method calls + * {@link #handleRootElement(IConfigurationElement)} on each root + * configuration element. + */ + protected void initialize() { + final IExtensionRegistry extensionRegistry = Platform.getExtensionRegistry(); + final IExtensionPoint extensionPoint = extensionRegistry.getExtensionPoint( + getExtensionPointNamespace(), getExtensionPointName()); + + if (extensionPoint == null) { + Logger.logError("Extension point not found:" + getExtensionPointNamespace() //$NON-NLS-1$ + + "." + getExtensionPointName(), Activator.getDefault()); //$NON-NLS-1$ + return; + } + + final IExtension[] extensions = extensionPoint.getExtensions(); + for (final IExtension extension : extensions) { + final IConfigurationElement[] configurationElements = extension + .getConfigurationElements(); + for (final IConfigurationElement configurationElement : configurationElements) { + try { + handleRootElement(configurationElement); + } catch (Exception e) { + final String errogMsg = NLS + .bind("An exception occurred while loading registry of the extension point {0}. The problem occurred with the an extension contributed by the plug-in {1}", //$NON-NLS-1$ + getExtensionPointNamespace() + '.' + + getExtensionPointName(), + extension.getContributor().getName()); + Logger.logError(e, errogMsg, Activator.getDefault()); + } + } + } + } + + protected abstract String getExtensionPointNamespace(); + + protected abstract String getExtensionPointName(); + + /** Called for each root {@link IConfigurationElement} in the extension */ + protected abstract void handleRootElement(IConfigurationElement configurationElement); + + /** + * Logs the error in the log using the provided text and the information in + * the configuration element. + */ + protected static void logError(final IConfigurationElement element, final String text) { + final IExtension extension = element.getDeclaringExtension(); + final StringBuffer buf = new StringBuffer(); + buf.append(NLS.bind(Messages.AbstractRegistry_pluginExtension, extension + .getNamespaceIdentifier(), extension.getExtensionPointUniqueIdentifier())); + // look for an ID if available - this should help debugging + final String id = element.getAttribute("id"); //$NON-NLS-1$ + if (id != null) { + buf.append(Messages.AbstractRegistry_id); + buf.append(id); + } + buf.append(Messages.AbstractRegistry_colon + text); + Logger.logError(buf.toString(), Activator.getDefault()); + } + + /** + * Logs a very common registry error when a required attribute is missing. + */ + protected static void logMissingAttribute(final IConfigurationElement element, + final String attributeName) { + logError(element, NLS.bind(Messages.AbstractRegistry_requiredAttributeNotDefined, + attributeName)); + } + + /** + * Logs a registry error when the configuration element is unknown. + */ + protected static void logUnknownElement(final IConfigurationElement element) { + logError(element, Messages.AbstractRegistry_unknownExtensionTag + element.getName()); + } +}
diff --git a/org.eclipse.modisco.facet.util.core/src/org/eclipse/modisco/facet/util/core/internal/exported/FileUtils.java b/org.eclipse.modisco.facet.util.core/src/org/eclipse/modisco/facet/util/core/internal/exported/FileUtils.java new file mode 100644 index 0000000..b009397 --- /dev/null +++ b/org.eclipse.modisco.facet.util.core/src/org/eclipse/modisco/facet/util/core/internal/exported/FileUtils.java
@@ -0,0 +1,192 @@ +/******************************************************************************* + * Copyright (c) 2008, 2009, 2011 Mia-Software. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Nicolas Bros (Mia-Software) - initial API and implementation + * Nicolas Guyomar (Mia-Software) - Bug 340339 - Need some Utils class for Folder/File/Project management + * Nicolas Guyomar (Mia-Software) - Bug 342451 - To be able to edit derived facet attributes and derived facet references in a table + * Gregoire Dupe (Mia-Software) - Bug 373078 - API Cleaning + * Thomas Cicognani (Soft-Maint) - Bug 398079 - org.eclipse.emf.facet.util.core.internal.exported.FileUtils.copyFolderFromBundle + *******************************************************************************/ +package org.eclipse.modisco.facet.util.core.internal.exported; + +import java.io.File; +import java.io.FileInputStream; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.InputStream; +import java.io.InputStreamReader; +import java.io.Reader; +import java.net.URL; +import java.util.Enumeration; + +import org.eclipse.core.resources.IFile; +import org.eclipse.core.resources.IFolder; +import org.eclipse.core.resources.IProject; +import org.eclipse.core.runtime.CoreException; +import org.eclipse.core.runtime.NullProgressMonitor; +import org.osgi.framework.Bundle; + +/** + * @since 0.2 + */ +public final class FileUtils { + + // This class has been copied from org.eclipse.emf.facet.infra.common.core.internal.utils.FileUtils + + private static final int COPY_BUFFER_SIZE = 512 * 1024; + + private FileUtils() { + // Nothing + } + + /** Get the contents of a file from a Bundle */ + public static String getFileContents(final Bundle bundle, final String path) throws IOException { + InputStream source; + URL url = bundle.getResource(path); + if (url == null) { + return null; + } + source = url.openStream(); + return FileUtils.readInputStream(source); + } + + public static String readInputStream(final InputStream stream) throws IOException { + return readInputStream(stream, "UTF-8"); //$NON-NLS-1$ + } + + public static String readInputStream(final InputStream stream, final String charset) + throws IOException { + final int bufferSize = 65536; + final char[] buffer = new char[bufferSize]; + StringBuilder builder = new StringBuilder(); + Reader reader = new InputStreamReader(stream, charset); + int read; + do { + read = reader.read(buffer, 0, buffer.length); + if (read > 0) { + builder.append(buffer, 0, read); + } + } while (read >= 0); + + reader.close(); + return builder.toString(); + } + + /** + * Copy a folder contents from a bundle + * + * @param folderPath + * Folder path to copy + * @param project + * Copy folder into this {@link IProject} + * @param destinationPath + * Destination path + * @param bundleContainingResources + * Bundle which has resources to copy + * @param recurse + * <code>true</code> to copy recursively + * @throws IOException + * @throws CoreException + * @since 0.3 + */ + public static void copyFolderFromBundle(final String folderPath, final IProject project, + final String destinationPath, final Bundle bundleContainingResources, + final boolean recurse) + throws IOException, CoreException { + @SuppressWarnings("unchecked") + // @SuppressWarnings("unchecked") findEntries returns a raw type. + final Enumeration<URL> files = bundleContainingResources.findEntries(folderPath, "*.*", recurse); //$NON-NLS-1$ + while (files.hasMoreElements()) { + final URL element = files.nextElement(); + String filename = element.getFile().replace(folderPath, ""); //$NON-NLS-1$ + if (!filename.startsWith("/")) { //$NON-NLS-1$ + filename = "/" + filename; //$NON-NLS-1$ + } + copyFileFromBundle(element.getFile(), project, destinationPath + filename, bundleContainingResources); + } + } + + public static IFile copyFileFromBundle(final String sourcePath, final IProject project, + final String destinationPath, final Bundle bundleContainingResources) + throws IOException, CoreException { + InputStream source; + URL url = bundleContainingResources.getResource(sourcePath); + if (url != null) { + source = url.openStream(); + } else { + url = bundleContainingResources.getEntry(sourcePath); + if (url == null) { + throw new IOException(sourcePath + " not found."); //$NON-NLS-1$ + } + source = url.openStream(); + } + IFile javaFile = project.getFile(destinationPath); + if (javaFile.exists()) { + try { + javaFile.delete(true, new NullProgressMonitor()); + } catch (CoreException e) { + // problem deleting the file : try to close the project before deleting + if (project.isOpen()) { + try { + project.close(new NullProgressMonitor()); + javaFile.delete(true, new NullProgressMonitor()); + } finally { + project.open(new NullProgressMonitor()); + } + } + } + } + if (!javaFile.getParent().exists()) { + FolderUtils.createFolder((IFolder) javaFile.getParent()); + } + javaFile.create(source, true, new NullProgressMonitor()); + return javaFile; + } + + /** + * Copies the source file to the target file. + * + * @return <code>true</code> if successful, <code>false</code> otherwise + */ + public static final boolean copyFile(final File source, final File destination) { + boolean result = false; + FileInputStream sourceFile = null; + FileOutputStream destinationFile = null; + try { + // File creation + destination.createNewFile(); + sourceFile = new FileInputStream(source); + destinationFile = new FileOutputStream(destination); + // 0.5 MiB buffer for reading + byte[] buffer = new byte[FileUtils.COPY_BUFFER_SIZE]; + int nbRead; + while ((nbRead = sourceFile.read(buffer)) != -1) { + destinationFile.write(buffer, 0, nbRead); + } + + // Copied + result = true; + } catch (java.io.FileNotFoundException f) { + result = false; + } catch (java.io.IOException e) { + result = false; + } finally { + try { + if (sourceFile != null) { + sourceFile.close(); + } + if (destinationFile != null) { + destinationFile.close(); + } + } catch (Exception e) { + result = false; + } + } + return result; + } +}
diff --git a/org.eclipse.modisco.facet.util.core/src/org/eclipse/modisco/facet/util/core/internal/exported/FolderUtils.java b/org.eclipse.modisco.facet.util.core/src/org/eclipse/modisco/facet/util/core/internal/exported/FolderUtils.java new file mode 100644 index 0000000..6bf882d --- /dev/null +++ b/org.eclipse.modisco.facet.util.core/src/org/eclipse/modisco/facet/util/core/internal/exported/FolderUtils.java
@@ -0,0 +1,108 @@ +/******************************************************************************* + * Copyright (c) 2008, 2009 Mia-Software. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Gabriel Barbier (Mia-Software) - initial API and implementation + * Fabien Giquel (Mia-Software) + * Nicolas Bros (Mia-Software) + * Nicolas Guyomar (Mia-Software) - Bug 340339 - Need some Utils class for Folder/File/Project management + *******************************************************************************/ + +package org.eclipse.modisco.facet.util.core.internal.exported; + +import java.io.File; +import java.io.IOException; + +import org.eclipse.core.resources.IFolder; +import org.eclipse.core.runtime.CoreException; +import org.eclipse.core.runtime.NullProgressMonitor; + +/** + * @author Gabriel Barbier + * @since 0.2 + */ +public final class FolderUtils { + + // This class has been copied from org.eclipse.emf.facet.infra.common.core.internal.utils.FolderUtils + + private FolderUtils() { + // prevent instantiation + } + + /** + * This method delete the content of the folder + * @param folder The folder that has to be emptied + */ + public static final void clearFolder(final File folder) { + assert folder != null; + assert folder.exists(); + assert folder.isDirectory(); + /* + * To delete the contents of this folder, we recurse on all elements (File) in this folder. + * In the case of a directory, we first delete its own contents before deleting it. In the + * case of a file, we just delete the file. + */ + File[] files = folder.listFiles(); + for (File file : files) { + if (file.isDirectory()) { + FolderUtils.clearFolder(file); + } + file.delete(); + } + } + + /** + * This method create a folder and it parents if they do not exists. + * @param folder The folder that have to be created. + * @throws CoreException + */ + public static void createFolder(final IFolder folder) throws CoreException { + if (!folder.getParent().exists()) { + FolderUtils.createFolder((IFolder) folder.getParent()); + } + if (!folder.exists()) { + folder.create(true, true, new NullProgressMonitor()); + } + } + + /** + * Copies the source directory to the target directory. The target is + * created if it does not exist. + */ + public static final void copyFolder(final File srcDir, final File destDir) + throws IOException { + FolderUtils.copyFolder(srcDir, destDir, new IFilter<String>() { + public boolean filter(final String object) { + return true; + } + }); + } + + /** + * Copies the source directory to the target directory. + */ + public static final void copyFolder(final File srcDir, final File destDir, + final IFilter<String> filter) throws IOException { + + if (!destDir.exists()) { + destDir.mkdirs(); + } + File[] filesList = srcDir.listFiles(); + File dest; + // Copies each file and directory, one by one + for (File src : filesList) { + dest = new File(destDir.getPath() + File.separator + src.getName()); + if (filter.filter(dest.getAbsolutePath())) { + if (src.isDirectory()) { + FolderUtils.copyFolder(src, dest, filter); + } else { + FileUtils.copyFile(src, dest); + } + } + } + } +}
diff --git a/org.eclipse.modisco.facet.util.core/src/org/eclipse/modisco/facet/util/core/internal/exported/IFilter.java b/org.eclipse.modisco.facet.util.core/src/org/eclipse/modisco/facet/util/core/internal/exported/IFilter.java new file mode 100644 index 0000000..c3c5671 --- /dev/null +++ b/org.eclipse.modisco.facet.util.core/src/org/eclipse/modisco/facet/util/core/internal/exported/IFilter.java
@@ -0,0 +1,29 @@ +/******************************************************************************* + * Copyright (c) 2010, 2011 Mia-Software. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Gregoire DUPE (Mia-Software) - initial API and implementation + * Nicolas Bros (Mia-Software) + * Nicolas Guyomar (Mia-Software) - Bug 340339 - Need some Utils class for Folder/File/Project management + * Gregoire Dupe (Mia-Software) - Bug 340339 - Need some Utils class for Folder/File/Project management + *******************************************************************************/ +package org.eclipse.modisco.facet.util.core.internal.exported; + +/** + * @since 0.2 + */ +public interface IFilter<T> { + // This class has been copied from org.eclipse.emf.facet.infra.common.core.internal.utils.IFilter + + /** + * @param object + * an element to be filtered + * @return false if the element must be filtered out. + */ + public boolean filter(T object); + +}
diff --git a/org.eclipse.modisco.facet.util.core/src/org/eclipse/modisco/facet/util/core/internal/exported/ListUtils.java b/org.eclipse.modisco.facet.util.core/src/org/eclipse/modisco/facet/util/core/internal/exported/ListUtils.java new file mode 100644 index 0000000..a62ebac --- /dev/null +++ b/org.eclipse.modisco.facet.util.core/src/org/eclipse/modisco/facet/util/core/internal/exported/ListUtils.java
@@ -0,0 +1,33 @@ +/******************************************************************************* + * Copyright (c) 2012 CEA-LIST + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Gregoire Dupe (Mia-Software) - Bug 375087 - [Table] ITableWidget.addColumn(List<ETypedElement>, List<FacetSet>) + *******************************************************************************/ +package org.eclipse.modisco.facet.util.core.internal.exported; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.List; + +/** + * @since 0.2 + */ +public final class ListUtils { + + private ListUtils() { + // Must not be used. + } + + public static <T> List<T> cleanList(final Collection<T> collection) { + final List<T> cleanList = new ArrayList<T>(collection); + while (cleanList.contains(null)) { + cleanList.remove(null); + } + return cleanList; + } +}
diff --git a/org.eclipse.modisco.facet.util.core/src/org/eclipse/modisco/facet/util/core/internal/exported/StringUtils.java b/org.eclipse.modisco.facet.util.core/src/org/eclipse/modisco/facet/util/core/internal/exported/StringUtils.java new file mode 100644 index 0000000..b47475a --- /dev/null +++ b/org.eclipse.modisco.facet.util.core/src/org/eclipse/modisco/facet/util/core/internal/exported/StringUtils.java
@@ -0,0 +1,108 @@ +/******************************************************************************* + * Copyright (c) 2008, 2009 Mia-Software. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Gabriel Barbier (Mia-Software) - initial API and implementation + * Nicolas Bros (Mia-Software) + * Gregoire Dupe (Mia-Software) - Bug 366804 - [Restructuring] Table widget upgrade + * Gregoire Dupe (Mia-Software) - Bug 373078 - API Cleaning + *******************************************************************************/ + +package org.eclipse.modisco.facet.util.core.internal.exported; + + +import org.eclipse.modisco.facet.util.core.internal.Messages; + +import com.ibm.icu.lang.UCharacter; + +/** + * @author Gabriel Barbier + * @since 0.2 + */ +// Copied from org.eclipse.emf.facet.infra.common.core.internal.utils.StringUtils +public final class StringUtils { + public static final String ELLIPSIS = Messages.StringUtils_ellipsis; + private static final int TRUNCATE_AFTER = 150; + + private StringUtils() { + // prevent instantiation + } + + public static String firstLetterToLowerCase(final String source) { + String result; + if (source.length() == 0) { + result = source; + } else if (source.length() == 1) { + result = source.toLowerCase(); + } else { + result = source.substring(0, 1).toLowerCase() + source.substring(1); + } + return result; + } + + public static String firstLetterToUpperCase(final String source) { + String result; + if (source.length() == 0) { + result = source; + } else if (source.length() == 1) { + result = source.toUpperCase(); + } else { + result = source.substring(0, 1).toUpperCase() + source.substring(1); + } + return result; + } + + /** + * Truncate the given String before the first newline or a maximum number of + * characters, whichever comes first. Adds an ellipsis ("...") if it was + * effectively truncated. + * + * @param str + * the string to truncate + * @return the part of the given string before the first newline + */ + public static String truncateBeforeNewline(final String str) { + int endIndex = str.indexOf('\r'); + if (endIndex == -1) { + endIndex = str.indexOf('\n'); + } + if (endIndex != -1 && endIndex <= StringUtils.TRUNCATE_AFTER) { + return str.substring(0, endIndex) + StringUtils.ELLIPSIS; + } + if (endIndex == -1) { + endIndex = str.length(); + } + + if (endIndex > StringUtils.TRUNCATE_AFTER) { + return str.substring(0, StringUtils.TRUNCATE_AFTER / 2) + StringUtils.ELLIPSIS + + str.substring(str.length() - StringUtils.TRUNCATE_AFTER / 2, endIndex); + } + return str; + } + + /** + * Get a name suitable for a Java class from the given name. Capitalizes the + * first letter and each letter after a space, and removes spaces. + */ + public static String inferJavaClassName(final String name) { + String upperName = StringUtils.firstLetterToUpperCase(name.trim()); + StringBuilder javaName = new StringBuilder(); + boolean space = false; + for (int i = 0; i < upperName.length(); i++) { + char c = upperName.charAt(i); + if (c == ' ') { + space = true; + } else if (space) { + javaName.append(UCharacter.toUpperCase(c)); + space = false; + } else { + javaName.append(c); + } + } + return javaName.toString(); + } +}
diff --git a/org.eclipse.modisco.facet.util.core/src/org/eclipse/emf/facet/util/core/internal/messages.properties b/org.eclipse.modisco.facet.util.core/src/org/eclipse/modisco/facet/util/core/internal/messages.properties similarity index 100% rename from org.eclipse.modisco.facet.util.core/src/org/eclipse/emf/facet/util/core/internal/messages.properties rename to org.eclipse.modisco.facet.util.core/src/org/eclipse/modisco/facet/util/core/internal/messages.properties
diff --git a/org.eclipse.modisco.facet.util.emf.catalog.metamodel/META-INF/MANIFEST.MF b/org.eclipse.modisco.facet.util.emf.catalog.metamodel/META-INF/MANIFEST.MF index 4b0941b..a5712b9 100644 --- a/org.eclipse.modisco.facet.util.emf.catalog.metamodel/META-INF/MANIFEST.MF +++ b/org.eclipse.modisco.facet.util.emf.catalog.metamodel/META-INF/MANIFEST.MF
@@ -4,13 +4,13 @@ Bundle-SymbolicName: org.eclipse.emf.facet.util.emf.catalog.metamodel;singleton:=true Bundle-Version: 1.3.0.qualifier Bundle-ClassPath: . -Bundle-Activator: org.eclipse.emf.facet.util.emf.catalog.metamodel.internal.Activator +Bundle-Activator: org.eclipse.modisco.facet.util.emf.catalog.metamodel.internal.Activator Bundle-Vendor: %Bundle-Vendor Require-Bundle: org.eclipse.core.runtime, org.eclipse.emf.ecore;visibility:=reexport Bundle-RequiredExecutionEnvironment: JavaSE-1.8 -Export-Package: org.eclipse.emf.facet.util.emf.catalog.metamodel.internal.v1_1.catalog;x-friends:="org.eclipse.emf.facet.util.emf.core", - org.eclipse.emf.facet.util.emf.catalog.metamodel.internal.v1_1.catalog.impl;x-internal:=true, - org.eclipse.emf.facet.util.emf.catalog.metamodel.internal.v1_1.catalog.util;x-internal:=true +Export-Package: org.eclipse.modisco.facet.util.emf.catalog.metamodel.internal.v1_1.catalog;x-friends:="org.eclipse.emf.facet.util.emf.core", + org.eclipse.modisco.facet.util.emf.catalog.metamodel.internal.v1_1.catalog.impl;x-internal:=true, + org.eclipse.modisco.facet.util.emf.catalog.metamodel.internal.v1_1.catalog.util;x-internal:=true Bundle-ActivationPolicy: lazy Automatic-Module-Name: org.eclipse.emf.facet.util.emf.catalog.metamodel
diff --git a/org.eclipse.modisco.facet.util.emf.catalog.metamodel/plugin.xml b/org.eclipse.modisco.facet.util.emf.catalog.metamodel/plugin.xml index 2db715f..cc945db 100644 --- a/org.eclipse.modisco.facet.util.emf.catalog.metamodel/plugin.xml +++ b/org.eclipse.modisco.facet.util.emf.catalog.metamodel/plugin.xml
@@ -16,7 +16,7 @@ <!-- @generated catalog-1.1 --> <package uri="http://www.eclipse.org/emf/facet/catalog/1.1.0/internal/catalog/" - class="org.eclipse.emf.facet.util.emf.catalog.metamodel.internal.v1_1.catalog.CatalogPackage" + class="org.eclipse.modisco.facet.util.emf.catalog.metamodel.internal.v1_1.catalog.CatalogPackage" genModel="model/catalog-1.1.genmodel"/> </extension>
diff --git a/org.eclipse.modisco.facet.util.emf.catalog.metamodel/src/org/eclipse/emf/facet/util/emf/catalog/metamodel/internal/Activator.java b/org.eclipse.modisco.facet.util.emf.catalog.metamodel/src/org/eclipse/emf/facet/util/emf/catalog/metamodel/internal/Activator.java deleted file mode 100644 index 3c262e2..0000000 --- a/org.eclipse.modisco.facet.util.emf.catalog.metamodel/src/org/eclipse/emf/facet/util/emf/catalog/metamodel/internal/Activator.java +++ /dev/null
@@ -1,50 +0,0 @@ -/** - * Copyright (c) 2015 Mia-Software. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Grégoire Dupé (Mia-Software) - Bug 477657 - The catalog manager should be able to manage workspace model - */ -package org.eclipse.emf.facet.util.emf.catalog.metamodel.internal; - -import org.eclipse.core.runtime.Plugin; -import org.osgi.framework.BundleContext; - -@SuppressWarnings("PMD.UseSingleton") -// @SuppressWarnings("PMD.UseSingleton") We cannot conforms to this rule because -// this class is an Eclipse plug-in activator which will be instantiated by the -// Eclipse framework. -public class Activator extends Plugin { - - private static Activator plugin; - - @Override - @SuppressWarnings("PMD.SignatureDeclareThrowsException") - // @SuppressWarnings("PMD.SignatureDeclareThrowsException") We have to use - // this signature because this is an override of an Eclipse framework's - // method. - public void start(final BundleContext bundleContext) throws Exception { - super.start(bundleContext); - Activator.plugin = this; - } - - @Override - @SuppressWarnings("PMD.SignatureDeclareThrowsException") - // @SuppressWarnings("PMD.SignatureDeclareThrowsException") We have to use - // this signature because this is an override of an Eclipse framework's - // method. - public void stop(final BundleContext bundleContext) throws Exception { - // NOPMD: PMD say "Assigning an Object to null is a code smell." - // No choice to right it in another way : this is an Eclipse pattern. - Activator.plugin = null; // NOPMD by gdupe on 30/03/12 10:19 - super.stop(bundleContext); - } - - public static Plugin getDefault() { - return Activator.plugin; - } - -} \ No newline at end of file
diff --git a/org.eclipse.modisco.facet.util.emf.catalog.metamodel/src/org/eclipse/emf/facet/util/emf/catalog/metamodel/internal/v1_1/catalog/CatalogFactory.java b/org.eclipse.modisco.facet.util.emf.catalog.metamodel/src/org/eclipse/emf/facet/util/emf/catalog/metamodel/internal/v1_1/catalog/CatalogFactory.java deleted file mode 100644 index 4557957..0000000 --- a/org.eclipse.modisco.facet.util.emf.catalog.metamodel/src/org/eclipse/emf/facet/util/emf/catalog/metamodel/internal/v1_1/catalog/CatalogFactory.java +++ /dev/null
@@ -1,50 +0,0 @@ -/** - * Copyright (c) 2015 Mia-Software. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Grégoire Dupé (Mia-Software) - Bug 477657 - The catalog manager should be able to manage workspace model - */ -package org.eclipse.emf.facet.util.emf.catalog.metamodel.internal.v1_1.catalog; - -import org.eclipse.emf.ecore.EFactory; - -/** - * <!-- begin-user-doc --> - * The <b>Factory</b> for the model. - * It provides a create method for each non-abstract class of the model. - * <!-- end-user-doc --> - * @see org.eclipse.emf.facet.util.emf.catalog.metamodel.internal.v1_1.catalog.CatalogPackage - * @generated - */ -public interface CatalogFactory extends EFactory { - /** - * The singleton instance of the factory. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - CatalogFactory eINSTANCE = org.eclipse.emf.facet.util.emf.catalog.metamodel.internal.v1_1.catalog.impl.CatalogFactoryImpl.init(); - - /** - * Returns a new object of class '<em>Install And Wokspace Catalog</em>'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return a new object of class '<em>Install And Wokspace Catalog</em>'. - * @generated - */ - InstallAndWokspaceCatalog createInstallAndWokspaceCatalog(); - - /** - * Returns the package supported by this factory. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the package supported by this factory. - * @generated - */ - CatalogPackage getCatalogPackage(); - -} //CatalogFactory
diff --git a/org.eclipse.modisco.facet.util.emf.catalog.metamodel/src/org/eclipse/emf/facet/util/emf/catalog/metamodel/internal/v1_1/catalog/CatalogPackage.java b/org.eclipse.modisco.facet.util.emf.catalog.metamodel/src/org/eclipse/emf/facet/util/emf/catalog/metamodel/internal/v1_1/catalog/CatalogPackage.java deleted file mode 100644 index b499464..0000000 --- a/org.eclipse.modisco.facet.util.emf.catalog.metamodel/src/org/eclipse/emf/facet/util/emf/catalog/metamodel/internal/v1_1/catalog/CatalogPackage.java +++ /dev/null
@@ -1,196 +0,0 @@ -/** - * Copyright (c) 2015 Mia-Software. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Grégoire Dupé (Mia-Software) - Bug 477657 - The catalog manager should be able to manage workspace model - */ -package org.eclipse.emf.facet.util.emf.catalog.metamodel.internal.v1_1.catalog; - -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.ecore.EPackage; -import org.eclipse.emf.ecore.EReference; - -/** - * <!-- begin-user-doc --> - * The <b>Package</b> for the model. - * It contains accessors for the meta objects to represent - * <ul> - * <li>each class,</li> - * <li>each feature of each class,</li> - * <li>each operation of each class,</li> - * <li>each enum,</li> - * <li>and each data type</li> - * </ul> - * <!-- end-user-doc --> - * @see org.eclipse.emf.facet.util.emf.catalog.metamodel.internal.v1_1.catalog.CatalogFactory - * @model kind="package" - * @generated - */ -public interface CatalogPackage extends EPackage { - /** - * The package name. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - String eNAME = "catalog"; - - /** - * The package namespace URI. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - String eNS_URI = "http://www.eclipse.org/emf/facet/catalog/1.1.0/internal/catalog/"; - - /** - * The package namespace name. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - String eNS_PREFIX = "catalog"; - - /** - * The singleton instance of the package. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - CatalogPackage eINSTANCE = org.eclipse.emf.facet.util.emf.catalog.metamodel.internal.v1_1.catalog.impl.CatalogPackageImpl.init(); - - /** - * The meta object id for the '{@link org.eclipse.emf.facet.util.emf.catalog.metamodel.internal.v1_1.catalog.impl.InstallAndWokspaceCatalogImpl <em>Install And Wokspace Catalog</em>}' class. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see org.eclipse.emf.facet.util.emf.catalog.metamodel.internal.v1_1.catalog.impl.InstallAndWokspaceCatalogImpl - * @see org.eclipse.emf.facet.util.emf.catalog.metamodel.internal.v1_1.catalog.impl.CatalogPackageImpl#getInstallAndWokspaceCatalog() - * @generated - */ - int INSTALL_AND_WOKSPACE_CATALOG = 0; - - /** - * The feature id for the '<em><b>Installed Entries</b></em>' reference list. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int INSTALL_AND_WOKSPACE_CATALOG__INSTALLED_ENTRIES = 0; - - /** - * The feature id for the '<em><b>Workspace Entries</b></em>' reference list. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int INSTALL_AND_WOKSPACE_CATALOG__WORKSPACE_ENTRIES = 1; - - /** - * The number of structural features of the '<em>Install And Wokspace Catalog</em>' class. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int INSTALL_AND_WOKSPACE_CATALOG_FEATURE_COUNT = 2; - - /** - * The number of operations of the '<em>Install And Wokspace Catalog</em>' class. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int INSTALL_AND_WOKSPACE_CATALOG_OPERATION_COUNT = 0; - - - /** - * Returns the meta object for class '{@link org.eclipse.emf.facet.util.emf.catalog.metamodel.internal.v1_1.catalog.InstallAndWokspaceCatalog <em>Install And Wokspace Catalog</em>}'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the meta object for class '<em>Install And Wokspace Catalog</em>'. - * @see org.eclipse.emf.facet.util.emf.catalog.metamodel.internal.v1_1.catalog.InstallAndWokspaceCatalog - * @generated - */ - EClass getInstallAndWokspaceCatalog(); - - /** - * Returns the meta object for the reference list '{@link org.eclipse.emf.facet.util.emf.catalog.metamodel.internal.v1_1.catalog.InstallAndWokspaceCatalog#getInstalledEntries <em>Installed Entries</em>}'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the meta object for the reference list '<em>Installed Entries</em>'. - * @see org.eclipse.emf.facet.util.emf.catalog.metamodel.internal.v1_1.catalog.InstallAndWokspaceCatalog#getInstalledEntries() - * @see #getInstallAndWokspaceCatalog() - * @generated - */ - EReference getInstallAndWokspaceCatalog_InstalledEntries(); - - /** - * Returns the meta object for the reference list '{@link org.eclipse.emf.facet.util.emf.catalog.metamodel.internal.v1_1.catalog.InstallAndWokspaceCatalog#getWorkspaceEntries <em>Workspace Entries</em>}'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the meta object for the reference list '<em>Workspace Entries</em>'. - * @see org.eclipse.emf.facet.util.emf.catalog.metamodel.internal.v1_1.catalog.InstallAndWokspaceCatalog#getWorkspaceEntries() - * @see #getInstallAndWokspaceCatalog() - * @generated - */ - EReference getInstallAndWokspaceCatalog_WorkspaceEntries(); - - /** - * Returns the factory that creates the instances of the model. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the factory that creates the instances of the model. - * @generated - */ - CatalogFactory getCatalogFactory(); - - /** - * <!-- begin-user-doc --> - * Defines literals for the meta objects that represent - * <ul> - * <li>each class,</li> - * <li>each feature of each class,</li> - * <li>each operation of each class,</li> - * <li>each enum,</li> - * <li>and each data type</li> - * </ul> - * <!-- end-user-doc --> - * @generated - */ - interface Literals { - /** - * The meta object literal for the '{@link org.eclipse.emf.facet.util.emf.catalog.metamodel.internal.v1_1.catalog.impl.InstallAndWokspaceCatalogImpl <em>Install And Wokspace Catalog</em>}' class. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see org.eclipse.emf.facet.util.emf.catalog.metamodel.internal.v1_1.catalog.impl.InstallAndWokspaceCatalogImpl - * @see org.eclipse.emf.facet.util.emf.catalog.metamodel.internal.v1_1.catalog.impl.CatalogPackageImpl#getInstallAndWokspaceCatalog() - * @generated - */ - EClass INSTALL_AND_WOKSPACE_CATALOG = eINSTANCE.getInstallAndWokspaceCatalog(); - - /** - * The meta object literal for the '<em><b>Installed Entries</b></em>' reference list feature. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - EReference INSTALL_AND_WOKSPACE_CATALOG__INSTALLED_ENTRIES = eINSTANCE.getInstallAndWokspaceCatalog_InstalledEntries(); - - /** - * The meta object literal for the '<em><b>Workspace Entries</b></em>' reference list feature. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - EReference INSTALL_AND_WOKSPACE_CATALOG__WORKSPACE_ENTRIES = eINSTANCE.getInstallAndWokspaceCatalog_WorkspaceEntries(); - - } - -} //CatalogPackage
diff --git a/org.eclipse.modisco.facet.util.emf.catalog.metamodel/src/org/eclipse/emf/facet/util/emf/catalog/metamodel/internal/v1_1/catalog/InstallAndWokspaceCatalog.java b/org.eclipse.modisco.facet.util.emf.catalog.metamodel/src/org/eclipse/emf/facet/util/emf/catalog/metamodel/internal/v1_1/catalog/InstallAndWokspaceCatalog.java deleted file mode 100644 index 6b36ba8..0000000 --- a/org.eclipse.modisco.facet.util.emf.catalog.metamodel/src/org/eclipse/emf/facet/util/emf/catalog/metamodel/internal/v1_1/catalog/InstallAndWokspaceCatalog.java +++ /dev/null
@@ -1,70 +0,0 @@ -/** - * Copyright (c) 2015 Mia-Software. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Grégoire Dupé (Mia-Software) - Bug 477657 - The catalog manager should be able to manage workspace model - */ -package org.eclipse.emf.facet.util.emf.catalog.metamodel.internal.v1_1.catalog; - -import org.eclipse.emf.common.util.EList; - -import org.eclipse.emf.ecore.EObject; - -/** - * <!-- begin-user-doc --> - * A representation of the model object '<em><b>Install And Wokspace Catalog</b></em>'. - * <!-- end-user-doc --> - * - * <!-- begin-model-doc --> - * A EMF Facet Catalog catalog is a way to references sets of EObject. - * It has to be subclassed for each user catalog, especially to create derived links to access elements with their right type. - * <!-- end-model-doc --> - * - * <p> - * The following features are supported: - * </p> - * <ul> - * <li>{@link org.eclipse.emf.facet.util.emf.catalog.metamodel.internal.v1_1.catalog.InstallAndWokspaceCatalog#getInstalledEntries <em>Installed Entries</em>}</li> - * <li>{@link org.eclipse.emf.facet.util.emf.catalog.metamodel.internal.v1_1.catalog.InstallAndWokspaceCatalog#getWorkspaceEntries <em>Workspace Entries</em>}</li> - * </ul> - * - * @see org.eclipse.emf.facet.util.emf.catalog.metamodel.internal.v1_1.catalog.CatalogPackage#getInstallAndWokspaceCatalog() - * @model - * @generated - */ -public interface InstallAndWokspaceCatalog extends EObject { - /** - * Returns the value of the '<em><b>Installed Entries</b></em>' reference list. - * The list contents are of type {@link org.eclipse.emf.ecore.EObject}. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * <!-- begin-model-doc --> - * "installedEntries" represents all the EObject initially registered through the registration extension point. - * <!-- end-model-doc --> - * @return the value of the '<em>Installed Entries</em>' reference list. - * @see org.eclipse.emf.facet.util.emf.catalog.metamodel.internal.v1_1.catalog.CatalogPackage#getInstallAndWokspaceCatalog_InstalledEntries() - * @model transient="true" - * @generated - */ - EList<EObject> getInstalledEntries(); - - /** - * Returns the value of the '<em><b>Workspace Entries</b></em>' reference list. - * The list contents are of type {@link org.eclipse.emf.ecore.EObject}. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * <!-- begin-model-doc --> - * "installedEntries" represents all the EObject initially registered through the registration extension point. - * <!-- end-model-doc --> - * @return the value of the '<em>Workspace Entries</em>' reference list. - * @see org.eclipse.emf.facet.util.emf.catalog.metamodel.internal.v1_1.catalog.CatalogPackage#getInstallAndWokspaceCatalog_WorkspaceEntries() - * @model - * @generated - */ - EList<EObject> getWorkspaceEntries(); - -} // InstallAndWokspaceCatalog
diff --git a/org.eclipse.modisco.facet.util.emf.catalog.metamodel/src/org/eclipse/emf/facet/util/emf/catalog/metamodel/internal/v1_1/catalog/impl/CatalogFactoryImpl.java b/org.eclipse.modisco.facet.util.emf.catalog.metamodel/src/org/eclipse/emf/facet/util/emf/catalog/metamodel/internal/v1_1/catalog/impl/CatalogFactoryImpl.java deleted file mode 100644 index 30256e5..0000000 --- a/org.eclipse.modisco.facet.util.emf.catalog.metamodel/src/org/eclipse/emf/facet/util/emf/catalog/metamodel/internal/v1_1/catalog/impl/CatalogFactoryImpl.java +++ /dev/null
@@ -1,103 +0,0 @@ -/** - * Copyright (c) 2015 Mia-Software. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Grégoire Dupé (Mia-Software) - Bug 477657 - The catalog manager should be able to manage workspace model - */ -package org.eclipse.emf.facet.util.emf.catalog.metamodel.internal.v1_1.catalog.impl; - -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.EPackage; - -import org.eclipse.emf.ecore.impl.EFactoryImpl; - -import org.eclipse.emf.ecore.plugin.EcorePlugin; - -import org.eclipse.emf.facet.util.emf.catalog.metamodel.internal.v1_1.catalog.*; - -/** - * <!-- begin-user-doc --> - * An implementation of the model <b>Factory</b>. - * <!-- end-user-doc --> - * @generated - */ -public class CatalogFactoryImpl extends EFactoryImpl implements CatalogFactory { - /** - * Creates the default factory implementation. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public static CatalogFactory init() { - try { - CatalogFactory theCatalogFactory = (CatalogFactory)EPackage.Registry.INSTANCE.getEFactory(CatalogPackage.eNS_URI); - if (theCatalogFactory != null) { - return theCatalogFactory; - } - } - catch (Exception exception) { - EcorePlugin.INSTANCE.log(exception); - } - return new CatalogFactoryImpl(); - } - - /** - * Creates an instance of the factory. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public CatalogFactoryImpl() { - super(); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public EObject create(EClass eClass) { - switch (eClass.getClassifierID()) { - case CatalogPackage.INSTALL_AND_WOKSPACE_CATALOG: return createInstallAndWokspaceCatalog(); - default: - throw new IllegalArgumentException("The class '" + eClass.getName() + "' is not a valid classifier"); - } - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public InstallAndWokspaceCatalog createInstallAndWokspaceCatalog() { - InstallAndWokspaceCatalogImpl installAndWokspaceCatalog = new InstallAndWokspaceCatalogImpl(); - return installAndWokspaceCatalog; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public CatalogPackage getCatalogPackage() { - return (CatalogPackage)getEPackage(); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @deprecated - * @generated - */ - @Deprecated - public static CatalogPackage getPackage() { - return CatalogPackage.eINSTANCE; - } - -} //CatalogFactoryImpl
diff --git a/org.eclipse.modisco.facet.util.emf.catalog.metamodel/src/org/eclipse/emf/facet/util/emf/catalog/metamodel/internal/v1_1/catalog/impl/CatalogPackageImpl.java b/org.eclipse.modisco.facet.util.emf.catalog.metamodel/src/org/eclipse/emf/facet/util/emf/catalog/metamodel/internal/v1_1/catalog/impl/CatalogPackageImpl.java deleted file mode 100644 index 3448c1d..0000000 --- a/org.eclipse.modisco.facet.util.emf.catalog.metamodel/src/org/eclipse/emf/facet/util/emf/catalog/metamodel/internal/v1_1/catalog/impl/CatalogPackageImpl.java +++ /dev/null
@@ -1,196 +0,0 @@ -/** - * Copyright (c) 2015 Mia-Software. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Grégoire Dupé (Mia-Software) - Bug 477657 - The catalog manager should be able to manage workspace model - */ -package org.eclipse.emf.facet.util.emf.catalog.metamodel.internal.v1_1.catalog.impl; - -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.ecore.EPackage; -import org.eclipse.emf.ecore.EReference; - -import org.eclipse.emf.ecore.impl.EPackageImpl; - -import org.eclipse.emf.facet.util.emf.catalog.metamodel.internal.v1_1.catalog.CatalogFactory; -import org.eclipse.emf.facet.util.emf.catalog.metamodel.internal.v1_1.catalog.CatalogPackage; -import org.eclipse.emf.facet.util.emf.catalog.metamodel.internal.v1_1.catalog.InstallAndWokspaceCatalog; - -/** - * <!-- begin-user-doc --> - * An implementation of the model <b>Package</b>. - * <!-- end-user-doc --> - * @generated - */ -public class CatalogPackageImpl extends EPackageImpl implements CatalogPackage { - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - private EClass installAndWokspaceCatalogEClass = null; - - /** - * Creates an instance of the model <b>Package</b>, registered with - * {@link org.eclipse.emf.ecore.EPackage.Registry EPackage.Registry} by the package - * package URI value. - * <p>Note: the correct way to create the package is via the static - * factory method {@link #init init()}, which also performs - * initialization of the package, or returns the registered package, - * if one already exists. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see org.eclipse.emf.ecore.EPackage.Registry - * @see org.eclipse.emf.facet.util.emf.catalog.metamodel.internal.v1_1.catalog.CatalogPackage#eNS_URI - * @see #init() - * @generated - */ - private CatalogPackageImpl() { - super(eNS_URI, CatalogFactory.eINSTANCE); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - private static boolean isInited = false; - - /** - * Creates, registers, and initializes the <b>Package</b> for this model, and for any others upon which it depends. - * - * <p>This method is used to initialize {@link CatalogPackage#eINSTANCE} when that field is accessed. - * Clients should not invoke it directly. Instead, they should simply access that field to obtain the package. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #eNS_URI - * @see #createPackageContents() - * @see #initializePackageContents() - * @generated - */ - public static CatalogPackage init() { - if (isInited) return (CatalogPackage)EPackage.Registry.INSTANCE.getEPackage(CatalogPackage.eNS_URI); - - // Obtain or create and register package - CatalogPackageImpl theCatalogPackage = (CatalogPackageImpl)(EPackage.Registry.INSTANCE.get(eNS_URI) instanceof CatalogPackageImpl ? EPackage.Registry.INSTANCE.get(eNS_URI) : new CatalogPackageImpl()); - - isInited = true; - - // Create package meta-data objects - theCatalogPackage.createPackageContents(); - - // Initialize created meta-data - theCatalogPackage.initializePackageContents(); - - // Mark meta-data to indicate it can't be changed - theCatalogPackage.freeze(); - - - // Update the registry and return the package - EPackage.Registry.INSTANCE.put(CatalogPackage.eNS_URI, theCatalogPackage); - return theCatalogPackage; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EClass getInstallAndWokspaceCatalog() { - return installAndWokspaceCatalogEClass; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EReference getInstallAndWokspaceCatalog_InstalledEntries() { - return (EReference)installAndWokspaceCatalogEClass.getEStructuralFeatures().get(0); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EReference getInstallAndWokspaceCatalog_WorkspaceEntries() { - return (EReference)installAndWokspaceCatalogEClass.getEStructuralFeatures().get(1); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public CatalogFactory getCatalogFactory() { - return (CatalogFactory)getEFactoryInstance(); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - private boolean isCreated = false; - - /** - * Creates the meta-model objects for the package. This method is - * guarded to have no affect on any invocation but its first. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public void createPackageContents() { - if (isCreated) return; - isCreated = true; - - // Create classes and their features - installAndWokspaceCatalogEClass = createEClass(INSTALL_AND_WOKSPACE_CATALOG); - createEReference(installAndWokspaceCatalogEClass, INSTALL_AND_WOKSPACE_CATALOG__INSTALLED_ENTRIES); - createEReference(installAndWokspaceCatalogEClass, INSTALL_AND_WOKSPACE_CATALOG__WORKSPACE_ENTRIES); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - private boolean isInitialized = false; - - /** - * Complete the initialization of the package and its meta-model. This - * method is guarded to have no affect on any invocation but its first. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public void initializePackageContents() { - if (isInitialized) return; - isInitialized = true; - - // Initialize package - setName(eNAME); - setNsPrefix(eNS_PREFIX); - setNsURI(eNS_URI); - - // Create type parameters - - // Set bounds for type parameters - - // Add supertypes to classes - - // Initialize classes, features, and operations; add parameters - initEClass(installAndWokspaceCatalogEClass, InstallAndWokspaceCatalog.class, "InstallAndWokspaceCatalog", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); - initEReference(getInstallAndWokspaceCatalog_InstalledEntries(), ecorePackage.getEObject(), null, "installedEntries", null, 0, -1, InstallAndWokspaceCatalog.class, IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); - initEReference(getInstallAndWokspaceCatalog_WorkspaceEntries(), ecorePackage.getEObject(), null, "workspaceEntries", null, 0, -1, InstallAndWokspaceCatalog.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); - - // Create resource - createResource(eNS_URI); - } - -} //CatalogPackageImpl
diff --git a/org.eclipse.modisco.facet.util.emf.catalog.metamodel/src/org/eclipse/emf/facet/util/emf/catalog/metamodel/internal/v1_1/catalog/impl/InstallAndWokspaceCatalogImpl.java b/org.eclipse.modisco.facet.util.emf.catalog.metamodel/src/org/eclipse/emf/facet/util/emf/catalog/metamodel/internal/v1_1/catalog/impl/InstallAndWokspaceCatalogImpl.java deleted file mode 100644 index b6a3fed..0000000 --- a/org.eclipse.modisco.facet.util.emf.catalog.metamodel/src/org/eclipse/emf/facet/util/emf/catalog/metamodel/internal/v1_1/catalog/impl/InstallAndWokspaceCatalogImpl.java +++ /dev/null
@@ -1,176 +0,0 @@ -/** - * Copyright (c) 2015 Mia-Software. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Grégoire Dupé (Mia-Software) - Bug 477657 - The catalog manager should be able to manage workspace model - */ -package org.eclipse.emf.facet.util.emf.catalog.metamodel.internal.v1_1.catalog.impl; - -import java.util.Collection; - -import org.eclipse.emf.common.util.EList; - -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.ecore.EObject; - -import org.eclipse.emf.ecore.impl.MinimalEObjectImpl; - -import org.eclipse.emf.ecore.util.EObjectResolvingEList; - -import org.eclipse.emf.facet.util.emf.catalog.metamodel.internal.v1_1.catalog.CatalogPackage; -import org.eclipse.emf.facet.util.emf.catalog.metamodel.internal.v1_1.catalog.InstallAndWokspaceCatalog; - -/** - * <!-- begin-user-doc --> - * An implementation of the model object '<em><b>Install And Wokspace Catalog</b></em>'. - * <!-- end-user-doc --> - * <p> - * The following features are implemented: - * </p> - * <ul> - * <li>{@link org.eclipse.emf.facet.util.emf.catalog.metamodel.internal.v1_1.catalog.impl.InstallAndWokspaceCatalogImpl#getInstalledEntries <em>Installed Entries</em>}</li> - * <li>{@link org.eclipse.emf.facet.util.emf.catalog.metamodel.internal.v1_1.catalog.impl.InstallAndWokspaceCatalogImpl#getWorkspaceEntries <em>Workspace Entries</em>}</li> - * </ul> - * - * @generated - */ -public class InstallAndWokspaceCatalogImpl extends MinimalEObjectImpl.Container implements InstallAndWokspaceCatalog { - /** - * The cached value of the '{@link #getInstalledEntries() <em>Installed Entries</em>}' reference list. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #getInstalledEntries() - * @generated - * @ordered - */ - protected EList<EObject> installedEntries; - - /** - * The cached value of the '{@link #getWorkspaceEntries() <em>Workspace Entries</em>}' reference list. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #getWorkspaceEntries() - * @generated - * @ordered - */ - protected EList<EObject> workspaceEntries; - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected InstallAndWokspaceCatalogImpl() { - super(); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - protected EClass eStaticClass() { - return CatalogPackage.Literals.INSTALL_AND_WOKSPACE_CATALOG; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EList<EObject> getInstalledEntries() { - if (installedEntries == null) { - installedEntries = new EObjectResolvingEList<EObject>(EObject.class, this, CatalogPackage.INSTALL_AND_WOKSPACE_CATALOG__INSTALLED_ENTRIES); - } - return installedEntries; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EList<EObject> getWorkspaceEntries() { - if (workspaceEntries == null) { - workspaceEntries = new EObjectResolvingEList<EObject>(EObject.class, this, CatalogPackage.INSTALL_AND_WOKSPACE_CATALOG__WORKSPACE_ENTRIES); - } - return workspaceEntries; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public Object eGet(int featureID, boolean resolve, boolean coreType) { - switch (featureID) { - case CatalogPackage.INSTALL_AND_WOKSPACE_CATALOG__INSTALLED_ENTRIES: - return getInstalledEntries(); - case CatalogPackage.INSTALL_AND_WOKSPACE_CATALOG__WORKSPACE_ENTRIES: - return getWorkspaceEntries(); - } - return super.eGet(featureID, resolve, coreType); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @SuppressWarnings("unchecked") - @Override - public void eSet(int featureID, Object newValue) { - switch (featureID) { - case CatalogPackage.INSTALL_AND_WOKSPACE_CATALOG__INSTALLED_ENTRIES: - getInstalledEntries().clear(); - getInstalledEntries().addAll((Collection<? extends EObject>)newValue); - return; - case CatalogPackage.INSTALL_AND_WOKSPACE_CATALOG__WORKSPACE_ENTRIES: - getWorkspaceEntries().clear(); - getWorkspaceEntries().addAll((Collection<? extends EObject>)newValue); - return; - } - super.eSet(featureID, newValue); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public void eUnset(int featureID) { - switch (featureID) { - case CatalogPackage.INSTALL_AND_WOKSPACE_CATALOG__INSTALLED_ENTRIES: - getInstalledEntries().clear(); - return; - case CatalogPackage.INSTALL_AND_WOKSPACE_CATALOG__WORKSPACE_ENTRIES: - getWorkspaceEntries().clear(); - return; - } - super.eUnset(featureID); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public boolean eIsSet(int featureID) { - switch (featureID) { - case CatalogPackage.INSTALL_AND_WOKSPACE_CATALOG__INSTALLED_ENTRIES: - return installedEntries != null && !installedEntries.isEmpty(); - case CatalogPackage.INSTALL_AND_WOKSPACE_CATALOG__WORKSPACE_ENTRIES: - return workspaceEntries != null && !workspaceEntries.isEmpty(); - } - return super.eIsSet(featureID); - } - -} //InstallAndWokspaceCatalogImpl
diff --git a/org.eclipse.modisco.facet.util.emf.catalog.metamodel/src/org/eclipse/emf/facet/util/emf/catalog/metamodel/internal/v1_1/catalog/util/CatalogAdapterFactory.java b/org.eclipse.modisco.facet.util.emf.catalog.metamodel/src/org/eclipse/emf/facet/util/emf/catalog/metamodel/internal/v1_1/catalog/util/CatalogAdapterFactory.java deleted file mode 100644 index 816e791..0000000 --- a/org.eclipse.modisco.facet.util.emf.catalog.metamodel/src/org/eclipse/emf/facet/util/emf/catalog/metamodel/internal/v1_1/catalog/util/CatalogAdapterFactory.java +++ /dev/null
@@ -1,128 +0,0 @@ -/** - * Copyright (c) 2015 Mia-Software. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Grégoire Dupé (Mia-Software) - Bug 477657 - The catalog manager should be able to manage workspace model - */ -package org.eclipse.emf.facet.util.emf.catalog.metamodel.internal.v1_1.catalog.util; - -import org.eclipse.emf.common.notify.Adapter; -import org.eclipse.emf.common.notify.Notifier; - -import org.eclipse.emf.common.notify.impl.AdapterFactoryImpl; - -import org.eclipse.emf.ecore.EObject; - -import org.eclipse.emf.facet.util.emf.catalog.metamodel.internal.v1_1.catalog.*; - -/** - * <!-- begin-user-doc --> - * The <b>Adapter Factory</b> for the model. - * It provides an adapter <code>createXXX</code> method for each class of the model. - * <!-- end-user-doc --> - * @see org.eclipse.emf.facet.util.emf.catalog.metamodel.internal.v1_1.catalog.CatalogPackage - * @generated - */ -public class CatalogAdapterFactory extends AdapterFactoryImpl { - /** - * The cached model package. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected static CatalogPackage modelPackage; - - /** - * Creates an instance of the adapter factory. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public CatalogAdapterFactory() { - if (modelPackage == null) { - modelPackage = CatalogPackage.eINSTANCE; - } - } - - /** - * Returns whether this factory is applicable for the type of the object. - * <!-- begin-user-doc --> - * This implementation returns <code>true</code> if the object is either the model's package or is an instance object of the model. - * <!-- end-user-doc --> - * @return whether this factory is applicable for the type of the object. - * @generated - */ - @Override - public boolean isFactoryForType(Object object) { - if (object == modelPackage) { - return true; - } - if (object instanceof EObject) { - return ((EObject)object).eClass().getEPackage() == modelPackage; - } - return false; - } - - /** - * The switch that delegates to the <code>createXXX</code> methods. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected CatalogSwitch<Adapter> modelSwitch = - new CatalogSwitch<Adapter>() { - @Override - public Adapter caseInstallAndWokspaceCatalog(InstallAndWokspaceCatalog object) { - return createInstallAndWokspaceCatalogAdapter(); - } - @Override - public Adapter defaultCase(EObject object) { - return createEObjectAdapter(); - } - }; - - /** - * Creates an adapter for the <code>target</code>. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @param target the object to adapt. - * @return the adapter for the <code>target</code>. - * @generated - */ - @Override - public Adapter createAdapter(Notifier target) { - return modelSwitch.doSwitch((EObject)target); - } - - - /** - * Creates a new adapter for an object of class '{@link org.eclipse.emf.facet.util.emf.catalog.metamodel.internal.v1_1.catalog.InstallAndWokspaceCatalog <em>Install And Wokspace Catalog</em>}'. - * <!-- begin-user-doc --> - * This default implementation returns null so that we can easily ignore cases; - * it's useful to ignore a case when inheritance will catch all the cases anyway. - * <!-- end-user-doc --> - * @return the new adapter. - * @see org.eclipse.emf.facet.util.emf.catalog.metamodel.internal.v1_1.catalog.InstallAndWokspaceCatalog - * @generated - */ - public Adapter createInstallAndWokspaceCatalogAdapter() { - return null; - } - - /** - * Creates a new adapter for the default case. - * <!-- begin-user-doc --> - * This default implementation returns null. - * <!-- end-user-doc --> - * @return the new adapter. - * @generated - */ - public Adapter createEObjectAdapter() { - return null; - } - -} //CatalogAdapterFactory
diff --git a/org.eclipse.modisco.facet.util.emf.catalog.metamodel/src/org/eclipse/emf/facet/util/emf/catalog/metamodel/internal/v1_1/catalog/util/CatalogSwitch.java b/org.eclipse.modisco.facet.util.emf.catalog.metamodel/src/org/eclipse/emf/facet/util/emf/catalog/metamodel/internal/v1_1/catalog/util/CatalogSwitch.java deleted file mode 100644 index d8e7a20..0000000 --- a/org.eclipse.modisco.facet.util.emf.catalog.metamodel/src/org/eclipse/emf/facet/util/emf/catalog/metamodel/internal/v1_1/catalog/util/CatalogSwitch.java +++ /dev/null
@@ -1,132 +0,0 @@ -/** - * Copyright (c) 2015 Mia-Software. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Grégoire Dupé (Mia-Software) - Bug 477657 - The catalog manager should be able to manage workspace model - */ -package org.eclipse.emf.facet.util.emf.catalog.metamodel.internal.v1_1.catalog.util; - -import java.util.List; - -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.ecore.EObject; - -import org.eclipse.emf.facet.util.emf.catalog.metamodel.internal.v1_1.catalog.*; - -/** - * <!-- begin-user-doc --> - * The <b>Switch</b> for the model's inheritance hierarchy. - * It supports the call {@link #doSwitch(EObject) doSwitch(object)} - * to invoke the <code>caseXXX</code> method for each class of the model, - * starting with the actual class of the object - * and proceeding up the inheritance hierarchy - * until a non-null result is returned, - * which is the result of the switch. - * <!-- end-user-doc --> - * @see org.eclipse.emf.facet.util.emf.catalog.metamodel.internal.v1_1.catalog.CatalogPackage - * @generated - */ -public class CatalogSwitch<T> { - /** - * The cached model package - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected static CatalogPackage modelPackage; - - /** - * Creates an instance of the switch. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public CatalogSwitch() { - if (modelPackage == null) { - modelPackage = CatalogPackage.eINSTANCE; - } - } - - /** - * Calls <code>caseXXX</code> for each class of the model until one returns a non null result; it yields that result. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the first non-null result returned by a <code>caseXXX</code> call. - * @generated - */ - public T doSwitch(EObject theEObject) { - return doSwitch(theEObject.eClass(), theEObject); - } - - /** - * Calls <code>caseXXX</code> for each class of the model until one returns a non null result; it yields that result. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the first non-null result returned by a <code>caseXXX</code> call. - * @generated - */ - protected T doSwitch(EClass theEClass, EObject theEObject) { - if (theEClass.eContainer() == modelPackage) { - return doSwitch(theEClass.getClassifierID(), theEObject); - } - List<EClass> eSuperTypes = theEClass.getESuperTypes(); - return - eSuperTypes.isEmpty() ? - defaultCase(theEObject) : - doSwitch(eSuperTypes.get(0), theEObject); - } - - /** - * Calls <code>caseXXX</code> for each class of the model until one returns a non null result; it yields that result. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the first non-null result returned by a <code>caseXXX</code> call. - * @generated - */ - protected T doSwitch(int classifierID, EObject theEObject) { - switch (classifierID) { - case CatalogPackage.INSTALL_AND_WOKSPACE_CATALOG: { - InstallAndWokspaceCatalog installAndWokspaceCatalog = (InstallAndWokspaceCatalog)theEObject; - T result = caseInstallAndWokspaceCatalog(installAndWokspaceCatalog); - if (result == null) result = defaultCase(theEObject); - return result; - } - default: return defaultCase(theEObject); - } - } - - /** - * Returns the result of interpreting the object as an instance of '<em>Install And Wokspace Catalog</em>'. - * <!-- begin-user-doc --> - * This implementation returns null; - * returning a non-null result will terminate the switch. - * <!-- end-user-doc --> - * @param object the target of the switch. - * @return the result of interpreting the object as an instance of '<em>Install And Wokspace Catalog</em>'. - * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) - * @generated - */ - public T caseInstallAndWokspaceCatalog(InstallAndWokspaceCatalog object) { - return null; - } - - /** - * Returns the result of interpreting the object as an instance of '<em>EObject</em>'. - * <!-- begin-user-doc --> - * This implementation returns null; - * returning a non-null result will terminate the switch, but this is the last case anyway. - * <!-- end-user-doc --> - * @param object the target of the switch. - * @return the result of interpreting the object as an instance of '<em>EObject</em>'. - * @see #doSwitch(org.eclipse.emf.ecore.EObject) - * @generated - */ - public T defaultCase(EObject object) { - return null; - } - -} //CatalogSwitch
diff --git a/org.eclipse.modisco.facet.util.emf.catalog.metamodel/src/org/eclipse/modisco/facet/util/emf/catalog/metamodel/internal/Activator.java b/org.eclipse.modisco.facet.util.emf.catalog.metamodel/src/org/eclipse/modisco/facet/util/emf/catalog/metamodel/internal/Activator.java new file mode 100644 index 0000000..dff87ab --- /dev/null +++ b/org.eclipse.modisco.facet.util.emf.catalog.metamodel/src/org/eclipse/modisco/facet/util/emf/catalog/metamodel/internal/Activator.java
@@ -0,0 +1,50 @@ +/** + * Copyright (c) 2015 Mia-Software. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Grégoire Dupé (Mia-Software) - Bug 477657 - The catalog manager should be able to manage workspace model + */ +package org.eclipse.modisco.facet.util.emf.catalog.metamodel.internal; + +import org.eclipse.core.runtime.Plugin; +import org.osgi.framework.BundleContext; + +@SuppressWarnings("PMD.UseSingleton") +// @SuppressWarnings("PMD.UseSingleton") We cannot conforms to this rule because +// this class is an Eclipse plug-in activator which will be instantiated by the +// Eclipse framework. +public class Activator extends Plugin { + + private static Activator plugin; + + @Override + @SuppressWarnings("PMD.SignatureDeclareThrowsException") + // @SuppressWarnings("PMD.SignatureDeclareThrowsException") We have to use + // this signature because this is an override of an Eclipse framework's + // method. + public void start(final BundleContext bundleContext) throws Exception { + super.start(bundleContext); + Activator.plugin = this; + } + + @Override + @SuppressWarnings("PMD.SignatureDeclareThrowsException") + // @SuppressWarnings("PMD.SignatureDeclareThrowsException") We have to use + // this signature because this is an override of an Eclipse framework's + // method. + public void stop(final BundleContext bundleContext) throws Exception { + // NOPMD: PMD say "Assigning an Object to null is a code smell." + // No choice to right it in another way : this is an Eclipse pattern. + Activator.plugin = null; // NOPMD by gdupe on 30/03/12 10:19 + super.stop(bundleContext); + } + + public static Plugin getDefault() { + return Activator.plugin; + } + +} \ No newline at end of file
diff --git a/org.eclipse.modisco.facet.util.emf.catalog.metamodel/src/org/eclipse/modisco/facet/util/emf/catalog/metamodel/internal/v1_1/catalog/CatalogFactory.java b/org.eclipse.modisco.facet.util.emf.catalog.metamodel/src/org/eclipse/modisco/facet/util/emf/catalog/metamodel/internal/v1_1/catalog/CatalogFactory.java new file mode 100644 index 0000000..c34dae5 --- /dev/null +++ b/org.eclipse.modisco.facet.util.emf.catalog.metamodel/src/org/eclipse/modisco/facet/util/emf/catalog/metamodel/internal/v1_1/catalog/CatalogFactory.java
@@ -0,0 +1,50 @@ +/** + * Copyright (c) 2015 Mia-Software. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Grégoire Dupé (Mia-Software) - Bug 477657 - The catalog manager should be able to manage workspace model + */ +package org.eclipse.modisco.facet.util.emf.catalog.metamodel.internal.v1_1.catalog; + +import org.eclipse.emf.ecore.EFactory; + +/** + * <!-- begin-user-doc --> + * The <b>Factory</b> for the model. + * It provides a create method for each non-abstract class of the model. + * <!-- end-user-doc --> + * @see org.eclipse.modisco.facet.util.emf.catalog.metamodel.internal.v1_1.catalog.CatalogPackage + * @generated + */ +public interface CatalogFactory extends EFactory { + /** + * The singleton instance of the factory. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + CatalogFactory eINSTANCE = org.eclipse.modisco.facet.util.emf.catalog.metamodel.internal.v1_1.catalog.impl.CatalogFactoryImpl.init(); + + /** + * Returns a new object of class '<em>Install And Wokspace Catalog</em>'. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @return a new object of class '<em>Install And Wokspace Catalog</em>'. + * @generated + */ + InstallAndWokspaceCatalog createInstallAndWokspaceCatalog(); + + /** + * Returns the package supported by this factory. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @return the package supported by this factory. + * @generated + */ + CatalogPackage getCatalogPackage(); + +} //CatalogFactory
diff --git a/org.eclipse.modisco.facet.util.emf.catalog.metamodel/src/org/eclipse/modisco/facet/util/emf/catalog/metamodel/internal/v1_1/catalog/CatalogPackage.java b/org.eclipse.modisco.facet.util.emf.catalog.metamodel/src/org/eclipse/modisco/facet/util/emf/catalog/metamodel/internal/v1_1/catalog/CatalogPackage.java new file mode 100644 index 0000000..a7b5e54 --- /dev/null +++ b/org.eclipse.modisco.facet.util.emf.catalog.metamodel/src/org/eclipse/modisco/facet/util/emf/catalog/metamodel/internal/v1_1/catalog/CatalogPackage.java
@@ -0,0 +1,196 @@ +/** + * Copyright (c) 2015 Mia-Software. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Grégoire Dupé (Mia-Software) - Bug 477657 - The catalog manager should be able to manage workspace model + */ +package org.eclipse.modisco.facet.util.emf.catalog.metamodel.internal.v1_1.catalog; + +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.EPackage; +import org.eclipse.emf.ecore.EReference; + +/** + * <!-- begin-user-doc --> + * The <b>Package</b> for the model. + * It contains accessors for the meta objects to represent + * <ul> + * <li>each class,</li> + * <li>each feature of each class,</li> + * <li>each operation of each class,</li> + * <li>each enum,</li> + * <li>and each data type</li> + * </ul> + * <!-- end-user-doc --> + * @see org.eclipse.modisco.facet.util.emf.catalog.metamodel.internal.v1_1.catalog.CatalogFactory + * @model kind="package" + * @generated + */ +public interface CatalogPackage extends EPackage { + /** + * The package name. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + String eNAME = "catalog"; + + /** + * The package namespace URI. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + String eNS_URI = "http://www.eclipse.org/emf/facet/catalog/1.1.0/internal/catalog/"; + + /** + * The package namespace name. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + String eNS_PREFIX = "catalog"; + + /** + * The singleton instance of the package. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + CatalogPackage eINSTANCE = org.eclipse.modisco.facet.util.emf.catalog.metamodel.internal.v1_1.catalog.impl.CatalogPackageImpl.init(); + + /** + * The meta object id for the '{@link org.eclipse.modisco.facet.util.emf.catalog.metamodel.internal.v1_1.catalog.impl.InstallAndWokspaceCatalogImpl <em>Install And Wokspace Catalog</em>}' class. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @see org.eclipse.modisco.facet.util.emf.catalog.metamodel.internal.v1_1.catalog.impl.InstallAndWokspaceCatalogImpl + * @see org.eclipse.modisco.facet.util.emf.catalog.metamodel.internal.v1_1.catalog.impl.CatalogPackageImpl#getInstallAndWokspaceCatalog() + * @generated + */ + int INSTALL_AND_WOKSPACE_CATALOG = 0; + + /** + * The feature id for the '<em><b>Installed Entries</b></em>' reference list. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + */ + int INSTALL_AND_WOKSPACE_CATALOG__INSTALLED_ENTRIES = 0; + + /** + * The feature id for the '<em><b>Workspace Entries</b></em>' reference list. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + */ + int INSTALL_AND_WOKSPACE_CATALOG__WORKSPACE_ENTRIES = 1; + + /** + * The number of structural features of the '<em>Install And Wokspace Catalog</em>' class. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + */ + int INSTALL_AND_WOKSPACE_CATALOG_FEATURE_COUNT = 2; + + /** + * The number of operations of the '<em>Install And Wokspace Catalog</em>' class. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + */ + int INSTALL_AND_WOKSPACE_CATALOG_OPERATION_COUNT = 0; + + + /** + * Returns the meta object for class '{@link org.eclipse.modisco.facet.util.emf.catalog.metamodel.internal.v1_1.catalog.InstallAndWokspaceCatalog <em>Install And Wokspace Catalog</em>}'. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @return the meta object for class '<em>Install And Wokspace Catalog</em>'. + * @see org.eclipse.modisco.facet.util.emf.catalog.metamodel.internal.v1_1.catalog.InstallAndWokspaceCatalog + * @generated + */ + EClass getInstallAndWokspaceCatalog(); + + /** + * Returns the meta object for the reference list '{@link org.eclipse.modisco.facet.util.emf.catalog.metamodel.internal.v1_1.catalog.InstallAndWokspaceCatalog#getInstalledEntries <em>Installed Entries</em>}'. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @return the meta object for the reference list '<em>Installed Entries</em>'. + * @see org.eclipse.modisco.facet.util.emf.catalog.metamodel.internal.v1_1.catalog.InstallAndWokspaceCatalog#getInstalledEntries() + * @see #getInstallAndWokspaceCatalog() + * @generated + */ + EReference getInstallAndWokspaceCatalog_InstalledEntries(); + + /** + * Returns the meta object for the reference list '{@link org.eclipse.modisco.facet.util.emf.catalog.metamodel.internal.v1_1.catalog.InstallAndWokspaceCatalog#getWorkspaceEntries <em>Workspace Entries</em>}'. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @return the meta object for the reference list '<em>Workspace Entries</em>'. + * @see org.eclipse.modisco.facet.util.emf.catalog.metamodel.internal.v1_1.catalog.InstallAndWokspaceCatalog#getWorkspaceEntries() + * @see #getInstallAndWokspaceCatalog() + * @generated + */ + EReference getInstallAndWokspaceCatalog_WorkspaceEntries(); + + /** + * Returns the factory that creates the instances of the model. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @return the factory that creates the instances of the model. + * @generated + */ + CatalogFactory getCatalogFactory(); + + /** + * <!-- begin-user-doc --> + * Defines literals for the meta objects that represent + * <ul> + * <li>each class,</li> + * <li>each feature of each class,</li> + * <li>each operation of each class,</li> + * <li>each enum,</li> + * <li>and each data type</li> + * </ul> + * <!-- end-user-doc --> + * @generated + */ + interface Literals { + /** + * The meta object literal for the '{@link org.eclipse.modisco.facet.util.emf.catalog.metamodel.internal.v1_1.catalog.impl.InstallAndWokspaceCatalogImpl <em>Install And Wokspace Catalog</em>}' class. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @see org.eclipse.modisco.facet.util.emf.catalog.metamodel.internal.v1_1.catalog.impl.InstallAndWokspaceCatalogImpl + * @see org.eclipse.modisco.facet.util.emf.catalog.metamodel.internal.v1_1.catalog.impl.CatalogPackageImpl#getInstallAndWokspaceCatalog() + * @generated + */ + EClass INSTALL_AND_WOKSPACE_CATALOG = eINSTANCE.getInstallAndWokspaceCatalog(); + + /** + * The meta object literal for the '<em><b>Installed Entries</b></em>' reference list feature. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + EReference INSTALL_AND_WOKSPACE_CATALOG__INSTALLED_ENTRIES = eINSTANCE.getInstallAndWokspaceCatalog_InstalledEntries(); + + /** + * The meta object literal for the '<em><b>Workspace Entries</b></em>' reference list feature. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + EReference INSTALL_AND_WOKSPACE_CATALOG__WORKSPACE_ENTRIES = eINSTANCE.getInstallAndWokspaceCatalog_WorkspaceEntries(); + + } + +} //CatalogPackage
diff --git a/org.eclipse.modisco.facet.util.emf.catalog.metamodel/src/org/eclipse/modisco/facet/util/emf/catalog/metamodel/internal/v1_1/catalog/InstallAndWokspaceCatalog.java b/org.eclipse.modisco.facet.util.emf.catalog.metamodel/src/org/eclipse/modisco/facet/util/emf/catalog/metamodel/internal/v1_1/catalog/InstallAndWokspaceCatalog.java new file mode 100644 index 0000000..49a23f9 --- /dev/null +++ b/org.eclipse.modisco.facet.util.emf.catalog.metamodel/src/org/eclipse/modisco/facet/util/emf/catalog/metamodel/internal/v1_1/catalog/InstallAndWokspaceCatalog.java
@@ -0,0 +1,70 @@ +/** + * Copyright (c) 2015 Mia-Software. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Grégoire Dupé (Mia-Software) - Bug 477657 - The catalog manager should be able to manage workspace model + */ +package org.eclipse.modisco.facet.util.emf.catalog.metamodel.internal.v1_1.catalog; + +import org.eclipse.emf.common.util.EList; + +import org.eclipse.emf.ecore.EObject; + +/** + * <!-- begin-user-doc --> + * A representation of the model object '<em><b>Install And Wokspace Catalog</b></em>'. + * <!-- end-user-doc --> + * + * <!-- begin-model-doc --> + * A EMF Facet Catalog catalog is a way to references sets of EObject. + * It has to be subclassed for each user catalog, especially to create derived links to access elements with their right type. + * <!-- end-model-doc --> + * + * <p> + * The following features are supported: + * </p> + * <ul> + * <li>{@link org.eclipse.modisco.facet.util.emf.catalog.metamodel.internal.v1_1.catalog.InstallAndWokspaceCatalog#getInstalledEntries <em>Installed Entries</em>}</li> + * <li>{@link org.eclipse.modisco.facet.util.emf.catalog.metamodel.internal.v1_1.catalog.InstallAndWokspaceCatalog#getWorkspaceEntries <em>Workspace Entries</em>}</li> + * </ul> + * + * @see org.eclipse.modisco.facet.util.emf.catalog.metamodel.internal.v1_1.catalog.CatalogPackage#getInstallAndWokspaceCatalog() + * @model + * @generated + */ +public interface InstallAndWokspaceCatalog extends EObject { + /** + * Returns the value of the '<em><b>Installed Entries</b></em>' reference list. + * The list contents are of type {@link org.eclipse.emf.ecore.EObject}. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * <!-- begin-model-doc --> + * "installedEntries" represents all the EObject initially registered through the registration extension point. + * <!-- end-model-doc --> + * @return the value of the '<em>Installed Entries</em>' reference list. + * @see org.eclipse.modisco.facet.util.emf.catalog.metamodel.internal.v1_1.catalog.CatalogPackage#getInstallAndWokspaceCatalog_InstalledEntries() + * @model transient="true" + * @generated + */ + EList<EObject> getInstalledEntries(); + + /** + * Returns the value of the '<em><b>Workspace Entries</b></em>' reference list. + * The list contents are of type {@link org.eclipse.emf.ecore.EObject}. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * <!-- begin-model-doc --> + * "installedEntries" represents all the EObject initially registered through the registration extension point. + * <!-- end-model-doc --> + * @return the value of the '<em>Workspace Entries</em>' reference list. + * @see org.eclipse.modisco.facet.util.emf.catalog.metamodel.internal.v1_1.catalog.CatalogPackage#getInstallAndWokspaceCatalog_WorkspaceEntries() + * @model + * @generated + */ + EList<EObject> getWorkspaceEntries(); + +} // InstallAndWokspaceCatalog
diff --git a/org.eclipse.modisco.facet.util.emf.catalog.metamodel/src/org/eclipse/modisco/facet/util/emf/catalog/metamodel/internal/v1_1/catalog/impl/CatalogFactoryImpl.java b/org.eclipse.modisco.facet.util.emf.catalog.metamodel/src/org/eclipse/modisco/facet/util/emf/catalog/metamodel/internal/v1_1/catalog/impl/CatalogFactoryImpl.java new file mode 100644 index 0000000..4b468cf --- /dev/null +++ b/org.eclipse.modisco.facet.util.emf.catalog.metamodel/src/org/eclipse/modisco/facet/util/emf/catalog/metamodel/internal/v1_1/catalog/impl/CatalogFactoryImpl.java
@@ -0,0 +1,102 @@ +/** + * Copyright (c) 2015 Mia-Software. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Grégoire Dupé (Mia-Software) - Bug 477657 - The catalog manager should be able to manage workspace model + */ +package org.eclipse.modisco.facet.util.emf.catalog.metamodel.internal.v1_1.catalog.impl; + +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.ecore.EPackage; + +import org.eclipse.emf.ecore.impl.EFactoryImpl; + +import org.eclipse.emf.ecore.plugin.EcorePlugin; +import org.eclipse.modisco.facet.util.emf.catalog.metamodel.internal.v1_1.catalog.*; + +/** + * <!-- begin-user-doc --> + * An implementation of the model <b>Factory</b>. + * <!-- end-user-doc --> + * @generated + */ +public class CatalogFactoryImpl extends EFactoryImpl implements CatalogFactory { + /** + * Creates the default factory implementation. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public static CatalogFactory init() { + try { + CatalogFactory theCatalogFactory = (CatalogFactory)EPackage.Registry.INSTANCE.getEFactory(CatalogPackage.eNS_URI); + if (theCatalogFactory != null) { + return theCatalogFactory; + } + } + catch (Exception exception) { + EcorePlugin.INSTANCE.log(exception); + } + return new CatalogFactoryImpl(); + } + + /** + * Creates an instance of the factory. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public CatalogFactoryImpl() { + super(); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + public EObject create(EClass eClass) { + switch (eClass.getClassifierID()) { + case CatalogPackage.INSTALL_AND_WOKSPACE_CATALOG: return createInstallAndWokspaceCatalog(); + default: + throw new IllegalArgumentException("The class '" + eClass.getName() + "' is not a valid classifier"); + } + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public InstallAndWokspaceCatalog createInstallAndWokspaceCatalog() { + InstallAndWokspaceCatalogImpl installAndWokspaceCatalog = new InstallAndWokspaceCatalogImpl(); + return installAndWokspaceCatalog; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public CatalogPackage getCatalogPackage() { + return (CatalogPackage)getEPackage(); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @deprecated + * @generated + */ + @Deprecated + public static CatalogPackage getPackage() { + return CatalogPackage.eINSTANCE; + } + +} //CatalogFactoryImpl
diff --git a/org.eclipse.modisco.facet.util.emf.catalog.metamodel/src/org/eclipse/modisco/facet/util/emf/catalog/metamodel/internal/v1_1/catalog/impl/CatalogPackageImpl.java b/org.eclipse.modisco.facet.util.emf.catalog.metamodel/src/org/eclipse/modisco/facet/util/emf/catalog/metamodel/internal/v1_1/catalog/impl/CatalogPackageImpl.java new file mode 100644 index 0000000..9e6b8ef --- /dev/null +++ b/org.eclipse.modisco.facet.util.emf.catalog.metamodel/src/org/eclipse/modisco/facet/util/emf/catalog/metamodel/internal/v1_1/catalog/impl/CatalogPackageImpl.java
@@ -0,0 +1,195 @@ +/** + * Copyright (c) 2015 Mia-Software. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Grégoire Dupé (Mia-Software) - Bug 477657 - The catalog manager should be able to manage workspace model + */ +package org.eclipse.modisco.facet.util.emf.catalog.metamodel.internal.v1_1.catalog.impl; + +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.EPackage; +import org.eclipse.emf.ecore.EReference; + +import org.eclipse.emf.ecore.impl.EPackageImpl; +import org.eclipse.modisco.facet.util.emf.catalog.metamodel.internal.v1_1.catalog.CatalogFactory; +import org.eclipse.modisco.facet.util.emf.catalog.metamodel.internal.v1_1.catalog.CatalogPackage; +import org.eclipse.modisco.facet.util.emf.catalog.metamodel.internal.v1_1.catalog.InstallAndWokspaceCatalog; + +/** + * <!-- begin-user-doc --> + * An implementation of the model <b>Package</b>. + * <!-- end-user-doc --> + * @generated + */ +public class CatalogPackageImpl extends EPackageImpl implements CatalogPackage { + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + private EClass installAndWokspaceCatalogEClass = null; + + /** + * Creates an instance of the model <b>Package</b>, registered with + * {@link org.eclipse.emf.ecore.EPackage.Registry EPackage.Registry} by the package + * package URI value. + * <p>Note: the correct way to create the package is via the static + * factory method {@link #init init()}, which also performs + * initialization of the package, or returns the registered package, + * if one already exists. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @see org.eclipse.emf.ecore.EPackage.Registry + * @see org.eclipse.modisco.facet.util.emf.catalog.metamodel.internal.v1_1.catalog.CatalogPackage#eNS_URI + * @see #init() + * @generated + */ + private CatalogPackageImpl() { + super(eNS_URI, CatalogFactory.eINSTANCE); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + private static boolean isInited = false; + + /** + * Creates, registers, and initializes the <b>Package</b> for this model, and for any others upon which it depends. + * + * <p>This method is used to initialize {@link CatalogPackage#eINSTANCE} when that field is accessed. + * Clients should not invoke it directly. Instead, they should simply access that field to obtain the package. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @see #eNS_URI + * @see #createPackageContents() + * @see #initializePackageContents() + * @generated + */ + public static CatalogPackage init() { + if (isInited) return (CatalogPackage)EPackage.Registry.INSTANCE.getEPackage(CatalogPackage.eNS_URI); + + // Obtain or create and register package + CatalogPackageImpl theCatalogPackage = (CatalogPackageImpl)(EPackage.Registry.INSTANCE.get(eNS_URI) instanceof CatalogPackageImpl ? EPackage.Registry.INSTANCE.get(eNS_URI) : new CatalogPackageImpl()); + + isInited = true; + + // Create package meta-data objects + theCatalogPackage.createPackageContents(); + + // Initialize created meta-data + theCatalogPackage.initializePackageContents(); + + // Mark meta-data to indicate it can't be changed + theCatalogPackage.freeze(); + + + // Update the registry and return the package + EPackage.Registry.INSTANCE.put(CatalogPackage.eNS_URI, theCatalogPackage); + return theCatalogPackage; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public EClass getInstallAndWokspaceCatalog() { + return installAndWokspaceCatalogEClass; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public EReference getInstallAndWokspaceCatalog_InstalledEntries() { + return (EReference)installAndWokspaceCatalogEClass.getEStructuralFeatures().get(0); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public EReference getInstallAndWokspaceCatalog_WorkspaceEntries() { + return (EReference)installAndWokspaceCatalogEClass.getEStructuralFeatures().get(1); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public CatalogFactory getCatalogFactory() { + return (CatalogFactory)getEFactoryInstance(); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + private boolean isCreated = false; + + /** + * Creates the meta-model objects for the package. This method is + * guarded to have no affect on any invocation but its first. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public void createPackageContents() { + if (isCreated) return; + isCreated = true; + + // Create classes and their features + installAndWokspaceCatalogEClass = createEClass(INSTALL_AND_WOKSPACE_CATALOG); + createEReference(installAndWokspaceCatalogEClass, INSTALL_AND_WOKSPACE_CATALOG__INSTALLED_ENTRIES); + createEReference(installAndWokspaceCatalogEClass, INSTALL_AND_WOKSPACE_CATALOG__WORKSPACE_ENTRIES); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + private boolean isInitialized = false; + + /** + * Complete the initialization of the package and its meta-model. This + * method is guarded to have no affect on any invocation but its first. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public void initializePackageContents() { + if (isInitialized) return; + isInitialized = true; + + // Initialize package + setName(eNAME); + setNsPrefix(eNS_PREFIX); + setNsURI(eNS_URI); + + // Create type parameters + + // Set bounds for type parameters + + // Add supertypes to classes + + // Initialize classes, features, and operations; add parameters + initEClass(installAndWokspaceCatalogEClass, InstallAndWokspaceCatalog.class, "InstallAndWokspaceCatalog", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); + initEReference(getInstallAndWokspaceCatalog_InstalledEntries(), ecorePackage.getEObject(), null, "installedEntries", null, 0, -1, InstallAndWokspaceCatalog.class, IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + initEReference(getInstallAndWokspaceCatalog_WorkspaceEntries(), ecorePackage.getEObject(), null, "workspaceEntries", null, 0, -1, InstallAndWokspaceCatalog.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + + // Create resource + createResource(eNS_URI); + } + +} //CatalogPackageImpl
diff --git a/org.eclipse.modisco.facet.util.emf.catalog.metamodel/src/org/eclipse/modisco/facet/util/emf/catalog/metamodel/internal/v1_1/catalog/impl/InstallAndWokspaceCatalogImpl.java b/org.eclipse.modisco.facet.util.emf.catalog.metamodel/src/org/eclipse/modisco/facet/util/emf/catalog/metamodel/internal/v1_1/catalog/impl/InstallAndWokspaceCatalogImpl.java new file mode 100644 index 0000000..a4a93fd --- /dev/null +++ b/org.eclipse.modisco.facet.util.emf.catalog.metamodel/src/org/eclipse/modisco/facet/util/emf/catalog/metamodel/internal/v1_1/catalog/impl/InstallAndWokspaceCatalogImpl.java
@@ -0,0 +1,175 @@ +/** + * Copyright (c) 2015 Mia-Software. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Grégoire Dupé (Mia-Software) - Bug 477657 - The catalog manager should be able to manage workspace model + */ +package org.eclipse.modisco.facet.util.emf.catalog.metamodel.internal.v1_1.catalog.impl; + +import java.util.Collection; + +import org.eclipse.emf.common.util.EList; + +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.EObject; + +import org.eclipse.emf.ecore.impl.MinimalEObjectImpl; + +import org.eclipse.emf.ecore.util.EObjectResolvingEList; +import org.eclipse.modisco.facet.util.emf.catalog.metamodel.internal.v1_1.catalog.CatalogPackage; +import org.eclipse.modisco.facet.util.emf.catalog.metamodel.internal.v1_1.catalog.InstallAndWokspaceCatalog; + +/** + * <!-- begin-user-doc --> + * An implementation of the model object '<em><b>Install And Wokspace Catalog</b></em>'. + * <!-- end-user-doc --> + * <p> + * The following features are implemented: + * </p> + * <ul> + * <li>{@link org.eclipse.modisco.facet.util.emf.catalog.metamodel.internal.v1_1.catalog.impl.InstallAndWokspaceCatalogImpl#getInstalledEntries <em>Installed Entries</em>}</li> + * <li>{@link org.eclipse.modisco.facet.util.emf.catalog.metamodel.internal.v1_1.catalog.impl.InstallAndWokspaceCatalogImpl#getWorkspaceEntries <em>Workspace Entries</em>}</li> + * </ul> + * + * @generated + */ +public class InstallAndWokspaceCatalogImpl extends MinimalEObjectImpl.Container implements InstallAndWokspaceCatalog { + /** + * The cached value of the '{@link #getInstalledEntries() <em>Installed Entries</em>}' reference list. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @see #getInstalledEntries() + * @generated + * @ordered + */ + protected EList<EObject> installedEntries; + + /** + * The cached value of the '{@link #getWorkspaceEntries() <em>Workspace Entries</em>}' reference list. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @see #getWorkspaceEntries() + * @generated + * @ordered + */ + protected EList<EObject> workspaceEntries; + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + protected InstallAndWokspaceCatalogImpl() { + super(); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + protected EClass eStaticClass() { + return CatalogPackage.Literals.INSTALL_AND_WOKSPACE_CATALOG; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public EList<EObject> getInstalledEntries() { + if (installedEntries == null) { + installedEntries = new EObjectResolvingEList<EObject>(EObject.class, this, CatalogPackage.INSTALL_AND_WOKSPACE_CATALOG__INSTALLED_ENTRIES); + } + return installedEntries; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public EList<EObject> getWorkspaceEntries() { + if (workspaceEntries == null) { + workspaceEntries = new EObjectResolvingEList<EObject>(EObject.class, this, CatalogPackage.INSTALL_AND_WOKSPACE_CATALOG__WORKSPACE_ENTRIES); + } + return workspaceEntries; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + public Object eGet(int featureID, boolean resolve, boolean coreType) { + switch (featureID) { + case CatalogPackage.INSTALL_AND_WOKSPACE_CATALOG__INSTALLED_ENTRIES: + return getInstalledEntries(); + case CatalogPackage.INSTALL_AND_WOKSPACE_CATALOG__WORKSPACE_ENTRIES: + return getWorkspaceEntries(); + } + return super.eGet(featureID, resolve, coreType); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @SuppressWarnings("unchecked") + @Override + public void eSet(int featureID, Object newValue) { + switch (featureID) { + case CatalogPackage.INSTALL_AND_WOKSPACE_CATALOG__INSTALLED_ENTRIES: + getInstalledEntries().clear(); + getInstalledEntries().addAll((Collection<? extends EObject>)newValue); + return; + case CatalogPackage.INSTALL_AND_WOKSPACE_CATALOG__WORKSPACE_ENTRIES: + getWorkspaceEntries().clear(); + getWorkspaceEntries().addAll((Collection<? extends EObject>)newValue); + return; + } + super.eSet(featureID, newValue); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + public void eUnset(int featureID) { + switch (featureID) { + case CatalogPackage.INSTALL_AND_WOKSPACE_CATALOG__INSTALLED_ENTRIES: + getInstalledEntries().clear(); + return; + case CatalogPackage.INSTALL_AND_WOKSPACE_CATALOG__WORKSPACE_ENTRIES: + getWorkspaceEntries().clear(); + return; + } + super.eUnset(featureID); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + public boolean eIsSet(int featureID) { + switch (featureID) { + case CatalogPackage.INSTALL_AND_WOKSPACE_CATALOG__INSTALLED_ENTRIES: + return installedEntries != null && !installedEntries.isEmpty(); + case CatalogPackage.INSTALL_AND_WOKSPACE_CATALOG__WORKSPACE_ENTRIES: + return workspaceEntries != null && !workspaceEntries.isEmpty(); + } + return super.eIsSet(featureID); + } + +} //InstallAndWokspaceCatalogImpl
diff --git a/org.eclipse.modisco.facet.util.emf.catalog.metamodel/src/org/eclipse/modisco/facet/util/emf/catalog/metamodel/internal/v1_1/catalog/util/CatalogAdapterFactory.java b/org.eclipse.modisco.facet.util.emf.catalog.metamodel/src/org/eclipse/modisco/facet/util/emf/catalog/metamodel/internal/v1_1/catalog/util/CatalogAdapterFactory.java new file mode 100644 index 0000000..05f4ea0 --- /dev/null +++ b/org.eclipse.modisco.facet.util.emf.catalog.metamodel/src/org/eclipse/modisco/facet/util/emf/catalog/metamodel/internal/v1_1/catalog/util/CatalogAdapterFactory.java
@@ -0,0 +1,127 @@ +/** + * Copyright (c) 2015 Mia-Software. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Grégoire Dupé (Mia-Software) - Bug 477657 - The catalog manager should be able to manage workspace model + */ +package org.eclipse.modisco.facet.util.emf.catalog.metamodel.internal.v1_1.catalog.util; + +import org.eclipse.emf.common.notify.Adapter; +import org.eclipse.emf.common.notify.Notifier; + +import org.eclipse.emf.common.notify.impl.AdapterFactoryImpl; + +import org.eclipse.emf.ecore.EObject; +import org.eclipse.modisco.facet.util.emf.catalog.metamodel.internal.v1_1.catalog.*; + +/** + * <!-- begin-user-doc --> + * The <b>Adapter Factory</b> for the model. + * It provides an adapter <code>createXXX</code> method for each class of the model. + * <!-- end-user-doc --> + * @see org.eclipse.modisco.facet.util.emf.catalog.metamodel.internal.v1_1.catalog.CatalogPackage + * @generated + */ +public class CatalogAdapterFactory extends AdapterFactoryImpl { + /** + * The cached model package. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + protected static CatalogPackage modelPackage; + + /** + * Creates an instance of the adapter factory. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public CatalogAdapterFactory() { + if (modelPackage == null) { + modelPackage = CatalogPackage.eINSTANCE; + } + } + + /** + * Returns whether this factory is applicable for the type of the object. + * <!-- begin-user-doc --> + * This implementation returns <code>true</code> if the object is either the model's package or is an instance object of the model. + * <!-- end-user-doc --> + * @return whether this factory is applicable for the type of the object. + * @generated + */ + @Override + public boolean isFactoryForType(Object object) { + if (object == modelPackage) { + return true; + } + if (object instanceof EObject) { + return ((EObject)object).eClass().getEPackage() == modelPackage; + } + return false; + } + + /** + * The switch that delegates to the <code>createXXX</code> methods. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + protected CatalogSwitch<Adapter> modelSwitch = + new CatalogSwitch<Adapter>() { + @Override + public Adapter caseInstallAndWokspaceCatalog(InstallAndWokspaceCatalog object) { + return createInstallAndWokspaceCatalogAdapter(); + } + @Override + public Adapter defaultCase(EObject object) { + return createEObjectAdapter(); + } + }; + + /** + * Creates an adapter for the <code>target</code>. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @param target the object to adapt. + * @return the adapter for the <code>target</code>. + * @generated + */ + @Override + public Adapter createAdapter(Notifier target) { + return modelSwitch.doSwitch((EObject)target); + } + + + /** + * Creates a new adapter for an object of class '{@link org.eclipse.modisco.facet.util.emf.catalog.metamodel.internal.v1_1.catalog.InstallAndWokspaceCatalog <em>Install And Wokspace Catalog</em>}'. + * <!-- begin-user-doc --> + * This default implementation returns null so that we can easily ignore cases; + * it's useful to ignore a case when inheritance will catch all the cases anyway. + * <!-- end-user-doc --> + * @return the new adapter. + * @see org.eclipse.modisco.facet.util.emf.catalog.metamodel.internal.v1_1.catalog.InstallAndWokspaceCatalog + * @generated + */ + public Adapter createInstallAndWokspaceCatalogAdapter() { + return null; + } + + /** + * Creates a new adapter for the default case. + * <!-- begin-user-doc --> + * This default implementation returns null. + * <!-- end-user-doc --> + * @return the new adapter. + * @generated + */ + public Adapter createEObjectAdapter() { + return null; + } + +} //CatalogAdapterFactory
diff --git a/org.eclipse.modisco.facet.util.emf.catalog.metamodel/src/org/eclipse/modisco/facet/util/emf/catalog/metamodel/internal/v1_1/catalog/util/CatalogSwitch.java b/org.eclipse.modisco.facet.util.emf.catalog.metamodel/src/org/eclipse/modisco/facet/util/emf/catalog/metamodel/internal/v1_1/catalog/util/CatalogSwitch.java new file mode 100644 index 0000000..cfb3dfe --- /dev/null +++ b/org.eclipse.modisco.facet.util.emf.catalog.metamodel/src/org/eclipse/modisco/facet/util/emf/catalog/metamodel/internal/v1_1/catalog/util/CatalogSwitch.java
@@ -0,0 +1,131 @@ +/** + * Copyright (c) 2015 Mia-Software. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Grégoire Dupé (Mia-Software) - Bug 477657 - The catalog manager should be able to manage workspace model + */ +package org.eclipse.modisco.facet.util.emf.catalog.metamodel.internal.v1_1.catalog.util; + +import java.util.List; + +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.EObject; +import org.eclipse.modisco.facet.util.emf.catalog.metamodel.internal.v1_1.catalog.*; + +/** + * <!-- begin-user-doc --> + * The <b>Switch</b> for the model's inheritance hierarchy. + * It supports the call {@link #doSwitch(EObject) doSwitch(object)} + * to invoke the <code>caseXXX</code> method for each class of the model, + * starting with the actual class of the object + * and proceeding up the inheritance hierarchy + * until a non-null result is returned, + * which is the result of the switch. + * <!-- end-user-doc --> + * @see org.eclipse.modisco.facet.util.emf.catalog.metamodel.internal.v1_1.catalog.CatalogPackage + * @generated + */ +public class CatalogSwitch<T> { + /** + * The cached model package + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + protected static CatalogPackage modelPackage; + + /** + * Creates an instance of the switch. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public CatalogSwitch() { + if (modelPackage == null) { + modelPackage = CatalogPackage.eINSTANCE; + } + } + + /** + * Calls <code>caseXXX</code> for each class of the model until one returns a non null result; it yields that result. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @return the first non-null result returned by a <code>caseXXX</code> call. + * @generated + */ + public T doSwitch(EObject theEObject) { + return doSwitch(theEObject.eClass(), theEObject); + } + + /** + * Calls <code>caseXXX</code> for each class of the model until one returns a non null result; it yields that result. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @return the first non-null result returned by a <code>caseXXX</code> call. + * @generated + */ + protected T doSwitch(EClass theEClass, EObject theEObject) { + if (theEClass.eContainer() == modelPackage) { + return doSwitch(theEClass.getClassifierID(), theEObject); + } + List<EClass> eSuperTypes = theEClass.getESuperTypes(); + return + eSuperTypes.isEmpty() ? + defaultCase(theEObject) : + doSwitch(eSuperTypes.get(0), theEObject); + } + + /** + * Calls <code>caseXXX</code> for each class of the model until one returns a non null result; it yields that result. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @return the first non-null result returned by a <code>caseXXX</code> call. + * @generated + */ + protected T doSwitch(int classifierID, EObject theEObject) { + switch (classifierID) { + case CatalogPackage.INSTALL_AND_WOKSPACE_CATALOG: { + InstallAndWokspaceCatalog installAndWokspaceCatalog = (InstallAndWokspaceCatalog)theEObject; + T result = caseInstallAndWokspaceCatalog(installAndWokspaceCatalog); + if (result == null) result = defaultCase(theEObject); + return result; + } + default: return defaultCase(theEObject); + } + } + + /** + * Returns the result of interpreting the object as an instance of '<em>Install And Wokspace Catalog</em>'. + * <!-- begin-user-doc --> + * This implementation returns null; + * returning a non-null result will terminate the switch. + * <!-- end-user-doc --> + * @param object the target of the switch. + * @return the result of interpreting the object as an instance of '<em>Install And Wokspace Catalog</em>'. + * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) + * @generated + */ + public T caseInstallAndWokspaceCatalog(InstallAndWokspaceCatalog object) { + return null; + } + + /** + * Returns the result of interpreting the object as an instance of '<em>EObject</em>'. + * <!-- begin-user-doc --> + * This implementation returns null; + * returning a non-null result will terminate the switch, but this is the last case anyway. + * <!-- end-user-doc --> + * @param object the target of the switch. + * @return the result of interpreting the object as an instance of '<em>EObject</em>'. + * @see #doSwitch(org.eclipse.emf.ecore.EObject) + * @generated + */ + public T defaultCase(EObject object) { + return null; + } + +} //CatalogSwitch
diff --git a/org.eclipse.modisco.facet.util.emf.catalog/META-INF/MANIFEST.MF b/org.eclipse.modisco.facet.util.emf.catalog/META-INF/MANIFEST.MF index 04bb849..0476856 100644 --- a/org.eclipse.modisco.facet.util.emf.catalog/META-INF/MANIFEST.MF +++ b/org.eclipse.modisco.facet.util.emf.catalog/META-INF/MANIFEST.MF
@@ -9,8 +9,8 @@ Require-Bundle: org.eclipse.core.runtime, org.eclipse.emf.ecore Bundle-ActivationPolicy: lazy -Bundle-Activator: org.eclipse.emf.facet.util.emf.catalog.plugin.Activator -Export-Package: org.eclipse.emf.facet.util.emf.catalog, - org.eclipse.emf.facet.util.emf.catalog.impl;x-internal:=true, - org.eclipse.emf.facet.util.emf.catalog.util;x-internal:=true +Bundle-Activator: org.eclipse.modisco.facet.util.emf.catalog.plugin.Activator +Export-Package: org.eclipse.modisco.facet.util.emf.catalog, + org.eclipse.modisco.facet.util.emf.catalog.impl;x-internal:=true, + org.eclipse.modisco.facet.util.emf.catalog.util;x-internal:=true Automatic-Module-Name: org.eclipse.emf.facet.util.emf.catalog
diff --git a/org.eclipse.modisco.facet.util.emf.catalog/plugin.xml b/org.eclipse.modisco.facet.util.emf.catalog/plugin.xml index 1188329..bfff2f8 100644 --- a/org.eclipse.modisco.facet.util.emf.catalog/plugin.xml +++ b/org.eclipse.modisco.facet.util.emf.catalog/plugin.xml
@@ -17,7 +17,7 @@ <extension point="org.eclipse.emf.ecore.generated_package"> <package uri="http://www.eclipse.org/emf/facet/catalog/0.1.incubation" - class="org.eclipse.emf.facet.util.emf.catalog.CatalogPackage" + class="org.eclipse.modisco.facet.util.emf.catalog.CatalogPackage" genModel="model/catalog.genmodel"/> </extension> </plugin>
diff --git a/org.eclipse.modisco.facet.util.emf.catalog/src/org/eclipse/emf/facet/util/emf/catalog/Catalog.java b/org.eclipse.modisco.facet.util.emf.catalog/src/org/eclipse/emf/facet/util/emf/catalog/Catalog.java deleted file mode 100644 index 01db07a..0000000 --- a/org.eclipse.modisco.facet.util.emf.catalog/src/org/eclipse/emf/facet/util/emf/catalog/Catalog.java +++ /dev/null
@@ -1,89 +0,0 @@ -/** - * Copyright (c) 2011, 2015 Mia-Software. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Grégoire Dupé (Mia-Software) - Design - * Nicolas Guyomar (Mia-Software) - Implementation - * Grégoire Dupé (Mia-Software) - Bug 477657 - The catalog manager should be able to manage workspace model - * - */ -package org.eclipse.emf.facet.util.emf.catalog; - -import org.eclipse.emf.common.util.EList; - -import org.eclipse.emf.ecore.EObject; - -/** - * <!-- begin-user-doc --> - * A representation of the model object '<em><b>Catalog</b></em>'. - * <!-- end-user-doc --> - * - * <!-- begin-model-doc --> - * A EMF Facet Catalog catalog is a way to references sets of EObject. - * It has to be subclassed for each user catalog, especially to create derived links to access elements with their right type. - * <!-- end-model-doc --> - * - * <p> - * The following features are supported: - * <ul> - * <li>{@link org.eclipse.emf.facet.util.emf.catalog.Catalog#getInstalledEntries <em>Installed Entries</em>}</li> - * <li>{@link org.eclipse.emf.facet.util.emf.catalog.Catalog#getName <em>Name</em>}</li> - * </ul> - * </p> - * - * @see org.eclipse.emf.facet.util.emf.catalog.CatalogPackage#getCatalog() - * @model interface="true" abstract="true" - * @generated - */ -@Deprecated -public interface Catalog extends EObject { - /** - * Returns the value of the '<em><b>Installed Entries</b></em>' reference list. - * The list contents are of type {@link org.eclipse.emf.ecore.EObject}. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * <!-- begin-model-doc --> - * "installedEntries" represents all the EObject initially registered through the registration extension point. - * <!-- end-model-doc --> - * @return the value of the '<em>Installed Entries</em>' reference list. - * @see org.eclipse.emf.facet.util.emf.catalog.CatalogPackage#getCatalog_InstalledEntries() - * @model - * @generated - */ - EList<EObject> getInstalledEntries(); - - /** - * Returns the value of the '<em><b>Name</b></em>' attribute. - * <!-- begin-user-doc --> - * <p> - * If the meaning of the '<em>Name</em>' attribute isn't clear, - * there really should be more of a description here... - * </p> - * <!-- end-user-doc --> - * <!-- begin-model-doc --> - * The name of the Catalog. - * <!-- end-model-doc --> - * @return the value of the '<em>Name</em>' attribute. - * @see #setName(String) - * @see org.eclipse.emf.facet.util.emf.catalog.CatalogPackage#getCatalog_Name() - * @model - * @generated - */ - String getName(); - - /** - * Sets the value of the '{@link org.eclipse.emf.facet.util.emf.catalog.Catalog#getName <em>Name</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @param value the new value of the '<em>Name</em>' attribute. - * @see #getName() - * @generated - */ - void setName(String value); - -} // Catalog
diff --git a/org.eclipse.modisco.facet.util.emf.catalog/src/org/eclipse/emf/facet/util/emf/catalog/CatalogFactory.java b/org.eclipse.modisco.facet.util.emf.catalog/src/org/eclipse/emf/facet/util/emf/catalog/CatalogFactory.java deleted file mode 100644 index 970aaa6..0000000 --- a/org.eclipse.modisco.facet.util.emf.catalog/src/org/eclipse/emf/facet/util/emf/catalog/CatalogFactory.java +++ /dev/null
@@ -1,54 +0,0 @@ -/** - * Copyright (c) 2011, 2015 Mia-Software. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Grégoire Dupé (Mia-Software) - Design - * Nicolas Guyomar (Mia-Software) - Implementation - * Grégoire Dupé (Mia-Software) - Bug 477657 - The catalog manager should be able to manage workspace model - */ -package org.eclipse.emf.facet.util.emf.catalog; - -import org.eclipse.emf.ecore.EFactory; - -/** - * <!-- begin-user-doc --> - * The <b>Factory</b> for the model. - * It provides a create method for each non-abstract class of the model. - * <!-- end-user-doc --> - * @see org.eclipse.emf.facet.util.emf.catalog.CatalogPackage - * @generated - */ -@Deprecated -public interface CatalogFactory extends EFactory { - /** - * The singleton instance of the factory. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - CatalogFactory eINSTANCE = org.eclipse.emf.facet.util.emf.catalog.impl.CatalogFactoryImpl.init(); - - /** - * Returns a new object of class '<em>Set</em>'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return a new object of class '<em>Set</em>'. - * @generated - */ - CatalogSet createCatalogSet(); - - /** - * Returns the package supported by this factory. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the package supported by this factory. - * @generated - */ - CatalogPackage getCatalogPackage(); - -} //CatalogFactory
diff --git a/org.eclipse.modisco.facet.util.emf.catalog/src/org/eclipse/emf/facet/util/emf/catalog/CatalogPackage.java b/org.eclipse.modisco.facet.util.emf.catalog/src/org/eclipse/emf/facet/util/emf/catalog/CatalogPackage.java deleted file mode 100644 index 8423fb1..0000000 --- a/org.eclipse.modisco.facet.util.emf.catalog/src/org/eclipse/emf/facet/util/emf/catalog/CatalogPackage.java +++ /dev/null
@@ -1,258 +0,0 @@ -/** - * Copyright (c) 2011, 2015 Mia-Software. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Grégoire Dupé (Mia-Software) - Design - * Nicolas Guyomar (Mia-Software) - Implementation - * Grégoire Dupé (Mia-Software) - Bug 477657 - The catalog manager should be able to manage workspace model - * - */ -package org.eclipse.emf.facet.util.emf.catalog; - -import org.eclipse.emf.ecore.EAttribute; -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.ecore.EPackage; -import org.eclipse.emf.ecore.EReference; - -/** - * <!-- begin-user-doc --> - * The <b>Package</b> for the model. - * It contains accessors for the meta objects to represent - * <ul> - * <li>each class,</li> - * <li>each feature of each class,</li> - * <li>each enum,</li> - * <li>and each data type</li> - * </ul> - * <!-- end-user-doc --> - * @see org.eclipse.emf.facet.util.emf.catalog.CatalogFactory - * @model kind="package" - * @generated - */ -@Deprecated -public interface CatalogPackage extends EPackage { - /** - * The package name. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - String eNAME = "catalog"; //$NON-NLS-1$ - - /** - * The package namespace URI. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - String eNS_URI = "http://www.eclipse.org/emf/facet/catalog/0.1.incubation"; //$NON-NLS-1$ - - /** - * The package namespace name. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - String eNS_PREFIX = "catalog"; //$NON-NLS-1$ - - /** - * The singleton instance of the package. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - CatalogPackage eINSTANCE = org.eclipse.emf.facet.util.emf.catalog.impl.CatalogPackageImpl.init(); - - /** - * The meta object id for the '{@link org.eclipse.emf.facet.util.emf.catalog.impl.CatalogSetImpl <em>Set</em>}' class. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see org.eclipse.emf.facet.util.emf.catalog.impl.CatalogSetImpl - * @see org.eclipse.emf.facet.util.emf.catalog.impl.CatalogPackageImpl#getCatalogSet() - * @generated - */ - int CATALOG_SET = 0; - - /** - * The feature id for the '<em><b>Catalogs</b></em>' containment reference list. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int CATALOG_SET__CATALOGS = 0; - - /** - * The number of structural features of the '<em>Set</em>' class. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int CATALOG_SET_FEATURE_COUNT = 1; - - /** - * The meta object id for the '{@link org.eclipse.emf.facet.util.emf.catalog.Catalog <em>Catalog</em>}' class. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see org.eclipse.emf.facet.util.emf.catalog.Catalog - * @see org.eclipse.emf.facet.util.emf.catalog.impl.CatalogPackageImpl#getCatalog() - * @generated - */ - int CATALOG = 1; - - /** - * The feature id for the '<em><b>Installed Entries</b></em>' reference list. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int CATALOG__INSTALLED_ENTRIES = 0; - - /** - * The feature id for the '<em><b>Name</b></em>' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int CATALOG__NAME = 1; - - /** - * The number of structural features of the '<em>Catalog</em>' class. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int CATALOG_FEATURE_COUNT = 2; - - - /** - * Returns the meta object for class '{@link org.eclipse.emf.facet.util.emf.catalog.CatalogSet <em>Set</em>}'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the meta object for class '<em>Set</em>'. - * @see org.eclipse.emf.facet.util.emf.catalog.CatalogSet - * @generated - */ - EClass getCatalogSet(); - - /** - * Returns the meta object for the containment reference list '{@link org.eclipse.emf.facet.util.emf.catalog.CatalogSet#getCatalogs <em>Catalogs</em>}'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the meta object for the containment reference list '<em>Catalogs</em>'. - * @see org.eclipse.emf.facet.util.emf.catalog.CatalogSet#getCatalogs() - * @see #getCatalogSet() - * @generated - */ - EReference getCatalogSet_Catalogs(); - - /** - * Returns the meta object for class '{@link org.eclipse.emf.facet.util.emf.catalog.Catalog <em>Catalog</em>}'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the meta object for class '<em>Catalog</em>'. - * @see org.eclipse.emf.facet.util.emf.catalog.Catalog - * @generated - */ - EClass getCatalog(); - - /** - * Returns the meta object for the reference list '{@link org.eclipse.emf.facet.util.emf.catalog.Catalog#getInstalledEntries <em>Installed Entries</em>}'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the meta object for the reference list '<em>Installed Entries</em>'. - * @see org.eclipse.emf.facet.util.emf.catalog.Catalog#getInstalledEntries() - * @see #getCatalog() - * @generated - */ - EReference getCatalog_InstalledEntries(); - - /** - * Returns the meta object for the attribute '{@link org.eclipse.emf.facet.util.emf.catalog.Catalog#getName <em>Name</em>}'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the meta object for the attribute '<em>Name</em>'. - * @see org.eclipse.emf.facet.util.emf.catalog.Catalog#getName() - * @see #getCatalog() - * @generated - */ - EAttribute getCatalog_Name(); - - /** - * Returns the factory that creates the instances of the model. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the factory that creates the instances of the model. - * @generated - */ - CatalogFactory getCatalogFactory(); - - /** - * <!-- begin-user-doc --> - * Defines literals for the meta objects that represent - * <ul> - * <li>each class,</li> - * <li>each feature of each class,</li> - * <li>each enum,</li> - * <li>and each data type</li> - * </ul> - * <!-- end-user-doc --> - * @generated - */ - interface Literals { - /** - * The meta object literal for the '{@link org.eclipse.emf.facet.util.emf.catalog.impl.CatalogSetImpl <em>Set</em>}' class. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see org.eclipse.emf.facet.util.emf.catalog.impl.CatalogSetImpl - * @see org.eclipse.emf.facet.util.emf.catalog.impl.CatalogPackageImpl#getCatalogSet() - * @generated - */ - EClass CATALOG_SET = eINSTANCE.getCatalogSet(); - - /** - * The meta object literal for the '<em><b>Catalogs</b></em>' containment reference list feature. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - EReference CATALOG_SET__CATALOGS = eINSTANCE.getCatalogSet_Catalogs(); - - /** - * The meta object literal for the '{@link org.eclipse.emf.facet.util.emf.catalog.Catalog <em>Catalog</em>}' class. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see org.eclipse.emf.facet.util.emf.catalog.Catalog - * @see org.eclipse.emf.facet.util.emf.catalog.impl.CatalogPackageImpl#getCatalog() - * @generated - */ - EClass CATALOG = eINSTANCE.getCatalog(); - - /** - * The meta object literal for the '<em><b>Installed Entries</b></em>' reference list feature. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - EReference CATALOG__INSTALLED_ENTRIES = eINSTANCE.getCatalog_InstalledEntries(); - - /** - * The meta object literal for the '<em><b>Name</b></em>' attribute feature. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - EAttribute CATALOG__NAME = eINSTANCE.getCatalog_Name(); - - } - -} //CatalogPackage
diff --git a/org.eclipse.modisco.facet.util.emf.catalog/src/org/eclipse/emf/facet/util/emf/catalog/CatalogSet.java b/org.eclipse.modisco.facet.util.emf.catalog/src/org/eclipse/emf/facet/util/emf/catalog/CatalogSet.java deleted file mode 100644 index d0f6494..0000000 --- a/org.eclipse.modisco.facet.util.emf.catalog/src/org/eclipse/emf/facet/util/emf/catalog/CatalogSet.java +++ /dev/null
@@ -1,61 +0,0 @@ -/** - * Copyright (c) 2011, 2015 Mia-Software. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Grégoire Dupé (Mia-Software) - Design - * Nicolas Guyomar (Mia-Software) - Implementation - * Grégoire Dupé (Mia-Software) - Bug 477657 - The catalog manager should be able to manage workspace model - */ -package org.eclipse.emf.facet.util.emf.catalog; - -import org.eclipse.emf.common.util.EList; - -import org.eclipse.emf.ecore.EObject; - -/** - * <!-- begin-user-doc --> - * A representation of the model object '<em><b>Set</b></em>'. - * <!-- end-user-doc --> - * - * <!-- begin-model-doc --> - * A CatalogSet is a set of EMF Facet catalogs. - * <!-- end-model-doc --> - * - * <p> - * The following features are supported: - * <ul> - * <li>{@link org.eclipse.emf.facet.util.emf.catalog.CatalogSet#getCatalogs <em>Catalogs</em>}</li> - * </ul> - * </p> - * - * @see org.eclipse.emf.facet.util.emf.catalog.CatalogPackage#getCatalogSet() - * @model - * @generated - */ -@Deprecated -public interface CatalogSet extends EObject { - /** - * Returns the value of the '<em><b>Catalogs</b></em>' containment reference list. - * The list contents are of type {@link org.eclipse.emf.facet.util.emf.catalog.Catalog}. - * <!-- begin-user-doc --> - * <p> - * If the meaning of the '<em>Catalogs</em>' containment reference list isn't clear, - * there really should be more of a description here... - * </p> - * <!-- end-user-doc --> - * <!-- begin-model-doc --> - * The "catalogs" reference references all the EMF Facet Catalog catalogs contained by a CatalogSet - * <!-- end-model-doc --> - * @return the value of the '<em>Catalogs</em>' containment reference list. - * @see org.eclipse.emf.facet.util.emf.catalog.CatalogPackage#getCatalogSet_Catalogs() - * @model containment="true" - * @generated - */ - EList<Catalog> getCatalogs(); - -} // CatalogSet
diff --git a/org.eclipse.modisco.facet.util.emf.catalog/src/org/eclipse/emf/facet/util/emf/catalog/impl/CatalogFactoryImpl.java b/org.eclipse.modisco.facet.util.emf.catalog/src/org/eclipse/emf/facet/util/emf/catalog/impl/CatalogFactoryImpl.java deleted file mode 100644 index dff64cd..0000000 --- a/org.eclipse.modisco.facet.util.emf.catalog/src/org/eclipse/emf/facet/util/emf/catalog/impl/CatalogFactoryImpl.java +++ /dev/null
@@ -1,107 +0,0 @@ -/** - * Copyright (c) 2011, 2015 Mia-Software. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Grégoire Dupé (Mia-Software) - Design - * Nicolas Guyomar (Mia-Software) - Implementation - * Grégoire Dupé (Mia-Software) - Bug 477657 - The catalog manager should be able to manage workspace model - */ -package org.eclipse.emf.facet.util.emf.catalog.impl; - -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.EPackage; - -import org.eclipse.emf.ecore.impl.EFactoryImpl; - -import org.eclipse.emf.ecore.plugin.EcorePlugin; - -import org.eclipse.emf.facet.util.emf.catalog.*; - -/** - * <!-- begin-user-doc --> - * An implementation of the model <b>Factory</b>. - * <!-- end-user-doc --> - * @generated - */ -@Deprecated -public class CatalogFactoryImpl extends EFactoryImpl implements CatalogFactory { - /** - * Creates the default factory implementation. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public static CatalogFactory init() { - try { - CatalogFactory theCatalogFactory = (CatalogFactory)EPackage.Registry.INSTANCE.getEFactory("http://www.eclipse.org/emf/facet/catalog/0.1.incubation"); //$NON-NLS-1$ - if (theCatalogFactory != null) { - return theCatalogFactory; - } - } - catch (Exception exception) { - EcorePlugin.INSTANCE.log(exception); - } - return new CatalogFactoryImpl(); - } - - /** - * Creates an instance of the factory. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public CatalogFactoryImpl() { - super(); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public EObject create(EClass eClass) { - switch (eClass.getClassifierID()) { - case CatalogPackage.CATALOG_SET: return createCatalogSet(); - default: - throw new IllegalArgumentException("The class '" + eClass.getName() + "' is not a valid classifier"); //$NON-NLS-1$ //$NON-NLS-2$ - } - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public CatalogSet createCatalogSet() { - CatalogSetImpl catalogSet = new CatalogSetImpl(); - return catalogSet; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public CatalogPackage getCatalogPackage() { - return (CatalogPackage)getEPackage(); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @deprecated - * @generated - */ - @Deprecated - public static CatalogPackage getPackage() { - return CatalogPackage.eINSTANCE; - } - -} //CatalogFactoryImpl
diff --git a/org.eclipse.modisco.facet.util.emf.catalog/src/org/eclipse/emf/facet/util/emf/catalog/impl/CatalogPackageImpl.java b/org.eclipse.modisco.facet.util.emf.catalog/src/org/eclipse/emf/facet/util/emf/catalog/impl/CatalogPackageImpl.java deleted file mode 100644 index aa5f42f..0000000 --- a/org.eclipse.modisco.facet.util.emf.catalog/src/org/eclipse/emf/facet/util/emf/catalog/impl/CatalogPackageImpl.java +++ /dev/null
@@ -1,233 +0,0 @@ -/** - * Copyright (c) 2011, 2015 Mia-Software. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Grégoire Dupé (Mia-Software) - Design - * Nicolas Guyomar (Mia-Software) - Implementation - * Grégoire Dupé (Mia-Software) - Bug 477657 - The catalog manager should be able to manage workspace model - */ -package org.eclipse.emf.facet.util.emf.catalog.impl; - -import org.eclipse.emf.ecore.EAttribute; -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.ecore.EPackage; -import org.eclipse.emf.ecore.EReference; - -import org.eclipse.emf.ecore.impl.EPackageImpl; - -import org.eclipse.emf.facet.util.emf.catalog.Catalog; -import org.eclipse.emf.facet.util.emf.catalog.CatalogFactory; -import org.eclipse.emf.facet.util.emf.catalog.CatalogPackage; -import org.eclipse.emf.facet.util.emf.catalog.CatalogSet; - -/** - * <!-- begin-user-doc --> - * An implementation of the model <b>Package</b>. - * <!-- end-user-doc --> - * @generated - */ -@Deprecated -public class CatalogPackageImpl extends EPackageImpl implements CatalogPackage { - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - private EClass catalogSetEClass = null; - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - private EClass catalogEClass = null; - - /** - * Creates an instance of the model <b>Package</b>, registered with - * {@link org.eclipse.emf.ecore.EPackage.Registry EPackage.Registry} by the package - * package URI value. - * <p>Note: the correct way to create the package is via the static - * factory method {@link #init init()}, which also performs - * initialization of the package, or returns the registered package, - * if one already exists. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see org.eclipse.emf.ecore.EPackage.Registry - * @see org.eclipse.emf.facet.util.emf.catalog.CatalogPackage#eNS_URI - * @see #init() - * @generated - */ - private CatalogPackageImpl() { - super(eNS_URI, CatalogFactory.eINSTANCE); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - private static boolean isInited = false; - - /** - * Creates, registers, and initializes the <b>Package</b> for this model, and for any others upon which it depends. - * - * <p>This method is used to initialize {@link CatalogPackage#eINSTANCE} when that field is accessed. - * Clients should not invoke it directly. Instead, they should simply access that field to obtain the package. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #eNS_URI - * @see #createPackageContents() - * @see #initializePackageContents() - * @generated - */ - public static CatalogPackage init() { - if (isInited) return (CatalogPackage)EPackage.Registry.INSTANCE.getEPackage(CatalogPackage.eNS_URI); - - // Obtain or create and register package - CatalogPackageImpl theCatalogPackage = (CatalogPackageImpl)(EPackage.Registry.INSTANCE.get(eNS_URI) instanceof CatalogPackageImpl ? EPackage.Registry.INSTANCE.get(eNS_URI) : new CatalogPackageImpl()); - - isInited = true; - - // Create package meta-data objects - theCatalogPackage.createPackageContents(); - - // Initialize created meta-data - theCatalogPackage.initializePackageContents(); - - // Mark meta-data to indicate it can't be changed - theCatalogPackage.freeze(); - - - // Update the registry and return the package - EPackage.Registry.INSTANCE.put(CatalogPackage.eNS_URI, theCatalogPackage); - return theCatalogPackage; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EClass getCatalogSet() { - return catalogSetEClass; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EReference getCatalogSet_Catalogs() { - return (EReference)catalogSetEClass.getEStructuralFeatures().get(0); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EClass getCatalog() { - return catalogEClass; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EReference getCatalog_InstalledEntries() { - return (EReference)catalogEClass.getEStructuralFeatures().get(0); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EAttribute getCatalog_Name() { - return (EAttribute)catalogEClass.getEStructuralFeatures().get(1); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public CatalogFactory getCatalogFactory() { - return (CatalogFactory)getEFactoryInstance(); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - private boolean isCreated = false; - - /** - * Creates the meta-model objects for the package. This method is - * guarded to have no affect on any invocation but its first. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public void createPackageContents() { - if (isCreated) return; - isCreated = true; - - // Create classes and their features - catalogSetEClass = createEClass(CATALOG_SET); - createEReference(catalogSetEClass, CATALOG_SET__CATALOGS); - - catalogEClass = createEClass(CATALOG); - createEReference(catalogEClass, CATALOG__INSTALLED_ENTRIES); - createEAttribute(catalogEClass, CATALOG__NAME); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - private boolean isInitialized = false; - - /** - * Complete the initialization of the package and its meta-model. This - * method is guarded to have no affect on any invocation but its first. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public void initializePackageContents() { - if (isInitialized) return; - isInitialized = true; - - // Initialize package - setName(eNAME); - setNsPrefix(eNS_PREFIX); - setNsURI(eNS_URI); - - // Create type parameters - - // Set bounds for type parameters - - // Add supertypes to classes - - // Initialize classes and features; add operations and parameters - initEClass(catalogSetEClass, CatalogSet.class, "CatalogSet", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); //$NON-NLS-1$ - initEReference(getCatalogSet_Catalogs(), this.getCatalog(), null, "catalogs", null, 0, -1, CatalogSet.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); //$NON-NLS-1$ - - initEClass(catalogEClass, Catalog.class, "Catalog", IS_ABSTRACT, IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); //$NON-NLS-1$ - initEReference(getCatalog_InstalledEntries(), ecorePackage.getEObject(), null, "installedEntries", null, 0, -1, Catalog.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); //$NON-NLS-1$ - initEAttribute(getCatalog_Name(), ecorePackage.getEString(), "name", null, 0, 1, Catalog.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); //$NON-NLS-1$ - - // Create resource - createResource(eNS_URI); - } - -} //CatalogPackageImpl
diff --git a/org.eclipse.modisco.facet.util.emf.catalog/src/org/eclipse/emf/facet/util/emf/catalog/impl/CatalogSetImpl.java b/org.eclipse.modisco.facet.util.emf.catalog/src/org/eclipse/emf/facet/util/emf/catalog/impl/CatalogSetImpl.java deleted file mode 100644 index b29da6a..0000000 --- a/org.eclipse.modisco.facet.util.emf.catalog/src/org/eclipse/emf/facet/util/emf/catalog/impl/CatalogSetImpl.java +++ /dev/null
@@ -1,164 +0,0 @@ -/** - * Copyright (c) 2011, 2015 Mia-Software. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Grégoire Dupé (Mia-Software) - Design - * Nicolas Guyomar (Mia-Software) - Implementation - * Grégoire Dupé (Mia-Software) - Bug 477657 - The catalog manager should be able to manage workspace model - */ -package org.eclipse.emf.facet.util.emf.catalog.impl; - -import java.util.Collection; - -import org.eclipse.emf.common.notify.NotificationChain; - -import org.eclipse.emf.common.util.EList; - -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.ecore.InternalEObject; - -import org.eclipse.emf.ecore.impl.EObjectImpl; - -import org.eclipse.emf.ecore.util.EObjectContainmentEList; -import org.eclipse.emf.ecore.util.InternalEList; - -import org.eclipse.emf.facet.util.emf.catalog.Catalog; -import org.eclipse.emf.facet.util.emf.catalog.CatalogPackage; -import org.eclipse.emf.facet.util.emf.catalog.CatalogSet; - -/** - * <!-- begin-user-doc --> - * An implementation of the model object '<em><b>Set</b></em>'. - * <!-- end-user-doc --> - * <p> - * The following features are implemented: - * <ul> - * <li>{@link org.eclipse.emf.facet.util.emf.catalog.impl.CatalogSetImpl#getCatalogs <em>Catalogs</em>}</li> - * </ul> - * </p> - * - * @generated - */ -@Deprecated -public class CatalogSetImpl extends EObjectImpl implements CatalogSet { - /** - * The cached value of the '{@link #getCatalogs() <em>Catalogs</em>}' containment reference list. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #getCatalogs() - * @generated - * @ordered - */ - protected EList<Catalog> catalogs; - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected CatalogSetImpl() { - super(); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - protected EClass eStaticClass() { - return CatalogPackage.Literals.CATALOG_SET; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EList<Catalog> getCatalogs() { - if (catalogs == null) { - catalogs = new EObjectContainmentEList<Catalog>(Catalog.class, this, CatalogPackage.CATALOG_SET__CATALOGS); - } - return catalogs; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { - switch (featureID) { - case CatalogPackage.CATALOG_SET__CATALOGS: - return ((InternalEList<?>)getCatalogs()).basicRemove(otherEnd, msgs); - } - return super.eInverseRemove(otherEnd, featureID, msgs); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public Object eGet(int featureID, boolean resolve, boolean coreType) { - switch (featureID) { - case CatalogPackage.CATALOG_SET__CATALOGS: - return getCatalogs(); - } - return super.eGet(featureID, resolve, coreType); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @SuppressWarnings("unchecked") - @Override - public void eSet(int featureID, Object newValue) { - switch (featureID) { - case CatalogPackage.CATALOG_SET__CATALOGS: - getCatalogs().clear(); - getCatalogs().addAll((Collection<? extends Catalog>)newValue); - return; - } - super.eSet(featureID, newValue); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public void eUnset(int featureID) { - switch (featureID) { - case CatalogPackage.CATALOG_SET__CATALOGS: - getCatalogs().clear(); - return; - } - super.eUnset(featureID); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @Override - public boolean eIsSet(int featureID) { - switch (featureID) { - case CatalogPackage.CATALOG_SET__CATALOGS: - return catalogs != null && !catalogs.isEmpty(); - } - return super.eIsSet(featureID); - } - -} //CatalogSetImpl
diff --git a/org.eclipse.modisco.facet.util.emf.catalog/src/org/eclipse/emf/facet/util/emf/catalog/plugin/Activator.java b/org.eclipse.modisco.facet.util.emf.catalog/src/org/eclipse/emf/facet/util/emf/catalog/plugin/Activator.java deleted file mode 100644 index 828c9ba..0000000 --- a/org.eclipse.modisco.facet.util.emf.catalog/src/org/eclipse/emf/facet/util/emf/catalog/plugin/Activator.java +++ /dev/null
@@ -1,41 +0,0 @@ -/** - * Copyright (c) 2011 Mia-Software. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Nicolas Guyomar (Mia-Software) - Bug 334000 Simple catalog manager - */ -package org.eclipse.emf.facet.util.emf.catalog.plugin; - -import org.osgi.framework.BundleActivator; -import org.osgi.framework.BundleContext; - -public class Activator implements BundleActivator { - - private static BundleContext context; - - static BundleContext getContext() { - return Activator.context; - } - - /* - * (non-Javadoc) - * @see org.osgi.framework.BundleActivator#start(org.osgi.framework.BundleContext) - */ - public void start(final BundleContext bundleContext) throws Exception { - Activator.context = bundleContext; - } - - /* - * (non-Javadoc) - * @see org.osgi.framework.BundleActivator#stop(org.osgi.framework.BundleContext) - */ - public void stop(final BundleContext bundleContext) throws Exception { - Activator.context = null; - } - -}
diff --git a/org.eclipse.modisco.facet.util.emf.catalog/src/org/eclipse/emf/facet/util/emf/catalog/util/CatalogAdapterFactory.java b/org.eclipse.modisco.facet.util.emf.catalog/src/org/eclipse/emf/facet/util/emf/catalog/util/CatalogAdapterFactory.java deleted file mode 100644 index 2719591..0000000 --- a/org.eclipse.modisco.facet.util.emf.catalog/src/org/eclipse/emf/facet/util/emf/catalog/util/CatalogAdapterFactory.java +++ /dev/null
@@ -1,152 +0,0 @@ -/** - * Copyright (c) 2011, 2015 Mia-Software. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Grégoire Dupé (Mia-Software) - Design - * Nicolas Guyomar (Mia-Software) - Implementation - * Grégoire Dupé (Mia-Software) - Bug 477657 - The catalog manager should be able to manage workspace model - */ -package org.eclipse.emf.facet.util.emf.catalog.util; - -import org.eclipse.emf.common.notify.Adapter; -import org.eclipse.emf.common.notify.Notifier; - -import org.eclipse.emf.common.notify.impl.AdapterFactoryImpl; - -import org.eclipse.emf.ecore.EObject; - -import org.eclipse.emf.facet.util.emf.catalog.*; - -/** - * <!-- begin-user-doc --> - * The <b>Adapter Factory</b> for the model. - * It provides an adapter <code>createXXX</code> method for each class of the model. - * <!-- end-user-doc --> - * @see org.eclipse.emf.facet.util.emf.catalog.CatalogPackage - * @generated - */ -// generated code -@SuppressWarnings("all") -@Deprecated -public class CatalogAdapterFactory extends AdapterFactoryImpl { - /** - * The cached model package. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected static CatalogPackage modelPackage; - - /** - * Creates an instance of the adapter factory. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public CatalogAdapterFactory() { - if (modelPackage == null) { - modelPackage = CatalogPackage.eINSTANCE; - } - } - - /** - * Returns whether this factory is applicable for the type of the object. - * <!-- begin-user-doc --> - * This implementation returns <code>true</code> if the object is either the model's package or is an instance object of the model. - * <!-- end-user-doc --> - * @return whether this factory is applicable for the type of the object. - * @generated - */ - @Override - public boolean isFactoryForType(Object object) { - if (object == modelPackage) { - return true; - } - if (object instanceof EObject) { - return ((EObject)object).eClass().getEPackage() == modelPackage; - } - return false; - } - - /** - * The switch that delegates to the <code>createXXX</code> methods. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected CatalogSwitch<Adapter> modelSwitch = - new CatalogSwitch<Adapter>() { - @Override - public Adapter caseCatalogSet(CatalogSet object) { - return createCatalogSetAdapter(); - } - @Override - public Adapter caseCatalog(Catalog object) { - return createCatalogAdapter(); - } - @Override - public Adapter defaultCase(EObject object) { - return createEObjectAdapter(); - } - }; - - /** - * Creates an adapter for the <code>target</code>. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @param target the object to adapt. - * @return the adapter for the <code>target</code>. - * @generated - */ - @Override - public Adapter createAdapter(Notifier target) { - return modelSwitch.doSwitch((EObject)target); - } - - - /** - * Creates a new adapter for an object of class '{@link org.eclipse.emf.facet.util.emf.catalog.CatalogSet <em>Set</em>}'. - * <!-- begin-user-doc --> - * This default implementation returns null so that we can easily ignore cases; - * it's useful to ignore a case when inheritance will catch all the cases anyway. - * <!-- end-user-doc --> - * @return the new adapter. - * @see org.eclipse.emf.facet.util.emf.catalog.CatalogSet - * @generated - */ - public Adapter createCatalogSetAdapter() { - return null; - } - - /** - * Creates a new adapter for an object of class '{@link org.eclipse.emf.facet.util.emf.catalog.Catalog <em>Catalog</em>}'. - * <!-- begin-user-doc --> - * This default implementation returns null so that we can easily ignore cases; - * it's useful to ignore a case when inheritance will catch all the cases anyway. - * <!-- end-user-doc --> - * @return the new adapter. - * @see org.eclipse.emf.facet.util.emf.catalog.Catalog - * @generated - */ - public Adapter createCatalogAdapter() { - return null; - } - - /** - * Creates a new adapter for the default case. - * <!-- begin-user-doc --> - * This default implementation returns null. - * <!-- end-user-doc --> - * @return the new adapter. - * @generated - */ - public Adapter createEObjectAdapter() { - return null; - } - -} //CatalogAdapterFactory
diff --git a/org.eclipse.modisco.facet.util.emf.catalog/src/org/eclipse/emf/facet/util/emf/catalog/util/CatalogSwitch.java b/org.eclipse.modisco.facet.util.emf.catalog/src/org/eclipse/emf/facet/util/emf/catalog/util/CatalogSwitch.java deleted file mode 100644 index 273b0f5..0000000 --- a/org.eclipse.modisco.facet.util.emf.catalog/src/org/eclipse/emf/facet/util/emf/catalog/util/CatalogSwitch.java +++ /dev/null
@@ -1,159 +0,0 @@ -/** - * Copyright (c) 2011, 2015 Mia-Software. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Grégoire Dupé (Mia-Software) - Design - * Nicolas Guyomar (Mia-Software) - Implementation - * Grégoire Dupé (Mia-Software) - Bug 477657 - The catalog manager should be able to manage workspace model - */ -package org.eclipse.emf.facet.util.emf.catalog.util; - -import java.util.List; - -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.ecore.EObject; - -import org.eclipse.emf.facet.util.emf.catalog.*; - -/** - * <!-- begin-user-doc --> - * The <b>Switch</b> for the model's inheritance hierarchy. - * It supports the call {@link #doSwitch(EObject) doSwitch(object)} - * to invoke the <code>caseXXX</code> method for each class of the model, - * starting with the actual class of the object - * and proceeding up the inheritance hierarchy - * until a non-null result is returned, - * which is the result of the switch. - * <!-- end-user-doc --> - * @see org.eclipse.emf.facet.util.emf.catalog.CatalogPackage - * @generated - */ -@Deprecated -public class CatalogSwitch<T> { - /** - * The cached model package - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected static CatalogPackage modelPackage; - - /** - * Creates an instance of the switch. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public CatalogSwitch() { - if (modelPackage == null) { - modelPackage = CatalogPackage.eINSTANCE; - } - } - - /** - * Calls <code>caseXXX</code> for each class of the model until one returns a non null result; it yields that result. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the first non-null result returned by a <code>caseXXX</code> call. - * @generated - */ - public T doSwitch(EObject theEObject) { - return doSwitch(theEObject.eClass(), theEObject); - } - - /** - * Calls <code>caseXXX</code> for each class of the model until one returns a non null result; it yields that result. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the first non-null result returned by a <code>caseXXX</code> call. - * @generated - */ - protected T doSwitch(EClass theEClass, EObject theEObject) { - if (theEClass.eContainer() == modelPackage) { - return doSwitch(theEClass.getClassifierID(), theEObject); - } - else { - List<EClass> eSuperTypes = theEClass.getESuperTypes(); - return - eSuperTypes.isEmpty() ? - defaultCase(theEObject) : - doSwitch(eSuperTypes.get(0), theEObject); - } - } - - /** - * Calls <code>caseXXX</code> for each class of the model until one returns a non null result; it yields that result. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the first non-null result returned by a <code>caseXXX</code> call. - * @generated - */ - protected T doSwitch(int classifierID, EObject theEObject) { - switch (classifierID) { - case CatalogPackage.CATALOG_SET: { - CatalogSet catalogSet = (CatalogSet)theEObject; - T result = caseCatalogSet(catalogSet); - if (result == null) result = defaultCase(theEObject); - return result; - } - case CatalogPackage.CATALOG: { - Catalog catalog = (Catalog)theEObject; - T result = caseCatalog(catalog); - if (result == null) result = defaultCase(theEObject); - return result; - } - default: return defaultCase(theEObject); - } - } - - /** - * Returns the result of interpreting the object as an instance of '<em>Set</em>'. - * <!-- begin-user-doc --> - * This implementation returns null; - * returning a non-null result will terminate the switch. - * <!-- end-user-doc --> - * @param object the target of the switch. - * @return the result of interpreting the object as an instance of '<em>Set</em>'. - * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) - * @generated - */ - public T caseCatalogSet(CatalogSet object) { - return null; - } - - /** - * Returns the result of interpreting the object as an instance of '<em>Catalog</em>'. - * <!-- begin-user-doc --> - * This implementation returns null; - * returning a non-null result will terminate the switch. - * <!-- end-user-doc --> - * @param object the target of the switch. - * @return the result of interpreting the object as an instance of '<em>Catalog</em>'. - * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) - * @generated - */ - public T caseCatalog(Catalog object) { - return null; - } - - /** - * Returns the result of interpreting the object as an instance of '<em>EObject</em>'. - * <!-- begin-user-doc --> - * This implementation returns null; - * returning a non-null result will terminate the switch, but this is the last case anyway. - * <!-- end-user-doc --> - * @param object the target of the switch. - * @return the result of interpreting the object as an instance of '<em>EObject</em>'. - * @see #doSwitch(org.eclipse.emf.ecore.EObject) - * @generated - */ - public T defaultCase(EObject object) { - return null; - } - -} //CatalogSwitch
diff --git a/org.eclipse.modisco.facet.util.emf.catalog/src/org/eclipse/modisco/facet/util/emf/catalog/Catalog.java b/org.eclipse.modisco.facet.util.emf.catalog/src/org/eclipse/modisco/facet/util/emf/catalog/Catalog.java new file mode 100644 index 0000000..30fbb55 --- /dev/null +++ b/org.eclipse.modisco.facet.util.emf.catalog/src/org/eclipse/modisco/facet/util/emf/catalog/Catalog.java
@@ -0,0 +1,89 @@ +/** + * Copyright (c) 2011, 2015 Mia-Software. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Grégoire Dupé (Mia-Software) - Design + * Nicolas Guyomar (Mia-Software) - Implementation + * Grégoire Dupé (Mia-Software) - Bug 477657 - The catalog manager should be able to manage workspace model + * + */ +package org.eclipse.modisco.facet.util.emf.catalog; + +import org.eclipse.emf.common.util.EList; + +import org.eclipse.emf.ecore.EObject; + +/** + * <!-- begin-user-doc --> + * A representation of the model object '<em><b>Catalog</b></em>'. + * <!-- end-user-doc --> + * + * <!-- begin-model-doc --> + * A EMF Facet Catalog catalog is a way to references sets of EObject. + * It has to be subclassed for each user catalog, especially to create derived links to access elements with their right type. + * <!-- end-model-doc --> + * + * <p> + * The following features are supported: + * <ul> + * <li>{@link org.eclipse.modisco.facet.util.emf.catalog.Catalog#getInstalledEntries <em>Installed Entries</em>}</li> + * <li>{@link org.eclipse.modisco.facet.util.emf.catalog.Catalog#getName <em>Name</em>}</li> + * </ul> + * </p> + * + * @see org.eclipse.modisco.facet.util.emf.catalog.CatalogPackage#getCatalog() + * @model interface="true" abstract="true" + * @generated + */ +@Deprecated +public interface Catalog extends EObject { + /** + * Returns the value of the '<em><b>Installed Entries</b></em>' reference list. + * The list contents are of type {@link org.eclipse.emf.ecore.EObject}. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * <!-- begin-model-doc --> + * "installedEntries" represents all the EObject initially registered through the registration extension point. + * <!-- end-model-doc --> + * @return the value of the '<em>Installed Entries</em>' reference list. + * @see org.eclipse.modisco.facet.util.emf.catalog.CatalogPackage#getCatalog_InstalledEntries() + * @model + * @generated + */ + EList<EObject> getInstalledEntries(); + + /** + * Returns the value of the '<em><b>Name</b></em>' attribute. + * <!-- begin-user-doc --> + * <p> + * If the meaning of the '<em>Name</em>' attribute isn't clear, + * there really should be more of a description here... + * </p> + * <!-- end-user-doc --> + * <!-- begin-model-doc --> + * The name of the Catalog. + * <!-- end-model-doc --> + * @return the value of the '<em>Name</em>' attribute. + * @see #setName(String) + * @see org.eclipse.modisco.facet.util.emf.catalog.CatalogPackage#getCatalog_Name() + * @model + * @generated + */ + String getName(); + + /** + * Sets the value of the '{@link org.eclipse.modisco.facet.util.emf.catalog.Catalog#getName <em>Name</em>}' attribute. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @param value the new value of the '<em>Name</em>' attribute. + * @see #getName() + * @generated + */ + void setName(String value); + +} // Catalog
diff --git a/org.eclipse.modisco.facet.util.emf.catalog/src/org/eclipse/modisco/facet/util/emf/catalog/CatalogFactory.java b/org.eclipse.modisco.facet.util.emf.catalog/src/org/eclipse/modisco/facet/util/emf/catalog/CatalogFactory.java new file mode 100644 index 0000000..41a3fec --- /dev/null +++ b/org.eclipse.modisco.facet.util.emf.catalog/src/org/eclipse/modisco/facet/util/emf/catalog/CatalogFactory.java
@@ -0,0 +1,54 @@ +/** + * Copyright (c) 2011, 2015 Mia-Software. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Grégoire Dupé (Mia-Software) - Design + * Nicolas Guyomar (Mia-Software) - Implementation + * Grégoire Dupé (Mia-Software) - Bug 477657 - The catalog manager should be able to manage workspace model + */ +package org.eclipse.modisco.facet.util.emf.catalog; + +import org.eclipse.emf.ecore.EFactory; + +/** + * <!-- begin-user-doc --> + * The <b>Factory</b> for the model. + * It provides a create method for each non-abstract class of the model. + * <!-- end-user-doc --> + * @see org.eclipse.modisco.facet.util.emf.catalog.CatalogPackage + * @generated + */ +@Deprecated +public interface CatalogFactory extends EFactory { + /** + * The singleton instance of the factory. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + CatalogFactory eINSTANCE = org.eclipse.modisco.facet.util.emf.catalog.impl.CatalogFactoryImpl.init(); + + /** + * Returns a new object of class '<em>Set</em>'. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @return a new object of class '<em>Set</em>'. + * @generated + */ + CatalogSet createCatalogSet(); + + /** + * Returns the package supported by this factory. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @return the package supported by this factory. + * @generated + */ + CatalogPackage getCatalogPackage(); + +} //CatalogFactory
diff --git a/org.eclipse.modisco.facet.util.emf.catalog/src/org/eclipse/modisco/facet/util/emf/catalog/CatalogPackage.java b/org.eclipse.modisco.facet.util.emf.catalog/src/org/eclipse/modisco/facet/util/emf/catalog/CatalogPackage.java new file mode 100644 index 0000000..4818a49 --- /dev/null +++ b/org.eclipse.modisco.facet.util.emf.catalog/src/org/eclipse/modisco/facet/util/emf/catalog/CatalogPackage.java
@@ -0,0 +1,258 @@ +/** + * Copyright (c) 2011, 2015 Mia-Software. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Grégoire Dupé (Mia-Software) - Design + * Nicolas Guyomar (Mia-Software) - Implementation + * Grégoire Dupé (Mia-Software) - Bug 477657 - The catalog manager should be able to manage workspace model + * + */ +package org.eclipse.modisco.facet.util.emf.catalog; + +import org.eclipse.emf.ecore.EAttribute; +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.EPackage; +import org.eclipse.emf.ecore.EReference; + +/** + * <!-- begin-user-doc --> + * The <b>Package</b> for the model. + * It contains accessors for the meta objects to represent + * <ul> + * <li>each class,</li> + * <li>each feature of each class,</li> + * <li>each enum,</li> + * <li>and each data type</li> + * </ul> + * <!-- end-user-doc --> + * @see org.eclipse.modisco.facet.util.emf.catalog.CatalogFactory + * @model kind="package" + * @generated + */ +@Deprecated +public interface CatalogPackage extends EPackage { + /** + * The package name. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + String eNAME = "catalog"; //$NON-NLS-1$ + + /** + * The package namespace URI. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + String eNS_URI = "http://www.eclipse.org/emf/facet/catalog/0.1.incubation"; //$NON-NLS-1$ + + /** + * The package namespace name. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + String eNS_PREFIX = "catalog"; //$NON-NLS-1$ + + /** + * The singleton instance of the package. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + CatalogPackage eINSTANCE = org.eclipse.modisco.facet.util.emf.catalog.impl.CatalogPackageImpl.init(); + + /** + * The meta object id for the '{@link org.eclipse.modisco.facet.util.emf.catalog.impl.CatalogSetImpl <em>Set</em>}' class. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @see org.eclipse.modisco.facet.util.emf.catalog.impl.CatalogSetImpl + * @see org.eclipse.modisco.facet.util.emf.catalog.impl.CatalogPackageImpl#getCatalogSet() + * @generated + */ + int CATALOG_SET = 0; + + /** + * The feature id for the '<em><b>Catalogs</b></em>' containment reference list. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + */ + int CATALOG_SET__CATALOGS = 0; + + /** + * The number of structural features of the '<em>Set</em>' class. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + */ + int CATALOG_SET_FEATURE_COUNT = 1; + + /** + * The meta object id for the '{@link org.eclipse.modisco.facet.util.emf.catalog.Catalog <em>Catalog</em>}' class. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @see org.eclipse.modisco.facet.util.emf.catalog.Catalog + * @see org.eclipse.modisco.facet.util.emf.catalog.impl.CatalogPackageImpl#getCatalog() + * @generated + */ + int CATALOG = 1; + + /** + * The feature id for the '<em><b>Installed Entries</b></em>' reference list. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + */ + int CATALOG__INSTALLED_ENTRIES = 0; + + /** + * The feature id for the '<em><b>Name</b></em>' attribute. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + */ + int CATALOG__NAME = 1; + + /** + * The number of structural features of the '<em>Catalog</em>' class. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + */ + int CATALOG_FEATURE_COUNT = 2; + + + /** + * Returns the meta object for class '{@link org.eclipse.modisco.facet.util.emf.catalog.CatalogSet <em>Set</em>}'. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @return the meta object for class '<em>Set</em>'. + * @see org.eclipse.modisco.facet.util.emf.catalog.CatalogSet + * @generated + */ + EClass getCatalogSet(); + + /** + * Returns the meta object for the containment reference list '{@link org.eclipse.modisco.facet.util.emf.catalog.CatalogSet#getCatalogs <em>Catalogs</em>}'. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @return the meta object for the containment reference list '<em>Catalogs</em>'. + * @see org.eclipse.modisco.facet.util.emf.catalog.CatalogSet#getCatalogs() + * @see #getCatalogSet() + * @generated + */ + EReference getCatalogSet_Catalogs(); + + /** + * Returns the meta object for class '{@link org.eclipse.modisco.facet.util.emf.catalog.Catalog <em>Catalog</em>}'. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @return the meta object for class '<em>Catalog</em>'. + * @see org.eclipse.modisco.facet.util.emf.catalog.Catalog + * @generated + */ + EClass getCatalog(); + + /** + * Returns the meta object for the reference list '{@link org.eclipse.modisco.facet.util.emf.catalog.Catalog#getInstalledEntries <em>Installed Entries</em>}'. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @return the meta object for the reference list '<em>Installed Entries</em>'. + * @see org.eclipse.modisco.facet.util.emf.catalog.Catalog#getInstalledEntries() + * @see #getCatalog() + * @generated + */ + EReference getCatalog_InstalledEntries(); + + /** + * Returns the meta object for the attribute '{@link org.eclipse.modisco.facet.util.emf.catalog.Catalog#getName <em>Name</em>}'. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @return the meta object for the attribute '<em>Name</em>'. + * @see org.eclipse.modisco.facet.util.emf.catalog.Catalog#getName() + * @see #getCatalog() + * @generated + */ + EAttribute getCatalog_Name(); + + /** + * Returns the factory that creates the instances of the model. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @return the factory that creates the instances of the model. + * @generated + */ + CatalogFactory getCatalogFactory(); + + /** + * <!-- begin-user-doc --> + * Defines literals for the meta objects that represent + * <ul> + * <li>each class,</li> + * <li>each feature of each class,</li> + * <li>each enum,</li> + * <li>and each data type</li> + * </ul> + * <!-- end-user-doc --> + * @generated + */ + interface Literals { + /** + * The meta object literal for the '{@link org.eclipse.modisco.facet.util.emf.catalog.impl.CatalogSetImpl <em>Set</em>}' class. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @see org.eclipse.modisco.facet.util.emf.catalog.impl.CatalogSetImpl + * @see org.eclipse.modisco.facet.util.emf.catalog.impl.CatalogPackageImpl#getCatalogSet() + * @generated + */ + EClass CATALOG_SET = eINSTANCE.getCatalogSet(); + + /** + * The meta object literal for the '<em><b>Catalogs</b></em>' containment reference list feature. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + EReference CATALOG_SET__CATALOGS = eINSTANCE.getCatalogSet_Catalogs(); + + /** + * The meta object literal for the '{@link org.eclipse.modisco.facet.util.emf.catalog.Catalog <em>Catalog</em>}' class. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @see org.eclipse.modisco.facet.util.emf.catalog.Catalog + * @see org.eclipse.modisco.facet.util.emf.catalog.impl.CatalogPackageImpl#getCatalog() + * @generated + */ + EClass CATALOG = eINSTANCE.getCatalog(); + + /** + * The meta object literal for the '<em><b>Installed Entries</b></em>' reference list feature. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + EReference CATALOG__INSTALLED_ENTRIES = eINSTANCE.getCatalog_InstalledEntries(); + + /** + * The meta object literal for the '<em><b>Name</b></em>' attribute feature. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + EAttribute CATALOG__NAME = eINSTANCE.getCatalog_Name(); + + } + +} //CatalogPackage
diff --git a/org.eclipse.modisco.facet.util.emf.catalog/src/org/eclipse/modisco/facet/util/emf/catalog/CatalogSet.java b/org.eclipse.modisco.facet.util.emf.catalog/src/org/eclipse/modisco/facet/util/emf/catalog/CatalogSet.java new file mode 100644 index 0000000..ced35f0 --- /dev/null +++ b/org.eclipse.modisco.facet.util.emf.catalog/src/org/eclipse/modisco/facet/util/emf/catalog/CatalogSet.java
@@ -0,0 +1,61 @@ +/** + * Copyright (c) 2011, 2015 Mia-Software. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Grégoire Dupé (Mia-Software) - Design + * Nicolas Guyomar (Mia-Software) - Implementation + * Grégoire Dupé (Mia-Software) - Bug 477657 - The catalog manager should be able to manage workspace model + */ +package org.eclipse.modisco.facet.util.emf.catalog; + +import org.eclipse.emf.common.util.EList; + +import org.eclipse.emf.ecore.EObject; + +/** + * <!-- begin-user-doc --> + * A representation of the model object '<em><b>Set</b></em>'. + * <!-- end-user-doc --> + * + * <!-- begin-model-doc --> + * A CatalogSet is a set of EMF Facet catalogs. + * <!-- end-model-doc --> + * + * <p> + * The following features are supported: + * <ul> + * <li>{@link org.eclipse.modisco.facet.util.emf.catalog.CatalogSet#getCatalogs <em>Catalogs</em>}</li> + * </ul> + * </p> + * + * @see org.eclipse.modisco.facet.util.emf.catalog.CatalogPackage#getCatalogSet() + * @model + * @generated + */ +@Deprecated +public interface CatalogSet extends EObject { + /** + * Returns the value of the '<em><b>Catalogs</b></em>' containment reference list. + * The list contents are of type {@link org.eclipse.modisco.facet.util.emf.catalog.Catalog}. + * <!-- begin-user-doc --> + * <p> + * If the meaning of the '<em>Catalogs</em>' containment reference list isn't clear, + * there really should be more of a description here... + * </p> + * <!-- end-user-doc --> + * <!-- begin-model-doc --> + * The "catalogs" reference references all the EMF Facet Catalog catalogs contained by a CatalogSet + * <!-- end-model-doc --> + * @return the value of the '<em>Catalogs</em>' containment reference list. + * @see org.eclipse.modisco.facet.util.emf.catalog.CatalogPackage#getCatalogSet_Catalogs() + * @model containment="true" + * @generated + */ + EList<Catalog> getCatalogs(); + +} // CatalogSet
diff --git a/org.eclipse.modisco.facet.util.emf.catalog/src/org/eclipse/modisco/facet/util/emf/catalog/impl/CatalogFactoryImpl.java b/org.eclipse.modisco.facet.util.emf.catalog/src/org/eclipse/modisco/facet/util/emf/catalog/impl/CatalogFactoryImpl.java new file mode 100644 index 0000000..ce211cf --- /dev/null +++ b/org.eclipse.modisco.facet.util.emf.catalog/src/org/eclipse/modisco/facet/util/emf/catalog/impl/CatalogFactoryImpl.java
@@ -0,0 +1,106 @@ +/** + * Copyright (c) 2011, 2015 Mia-Software. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Grégoire Dupé (Mia-Software) - Design + * Nicolas Guyomar (Mia-Software) - Implementation + * Grégoire Dupé (Mia-Software) - Bug 477657 - The catalog manager should be able to manage workspace model + */ +package org.eclipse.modisco.facet.util.emf.catalog.impl; + +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.ecore.EPackage; + +import org.eclipse.emf.ecore.impl.EFactoryImpl; + +import org.eclipse.emf.ecore.plugin.EcorePlugin; +import org.eclipse.modisco.facet.util.emf.catalog.*; + +/** + * <!-- begin-user-doc --> + * An implementation of the model <b>Factory</b>. + * <!-- end-user-doc --> + * @generated + */ +@Deprecated +public class CatalogFactoryImpl extends EFactoryImpl implements CatalogFactory { + /** + * Creates the default factory implementation. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public static CatalogFactory init() { + try { + CatalogFactory theCatalogFactory = (CatalogFactory)EPackage.Registry.INSTANCE.getEFactory("http://www.eclipse.org/emf/facet/catalog/0.1.incubation"); //$NON-NLS-1$ + if (theCatalogFactory != null) { + return theCatalogFactory; + } + } + catch (Exception exception) { + EcorePlugin.INSTANCE.log(exception); + } + return new CatalogFactoryImpl(); + } + + /** + * Creates an instance of the factory. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public CatalogFactoryImpl() { + super(); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + public EObject create(EClass eClass) { + switch (eClass.getClassifierID()) { + case CatalogPackage.CATALOG_SET: return createCatalogSet(); + default: + throw new IllegalArgumentException("The class '" + eClass.getName() + "' is not a valid classifier"); //$NON-NLS-1$ //$NON-NLS-2$ + } + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public CatalogSet createCatalogSet() { + CatalogSetImpl catalogSet = new CatalogSetImpl(); + return catalogSet; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public CatalogPackage getCatalogPackage() { + return (CatalogPackage)getEPackage(); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @deprecated + * @generated + */ + @Deprecated + public static CatalogPackage getPackage() { + return CatalogPackage.eINSTANCE; + } + +} //CatalogFactoryImpl
diff --git a/org.eclipse.modisco.facet.util.emf.catalog/src/org/eclipse/modisco/facet/util/emf/catalog/impl/CatalogPackageImpl.java b/org.eclipse.modisco.facet.util.emf.catalog/src/org/eclipse/modisco/facet/util/emf/catalog/impl/CatalogPackageImpl.java new file mode 100644 index 0000000..b81e80c --- /dev/null +++ b/org.eclipse.modisco.facet.util.emf.catalog/src/org/eclipse/modisco/facet/util/emf/catalog/impl/CatalogPackageImpl.java
@@ -0,0 +1,232 @@ +/** + * Copyright (c) 2011, 2015 Mia-Software. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Grégoire Dupé (Mia-Software) - Design + * Nicolas Guyomar (Mia-Software) - Implementation + * Grégoire Dupé (Mia-Software) - Bug 477657 - The catalog manager should be able to manage workspace model + */ +package org.eclipse.modisco.facet.util.emf.catalog.impl; + +import org.eclipse.emf.ecore.EAttribute; +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.EPackage; +import org.eclipse.emf.ecore.EReference; + +import org.eclipse.emf.ecore.impl.EPackageImpl; +import org.eclipse.modisco.facet.util.emf.catalog.Catalog; +import org.eclipse.modisco.facet.util.emf.catalog.CatalogFactory; +import org.eclipse.modisco.facet.util.emf.catalog.CatalogPackage; +import org.eclipse.modisco.facet.util.emf.catalog.CatalogSet; + +/** + * <!-- begin-user-doc --> + * An implementation of the model <b>Package</b>. + * <!-- end-user-doc --> + * @generated + */ +@Deprecated +public class CatalogPackageImpl extends EPackageImpl implements CatalogPackage { + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + private EClass catalogSetEClass = null; + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + private EClass catalogEClass = null; + + /** + * Creates an instance of the model <b>Package</b>, registered with + * {@link org.eclipse.emf.ecore.EPackage.Registry EPackage.Registry} by the package + * package URI value. + * <p>Note: the correct way to create the package is via the static + * factory method {@link #init init()}, which also performs + * initialization of the package, or returns the registered package, + * if one already exists. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @see org.eclipse.emf.ecore.EPackage.Registry + * @see org.eclipse.modisco.facet.util.emf.catalog.CatalogPackage#eNS_URI + * @see #init() + * @generated + */ + private CatalogPackageImpl() { + super(eNS_URI, CatalogFactory.eINSTANCE); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + private static boolean isInited = false; + + /** + * Creates, registers, and initializes the <b>Package</b> for this model, and for any others upon which it depends. + * + * <p>This method is used to initialize {@link CatalogPackage#eINSTANCE} when that field is accessed. + * Clients should not invoke it directly. Instead, they should simply access that field to obtain the package. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @see #eNS_URI + * @see #createPackageContents() + * @see #initializePackageContents() + * @generated + */ + public static CatalogPackage init() { + if (isInited) return (CatalogPackage)EPackage.Registry.INSTANCE.getEPackage(CatalogPackage.eNS_URI); + + // Obtain or create and register package + CatalogPackageImpl theCatalogPackage = (CatalogPackageImpl)(EPackage.Registry.INSTANCE.get(eNS_URI) instanceof CatalogPackageImpl ? EPackage.Registry.INSTANCE.get(eNS_URI) : new CatalogPackageImpl()); + + isInited = true; + + // Create package meta-data objects + theCatalogPackage.createPackageContents(); + + // Initialize created meta-data + theCatalogPackage.initializePackageContents(); + + // Mark meta-data to indicate it can't be changed + theCatalogPackage.freeze(); + + + // Update the registry and return the package + EPackage.Registry.INSTANCE.put(CatalogPackage.eNS_URI, theCatalogPackage); + return theCatalogPackage; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public EClass getCatalogSet() { + return catalogSetEClass; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public EReference getCatalogSet_Catalogs() { + return (EReference)catalogSetEClass.getEStructuralFeatures().get(0); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public EClass getCatalog() { + return catalogEClass; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public EReference getCatalog_InstalledEntries() { + return (EReference)catalogEClass.getEStructuralFeatures().get(0); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public EAttribute getCatalog_Name() { + return (EAttribute)catalogEClass.getEStructuralFeatures().get(1); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public CatalogFactory getCatalogFactory() { + return (CatalogFactory)getEFactoryInstance(); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + private boolean isCreated = false; + + /** + * Creates the meta-model objects for the package. This method is + * guarded to have no affect on any invocation but its first. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public void createPackageContents() { + if (isCreated) return; + isCreated = true; + + // Create classes and their features + catalogSetEClass = createEClass(CATALOG_SET); + createEReference(catalogSetEClass, CATALOG_SET__CATALOGS); + + catalogEClass = createEClass(CATALOG); + createEReference(catalogEClass, CATALOG__INSTALLED_ENTRIES); + createEAttribute(catalogEClass, CATALOG__NAME); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + private boolean isInitialized = false; + + /** + * Complete the initialization of the package and its meta-model. This + * method is guarded to have no affect on any invocation but its first. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public void initializePackageContents() { + if (isInitialized) return; + isInitialized = true; + + // Initialize package + setName(eNAME); + setNsPrefix(eNS_PREFIX); + setNsURI(eNS_URI); + + // Create type parameters + + // Set bounds for type parameters + + // Add supertypes to classes + + // Initialize classes and features; add operations and parameters + initEClass(catalogSetEClass, CatalogSet.class, "CatalogSet", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); //$NON-NLS-1$ + initEReference(getCatalogSet_Catalogs(), this.getCatalog(), null, "catalogs", null, 0, -1, CatalogSet.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); //$NON-NLS-1$ + + initEClass(catalogEClass, Catalog.class, "Catalog", IS_ABSTRACT, IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); //$NON-NLS-1$ + initEReference(getCatalog_InstalledEntries(), ecorePackage.getEObject(), null, "installedEntries", null, 0, -1, Catalog.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); //$NON-NLS-1$ + initEAttribute(getCatalog_Name(), ecorePackage.getEString(), "name", null, 0, 1, Catalog.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); //$NON-NLS-1$ + + // Create resource + createResource(eNS_URI); + } + +} //CatalogPackageImpl
diff --git a/org.eclipse.modisco.facet.util.emf.catalog/src/org/eclipse/modisco/facet/util/emf/catalog/impl/CatalogSetImpl.java b/org.eclipse.modisco.facet.util.emf.catalog/src/org/eclipse/modisco/facet/util/emf/catalog/impl/CatalogSetImpl.java new file mode 100644 index 0000000..92e9f92 --- /dev/null +++ b/org.eclipse.modisco.facet.util.emf.catalog/src/org/eclipse/modisco/facet/util/emf/catalog/impl/CatalogSetImpl.java
@@ -0,0 +1,163 @@ +/** + * Copyright (c) 2011, 2015 Mia-Software. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Grégoire Dupé (Mia-Software) - Design + * Nicolas Guyomar (Mia-Software) - Implementation + * Grégoire Dupé (Mia-Software) - Bug 477657 - The catalog manager should be able to manage workspace model + */ +package org.eclipse.modisco.facet.util.emf.catalog.impl; + +import java.util.Collection; + +import org.eclipse.emf.common.notify.NotificationChain; + +import org.eclipse.emf.common.util.EList; + +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.InternalEObject; + +import org.eclipse.emf.ecore.impl.EObjectImpl; + +import org.eclipse.emf.ecore.util.EObjectContainmentEList; +import org.eclipse.emf.ecore.util.InternalEList; +import org.eclipse.modisco.facet.util.emf.catalog.Catalog; +import org.eclipse.modisco.facet.util.emf.catalog.CatalogPackage; +import org.eclipse.modisco.facet.util.emf.catalog.CatalogSet; + +/** + * <!-- begin-user-doc --> + * An implementation of the model object '<em><b>Set</b></em>'. + * <!-- end-user-doc --> + * <p> + * The following features are implemented: + * <ul> + * <li>{@link org.eclipse.modisco.facet.util.emf.catalog.impl.CatalogSetImpl#getCatalogs <em>Catalogs</em>}</li> + * </ul> + * </p> + * + * @generated + */ +@Deprecated +public class CatalogSetImpl extends EObjectImpl implements CatalogSet { + /** + * The cached value of the '{@link #getCatalogs() <em>Catalogs</em>}' containment reference list. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @see #getCatalogs() + * @generated + * @ordered + */ + protected EList<Catalog> catalogs; + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + protected CatalogSetImpl() { + super(); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + protected EClass eStaticClass() { + return CatalogPackage.Literals.CATALOG_SET; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public EList<Catalog> getCatalogs() { + if (catalogs == null) { + catalogs = new EObjectContainmentEList<Catalog>(Catalog.class, this, CatalogPackage.CATALOG_SET__CATALOGS); + } + return catalogs; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { + switch (featureID) { + case CatalogPackage.CATALOG_SET__CATALOGS: + return ((InternalEList<?>)getCatalogs()).basicRemove(otherEnd, msgs); + } + return super.eInverseRemove(otherEnd, featureID, msgs); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + public Object eGet(int featureID, boolean resolve, boolean coreType) { + switch (featureID) { + case CatalogPackage.CATALOG_SET__CATALOGS: + return getCatalogs(); + } + return super.eGet(featureID, resolve, coreType); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @SuppressWarnings("unchecked") + @Override + public void eSet(int featureID, Object newValue) { + switch (featureID) { + case CatalogPackage.CATALOG_SET__CATALOGS: + getCatalogs().clear(); + getCatalogs().addAll((Collection<? extends Catalog>)newValue); + return; + } + super.eSet(featureID, newValue); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + public void eUnset(int featureID) { + switch (featureID) { + case CatalogPackage.CATALOG_SET__CATALOGS: + getCatalogs().clear(); + return; + } + super.eUnset(featureID); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + public boolean eIsSet(int featureID) { + switch (featureID) { + case CatalogPackage.CATALOG_SET__CATALOGS: + return catalogs != null && !catalogs.isEmpty(); + } + return super.eIsSet(featureID); + } + +} //CatalogSetImpl
diff --git a/org.eclipse.modisco.facet.util.emf.catalog/src/org/eclipse/modisco/facet/util/emf/catalog/plugin/Activator.java b/org.eclipse.modisco.facet.util.emf.catalog/src/org/eclipse/modisco/facet/util/emf/catalog/plugin/Activator.java new file mode 100644 index 0000000..0311050 --- /dev/null +++ b/org.eclipse.modisco.facet.util.emf.catalog/src/org/eclipse/modisco/facet/util/emf/catalog/plugin/Activator.java
@@ -0,0 +1,41 @@ +/** + * Copyright (c) 2011 Mia-Software. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Nicolas Guyomar (Mia-Software) - Bug 334000 Simple catalog manager + */ +package org.eclipse.modisco.facet.util.emf.catalog.plugin; + +import org.osgi.framework.BundleActivator; +import org.osgi.framework.BundleContext; + +public class Activator implements BundleActivator { + + private static BundleContext context; + + static BundleContext getContext() { + return Activator.context; + } + + /* + * (non-Javadoc) + * @see org.osgi.framework.BundleActivator#start(org.osgi.framework.BundleContext) + */ + public void start(final BundleContext bundleContext) throws Exception { + Activator.context = bundleContext; + } + + /* + * (non-Javadoc) + * @see org.osgi.framework.BundleActivator#stop(org.osgi.framework.BundleContext) + */ + public void stop(final BundleContext bundleContext) throws Exception { + Activator.context = null; + } + +}
diff --git a/org.eclipse.modisco.facet.util.emf.catalog/src/org/eclipse/modisco/facet/util/emf/catalog/util/CatalogAdapterFactory.java b/org.eclipse.modisco.facet.util.emf.catalog/src/org/eclipse/modisco/facet/util/emf/catalog/util/CatalogAdapterFactory.java new file mode 100644 index 0000000..1afad1a --- /dev/null +++ b/org.eclipse.modisco.facet.util.emf.catalog/src/org/eclipse/modisco/facet/util/emf/catalog/util/CatalogAdapterFactory.java
@@ -0,0 +1,151 @@ +/** + * Copyright (c) 2011, 2015 Mia-Software. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Grégoire Dupé (Mia-Software) - Design + * Nicolas Guyomar (Mia-Software) - Implementation + * Grégoire Dupé (Mia-Software) - Bug 477657 - The catalog manager should be able to manage workspace model + */ +package org.eclipse.modisco.facet.util.emf.catalog.util; + +import org.eclipse.emf.common.notify.Adapter; +import org.eclipse.emf.common.notify.Notifier; + +import org.eclipse.emf.common.notify.impl.AdapterFactoryImpl; + +import org.eclipse.emf.ecore.EObject; +import org.eclipse.modisco.facet.util.emf.catalog.*; + +/** + * <!-- begin-user-doc --> + * The <b>Adapter Factory</b> for the model. + * It provides an adapter <code>createXXX</code> method for each class of the model. + * <!-- end-user-doc --> + * @see org.eclipse.modisco.facet.util.emf.catalog.CatalogPackage + * @generated + */ +// generated code +@SuppressWarnings("all") +@Deprecated +public class CatalogAdapterFactory extends AdapterFactoryImpl { + /** + * The cached model package. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + protected static CatalogPackage modelPackage; + + /** + * Creates an instance of the adapter factory. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public CatalogAdapterFactory() { + if (modelPackage == null) { + modelPackage = CatalogPackage.eINSTANCE; + } + } + + /** + * Returns whether this factory is applicable for the type of the object. + * <!-- begin-user-doc --> + * This implementation returns <code>true</code> if the object is either the model's package or is an instance object of the model. + * <!-- end-user-doc --> + * @return whether this factory is applicable for the type of the object. + * @generated + */ + @Override + public boolean isFactoryForType(Object object) { + if (object == modelPackage) { + return true; + } + if (object instanceof EObject) { + return ((EObject)object).eClass().getEPackage() == modelPackage; + } + return false; + } + + /** + * The switch that delegates to the <code>createXXX</code> methods. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + protected CatalogSwitch<Adapter> modelSwitch = + new CatalogSwitch<Adapter>() { + @Override + public Adapter caseCatalogSet(CatalogSet object) { + return createCatalogSetAdapter(); + } + @Override + public Adapter caseCatalog(Catalog object) { + return createCatalogAdapter(); + } + @Override + public Adapter defaultCase(EObject object) { + return createEObjectAdapter(); + } + }; + + /** + * Creates an adapter for the <code>target</code>. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @param target the object to adapt. + * @return the adapter for the <code>target</code>. + * @generated + */ + @Override + public Adapter createAdapter(Notifier target) { + return modelSwitch.doSwitch((EObject)target); + } + + + /** + * Creates a new adapter for an object of class '{@link org.eclipse.modisco.facet.util.emf.catalog.CatalogSet <em>Set</em>}'. + * <!-- begin-user-doc --> + * This default implementation returns null so that we can easily ignore cases; + * it's useful to ignore a case when inheritance will catch all the cases anyway. + * <!-- end-user-doc --> + * @return the new adapter. + * @see org.eclipse.modisco.facet.util.emf.catalog.CatalogSet + * @generated + */ + public Adapter createCatalogSetAdapter() { + return null; + } + + /** + * Creates a new adapter for an object of class '{@link org.eclipse.modisco.facet.util.emf.catalog.Catalog <em>Catalog</em>}'. + * <!-- begin-user-doc --> + * This default implementation returns null so that we can easily ignore cases; + * it's useful to ignore a case when inheritance will catch all the cases anyway. + * <!-- end-user-doc --> + * @return the new adapter. + * @see org.eclipse.modisco.facet.util.emf.catalog.Catalog + * @generated + */ + public Adapter createCatalogAdapter() { + return null; + } + + /** + * Creates a new adapter for the default case. + * <!-- begin-user-doc --> + * This default implementation returns null. + * <!-- end-user-doc --> + * @return the new adapter. + * @generated + */ + public Adapter createEObjectAdapter() { + return null; + } + +} //CatalogAdapterFactory
diff --git a/org.eclipse.modisco.facet.util.emf.catalog/src/org/eclipse/modisco/facet/util/emf/catalog/util/CatalogSwitch.java b/org.eclipse.modisco.facet.util.emf.catalog/src/org/eclipse/modisco/facet/util/emf/catalog/util/CatalogSwitch.java new file mode 100644 index 0000000..91c6b35 --- /dev/null +++ b/org.eclipse.modisco.facet.util.emf.catalog/src/org/eclipse/modisco/facet/util/emf/catalog/util/CatalogSwitch.java
@@ -0,0 +1,158 @@ +/** + * Copyright (c) 2011, 2015 Mia-Software. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Grégoire Dupé (Mia-Software) - Design + * Nicolas Guyomar (Mia-Software) - Implementation + * Grégoire Dupé (Mia-Software) - Bug 477657 - The catalog manager should be able to manage workspace model + */ +package org.eclipse.modisco.facet.util.emf.catalog.util; + +import java.util.List; + +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.EObject; +import org.eclipse.modisco.facet.util.emf.catalog.*; + +/** + * <!-- begin-user-doc --> + * The <b>Switch</b> for the model's inheritance hierarchy. + * It supports the call {@link #doSwitch(EObject) doSwitch(object)} + * to invoke the <code>caseXXX</code> method for each class of the model, + * starting with the actual class of the object + * and proceeding up the inheritance hierarchy + * until a non-null result is returned, + * which is the result of the switch. + * <!-- end-user-doc --> + * @see org.eclipse.modisco.facet.util.emf.catalog.CatalogPackage + * @generated + */ +@Deprecated +public class CatalogSwitch<T> { + /** + * The cached model package + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + protected static CatalogPackage modelPackage; + + /** + * Creates an instance of the switch. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public CatalogSwitch() { + if (modelPackage == null) { + modelPackage = CatalogPackage.eINSTANCE; + } + } + + /** + * Calls <code>caseXXX</code> for each class of the model until one returns a non null result; it yields that result. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @return the first non-null result returned by a <code>caseXXX</code> call. + * @generated + */ + public T doSwitch(EObject theEObject) { + return doSwitch(theEObject.eClass(), theEObject); + } + + /** + * Calls <code>caseXXX</code> for each class of the model until one returns a non null result; it yields that result. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @return the first non-null result returned by a <code>caseXXX</code> call. + * @generated + */ + protected T doSwitch(EClass theEClass, EObject theEObject) { + if (theEClass.eContainer() == modelPackage) { + return doSwitch(theEClass.getClassifierID(), theEObject); + } + else { + List<EClass> eSuperTypes = theEClass.getESuperTypes(); + return + eSuperTypes.isEmpty() ? + defaultCase(theEObject) : + doSwitch(eSuperTypes.get(0), theEObject); + } + } + + /** + * Calls <code>caseXXX</code> for each class of the model until one returns a non null result; it yields that result. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @return the first non-null result returned by a <code>caseXXX</code> call. + * @generated + */ + protected T doSwitch(int classifierID, EObject theEObject) { + switch (classifierID) { + case CatalogPackage.CATALOG_SET: { + CatalogSet catalogSet = (CatalogSet)theEObject; + T result = caseCatalogSet(catalogSet); + if (result == null) result = defaultCase(theEObject); + return result; + } + case CatalogPackage.CATALOG: { + Catalog catalog = (Catalog)theEObject; + T result = caseCatalog(catalog); + if (result == null) result = defaultCase(theEObject); + return result; + } + default: return defaultCase(theEObject); + } + } + + /** + * Returns the result of interpreting the object as an instance of '<em>Set</em>'. + * <!-- begin-user-doc --> + * This implementation returns null; + * returning a non-null result will terminate the switch. + * <!-- end-user-doc --> + * @param object the target of the switch. + * @return the result of interpreting the object as an instance of '<em>Set</em>'. + * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) + * @generated + */ + public T caseCatalogSet(CatalogSet object) { + return null; + } + + /** + * Returns the result of interpreting the object as an instance of '<em>Catalog</em>'. + * <!-- begin-user-doc --> + * This implementation returns null; + * returning a non-null result will terminate the switch. + * <!-- end-user-doc --> + * @param object the target of the switch. + * @return the result of interpreting the object as an instance of '<em>Catalog</em>'. + * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) + * @generated + */ + public T caseCatalog(Catalog object) { + return null; + } + + /** + * Returns the result of interpreting the object as an instance of '<em>EObject</em>'. + * <!-- begin-user-doc --> + * This implementation returns null; + * returning a non-null result will terminate the switch, but this is the last case anyway. + * <!-- end-user-doc --> + * @param object the target of the switch. + * @return the result of interpreting the object as an instance of '<em>EObject</em>'. + * @see #doSwitch(org.eclipse.emf.ecore.EObject) + * @generated + */ + public T defaultCase(EObject object) { + return null; + } + +} //CatalogSwitch
diff --git a/org.eclipse.modisco.facet.util.emf.core/META-INF/MANIFEST.MF b/org.eclipse.modisco.facet.util.emf.core/META-INF/MANIFEST.MF index af4f0ab..5c62c58 100644 --- a/org.eclipse.modisco.facet.util.emf.core/META-INF/MANIFEST.MF +++ b/org.eclipse.modisco.facet.util.emf.core/META-INF/MANIFEST.MF
@@ -3,7 +3,7 @@ Bundle-Name: %Bundle-Name Bundle-SymbolicName: org.eclipse.emf.facet.util.emf.core;singleton:=true Bundle-Version: 1.3.0.qualifier -Bundle-Activator: org.eclipse.emf.facet.util.emf.core.internal.Activator +Bundle-Activator: org.eclipse.modisco.facet.util.emf.core.internal.Activator Bundle-Vendor: %Bundle-Vendor Require-Bundle: org.eclipse.core.runtime, org.eclipse.emf.ecore;bundle-version="2.2.0", @@ -18,23 +18,23 @@ org.eclipse.emf.ecore.xmi;bundle-version="2.5.0" Bundle-RequiredExecutionEnvironment: JavaSE-1.8 Bundle-ActivationPolicy: lazy -Export-Package: org.eclipse.emf.facet.util.emf.core, - org.eclipse.emf.facet.util.emf.core.catalog, - org.eclipse.emf.facet.util.emf.core.command, - org.eclipse.emf.facet.util.emf.core.exception, - org.eclipse.emf.facet.util.emf.core.internal; +Export-Package: org.eclipse.modisco.facet.util.emf.core, + org.eclipse.modisco.facet.util.emf.core.catalog, + org.eclipse.modisco.facet.util.emf.core.command, + org.eclipse.modisco.facet.util.emf.core.exception, + org.eclipse.modisco.facet.util.emf.core.internal; x-friends:="org.eclipse.emf.facet.util.emf.ui, org.eclipse.emf.facet.util.emf.core.tests, org.eclipse.emf.facet.widgets.nattable, org.eclipse.emf.facet.efacet.core", - org.eclipse.emf.facet.util.emf.core.internal.catalog;x-internal:=true, - org.eclipse.emf.facet.util.emf.core.internal.catalog.v2;x-friends:="org.eclipse.emf.facet.util.emf.core.tests", - org.eclipse.emf.facet.util.emf.core.internal.exported, - org.eclipse.emf.facet.util.emf.core.internal.preferences;x-friends:="org.eclipse.emf.facet.util.emf.ui,org.eclipse.emf.facet.util.emf.core.tests", - org.eclipse.emf.facet.util.emf.core.internal.registry;x-internal:=true, - org.eclipse.emf.facet.util.emf.core.internal.serialization;x-internal:=true, - org.eclipse.emf.facet.util.emf.core.internal.serialization.serializers;x-internal:=true, - org.eclipse.emf.facet.util.emf.core.serialization, - org.eclipse.emf.facet.util.emf.core.serialization.model.serialization, - org.eclipse.emf.facet.util.emf.core.serialization.model.serialization.impl;x-internal:=true + org.eclipse.modisco.facet.util.emf.core.internal.catalog;x-internal:=true, + org.eclipse.modisco.facet.util.emf.core.internal.catalog.v2;x-friends:="org.eclipse.emf.facet.util.emf.core.tests", + org.eclipse.modisco.facet.util.emf.core.internal.exported, + org.eclipse.modisco.facet.util.emf.core.internal.preferences;x-friends:="org.eclipse.emf.facet.util.emf.ui,org.eclipse.emf.facet.util.emf.core.tests", + org.eclipse.modisco.facet.util.emf.core.internal.registry;x-internal:=true, + org.eclipse.modisco.facet.util.emf.core.internal.serialization;x-internal:=true, + org.eclipse.modisco.facet.util.emf.core.internal.serialization.serializers;x-internal:=true, + org.eclipse.modisco.facet.util.emf.core.serialization, + org.eclipse.modisco.facet.util.emf.core.serialization.model.serialization, + org.eclipse.modisco.facet.util.emf.core.serialization.model.serialization.impl;x-internal:=true Automatic-Module-Name: org.eclipse.emf.facet.util.emf.core
diff --git a/org.eclipse.modisco.facet.util.emf.core/plugin.xml b/org.eclipse.modisco.facet.util.emf.core/plugin.xml index f7d9021..875b862 100644 --- a/org.eclipse.modisco.facet.util.emf.core/plugin.xml +++ b/org.eclipse.modisco.facet.util.emf.core/plugin.xml
@@ -23,7 +23,7 @@ <extension point="org.eclipse.core.runtime.preferences"> <initializer - class="org.eclipse.emf.facet.util.emf.core.internal.preferences.PreferenceInitializer"> + class="org.eclipse.modisco.facet.util.emf.core.internal.preferences.PreferenceInitializer"> </initializer> </extension> <extension
diff --git a/org.eclipse.modisco.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/CommandFactory.java b/org.eclipse.modisco.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/CommandFactory.java deleted file mode 100644 index 750916a..0000000 --- a/org.eclipse.modisco.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/CommandFactory.java +++ /dev/null
@@ -1,80 +0,0 @@ -/** - * Copyright (c) 2011, 2017 CEA LIST, and Soft-Maint. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Gregoire Dupe (Mia-Software) - Bug 345730 - Deleting an element in the model breaks the table - * Jonathan Pepin (Soft-Maint) - Bug 516701 - Command factory to add content to resource - */ -package org.eclipse.emf.facet.util.emf.core; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.List; - -import org.eclipse.emf.common.command.Command; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.resource.Resource; -import org.eclipse.emf.facet.util.emf.core.internal.command.AddResourceContentCommand; -import org.eclipse.emf.facet.util.emf.core.internal.command.SetResourceContentCommand; - -public final class CommandFactory { - - private CommandFactory() { - //Must not be called - } - - /** - * This method creates a command to set a collection of element to a resource - * @param resource the resource to set - * @param content a collection of EObject to set as the content of the resource. - * @return an EMF Command - */ - public static Command createSetResourceContentsCommand(final Resource resource, - final Collection<EObject> content) { - Command result = new SetResourceContentCommand(resource, content); - return result; - } - - /** - * This method creates a command to set an EObject to a resource - * @param resource the resource to set - * @param eObject an EObject to set as the content of the resource. - * @return an EMF Command - */ - public static Command createSetResourceContentsCommand(final Resource resource, - final EObject eObject) { - List<EObject> content = new ArrayList<EObject>(); - content.add(eObject); - Command result = createSetResourceContentsCommand(resource, content); - return result; - } - - /** - * This method creates a command to add a collection of element to a resource - * @param resource the resource to add - * @param content a collection of EObject to add to the content of the resource. - * @return an EMF Command - */ - public static Command createAddResourceContentsCommand(final Resource resource, - final Collection<EObject> content) { - return new AddResourceContentCommand(resource, content); - } - - /** - * This method creates a command to add an EObject to a resource - * @param resource the resource to add - * @param eObject an EObject to add to the content of the resource. - * @return an EMF Command - */ - public static Command createAddResourceContentsCommand(final Resource resource, - final EObject eObject) { - final List<EObject> content = new ArrayList<EObject>(); - content.add(eObject); - return createAddResourceContentsCommand(resource, content); - } - -}
diff --git a/org.eclipse.modisco.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/EmfDebugUtils.java b/org.eclipse.modisco.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/EmfDebugUtils.java deleted file mode 100644 index a151682..0000000 --- a/org.eclipse.modisco.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/EmfDebugUtils.java +++ /dev/null
@@ -1,90 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2011 Mia-Software. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Gregoire Dupe (Mia-Software) - Bug 366804 - [Restructuring] Table widget upgrade - * Grégoire Dupé (Mia-Software) - Bug 365843 - [Unit Test Failure][0.2/3.8][0.2/4.2] org.eclipse.emf.facet.widgets.nattable.tests.swtbot.Bug344925Test.testBug344925 - * Grégoire Dupé (Mia-Software) - Bug 367700 - [Unit Test Failure][0.2/3.8] org.eclipse.emf.facet.widgets.table.tests.internal.v0_2.swtbot.NatTableUITests.testOpenLoadCustomizationDialog - * Grégoire Dupé (Mia-Software) - Bug 373078 - API Cleaning - *******************************************************************************/ -package org.eclipse.emf.facet.util.emf.core; -import java.io.File; -import java.io.IOException; -import java.util.Collections; - -import org.eclipse.emf.common.command.Command; -import org.eclipse.emf.common.command.CompoundCommand; -import org.eclipse.emf.common.util.URI; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.resource.Resource; -import org.eclipse.emf.ecore.resource.ResourceSet; -import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl; -import org.eclipse.emf.ecore.util.EcoreUtil; -import org.eclipse.emf.facet.util.core.DebugUtils; -import org.eclipse.emf.facet.util.emf.core.exception.DebugRuntimeException; - -/** - * @since 0.2 - */ -public final class EmfDebugUtils { - - private EmfDebugUtils() { - // Must not be used - } - - public static String debugCommand(final Command command) { - return debugCommand(command, 1); - } - - private static String debugCommand(final Command command, final int indent) { - StringBuffer result = new StringBuffer(); - result.append('\n'); - for (int i = 0; i < indent; i++) { - result.append("--"); //$NON-NLS-1$ - } - result.append(command.getClass().getSimpleName()); - result.append(" \""); //$NON-NLS-1$ - result.append(command.getLabel()); - result.append("\" "); //$NON-NLS-1$ - result.append(" canExecute="); //$NON-NLS-1$ - result.append(command.canExecute()); - result.append(" ("); //$NON-NLS-1$ - result.append(command.getClass().getName()); - result.append(')'); - if (command instanceof CompoundCommand) { - CompoundCommand compoundCommand = (CompoundCommand) command; - for (Command subCommand : compoundCommand.getCommandList()) { - result.append(debugCommand(subCommand, indent + 1)); - } - } - return result.toString(); - } - - /** - * This method can be used to easily dump a model into a file. This method has been written to be - * used by unit tests. - * - * @param eObject - * @param fileExtension - * @return a string explaining where the file has been saved. - */ - public static String getStateDumpMessage(final EObject eObject, final String fileExtension) { - final File file = new File(DebugUtils.getCallerLocation(1) + '.' + fileExtension); - URI uri = URI.createFileURI(file.getAbsolutePath()); - ResourceSet resourceSet = new ResourceSetImpl(); - Resource resource = resourceSet.createResource(uri); - resource.getContents().add(EcoreUtil.copy(eObject)); - try { - resource.save(Collections.EMPTY_MAP); - } catch (IOException e) { - throw new DebugRuntimeException(e); - } - return "A model containing the dumped EObject has been saved in " + file.getAbsolutePath(); //$NON-NLS-1$ - } - -}
diff --git a/org.eclipse.modisco.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/IBrowserRegistry.java b/org.eclipse.modisco.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/IBrowserRegistry.java deleted file mode 100644 index 17af766..0000000 --- a/org.eclipse.modisco.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/IBrowserRegistry.java +++ /dev/null
@@ -1,88 +0,0 @@ -/********************************************************************************** - * Copyright (c) 2011 Mia-Software. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Nicolas Guyomar (Mia-Software) - Bug 333652 Extension point offering the possibility to declare an EPackage browser - * Fabien Giquel (Mia-Software) -Bug 335218 - Extension point for registering EObject, EPackage, model editor - * Nicolas Bros (Mia-Software) - Bug 335218 - Extension point for registering EObject, EPackage, model editor - ***********************************************************************************/ -package org.eclipse.emf.facet.util.emf.core; - -import java.util.List; - -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.EPackage; -import org.eclipse.emf.ecore.resource.Resource; -import org.eclipse.emf.facet.util.emf.core.internal.registry.BrowserRegistry; - -/** - * A registry for the {@link EObject}, {@link EPackage}, and {@link Resource} browser opener - * extension point. It can be used to open a default model browser (chosen by the user) or get a - * list of model browsers that can be opened on a model element, {@link EPackage} or - * {@link Resource}. - * @noimplement This interface is not intended to be implemented by clients. - * @noextend This interface is not intended to be extended by clients. - */ -public interface IBrowserRegistry { - - public static IBrowserRegistry INSTANCE = new BrowserRegistry(); - - /** - * Browse the given package using the default EPackage browser opener - * - * @param ePackage - * the element to browse - */ - public void browseEPackage(EPackage ePackage); - - /** - * Browse the given resource using the default Resource browser opener - * - * @param resource - * the element to browse - */ - public void browseResource(Resource resource); - - /** - * Browse the given eObject using the default EObject browser opener - * - * @param eObject - * the element to browse - */ - public void browseEObject(EObject eObject); - - /** - * @return the registered EPackage browser openers - */ - public List<IEPackageBrowserOpener> getAllRegisteredEPackageBrowsers(); - - /** - * @return the registered EObject browser openers - */ - public List<IEObjectBrowserOpener> getAllRegisteredEObjectBrowsers(); - - /** - * @return the registered Resource browser openers - */ - public List<IResourceBrowserOpener> getAllRegisteredResourceBrowsers(); - - /** - * @return the default EPackage browser opener, can be <code>null</code> - */ - public IEPackageBrowserOpener getDefaultEPackageBrowserOpener(); - - /** - * @return the default EObject browser opener, can be <code>null</code> - */ - public IEObjectBrowserOpener getDefaultEObjectBrowserOpener(); - - /** - * @return the default Resource browser opener, can be <code>null</code> - */ - public IResourceBrowserOpener getDefaultResourceBrowserOpener(); - -}
diff --git a/org.eclipse.modisco.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/ICatalogManager.java b/org.eclipse.modisco.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/ICatalogManager.java deleted file mode 100644 index e2505aa..0000000 --- a/org.eclipse.modisco.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/ICatalogManager.java +++ /dev/null
@@ -1,59 +0,0 @@ -/** - * Copyright (c) 2011, 2015 Mia-Software. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Grégoire Dupé (Mia-Software) - Bug 334000 Simple catalog manager - * Nicolas Guyomar (Mia-Software) - Bug 334000 Simple catalog manager - * Grégoire Dupé (Mia-Software) - Bug 477657 - The catalog manager should be able to manage workspace model - */ -package org.eclipse.emf.facet.util.emf.core; - -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.facet.util.emf.catalog.CatalogSet; -import org.eclipse.emf.facet.util.emf.core.internal.catalog.CatalogSetManager; - -/** - * Manager for catalogs containing registered elements defined in models. - * - * @since 0.2 - * @noextend This interface is not intended to be extended by clients. - */ -@Deprecated -public interface ICatalogManager { - - /** - * Return <code>true</code> if the eObject can be managed as a catalog entry. - * - * @param root - * the root element of a catalog - * @return whether the given element is of the right type to be a catalog root - */ - public boolean canBeManaged(EObject root); - - /** - * This method is called by {@link CatalogSetManager} when a model registration that can be - * managed (according to {@link ICatalogManager#canBeManaged(EObject) canBeManaged}) is detected - * while loading. This method adds the given root model element to the catalog. - * - * @param root - * a root element of a model that should be added to the catalog - */ - public void manage(EObject root); - - /** - * This method is called by the {@link CatalogSetManager} after the instantiation of this - * {@link ICatalogManager}. This method must attach the catalog(s) managed by this - * {@link ICatalogManager} to the given <code>catalogSet</code>. - * - * @param catalogSet - * the {@link CatalogSet} to which the catalog managed by this - * {@link ICatalogManager} should be attached - */ - public void setCatalogSet(CatalogSet catalogSet); - -}
diff --git a/org.eclipse.modisco.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/ICatalogSetManager2.java b/org.eclipse.modisco.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/ICatalogSetManager2.java deleted file mode 100644 index 161b131..0000000 --- a/org.eclipse.modisco.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/ICatalogSetManager2.java +++ /dev/null
@@ -1,73 +0,0 @@ -/** - * Copyright (c) 2011, 2015 Mia-Software. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Grégoire Dupé (Mia-Software) - Bug 334000 Simple catalog manager - * Nicolas Guyomar (Mia-Software) - Bug 334000 Simple catalog manager - * Nicolas Guyomar (Mia-Software) - Bug 334529 ICatalogManager should be exposed in org.eclipse.emf.facet.common.core - * Nicolas Guyomar (Mia-Software) - Bug 338811 - A model registration method in the interface ICatalogSetManager - * Grégoire Dupé (Mia-Software) - Bug 362084 - Get the instance of a catalog manager - */ -package org.eclipse.emf.facet.util.emf.core; - -import java.util.List; - -import org.eclipse.core.resources.IFile; -import org.eclipse.emf.ecore.resource.Resource; -import org.eclipse.emf.facet.util.emf.catalog.Catalog; -import org.eclipse.emf.facet.util.emf.catalog.CatalogSet; -import org.eclipse.emf.facet.util.emf.core.exception.InvalidFacetSetException; -import org.osgi.framework.Bundle; - -/** - * @since 0.2 - * @noextend This interface is not intended to be extended by clients. - * @noimplement This interface is not intended to be implemented by clients. - */ -@Deprecated -public interface ICatalogSetManager2 { - - /** - * This method returns the {@link CatalogSet} object which contains all the registered catalogs. - * - * @return the set of registered {@link Catalog}s - */ - CatalogSet getCatalogSet(); - - /** - * Return the bundle containing the file from which we have created the given resource. - * - * @param eResource - * the EMF Resource - * @return the {@link Bundle} matching the given resource, or <code>null</code> if the resource - * is not defined in a Bundle. - * @throws IllegalArgumentException - * if the resource is <code>null</code> - * - * @author Nicolas Guyomar - */ - Bundle getBundleByResource(Resource eResource); - - /** - * This method takes a file to register it as a "modelDeclaration" extension in its containing - * plug-in. - * - * @param file - * the file to be registered as a "modelDeclaration" - * @throws InvalidFacetSetException - */ - void registerModelDeclaration(IFile file) throws InvalidFacetSetException; - - /** - * Return the registered catalogs conforming to the parameter class. - * - * @return a list of {@link ICatalogManager} - */ - <T> List<T> getCatalogManagerByType(Class<? extends T> catalogManagerClass); - -}
diff --git a/org.eclipse.modisco.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/ICatalogSetManagerFactory.java b/org.eclipse.modisco.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/ICatalogSetManagerFactory.java deleted file mode 100644 index a321fc8..0000000 --- a/org.eclipse.modisco.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/ICatalogSetManagerFactory.java +++ /dev/null
@@ -1,27 +0,0 @@ -/** - * Copyright (c) 2012, 2015 Mia-Software. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Grégoire Dupé (Mia-Software) - Bug 369987 - [Restructuring][Table] Switch to the new customization and facet framework - */ -package org.eclipse.emf.facet.util.emf.core; - -import org.eclipse.emf.ecore.resource.ResourceSet; -import org.eclipse.emf.facet.util.emf.core.internal.catalog.CatalogSetManagerFactory; - -/** - * @since 0.2 - * @noextend This interface is not intended to be extended by clients. - * @noimplement This interface is not intended to be implemented by clients. - */ -@Deprecated -public interface ICatalogSetManagerFactory { - ICatalogSetManagerFactory DEFAULT = new CatalogSetManagerFactory(); - - ICatalogSetManager2 createICatalogSetManager(ResourceSet resourceSet); -}
diff --git a/org.eclipse.modisco.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/IEObjectBrowserOpener.java b/org.eclipse.modisco.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/IEObjectBrowserOpener.java deleted file mode 100644 index 9808529..0000000 --- a/org.eclipse.modisco.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/IEObjectBrowserOpener.java +++ /dev/null
@@ -1,40 +0,0 @@ -/** - * Copyright (c) 2011 Mia-Software. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Fabien Giquel (Mia-Software) - * Nicolas Bros (Mia-Software) - Bug 335218 - Extension point for registering EObject, EPackage, model editor - */ -package org.eclipse.emf.facet.util.emf.core; - -import org.eclipse.emf.ecore.EObject; - -/** - * This class is used to register a Browser (typically an Eclipse editor or view), that can be - * opened from a given EObject. The registration is done through the - * "org.eclipse.emf.facet.util.emf.core.modelViewer" extension point. - */ -public interface IEObjectBrowserOpener { - - /** - * This method opens the given {@link EObject} with the browser corresponding to this - * {@link IEObjectBrowserOpener}. - * - * @param eObject - * the {@link EObject} to be opened - */ - public void openEObject(final EObject eObject); - - /** - * Return a human readable name for the {@link EObject} browser. - * - * @return a human readable name for the {@link EObject} browser - */ - public String getBrowserName(); - -}
diff --git a/org.eclipse.modisco.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/IEPackageBrowserOpener.java b/org.eclipse.modisco.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/IEPackageBrowserOpener.java deleted file mode 100644 index ee489e7..0000000 --- a/org.eclipse.modisco.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/IEPackageBrowserOpener.java +++ /dev/null
@@ -1,40 +0,0 @@ -/** - * Copyright (c) 2011 Mia-Software. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Nicolas Guyomar (Mia-Software) - Bug 333652 Extension point offering the possibility to declare an EPackage browser - * Nicolas Bros (Mia-Software) - Bug 335218 - Extension point for registering EObject, EPackage, model editor - */ -package org.eclipse.emf.facet.util.emf.core; - -import org.eclipse.emf.ecore.EPackage; - -/** - * This class is used to register a Browser (typically an Eclipse editor or view), that can be - * opened from a given EPackage. The registration is done through the - * "org.eclipse.emf.facet.util.emf.core.modelViewer" extension point. - */ -public interface IEPackageBrowserOpener { - - /** - * This method opens the given {@link EPackage} with the browser corresponding to this - * {@link IEPackageBrowserOpener}. - * - * @param ePackage - * the {@link EPackage} to be opened - */ - public void openEPackage(final EPackage ePackage); - - /** - * Return a human readable name for the {@link EPackage} browser. - * - * @return a human readable name for the {@link EPackage} browser - */ - public String getBrowserName(); - -}
diff --git a/org.eclipse.modisco.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/IResourceBrowserOpener.java b/org.eclipse.modisco.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/IResourceBrowserOpener.java deleted file mode 100644 index 9fe3b0b..0000000 --- a/org.eclipse.modisco.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/IResourceBrowserOpener.java +++ /dev/null
@@ -1,40 +0,0 @@ -/** - * Copyright (c) 2011 Mia-Software. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Fabien Giquel (Mia-Software) - * Nicolas Bros (Mia-Software) - Bug 335218 - Extension point for registering EObject, EPackage, model editor - */ -package org.eclipse.emf.facet.util.emf.core; - -import org.eclipse.emf.ecore.resource.Resource; - -/** - * This class is used to register a Browser (typically an Eclipse editor or view), that can be - * opened from a given EMF Resource. The registration is done through the - * "org.eclipse.emf.facet.util.emf.core.modelViewer" extension point. - */ -public interface IResourceBrowserOpener { - - /** - * This method opens the given {@link Resource} with the browser corresponding to this - * {@link IResourceBrowserOpener}. - * - * @param resource - * the {@link Resource} to be opened - */ - public void openResource(final Resource resource); - - /** - * Return a human readable name for the {@link Resource} browser. - * - * @return a human readable name for the {@link Resource} browser - */ - public String getBrowserName(); - -}
diff --git a/org.eclipse.modisco.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/ModelUtils.java b/org.eclipse.modisco.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/ModelUtils.java deleted file mode 100644 index e48aa19..0000000 --- a/org.eclipse.modisco.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/ModelUtils.java +++ /dev/null
@@ -1,253 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2010, 2012 Mia-Software. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Nicolas Bros (Mia-Software) - Bug 366367 - To be able to change the "CanBePresentedInTheTable" query - * Gregoire Dupe (Mia-Software) - Bug 369987 - [Restructuring][Table] Switch to the new customization and facet framework - * Laurent Pichierri (Soft-Maint) - Bug 371204 - Compatibility with Helios - * Gregoire Dupe (Mia-Software) - Bug 371367 - Hierarchical FacetSets - * Gregoire Dupe (Mia-Software) - Bug 369987 - [Restructuring][Table] Switch to the new customization and facet framework - * Gregoire Dupe (Mia-Software) - Bug 387470 - [EFacet][Custom] Editors - *******************************************************************************/ -package org.eclipse.emf.facet.util.emf.core; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.List; - -import org.eclipse.core.resources.IProject; -import org.eclipse.core.resources.IWorkspace; -import org.eclipse.core.resources.ResourcesPlugin; -import org.eclipse.emf.common.notify.Notifier; -import org.eclipse.emf.common.util.EList; -import org.eclipse.emf.common.util.TreeIterator; -import org.eclipse.emf.common.util.URI; -import org.eclipse.emf.ecore.EAttribute; -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.ecore.EClassifier; -import org.eclipse.emf.ecore.EDataType; -import org.eclipse.emf.ecore.ENamedElement; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.EPackage; -import org.eclipse.emf.ecore.EStructuralFeature; -import org.eclipse.emf.ecore.resource.Resource; -import org.eclipse.emf.ecore.resource.ResourceSet; -import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl; -import org.eclipse.emf.ecore.util.FeatureMap; -import org.eclipse.emf.edit.provider.ComposedAdapterFactory; -import org.eclipse.emf.edit.provider.IItemLabelProvider; -import org.eclipse.emf.facet.util.core.Logger; -import org.eclipse.emf.facet.util.core.internal.exported.StringUtils; -import org.eclipse.emf.facet.util.emf.core.internal.Activator; - -/** - * Utility class for models. - * @since 0.2 - */ -public final class ModelUtils { - - /** - * Meta-model qualified name separator - */ - private static final String MM_QNAME_SEPARATOR = "::"; //$NON-NLS-1$ - - /** - * Utility classes don't need to (and shouldn't) be instantiated. - */ - private ModelUtils() { - // prevents instantiation - } - - /** - * Computes a list of {@link EObject}s from the same {@link ResourceSet} as - * <code>source</code> that can be assigned to the given feature. - */ - //Copied from org.eclipse.emf.facet.infra.common.core.internal.utils.ModelUtils.computeAssignableElements(EStructuralFeature, EObject) - public static List<EObject> computeAssignableElements(final EStructuralFeature feature, - final EObject source) { - EClassifier eType = feature.getEType(); - - // build a list of EObjects assignable to the EReference - List<EObject> list = new ArrayList<EObject>(); - Resource eResource = source.eResource(); - ResourceSet resourceSet = eResource.getResourceSet(); - TreeIterator<Notifier> allContents = resourceSet.getAllContents(); - while (allContents.hasNext()) { - Notifier notifier = allContents.next(); - if (notifier instanceof EObject) { - EObject eObject = (EObject) notifier; - if (eType.isInstance(eObject)) { - list.add(eObject); - } - } - } - return list; - } - - public static boolean isBooleanDataType(final EClassifier classifier) { - if (classifier instanceof EDataType) { - EDataType dataType = (EDataType) classifier; - Class<?> instanceClass = dataType.getInstanceClass(); - return instanceClass == Boolean.class || instanceClass == boolean.class; - } - return false; - } - - /** - * Find all subclasses of the given metaclass in the package registry - * - * @param context - * the metaclass whose subclasses must be found - * @return all the subclasses - */ - //Copied from org.eclipse.emf.facet.infra.common.core.internal.utils.ModelUtils.allSubClasses(final EClass context) - public static List<EClass> allSubClasses(final EClass context) { - List<EClass> result = new ArrayList<EClass>(); - // Set<Resource> resources = new HashSet<Resource>(); - Collection<String> uris = new ArrayList<String>(EPackage.Registry.INSTANCE.keySet()); - for (String ePackageURI : uris) { - try { - EPackage ePackage = EPackage.Registry.INSTANCE.getEPackage(ePackageURI); - EList<EClassifier> eClassifiers = ePackage.getEClassifiers(); - for (EClassifier eClassifier : eClassifiers) { - if (eClassifier instanceof EClass) { - EClass eClass = (EClass) eClassifier; - if (isSuperTypeOf(context, eClass)) { - result.add(eClass); - } - } - } - } catch (Exception e) { - Logger.logError(e, Activator.getDefault()); - } - } - return result; - } - - //Copied from org.eclipse.emf.facet.infra.common.core.internal.utils.ModelUtils.isSuperTypeOf(final EClass self, final EClass typeDeclaration) - public static boolean isSuperTypeOf(final EClass self, final EClass typeDeclaration) { - return typeDeclaration.getEAllSuperTypes().contains(self); - } - - /** @return the qualified name of the given metaclass */ - //Copied from org.eclipse.emf.facet.infra.common.core.internal.utils.ModelUtils.getMetaclassQualifiedName(final EClassifier eClass) - public static String getMetaclassQualifiedName(final EClassifier eClass) { - final ArrayList<String> qualifiedNameParts = new ArrayList<String>(); - final StringBuilder builder = new StringBuilder(); - - EPackage ePackage = eClass.getEPackage(); - while (ePackage != null) { - qualifiedNameParts.add(ePackage.getName()); - ePackage = ePackage.getESuperPackage(); - } - - for (int i = qualifiedNameParts.size() - 1; i >= 0; i--) { - builder.append(qualifiedNameParts.get(i) + "."); //$NON-NLS-1$ - } - - builder.append(eClass.getName()); - - return builder.toString(); - } - - /** - * Returns a name for the given model element from the EMF global registry, - * or use a default name taken from a String attribute. - * - * @return a name for the given element - */ - //Copied from org.eclipse.emf.facet.infra.common.core.internal.utils.ModelUtils.getName(EObject) - public static String getName(final EObject eObject) { - IItemLabelProvider itemLabelProvider = (IItemLabelProvider) new ComposedAdapterFactory( - ComposedAdapterFactory.Descriptor.Registry.INSTANCE).adapt(eObject, IItemLabelProvider.class); - if (itemLabelProvider != null) { - return itemLabelProvider.getText(eObject); - } - return ModelUtils.getDefaultName(eObject); - } - - /** - * @return a default name based on a string feature of the given - * {@link EObject} - */ - //Copied from org.eclipse.emf.facet.infra.common.core.internal.utils.ModelUtils.getDefaultName(EObject) - public static String getDefaultName(final EObject eObject) { - // find a feature that can be used as a name - final EStructuralFeature feature = ModelUtils.getLabelFeature(eObject.eClass()); - if (feature != null) { - final Object value = eObject.eGet(feature); - if (value != null) { - return StringUtils.truncateBeforeNewline(value.toString()); - } - } - return ""; //$NON-NLS-1$ - } - - //Copied from ReflectiveItemProvider class - //Copied from org.eclipse.emf.facet.infra.common.core.internal.utils.ModelUtils.getLabelFeature(EClass) - private static EStructuralFeature getLabelFeature(final EClass eClass) { - EAttribute result = null; - for (final EAttribute eAttribute : eClass.getEAllAttributes()) { - if (!eAttribute.isMany() - && eAttribute.getEType().getInstanceClass() != FeatureMap.Entry.class) { - if ("name".equalsIgnoreCase(eAttribute.getName())) { //$NON-NLS-1$ - result = eAttribute; - break; - } else if (result == null) { - result = eAttribute; - } else if (eAttribute.getEAttributeType().getInstanceClass() == String.class - && result.getEAttributeType().getInstanceClass() != String.class) { - result = eAttribute; - } - } - } - return result; - } - - /** - * @author Gregoire Dupe (Mia-Software) - * @param namedElement - * @return - */ - public static String getQualifiedName(final ENamedElement namedElement) { - String parentQName = ""; //$NON-NLS-1$ - if (namedElement.eContainer() instanceof ENamedElement) { - ENamedElement parent = (ENamedElement) namedElement.eContainer(); - parentQName = getQualifiedName(parent) + ModelUtils.MM_QNAME_SEPARATOR; - } - return parentQName + namedElement.getName(); - } - - /** - * @since 0.3 - */ - public static ResourceSet getOrCreateResourceSet(final EObject eObject) { - ResourceSet resourceSet = null; - if (eObject.eResource() == null) { - resourceSet = new ResourceSetImpl(); - } else { - resourceSet = eObject.eResource().getResourceSet(); - } - return resourceSet; - } - - /** - * @since 0.3 - */ - public static IProject getProject(final EObject eObject) { - IProject result = null; - final Resource resource = eObject.eResource(); - final URI uri = resource.getURI(); - if (uri.isPlatformResource()) { - final String projectName = uri.segment(1); - final IWorkspace workspace = ResourcesPlugin.getWorkspace(); - result = workspace.getRoot() - .getProject(projectName); - } - return result; - } -}
diff --git a/org.eclipse.modisco.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/catalog/ICatalogManager.java b/org.eclipse.modisco.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/catalog/ICatalogManager.java deleted file mode 100644 index fa3ebde..0000000 --- a/org.eclipse.modisco.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/catalog/ICatalogManager.java +++ /dev/null
@@ -1,33 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2015, 2016 Mia-Software. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Grégoire Dupé (Mia-Software) - Bug 477657 - The catalog manager should be able to manage workspace model - * Grégoire Dupé (Mia-Software) - Bug 482887 - CatalogManager create files with too long name - *******************************************************************************/ -package org.eclipse.emf.facet.util.emf.core.catalog; - -import java.util.List; - -import org.eclipse.core.resources.IProject; -import org.eclipse.emf.ecore.EObject; - -/** - * @since 1.1 - * @noimplement This interface is not intended to be implemented by clients. - * @noextend This interface is not intended to be extended by clients. - */ -public interface ICatalogManager { - - <T> List<T> getEntries(final Class<T> expectedClass); - <T> List<T> getWsEntries(final Class<T> expectedClass); - <T> List<T> getInstalledEntries(final Class<T> expectedClass); - boolean addWsEntry(EObject entry); - void removeWsEntry(EObject entry); - void removeAllWsEntries(IProject project); - -}
diff --git a/org.eclipse.modisco.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/catalog/ICatalogManagerConfiguration.java b/org.eclipse.modisco.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/catalog/ICatalogManagerConfiguration.java deleted file mode 100644 index 86a5549..0000000 --- a/org.eclipse.modisco.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/catalog/ICatalogManagerConfiguration.java +++ /dev/null
@@ -1,44 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2015, 2016 Mia-Software. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Grégoire Dupé (Mia-Software) - Bug 477657 - The catalog manager should be able to manage workspace model - * Grégoire Dupé (Mia-Software) - Bug 482887 - CatalogManager create files with too long name - *******************************************************************************/ -package org.eclipse.emf.facet.util.emf.core.catalog; - -import org.eclipse.emf.ecore.EObject; - -/** - * Manager for catalogs containing registered elements defined in models. - * - * @since 1.1 - * @noextend This interface is not intended to be extended by clients. - */ -public interface ICatalogManagerConfiguration { - - /** - * Return <code>true</code> if the eObject can be managed as a catalog - * entry. - * - * @param root - * the root element of a catalog - * @return true if the parameter 'root' is of the right type to be a catalog - * root - */ - boolean canBeManaged(EObject root); - - /** - * Return <code>true</code> if the eObject is valid. - * - * @param root - * the root element of a catalog - * @return true if the parameter 'root' is is valid - */ - boolean isValid(EObject root); - -}
diff --git a/org.eclipse.modisco.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/catalog/ICatalogManagerFactory.java b/org.eclipse.modisco.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/catalog/ICatalogManagerFactory.java deleted file mode 100644 index 8acb4f5..0000000 --- a/org.eclipse.modisco.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/catalog/ICatalogManagerFactory.java +++ /dev/null
@@ -1,41 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2015, 2016 Mia-Software. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Grégoire Dupé (Mia-Software) - Bug 477657 - The catalog manager should be able to manage workspace model - * Grégoire Dupé (Mia-Software) - Bug 482887 - CatalogManager create files with too long name - *******************************************************************************/ -package org.eclipse.emf.facet.util.emf.core.catalog; - -import org.eclipse.emf.ecore.resource.ResourceSet; -import org.eclipse.emf.facet.util.emf.core.internal.catalog.v2.CatalogManagerFactory; - -/** - * @since 1.1 - * @noimplement This interface is not intended to be implemented by clients. - * @noextend This interface is not intended to be extended by clients. - */ -public interface ICatalogManagerFactory { - - ICatalogManagerFactory DEFAULT = new CatalogManagerFactory(); - - /** - * The returned catalog will be serialized on file system. The serialization - * file will be named using the id parameter value. - */ - ICatalogManager getOrCreateCatalogManager( - ICatalogManagerConfiguration catalogMgrconfig, - ResourceSet resourceSet, String catalogId); - - /** - * The returned catalog will not be serialized on file system. The eObject - * will be stored in resource having a URI starting with <code>tmp://</code> - */ - ICatalogManager createCatalogManager( - ICatalogManagerConfiguration catalogMgrconfig, - ResourceSet resourceSet); -}
diff --git a/org.eclipse.modisco.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/command/EmfCommandUtils.java b/org.eclipse.modisco.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/command/EmfCommandUtils.java deleted file mode 100644 index f853f3d..0000000 --- a/org.eclipse.modisco.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/command/EmfCommandUtils.java +++ /dev/null
@@ -1,41 +0,0 @@ -/** - * Copyright (c) 2012 Mia-Software. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Alban Ménager (Soft-Maint) - Bug 387470 - [EFacet][Custom] Editors - * Grégoire Dupé (Mia-Software) - Bug 387470 - [EFacet][Custom] Editors - */ -package org.eclipse.emf.facet.util.emf.core.command; - -import java.util.List; - -import org.eclipse.emf.common.command.Command; -import org.eclipse.emf.common.command.CompoundCommand; - -/** - * @since 0.3 - */ -public final class EmfCommandUtils { - - private EmfCommandUtils() { - // Must not be used - } - - public static final Command createResult(final List<Command> commandList, - final String label) { - Command result = null; - while (commandList.contains(null)) { - commandList.remove(null); - } - if (!commandList.isEmpty()) { - result = new CompoundCommand(label, commandList); - } - return result; - } - -}
diff --git a/org.eclipse.modisco.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/command/ICommandFactoryResult.java b/org.eclipse.modisco.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/command/ICommandFactoryResult.java deleted file mode 100644 index a4ffca9..0000000 --- a/org.eclipse.modisco.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/command/ICommandFactoryResult.java +++ /dev/null
@@ -1,24 +0,0 @@ -/** - * Copyright (c) 2012 Mia-Software. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Gregoire Dupe (Mia-Software) - Bug 369987 - [Restructuring][Table] Switch to the new customization and facet framework - * Gregoire Dupe (Mia-Software) - Bug 373078 - API Cleaning - */ -package org.eclipse.emf.facet.util.emf.core.command; - -import org.eclipse.emf.common.command.Command; - -/** - * @since 0.2 - */ -public interface ICommandFactoryResult<T> { - Command getCommand(); - T getResult(); - -}
diff --git a/org.eclipse.modisco.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/command/ICommandFactoryResultFactory.java b/org.eclipse.modisco.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/command/ICommandFactoryResultFactory.java deleted file mode 100644 index 51fe2b5..0000000 --- a/org.eclipse.modisco.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/command/ICommandFactoryResultFactory.java +++ /dev/null
@@ -1,28 +0,0 @@ -/** - * Copyright (c) 2012 Mia-Software. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Gregoire Dupe (Mia-Software) - Bug 369987 - [Restructuring][Table] Switch to the new customization and facet framework - * Gregoire Dupe (Mia-Software) - Bug 373078 - API Cleaning - */ -package org.eclipse.emf.facet.util.emf.core.command; - -import org.eclipse.emf.common.command.Command; -import org.eclipse.emf.facet.util.emf.core.internal.command.CommandFactoryResultFactory; - -/** - * @since 0.2 - * @noimplement This interface is not intended to be implemented by clients. - * @noextend This interface is not intended to be extended by clients. - */ -public interface ICommandFactoryResultFactory { - - ICommandFactoryResultFactory DEFAULT = new CommandFactoryResultFactory(); - - <T> ICommandFactoryResult<T> createCommandFactoryResult(Command command, T result); -}
diff --git a/org.eclipse.modisco.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/command/ILockableUndoCommand.java b/org.eclipse.modisco.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/command/ILockableUndoCommand.java deleted file mode 100644 index 4228afe..0000000 --- a/org.eclipse.modisco.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/command/ILockableUndoCommand.java +++ /dev/null
@@ -1,25 +0,0 @@ -/** - * Copyright (c) 2011 CEA LIST. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Gregoire Dupe (Mia-Software) - Bug 345730 - Deleting an element in the model breaks the table - */ -package org.eclipse.emf.facet.util.emf.core.command; - -/** - * This interface is used to force an EMF command to not be "undo-able" - * @since 0.1.1 - * @noimplement This interface is not intended to be implemented by clients. - * @noextend This interface is not intended to be extended by clients. - */ -public interface ILockableUndoCommand { - - /** - * @param enableUndo false to lock the command in an not "undo-able" mode - */ - public void enableCanUndo(boolean enableUndo); -}
diff --git a/org.eclipse.modisco.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/exception/DebugRuntimeException.java b/org.eclipse.modisco.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/exception/DebugRuntimeException.java deleted file mode 100644 index 64fa8b9..0000000 --- a/org.eclipse.modisco.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/exception/DebugRuntimeException.java +++ /dev/null
@@ -1,25 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2011 Mia Software. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Grégoire Dupé - Bug 365843 - [Unit Test Failure][0.2/3.8][0.2/4.2]org.eclipse.emf.facet.widgets.nattable.tests.swtbot.Bug344925Test.testBug344925 - * Gregoire Dupe (Mia-Software) - Bug 373078 - API Cleaning - *******************************************************************************/ -package org.eclipse.emf.facet.util.emf.core.exception; - -/** - * @since 0.2 - */ -public final class DebugRuntimeException extends RuntimeException { - - private static final long serialVersionUID = -2130942266962627760L; - - public DebugRuntimeException(final Throwable throwable) { - super(throwable); - } - -}
diff --git a/org.eclipse.modisco.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/exception/InvalidFacetSetException.java b/org.eclipse.modisco.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/exception/InvalidFacetSetException.java deleted file mode 100644 index d95231f..0000000 --- a/org.eclipse.modisco.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/exception/InvalidFacetSetException.java +++ /dev/null
@@ -1,36 +0,0 @@ -/** - * Copyright (c) 2011 Mia-Software. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Nicolas Guyomar (Mia-Software) - Bug 338811 - A model registration method in the interface ICatalogSetManager - * Gregoire Dupe (Mia-Software) - Bug 373078 - API Cleaning - */ -package org.eclipse.emf.facet.util.emf.core.exception; - -/** - * This exception is raised when an invalid FacetSet is found - * - * @since 0.2 - */ -public final class InvalidFacetSetException extends Exception { - - private static final long serialVersionUID = -7684948344074635385L; - - public InvalidFacetSetException(final String message) { - super(message); - } - - public InvalidFacetSetException(final String message, final Throwable cause) { - super(message, cause); - } - - public InvalidFacetSetException(final Throwable cause) { - super(cause); - } - -}
diff --git a/org.eclipse.modisco.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/internal/Activator.java b/org.eclipse.modisco.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/internal/Activator.java deleted file mode 100644 index 7f44184..0000000 --- a/org.eclipse.modisco.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/internal/Activator.java +++ /dev/null
@@ -1,47 +0,0 @@ -/** - * Copyright (c) 2011 Mia-Software. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Gregoire Dupe (Mia-Software) - Bug 334000 - Simple catalog manager - * Nicolas Bros (Mia-Software) - Bug 335218 - Extension point for registering EObject, EPackage, model editor - */ -package org.eclipse.emf.facet.util.emf.core.internal; - -import org.eclipse.core.runtime.Plugin; -import org.osgi.framework.BundleContext; - -public class Activator extends Plugin { - - public static final String PLUGIN_ID = "org.eclipse.emf.facet.util.emf.core"; //$NON-NLS-1$ - - private static BundleContext context; - private static Activator plugin; - - public static Plugin getDefault() { - return Activator.plugin; - } - - static BundleContext getContext() { - return Activator.context; - } - - @Override - public void start(final BundleContext bundleContext) throws Exception { - super.start(bundleContext); - Activator.plugin = this; - Activator.context = bundleContext; - } - - @Override - public void stop(final BundleContext bundleContext) throws Exception { - Activator.context = null; - Activator.plugin = null; - super.stop(bundleContext); - } - -}
diff --git a/org.eclipse.modisco.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/internal/EMFUtils.java b/org.eclipse.modisco.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/internal/EMFUtils.java deleted file mode 100644 index 2c15370..0000000 --- a/org.eclipse.modisco.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/internal/EMFUtils.java +++ /dev/null
@@ -1,162 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2011 CEA LIST. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Nicolas Bros (Mia-Software) - Bug 340588 - Least common supertype - * Vincent Lorenzo (CEA-LIST) - bug 341328 - We need to be able to specify which column have to be hidden/visible using the customization mechanism - *******************************************************************************/ -package org.eclipse.emf.facet.util.emf.core.internal; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.Collections; -import java.util.Comparator; -import java.util.HashSet; -import java.util.Iterator; -import java.util.List; -import java.util.ListIterator; -import java.util.Set; - -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.EStructuralFeature; -import org.eclipse.emf.ecore.EcorePackage; - -public final class EMFUtils { - - private EMFUtils() { - // prevent instantiation - } - - /** - * Computes the least common supertype of all the given metaclasses. That is, the most derived - * type that is a supertype of all the given classes. - * - * @param classes - * the list of metaclasses - * - * @return the least common supertype of all the given metaclasses, or <code>null</code> if - * there is none, or several. In this case, the only common supertype can be considered - * as {@link EObject} . - */ - public static EClass computeLeastCommonSupertype(final Collection<EClass> classes) { - return computeLeastCommonSupertype(classes, null); - } - - /** - * Computes the least common supertype of all the given metaclasses. That is, the most derived - * type that is a supertype of all the given classes. - * - * @param classes - * the list of metaclasses - * @param feature - * if not <code>null</code>, then only metaclasses that contain this feature will be - * considered - * - * @return the least common supertype of all the given metaclasses, or the {@link EObject} - * {@link EClass} if there is none, or several. - */ - public static EClass computeLeastCommonSupertype(final Collection<EClass> classes, - final EStructuralFeature feature) { - Set<EClass> commonClasses = new HashSet<EClass>(); - Iterator<EClass> iterator = classes.iterator(); - boolean first = true; - while (iterator.hasNext()) { - EClass eClass = iterator.next(); - if (first) { - commonClasses.addAll(eClass.getEAllSuperTypes()); - commonClasses.add(eClass); - first = false; - } else { - List<EClass> filter = new ArrayList<EClass>(eClass.getEAllSuperTypes()); - filter.add(eClass); - commonClasses.retainAll(filter); - } - } - - Collection<EClass> commonClassesFiltered; - // keep only metaclasses that contain the feature - if (feature != null) { - commonClassesFiltered = new ArrayList<EClass>(); - for (EClass eClass : commonClasses) { - if (eClass.getEAllStructuralFeatures().contains(feature)) { - commonClassesFiltered.add(eClass); - } - } - } else { - commonClassesFiltered = commonClasses; - } - - // handle the easy (and common) cases early - int size = commonClassesFiltered.size(); - if (size == 0) { - return EcorePackage.eINSTANCE.getEObject(); - } - if (size == 1) { - return commonClassesFiltered.iterator().next(); - } - - // now, remove EClasses that are not a direct or indirect sub- or super-type - // of all the other classes. - ArrayList<EClass> list = new ArrayList<EClass>(commonClassesFiltered); - ListIterator<EClass> listIterator = list.listIterator(); - while (listIterator.hasNext()) { - EClass eClass = listIterator.next(); - for (EClass eClass2 : commonClassesFiltered) { - if (eClass != eClass2 && !eClass.isSuperTypeOf(eClass2) - && !eClass2.isSuperTypeOf(eClass)) { - listIterator.remove(); - break; - } - } - } - - int size2 = list.size(); - if (size2 == 0) { - return EcorePackage.eINSTANCE.getEObject(); - } - if (size2 == 1) { - return list.iterator().next(); - } - - // now commonClasses only contains classes in the same hierarchy, - // so we can sort them using a "is subtype of" comparison operator - - Collections.sort(list, new Comparator<EClass>() { - public int compare(final EClass e1, final EClass e2) { - if (e1 == e2) { - return 0; - } else if (e1.isSuperTypeOf(e2)) { - return 1; - } else if (e2.isSuperTypeOf(e1)) { - return -1; - } else { - throw new IllegalStateException("comparing classes not in the same hierarchy"); //$NON-NLS-1$ - } - } - }); - - if (list.isEmpty()) { - return EcorePackage.eINSTANCE.getEObject(); - } - return list.get(0); - } - - - public static Set<EClass> getAllFeatureOwner(final List<EObject> elements, - final EStructuralFeature feature) { - Set<EClass> owners = new HashSet<EClass>(); - for (EObject el : elements) { - if (el.eClass().getEAllStructuralFeatures().contains(feature)) { - owners.add(el.eClass()); - } - } - return owners; - } - -}
diff --git a/org.eclipse.modisco.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/internal/Messages.java b/org.eclipse.modisco.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/internal/Messages.java deleted file mode 100644 index 3646ad4..0000000 --- a/org.eclipse.modisco.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/internal/Messages.java +++ /dev/null
@@ -1,29 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2017 Soft-Maint. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Jonathan Pepin (Soft-Maint) - Bug 516701 - Command factory to add content to resource - *******************************************************************************/ - -package org.eclipse.emf.facet.util.emf.core.internal; - -import org.eclipse.osgi.util.NLS; - -public class Messages extends NLS { - private static final String BUNDLE_NAME = "org.eclipse.emf.facet.util.emf.core.internal.messages"; //$NON-NLS-1$ - public static String AddResourceContentCommand_Description; - public static String AddResourceContentCommand_Label; - public static String SetResourceContentCommand_Description; - public static String SetResourceContentCommand_Label; - static { - // initialize resource bundle - NLS.initializeMessages(BUNDLE_NAME, Messages.class); - } - - private Messages() { - } -}
diff --git a/org.eclipse.modisco.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/internal/catalog/CatalogSetManager.java b/org.eclipse.modisco.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/internal/catalog/CatalogSetManager.java deleted file mode 100644 index 5117537..0000000 --- a/org.eclipse.modisco.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/internal/catalog/CatalogSetManager.java +++ /dev/null
@@ -1,191 +0,0 @@ -/** - * Copyright (c) 2011, 2015 Mia-Software. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Grégoire Dupé (Mia-Software) - Bug 334000 Simple catalog manager - * Nicolas Guyomar (Mia-Software) - Bug 334000 Simple catalog manager - * Nicolas Guyomar (Mia-Software) - Bug 334529 - ICatalogManager should be exposed in org.eclipse.emf.facet.common.core - * Nicolas Guyomar (Mia-Software) - Bug 338811 - A model registration method in the interface ICatalogSetManager - * Grégoire Dupé (Mia-Software) - Bug 338811 - A model registration method in the interface ICatalogSetManager - * Emmanuelle Rouillé (Mia-Software) - Bug 352618 - To be able to use non derived facet structural features and save them values. - * Grégoire Dupé (Mia-Software) - Bug 362084 - Get the instance of a catalog manager - * Grégoire Dupé (Mia-Software) - Bug 362087 - [Deprecated] org.eclipse.emf.facet.util.emf.core.ICatalogSetManager - * Grégoire Dupé (Mia-Software) - Bug 477657 - The catalog manager should be able to manage workspace model - */ -package org.eclipse.emf.facet.util.emf.core.internal.catalog; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import org.eclipse.core.resources.IFile; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IConfigurationElement; -import org.eclipse.core.runtime.IExtension; -import org.eclipse.core.runtime.IExtensionPoint; -import org.eclipse.core.runtime.IExtensionRegistry; -import org.eclipse.core.runtime.Platform; -import org.eclipse.emf.common.notify.Adapter; -import org.eclipse.emf.common.notify.Notification; -import org.eclipse.emf.common.notify.Notifier; -import org.eclipse.emf.common.util.URI; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.resource.Resource; -import org.eclipse.emf.ecore.resource.ResourceSet; -import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl; -import org.eclipse.emf.facet.util.core.Logger; -import org.eclipse.emf.facet.util.emf.catalog.CatalogFactory; -import org.eclipse.emf.facet.util.emf.catalog.CatalogSet; -import org.eclipse.emf.facet.util.emf.core.ICatalogManager; -import org.eclipse.emf.facet.util.emf.core.ICatalogSetManager2; -import org.eclipse.emf.facet.util.emf.core.exception.InvalidFacetSetException; -import org.eclipse.emf.facet.util.emf.core.internal.Activator; -import org.eclipse.emf.facet.util.pde.core.internal.exported.PluginUtils; -import org.osgi.framework.Bundle; - -@Deprecated -public class CatalogSetManager implements ICatalogSetManager2, Adapter { - - private static final String CATALOG_MGR_EXTENSION_POINT_ID = "org.eclipse.emf.facet.util.emf.core.catalogmanager"; //$NON-NLS-1$ - private static final String MODEL_DECLARATION_EXTENSION_POINT_ID = "org.eclipse.emf.facet.util.emf.core.modeldeclaration"; //$NON-NLS-1$ - private static final String CLASS = "class"; //$NON-NLS-1$ - private static final String FILE = "file"; //$NON-NLS-1$ - - /** - * The singleton instance of this {@link CatalogSetManager}. - */ - public static final CatalogSetManager INSTANCE = new CatalogSetManager(); - - private final Map<Resource, Bundle> resourceToBundleMap = new HashMap<Resource, Bundle>(); - private final ResourceSet resourceSet; - - private final List<ICatalogManager> catalogManagers = new ArrayList<ICatalogManager>(); - private final CatalogSet catalogSet; - - public CatalogSetManager() { - this.resourceSet = new ResourceSetImpl(); - this.catalogSet = CatalogFactory.eINSTANCE.createCatalogSet(); - initRegisteredEntries(); - } - - public CatalogSetManager(final ResourceSet resourceSet) { - this.resourceSet = resourceSet; - this.catalogSet = CatalogFactory.eINSTANCE.createCatalogSet(); - initRegisteredEntries(); - } - - private void initRegisteredEntries() { - final IExtensionRegistry registry = Platform.getExtensionRegistry(); - final IExtensionPoint extPointCatalogMgr = registry - .getExtensionPoint(CatalogSetManager.CATALOG_MGR_EXTENSION_POINT_ID); - if (extPointCatalogMgr != null) { - for (IExtension ext : extPointCatalogMgr.getExtensions()) { - for (IConfigurationElement configElt : ext - .getConfigurationElements()) { - ICatalogManager catalogMgr; - try { - catalogMgr = (ICatalogManager) configElt - .createExecutableExtension(CatalogSetManager.CLASS); - this.catalogManagers.add(catalogMgr); - catalogMgr.setCatalogSet(this.catalogSet); - } catch (CoreException e) { - Logger.logError(e, Activator.getDefault()); - } - } - } - } - IExtensionPoint modelDeclarationExtPoint = registry - .getExtensionPoint(CatalogSetManager.MODEL_DECLARATION_EXTENSION_POINT_ID); - if (modelDeclarationExtPoint != null) { - for (IExtension ext : modelDeclarationExtPoint.getExtensions()) { - for (IConfigurationElement configElt : ext - .getConfigurationElements()) { - String filePath = configElt - .getAttribute(CatalogSetManager.FILE); - if (filePath != null) { - String pluginName = ext.getNamespaceIdentifier(); - Bundle bundle = Platform.getBundle(pluginName); - URI uri = URI.createPlatformPluginURI(pluginName + "/" //$NON-NLS-1$ - + filePath, false); - try { - final Resource resource = this.resourceSet - .getResource(uri, true); - this.resourceToBundleMap.put(resource, bundle); - for (EObject root : resource.getContents()) { - for (ICatalogManager catalogMgr : this.catalogManagers) { - if (catalogMgr.canBeManaged(root)) { - catalogMgr.manage(root); - } - } - } - } catch (Exception e) { - Logger.logError(e, Activator.getDefault()); - } - } - } - } - } - } - - public CatalogSet getCatalogSet() { - return this.catalogSet; - } - - /** - * @author Nicolas Guyomar - * Modified by Emmanuelle Rouillé - */ - public Bundle getBundleByResource(final Resource eResource) { - if (eResource == null) { - throw new IllegalArgumentException("The resource cannot be null"); //$NON-NLS-1$ - } - if (eResource.getURI().scheme().equals("platform") && eResource.getURI().segment(0).equals("plugin")) { //$NON-NLS-1$//$NON-NLS-2$ - return Platform.getBundle(eResource.getURI().segment(1)); - } - return this.resourceToBundleMap.get(eResource); - } - - public void registerModelDeclaration(final IFile file) throws InvalidFacetSetException { - PluginUtils.register(file, CatalogSetManager.MODEL_DECLARATION_EXTENSION_POINT_ID, - "modeldeclaration"); //$NON-NLS-1$ - } - - public <T> List<T> getCatalogManagerByType(final Class<? extends T> catalogManagerClass) { - List<T> result = new ArrayList<T>(); - for (ICatalogManager catalogManager : this.catalogManagers) { - if (catalogManagerClass.isInstance(catalogManager)) { - @SuppressWarnings("unchecked") - /* - * @SuppressWarnings("unchecked"): gdupe> Checked by the call of - * 'isInstance' in the if statement - */ - final T catalogManager2 = (T) catalogManager; - result.add(catalogManager2); - } - } - return result; - } - - public void notifyChanged(final Notification notification) { - // Nothing to do - } - - public Notifier getTarget() { - return this.resourceSet; - } - - public void setTarget(final Notifier newTarget) { - // Nothing to do - } - - public boolean isAdapterForType(final Object type) { - return type == ICatalogSetManager2.class; - } - -}
diff --git a/org.eclipse.modisco.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/internal/catalog/CatalogSetManagerFactory.java b/org.eclipse.modisco.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/internal/catalog/CatalogSetManagerFactory.java deleted file mode 100644 index 8aa9d84..0000000 --- a/org.eclipse.modisco.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/internal/catalog/CatalogSetManagerFactory.java +++ /dev/null
@@ -1,37 +0,0 @@ -/** - * Copyright (c) 2012, 2015 Mia-Software. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Gregoire Dupe (Mia-Software) - Bug 369987 - [Restructuring][Table] Switch to the new customization and facet framework - * Grégoire Dupé (Mia-Software) - Bug 477657 - The catalog manager should be able to manage workspace model - */ -package org.eclipse.emf.facet.util.emf.core.internal.catalog; - -import org.eclipse.emf.common.notify.Adapter; -import org.eclipse.emf.ecore.resource.ResourceSet; -import org.eclipse.emf.facet.util.emf.core.ICatalogSetManager2; -import org.eclipse.emf.facet.util.emf.core.ICatalogSetManagerFactory; - -@Deprecated -public class CatalogSetManagerFactory implements ICatalogSetManagerFactory { - - public ICatalogSetManager2 createICatalogSetManager(final ResourceSet resourceSet) { - CatalogSetManager result = null; - for (Adapter adapter : resourceSet.eAdapters()) { - if (adapter instanceof CatalogSetManager) { - result = (CatalogSetManager) adapter; - } - } - if (result == null) { - result = new CatalogSetManager(resourceSet); - resourceSet.eAdapters().add(result); - } - return result; - } - -}
diff --git a/org.eclipse.modisco.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/internal/catalog/v2/CatalogListener.java b/org.eclipse.modisco.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/internal/catalog/v2/CatalogListener.java deleted file mode 100644 index bf49f72..0000000 --- a/org.eclipse.modisco.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/internal/catalog/v2/CatalogListener.java +++ /dev/null
@@ -1,179 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2015, 2016 Mia-Software. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Grégoire Dupé (Mia-Software) - Bug 477657 - The catalog manager should be able to manage workspace model - * Thomas Cicognani (Mia-Software) - Bug 483684 - NullPointerException on CatalogManager - * Grégoire Dupé (Mia-Software) - Bug 482887 - CatalogManager create files with too long name - *******************************************************************************/ -package org.eclipse.emf.facet.util.emf.core.internal.catalog.v2; - -import java.io.IOException; -import java.util.Collection; -import java.util.HashMap; -import java.util.Map; - -import org.eclipse.emf.common.notify.Adapter; -import org.eclipse.emf.common.notify.Notification; -import org.eclipse.emf.common.notify.Notifier; -import org.eclipse.emf.common.util.URI; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.EReference; -import org.eclipse.emf.ecore.resource.Resource; -import org.eclipse.emf.ecore.xmi.XMLResource; -import org.eclipse.emf.facet.util.core.Logger; -import org.eclipse.emf.facet.util.emf.core.internal.Activator; - - -class CatalogListener implements Adapter { - -/* - private static final boolean DEBUG = DebugUtils.getDebugStatus(Activator - .getDefault()); -*/ - private final Resource resource; - - private static final Map<String, String> SAVE_OPTIONS = new HashMap<String, String>(); - static { - final String fileEncoding = System.getProperty("file.encoding"); //$NON-NLS-1$ - SAVE_OPTIONS.put(XMLResource.OPTION_ENCODING, fileEncoding); - } - - public CatalogListener(final Resource resource) { - this.resource = resource; - } - - private EObject target; - - public void notifyChanged(final Notification notification) { - final int eventType = notification.getEventType(); - switch (eventType) { - case Notification.SET: - notifyChangedForSet(notification); - break; - case Notification.ADD: - notifyChangedForAdd(notification); - break; - case Notification.ADD_MANY: - notifyChangedForAddMany(notification); - break; - case Notification.REMOVE: - notifyChangedForRemove(notification); - break; - case Notification.REMOVE_MANY: - notifyChangedForRemoveMany(notification); - break; - default: - break; - } - try { - final URI uri = this.resource.getURI(); - final String uriStr = uri.toString(); - if (!uriStr.startsWith("tmp")) { //$NON-NLS-1$ - this.resource.save(SAVE_OPTIONS); - } - } catch (IOException e) { - Logger.logError(e, Activator.getDefault()); - } - } - - private void notifyChangedForSet(final Notification notification) { - final Object newValue = notification.getNewValue(); - CatalogListenerFactory.adapt(newValue, this.resource); - } - - private static void notifyChangedForRemoveMany( - final Notification notification) { - @SuppressWarnings("unchecked") - /* - * @SuppressWarnings("unchecked") TCI> Safe cast - */ - final Collection<Object> oldValues = (Collection<Object>) notification - .getOldValue(); - ifIsContainement(notification, new Runnable() { - public void run() { - for (Object oldValuesItem : oldValues) { - CatalogListenerFactory.removeAdapter(oldValuesItem); - } - } - }); - } - - private static void notifyChangedForRemove(final Notification notification) { - final Object oldValue = notification.getOldValue(); - ifIsContainement(notification, new Runnable() { - public void run() { - CatalogListenerFactory.removeAdapter(oldValue); - } - }); - } - - private void notifyChangedForAddMany(final Notification notification) { - @SuppressWarnings("unchecked") - /* - * @SuppressWarnings("unchecked") TCI> Safe cast - */ - final Collection<Object> newValues = (Collection<Object>) notification - .getNewValue(); - ifIsContainement(notification, new Runnable() { - public void run() { - for (Object newValuesItem : newValues) { - CatalogListenerFactory.adapt(newValuesItem, - CatalogListener.this.getResource()); - } - } - }); - } - - private void notifyChangedForAdd(final Notification notification) { - final Object newValue = notification.getNewValue(); - ifIsContainement(notification, new Runnable() { - public void run() { - CatalogListenerFactory.adapt(newValue, - CatalogListener.this.getResource()); - } - }); - } - - protected Resource getResource() { - return this.resource; - } - - private static void ifIsContainement(final Notification notification, - final Runnable runnable) { - final Object feature = notification.getFeature(); - if (feature instanceof EReference - && ((EReference) feature).isContainment()) { - runnable.run(); - } - } - - public Notifier getTarget() { - return this.target; - } - - public void setTarget(final Notifier newTarget) { - if (newTarget instanceof EObject) { - this.target = (EObject) newTarget; - propagate(newTarget); - } - } - - private void propagate(final Notifier newTarget) { - if (newTarget instanceof EObject) { - final EObject eObject = (EObject) newTarget; - for (final EObject subEObject : eObject.eContents()) { - CatalogListenerFactory.adaptResource(subEObject, this.resource); - } - } - } - - public boolean isAdapterForType(final Object type) { - return EObject.class.isInstance(type); - } - -}
diff --git a/org.eclipse.modisco.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/internal/catalog/v2/CatalogListenerFactory.java b/org.eclipse.modisco.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/internal/catalog/v2/CatalogListenerFactory.java deleted file mode 100644 index 88a064f..0000000 --- a/org.eclipse.modisco.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/internal/catalog/v2/CatalogListenerFactory.java +++ /dev/null
@@ -1,118 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2015, 2016 Mia-Software. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Grégoire Dupé (Mia-Software) - Bug 477657 - The catalog manager should be able to manage workspace model - * Grégoire Dupé (Mia-Software) - Bug 482887 - CatalogManager create files with too long name - *******************************************************************************/ -package org.eclipse.emf.facet.util.emf.core.internal.catalog.v2; - -import org.eclipse.emf.common.notify.Adapter; -import org.eclipse.emf.common.notify.AdapterFactory; -import org.eclipse.emf.common.notify.Notifier; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.resource.Resource; -import org.eclipse.emf.facet.util.core.DebugUtils; -import org.eclipse.emf.facet.util.emf.core.internal.Activator; - - -public class CatalogListenerFactory implements AdapterFactory { - - private static final boolean DEBUG = DebugUtils.getDebugStatus(Activator - .getDefault()); - - public boolean isFactoryForType(final Object type) { - return type == CatalogListener.class; - } - - public Object adapt(final Object object, final Object type) { - Object result = null; - if (object instanceof Notifier) { - result = adapt((Notifier) object, type); - } - return result; - } - - public static void adapt(final Object object, - final Resource resource) { - if (object instanceof EObject) { - final EObject eObject = (EObject) object; - adaptResource(eObject, resource); - } - } - - public Adapter adapt(final Notifier target, final Object type) { - Adapter result = null; - if ((isFactoryForType(type)) && (target instanceof EObject)) { - final EObject eObject = (EObject) target; - result = adapt(target, eObject); - } - return result; - } - - public static CatalogListener adaptResource(final Notifier target, - final Resource resource) { - CatalogListener result = findAdatper(target); - if (result == null) { - result = adaptNew(target, resource); - } - return result; - } - - private static CatalogListener findAdatper(final Notifier target) { - CatalogListener result = null; - for (final Adapter adapter : target.eAdapters()) { - if (adapter instanceof CatalogListener) { - result = (CatalogListener) adapter; - break; - } - } - return result; - } - - private static CatalogListener adaptNew(final Notifier target, - final Resource resource) { - if (DEBUG) { - DebugUtils.debug(target.toString()); - } - final CatalogListener result = new CatalogListener(resource); - target.eAdapters().add(result); - return result; - } - - public Adapter adaptNew(final Notifier target, final Object type) { - Adapter result = null; - if ((type == CatalogListener.class) && (target instanceof EObject)) { - final EObject eObject = (EObject) target; - result = adapt(target, eObject); - } - return result; - } - - public void adaptAllNew(final Notifier notifier) { - if (notifier instanceof EObject) { - final EObject eObject = (EObject) notifier; - adapt(notifier, eObject); - } - } - - public static void removeAdapter(final Object oldValue) { - if (DEBUG) { - DebugUtils.debug(oldValue.toString()); - } - if (oldValue instanceof EObject) { - final EObject notifier = (EObject) oldValue; - final CatalogListener validationAdapter = findAdatper(notifier); - if (validationAdapter != null) { - notifier.eAdapters().remove(validationAdapter); - for (EObject subEObject : notifier.eContents()) { - removeAdapter(subEObject); - } - } - } - } -}
diff --git a/org.eclipse.modisco.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/internal/catalog/v2/CatalogManager.java b/org.eclipse.modisco.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/internal/catalog/v2/CatalogManager.java deleted file mode 100644 index c827cd3..0000000 --- a/org.eclipse.modisco.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/internal/catalog/v2/CatalogManager.java +++ /dev/null
@@ -1,239 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2015, 2017 Mia-Software. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Grégoire Dupé (Mia-Software) - Bug 477657 - The catalog manager should be able to manage workspace model - * Thomas Cicognani (Mia-Software) - Bug 483684 - NullPointerException on CatalogManager - * Thomas Cicognani (Mia-Software) - Bug 482887 - CatalogManager create files with to long name - * Grégoire Dupé (Mia-Software) - Bug 482887 - CatalogManager create files with too long name - * Grégoire Dupé (Mia-Software) - Bug 516254 - CatalogManager must not return workspace entries from closed project - *******************************************************************************/ -package org.eclipse.emf.facet.util.emf.core.internal.catalog.v2; - -import java.io.FileNotFoundException; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import org.eclipse.core.resources.IProject; -import org.eclipse.core.runtime.IConfigurationElement; -import org.eclipse.core.runtime.IExtension; -import org.eclipse.core.runtime.IExtensionPoint; -import org.eclipse.core.runtime.IExtensionRegistry; -import org.eclipse.core.runtime.Platform; -import org.eclipse.emf.common.notify.Adapter; -import org.eclipse.emf.common.notify.Notification; -import org.eclipse.emf.common.notify.Notifier; -import org.eclipse.emf.common.util.EList; -import org.eclipse.emf.common.util.URI; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.resource.Resource; -import org.eclipse.emf.ecore.resource.ResourceSet; -import org.eclipse.emf.facet.util.core.Logger; -import org.eclipse.emf.facet.util.emf.catalog.metamodel.internal.v1_1.catalog.CatalogFactory; -import org.eclipse.emf.facet.util.emf.catalog.metamodel.internal.v1_1.catalog.InstallAndWokspaceCatalog; -import org.eclipse.emf.facet.util.emf.core.catalog.ICatalogManager; -import org.eclipse.emf.facet.util.emf.core.catalog.ICatalogManagerConfiguration; -import org.eclipse.emf.facet.util.emf.core.internal.Activator; -import org.osgi.framework.Bundle; - -final class CatalogManager implements ICatalogManager, Adapter { - - private static final String MODEL_DECL_EXT_PT = "org.eclipse.emf.facet.util.emf.core.modeldeclaration"; //$NON-NLS-1$ - private static final String FILE = "file"; //$NON-NLS-1$ - private final Map<Resource, Bundle> resourceToBundle = new HashMap<Resource, Bundle>(); - private final ICatalogManagerConfiguration catalogMgrconfig; - private InstallAndWokspaceCatalog catalog; - private final ResourceSet resourceSet; - private final String catalogId; - private Resource resource; - - public CatalogManager(final ICatalogManagerConfiguration catalogMgrconfig, - final ResourceSet resourceSet, final String catalogId) { - this.resourceSet = resourceSet; - this.catalogMgrconfig = catalogMgrconfig; - this.catalogId = catalogId; - URI uri; - if (catalogId == null) { - final String uriStr = String.format("tmp://%s", //$NON-NLS-1$ - this.getClass().getName()); - uri = URI.createURI(uriStr); - } else { - final String uriStr = String.format("platform:/meta/%s/%s.xmi", //$NON-NLS-1$ - Activator.getDefault().getBundle().getSymbolicName(), - catalogId); - uri = URI.createURI(uriStr); - } - if (catalogId == null) { - this.resource = this.resourceSet.createResource(uri); - } else { - try { - this.resource = this.resourceSet.getResource(uri, true); - } catch (org.eclipse.emf.common.util.WrappedException e) { - if (!(e.getCause() instanceof FileNotFoundException)) { - Logger.logError(e, Activator.getDefault()); - } - this.resource = this.resourceSet.createResource(uri); - } - } - if ((!this.resource.getContents().isEmpty()) - && this.resource.getContents().get(0) instanceof InstallAndWokspaceCatalog) { - this.catalog = (InstallAndWokspaceCatalog) this.resource.getContents().get(0); - removeNotResolvedProxy(this.catalog.getWorkspaceEntries()); - removeNotResolvedProxy(this.catalog.getInstalledEntries()); - } else { - this.catalog = CatalogFactory.eINSTANCE.createInstallAndWokspaceCatalog(); - EmfCommandUtils.executeAdd(this.resource, this.catalog); - } - initRegisteredEntries(); - CatalogListenerFactory.adaptResource(this.catalog, this.resource); - } - - private void removeNotResolvedProxy(final EList<EObject> eObjects) { - final List<EObject> toBeRemoved = new ArrayList<EObject>(); - for (EObject entry : eObjects) { - if (entry.eIsProxy()) { - toBeRemoved.add(entry); - } - } - EmfCommandUtils.executeRemove(eObjects, toBeRemoved, this.resource); - } - - private void initRegisteredEntries() { - final IExtensionRegistry registry = Platform.getExtensionRegistry(); - final IExtensionPoint modelDeclExtPoint = registry - .getExtensionPoint(CatalogManager.MODEL_DECL_EXT_PT); - if (modelDeclExtPoint != null) { - for (IExtension ext : modelDeclExtPoint.getExtensions()) { - for (IConfigurationElement configElt : ext.getConfigurationElements()) { - final String filePath = configElt.getAttribute(CatalogManager.FILE); - if (filePath != null) { - final String pluginName = ext.getNamespaceIdentifier(); - final Bundle bundle = Platform.getBundle(pluginName); - final URI uri = URI.createPlatformPluginURI(pluginName - + "/" + filePath, false); //$NON-NLS-1$ - try { - final Resource resource = this.resourceSet.getResource(uri, true); - this.resourceToBundle.put(resource, bundle); - for (EObject root : resource.getContents()) { - this.onInstalledModelFound(root); - } - } catch (Exception e) { - Logger.logError(e, Activator.getDefault()); - } - } - } - } - } - } - - private void onInstalledModelFound(final EObject root) { - if (this.catalogMgrconfig.canBeManaged(root) && this.catalogMgrconfig.isValid(root)) { - this.catalog.getInstalledEntries().add(root); - } - } - - public <T> List<T> getEntries(final Class<T> expectedClass) { - final List<T> result = new ArrayList<T>(); - final List<T> filteredEntries = getInstalledEntries(expectedClass); - result.addAll(filteredEntries); - final List<T> wsEntriesFiltered = getWsEntries(expectedClass); - result.addAll(wsEntriesFiltered); - return result; - } - - public <T> List<T> getWsEntries(final Class<T> expectedClass) { - final List<T> result = new ArrayList<T>(); - for (EObject eObject : this.catalog.getWorkspaceEntries()) { - if (expectedClass.isInstance(eObject) - && EmfUtils.isDataAccessible(eObject)) { - @SuppressWarnings("unchecked") - /* - * @SuppressWarnings("unchecked"): gdupe> Checked by the call of - * 'isInstance' in the 'if' statement - */ - final T tObject = (T) eObject; - result.add(tObject); - } - } - return result; - } - - public <T> List<T> getInstalledEntries(final Class<T> expectedClass) { - final List<T> result = new ArrayList<T>(); - for (EObject eObject : this.catalog.getInstalledEntries()) { - if (expectedClass.isInstance(eObject)) { - @SuppressWarnings("unchecked") - /* - * @SuppressWarnings("unchecked"): gdupe> Checked by the call of - * 'isInstance' in the 'if' statement - */ - final T tObject = (T) eObject; - result.add(tObject); - } - } - return result; - } - - public boolean addWsEntry(final EObject entry) { - boolean result = false; - if (this.catalogMgrconfig.canBeManaged(entry) - && this.catalogMgrconfig.isValid(entry)) { - this.catalog.getWorkspaceEntries().add(entry); - result = true; - } - return result; - } - - public void removeWsEntry(final EObject entry) { - this.catalog.getWorkspaceEntries().remove(entry); - } - - public void removeAllWsEntries(final IProject project) { - final List<EObject> toBeRemoved = new ArrayList<EObject>(); - final List<EObject> wsEntries = getWsEntries(EObject.class); - for (EObject registered : wsEntries) { - final Resource eResource = registered.eResource(); - if (eResource == null || registered.eIsProxy()) { - /* - * Case where it is impossible to get the Resource (e.g. the - * linked object [registered] was deleted) - */ - toBeRemoved.add(registered); - } else { - final URI uri = eResource.getURI(); - final String uriStr = uri.toString(); - if (uriStr - .startsWith("platform:/resource/" + project.getName())) { //$NON-NLS-1$ - toBeRemoved.add(registered); - } - } - } - this.catalog.getWorkspaceEntries().removeAll(toBeRemoved); - } - - public String getCatalogId() { - return this.catalogId; - } - - public void notifyChanged(final Notification notification) { - // Nothing to do - } - - public Notifier getTarget() { - return this.resourceSet; - } - - public void setTarget(final Notifier newTarget) { - // Nothing to do - } - - public boolean isAdapterForType(final Object type) { - return type == ICatalogManager.class; - } -}
diff --git a/org.eclipse.modisco.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/internal/catalog/v2/CatalogManagerFactory.java b/org.eclipse.modisco.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/internal/catalog/v2/CatalogManagerFactory.java deleted file mode 100644 index edee7cc..0000000 --- a/org.eclipse.modisco.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/internal/catalog/v2/CatalogManagerFactory.java +++ /dev/null
@@ -1,55 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2015, 2016 Mia-Software. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Grégoire Dupé (Mia-Software) - Bug 477657 - The catalog manager should be able to manage workspace model - * Grégoire Dupé (Mia-Software) - Bug 482887 - CatalogManager create files with too long name - *******************************************************************************/ -package org.eclipse.emf.facet.util.emf.core.internal.catalog.v2; - -import org.eclipse.emf.common.notify.Adapter; -import org.eclipse.emf.ecore.resource.ResourceSet; -import org.eclipse.emf.facet.util.emf.core.catalog.ICatalogManager; -import org.eclipse.emf.facet.util.emf.core.catalog.ICatalogManagerConfiguration; -import org.eclipse.emf.facet.util.emf.core.catalog.ICatalogManagerFactory; - -public class CatalogManagerFactory implements ICatalogManagerFactory { - - public ICatalogManager getOrCreateCatalogManager( - final ICatalogManagerConfiguration catalogMgrconfig, - final ResourceSet resourceSet, final String catalogId) { - CatalogManager result = searchExistingMgr(resourceSet, catalogId); - if (result == null) { - result = new CatalogManager(catalogMgrconfig, resourceSet, catalogId); - resourceSet.eAdapters().add(result); - } - return result; - } - - public ICatalogManager createCatalogManager( - final ICatalogManagerConfiguration catalogMgrconfig, - final ResourceSet resourceSet) { - final CatalogManager result = new CatalogManager( - catalogMgrconfig, resourceSet, null); - resourceSet.eAdapters().add(result); - return result; - } - - private static CatalogManager searchExistingMgr( - final ResourceSet resourceSet, final String catalogId) { - CatalogManager result = null; - for (Adapter adapter : resourceSet.eAdapters()) { - if (adapter instanceof CatalogManager) { - final CatalogManager candidate = (CatalogManager) adapter; - if (candidate.getCatalogId().equals(catalogId)) { - result = (CatalogManager) adapter; - } - } - } - return result; - } -}
diff --git a/org.eclipse.modisco.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/internal/catalog/v2/EmfCommandUtils.java b/org.eclipse.modisco.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/internal/catalog/v2/EmfCommandUtils.java deleted file mode 100644 index 67642c3..0000000 --- a/org.eclipse.modisco.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/internal/catalog/v2/EmfCommandUtils.java +++ /dev/null
@@ -1,58 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2017 Mia-Software. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Grégoire Dupé (Mia-Software) - Bug 516254 - CatalogManager must not return workspace entries from closed project - *******************************************************************************/ -package org.eclipse.emf.facet.util.emf.core.internal.catalog.v2; - -import java.util.List; - -import org.eclipse.emf.common.command.Command; -import org.eclipse.emf.common.util.EList; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.resource.Resource; -import org.eclipse.emf.edit.command.AddCommand; -import org.eclipse.emf.edit.command.RemoveCommand; -import org.eclipse.emf.facet.util.emf.catalog.metamodel.internal.v1_1.catalog.InstallAndWokspaceCatalog; -import org.eclipse.emf.transaction.TransactionalEditingDomain; -import org.eclipse.emf.transaction.util.TransactionUtil; - -public final class EmfCommandUtils { - - private EmfCommandUtils() { - // Must not be used - } - - public static void executeRemove(final EList<EObject> eObjects, - final List<EObject> toBeRemoved, final Resource resource) { - final TransactionalEditingDomain editingDomain = TransactionUtil - .getEditingDomain(resource); - if (editingDomain == null) { - eObjects.removeAll(toBeRemoved); - } else { - final Command command = new RemoveCommand(editingDomain, eObjects, - toBeRemoved); - editingDomain.getCommandStack().execute(command); - } - } - - public static void executeAdd(final Resource resource, - final InstallAndWokspaceCatalog catalog) { - final TransactionalEditingDomain editingDomain = TransactionUtil - .getEditingDomain(resource); - final EList<EObject> contents = resource.getContents(); - if (editingDomain == null) { - contents.add(catalog); - } else { - final Command command = new AddCommand(editingDomain, contents, - catalog); - editingDomain.getCommandStack().execute(command); - } - } - -}
diff --git a/org.eclipse.modisco.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/internal/catalog/v2/EmfUtils.java b/org.eclipse.modisco.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/internal/catalog/v2/EmfUtils.java deleted file mode 100644 index 92df40c..0000000 --- a/org.eclipse.modisco.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/internal/catalog/v2/EmfUtils.java +++ /dev/null
@@ -1,54 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2017 Mia-Software. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Grégoire Dupé (Mia-Software) - Bug 516254 - CatalogManager must not return workspace entries from closed project - * Thomas Cicognani (Mia-Software) - Bug 521883 - Cannot get IProject from URI if name contains spaces - *******************************************************************************/ -package org.eclipse.emf.facet.util.emf.core.internal.catalog.v2; - -import org.eclipse.core.resources.IProject; -import org.eclipse.core.resources.IWorkspace; -import org.eclipse.core.resources.IWorkspaceRoot; -import org.eclipse.core.resources.ResourcesPlugin; -import org.eclipse.emf.common.util.URI; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.util.EcoreUtil; - -public final class EmfUtils { - - private EmfUtils() { - // Must not be used - } - - public static boolean isDataAccessible(final EObject eObject) { - boolean result = true; - final URI uri = EcoreUtil.getURI(eObject); - if (uri.isPlatformResource()) { - final IProject project = getProject(uri); - result = project.isOpen(); - } - return result; - } - - public static IProject getProject(final URI uri) { - IProject result = null; - final String prjName = uri.segment(1); - result = getProject(prjName); - if (result == null || !result.exists()) { - final String decodedPrjName = URI.decode(prjName); - result = getProject(decodedPrjName); - } - return result; - } - - private static IProject getProject(final String prjName) { - final IWorkspace workspace = ResourcesPlugin.getWorkspace(); - final IWorkspaceRoot root = workspace.getRoot(); - return root.getProject(prjName); - } -}
diff --git a/org.eclipse.modisco.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/internal/command/AddResourceContentCommand.java b/org.eclipse.modisco.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/internal/command/AddResourceContentCommand.java deleted file mode 100644 index 7c58e65..0000000 --- a/org.eclipse.modisco.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/internal/command/AddResourceContentCommand.java +++ /dev/null
@@ -1,97 +0,0 @@ -/** - * Copyright (c) 2017 Soft-Maint. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Jonathan Pepin (Soft-Maint) - Bug 516701 - Command factory to add content to resource - */ -package org.eclipse.emf.facet.util.emf.core.internal.command; - -import java.util.ArrayList; -import java.util.Collection; - -import org.eclipse.emf.common.command.Command; -import org.eclipse.emf.common.command.CompoundCommand; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.resource.Resource; -import org.eclipse.emf.facet.util.emf.core.command.ILockableUndoCommand; -import org.eclipse.emf.facet.util.emf.core.internal.Messages; - -/** - * This command has to be used to add content to a resource - */ -public class AddResourceContentCommand implements Command, ILockableUndoCommand { - - private final Collection<EObject> newContent; - private final Resource resource; - private boolean enableUndo = true; - - /** - * @param resource the resource of which we want to add the content. - * @param content a list of EObject to add as the content of the resource - */ - public AddResourceContentCommand(final Resource resource, final Collection<EObject> content) { - this.resource = resource; - this.newContent = content; - } - - public boolean canExecute() { - return true; - } - - public void execute() { - this.resource.getContents().addAll(this.newContent); - } - - public boolean canUndo() { - return this.enableUndo; - } - - public void undo() { - this.resource.getContents().removeAll(this.newContent); - } - - public void redo() { - this.resource.getContents().addAll(this.newContent); - } - - public Collection<?> getResult() { - final Collection<Resource> result = new ArrayList<Resource>(); - result.add(this.resource); - return result; - } - - public Collection<?> getAffectedObjects() { - final Collection<Object> affectedObjects = new ArrayList<Object>(); - affectedObjects.add(this.resource); - affectedObjects.addAll(this.newContent); - return affectedObjects; - } - - public String getLabel() { - return Messages.AddResourceContentCommand_Label; - } - - public String getDescription() { - return Messages.AddResourceContentCommand_Description; - } - - public void dispose() { - // do nothing - } - - public Command chain(final Command command) { - final CompoundCommand result = new CompoundCommand(); - result.append(this); - result.append(command); - return result; - } - - public void enableCanUndo(final boolean enable) { - this.enableUndo = enable; - } - -}
diff --git a/org.eclipse.modisco.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/internal/command/CommandFactoryResult.java b/org.eclipse.modisco.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/internal/command/CommandFactoryResult.java deleted file mode 100644 index b0779d0..0000000 --- a/org.eclipse.modisco.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/internal/command/CommandFactoryResult.java +++ /dev/null
@@ -1,35 +0,0 @@ -/** - * Copyright (c) 2012 Mia-Software. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Gregoire Dupe (Mia-Software) - Bug 369987 - [Restructuring][Table] Switch to the new customization and facet framework - */ -package org.eclipse.emf.facet.util.emf.core.internal.command; - -import org.eclipse.emf.common.command.Command; -import org.eclipse.emf.facet.util.emf.core.command.ICommandFactoryResult; - -public class CommandFactoryResult<T> implements ICommandFactoryResult<T> { - - private final Command cmd; - private final T result; - - public CommandFactoryResult(final Command cmd, final T result) { - this.cmd = cmd; - this.result = result; - } - - public Command getCommand() { - return this.cmd; - } - - public T getResult() { - return this.result; - } - -}
diff --git a/org.eclipse.modisco.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/internal/command/CommandFactoryResultFactory.java b/org.eclipse.modisco.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/internal/command/CommandFactoryResultFactory.java deleted file mode 100644 index f7bcaed..0000000 --- a/org.eclipse.modisco.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/internal/command/CommandFactoryResultFactory.java +++ /dev/null
@@ -1,23 +0,0 @@ -/** - * Copyright (c) 2012 Mia-Software. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Gregoire Dupe (Mia-Software) - Bug 369987 - [Restructuring][Table] Switch to the new customization and facet framework - */ -package org.eclipse.emf.facet.util.emf.core.internal.command; - -import org.eclipse.emf.common.command.Command; -import org.eclipse.emf.facet.util.emf.core.command.ICommandFactoryResult; -import org.eclipse.emf.facet.util.emf.core.command.ICommandFactoryResultFactory; - -public class CommandFactoryResultFactory implements ICommandFactoryResultFactory { - - public <T> ICommandFactoryResult<T> createCommandFactoryResult(final Command command, final T result) { - return new CommandFactoryResult<T>(command, result); - } -}
diff --git a/org.eclipse.modisco.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/internal/command/SetResourceContentCommand.java b/org.eclipse.modisco.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/internal/command/SetResourceContentCommand.java deleted file mode 100644 index 51ddc8d..0000000 --- a/org.eclipse.modisco.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/internal/command/SetResourceContentCommand.java +++ /dev/null
@@ -1,105 +0,0 @@ -/** - * Copyright (c) 2011, 2017 CEA LIST, and Soft-Maint. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Gregoire Dupe (Mia-Software) - Bug 345730 - Deleting an element in the model breaks the table - * Jonathan Pepin (Soft-Maint) - Bug 516701 - Command factory to add content to resource - */ -package org.eclipse.emf.facet.util.emf.core.internal.command; - -import java.util.ArrayList; -import java.util.Collection; - -import org.eclipse.emf.common.command.Command; -import org.eclipse.emf.common.util.EList; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.resource.Resource; -import org.eclipse.emf.facet.util.emf.core.command.ILockableUndoCommand; -import org.eclipse.emf.facet.util.emf.core.internal.Messages; - -/** - * This command has to be used to set the content of a resource - */ -public class SetResourceContentCommand implements Command, ILockableUndoCommand { - private EList<EObject> oldContent = null; - private Collection<EObject> newContent = null; - private Resource resource; - private boolean enableUndo = true; - - /** - * @param resource the resource of which we want to set the content. - * @param content a list of EObject to set as the content of the resource - */ - public SetResourceContentCommand(final Resource resource, final Collection<EObject> content) { - this.resource = resource; - this.newContent = content; - } - - public boolean canExecute() { - return true; - } - - public void execute() { - this.oldContent = this.resource.getContents(); - this.resource.getContents().clear(); - this.resource.getContents().addAll(this.newContent); - - } - - public boolean canUndo() { - boolean canUndo = (this.enableUndo && (this.oldContent != null)); - return canUndo; - } - - public void undo() { - this.resource.getContents().clear(); - this.resource.getContents().addAll(this.oldContent); - - } - - public void redo() { - this.resource.getContents().clear(); - this.resource.getContents().addAll(this.newContent); - } - - public Collection<?> getResult() { - Collection<Resource> result = new ArrayList<Resource>(); - result.add(this.resource); - return result; - } - - public Collection<?> getAffectedObjects() { - Collection<Object> affectedObjects = new ArrayList<Object>(); - affectedObjects.add(this.resource); - affectedObjects.addAll(this.newContent); - affectedObjects.addAll(this.oldContent); - return affectedObjects; - } - - public String getLabel() { - return Messages.SetResourceContentCommand_Label; - } - - public String getDescription() { - return Messages.SetResourceContentCommand_Description; - } - - public void dispose() { - this.oldContent = null; - this.newContent = null; - this.resource = null; - } - - public Command chain(final Command command) { - return null; - } - - public void enableCanUndo(final boolean enable) { - this.enableUndo = enable; - } - -}
diff --git a/org.eclipse.modisco.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/internal/exported/ICommandFactory.java b/org.eclipse.modisco.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/internal/exported/ICommandFactory.java deleted file mode 100644 index 8b096d4..0000000 --- a/org.eclipse.modisco.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/internal/exported/ICommandFactory.java +++ /dev/null
@@ -1,71 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 CEA LIST. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Nicolas Bros (Mia-Software) - initial API and implementation - * Gregoire Dupe (Mia-Software) - Bug 369987 - [Restructuring][Table] Switch to the new customization and facet framework - *******************************************************************************/ -package org.eclipse.emf.facet.util.emf.core.internal.exported; - -import org.eclipse.emf.common.command.Command; -import org.eclipse.emf.edit.command.AddCommand; -import org.eclipse.emf.edit.command.MoveCommand; -import org.eclipse.emf.edit.command.RemoveCommand; -import org.eclipse.emf.edit.command.SetCommand; -import org.eclipse.emf.edit.domain.EditingDomain; - -/** - * Creates {@link Command}s for a specific {@link EditingDomain}. - * <p> - * See also {@link ICommandFactoriesRegistry} - * - * @since 0.2 - */ -// Copied from org.eclipse.emf.facet.widgets.celleditors.ICommandFactory -public interface ICommandFactory { - /** - * Whether this command factory should be used for the given {@link EditingDomain} - */ - boolean handles(EditingDomain editingDomain); - - /** - * This creates a {@link SetCommand} to set the owner's feature to the specified value. - */ - Command createSetCommand(EditingDomain domain, Object owner, Object feature, Object value); - - /** - * This creates a {@link SetCommand} to set the owner's feature to the specified value at the - * specified index. - */ - Command createSetCommand(EditingDomain domain, Object owner, Object feature, - Object value, int index); - - /** - * This creates a {@link MoveCommand} to move a particular value to a particular index in the - * specified feature of the owner. The feature will often be <code>null</code> because the - * domain will deduce it. - */ - Command createMoveCommand(EditingDomain domain, Object owner, Object feature, Object value, - int index); - - /** - * This creates an {@link AddCommand} to add a particular value to the specified feature of the - * owner. The feature will often be <code>null</code> because the domain will deduce it. - */ - Command createAddCommand(EditingDomain domain, Object owner, Object feature, Object value); - - /** - * This creates a {@link RemoveCommand} to remove a particular value from the specified feature - * of the owner. - */ - Command createRemoveCommand(EditingDomain domain, Object owner, Object feature, Object value); - - /** This creates a command that deletes the given object. */ - Command createDeleteCommand(EditingDomain domain, Object object); - -}
diff --git a/org.eclipse.modisco.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/internal/preferences/PreferenceConstants.java b/org.eclipse.modisco.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/internal/preferences/PreferenceConstants.java deleted file mode 100644 index 7c62b2c..0000000 --- a/org.eclipse.modisco.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/internal/preferences/PreferenceConstants.java +++ /dev/null
@@ -1,26 +0,0 @@ -/** - * Copyright (c) 2011 Mia-Software. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Nicolas Guyomar (Mia-Software) - Bug 333652 Extension point offering the possibility to declare an EPackage browser - * Fabien Giquel (Mia-Software) - * Nicolas Bros (Mia-Software) - Bug 335218 - Extension point for registering EObject, EPackage, model editor - */ -package org.eclipse.emf.facet.util.emf.core.internal.preferences; - -public final class PreferenceConstants { - - private PreferenceConstants() { - // constants class: no need to instantiate - } - - public static final String P_DEFAULT_EPACKAGE_VIEWER = "emf_facet_default_epackage_viewer"; //$NON-NLS-1$ - public static final String P_DEFAULT_EOBJECT_VIEWER = "emf_facet_default_eobject_viewer"; //$NON-NLS-1$ - public static final String P_DEFAULT_RESOURCE_VIEWER = "emf_facet_default_resource_viewer"; //$NON-NLS-1$ - -}
diff --git a/org.eclipse.modisco.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/internal/preferences/PreferenceInitializer.java b/org.eclipse.modisco.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/internal/preferences/PreferenceInitializer.java deleted file mode 100644 index 7ea8549..0000000 --- a/org.eclipse.modisco.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/internal/preferences/PreferenceInitializer.java +++ /dev/null
@@ -1,54 +0,0 @@ -/** - * Copyright (c) 2011 Mia-Software. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Nicolas Guyomar (Mia-Software) - Bug 333652 Extension point offering the possibility to declare an EPackage browser - * Nicolas Bros (Mia-Software) - Bug 335218 - Extension point for registering EObject, EPackage, model editor - * Laurent Pichierri (Soft-Maint) - Bug 371204 - Compatibility with Helios - */ -package org.eclipse.emf.facet.util.emf.core.internal.preferences; - -import org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer; -import org.eclipse.core.runtime.preferences.DefaultScope; -import org.eclipse.core.runtime.preferences.IEclipsePreferences; -import org.eclipse.emf.facet.util.emf.core.IBrowserRegistry; -import org.eclipse.emf.facet.util.emf.core.IEObjectBrowserOpener; -import org.eclipse.emf.facet.util.emf.core.IEPackageBrowserOpener; -import org.eclipse.emf.facet.util.emf.core.IResourceBrowserOpener; -import org.eclipse.emf.facet.util.emf.core.internal.Activator; - -public class PreferenceInitializer extends AbstractPreferenceInitializer { - - @Override - public void initializeDefaultPreferences() { - IEclipsePreferences preferenceNode = new DefaultScope().getNode(Activator.PLUGIN_ID); - // general rule is to keep the same behavior as EMF by default - IEObjectBrowserOpener defaultEObjectBrowserOpener = IBrowserRegistry.INSTANCE - .getDefaultEObjectBrowserOpener(); - if (defaultEObjectBrowserOpener != null) { - preferenceNode.put(PreferenceConstants.P_DEFAULT_EOBJECT_VIEWER, - defaultEObjectBrowserOpener.getClass().getName()); - } - - IEPackageBrowserOpener defaultEPackageBrowserOpener = IBrowserRegistry.INSTANCE - .getDefaultEPackageBrowserOpener(); - if (defaultEPackageBrowserOpener != null) { - preferenceNode.put(PreferenceConstants.P_DEFAULT_EPACKAGE_VIEWER, - defaultEPackageBrowserOpener.getClass().getName()); - } - - IResourceBrowserOpener defaultResourceBrowserOpener = IBrowserRegistry.INSTANCE - .getDefaultResourceBrowserOpener(); - if (defaultResourceBrowserOpener != null) { - preferenceNode.put(PreferenceConstants.P_DEFAULT_RESOURCE_VIEWER, - defaultResourceBrowserOpener.getClass().getName()); - } - - } - -}
diff --git a/org.eclipse.modisco.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/internal/registry/BrowserRegistry.java b/org.eclipse.modisco.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/internal/registry/BrowserRegistry.java deleted file mode 100644 index d374819..0000000 --- a/org.eclipse.modisco.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/internal/registry/BrowserRegistry.java +++ /dev/null
@@ -1,212 +0,0 @@ -/********************************************************************************** - * Copyright (c) 2011 Mia-Software. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Nicolas Guyomar (Mia-Software) - Bug 333652 Extension point offering the possibility to declare an EPackage browser - * Nicolas Bros (Mia-Software) - Bug 335218 - Extension point for registering EObject, EPackage, model editor - * Laurent Pichierri (Soft-Maint) - Bug 371204 - Compatibility with Helios - ***********************************************************************************/ -package org.eclipse.emf.facet.util.emf.core.internal.registry; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; - -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IConfigurationElement; -import org.eclipse.core.runtime.IExtension; -import org.eclipse.core.runtime.IExtensionPoint; -import org.eclipse.core.runtime.IExtensionRegistry; -import org.eclipse.core.runtime.Platform; -import org.eclipse.core.runtime.preferences.IEclipsePreferences; -import org.eclipse.core.runtime.preferences.InstanceScope; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.EPackage; -import org.eclipse.emf.ecore.resource.Resource; -import org.eclipse.emf.facet.util.core.Logger; -import org.eclipse.emf.facet.util.emf.core.IBrowserRegistry; -import org.eclipse.emf.facet.util.emf.core.IEObjectBrowserOpener; -import org.eclipse.emf.facet.util.emf.core.IEPackageBrowserOpener; -import org.eclipse.emf.facet.util.emf.core.IResourceBrowserOpener; -import org.eclipse.emf.facet.util.emf.core.internal.Activator; -import org.eclipse.emf.facet.util.emf.core.internal.preferences.PreferenceConstants; - -/** A registry for the EObject, EPackage, and Resource browser opener extension point. */ -public class BrowserRegistry implements IBrowserRegistry { - - private static final String EXTENSION_POINT_RESOURCE_VIEWER_ELT = "resourceViewer"; //$NON-NLS-1$ - private static final String EXTENSION_POINT_EOBJECT_VIEWER_ELT = "eObjectViewer"; //$NON-NLS-1$ - private static final String EXTENSION_POINT_EPACKAGE_VIEWER_ELT = "ePackageViewer"; //$NON-NLS-1$ - private final List<IEPackageBrowserOpener> epackageBrowserOpeners; - private final List<IEObjectBrowserOpener> eobjectBrowserOpeners; - private final List<IResourceBrowserOpener> resourceBrowserOpeners; - - public static final String EXTENSION_POINT_MODEL_VIEWER_ID = "org.eclipse.emf.facet.util.emf.core.modelViewer"; //$NON-NLS-1$ - - public static final String CLASS = "class"; //$NON-NLS-1$ - - public BrowserRegistry() { - this.epackageBrowserOpeners = new ArrayList<IEPackageBrowserOpener>(); - this.eobjectBrowserOpeners = new ArrayList<IEObjectBrowserOpener>(); - this.resourceBrowserOpeners = new ArrayList<IResourceBrowserOpener>(); - - IExtensionRegistry registry = Platform.getExtensionRegistry(); - IExtensionPoint extensionPoint = registry - .getExtensionPoint(BrowserRegistry.EXTENSION_POINT_MODEL_VIEWER_ID); - if (extensionPoint != null) { - for (IExtension ext : extensionPoint.getExtensions()) { - for (IConfigurationElement configElt : ext.getConfigurationElements()) { - - String kind = configElt.getName(); - String classID = configElt.getAttribute(BrowserRegistry.CLASS); - try { - if (classID != null) { - if (kind.equals(BrowserRegistry.EXTENSION_POINT_EPACKAGE_VIEWER_ELT)) { - this.epackageBrowserOpeners.add((IEPackageBrowserOpener) configElt - .createExecutableExtension(BrowserRegistry.CLASS)); - } else if (kind - .equals(BrowserRegistry.EXTENSION_POINT_EOBJECT_VIEWER_ELT)) { - this.eobjectBrowserOpeners.add((IEObjectBrowserOpener) configElt - .createExecutableExtension(BrowserRegistry.CLASS)); - } else if (kind - .equals(BrowserRegistry.EXTENSION_POINT_RESOURCE_VIEWER_ELT)) { - this.resourceBrowserOpeners.add((IResourceBrowserOpener) configElt - .createExecutableExtension(BrowserRegistry.CLASS)); - } - } - } catch (CoreException e) { - Logger.logError(e, Activator.getDefault()); - } - } - } - } else { - Logger.logError( - "Extension point not found: " + BrowserRegistry.EXTENSION_POINT_MODEL_VIEWER_ID, //$NON-NLS-1$ - Activator.getDefault()); - } - } - - public void browseEPackage(final EPackage ePackage) { - if (ePackage == null) { - throw new IllegalArgumentException(); - } - IEPackageBrowserOpener opener = getDefaultEPackageBrowserOpener(); - if (opener != null) { - opener.openEPackage(ePackage); - } else { - Logger.logWarning( - "No epackage browser opener is registered to open ePackage " + ePackage.getNsURI(), Activator.getDefault()); //$NON-NLS-1$ - } - } - - public void browseResource(final Resource resource) { - if (resource == null) { - throw new IllegalArgumentException(); - } - IResourceBrowserOpener opener = getDefaultResourceBrowserOpener(); - if (opener != null) { - opener.openResource(resource); - } else { - Logger.logWarning( - "No resource browser opener is registered to open " + resource.getURI(), Activator.getDefault()); //$NON-NLS-1$ - } - } - - public void browseEObject(final EObject eObject) { - if (eObject == null) { - throw new IllegalArgumentException(); - } - IEObjectBrowserOpener opener = getDefaultEObjectBrowserOpener(); - if (opener != null) { - opener.openEObject(eObject); - } else { - Logger.logWarning( - "No eobject browser opener is registered to open " + eObject.toString(), Activator.getDefault()); //$NON-NLS-1$ - } - } - - public List<IEPackageBrowserOpener> getAllRegisteredEPackageBrowsers() { - return Collections.unmodifiableList(this.epackageBrowserOpeners); - } - - public List<IEObjectBrowserOpener> getAllRegisteredEObjectBrowsers() { - return Collections.unmodifiableList(this.eobjectBrowserOpeners); - } - - public List<IResourceBrowserOpener> getAllRegisteredResourceBrowsers() { - return Collections.unmodifiableList(this.resourceBrowserOpeners); - } - - /** - * @return the default EPackage browser opener, can be null - */ - public IEPackageBrowserOpener getDefaultEPackageBrowserOpener() { - IEclipsePreferences preferenceNode = new InstanceScope().getNode(Activator.PLUGIN_ID); - String className = preferenceNode.get(PreferenceConstants.P_DEFAULT_EPACKAGE_VIEWER, null); - if (className != null) { - for (IEPackageBrowserOpener ePackageBrowserFactory : this.epackageBrowserOpeners) { - if (ePackageBrowserFactory.getClass().getName().equals(className)) { - return ePackageBrowserFactory; - } - } - } - // By default return the first editor registered through the extension - // point org.eclipse.emf.facet.util.emf.core.modelViewer - if (!this.epackageBrowserOpeners.isEmpty()) { - return this.epackageBrowserOpeners.get(0); - } - - return null; - - } - - /** - * @return the default EObject browser opener, can be null - */ - public IEObjectBrowserOpener getDefaultEObjectBrowserOpener() { - IEclipsePreferences preferenceNode = new InstanceScope().getNode(Activator.PLUGIN_ID); - String className = preferenceNode.get(PreferenceConstants.P_DEFAULT_EOBJECT_VIEWER, null); - if (className != null) { - for (IEObjectBrowserOpener eObjectBrowserFactory : this.eobjectBrowserOpeners) { - if (eObjectBrowserFactory.getClass().getName().equals(className)) { - return eObjectBrowserFactory; - } - } - } - // By default return the first editor registered through the extension - // point org.eclipse.emf.facet.util.emf.core.modelViewer - if (!this.eobjectBrowserOpeners.isEmpty()) { - return this.eobjectBrowserOpeners.get(0); - } - - return null; - - } - - /** - * @return the default Resource browser opener, can be <code>null</code> - */ - public IResourceBrowserOpener getDefaultResourceBrowserOpener() { - IEclipsePreferences preferenceNode = new InstanceScope().getNode(Activator.PLUGIN_ID); - String className = preferenceNode.get(PreferenceConstants.P_DEFAULT_RESOURCE_VIEWER, null); - if (className != null) { - for (IResourceBrowserOpener resourceBrowserOpener : this.resourceBrowserOpeners) { - if (resourceBrowserOpener.getClass().getName().equals(className)) { - return resourceBrowserOpener; - } - } - } - // By default return the first editor registered through the extension - // point org.eclipse.emf.facet.util.emf.core.modelViewer - if (!this.resourceBrowserOpeners.isEmpty()) { - return this.resourceBrowserOpeners.get(0); - } - - return null; - } - -}
diff --git a/org.eclipse.modisco.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/internal/serialization/SerializationRegistry.java b/org.eclipse.modisco.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/internal/serialization/SerializationRegistry.java deleted file mode 100644 index 9a73c5c..0000000 --- a/org.eclipse.modisco.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/internal/serialization/SerializationRegistry.java +++ /dev/null
@@ -1,133 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2011 Mia-Software. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Nicolas Bros (Mia-Software) - initial API and implementation - * Laurent Pichierri (Soft-Maint) - Bug 371204 - Compatibility with Helios - *******************************************************************************/ -package org.eclipse.emf.facet.util.emf.core.internal.serialization; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; - -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IConfigurationElement; -//import org.eclipse.emf.facet.infra.common.core.internal.extensions.AbstractRegistry; -import org.eclipse.emf.facet.util.core.Logger; -import org.eclipse.emf.facet.util.core.internal.exported.AbstractRegistry; -import org.eclipse.emf.facet.util.emf.core.internal.Activator; -import org.eclipse.emf.facet.util.emf.core.serialization.ISerializationRegistry; -import org.eclipse.emf.facet.util.emf.core.serialization.ISerializer; - -/** Registry for the "serialization" extension point */ -public class SerializationRegistry extends AbstractRegistry implements ISerializationRegistry { - - private static final String EXTENSION_POINT_NAMESPACE = "org.eclipse.emf.facet.util.emf.core"; //$NON-NLS-1$ - private static final String EXTENSION_POINT_NAME = "serialization"; //$NON-NLS-1$ - - private static final String SERIALIZER_ELEMENT = "serializer"; //$NON-NLS-1$ - private static final String CLASS_ATTRIBUTE = "class"; //$NON-NLS-1$ - - private static SerializationRegistry instance = null; - - private final List<ISerializer<?>> serializers = new ArrayList<ISerializer<?>>(); - - public static SerializationRegistry getInstance() { - if (SerializationRegistry.instance == null) { - SerializationRegistry.instance = new SerializationRegistry(); - } - return SerializationRegistry.instance; - } - - public SerializationRegistry() { - initialize(); - } - - public List<ISerializer<?>> getSerializers() { - return Collections.unmodifiableList(this.serializers); - } - - public ISerializer<?> getSerializerFor(final Class<?> type) { - for (ISerializer<?> serializer : this.serializers) { - if (serializer.getType().isAssignableFrom(type)) { - return serializer; - } - } - return null; - } - - public ISerializer<?> getSerializerFor(final String type) { - for (ISerializer<?> serializer : this.serializers) { - if (serializer.getType().getName().equals(type)) { - return serializer; - } - } - return null; - } - - @Override - protected String getExtensionPointName() { - return SerializationRegistry.EXTENSION_POINT_NAME; - } - - @Override - protected String getExtensionPointNamespace() { - return SerializationRegistry.EXTENSION_POINT_NAMESPACE; - } - - @Override - protected void handleRootElement(final IConfigurationElement configurationElement) { - final String name = configurationElement.getName(); - if (name.equalsIgnoreCase(SerializationRegistry.SERIALIZER_ELEMENT)) { - readSerializerElement(configurationElement); - } else { - logUnknownElement(configurationElement); - } - } - - /** Read a 'serializer' element */ - private void readSerializerElement(final IConfigurationElement configurationElement) { - Object object; - try { - object = configurationElement - .createExecutableExtension(SerializationRegistry.CLASS_ATTRIBUTE); - } catch (CoreException e) { - Logger.logError(e, Activator.getDefault()); - return; - } - if (object == null) { - logMissingAttribute(configurationElement, SerializationRegistry.CLASS_ATTRIBUTE); - return; - } - - if (object instanceof ISerializer<?>) { - ISerializer<?> serializer = (ISerializer<?>) object; - ISerializer<?> existingSerializer = getSerializerFor(serializer.getType()); - if (existingSerializer != null) { - logError( - configurationElement, - "Several serializers are provided for the type: " + serializer.getType().getName() + ". Only the first one will be used."); //$NON-NLS-1$ //$NON-NLS-2$ - - // always take the first one in the alphabetical order => determinism to avoid - // trying to serialize with one implementation and deserialize with an incompatible - // implementation - if (serializer.getClass().getName() - .compareTo(existingSerializer.getClass().getName()) < 0) { - // replace the already registered serializer by this one - this.serializers.remove(existingSerializer); - } else { - return; - } - } - this.serializers.add(serializer); - } else { - logError(configurationElement, - "class must implement " + ISerializer.class.getSimpleName()); //$NON-NLS-1$ - } - } -} \ No newline at end of file
diff --git a/org.eclipse.modisco.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/internal/serialization/SerializationService.java b/org.eclipse.modisco.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/internal/serialization/SerializationService.java deleted file mode 100644 index f6cc050..0000000 --- a/org.eclipse.modisco.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/internal/serialization/SerializationService.java +++ /dev/null
@@ -1,66 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2011 Mia-Software. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Nicolas Bros (Mia-Software) - initial API and implementation - * Nicolas Bros (Mia-Software) - Bug 338907 - expose serialization services from SerializationFactoryImpl - *******************************************************************************/ -package org.eclipse.emf.facet.util.emf.core.internal.serialization; - -import org.eclipse.emf.facet.util.core.Logger; -import org.eclipse.emf.facet.util.emf.core.internal.Activator; -import org.eclipse.emf.facet.util.emf.core.serialization.ISerializationRegistry; -import org.eclipse.emf.facet.util.emf.core.serialization.ISerializationService; -import org.eclipse.emf.facet.util.emf.core.serialization.ISerializer; - -public class SerializationService implements ISerializationService { - - public String serialize(final Object instanceValue) { - if (instanceValue == null) { - return "null"; //$NON-NLS-1$ - } - - ISerializer<Object> serializer = (ISerializer<Object>) ISerializationRegistry.INSTANCE - .getSerializerFor(instanceValue.getClass()); - if (serializer != null) { - return serializer.getType().getName() + ":" //$NON-NLS-1$ - + serializer.serialize(instanceValue); - } - - Logger.logError("serialization of type " + instanceValue.getClass().getName() //$NON-NLS-1$ - + " is not implemented.", Activator.getDefault()); //$NON-NLS-1$ - return "null"; //$NON-NLS-1$ - } - - public Object deserialize(final String serializedValue) { - try { - if ("null".equals(serializedValue)) { //$NON-NLS-1$ - return null; - } - - int colonPos = serializedValue.indexOf(':'); - if (colonPos == -1) { - throw new IllegalArgumentException("invalid serialization format"); //$NON-NLS-1$ - } - String type = serializedValue.substring(0, colonPos); - String strValue = serializedValue.substring(colonPos + 1); - - ISerializer<?> serializer = ISerializationRegistry.INSTANCE.getSerializerFor(type); - if (serializer != null) { - Object value = serializer.deserialize(strValue); - return value; - } - - Logger.logError("deserialization of type " + type //$NON-NLS-1$ - + " is not implemented.", Activator.getDefault()); //$NON-NLS-1$ - } catch (Exception e) { - Logger.logError(e, "Error deserializing: " + serializedValue, //$NON-NLS-1$ - Activator.getDefault()); - } - return null; - } -}
diff --git a/org.eclipse.modisco.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/internal/serialization/serializers/BooleanSerializer.java b/org.eclipse.modisco.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/internal/serialization/serializers/BooleanSerializer.java deleted file mode 100644 index 8da4291..0000000 --- a/org.eclipse.modisco.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/internal/serialization/serializers/BooleanSerializer.java +++ /dev/null
@@ -1,32 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2011 Mia-Software. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Nicolas Bros (Mia-Software) - initial API and implementation - *******************************************************************************/ -package org.eclipse.emf.facet.util.emf.core.internal.serialization.serializers; - -import org.eclipse.emf.facet.util.emf.core.serialization.ISerializer; - -public class BooleanSerializer implements ISerializer<Boolean> { - - public BooleanSerializer() { - // - } - - public Class<Boolean> getType() { - return Boolean.class; - } - - public String serialize(final Boolean value) { - return value.toString(); - } - - public Boolean deserialize(final String serializedValue) { - return Boolean.valueOf(serializedValue); - } -}
diff --git a/org.eclipse.modisco.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/internal/serialization/serializers/EMFURISerializer.java b/org.eclipse.modisco.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/internal/serialization/serializers/EMFURISerializer.java deleted file mode 100644 index 9379a66..0000000 --- a/org.eclipse.modisco.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/internal/serialization/serializers/EMFURISerializer.java +++ /dev/null
@@ -1,33 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2011 Mia-Software. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Nicolas Bros (Mia-Software) - initial API and implementation - *******************************************************************************/ -package org.eclipse.emf.facet.util.emf.core.internal.serialization.serializers; - -import org.eclipse.emf.common.util.URI; -import org.eclipse.emf.facet.util.emf.core.serialization.ISerializer; - -public class EMFURISerializer implements ISerializer<URI> { - - public EMFURISerializer() { - // - } - - public Class<URI> getType() { - return URI.class; - } - - public String serialize(final URI value) { - return value.toString(); - } - - public URI deserialize(final String serializedValue) { - return URI.createURI(serializedValue); - } -}
diff --git a/org.eclipse.modisco.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/internal/serialization/serializers/IResourceSerializer.java b/org.eclipse.modisco.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/internal/serialization/serializers/IResourceSerializer.java deleted file mode 100644 index b7c1db1..0000000 --- a/org.eclipse.modisco.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/internal/serialization/serializers/IResourceSerializer.java +++ /dev/null
@@ -1,34 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2011 Mia-Software. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Nicolas Bros (Mia-Software) - initial API and implementation - *******************************************************************************/ -package org.eclipse.emf.facet.util.emf.core.internal.serialization.serializers; - -import org.eclipse.core.resources.IResource; -import org.eclipse.core.resources.ResourcesPlugin; -import org.eclipse.emf.facet.util.emf.core.serialization.ISerializer; - -public class IResourceSerializer implements ISerializer<IResource> { - - public IResourceSerializer() { - // - } - - public Class<IResource> getType() { - return IResource.class; - } - - public String serialize(final IResource value) { - return value.getFullPath().toPortableString(); - } - - public IResource deserialize(final String serializedValue) { - return ResourcesPlugin.getWorkspace().getRoot().findMember(serializedValue); - } -}
diff --git a/org.eclipse.modisco.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/internal/serialization/serializers/IntegerSerializer.java b/org.eclipse.modisco.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/internal/serialization/serializers/IntegerSerializer.java deleted file mode 100644 index 30fd069..0000000 --- a/org.eclipse.modisco.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/internal/serialization/serializers/IntegerSerializer.java +++ /dev/null
@@ -1,32 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2011 Mia-Software. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Nicolas Bros (Mia-Software) - initial API and implementation - *******************************************************************************/ -package org.eclipse.emf.facet.util.emf.core.internal.serialization.serializers; - -import org.eclipse.emf.facet.util.emf.core.serialization.ISerializer; - -public class IntegerSerializer implements ISerializer<Integer> { - - public IntegerSerializer() { - // - } - - public Class<Integer> getType() { - return Integer.class; - } - - public String serialize(final Integer value) { - return value.toString(); - } - - public Integer deserialize(final String serializedValue) { - return Integer.valueOf(serializedValue); - } -}
diff --git a/org.eclipse.modisco.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/internal/serialization/serializers/StringSerializer.java b/org.eclipse.modisco.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/internal/serialization/serializers/StringSerializer.java deleted file mode 100644 index 5861790..0000000 --- a/org.eclipse.modisco.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/internal/serialization/serializers/StringSerializer.java +++ /dev/null
@@ -1,32 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2011 Mia-Software. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Nicolas Bros (Mia-Software) - initial API and implementation - *******************************************************************************/ -package org.eclipse.emf.facet.util.emf.core.internal.serialization.serializers; - -import org.eclipse.emf.facet.util.emf.core.serialization.ISerializer; - -public class StringSerializer implements ISerializer<String> { - - public StringSerializer() { - // - } - - public Class<String> getType() { - return String.class; - } - - public String serialize(final String value) { - return value; - } - - public String deserialize(final String serializedValue) { - return serializedValue; - } -}
diff --git a/org.eclipse.modisco.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/serialization/ISerializationRegistry.java b/org.eclipse.modisco.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/serialization/ISerializationRegistry.java deleted file mode 100644 index 05617b7..0000000 --- a/org.eclipse.modisco.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/serialization/ISerializationRegistry.java +++ /dev/null
@@ -1,39 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2011 Mia-Software. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Nicolas Bros (Mia-Software) - initial API and implementation - *******************************************************************************/ -package org.eclipse.emf.facet.util.emf.core.serialization; - -import java.util.List; - -import org.eclipse.emf.facet.util.emf.core.internal.serialization.SerializationRegistry; - -/** - * The registry of {@link ISerializer}s per type. - * @noimplement This interface is not intended to be implemented by clients. - * @noextend This interface is not intended to be extended by clients. - */ -public interface ISerializationRegistry { - public static ISerializationRegistry INSTANCE = new SerializationRegistry(); - - /** Get all the serializers . */ - List<ISerializer<?>> getSerializers(); - - /** - * @return the serializer for the given type, or <code>null</code> if none has been registered. - * Also returns serializers for super-types of <code>type</code>. - */ - ISerializer<?> getSerializerFor(Class<?> type); - - /** - * @return the serializer for the given type qualified name, or <code>null</code> if none has - * been registered. Does not return serializers for super-types of <code>type</code>. - */ - ISerializer<?> getSerializerFor(String type); -}
diff --git a/org.eclipse.modisco.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/serialization/ISerializationService.java b/org.eclipse.modisco.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/serialization/ISerializationService.java deleted file mode 100644 index 90d21f0..0000000 --- a/org.eclipse.modisco.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/serialization/ISerializationService.java +++ /dev/null
@@ -1,31 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2011 Mia-Software. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Nicolas Bros (Mia-Software) - initial API and implementation - * Nicolas Bros (Mia-Software) - Bug 338907 - expose serialization services from SerializationFactoryImpl - *******************************************************************************/ -package org.eclipse.emf.facet.util.emf.core.serialization; - -import org.eclipse.emf.facet.util.emf.core.internal.serialization.SerializationService; - -/** - * Provides a serialization service so that the following is true:<br/> - * <code>deserialize(serialize(object)) == object</code> - * @noimplement This interface is not intended to be implemented by clients. - * @noextend This interface is not intended to be extended by clients. - */ -public interface ISerializationService { - - public ISerializationService INSTANCE = new SerializationService(); - - /** Serialize the given value. */ - String serialize(Object instanceValue); - - /** Deserialize the given string back into the value. */ - Object deserialize(String serializedValue); -}
diff --git a/org.eclipse.modisco.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/serialization/ISerializer.java b/org.eclipse.modisco.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/serialization/ISerializer.java deleted file mode 100644 index bf69f05..0000000 --- a/org.eclipse.modisco.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/serialization/ISerializer.java +++ /dev/null
@@ -1,34 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2011 Mia-Software. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Nicolas Bros (Mia-Software) - initial API and implementation - *******************************************************************************/ -package org.eclipse.emf.facet.util.emf.core.serialization; - -/** - * The interface that must be implemented when adding an extension to the "serializer" extension - * point. - * - * @see ISerializationRegistry - */ -// note: the serializer has to return the {@link Class} object instead of a qualified name -// because that's the one that has it on its bundle classpath. -public interface ISerializer<T> { - - /** @return the type handled by this serializer. */ - Class<T> getType(); - - /** Serialize the given value into a String */ - String serialize(T value); - - /** - * Deserialize the given String back into the original value that was serialized with - * {@link ISerializer#serialize(Object)} - */ - T deserialize(String serializedValue); -}
diff --git a/org.eclipse.modisco.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/serialization/model/serialization/SerializationFactory.java b/org.eclipse.modisco.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/serialization/model/serialization/SerializationFactory.java deleted file mode 100644 index 797d6e5..0000000 --- a/org.eclipse.modisco.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/serialization/model/serialization/SerializationFactory.java +++ /dev/null
@@ -1,41 +0,0 @@ -/** - * Copyright (c) 2011 Mia-Software. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Nicolas Bros (Mia-Software) - initial API and implementation - */ -package org.eclipse.emf.facet.util.emf.core.serialization.model.serialization; - -import org.eclipse.emf.ecore.EFactory; - -/** - * <!-- begin-user-doc --> - * The <b>Factory</b> for the model. - * It provides a create method for each non-abstract class of the model. - * <!-- end-user-doc --> - * @see org.eclipse.emf.facet.util.emf.core.serialization.model.serialization.SerializationPackage - * @generated - */ -public interface SerializationFactory extends EFactory { - /** - * The singleton instance of the factory. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - SerializationFactory eINSTANCE = org.eclipse.emf.facet.util.emf.core.serialization.model.serialization.impl.SerializationFactoryImpl.init(); - - /** - * Returns the package supported by this factory. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the package supported by this factory. - * @generated - */ - SerializationPackage getSerializationPackage(); - -} //SerializationFactory
diff --git a/org.eclipse.modisco.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/serialization/model/serialization/SerializationPackage.java b/org.eclipse.modisco.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/serialization/model/serialization/SerializationPackage.java deleted file mode 100644 index 377b694..0000000 --- a/org.eclipse.modisco.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/serialization/model/serialization/SerializationPackage.java +++ /dev/null
@@ -1,121 +0,0 @@ -/** - * Copyright (c) 2011 Mia-Software. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Nicolas Bros (Mia-Software) - initial API and implementation - */ -package org.eclipse.emf.facet.util.emf.core.serialization.model.serialization; - -import org.eclipse.emf.ecore.EDataType; -import org.eclipse.emf.ecore.EPackage; - -/** - * <!-- begin-user-doc --> - * The <b>Package</b> for the model. - * It contains accessors for the meta objects to represent - * <ul> - * <li>each class,</li> - * <li>each feature of each class,</li> - * <li>each enum,</li> - * <li>and each data type</li> - * </ul> - * <!-- end-user-doc --> - * @see org.eclipse.emf.facet.util.emf.core.serialization.model.serialization.SerializationFactory - * @model kind="package" - * @generated - */ -@SuppressWarnings("all") -public interface SerializationPackage extends EPackage { - /** - * The package name. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - String eNAME = "serialization"; //$NON-NLS-1$ - - /** - * The package namespace URI. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - String eNS_URI = "http://www.eclipse.org/emf/facet/serialization/0.1.incubation"; //$NON-NLS-1$ - - /** - * The package namespace name. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - String eNS_PREFIX = "serialization"; //$NON-NLS-1$ - - /** - * The singleton instance of the package. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - SerializationPackage eINSTANCE = org.eclipse.emf.facet.util.emf.core.serialization.model.serialization.impl.SerializationPackageImpl.init(); - - /** - * The meta object id for the '<em>Extensible Serializable Java Object</em>' data type. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see java.lang.Object - * @see org.eclipse.emf.facet.util.emf.core.serialization.model.serialization.impl.SerializationPackageImpl#getExtensibleSerializableJavaObject() - * @generated - */ - int EXTENSIBLE_SERIALIZABLE_JAVA_OBJECT = 0; - - - /** - * Returns the meta object for data type '{@link java.lang.Object <em>Extensible Serializable Java Object</em>}'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the meta object for data type '<em>Extensible Serializable Java Object</em>'. - * @see java.lang.Object - * @model instanceClass="java.lang.Object" - * @generated - */ - EDataType getExtensibleSerializableJavaObject(); - - /** - * Returns the factory that creates the instances of the model. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the factory that creates the instances of the model. - * @generated - */ - SerializationFactory getSerializationFactory(); - - /** - * <!-- begin-user-doc --> - * Defines literals for the meta objects that represent - * <ul> - * <li>each class,</li> - * <li>each feature of each class,</li> - * <li>each enum,</li> - * <li>and each data type</li> - * </ul> - * <!-- end-user-doc --> - * @generated - */ - interface Literals { - /** - * The meta object literal for the '<em>Extensible Serializable Java Object</em>' data type. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see java.lang.Object - * @see org.eclipse.emf.facet.util.emf.core.serialization.model.serialization.impl.SerializationPackageImpl#getExtensibleSerializableJavaObject() - * @generated - */ - EDataType EXTENSIBLE_SERIALIZABLE_JAVA_OBJECT = SerializationPackage.eINSTANCE.getExtensibleSerializableJavaObject(); - - } - -} //SerializationPackage
diff --git a/org.eclipse.modisco.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/serialization/model/serialization/impl/SerializationFactoryImpl.java b/org.eclipse.modisco.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/serialization/model/serialization/impl/SerializationFactoryImpl.java deleted file mode 100644 index 74a70b2..0000000 --- a/org.eclipse.modisco.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/serialization/model/serialization/impl/SerializationFactoryImpl.java +++ /dev/null
@@ -1,151 +0,0 @@ -/** - * Copyright (c) 2011 Mia-Software. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Nicolas Bros (Mia-Software) - initial API and implementation - * Nicolas Bros (Mia-Software) - Bug 338907 - expose serialization services from SerializationFactoryImpl - */ -package org.eclipse.emf.facet.util.emf.core.serialization.model.serialization.impl; - -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.ecore.EDataType; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.EPackage; -import org.eclipse.emf.ecore.impl.EFactoryImpl; -import org.eclipse.emf.ecore.plugin.EcorePlugin; -import org.eclipse.emf.facet.util.emf.core.serialization.ISerializationService; -import org.eclipse.emf.facet.util.emf.core.serialization.model.serialization.SerializationFactory; -import org.eclipse.emf.facet.util.emf.core.serialization.model.serialization.SerializationPackage; - -/** - * <!-- begin-user-doc --> An implementation of the model <b>Factory</b>. <!-- end-user-doc --> - * - * @generated - */ -public class SerializationFactoryImpl extends EFactoryImpl implements SerializationFactory { - /** - * Creates the default factory implementation. <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - public static SerializationFactory init() { - try { - SerializationFactory theSerializationFactory = (SerializationFactory) EPackage.Registry.INSTANCE - .getEFactory("http://www.eclipse.org/emf/facet/serialization/0.1.incubation"); //$NON-NLS-1$ - if (theSerializationFactory != null) { - return theSerializationFactory; - } - } catch (Exception exception) { - EcorePlugin.INSTANCE.log(exception); - } - return new SerializationFactoryImpl(); - } - - /** - * Creates an instance of the factory. <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - public SerializationFactoryImpl() { - super(); - } - - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - @Override - public EObject create(final EClass eClass) { - switch (eClass.getClassifierID()) { - default: - throw new IllegalArgumentException( - "The class '" + eClass.getName() + "' is not a valid classifier"); //$NON-NLS-1$ //$NON-NLS-2$ - } - } - - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - @Override - public Object createFromString(final EDataType eDataType, final String initialValue) { - switch (eDataType.getClassifierID()) { - case SerializationPackage.EXTENSIBLE_SERIALIZABLE_JAVA_OBJECT: - return createExtensibleSerializableJavaObjectFromString(eDataType, initialValue); - default: - throw new IllegalArgumentException( - "The datatype '" + eDataType.getName() + "' is not a valid classifier"); //$NON-NLS-1$ //$NON-NLS-2$ - } - } - - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - @Override - public String convertToString(final EDataType eDataType, final Object instanceValue) { - switch (eDataType.getClassifierID()) { - case SerializationPackage.EXTENSIBLE_SERIALIZABLE_JAVA_OBJECT: - return convertExtensibleSerializableJavaObjectToString(eDataType, instanceValue); - default: - throw new IllegalArgumentException( - "The datatype '" + eDataType.getName() + "' is not a valid classifier"); //$NON-NLS-1$ //$NON-NLS-2$ - } - } - - /** - * <!-- begin-user-doc --> Deserializes a value. - * - * @param eDataType - * the datatype - * @param initialValue - * the serialized value to deserialize <!-- end-user-doc --> - * @generated NOT - */ - public static Object createExtensibleSerializableJavaObjectFromString( - final EDataType eDataType, final String initialValue) { - return ISerializationService.INSTANCE.deserialize(initialValue); - } - - /** - * <!-- begin-user-doc --> Serializes a value. - * - * @param eDataType - * the datatype - * @param instanceValue - * the value to serialize <!-- end-user-doc --> - * @generated NOT - */ - public static String convertExtensibleSerializableJavaObjectToString(final EDataType eDataType, - final Object instanceValue) { - return ISerializationService.INSTANCE.serialize(instanceValue); - } - - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - public SerializationPackage getSerializationPackage() { - return (SerializationPackage) getEPackage(); - } - - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @deprecated - * @generated - */ - @Deprecated - public static SerializationPackage getPackage() { - return SerializationPackage.eINSTANCE; - } - -} // SerializationFactoryImpl
diff --git a/org.eclipse.modisco.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/serialization/model/serialization/impl/SerializationPackageImpl.java b/org.eclipse.modisco.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/serialization/model/serialization/impl/SerializationPackageImpl.java deleted file mode 100644 index 3e10c2d..0000000 --- a/org.eclipse.modisco.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/serialization/model/serialization/impl/SerializationPackageImpl.java +++ /dev/null
@@ -1,170 +0,0 @@ -/** - * Copyright (c) 2011 Mia-Software. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Nicolas Bros (Mia-Software) - initial API and implementation - */ -package org.eclipse.emf.facet.util.emf.core.serialization.model.serialization.impl; - -import org.eclipse.emf.ecore.EDataType; -import org.eclipse.emf.ecore.EPackage; -import org.eclipse.emf.ecore.impl.EPackageImpl; -import org.eclipse.emf.facet.util.emf.core.serialization.model.serialization.SerializationFactory; -import org.eclipse.emf.facet.util.emf.core.serialization.model.serialization.SerializationPackage; - -/** - * <!-- begin-user-doc --> - * An implementation of the model <b>Package</b>. - * <!-- end-user-doc --> - * @generated - */ -public class SerializationPackageImpl extends EPackageImpl implements SerializationPackage { - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - private EDataType extensibleSerializableJavaObjectEDataType = null; - - /** - * Creates an instance of the model <b>Package</b>, registered with - * {@link org.eclipse.emf.ecore.EPackage.Registry EPackage.Registry} by the package - * package URI value. - * <p>Note: the correct way to create the package is via the static - * factory method {@link #init init()}, which also performs - * initialization of the package, or returns the registered package, - * if one already exists. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see org.eclipse.emf.ecore.EPackage.Registry - * @see org.eclipse.emf.facet.util.emf.core.serialization.model.serialization.SerializationPackage#eNS_URI - * @see #init() - * @generated - */ - private SerializationPackageImpl() { - super(SerializationPackage.eNS_URI, SerializationFactory.eINSTANCE); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - private static boolean isInited = false; - - /** - * Creates, registers, and initializes the <b>Package</b> for this model, and for any others upon which it depends. - * - * <p>This method is used to initialize {@link SerializationPackage#eINSTANCE} when that field is accessed. - * Clients should not invoke it directly. Instead, they should simply access that field to obtain the package. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #eNS_URI - * @see #createPackageContents() - * @see #initializePackageContents() - * @generated - */ - public static SerializationPackage init() { - if (SerializationPackageImpl.isInited) { - return (SerializationPackage)EPackage.Registry.INSTANCE.getEPackage(SerializationPackage.eNS_URI); - } - - // Obtain or create and register package - SerializationPackageImpl theSerializationPackage = (SerializationPackageImpl)(EPackage.Registry.INSTANCE.get(SerializationPackage.eNS_URI) instanceof SerializationPackageImpl ? EPackage.Registry.INSTANCE.get(SerializationPackage.eNS_URI) : new SerializationPackageImpl()); - - SerializationPackageImpl.isInited = true; - - // Create package meta-data objects - theSerializationPackage.createPackageContents(); - - // Initialize created meta-data - theSerializationPackage.initializePackageContents(); - - // Mark meta-data to indicate it can't be changed - theSerializationPackage.freeze(); - - - // Update the registry and return the package - EPackage.Registry.INSTANCE.put(SerializationPackage.eNS_URI, theSerializationPackage); - return theSerializationPackage; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EDataType getExtensibleSerializableJavaObject() { - return this.extensibleSerializableJavaObjectEDataType; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public SerializationFactory getSerializationFactory() { - return (SerializationFactory)getEFactoryInstance(); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - private boolean isCreated = false; - - /** - * Creates the meta-model objects for the package. This method is - * guarded to have no affect on any invocation but its first. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public void createPackageContents() { - if (this.isCreated) { - return; - } - this.isCreated = true; - - // Create data types - this.extensibleSerializableJavaObjectEDataType = createEDataType(SerializationPackage.EXTENSIBLE_SERIALIZABLE_JAVA_OBJECT); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - private boolean isInitialized = false; - - /** - * Complete the initialization of the package and its meta-model. This - * method is guarded to have no affect on any invocation but its first. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public void initializePackageContents() { - if (this.isInitialized) { - return; - } - this.isInitialized = true; - - // Initialize package - setName(SerializationPackage.eNAME); - setNsPrefix(SerializationPackage.eNS_PREFIX); - setNsURI(SerializationPackage.eNS_URI); - - // Initialize data types - initEDataType(this.extensibleSerializableJavaObjectEDataType, Object.class, "ExtensibleSerializableJavaObject", EPackageImpl.IS_SERIALIZABLE, !EPackageImpl.IS_GENERATED_INSTANCE_CLASS); //$NON-NLS-1$ - - // Create resource - createResource(SerializationPackage.eNS_URI); - } - -} //SerializationPackageImpl
diff --git a/org.eclipse.modisco.facet.util.emf.core/src/org/eclipse/modisco/facet/util/emf/core/CommandFactory.java b/org.eclipse.modisco.facet.util.emf.core/src/org/eclipse/modisco/facet/util/emf/core/CommandFactory.java new file mode 100644 index 0000000..df4fa36 --- /dev/null +++ b/org.eclipse.modisco.facet.util.emf.core/src/org/eclipse/modisco/facet/util/emf/core/CommandFactory.java
@@ -0,0 +1,80 @@ +/** + * Copyright (c) 2011, 2017 CEA LIST, and Soft-Maint. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Gregoire Dupe (Mia-Software) - Bug 345730 - Deleting an element in the model breaks the table + * Jonathan Pepin (Soft-Maint) - Bug 516701 - Command factory to add content to resource + */ +package org.eclipse.modisco.facet.util.emf.core; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.List; + +import org.eclipse.emf.common.command.Command; +import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.ecore.resource.Resource; +import org.eclipse.modisco.facet.util.emf.core.internal.command.AddResourceContentCommand; +import org.eclipse.modisco.facet.util.emf.core.internal.command.SetResourceContentCommand; + +public final class CommandFactory { + + private CommandFactory() { + //Must not be called + } + + /** + * This method creates a command to set a collection of element to a resource + * @param resource the resource to set + * @param content a collection of EObject to set as the content of the resource. + * @return an EMF Command + */ + public static Command createSetResourceContentsCommand(final Resource resource, + final Collection<EObject> content) { + Command result = new SetResourceContentCommand(resource, content); + return result; + } + + /** + * This method creates a command to set an EObject to a resource + * @param resource the resource to set + * @param eObject an EObject to set as the content of the resource. + * @return an EMF Command + */ + public static Command createSetResourceContentsCommand(final Resource resource, + final EObject eObject) { + List<EObject> content = new ArrayList<EObject>(); + content.add(eObject); + Command result = createSetResourceContentsCommand(resource, content); + return result; + } + + /** + * This method creates a command to add a collection of element to a resource + * @param resource the resource to add + * @param content a collection of EObject to add to the content of the resource. + * @return an EMF Command + */ + public static Command createAddResourceContentsCommand(final Resource resource, + final Collection<EObject> content) { + return new AddResourceContentCommand(resource, content); + } + + /** + * This method creates a command to add an EObject to a resource + * @param resource the resource to add + * @param eObject an EObject to add to the content of the resource. + * @return an EMF Command + */ + public static Command createAddResourceContentsCommand(final Resource resource, + final EObject eObject) { + final List<EObject> content = new ArrayList<EObject>(); + content.add(eObject); + return createAddResourceContentsCommand(resource, content); + } + +}
diff --git a/org.eclipse.modisco.facet.util.emf.core/src/org/eclipse/modisco/facet/util/emf/core/EmfDebugUtils.java b/org.eclipse.modisco.facet.util.emf.core/src/org/eclipse/modisco/facet/util/emf/core/EmfDebugUtils.java new file mode 100644 index 0000000..938f4dd --- /dev/null +++ b/org.eclipse.modisco.facet.util.emf.core/src/org/eclipse/modisco/facet/util/emf/core/EmfDebugUtils.java
@@ -0,0 +1,90 @@ +/******************************************************************************* + * Copyright (c) 2011 Mia-Software. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Gregoire Dupe (Mia-Software) - Bug 366804 - [Restructuring] Table widget upgrade + * Grégoire Dupé (Mia-Software) - Bug 365843 - [Unit Test Failure][0.2/3.8][0.2/4.2] org.eclipse.emf.facet.widgets.nattable.tests.swtbot.Bug344925Test.testBug344925 + * Grégoire Dupé (Mia-Software) - Bug 367700 - [Unit Test Failure][0.2/3.8] org.eclipse.emf.facet.widgets.table.tests.internal.v0_2.swtbot.NatTableUITests.testOpenLoadCustomizationDialog + * Grégoire Dupé (Mia-Software) - Bug 373078 - API Cleaning + *******************************************************************************/ +package org.eclipse.modisco.facet.util.emf.core; +import java.io.File; +import java.io.IOException; +import java.util.Collections; + +import org.eclipse.emf.common.command.Command; +import org.eclipse.emf.common.command.CompoundCommand; +import org.eclipse.emf.common.util.URI; +import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.ecore.resource.Resource; +import org.eclipse.emf.ecore.resource.ResourceSet; +import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl; +import org.eclipse.emf.ecore.util.EcoreUtil; +import org.eclipse.modisco.facet.util.core.DebugUtils; +import org.eclipse.modisco.facet.util.emf.core.exception.DebugRuntimeException; + +/** + * @since 0.2 + */ +public final class EmfDebugUtils { + + private EmfDebugUtils() { + // Must not be used + } + + public static String debugCommand(final Command command) { + return debugCommand(command, 1); + } + + private static String debugCommand(final Command command, final int indent) { + StringBuffer result = new StringBuffer(); + result.append('\n'); + for (int i = 0; i < indent; i++) { + result.append("--"); //$NON-NLS-1$ + } + result.append(command.getClass().getSimpleName()); + result.append(" \""); //$NON-NLS-1$ + result.append(command.getLabel()); + result.append("\" "); //$NON-NLS-1$ + result.append(" canExecute="); //$NON-NLS-1$ + result.append(command.canExecute()); + result.append(" ("); //$NON-NLS-1$ + result.append(command.getClass().getName()); + result.append(')'); + if (command instanceof CompoundCommand) { + CompoundCommand compoundCommand = (CompoundCommand) command; + for (Command subCommand : compoundCommand.getCommandList()) { + result.append(debugCommand(subCommand, indent + 1)); + } + } + return result.toString(); + } + + /** + * This method can be used to easily dump a model into a file. This method has been written to be + * used by unit tests. + * + * @param eObject + * @param fileExtension + * @return a string explaining where the file has been saved. + */ + public static String getStateDumpMessage(final EObject eObject, final String fileExtension) { + final File file = new File(DebugUtils.getCallerLocation(1) + '.' + fileExtension); + URI uri = URI.createFileURI(file.getAbsolutePath()); + ResourceSet resourceSet = new ResourceSetImpl(); + Resource resource = resourceSet.createResource(uri); + resource.getContents().add(EcoreUtil.copy(eObject)); + try { + resource.save(Collections.EMPTY_MAP); + } catch (IOException e) { + throw new DebugRuntimeException(e); + } + return "A model containing the dumped EObject has been saved in " + file.getAbsolutePath(); //$NON-NLS-1$ + } + +}
diff --git a/org.eclipse.modisco.facet.util.emf.core/src/org/eclipse/modisco/facet/util/emf/core/IBrowserRegistry.java b/org.eclipse.modisco.facet.util.emf.core/src/org/eclipse/modisco/facet/util/emf/core/IBrowserRegistry.java new file mode 100644 index 0000000..bac5ada --- /dev/null +++ b/org.eclipse.modisco.facet.util.emf.core/src/org/eclipse/modisco/facet/util/emf/core/IBrowserRegistry.java
@@ -0,0 +1,88 @@ +/********************************************************************************** + * Copyright (c) 2011 Mia-Software. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Nicolas Guyomar (Mia-Software) - Bug 333652 Extension point offering the possibility to declare an EPackage browser + * Fabien Giquel (Mia-Software) -Bug 335218 - Extension point for registering EObject, EPackage, model editor + * Nicolas Bros (Mia-Software) - Bug 335218 - Extension point for registering EObject, EPackage, model editor + ***********************************************************************************/ +package org.eclipse.modisco.facet.util.emf.core; + +import java.util.List; + +import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.ecore.EPackage; +import org.eclipse.emf.ecore.resource.Resource; +import org.eclipse.modisco.facet.util.emf.core.internal.registry.BrowserRegistry; + +/** + * A registry for the {@link EObject}, {@link EPackage}, and {@link Resource} browser opener + * extension point. It can be used to open a default model browser (chosen by the user) or get a + * list of model browsers that can be opened on a model element, {@link EPackage} or + * {@link Resource}. + * @noimplement This interface is not intended to be implemented by clients. + * @noextend This interface is not intended to be extended by clients. + */ +public interface IBrowserRegistry { + + public static IBrowserRegistry INSTANCE = new BrowserRegistry(); + + /** + * Browse the given package using the default EPackage browser opener + * + * @param ePackage + * the element to browse + */ + public void browseEPackage(EPackage ePackage); + + /** + * Browse the given resource using the default Resource browser opener + * + * @param resource + * the element to browse + */ + public void browseResource(Resource resource); + + /** + * Browse the given eObject using the default EObject browser opener + * + * @param eObject + * the element to browse + */ + public void browseEObject(EObject eObject); + + /** + * @return the registered EPackage browser openers + */ + public List<IEPackageBrowserOpener> getAllRegisteredEPackageBrowsers(); + + /** + * @return the registered EObject browser openers + */ + public List<IEObjectBrowserOpener> getAllRegisteredEObjectBrowsers(); + + /** + * @return the registered Resource browser openers + */ + public List<IResourceBrowserOpener> getAllRegisteredResourceBrowsers(); + + /** + * @return the default EPackage browser opener, can be <code>null</code> + */ + public IEPackageBrowserOpener getDefaultEPackageBrowserOpener(); + + /** + * @return the default EObject browser opener, can be <code>null</code> + */ + public IEObjectBrowserOpener getDefaultEObjectBrowserOpener(); + + /** + * @return the default Resource browser opener, can be <code>null</code> + */ + public IResourceBrowserOpener getDefaultResourceBrowserOpener(); + +}
diff --git a/org.eclipse.modisco.facet.util.emf.core/src/org/eclipse/modisco/facet/util/emf/core/ICatalogManager.java b/org.eclipse.modisco.facet.util.emf.core/src/org/eclipse/modisco/facet/util/emf/core/ICatalogManager.java new file mode 100644 index 0000000..a4c4761 --- /dev/null +++ b/org.eclipse.modisco.facet.util.emf.core/src/org/eclipse/modisco/facet/util/emf/core/ICatalogManager.java
@@ -0,0 +1,59 @@ +/** + * Copyright (c) 2011, 2015 Mia-Software. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Grégoire Dupé (Mia-Software) - Bug 334000 Simple catalog manager + * Nicolas Guyomar (Mia-Software) - Bug 334000 Simple catalog manager + * Grégoire Dupé (Mia-Software) - Bug 477657 - The catalog manager should be able to manage workspace model + */ +package org.eclipse.modisco.facet.util.emf.core; + +import org.eclipse.emf.ecore.EObject; +import org.eclipse.modisco.facet.util.emf.catalog.CatalogSet; +import org.eclipse.modisco.facet.util.emf.core.internal.catalog.CatalogSetManager; + +/** + * Manager for catalogs containing registered elements defined in models. + * + * @since 0.2 + * @noextend This interface is not intended to be extended by clients. + */ +@Deprecated +public interface ICatalogManager { + + /** + * Return <code>true</code> if the eObject can be managed as a catalog entry. + * + * @param root + * the root element of a catalog + * @return whether the given element is of the right type to be a catalog root + */ + public boolean canBeManaged(EObject root); + + /** + * This method is called by {@link CatalogSetManager} when a model registration that can be + * managed (according to {@link ICatalogManager#canBeManaged(EObject) canBeManaged}) is detected + * while loading. This method adds the given root model element to the catalog. + * + * @param root + * a root element of a model that should be added to the catalog + */ + public void manage(EObject root); + + /** + * This method is called by the {@link CatalogSetManager} after the instantiation of this + * {@link ICatalogManager}. This method must attach the catalog(s) managed by this + * {@link ICatalogManager} to the given <code>catalogSet</code>. + * + * @param catalogSet + * the {@link CatalogSet} to which the catalog managed by this + * {@link ICatalogManager} should be attached + */ + public void setCatalogSet(CatalogSet catalogSet); + +}
diff --git a/org.eclipse.modisco.facet.util.emf.core/src/org/eclipse/modisco/facet/util/emf/core/ICatalogSetManager2.java b/org.eclipse.modisco.facet.util.emf.core/src/org/eclipse/modisco/facet/util/emf/core/ICatalogSetManager2.java new file mode 100644 index 0000000..7222428 --- /dev/null +++ b/org.eclipse.modisco.facet.util.emf.core/src/org/eclipse/modisco/facet/util/emf/core/ICatalogSetManager2.java
@@ -0,0 +1,73 @@ +/** + * Copyright (c) 2011, 2015 Mia-Software. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Grégoire Dupé (Mia-Software) - Bug 334000 Simple catalog manager + * Nicolas Guyomar (Mia-Software) - Bug 334000 Simple catalog manager + * Nicolas Guyomar (Mia-Software) - Bug 334529 ICatalogManager should be exposed in org.eclipse.emf.facet.common.core + * Nicolas Guyomar (Mia-Software) - Bug 338811 - A model registration method in the interface ICatalogSetManager + * Grégoire Dupé (Mia-Software) - Bug 362084 - Get the instance of a catalog manager + */ +package org.eclipse.modisco.facet.util.emf.core; + +import java.util.List; + +import org.eclipse.core.resources.IFile; +import org.eclipse.emf.ecore.resource.Resource; +import org.eclipse.modisco.facet.util.emf.catalog.Catalog; +import org.eclipse.modisco.facet.util.emf.catalog.CatalogSet; +import org.eclipse.modisco.facet.util.emf.core.exception.InvalidFacetSetException; +import org.osgi.framework.Bundle; + +/** + * @since 0.2 + * @noextend This interface is not intended to be extended by clients. + * @noimplement This interface is not intended to be implemented by clients. + */ +@Deprecated +public interface ICatalogSetManager2 { + + /** + * This method returns the {@link CatalogSet} object which contains all the registered catalogs. + * + * @return the set of registered {@link Catalog}s + */ + CatalogSet getCatalogSet(); + + /** + * Return the bundle containing the file from which we have created the given resource. + * + * @param eResource + * the EMF Resource + * @return the {@link Bundle} matching the given resource, or <code>null</code> if the resource + * is not defined in a Bundle. + * @throws IllegalArgumentException + * if the resource is <code>null</code> + * + * @author Nicolas Guyomar + */ + Bundle getBundleByResource(Resource eResource); + + /** + * This method takes a file to register it as a "modelDeclaration" extension in its containing + * plug-in. + * + * @param file + * the file to be registered as a "modelDeclaration" + * @throws InvalidFacetSetException + */ + void registerModelDeclaration(IFile file) throws InvalidFacetSetException; + + /** + * Return the registered catalogs conforming to the parameter class. + * + * @return a list of {@link ICatalogManager} + */ + <T> List<T> getCatalogManagerByType(Class<? extends T> catalogManagerClass); + +}
diff --git a/org.eclipse.modisco.facet.util.emf.core/src/org/eclipse/modisco/facet/util/emf/core/ICatalogSetManagerFactory.java b/org.eclipse.modisco.facet.util.emf.core/src/org/eclipse/modisco/facet/util/emf/core/ICatalogSetManagerFactory.java new file mode 100644 index 0000000..02cf1d6 --- /dev/null +++ b/org.eclipse.modisco.facet.util.emf.core/src/org/eclipse/modisco/facet/util/emf/core/ICatalogSetManagerFactory.java
@@ -0,0 +1,27 @@ +/** + * Copyright (c) 2012, 2015 Mia-Software. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Grégoire Dupé (Mia-Software) - Bug 369987 - [Restructuring][Table] Switch to the new customization and facet framework + */ +package org.eclipse.modisco.facet.util.emf.core; + +import org.eclipse.emf.ecore.resource.ResourceSet; +import org.eclipse.modisco.facet.util.emf.core.internal.catalog.CatalogSetManagerFactory; + +/** + * @since 0.2 + * @noextend This interface is not intended to be extended by clients. + * @noimplement This interface is not intended to be implemented by clients. + */ +@Deprecated +public interface ICatalogSetManagerFactory { + ICatalogSetManagerFactory DEFAULT = new CatalogSetManagerFactory(); + + ICatalogSetManager2 createICatalogSetManager(ResourceSet resourceSet); +}
diff --git a/org.eclipse.modisco.facet.util.emf.core/src/org/eclipse/modisco/facet/util/emf/core/IEObjectBrowserOpener.java b/org.eclipse.modisco.facet.util.emf.core/src/org/eclipse/modisco/facet/util/emf/core/IEObjectBrowserOpener.java new file mode 100644 index 0000000..c92edcb --- /dev/null +++ b/org.eclipse.modisco.facet.util.emf.core/src/org/eclipse/modisco/facet/util/emf/core/IEObjectBrowserOpener.java
@@ -0,0 +1,40 @@ +/** + * Copyright (c) 2011 Mia-Software. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Fabien Giquel (Mia-Software) + * Nicolas Bros (Mia-Software) - Bug 335218 - Extension point for registering EObject, EPackage, model editor + */ +package org.eclipse.modisco.facet.util.emf.core; + +import org.eclipse.emf.ecore.EObject; + +/** + * This class is used to register a Browser (typically an Eclipse editor or view), that can be + * opened from a given EObject. The registration is done through the + * "org.eclipse.emf.facet.util.emf.core.modelViewer" extension point. + */ +public interface IEObjectBrowserOpener { + + /** + * This method opens the given {@link EObject} with the browser corresponding to this + * {@link IEObjectBrowserOpener}. + * + * @param eObject + * the {@link EObject} to be opened + */ + public void openEObject(final EObject eObject); + + /** + * Return a human readable name for the {@link EObject} browser. + * + * @return a human readable name for the {@link EObject} browser + */ + public String getBrowserName(); + +}
diff --git a/org.eclipse.modisco.facet.util.emf.core/src/org/eclipse/modisco/facet/util/emf/core/IEPackageBrowserOpener.java b/org.eclipse.modisco.facet.util.emf.core/src/org/eclipse/modisco/facet/util/emf/core/IEPackageBrowserOpener.java new file mode 100644 index 0000000..f2636fb --- /dev/null +++ b/org.eclipse.modisco.facet.util.emf.core/src/org/eclipse/modisco/facet/util/emf/core/IEPackageBrowserOpener.java
@@ -0,0 +1,40 @@ +/** + * Copyright (c) 2011 Mia-Software. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Nicolas Guyomar (Mia-Software) - Bug 333652 Extension point offering the possibility to declare an EPackage browser + * Nicolas Bros (Mia-Software) - Bug 335218 - Extension point for registering EObject, EPackage, model editor + */ +package org.eclipse.modisco.facet.util.emf.core; + +import org.eclipse.emf.ecore.EPackage; + +/** + * This class is used to register a Browser (typically an Eclipse editor or view), that can be + * opened from a given EPackage. The registration is done through the + * "org.eclipse.emf.facet.util.emf.core.modelViewer" extension point. + */ +public interface IEPackageBrowserOpener { + + /** + * This method opens the given {@link EPackage} with the browser corresponding to this + * {@link IEPackageBrowserOpener}. + * + * @param ePackage + * the {@link EPackage} to be opened + */ + public void openEPackage(final EPackage ePackage); + + /** + * Return a human readable name for the {@link EPackage} browser. + * + * @return a human readable name for the {@link EPackage} browser + */ + public String getBrowserName(); + +}
diff --git a/org.eclipse.modisco.facet.util.emf.core/src/org/eclipse/modisco/facet/util/emf/core/IResourceBrowserOpener.java b/org.eclipse.modisco.facet.util.emf.core/src/org/eclipse/modisco/facet/util/emf/core/IResourceBrowserOpener.java new file mode 100644 index 0000000..93fc59c --- /dev/null +++ b/org.eclipse.modisco.facet.util.emf.core/src/org/eclipse/modisco/facet/util/emf/core/IResourceBrowserOpener.java
@@ -0,0 +1,40 @@ +/** + * Copyright (c) 2011 Mia-Software. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Fabien Giquel (Mia-Software) + * Nicolas Bros (Mia-Software) - Bug 335218 - Extension point for registering EObject, EPackage, model editor + */ +package org.eclipse.modisco.facet.util.emf.core; + +import org.eclipse.emf.ecore.resource.Resource; + +/** + * This class is used to register a Browser (typically an Eclipse editor or view), that can be + * opened from a given EMF Resource. The registration is done through the + * "org.eclipse.emf.facet.util.emf.core.modelViewer" extension point. + */ +public interface IResourceBrowserOpener { + + /** + * This method opens the given {@link Resource} with the browser corresponding to this + * {@link IResourceBrowserOpener}. + * + * @param resource + * the {@link Resource} to be opened + */ + public void openResource(final Resource resource); + + /** + * Return a human readable name for the {@link Resource} browser. + * + * @return a human readable name for the {@link Resource} browser + */ + public String getBrowserName(); + +}
diff --git a/org.eclipse.modisco.facet.util.emf.core/src/org/eclipse/modisco/facet/util/emf/core/ModelUtils.java b/org.eclipse.modisco.facet.util.emf.core/src/org/eclipse/modisco/facet/util/emf/core/ModelUtils.java new file mode 100644 index 0000000..df3f0b8 --- /dev/null +++ b/org.eclipse.modisco.facet.util.emf.core/src/org/eclipse/modisco/facet/util/emf/core/ModelUtils.java
@@ -0,0 +1,253 @@ +/******************************************************************************* + * Copyright (c) 2009, 2010, 2012 Mia-Software. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Nicolas Bros (Mia-Software) - Bug 366367 - To be able to change the "CanBePresentedInTheTable" query + * Gregoire Dupe (Mia-Software) - Bug 369987 - [Restructuring][Table] Switch to the new customization and facet framework + * Laurent Pichierri (Soft-Maint) - Bug 371204 - Compatibility with Helios + * Gregoire Dupe (Mia-Software) - Bug 371367 - Hierarchical FacetSets + * Gregoire Dupe (Mia-Software) - Bug 369987 - [Restructuring][Table] Switch to the new customization and facet framework + * Gregoire Dupe (Mia-Software) - Bug 387470 - [EFacet][Custom] Editors + *******************************************************************************/ +package org.eclipse.modisco.facet.util.emf.core; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.List; + +import org.eclipse.core.resources.IProject; +import org.eclipse.core.resources.IWorkspace; +import org.eclipse.core.resources.ResourcesPlugin; +import org.eclipse.emf.common.notify.Notifier; +import org.eclipse.emf.common.util.EList; +import org.eclipse.emf.common.util.TreeIterator; +import org.eclipse.emf.common.util.URI; +import org.eclipse.emf.ecore.EAttribute; +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.EClassifier; +import org.eclipse.emf.ecore.EDataType; +import org.eclipse.emf.ecore.ENamedElement; +import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.ecore.EPackage; +import org.eclipse.emf.ecore.EStructuralFeature; +import org.eclipse.emf.ecore.resource.Resource; +import org.eclipse.emf.ecore.resource.ResourceSet; +import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl; +import org.eclipse.emf.ecore.util.FeatureMap; +import org.eclipse.emf.edit.provider.ComposedAdapterFactory; +import org.eclipse.emf.edit.provider.IItemLabelProvider; +import org.eclipse.modisco.facet.util.core.Logger; +import org.eclipse.modisco.facet.util.core.internal.exported.StringUtils; +import org.eclipse.modisco.facet.util.emf.core.internal.Activator; + +/** + * Utility class for models. + * @since 0.2 + */ +public final class ModelUtils { + + /** + * Meta-model qualified name separator + */ + private static final String MM_QNAME_SEPARATOR = "::"; //$NON-NLS-1$ + + /** + * Utility classes don't need to (and shouldn't) be instantiated. + */ + private ModelUtils() { + // prevents instantiation + } + + /** + * Computes a list of {@link EObject}s from the same {@link ResourceSet} as + * <code>source</code> that can be assigned to the given feature. + */ + //Copied from org.eclipse.emf.facet.infra.common.core.internal.utils.ModelUtils.computeAssignableElements(EStructuralFeature, EObject) + public static List<EObject> computeAssignableElements(final EStructuralFeature feature, + final EObject source) { + EClassifier eType = feature.getEType(); + + // build a list of EObjects assignable to the EReference + List<EObject> list = new ArrayList<EObject>(); + Resource eResource = source.eResource(); + ResourceSet resourceSet = eResource.getResourceSet(); + TreeIterator<Notifier> allContents = resourceSet.getAllContents(); + while (allContents.hasNext()) { + Notifier notifier = allContents.next(); + if (notifier instanceof EObject) { + EObject eObject = (EObject) notifier; + if (eType.isInstance(eObject)) { + list.add(eObject); + } + } + } + return list; + } + + public static boolean isBooleanDataType(final EClassifier classifier) { + if (classifier instanceof EDataType) { + EDataType dataType = (EDataType) classifier; + Class<?> instanceClass = dataType.getInstanceClass(); + return instanceClass == Boolean.class || instanceClass == boolean.class; + } + return false; + } + + /** + * Find all subclasses of the given metaclass in the package registry + * + * @param context + * the metaclass whose subclasses must be found + * @return all the subclasses + */ + //Copied from org.eclipse.emf.facet.infra.common.core.internal.utils.ModelUtils.allSubClasses(final EClass context) + public static List<EClass> allSubClasses(final EClass context) { + List<EClass> result = new ArrayList<EClass>(); + // Set<Resource> resources = new HashSet<Resource>(); + Collection<String> uris = new ArrayList<String>(EPackage.Registry.INSTANCE.keySet()); + for (String ePackageURI : uris) { + try { + EPackage ePackage = EPackage.Registry.INSTANCE.getEPackage(ePackageURI); + EList<EClassifier> eClassifiers = ePackage.getEClassifiers(); + for (EClassifier eClassifier : eClassifiers) { + if (eClassifier instanceof EClass) { + EClass eClass = (EClass) eClassifier; + if (isSuperTypeOf(context, eClass)) { + result.add(eClass); + } + } + } + } catch (Exception e) { + Logger.logError(e, Activator.getDefault()); + } + } + return result; + } + + //Copied from org.eclipse.emf.facet.infra.common.core.internal.utils.ModelUtils.isSuperTypeOf(final EClass self, final EClass typeDeclaration) + public static boolean isSuperTypeOf(final EClass self, final EClass typeDeclaration) { + return typeDeclaration.getEAllSuperTypes().contains(self); + } + + /** @return the qualified name of the given metaclass */ + //Copied from org.eclipse.emf.facet.infra.common.core.internal.utils.ModelUtils.getMetaclassQualifiedName(final EClassifier eClass) + public static String getMetaclassQualifiedName(final EClassifier eClass) { + final ArrayList<String> qualifiedNameParts = new ArrayList<String>(); + final StringBuilder builder = new StringBuilder(); + + EPackage ePackage = eClass.getEPackage(); + while (ePackage != null) { + qualifiedNameParts.add(ePackage.getName()); + ePackage = ePackage.getESuperPackage(); + } + + for (int i = qualifiedNameParts.size() - 1; i >= 0; i--) { + builder.append(qualifiedNameParts.get(i) + "."); //$NON-NLS-1$ + } + + builder.append(eClass.getName()); + + return builder.toString(); + } + + /** + * Returns a name for the given model element from the EMF global registry, + * or use a default name taken from a String attribute. + * + * @return a name for the given element + */ + //Copied from org.eclipse.emf.facet.infra.common.core.internal.utils.ModelUtils.getName(EObject) + public static String getName(final EObject eObject) { + IItemLabelProvider itemLabelProvider = (IItemLabelProvider) new ComposedAdapterFactory( + ComposedAdapterFactory.Descriptor.Registry.INSTANCE).adapt(eObject, IItemLabelProvider.class); + if (itemLabelProvider != null) { + return itemLabelProvider.getText(eObject); + } + return ModelUtils.getDefaultName(eObject); + } + + /** + * @return a default name based on a string feature of the given + * {@link EObject} + */ + //Copied from org.eclipse.emf.facet.infra.common.core.internal.utils.ModelUtils.getDefaultName(EObject) + public static String getDefaultName(final EObject eObject) { + // find a feature that can be used as a name + final EStructuralFeature feature = ModelUtils.getLabelFeature(eObject.eClass()); + if (feature != null) { + final Object value = eObject.eGet(feature); + if (value != null) { + return StringUtils.truncateBeforeNewline(value.toString()); + } + } + return ""; //$NON-NLS-1$ + } + + //Copied from ReflectiveItemProvider class + //Copied from org.eclipse.emf.facet.infra.common.core.internal.utils.ModelUtils.getLabelFeature(EClass) + private static EStructuralFeature getLabelFeature(final EClass eClass) { + EAttribute result = null; + for (final EAttribute eAttribute : eClass.getEAllAttributes()) { + if (!eAttribute.isMany() + && eAttribute.getEType().getInstanceClass() != FeatureMap.Entry.class) { + if ("name".equalsIgnoreCase(eAttribute.getName())) { //$NON-NLS-1$ + result = eAttribute; + break; + } else if (result == null) { + result = eAttribute; + } else if (eAttribute.getEAttributeType().getInstanceClass() == String.class + && result.getEAttributeType().getInstanceClass() != String.class) { + result = eAttribute; + } + } + } + return result; + } + + /** + * @author Gregoire Dupe (Mia-Software) + * @param namedElement + * @return + */ + public static String getQualifiedName(final ENamedElement namedElement) { + String parentQName = ""; //$NON-NLS-1$ + if (namedElement.eContainer() instanceof ENamedElement) { + ENamedElement parent = (ENamedElement) namedElement.eContainer(); + parentQName = getQualifiedName(parent) + ModelUtils.MM_QNAME_SEPARATOR; + } + return parentQName + namedElement.getName(); + } + + /** + * @since 0.3 + */ + public static ResourceSet getOrCreateResourceSet(final EObject eObject) { + ResourceSet resourceSet = null; + if (eObject.eResource() == null) { + resourceSet = new ResourceSetImpl(); + } else { + resourceSet = eObject.eResource().getResourceSet(); + } + return resourceSet; + } + + /** + * @since 0.3 + */ + public static IProject getProject(final EObject eObject) { + IProject result = null; + final Resource resource = eObject.eResource(); + final URI uri = resource.getURI(); + if (uri.isPlatformResource()) { + final String projectName = uri.segment(1); + final IWorkspace workspace = ResourcesPlugin.getWorkspace(); + result = workspace.getRoot() + .getProject(projectName); + } + return result; + } +}
diff --git a/org.eclipse.modisco.facet.util.emf.core/src/org/eclipse/modisco/facet/util/emf/core/catalog/ICatalogManager.java b/org.eclipse.modisco.facet.util.emf.core/src/org/eclipse/modisco/facet/util/emf/core/catalog/ICatalogManager.java new file mode 100644 index 0000000..8f8de86 --- /dev/null +++ b/org.eclipse.modisco.facet.util.emf.core/src/org/eclipse/modisco/facet/util/emf/core/catalog/ICatalogManager.java
@@ -0,0 +1,33 @@ +/******************************************************************************* + * Copyright (c) 2015, 2016 Mia-Software. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Grégoire Dupé (Mia-Software) - Bug 477657 - The catalog manager should be able to manage workspace model + * Grégoire Dupé (Mia-Software) - Bug 482887 - CatalogManager create files with too long name + *******************************************************************************/ +package org.eclipse.modisco.facet.util.emf.core.catalog; + +import java.util.List; + +import org.eclipse.core.resources.IProject; +import org.eclipse.emf.ecore.EObject; + +/** + * @since 1.1 + * @noimplement This interface is not intended to be implemented by clients. + * @noextend This interface is not intended to be extended by clients. + */ +public interface ICatalogManager { + + <T> List<T> getEntries(final Class<T> expectedClass); + <T> List<T> getWsEntries(final Class<T> expectedClass); + <T> List<T> getInstalledEntries(final Class<T> expectedClass); + boolean addWsEntry(EObject entry); + void removeWsEntry(EObject entry); + void removeAllWsEntries(IProject project); + +}
diff --git a/org.eclipse.modisco.facet.util.emf.core/src/org/eclipse/modisco/facet/util/emf/core/catalog/ICatalogManagerConfiguration.java b/org.eclipse.modisco.facet.util.emf.core/src/org/eclipse/modisco/facet/util/emf/core/catalog/ICatalogManagerConfiguration.java new file mode 100644 index 0000000..44ae663 --- /dev/null +++ b/org.eclipse.modisco.facet.util.emf.core/src/org/eclipse/modisco/facet/util/emf/core/catalog/ICatalogManagerConfiguration.java
@@ -0,0 +1,44 @@ +/******************************************************************************* + * Copyright (c) 2015, 2016 Mia-Software. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Grégoire Dupé (Mia-Software) - Bug 477657 - The catalog manager should be able to manage workspace model + * Grégoire Dupé (Mia-Software) - Bug 482887 - CatalogManager create files with too long name + *******************************************************************************/ +package org.eclipse.modisco.facet.util.emf.core.catalog; + +import org.eclipse.emf.ecore.EObject; + +/** + * Manager for catalogs containing registered elements defined in models. + * + * @since 1.1 + * @noextend This interface is not intended to be extended by clients. + */ +public interface ICatalogManagerConfiguration { + + /** + * Return <code>true</code> if the eObject can be managed as a catalog + * entry. + * + * @param root + * the root element of a catalog + * @return true if the parameter 'root' is of the right type to be a catalog + * root + */ + boolean canBeManaged(EObject root); + + /** + * Return <code>true</code> if the eObject is valid. + * + * @param root + * the root element of a catalog + * @return true if the parameter 'root' is is valid + */ + boolean isValid(EObject root); + +}
diff --git a/org.eclipse.modisco.facet.util.emf.core/src/org/eclipse/modisco/facet/util/emf/core/catalog/ICatalogManagerFactory.java b/org.eclipse.modisco.facet.util.emf.core/src/org/eclipse/modisco/facet/util/emf/core/catalog/ICatalogManagerFactory.java new file mode 100644 index 0000000..78025b1 --- /dev/null +++ b/org.eclipse.modisco.facet.util.emf.core/src/org/eclipse/modisco/facet/util/emf/core/catalog/ICatalogManagerFactory.java
@@ -0,0 +1,41 @@ +/******************************************************************************* + * Copyright (c) 2015, 2016 Mia-Software. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Grégoire Dupé (Mia-Software) - Bug 477657 - The catalog manager should be able to manage workspace model + * Grégoire Dupé (Mia-Software) - Bug 482887 - CatalogManager create files with too long name + *******************************************************************************/ +package org.eclipse.modisco.facet.util.emf.core.catalog; + +import org.eclipse.emf.ecore.resource.ResourceSet; +import org.eclipse.modisco.facet.util.emf.core.internal.catalog.v2.CatalogManagerFactory; + +/** + * @since 1.1 + * @noimplement This interface is not intended to be implemented by clients. + * @noextend This interface is not intended to be extended by clients. + */ +public interface ICatalogManagerFactory { + + ICatalogManagerFactory DEFAULT = new CatalogManagerFactory(); + + /** + * The returned catalog will be serialized on file system. The serialization + * file will be named using the id parameter value. + */ + ICatalogManager getOrCreateCatalogManager( + ICatalogManagerConfiguration catalogMgrconfig, + ResourceSet resourceSet, String catalogId); + + /** + * The returned catalog will not be serialized on file system. The eObject + * will be stored in resource having a URI starting with <code>tmp://</code> + */ + ICatalogManager createCatalogManager( + ICatalogManagerConfiguration catalogMgrconfig, + ResourceSet resourceSet); +}
diff --git a/org.eclipse.modisco.facet.util.emf.core/src/org/eclipse/modisco/facet/util/emf/core/command/EmfCommandUtils.java b/org.eclipse.modisco.facet.util.emf.core/src/org/eclipse/modisco/facet/util/emf/core/command/EmfCommandUtils.java new file mode 100644 index 0000000..f170102 --- /dev/null +++ b/org.eclipse.modisco.facet.util.emf.core/src/org/eclipse/modisco/facet/util/emf/core/command/EmfCommandUtils.java
@@ -0,0 +1,41 @@ +/** + * Copyright (c) 2012 Mia-Software. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Alban Ménager (Soft-Maint) - Bug 387470 - [EFacet][Custom] Editors + * Grégoire Dupé (Mia-Software) - Bug 387470 - [EFacet][Custom] Editors + */ +package org.eclipse.modisco.facet.util.emf.core.command; + +import java.util.List; + +import org.eclipse.emf.common.command.Command; +import org.eclipse.emf.common.command.CompoundCommand; + +/** + * @since 0.3 + */ +public final class EmfCommandUtils { + + private EmfCommandUtils() { + // Must not be used + } + + public static final Command createResult(final List<Command> commandList, + final String label) { + Command result = null; + while (commandList.contains(null)) { + commandList.remove(null); + } + if (!commandList.isEmpty()) { + result = new CompoundCommand(label, commandList); + } + return result; + } + +}
diff --git a/org.eclipse.modisco.facet.util.emf.core/src/org/eclipse/modisco/facet/util/emf/core/command/ICommandFactoryResult.java b/org.eclipse.modisco.facet.util.emf.core/src/org/eclipse/modisco/facet/util/emf/core/command/ICommandFactoryResult.java new file mode 100644 index 0000000..c21bf1a --- /dev/null +++ b/org.eclipse.modisco.facet.util.emf.core/src/org/eclipse/modisco/facet/util/emf/core/command/ICommandFactoryResult.java
@@ -0,0 +1,24 @@ +/** + * Copyright (c) 2012 Mia-Software. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Gregoire Dupe (Mia-Software) - Bug 369987 - [Restructuring][Table] Switch to the new customization and facet framework + * Gregoire Dupe (Mia-Software) - Bug 373078 - API Cleaning + */ +package org.eclipse.modisco.facet.util.emf.core.command; + +import org.eclipse.emf.common.command.Command; + +/** + * @since 0.2 + */ +public interface ICommandFactoryResult<T> { + Command getCommand(); + T getResult(); + +}
diff --git a/org.eclipse.modisco.facet.util.emf.core/src/org/eclipse/modisco/facet/util/emf/core/command/ICommandFactoryResultFactory.java b/org.eclipse.modisco.facet.util.emf.core/src/org/eclipse/modisco/facet/util/emf/core/command/ICommandFactoryResultFactory.java new file mode 100644 index 0000000..9f475f0 --- /dev/null +++ b/org.eclipse.modisco.facet.util.emf.core/src/org/eclipse/modisco/facet/util/emf/core/command/ICommandFactoryResultFactory.java
@@ -0,0 +1,28 @@ +/** + * Copyright (c) 2012 Mia-Software. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Gregoire Dupe (Mia-Software) - Bug 369987 - [Restructuring][Table] Switch to the new customization and facet framework + * Gregoire Dupe (Mia-Software) - Bug 373078 - API Cleaning + */ +package org.eclipse.modisco.facet.util.emf.core.command; + +import org.eclipse.emf.common.command.Command; +import org.eclipse.modisco.facet.util.emf.core.internal.command.CommandFactoryResultFactory; + +/** + * @since 0.2 + * @noimplement This interface is not intended to be implemented by clients. + * @noextend This interface is not intended to be extended by clients. + */ +public interface ICommandFactoryResultFactory { + + ICommandFactoryResultFactory DEFAULT = new CommandFactoryResultFactory(); + + <T> ICommandFactoryResult<T> createCommandFactoryResult(Command command, T result); +}
diff --git a/org.eclipse.modisco.facet.util.emf.core/src/org/eclipse/modisco/facet/util/emf/core/command/ILockableUndoCommand.java b/org.eclipse.modisco.facet.util.emf.core/src/org/eclipse/modisco/facet/util/emf/core/command/ILockableUndoCommand.java new file mode 100644 index 0000000..a746d0c --- /dev/null +++ b/org.eclipse.modisco.facet.util.emf.core/src/org/eclipse/modisco/facet/util/emf/core/command/ILockableUndoCommand.java
@@ -0,0 +1,25 @@ +/** + * Copyright (c) 2011 CEA LIST. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Gregoire Dupe (Mia-Software) - Bug 345730 - Deleting an element in the model breaks the table + */ +package org.eclipse.modisco.facet.util.emf.core.command; + +/** + * This interface is used to force an EMF command to not be "undo-able" + * @since 0.1.1 + * @noimplement This interface is not intended to be implemented by clients. + * @noextend This interface is not intended to be extended by clients. + */ +public interface ILockableUndoCommand { + + /** + * @param enableUndo false to lock the command in an not "undo-able" mode + */ + public void enableCanUndo(boolean enableUndo); +}
diff --git a/org.eclipse.modisco.facet.util.emf.core/src/org/eclipse/modisco/facet/util/emf/core/exception/DebugRuntimeException.java b/org.eclipse.modisco.facet.util.emf.core/src/org/eclipse/modisco/facet/util/emf/core/exception/DebugRuntimeException.java new file mode 100644 index 0000000..9012df7 --- /dev/null +++ b/org.eclipse.modisco.facet.util.emf.core/src/org/eclipse/modisco/facet/util/emf/core/exception/DebugRuntimeException.java
@@ -0,0 +1,25 @@ +/******************************************************************************* + * Copyright (c) 2011 Mia Software. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Grégoire Dupé - Bug 365843 - [Unit Test Failure][0.2/3.8][0.2/4.2]org.eclipse.emf.facet.widgets.nattable.tests.swtbot.Bug344925Test.testBug344925 + * Gregoire Dupe (Mia-Software) - Bug 373078 - API Cleaning + *******************************************************************************/ +package org.eclipse.modisco.facet.util.emf.core.exception; + +/** + * @since 0.2 + */ +public final class DebugRuntimeException extends RuntimeException { + + private static final long serialVersionUID = -2130942266962627760L; + + public DebugRuntimeException(final Throwable throwable) { + super(throwable); + } + +}
diff --git a/org.eclipse.modisco.facet.util.emf.core/src/org/eclipse/modisco/facet/util/emf/core/exception/InvalidFacetSetException.java b/org.eclipse.modisco.facet.util.emf.core/src/org/eclipse/modisco/facet/util/emf/core/exception/InvalidFacetSetException.java new file mode 100644 index 0000000..ef68cb5 --- /dev/null +++ b/org.eclipse.modisco.facet.util.emf.core/src/org/eclipse/modisco/facet/util/emf/core/exception/InvalidFacetSetException.java
@@ -0,0 +1,36 @@ +/** + * Copyright (c) 2011 Mia-Software. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Nicolas Guyomar (Mia-Software) - Bug 338811 - A model registration method in the interface ICatalogSetManager + * Gregoire Dupe (Mia-Software) - Bug 373078 - API Cleaning + */ +package org.eclipse.modisco.facet.util.emf.core.exception; + +/** + * This exception is raised when an invalid FacetSet is found + * + * @since 0.2 + */ +public final class InvalidFacetSetException extends Exception { + + private static final long serialVersionUID = -7684948344074635385L; + + public InvalidFacetSetException(final String message) { + super(message); + } + + public InvalidFacetSetException(final String message, final Throwable cause) { + super(message, cause); + } + + public InvalidFacetSetException(final Throwable cause) { + super(cause); + } + +}
diff --git a/org.eclipse.modisco.facet.util.emf.core/src/org/eclipse/modisco/facet/util/emf/core/internal/Activator.java b/org.eclipse.modisco.facet.util.emf.core/src/org/eclipse/modisco/facet/util/emf/core/internal/Activator.java new file mode 100644 index 0000000..ff4c1b0 --- /dev/null +++ b/org.eclipse.modisco.facet.util.emf.core/src/org/eclipse/modisco/facet/util/emf/core/internal/Activator.java
@@ -0,0 +1,47 @@ +/** + * Copyright (c) 2011 Mia-Software. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Gregoire Dupe (Mia-Software) - Bug 334000 - Simple catalog manager + * Nicolas Bros (Mia-Software) - Bug 335218 - Extension point for registering EObject, EPackage, model editor + */ +package org.eclipse.modisco.facet.util.emf.core.internal; + +import org.eclipse.core.runtime.Plugin; +import org.osgi.framework.BundleContext; + +public class Activator extends Plugin { + + public static final String PLUGIN_ID = "org.eclipse.emf.facet.util.emf.core"; //$NON-NLS-1$ + + private static BundleContext context; + private static Activator plugin; + + public static Plugin getDefault() { + return Activator.plugin; + } + + static BundleContext getContext() { + return Activator.context; + } + + @Override + public void start(final BundleContext bundleContext) throws Exception { + super.start(bundleContext); + Activator.plugin = this; + Activator.context = bundleContext; + } + + @Override + public void stop(final BundleContext bundleContext) throws Exception { + Activator.context = null; + Activator.plugin = null; + super.stop(bundleContext); + } + +}
diff --git a/org.eclipse.modisco.facet.util.emf.core/src/org/eclipse/modisco/facet/util/emf/core/internal/EMFUtils.java b/org.eclipse.modisco.facet.util.emf.core/src/org/eclipse/modisco/facet/util/emf/core/internal/EMFUtils.java new file mode 100644 index 0000000..d3df815 --- /dev/null +++ b/org.eclipse.modisco.facet.util.emf.core/src/org/eclipse/modisco/facet/util/emf/core/internal/EMFUtils.java
@@ -0,0 +1,162 @@ +/******************************************************************************* + * Copyright (c) 2011 CEA LIST. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Nicolas Bros (Mia-Software) - Bug 340588 - Least common supertype + * Vincent Lorenzo (CEA-LIST) - bug 341328 - We need to be able to specify which column have to be hidden/visible using the customization mechanism + *******************************************************************************/ +package org.eclipse.modisco.facet.util.emf.core.internal; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.Collections; +import java.util.Comparator; +import java.util.HashSet; +import java.util.Iterator; +import java.util.List; +import java.util.ListIterator; +import java.util.Set; + +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.ecore.EStructuralFeature; +import org.eclipse.emf.ecore.EcorePackage; + +public final class EMFUtils { + + private EMFUtils() { + // prevent instantiation + } + + /** + * Computes the least common supertype of all the given metaclasses. That is, the most derived + * type that is a supertype of all the given classes. + * + * @param classes + * the list of metaclasses + * + * @return the least common supertype of all the given metaclasses, or <code>null</code> if + * there is none, or several. In this case, the only common supertype can be considered + * as {@link EObject} . + */ + public static EClass computeLeastCommonSupertype(final Collection<EClass> classes) { + return computeLeastCommonSupertype(classes, null); + } + + /** + * Computes the least common supertype of all the given metaclasses. That is, the most derived + * type that is a supertype of all the given classes. + * + * @param classes + * the list of metaclasses + * @param feature + * if not <code>null</code>, then only metaclasses that contain this feature will be + * considered + * + * @return the least common supertype of all the given metaclasses, or the {@link EObject} + * {@link EClass} if there is none, or several. + */ + public static EClass computeLeastCommonSupertype(final Collection<EClass> classes, + final EStructuralFeature feature) { + Set<EClass> commonClasses = new HashSet<EClass>(); + Iterator<EClass> iterator = classes.iterator(); + boolean first = true; + while (iterator.hasNext()) { + EClass eClass = iterator.next(); + if (first) { + commonClasses.addAll(eClass.getEAllSuperTypes()); + commonClasses.add(eClass); + first = false; + } else { + List<EClass> filter = new ArrayList<EClass>(eClass.getEAllSuperTypes()); + filter.add(eClass); + commonClasses.retainAll(filter); + } + } + + Collection<EClass> commonClassesFiltered; + // keep only metaclasses that contain the feature + if (feature != null) { + commonClassesFiltered = new ArrayList<EClass>(); + for (EClass eClass : commonClasses) { + if (eClass.getEAllStructuralFeatures().contains(feature)) { + commonClassesFiltered.add(eClass); + } + } + } else { + commonClassesFiltered = commonClasses; + } + + // handle the easy (and common) cases early + int size = commonClassesFiltered.size(); + if (size == 0) { + return EcorePackage.eINSTANCE.getEObject(); + } + if (size == 1) { + return commonClassesFiltered.iterator().next(); + } + + // now, remove EClasses that are not a direct or indirect sub- or super-type + // of all the other classes. + ArrayList<EClass> list = new ArrayList<EClass>(commonClassesFiltered); + ListIterator<EClass> listIterator = list.listIterator(); + while (listIterator.hasNext()) { + EClass eClass = listIterator.next(); + for (EClass eClass2 : commonClassesFiltered) { + if (eClass != eClass2 && !eClass.isSuperTypeOf(eClass2) + && !eClass2.isSuperTypeOf(eClass)) { + listIterator.remove(); + break; + } + } + } + + int size2 = list.size(); + if (size2 == 0) { + return EcorePackage.eINSTANCE.getEObject(); + } + if (size2 == 1) { + return list.iterator().next(); + } + + // now commonClasses only contains classes in the same hierarchy, + // so we can sort them using a "is subtype of" comparison operator + + Collections.sort(list, new Comparator<EClass>() { + public int compare(final EClass e1, final EClass e2) { + if (e1 == e2) { + return 0; + } else if (e1.isSuperTypeOf(e2)) { + return 1; + } else if (e2.isSuperTypeOf(e1)) { + return -1; + } else { + throw new IllegalStateException("comparing classes not in the same hierarchy"); //$NON-NLS-1$ + } + } + }); + + if (list.isEmpty()) { + return EcorePackage.eINSTANCE.getEObject(); + } + return list.get(0); + } + + + public static Set<EClass> getAllFeatureOwner(final List<EObject> elements, + final EStructuralFeature feature) { + Set<EClass> owners = new HashSet<EClass>(); + for (EObject el : elements) { + if (el.eClass().getEAllStructuralFeatures().contains(feature)) { + owners.add(el.eClass()); + } + } + return owners; + } + +}
diff --git a/org.eclipse.modisco.facet.util.emf.core/src/org/eclipse/modisco/facet/util/emf/core/internal/Messages.java b/org.eclipse.modisco.facet.util.emf.core/src/org/eclipse/modisco/facet/util/emf/core/internal/Messages.java new file mode 100644 index 0000000..8e5a4b5 --- /dev/null +++ b/org.eclipse.modisco.facet.util.emf.core/src/org/eclipse/modisco/facet/util/emf/core/internal/Messages.java
@@ -0,0 +1,29 @@ +/******************************************************************************* + * Copyright (c) 2017 Soft-Maint. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Jonathan Pepin (Soft-Maint) - Bug 516701 - Command factory to add content to resource + *******************************************************************************/ + +package org.eclipse.modisco.facet.util.emf.core.internal; + +import org.eclipse.osgi.util.NLS; + +public class Messages extends NLS { + private static final String BUNDLE_NAME = "org.eclipse.emf.facet.util.emf.core.internal.messages"; //$NON-NLS-1$ + public static String AddResourceContentCommand_Description; + public static String AddResourceContentCommand_Label; + public static String SetResourceContentCommand_Description; + public static String SetResourceContentCommand_Label; + static { + // initialize resource bundle + NLS.initializeMessages(BUNDLE_NAME, Messages.class); + } + + private Messages() { + } +}
diff --git a/org.eclipse.modisco.facet.util.emf.core/src/org/eclipse/modisco/facet/util/emf/core/internal/catalog/CatalogSetManager.java b/org.eclipse.modisco.facet.util.emf.core/src/org/eclipse/modisco/facet/util/emf/core/internal/catalog/CatalogSetManager.java new file mode 100644 index 0000000..f3a39da --- /dev/null +++ b/org.eclipse.modisco.facet.util.emf.core/src/org/eclipse/modisco/facet/util/emf/core/internal/catalog/CatalogSetManager.java
@@ -0,0 +1,191 @@ +/** + * Copyright (c) 2011, 2015 Mia-Software. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Grégoire Dupé (Mia-Software) - Bug 334000 Simple catalog manager + * Nicolas Guyomar (Mia-Software) - Bug 334000 Simple catalog manager + * Nicolas Guyomar (Mia-Software) - Bug 334529 - ICatalogManager should be exposed in org.eclipse.emf.facet.common.core + * Nicolas Guyomar (Mia-Software) - Bug 338811 - A model registration method in the interface ICatalogSetManager + * Grégoire Dupé (Mia-Software) - Bug 338811 - A model registration method in the interface ICatalogSetManager + * Emmanuelle Rouillé (Mia-Software) - Bug 352618 - To be able to use non derived facet structural features and save them values. + * Grégoire Dupé (Mia-Software) - Bug 362084 - Get the instance of a catalog manager + * Grégoire Dupé (Mia-Software) - Bug 362087 - [Deprecated] org.eclipse.emf.facet.util.emf.core.ICatalogSetManager + * Grégoire Dupé (Mia-Software) - Bug 477657 - The catalog manager should be able to manage workspace model + */ +package org.eclipse.modisco.facet.util.emf.core.internal.catalog; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import org.eclipse.core.resources.IFile; +import org.eclipse.core.runtime.CoreException; +import org.eclipse.core.runtime.IConfigurationElement; +import org.eclipse.core.runtime.IExtension; +import org.eclipse.core.runtime.IExtensionPoint; +import org.eclipse.core.runtime.IExtensionRegistry; +import org.eclipse.core.runtime.Platform; +import org.eclipse.emf.common.notify.Adapter; +import org.eclipse.emf.common.notify.Notification; +import org.eclipse.emf.common.notify.Notifier; +import org.eclipse.emf.common.util.URI; +import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.ecore.resource.Resource; +import org.eclipse.emf.ecore.resource.ResourceSet; +import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl; +import org.eclipse.modisco.facet.util.core.Logger; +import org.eclipse.modisco.facet.util.emf.catalog.CatalogFactory; +import org.eclipse.modisco.facet.util.emf.catalog.CatalogSet; +import org.eclipse.modisco.facet.util.emf.core.ICatalogManager; +import org.eclipse.modisco.facet.util.emf.core.ICatalogSetManager2; +import org.eclipse.modisco.facet.util.emf.core.exception.InvalidFacetSetException; +import org.eclipse.modisco.facet.util.emf.core.internal.Activator; +import org.eclipse.modisco.facet.util.pde.core.internal.exported.PluginUtils; +import org.osgi.framework.Bundle; + +@Deprecated +public class CatalogSetManager implements ICatalogSetManager2, Adapter { + + private static final String CATALOG_MGR_EXTENSION_POINT_ID = "org.eclipse.emf.facet.util.emf.core.catalogmanager"; //$NON-NLS-1$ + private static final String MODEL_DECLARATION_EXTENSION_POINT_ID = "org.eclipse.emf.facet.util.emf.core.modeldeclaration"; //$NON-NLS-1$ + private static final String CLASS = "class"; //$NON-NLS-1$ + private static final String FILE = "file"; //$NON-NLS-1$ + + /** + * The singleton instance of this {@link CatalogSetManager}. + */ + public static final CatalogSetManager INSTANCE = new CatalogSetManager(); + + private final Map<Resource, Bundle> resourceToBundleMap = new HashMap<Resource, Bundle>(); + private final ResourceSet resourceSet; + + private final List<ICatalogManager> catalogManagers = new ArrayList<ICatalogManager>(); + private final CatalogSet catalogSet; + + public CatalogSetManager() { + this.resourceSet = new ResourceSetImpl(); + this.catalogSet = CatalogFactory.eINSTANCE.createCatalogSet(); + initRegisteredEntries(); + } + + public CatalogSetManager(final ResourceSet resourceSet) { + this.resourceSet = resourceSet; + this.catalogSet = CatalogFactory.eINSTANCE.createCatalogSet(); + initRegisteredEntries(); + } + + private void initRegisteredEntries() { + final IExtensionRegistry registry = Platform.getExtensionRegistry(); + final IExtensionPoint extPointCatalogMgr = registry + .getExtensionPoint(CatalogSetManager.CATALOG_MGR_EXTENSION_POINT_ID); + if (extPointCatalogMgr != null) { + for (IExtension ext : extPointCatalogMgr.getExtensions()) { + for (IConfigurationElement configElt : ext + .getConfigurationElements()) { + ICatalogManager catalogMgr; + try { + catalogMgr = (ICatalogManager) configElt + .createExecutableExtension(CatalogSetManager.CLASS); + this.catalogManagers.add(catalogMgr); + catalogMgr.setCatalogSet(this.catalogSet); + } catch (CoreException e) { + Logger.logError(e, Activator.getDefault()); + } + } + } + } + IExtensionPoint modelDeclarationExtPoint = registry + .getExtensionPoint(CatalogSetManager.MODEL_DECLARATION_EXTENSION_POINT_ID); + if (modelDeclarationExtPoint != null) { + for (IExtension ext : modelDeclarationExtPoint.getExtensions()) { + for (IConfigurationElement configElt : ext + .getConfigurationElements()) { + String filePath = configElt + .getAttribute(CatalogSetManager.FILE); + if (filePath != null) { + String pluginName = ext.getNamespaceIdentifier(); + Bundle bundle = Platform.getBundle(pluginName); + URI uri = URI.createPlatformPluginURI(pluginName + "/" //$NON-NLS-1$ + + filePath, false); + try { + final Resource resource = this.resourceSet + .getResource(uri, true); + this.resourceToBundleMap.put(resource, bundle); + for (EObject root : resource.getContents()) { + for (ICatalogManager catalogMgr : this.catalogManagers) { + if (catalogMgr.canBeManaged(root)) { + catalogMgr.manage(root); + } + } + } + } catch (Exception e) { + Logger.logError(e, Activator.getDefault()); + } + } + } + } + } + } + + public CatalogSet getCatalogSet() { + return this.catalogSet; + } + + /** + * @author Nicolas Guyomar + * Modified by Emmanuelle Rouillé + */ + public Bundle getBundleByResource(final Resource eResource) { + if (eResource == null) { + throw new IllegalArgumentException("The resource cannot be null"); //$NON-NLS-1$ + } + if (eResource.getURI().scheme().equals("platform") && eResource.getURI().segment(0).equals("plugin")) { //$NON-NLS-1$//$NON-NLS-2$ + return Platform.getBundle(eResource.getURI().segment(1)); + } + return this.resourceToBundleMap.get(eResource); + } + + public void registerModelDeclaration(final IFile file) throws InvalidFacetSetException { + PluginUtils.register(file, CatalogSetManager.MODEL_DECLARATION_EXTENSION_POINT_ID, + "modeldeclaration"); //$NON-NLS-1$ + } + + public <T> List<T> getCatalogManagerByType(final Class<? extends T> catalogManagerClass) { + List<T> result = new ArrayList<T>(); + for (ICatalogManager catalogManager : this.catalogManagers) { + if (catalogManagerClass.isInstance(catalogManager)) { + @SuppressWarnings("unchecked") + /* + * @SuppressWarnings("unchecked"): gdupe> Checked by the call of + * 'isInstance' in the if statement + */ + final T catalogManager2 = (T) catalogManager; + result.add(catalogManager2); + } + } + return result; + } + + public void notifyChanged(final Notification notification) { + // Nothing to do + } + + public Notifier getTarget() { + return this.resourceSet; + } + + public void setTarget(final Notifier newTarget) { + // Nothing to do + } + + public boolean isAdapterForType(final Object type) { + return type == ICatalogSetManager2.class; + } + +}
diff --git a/org.eclipse.modisco.facet.util.emf.core/src/org/eclipse/modisco/facet/util/emf/core/internal/catalog/CatalogSetManagerFactory.java b/org.eclipse.modisco.facet.util.emf.core/src/org/eclipse/modisco/facet/util/emf/core/internal/catalog/CatalogSetManagerFactory.java new file mode 100644 index 0000000..6a28b41 --- /dev/null +++ b/org.eclipse.modisco.facet.util.emf.core/src/org/eclipse/modisco/facet/util/emf/core/internal/catalog/CatalogSetManagerFactory.java
@@ -0,0 +1,37 @@ +/** + * Copyright (c) 2012, 2015 Mia-Software. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Gregoire Dupe (Mia-Software) - Bug 369987 - [Restructuring][Table] Switch to the new customization and facet framework + * Grégoire Dupé (Mia-Software) - Bug 477657 - The catalog manager should be able to manage workspace model + */ +package org.eclipse.modisco.facet.util.emf.core.internal.catalog; + +import org.eclipse.emf.common.notify.Adapter; +import org.eclipse.emf.ecore.resource.ResourceSet; +import org.eclipse.modisco.facet.util.emf.core.ICatalogSetManager2; +import org.eclipse.modisco.facet.util.emf.core.ICatalogSetManagerFactory; + +@Deprecated +public class CatalogSetManagerFactory implements ICatalogSetManagerFactory { + + public ICatalogSetManager2 createICatalogSetManager(final ResourceSet resourceSet) { + CatalogSetManager result = null; + for (Adapter adapter : resourceSet.eAdapters()) { + if (adapter instanceof CatalogSetManager) { + result = (CatalogSetManager) adapter; + } + } + if (result == null) { + result = new CatalogSetManager(resourceSet); + resourceSet.eAdapters().add(result); + } + return result; + } + +}
diff --git a/org.eclipse.modisco.facet.util.emf.core/src/org/eclipse/modisco/facet/util/emf/core/internal/catalog/v2/CatalogListener.java b/org.eclipse.modisco.facet.util.emf.core/src/org/eclipse/modisco/facet/util/emf/core/internal/catalog/v2/CatalogListener.java new file mode 100644 index 0000000..b07234c --- /dev/null +++ b/org.eclipse.modisco.facet.util.emf.core/src/org/eclipse/modisco/facet/util/emf/core/internal/catalog/v2/CatalogListener.java
@@ -0,0 +1,179 @@ +/******************************************************************************* + * Copyright (c) 2015, 2016 Mia-Software. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Grégoire Dupé (Mia-Software) - Bug 477657 - The catalog manager should be able to manage workspace model + * Thomas Cicognani (Mia-Software) - Bug 483684 - NullPointerException on CatalogManager + * Grégoire Dupé (Mia-Software) - Bug 482887 - CatalogManager create files with too long name + *******************************************************************************/ +package org.eclipse.modisco.facet.util.emf.core.internal.catalog.v2; + +import java.io.IOException; +import java.util.Collection; +import java.util.HashMap; +import java.util.Map; + +import org.eclipse.emf.common.notify.Adapter; +import org.eclipse.emf.common.notify.Notification; +import org.eclipse.emf.common.notify.Notifier; +import org.eclipse.emf.common.util.URI; +import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.ecore.EReference; +import org.eclipse.emf.ecore.resource.Resource; +import org.eclipse.emf.ecore.xmi.XMLResource; +import org.eclipse.modisco.facet.util.core.Logger; +import org.eclipse.modisco.facet.util.emf.core.internal.Activator; + + +class CatalogListener implements Adapter { + +/* + private static final boolean DEBUG = DebugUtils.getDebugStatus(Activator + .getDefault()); +*/ + private final Resource resource; + + private static final Map<String, String> SAVE_OPTIONS = new HashMap<String, String>(); + static { + final String fileEncoding = System.getProperty("file.encoding"); //$NON-NLS-1$ + SAVE_OPTIONS.put(XMLResource.OPTION_ENCODING, fileEncoding); + } + + public CatalogListener(final Resource resource) { + this.resource = resource; + } + + private EObject target; + + public void notifyChanged(final Notification notification) { + final int eventType = notification.getEventType(); + switch (eventType) { + case Notification.SET: + notifyChangedForSet(notification); + break; + case Notification.ADD: + notifyChangedForAdd(notification); + break; + case Notification.ADD_MANY: + notifyChangedForAddMany(notification); + break; + case Notification.REMOVE: + notifyChangedForRemove(notification); + break; + case Notification.REMOVE_MANY: + notifyChangedForRemoveMany(notification); + break; + default: + break; + } + try { + final URI uri = this.resource.getURI(); + final String uriStr = uri.toString(); + if (!uriStr.startsWith("tmp")) { //$NON-NLS-1$ + this.resource.save(SAVE_OPTIONS); + } + } catch (IOException e) { + Logger.logError(e, Activator.getDefault()); + } + } + + private void notifyChangedForSet(final Notification notification) { + final Object newValue = notification.getNewValue(); + CatalogListenerFactory.adapt(newValue, this.resource); + } + + private static void notifyChangedForRemoveMany( + final Notification notification) { + @SuppressWarnings("unchecked") + /* + * @SuppressWarnings("unchecked") TCI> Safe cast + */ + final Collection<Object> oldValues = (Collection<Object>) notification + .getOldValue(); + ifIsContainement(notification, new Runnable() { + public void run() { + for (Object oldValuesItem : oldValues) { + CatalogListenerFactory.removeAdapter(oldValuesItem); + } + } + }); + } + + private static void notifyChangedForRemove(final Notification notification) { + final Object oldValue = notification.getOldValue(); + ifIsContainement(notification, new Runnable() { + public void run() { + CatalogListenerFactory.removeAdapter(oldValue); + } + }); + } + + private void notifyChangedForAddMany(final Notification notification) { + @SuppressWarnings("unchecked") + /* + * @SuppressWarnings("unchecked") TCI> Safe cast + */ + final Collection<Object> newValues = (Collection<Object>) notification + .getNewValue(); + ifIsContainement(notification, new Runnable() { + public void run() { + for (Object newValuesItem : newValues) { + CatalogListenerFactory.adapt(newValuesItem, + CatalogListener.this.getResource()); + } + } + }); + } + + private void notifyChangedForAdd(final Notification notification) { + final Object newValue = notification.getNewValue(); + ifIsContainement(notification, new Runnable() { + public void run() { + CatalogListenerFactory.adapt(newValue, + CatalogListener.this.getResource()); + } + }); + } + + protected Resource getResource() { + return this.resource; + } + + private static void ifIsContainement(final Notification notification, + final Runnable runnable) { + final Object feature = notification.getFeature(); + if (feature instanceof EReference + && ((EReference) feature).isContainment()) { + runnable.run(); + } + } + + public Notifier getTarget() { + return this.target; + } + + public void setTarget(final Notifier newTarget) { + if (newTarget instanceof EObject) { + this.target = (EObject) newTarget; + propagate(newTarget); + } + } + + private void propagate(final Notifier newTarget) { + if (newTarget instanceof EObject) { + final EObject eObject = (EObject) newTarget; + for (final EObject subEObject : eObject.eContents()) { + CatalogListenerFactory.adaptResource(subEObject, this.resource); + } + } + } + + public boolean isAdapterForType(final Object type) { + return EObject.class.isInstance(type); + } + +}
diff --git a/org.eclipse.modisco.facet.util.emf.core/src/org/eclipse/modisco/facet/util/emf/core/internal/catalog/v2/CatalogListenerFactory.java b/org.eclipse.modisco.facet.util.emf.core/src/org/eclipse/modisco/facet/util/emf/core/internal/catalog/v2/CatalogListenerFactory.java new file mode 100644 index 0000000..0e7ef49 --- /dev/null +++ b/org.eclipse.modisco.facet.util.emf.core/src/org/eclipse/modisco/facet/util/emf/core/internal/catalog/v2/CatalogListenerFactory.java
@@ -0,0 +1,118 @@ +/******************************************************************************* + * Copyright (c) 2015, 2016 Mia-Software. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Grégoire Dupé (Mia-Software) - Bug 477657 - The catalog manager should be able to manage workspace model + * Grégoire Dupé (Mia-Software) - Bug 482887 - CatalogManager create files with too long name + *******************************************************************************/ +package org.eclipse.modisco.facet.util.emf.core.internal.catalog.v2; + +import org.eclipse.emf.common.notify.Adapter; +import org.eclipse.emf.common.notify.AdapterFactory; +import org.eclipse.emf.common.notify.Notifier; +import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.ecore.resource.Resource; +import org.eclipse.modisco.facet.util.core.DebugUtils; +import org.eclipse.modisco.facet.util.emf.core.internal.Activator; + + +public class CatalogListenerFactory implements AdapterFactory { + + private static final boolean DEBUG = DebugUtils.getDebugStatus(Activator + .getDefault()); + + public boolean isFactoryForType(final Object type) { + return type == CatalogListener.class; + } + + public Object adapt(final Object object, final Object type) { + Object result = null; + if (object instanceof Notifier) { + result = adapt((Notifier) object, type); + } + return result; + } + + public static void adapt(final Object object, + final Resource resource) { + if (object instanceof EObject) { + final EObject eObject = (EObject) object; + adaptResource(eObject, resource); + } + } + + public Adapter adapt(final Notifier target, final Object type) { + Adapter result = null; + if ((isFactoryForType(type)) && (target instanceof EObject)) { + final EObject eObject = (EObject) target; + result = adapt(target, eObject); + } + return result; + } + + public static CatalogListener adaptResource(final Notifier target, + final Resource resource) { + CatalogListener result = findAdatper(target); + if (result == null) { + result = adaptNew(target, resource); + } + return result; + } + + private static CatalogListener findAdatper(final Notifier target) { + CatalogListener result = null; + for (final Adapter adapter : target.eAdapters()) { + if (adapter instanceof CatalogListener) { + result = (CatalogListener) adapter; + break; + } + } + return result; + } + + private static CatalogListener adaptNew(final Notifier target, + final Resource resource) { + if (DEBUG) { + DebugUtils.debug(target.toString()); + } + final CatalogListener result = new CatalogListener(resource); + target.eAdapters().add(result); + return result; + } + + public Adapter adaptNew(final Notifier target, final Object type) { + Adapter result = null; + if ((type == CatalogListener.class) && (target instanceof EObject)) { + final EObject eObject = (EObject) target; + result = adapt(target, eObject); + } + return result; + } + + public void adaptAllNew(final Notifier notifier) { + if (notifier instanceof EObject) { + final EObject eObject = (EObject) notifier; + adapt(notifier, eObject); + } + } + + public static void removeAdapter(final Object oldValue) { + if (DEBUG) { + DebugUtils.debug(oldValue.toString()); + } + if (oldValue instanceof EObject) { + final EObject notifier = (EObject) oldValue; + final CatalogListener validationAdapter = findAdatper(notifier); + if (validationAdapter != null) { + notifier.eAdapters().remove(validationAdapter); + for (EObject subEObject : notifier.eContents()) { + removeAdapter(subEObject); + } + } + } + } +}
diff --git a/org.eclipse.modisco.facet.util.emf.core/src/org/eclipse/modisco/facet/util/emf/core/internal/catalog/v2/CatalogManager.java b/org.eclipse.modisco.facet.util.emf.core/src/org/eclipse/modisco/facet/util/emf/core/internal/catalog/v2/CatalogManager.java new file mode 100644 index 0000000..d79164d --- /dev/null +++ b/org.eclipse.modisco.facet.util.emf.core/src/org/eclipse/modisco/facet/util/emf/core/internal/catalog/v2/CatalogManager.java
@@ -0,0 +1,239 @@ +/******************************************************************************* + * Copyright (c) 2015, 2017 Mia-Software. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Grégoire Dupé (Mia-Software) - Bug 477657 - The catalog manager should be able to manage workspace model + * Thomas Cicognani (Mia-Software) - Bug 483684 - NullPointerException on CatalogManager + * Thomas Cicognani (Mia-Software) - Bug 482887 - CatalogManager create files with to long name + * Grégoire Dupé (Mia-Software) - Bug 482887 - CatalogManager create files with too long name + * Grégoire Dupé (Mia-Software) - Bug 516254 - CatalogManager must not return workspace entries from closed project + *******************************************************************************/ +package org.eclipse.modisco.facet.util.emf.core.internal.catalog.v2; + +import java.io.FileNotFoundException; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import org.eclipse.core.resources.IProject; +import org.eclipse.core.runtime.IConfigurationElement; +import org.eclipse.core.runtime.IExtension; +import org.eclipse.core.runtime.IExtensionPoint; +import org.eclipse.core.runtime.IExtensionRegistry; +import org.eclipse.core.runtime.Platform; +import org.eclipse.emf.common.notify.Adapter; +import org.eclipse.emf.common.notify.Notification; +import org.eclipse.emf.common.notify.Notifier; +import org.eclipse.emf.common.util.EList; +import org.eclipse.emf.common.util.URI; +import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.ecore.resource.Resource; +import org.eclipse.emf.ecore.resource.ResourceSet; +import org.eclipse.modisco.facet.util.core.Logger; +import org.eclipse.modisco.facet.util.emf.catalog.metamodel.internal.v1_1.catalog.CatalogFactory; +import org.eclipse.modisco.facet.util.emf.catalog.metamodel.internal.v1_1.catalog.InstallAndWokspaceCatalog; +import org.eclipse.modisco.facet.util.emf.core.catalog.ICatalogManager; +import org.eclipse.modisco.facet.util.emf.core.catalog.ICatalogManagerConfiguration; +import org.eclipse.modisco.facet.util.emf.core.internal.Activator; +import org.osgi.framework.Bundle; + +final class CatalogManager implements ICatalogManager, Adapter { + + private static final String MODEL_DECL_EXT_PT = "org.eclipse.emf.facet.util.emf.core.modeldeclaration"; //$NON-NLS-1$ + private static final String FILE = "file"; //$NON-NLS-1$ + private final Map<Resource, Bundle> resourceToBundle = new HashMap<Resource, Bundle>(); + private final ICatalogManagerConfiguration catalogMgrconfig; + private InstallAndWokspaceCatalog catalog; + private final ResourceSet resourceSet; + private final String catalogId; + private Resource resource; + + public CatalogManager(final ICatalogManagerConfiguration catalogMgrconfig, + final ResourceSet resourceSet, final String catalogId) { + this.resourceSet = resourceSet; + this.catalogMgrconfig = catalogMgrconfig; + this.catalogId = catalogId; + URI uri; + if (catalogId == null) { + final String uriStr = String.format("tmp://%s", //$NON-NLS-1$ + this.getClass().getName()); + uri = URI.createURI(uriStr); + } else { + final String uriStr = String.format("platform:/meta/%s/%s.xmi", //$NON-NLS-1$ + Activator.getDefault().getBundle().getSymbolicName(), + catalogId); + uri = URI.createURI(uriStr); + } + if (catalogId == null) { + this.resource = this.resourceSet.createResource(uri); + } else { + try { + this.resource = this.resourceSet.getResource(uri, true); + } catch (org.eclipse.emf.common.util.WrappedException e) { + if (!(e.getCause() instanceof FileNotFoundException)) { + Logger.logError(e, Activator.getDefault()); + } + this.resource = this.resourceSet.createResource(uri); + } + } + if ((!this.resource.getContents().isEmpty()) + && this.resource.getContents().get(0) instanceof InstallAndWokspaceCatalog) { + this.catalog = (InstallAndWokspaceCatalog) this.resource.getContents().get(0); + removeNotResolvedProxy(this.catalog.getWorkspaceEntries()); + removeNotResolvedProxy(this.catalog.getInstalledEntries()); + } else { + this.catalog = CatalogFactory.eINSTANCE.createInstallAndWokspaceCatalog(); + EmfCommandUtils.executeAdd(this.resource, this.catalog); + } + initRegisteredEntries(); + CatalogListenerFactory.adaptResource(this.catalog, this.resource); + } + + private void removeNotResolvedProxy(final EList<EObject> eObjects) { + final List<EObject> toBeRemoved = new ArrayList<EObject>(); + for (EObject entry : eObjects) { + if (entry.eIsProxy()) { + toBeRemoved.add(entry); + } + } + EmfCommandUtils.executeRemove(eObjects, toBeRemoved, this.resource); + } + + private void initRegisteredEntries() { + final IExtensionRegistry registry = Platform.getExtensionRegistry(); + final IExtensionPoint modelDeclExtPoint = registry + .getExtensionPoint(CatalogManager.MODEL_DECL_EXT_PT); + if (modelDeclExtPoint != null) { + for (IExtension ext : modelDeclExtPoint.getExtensions()) { + for (IConfigurationElement configElt : ext.getConfigurationElements()) { + final String filePath = configElt.getAttribute(CatalogManager.FILE); + if (filePath != null) { + final String pluginName = ext.getNamespaceIdentifier(); + final Bundle bundle = Platform.getBundle(pluginName); + final URI uri = URI.createPlatformPluginURI(pluginName + + "/" + filePath, false); //$NON-NLS-1$ + try { + final Resource resource = this.resourceSet.getResource(uri, true); + this.resourceToBundle.put(resource, bundle); + for (EObject root : resource.getContents()) { + this.onInstalledModelFound(root); + } + } catch (Exception e) { + Logger.logError(e, Activator.getDefault()); + } + } + } + } + } + } + + private void onInstalledModelFound(final EObject root) { + if (this.catalogMgrconfig.canBeManaged(root) && this.catalogMgrconfig.isValid(root)) { + this.catalog.getInstalledEntries().add(root); + } + } + + public <T> List<T> getEntries(final Class<T> expectedClass) { + final List<T> result = new ArrayList<T>(); + final List<T> filteredEntries = getInstalledEntries(expectedClass); + result.addAll(filteredEntries); + final List<T> wsEntriesFiltered = getWsEntries(expectedClass); + result.addAll(wsEntriesFiltered); + return result; + } + + public <T> List<T> getWsEntries(final Class<T> expectedClass) { + final List<T> result = new ArrayList<T>(); + for (EObject eObject : this.catalog.getWorkspaceEntries()) { + if (expectedClass.isInstance(eObject) + && EmfUtils.isDataAccessible(eObject)) { + @SuppressWarnings("unchecked") + /* + * @SuppressWarnings("unchecked"): gdupe> Checked by the call of + * 'isInstance' in the 'if' statement + */ + final T tObject = (T) eObject; + result.add(tObject); + } + } + return result; + } + + public <T> List<T> getInstalledEntries(final Class<T> expectedClass) { + final List<T> result = new ArrayList<T>(); + for (EObject eObject : this.catalog.getInstalledEntries()) { + if (expectedClass.isInstance(eObject)) { + @SuppressWarnings("unchecked") + /* + * @SuppressWarnings("unchecked"): gdupe> Checked by the call of + * 'isInstance' in the 'if' statement + */ + final T tObject = (T) eObject; + result.add(tObject); + } + } + return result; + } + + public boolean addWsEntry(final EObject entry) { + boolean result = false; + if (this.catalogMgrconfig.canBeManaged(entry) + && this.catalogMgrconfig.isValid(entry)) { + this.catalog.getWorkspaceEntries().add(entry); + result = true; + } + return result; + } + + public void removeWsEntry(final EObject entry) { + this.catalog.getWorkspaceEntries().remove(entry); + } + + public void removeAllWsEntries(final IProject project) { + final List<EObject> toBeRemoved = new ArrayList<EObject>(); + final List<EObject> wsEntries = getWsEntries(EObject.class); + for (EObject registered : wsEntries) { + final Resource eResource = registered.eResource(); + if (eResource == null || registered.eIsProxy()) { + /* + * Case where it is impossible to get the Resource (e.g. the + * linked object [registered] was deleted) + */ + toBeRemoved.add(registered); + } else { + final URI uri = eResource.getURI(); + final String uriStr = uri.toString(); + if (uriStr + .startsWith("platform:/resource/" + project.getName())) { //$NON-NLS-1$ + toBeRemoved.add(registered); + } + } + } + this.catalog.getWorkspaceEntries().removeAll(toBeRemoved); + } + + public String getCatalogId() { + return this.catalogId; + } + + public void notifyChanged(final Notification notification) { + // Nothing to do + } + + public Notifier getTarget() { + return this.resourceSet; + } + + public void setTarget(final Notifier newTarget) { + // Nothing to do + } + + public boolean isAdapterForType(final Object type) { + return type == ICatalogManager.class; + } +}
diff --git a/org.eclipse.modisco.facet.util.emf.core/src/org/eclipse/modisco/facet/util/emf/core/internal/catalog/v2/CatalogManagerFactory.java b/org.eclipse.modisco.facet.util.emf.core/src/org/eclipse/modisco/facet/util/emf/core/internal/catalog/v2/CatalogManagerFactory.java new file mode 100644 index 0000000..af96b59 --- /dev/null +++ b/org.eclipse.modisco.facet.util.emf.core/src/org/eclipse/modisco/facet/util/emf/core/internal/catalog/v2/CatalogManagerFactory.java
@@ -0,0 +1,55 @@ +/******************************************************************************* + * Copyright (c) 2015, 2016 Mia-Software. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Grégoire Dupé (Mia-Software) - Bug 477657 - The catalog manager should be able to manage workspace model + * Grégoire Dupé (Mia-Software) - Bug 482887 - CatalogManager create files with too long name + *******************************************************************************/ +package org.eclipse.modisco.facet.util.emf.core.internal.catalog.v2; + +import org.eclipse.emf.common.notify.Adapter; +import org.eclipse.emf.ecore.resource.ResourceSet; +import org.eclipse.modisco.facet.util.emf.core.catalog.ICatalogManager; +import org.eclipse.modisco.facet.util.emf.core.catalog.ICatalogManagerConfiguration; +import org.eclipse.modisco.facet.util.emf.core.catalog.ICatalogManagerFactory; + +public class CatalogManagerFactory implements ICatalogManagerFactory { + + public ICatalogManager getOrCreateCatalogManager( + final ICatalogManagerConfiguration catalogMgrconfig, + final ResourceSet resourceSet, final String catalogId) { + CatalogManager result = searchExistingMgr(resourceSet, catalogId); + if (result == null) { + result = new CatalogManager(catalogMgrconfig, resourceSet, catalogId); + resourceSet.eAdapters().add(result); + } + return result; + } + + public ICatalogManager createCatalogManager( + final ICatalogManagerConfiguration catalogMgrconfig, + final ResourceSet resourceSet) { + final CatalogManager result = new CatalogManager( + catalogMgrconfig, resourceSet, null); + resourceSet.eAdapters().add(result); + return result; + } + + private static CatalogManager searchExistingMgr( + final ResourceSet resourceSet, final String catalogId) { + CatalogManager result = null; + for (Adapter adapter : resourceSet.eAdapters()) { + if (adapter instanceof CatalogManager) { + final CatalogManager candidate = (CatalogManager) adapter; + if (candidate.getCatalogId().equals(catalogId)) { + result = (CatalogManager) adapter; + } + } + } + return result; + } +}
diff --git a/org.eclipse.modisco.facet.util.emf.core/src/org/eclipse/modisco/facet/util/emf/core/internal/catalog/v2/EmfCommandUtils.java b/org.eclipse.modisco.facet.util.emf.core/src/org/eclipse/modisco/facet/util/emf/core/internal/catalog/v2/EmfCommandUtils.java new file mode 100644 index 0000000..22a39de --- /dev/null +++ b/org.eclipse.modisco.facet.util.emf.core/src/org/eclipse/modisco/facet/util/emf/core/internal/catalog/v2/EmfCommandUtils.java
@@ -0,0 +1,58 @@ +/******************************************************************************* + * Copyright (c) 2017 Mia-Software. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Grégoire Dupé (Mia-Software) - Bug 516254 - CatalogManager must not return workspace entries from closed project + *******************************************************************************/ +package org.eclipse.modisco.facet.util.emf.core.internal.catalog.v2; + +import java.util.List; + +import org.eclipse.emf.common.command.Command; +import org.eclipse.emf.common.util.EList; +import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.ecore.resource.Resource; +import org.eclipse.emf.edit.command.AddCommand; +import org.eclipse.emf.edit.command.RemoveCommand; +import org.eclipse.emf.transaction.TransactionalEditingDomain; +import org.eclipse.emf.transaction.util.TransactionUtil; +import org.eclipse.modisco.facet.util.emf.catalog.metamodel.internal.v1_1.catalog.InstallAndWokspaceCatalog; + +public final class EmfCommandUtils { + + private EmfCommandUtils() { + // Must not be used + } + + public static void executeRemove(final EList<EObject> eObjects, + final List<EObject> toBeRemoved, final Resource resource) { + final TransactionalEditingDomain editingDomain = TransactionUtil + .getEditingDomain(resource); + if (editingDomain == null) { + eObjects.removeAll(toBeRemoved); + } else { + final Command command = new RemoveCommand(editingDomain, eObjects, + toBeRemoved); + editingDomain.getCommandStack().execute(command); + } + } + + public static void executeAdd(final Resource resource, + final InstallAndWokspaceCatalog catalog) { + final TransactionalEditingDomain editingDomain = TransactionUtil + .getEditingDomain(resource); + final EList<EObject> contents = resource.getContents(); + if (editingDomain == null) { + contents.add(catalog); + } else { + final Command command = new AddCommand(editingDomain, contents, + catalog); + editingDomain.getCommandStack().execute(command); + } + } + +}
diff --git a/org.eclipse.modisco.facet.util.emf.core/src/org/eclipse/modisco/facet/util/emf/core/internal/catalog/v2/EmfUtils.java b/org.eclipse.modisco.facet.util.emf.core/src/org/eclipse/modisco/facet/util/emf/core/internal/catalog/v2/EmfUtils.java new file mode 100644 index 0000000..fb09721 --- /dev/null +++ b/org.eclipse.modisco.facet.util.emf.core/src/org/eclipse/modisco/facet/util/emf/core/internal/catalog/v2/EmfUtils.java
@@ -0,0 +1,54 @@ +/******************************************************************************* + * Copyright (c) 2017 Mia-Software. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Grégoire Dupé (Mia-Software) - Bug 516254 - CatalogManager must not return workspace entries from closed project + * Thomas Cicognani (Mia-Software) - Bug 521883 - Cannot get IProject from URI if name contains spaces + *******************************************************************************/ +package org.eclipse.modisco.facet.util.emf.core.internal.catalog.v2; + +import org.eclipse.core.resources.IProject; +import org.eclipse.core.resources.IWorkspace; +import org.eclipse.core.resources.IWorkspaceRoot; +import org.eclipse.core.resources.ResourcesPlugin; +import org.eclipse.emf.common.util.URI; +import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.ecore.util.EcoreUtil; + +public final class EmfUtils { + + private EmfUtils() { + // Must not be used + } + + public static boolean isDataAccessible(final EObject eObject) { + boolean result = true; + final URI uri = EcoreUtil.getURI(eObject); + if (uri.isPlatformResource()) { + final IProject project = getProject(uri); + result = project.isOpen(); + } + return result; + } + + public static IProject getProject(final URI uri) { + IProject result = null; + final String prjName = uri.segment(1); + result = getProject(prjName); + if (result == null || !result.exists()) { + final String decodedPrjName = URI.decode(prjName); + result = getProject(decodedPrjName); + } + return result; + } + + private static IProject getProject(final String prjName) { + final IWorkspace workspace = ResourcesPlugin.getWorkspace(); + final IWorkspaceRoot root = workspace.getRoot(); + return root.getProject(prjName); + } +}
diff --git a/org.eclipse.modisco.facet.util.emf.core/src/org/eclipse/modisco/facet/util/emf/core/internal/command/AddResourceContentCommand.java b/org.eclipse.modisco.facet.util.emf.core/src/org/eclipse/modisco/facet/util/emf/core/internal/command/AddResourceContentCommand.java new file mode 100644 index 0000000..61e4ce1 --- /dev/null +++ b/org.eclipse.modisco.facet.util.emf.core/src/org/eclipse/modisco/facet/util/emf/core/internal/command/AddResourceContentCommand.java
@@ -0,0 +1,97 @@ +/** + * Copyright (c) 2017 Soft-Maint. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Jonathan Pepin (Soft-Maint) - Bug 516701 - Command factory to add content to resource + */ +package org.eclipse.modisco.facet.util.emf.core.internal.command; + +import java.util.ArrayList; +import java.util.Collection; + +import org.eclipse.emf.common.command.Command; +import org.eclipse.emf.common.command.CompoundCommand; +import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.ecore.resource.Resource; +import org.eclipse.modisco.facet.util.emf.core.command.ILockableUndoCommand; +import org.eclipse.modisco.facet.util.emf.core.internal.Messages; + +/** + * This command has to be used to add content to a resource + */ +public class AddResourceContentCommand implements Command, ILockableUndoCommand { + + private final Collection<EObject> newContent; + private final Resource resource; + private boolean enableUndo = true; + + /** + * @param resource the resource of which we want to add the content. + * @param content a list of EObject to add as the content of the resource + */ + public AddResourceContentCommand(final Resource resource, final Collection<EObject> content) { + this.resource = resource; + this.newContent = content; + } + + public boolean canExecute() { + return true; + } + + public void execute() { + this.resource.getContents().addAll(this.newContent); + } + + public boolean canUndo() { + return this.enableUndo; + } + + public void undo() { + this.resource.getContents().removeAll(this.newContent); + } + + public void redo() { + this.resource.getContents().addAll(this.newContent); + } + + public Collection<?> getResult() { + final Collection<Resource> result = new ArrayList<Resource>(); + result.add(this.resource); + return result; + } + + public Collection<?> getAffectedObjects() { + final Collection<Object> affectedObjects = new ArrayList<Object>(); + affectedObjects.add(this.resource); + affectedObjects.addAll(this.newContent); + return affectedObjects; + } + + public String getLabel() { + return Messages.AddResourceContentCommand_Label; + } + + public String getDescription() { + return Messages.AddResourceContentCommand_Description; + } + + public void dispose() { + // do nothing + } + + public Command chain(final Command command) { + final CompoundCommand result = new CompoundCommand(); + result.append(this); + result.append(command); + return result; + } + + public void enableCanUndo(final boolean enable) { + this.enableUndo = enable; + } + +}
diff --git a/org.eclipse.modisco.facet.util.emf.core/src/org/eclipse/modisco/facet/util/emf/core/internal/command/CommandFactoryResult.java b/org.eclipse.modisco.facet.util.emf.core/src/org/eclipse/modisco/facet/util/emf/core/internal/command/CommandFactoryResult.java new file mode 100644 index 0000000..0a70929 --- /dev/null +++ b/org.eclipse.modisco.facet.util.emf.core/src/org/eclipse/modisco/facet/util/emf/core/internal/command/CommandFactoryResult.java
@@ -0,0 +1,35 @@ +/** + * Copyright (c) 2012 Mia-Software. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Gregoire Dupe (Mia-Software) - Bug 369987 - [Restructuring][Table] Switch to the new customization and facet framework + */ +package org.eclipse.modisco.facet.util.emf.core.internal.command; + +import org.eclipse.emf.common.command.Command; +import org.eclipse.modisco.facet.util.emf.core.command.ICommandFactoryResult; + +public class CommandFactoryResult<T> implements ICommandFactoryResult<T> { + + private final Command cmd; + private final T result; + + public CommandFactoryResult(final Command cmd, final T result) { + this.cmd = cmd; + this.result = result; + } + + public Command getCommand() { + return this.cmd; + } + + public T getResult() { + return this.result; + } + +}
diff --git a/org.eclipse.modisco.facet.util.emf.core/src/org/eclipse/modisco/facet/util/emf/core/internal/command/CommandFactoryResultFactory.java b/org.eclipse.modisco.facet.util.emf.core/src/org/eclipse/modisco/facet/util/emf/core/internal/command/CommandFactoryResultFactory.java new file mode 100644 index 0000000..f785b79 --- /dev/null +++ b/org.eclipse.modisco.facet.util.emf.core/src/org/eclipse/modisco/facet/util/emf/core/internal/command/CommandFactoryResultFactory.java
@@ -0,0 +1,23 @@ +/** + * Copyright (c) 2012 Mia-Software. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Gregoire Dupe (Mia-Software) - Bug 369987 - [Restructuring][Table] Switch to the new customization and facet framework + */ +package org.eclipse.modisco.facet.util.emf.core.internal.command; + +import org.eclipse.emf.common.command.Command; +import org.eclipse.modisco.facet.util.emf.core.command.ICommandFactoryResult; +import org.eclipse.modisco.facet.util.emf.core.command.ICommandFactoryResultFactory; + +public class CommandFactoryResultFactory implements ICommandFactoryResultFactory { + + public <T> ICommandFactoryResult<T> createCommandFactoryResult(final Command command, final T result) { + return new CommandFactoryResult<T>(command, result); + } +}
diff --git a/org.eclipse.modisco.facet.util.emf.core/src/org/eclipse/modisco/facet/util/emf/core/internal/command/SetResourceContentCommand.java b/org.eclipse.modisco.facet.util.emf.core/src/org/eclipse/modisco/facet/util/emf/core/internal/command/SetResourceContentCommand.java new file mode 100644 index 0000000..a1fc09a --- /dev/null +++ b/org.eclipse.modisco.facet.util.emf.core/src/org/eclipse/modisco/facet/util/emf/core/internal/command/SetResourceContentCommand.java
@@ -0,0 +1,105 @@ +/** + * Copyright (c) 2011, 2017 CEA LIST, and Soft-Maint. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Gregoire Dupe (Mia-Software) - Bug 345730 - Deleting an element in the model breaks the table + * Jonathan Pepin (Soft-Maint) - Bug 516701 - Command factory to add content to resource + */ +package org.eclipse.modisco.facet.util.emf.core.internal.command; + +import java.util.ArrayList; +import java.util.Collection; + +import org.eclipse.emf.common.command.Command; +import org.eclipse.emf.common.util.EList; +import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.ecore.resource.Resource; +import org.eclipse.modisco.facet.util.emf.core.command.ILockableUndoCommand; +import org.eclipse.modisco.facet.util.emf.core.internal.Messages; + +/** + * This command has to be used to set the content of a resource + */ +public class SetResourceContentCommand implements Command, ILockableUndoCommand { + private EList<EObject> oldContent = null; + private Collection<EObject> newContent = null; + private Resource resource; + private boolean enableUndo = true; + + /** + * @param resource the resource of which we want to set the content. + * @param content a list of EObject to set as the content of the resource + */ + public SetResourceContentCommand(final Resource resource, final Collection<EObject> content) { + this.resource = resource; + this.newContent = content; + } + + public boolean canExecute() { + return true; + } + + public void execute() { + this.oldContent = this.resource.getContents(); + this.resource.getContents().clear(); + this.resource.getContents().addAll(this.newContent); + + } + + public boolean canUndo() { + boolean canUndo = (this.enableUndo && (this.oldContent != null)); + return canUndo; + } + + public void undo() { + this.resource.getContents().clear(); + this.resource.getContents().addAll(this.oldContent); + + } + + public void redo() { + this.resource.getContents().clear(); + this.resource.getContents().addAll(this.newContent); + } + + public Collection<?> getResult() { + Collection<Resource> result = new ArrayList<Resource>(); + result.add(this.resource); + return result; + } + + public Collection<?> getAffectedObjects() { + Collection<Object> affectedObjects = new ArrayList<Object>(); + affectedObjects.add(this.resource); + affectedObjects.addAll(this.newContent); + affectedObjects.addAll(this.oldContent); + return affectedObjects; + } + + public String getLabel() { + return Messages.SetResourceContentCommand_Label; + } + + public String getDescription() { + return Messages.SetResourceContentCommand_Description; + } + + public void dispose() { + this.oldContent = null; + this.newContent = null; + this.resource = null; + } + + public Command chain(final Command command) { + return null; + } + + public void enableCanUndo(final boolean enable) { + this.enableUndo = enable; + } + +}
diff --git a/org.eclipse.modisco.facet.util.emf.core/src/org/eclipse/modisco/facet/util/emf/core/internal/exported/ICommandFactory.java b/org.eclipse.modisco.facet.util.emf.core/src/org/eclipse/modisco/facet/util/emf/core/internal/exported/ICommandFactory.java new file mode 100644 index 0000000..e460640 --- /dev/null +++ b/org.eclipse.modisco.facet.util.emf.core/src/org/eclipse/modisco/facet/util/emf/core/internal/exported/ICommandFactory.java
@@ -0,0 +1,71 @@ +/******************************************************************************* + * Copyright (c) 2010 CEA LIST. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Nicolas Bros (Mia-Software) - initial API and implementation + * Gregoire Dupe (Mia-Software) - Bug 369987 - [Restructuring][Table] Switch to the new customization and facet framework + *******************************************************************************/ +package org.eclipse.modisco.facet.util.emf.core.internal.exported; + +import org.eclipse.emf.common.command.Command; +import org.eclipse.emf.edit.command.AddCommand; +import org.eclipse.emf.edit.command.MoveCommand; +import org.eclipse.emf.edit.command.RemoveCommand; +import org.eclipse.emf.edit.command.SetCommand; +import org.eclipse.emf.edit.domain.EditingDomain; + +/** + * Creates {@link Command}s for a specific {@link EditingDomain}. + * <p> + * See also {@link ICommandFactoriesRegistry} + * + * @since 0.2 + */ +// Copied from org.eclipse.emf.facet.widgets.celleditors.ICommandFactory +public interface ICommandFactory { + /** + * Whether this command factory should be used for the given {@link EditingDomain} + */ + boolean handles(EditingDomain editingDomain); + + /** + * This creates a {@link SetCommand} to set the owner's feature to the specified value. + */ + Command createSetCommand(EditingDomain domain, Object owner, Object feature, Object value); + + /** + * This creates a {@link SetCommand} to set the owner's feature to the specified value at the + * specified index. + */ + Command createSetCommand(EditingDomain domain, Object owner, Object feature, + Object value, int index); + + /** + * This creates a {@link MoveCommand} to move a particular value to a particular index in the + * specified feature of the owner. The feature will often be <code>null</code> because the + * domain will deduce it. + */ + Command createMoveCommand(EditingDomain domain, Object owner, Object feature, Object value, + int index); + + /** + * This creates an {@link AddCommand} to add a particular value to the specified feature of the + * owner. The feature will often be <code>null</code> because the domain will deduce it. + */ + Command createAddCommand(EditingDomain domain, Object owner, Object feature, Object value); + + /** + * This creates a {@link RemoveCommand} to remove a particular value from the specified feature + * of the owner. + */ + Command createRemoveCommand(EditingDomain domain, Object owner, Object feature, Object value); + + /** This creates a command that deletes the given object. */ + Command createDeleteCommand(EditingDomain domain, Object object); + +}
diff --git a/org.eclipse.modisco.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/internal/messages.properties b/org.eclipse.modisco.facet.util.emf.core/src/org/eclipse/modisco/facet/util/emf/core/internal/messages.properties similarity index 100% rename from org.eclipse.modisco.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/internal/messages.properties rename to org.eclipse.modisco.facet.util.emf.core/src/org/eclipse/modisco/facet/util/emf/core/internal/messages.properties
diff --git a/org.eclipse.modisco.facet.util.emf.core/src/org/eclipse/modisco/facet/util/emf/core/internal/preferences/PreferenceConstants.java b/org.eclipse.modisco.facet.util.emf.core/src/org/eclipse/modisco/facet/util/emf/core/internal/preferences/PreferenceConstants.java new file mode 100644 index 0000000..eaf4be0 --- /dev/null +++ b/org.eclipse.modisco.facet.util.emf.core/src/org/eclipse/modisco/facet/util/emf/core/internal/preferences/PreferenceConstants.java
@@ -0,0 +1,26 @@ +/** + * Copyright (c) 2011 Mia-Software. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Nicolas Guyomar (Mia-Software) - Bug 333652 Extension point offering the possibility to declare an EPackage browser + * Fabien Giquel (Mia-Software) + * Nicolas Bros (Mia-Software) - Bug 335218 - Extension point for registering EObject, EPackage, model editor + */ +package org.eclipse.modisco.facet.util.emf.core.internal.preferences; + +public final class PreferenceConstants { + + private PreferenceConstants() { + // constants class: no need to instantiate + } + + public static final String P_DEFAULT_EPACKAGE_VIEWER = "emf_facet_default_epackage_viewer"; //$NON-NLS-1$ + public static final String P_DEFAULT_EOBJECT_VIEWER = "emf_facet_default_eobject_viewer"; //$NON-NLS-1$ + public static final String P_DEFAULT_RESOURCE_VIEWER = "emf_facet_default_resource_viewer"; //$NON-NLS-1$ + +}
diff --git a/org.eclipse.modisco.facet.util.emf.core/src/org/eclipse/modisco/facet/util/emf/core/internal/preferences/PreferenceInitializer.java b/org.eclipse.modisco.facet.util.emf.core/src/org/eclipse/modisco/facet/util/emf/core/internal/preferences/PreferenceInitializer.java new file mode 100644 index 0000000..7ec91f6 --- /dev/null +++ b/org.eclipse.modisco.facet.util.emf.core/src/org/eclipse/modisco/facet/util/emf/core/internal/preferences/PreferenceInitializer.java
@@ -0,0 +1,54 @@ +/** + * Copyright (c) 2011 Mia-Software. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Nicolas Guyomar (Mia-Software) - Bug 333652 Extension point offering the possibility to declare an EPackage browser + * Nicolas Bros (Mia-Software) - Bug 335218 - Extension point for registering EObject, EPackage, model editor + * Laurent Pichierri (Soft-Maint) - Bug 371204 - Compatibility with Helios + */ +package org.eclipse.modisco.facet.util.emf.core.internal.preferences; + +import org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer; +import org.eclipse.core.runtime.preferences.DefaultScope; +import org.eclipse.core.runtime.preferences.IEclipsePreferences; +import org.eclipse.modisco.facet.util.emf.core.IBrowserRegistry; +import org.eclipse.modisco.facet.util.emf.core.IEObjectBrowserOpener; +import org.eclipse.modisco.facet.util.emf.core.IEPackageBrowserOpener; +import org.eclipse.modisco.facet.util.emf.core.IResourceBrowserOpener; +import org.eclipse.modisco.facet.util.emf.core.internal.Activator; + +public class PreferenceInitializer extends AbstractPreferenceInitializer { + + @Override + public void initializeDefaultPreferences() { + IEclipsePreferences preferenceNode = new DefaultScope().getNode(Activator.PLUGIN_ID); + // general rule is to keep the same behavior as EMF by default + IEObjectBrowserOpener defaultEObjectBrowserOpener = IBrowserRegistry.INSTANCE + .getDefaultEObjectBrowserOpener(); + if (defaultEObjectBrowserOpener != null) { + preferenceNode.put(PreferenceConstants.P_DEFAULT_EOBJECT_VIEWER, + defaultEObjectBrowserOpener.getClass().getName()); + } + + IEPackageBrowserOpener defaultEPackageBrowserOpener = IBrowserRegistry.INSTANCE + .getDefaultEPackageBrowserOpener(); + if (defaultEPackageBrowserOpener != null) { + preferenceNode.put(PreferenceConstants.P_DEFAULT_EPACKAGE_VIEWER, + defaultEPackageBrowserOpener.getClass().getName()); + } + + IResourceBrowserOpener defaultResourceBrowserOpener = IBrowserRegistry.INSTANCE + .getDefaultResourceBrowserOpener(); + if (defaultResourceBrowserOpener != null) { + preferenceNode.put(PreferenceConstants.P_DEFAULT_RESOURCE_VIEWER, + defaultResourceBrowserOpener.getClass().getName()); + } + + } + +}
diff --git a/org.eclipse.modisco.facet.util.emf.core/src/org/eclipse/modisco/facet/util/emf/core/internal/registry/BrowserRegistry.java b/org.eclipse.modisco.facet.util.emf.core/src/org/eclipse/modisco/facet/util/emf/core/internal/registry/BrowserRegistry.java new file mode 100644 index 0000000..60bf9eb --- /dev/null +++ b/org.eclipse.modisco.facet.util.emf.core/src/org/eclipse/modisco/facet/util/emf/core/internal/registry/BrowserRegistry.java
@@ -0,0 +1,212 @@ +/********************************************************************************** + * Copyright (c) 2011 Mia-Software. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Nicolas Guyomar (Mia-Software) - Bug 333652 Extension point offering the possibility to declare an EPackage browser + * Nicolas Bros (Mia-Software) - Bug 335218 - Extension point for registering EObject, EPackage, model editor + * Laurent Pichierri (Soft-Maint) - Bug 371204 - Compatibility with Helios + ***********************************************************************************/ +package org.eclipse.modisco.facet.util.emf.core.internal.registry; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; + +import org.eclipse.core.runtime.CoreException; +import org.eclipse.core.runtime.IConfigurationElement; +import org.eclipse.core.runtime.IExtension; +import org.eclipse.core.runtime.IExtensionPoint; +import org.eclipse.core.runtime.IExtensionRegistry; +import org.eclipse.core.runtime.Platform; +import org.eclipse.core.runtime.preferences.IEclipsePreferences; +import org.eclipse.core.runtime.preferences.InstanceScope; +import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.ecore.EPackage; +import org.eclipse.emf.ecore.resource.Resource; +import org.eclipse.modisco.facet.util.core.Logger; +import org.eclipse.modisco.facet.util.emf.core.IBrowserRegistry; +import org.eclipse.modisco.facet.util.emf.core.IEObjectBrowserOpener; +import org.eclipse.modisco.facet.util.emf.core.IEPackageBrowserOpener; +import org.eclipse.modisco.facet.util.emf.core.IResourceBrowserOpener; +import org.eclipse.modisco.facet.util.emf.core.internal.Activator; +import org.eclipse.modisco.facet.util.emf.core.internal.preferences.PreferenceConstants; + +/** A registry for the EObject, EPackage, and Resource browser opener extension point. */ +public class BrowserRegistry implements IBrowserRegistry { + + private static final String EXTENSION_POINT_RESOURCE_VIEWER_ELT = "resourceViewer"; //$NON-NLS-1$ + private static final String EXTENSION_POINT_EOBJECT_VIEWER_ELT = "eObjectViewer"; //$NON-NLS-1$ + private static final String EXTENSION_POINT_EPACKAGE_VIEWER_ELT = "ePackageViewer"; //$NON-NLS-1$ + private final List<IEPackageBrowserOpener> epackageBrowserOpeners; + private final List<IEObjectBrowserOpener> eobjectBrowserOpeners; + private final List<IResourceBrowserOpener> resourceBrowserOpeners; + + public static final String EXTENSION_POINT_MODEL_VIEWER_ID = "org.eclipse.emf.facet.util.emf.core.modelViewer"; //$NON-NLS-1$ + + public static final String CLASS = "class"; //$NON-NLS-1$ + + public BrowserRegistry() { + this.epackageBrowserOpeners = new ArrayList<IEPackageBrowserOpener>(); + this.eobjectBrowserOpeners = new ArrayList<IEObjectBrowserOpener>(); + this.resourceBrowserOpeners = new ArrayList<IResourceBrowserOpener>(); + + IExtensionRegistry registry = Platform.getExtensionRegistry(); + IExtensionPoint extensionPoint = registry + .getExtensionPoint(BrowserRegistry.EXTENSION_POINT_MODEL_VIEWER_ID); + if (extensionPoint != null) { + for (IExtension ext : extensionPoint.getExtensions()) { + for (IConfigurationElement configElt : ext.getConfigurationElements()) { + + String kind = configElt.getName(); + String classID = configElt.getAttribute(BrowserRegistry.CLASS); + try { + if (classID != null) { + if (kind.equals(BrowserRegistry.EXTENSION_POINT_EPACKAGE_VIEWER_ELT)) { + this.epackageBrowserOpeners.add((IEPackageBrowserOpener) configElt + .createExecutableExtension(BrowserRegistry.CLASS)); + } else if (kind + .equals(BrowserRegistry.EXTENSION_POINT_EOBJECT_VIEWER_ELT)) { + this.eobjectBrowserOpeners.add((IEObjectBrowserOpener) configElt + .createExecutableExtension(BrowserRegistry.CLASS)); + } else if (kind + .equals(BrowserRegistry.EXTENSION_POINT_RESOURCE_VIEWER_ELT)) { + this.resourceBrowserOpeners.add((IResourceBrowserOpener) configElt + .createExecutableExtension(BrowserRegistry.CLASS)); + } + } + } catch (CoreException e) { + Logger.logError(e, Activator.getDefault()); + } + } + } + } else { + Logger.logError( + "Extension point not found: " + BrowserRegistry.EXTENSION_POINT_MODEL_VIEWER_ID, //$NON-NLS-1$ + Activator.getDefault()); + } + } + + public void browseEPackage(final EPackage ePackage) { + if (ePackage == null) { + throw new IllegalArgumentException(); + } + IEPackageBrowserOpener opener = getDefaultEPackageBrowserOpener(); + if (opener != null) { + opener.openEPackage(ePackage); + } else { + Logger.logWarning( + "No epackage browser opener is registered to open ePackage " + ePackage.getNsURI(), Activator.getDefault()); //$NON-NLS-1$ + } + } + + public void browseResource(final Resource resource) { + if (resource == null) { + throw new IllegalArgumentException(); + } + IResourceBrowserOpener opener = getDefaultResourceBrowserOpener(); + if (opener != null) { + opener.openResource(resource); + } else { + Logger.logWarning( + "No resource browser opener is registered to open " + resource.getURI(), Activator.getDefault()); //$NON-NLS-1$ + } + } + + public void browseEObject(final EObject eObject) { + if (eObject == null) { + throw new IllegalArgumentException(); + } + IEObjectBrowserOpener opener = getDefaultEObjectBrowserOpener(); + if (opener != null) { + opener.openEObject(eObject); + } else { + Logger.logWarning( + "No eobject browser opener is registered to open " + eObject.toString(), Activator.getDefault()); //$NON-NLS-1$ + } + } + + public List<IEPackageBrowserOpener> getAllRegisteredEPackageBrowsers() { + return Collections.unmodifiableList(this.epackageBrowserOpeners); + } + + public List<IEObjectBrowserOpener> getAllRegisteredEObjectBrowsers() { + return Collections.unmodifiableList(this.eobjectBrowserOpeners); + } + + public List<IResourceBrowserOpener> getAllRegisteredResourceBrowsers() { + return Collections.unmodifiableList(this.resourceBrowserOpeners); + } + + /** + * @return the default EPackage browser opener, can be null + */ + public IEPackageBrowserOpener getDefaultEPackageBrowserOpener() { + IEclipsePreferences preferenceNode = new InstanceScope().getNode(Activator.PLUGIN_ID); + String className = preferenceNode.get(PreferenceConstants.P_DEFAULT_EPACKAGE_VIEWER, null); + if (className != null) { + for (IEPackageBrowserOpener ePackageBrowserFactory : this.epackageBrowserOpeners) { + if (ePackageBrowserFactory.getClass().getName().equals(className)) { + return ePackageBrowserFactory; + } + } + } + // By default return the first editor registered through the extension + // point org.eclipse.emf.facet.util.emf.core.modelViewer + if (!this.epackageBrowserOpeners.isEmpty()) { + return this.epackageBrowserOpeners.get(0); + } + + return null; + + } + + /** + * @return the default EObject browser opener, can be null + */ + public IEObjectBrowserOpener getDefaultEObjectBrowserOpener() { + IEclipsePreferences preferenceNode = new InstanceScope().getNode(Activator.PLUGIN_ID); + String className = preferenceNode.get(PreferenceConstants.P_DEFAULT_EOBJECT_VIEWER, null); + if (className != null) { + for (IEObjectBrowserOpener eObjectBrowserFactory : this.eobjectBrowserOpeners) { + if (eObjectBrowserFactory.getClass().getName().equals(className)) { + return eObjectBrowserFactory; + } + } + } + // By default return the first editor registered through the extension + // point org.eclipse.emf.facet.util.emf.core.modelViewer + if (!this.eobjectBrowserOpeners.isEmpty()) { + return this.eobjectBrowserOpeners.get(0); + } + + return null; + + } + + /** + * @return the default Resource browser opener, can be <code>null</code> + */ + public IResourceBrowserOpener getDefaultResourceBrowserOpener() { + IEclipsePreferences preferenceNode = new InstanceScope().getNode(Activator.PLUGIN_ID); + String className = preferenceNode.get(PreferenceConstants.P_DEFAULT_RESOURCE_VIEWER, null); + if (className != null) { + for (IResourceBrowserOpener resourceBrowserOpener : this.resourceBrowserOpeners) { + if (resourceBrowserOpener.getClass().getName().equals(className)) { + return resourceBrowserOpener; + } + } + } + // By default return the first editor registered through the extension + // point org.eclipse.emf.facet.util.emf.core.modelViewer + if (!this.resourceBrowserOpeners.isEmpty()) { + return this.resourceBrowserOpeners.get(0); + } + + return null; + } + +}
diff --git a/org.eclipse.modisco.facet.util.emf.core/src/org/eclipse/modisco/facet/util/emf/core/internal/serialization/SerializationRegistry.java b/org.eclipse.modisco.facet.util.emf.core/src/org/eclipse/modisco/facet/util/emf/core/internal/serialization/SerializationRegistry.java new file mode 100644 index 0000000..e5659f3 --- /dev/null +++ b/org.eclipse.modisco.facet.util.emf.core/src/org/eclipse/modisco/facet/util/emf/core/internal/serialization/SerializationRegistry.java
@@ -0,0 +1,132 @@ +/******************************************************************************* + * Copyright (c) 2011 Mia-Software. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Nicolas Bros (Mia-Software) - initial API and implementation + * Laurent Pichierri (Soft-Maint) - Bug 371204 - Compatibility with Helios + *******************************************************************************/ +package org.eclipse.modisco.facet.util.emf.core.internal.serialization; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; + +import org.eclipse.core.runtime.CoreException; +import org.eclipse.core.runtime.IConfigurationElement; +import org.eclipse.modisco.facet.util.core.Logger; +import org.eclipse.modisco.facet.util.core.internal.exported.AbstractRegistry; +import org.eclipse.modisco.facet.util.emf.core.internal.Activator; +import org.eclipse.modisco.facet.util.emf.core.serialization.ISerializationRegistry; +import org.eclipse.modisco.facet.util.emf.core.serialization.ISerializer; + +/** Registry for the "serialization" extension point */ +public class SerializationRegistry extends AbstractRegistry implements ISerializationRegistry { + + private static final String EXTENSION_POINT_NAMESPACE = "org.eclipse.emf.facet.util.emf.core"; //$NON-NLS-1$ + private static final String EXTENSION_POINT_NAME = "serialization"; //$NON-NLS-1$ + + private static final String SERIALIZER_ELEMENT = "serializer"; //$NON-NLS-1$ + private static final String CLASS_ATTRIBUTE = "class"; //$NON-NLS-1$ + + private static SerializationRegistry instance = null; + + private final List<ISerializer<?>> serializers = new ArrayList<ISerializer<?>>(); + + public static SerializationRegistry getInstance() { + if (SerializationRegistry.instance == null) { + SerializationRegistry.instance = new SerializationRegistry(); + } + return SerializationRegistry.instance; + } + + public SerializationRegistry() { + initialize(); + } + + public List<ISerializer<?>> getSerializers() { + return Collections.unmodifiableList(this.serializers); + } + + public ISerializer<?> getSerializerFor(final Class<?> type) { + for (ISerializer<?> serializer : this.serializers) { + if (serializer.getType().isAssignableFrom(type)) { + return serializer; + } + } + return null; + } + + public ISerializer<?> getSerializerFor(final String type) { + for (ISerializer<?> serializer : this.serializers) { + if (serializer.getType().getName().equals(type)) { + return serializer; + } + } + return null; + } + + @Override + protected String getExtensionPointName() { + return SerializationRegistry.EXTENSION_POINT_NAME; + } + + @Override + protected String getExtensionPointNamespace() { + return SerializationRegistry.EXTENSION_POINT_NAMESPACE; + } + + @Override + protected void handleRootElement(final IConfigurationElement configurationElement) { + final String name = configurationElement.getName(); + if (name.equalsIgnoreCase(SerializationRegistry.SERIALIZER_ELEMENT)) { + readSerializerElement(configurationElement); + } else { + logUnknownElement(configurationElement); + } + } + + /** Read a 'serializer' element */ + private void readSerializerElement(final IConfigurationElement configurationElement) { + Object object; + try { + object = configurationElement + .createExecutableExtension(SerializationRegistry.CLASS_ATTRIBUTE); + } catch (CoreException e) { + Logger.logError(e, Activator.getDefault()); + return; + } + if (object == null) { + logMissingAttribute(configurationElement, SerializationRegistry.CLASS_ATTRIBUTE); + return; + } + + if (object instanceof ISerializer<?>) { + ISerializer<?> serializer = (ISerializer<?>) object; + ISerializer<?> existingSerializer = getSerializerFor(serializer.getType()); + if (existingSerializer != null) { + logError( + configurationElement, + "Several serializers are provided for the type: " + serializer.getType().getName() + ". Only the first one will be used."); //$NON-NLS-1$ //$NON-NLS-2$ + + // always take the first one in the alphabetical order => determinism to avoid + // trying to serialize with one implementation and deserialize with an incompatible + // implementation + if (serializer.getClass().getName() + .compareTo(existingSerializer.getClass().getName()) < 0) { + // replace the already registered serializer by this one + this.serializers.remove(existingSerializer); + } else { + return; + } + } + this.serializers.add(serializer); + } else { + logError(configurationElement, + "class must implement " + ISerializer.class.getSimpleName()); //$NON-NLS-1$ + } + } +} \ No newline at end of file
diff --git a/org.eclipse.modisco.facet.util.emf.core/src/org/eclipse/modisco/facet/util/emf/core/internal/serialization/SerializationService.java b/org.eclipse.modisco.facet.util.emf.core/src/org/eclipse/modisco/facet/util/emf/core/internal/serialization/SerializationService.java new file mode 100644 index 0000000..ae118d2 --- /dev/null +++ b/org.eclipse.modisco.facet.util.emf.core/src/org/eclipse/modisco/facet/util/emf/core/internal/serialization/SerializationService.java
@@ -0,0 +1,66 @@ +/******************************************************************************* + * Copyright (c) 2011 Mia-Software. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Nicolas Bros (Mia-Software) - initial API and implementation + * Nicolas Bros (Mia-Software) - Bug 338907 - expose serialization services from SerializationFactoryImpl + *******************************************************************************/ +package org.eclipse.modisco.facet.util.emf.core.internal.serialization; + +import org.eclipse.modisco.facet.util.core.Logger; +import org.eclipse.modisco.facet.util.emf.core.internal.Activator; +import org.eclipse.modisco.facet.util.emf.core.serialization.ISerializationRegistry; +import org.eclipse.modisco.facet.util.emf.core.serialization.ISerializationService; +import org.eclipse.modisco.facet.util.emf.core.serialization.ISerializer; + +public class SerializationService implements ISerializationService { + + public String serialize(final Object instanceValue) { + if (instanceValue == null) { + return "null"; //$NON-NLS-1$ + } + + ISerializer<Object> serializer = (ISerializer<Object>) ISerializationRegistry.INSTANCE + .getSerializerFor(instanceValue.getClass()); + if (serializer != null) { + return serializer.getType().getName() + ":" //$NON-NLS-1$ + + serializer.serialize(instanceValue); + } + + Logger.logError("serialization of type " + instanceValue.getClass().getName() //$NON-NLS-1$ + + " is not implemented.", Activator.getDefault()); //$NON-NLS-1$ + return "null"; //$NON-NLS-1$ + } + + public Object deserialize(final String serializedValue) { + try { + if ("null".equals(serializedValue)) { //$NON-NLS-1$ + return null; + } + + int colonPos = serializedValue.indexOf(':'); + if (colonPos == -1) { + throw new IllegalArgumentException("invalid serialization format"); //$NON-NLS-1$ + } + String type = serializedValue.substring(0, colonPos); + String strValue = serializedValue.substring(colonPos + 1); + + ISerializer<?> serializer = ISerializationRegistry.INSTANCE.getSerializerFor(type); + if (serializer != null) { + Object value = serializer.deserialize(strValue); + return value; + } + + Logger.logError("deserialization of type " + type //$NON-NLS-1$ + + " is not implemented.", Activator.getDefault()); //$NON-NLS-1$ + } catch (Exception e) { + Logger.logError(e, "Error deserializing: " + serializedValue, //$NON-NLS-1$ + Activator.getDefault()); + } + return null; + } +}
diff --git a/org.eclipse.modisco.facet.util.emf.core/src/org/eclipse/modisco/facet/util/emf/core/internal/serialization/serializers/BooleanSerializer.java b/org.eclipse.modisco.facet.util.emf.core/src/org/eclipse/modisco/facet/util/emf/core/internal/serialization/serializers/BooleanSerializer.java new file mode 100644 index 0000000..12e0dc7 --- /dev/null +++ b/org.eclipse.modisco.facet.util.emf.core/src/org/eclipse/modisco/facet/util/emf/core/internal/serialization/serializers/BooleanSerializer.java
@@ -0,0 +1,32 @@ +/******************************************************************************* + * Copyright (c) 2011 Mia-Software. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Nicolas Bros (Mia-Software) - initial API and implementation + *******************************************************************************/ +package org.eclipse.modisco.facet.util.emf.core.internal.serialization.serializers; + +import org.eclipse.modisco.facet.util.emf.core.serialization.ISerializer; + +public class BooleanSerializer implements ISerializer<Boolean> { + + public BooleanSerializer() { + // + } + + public Class<Boolean> getType() { + return Boolean.class; + } + + public String serialize(final Boolean value) { + return value.toString(); + } + + public Boolean deserialize(final String serializedValue) { + return Boolean.valueOf(serializedValue); + } +}
diff --git a/org.eclipse.modisco.facet.util.emf.core/src/org/eclipse/modisco/facet/util/emf/core/internal/serialization/serializers/EMFURISerializer.java b/org.eclipse.modisco.facet.util.emf.core/src/org/eclipse/modisco/facet/util/emf/core/internal/serialization/serializers/EMFURISerializer.java new file mode 100644 index 0000000..f563237 --- /dev/null +++ b/org.eclipse.modisco.facet.util.emf.core/src/org/eclipse/modisco/facet/util/emf/core/internal/serialization/serializers/EMFURISerializer.java
@@ -0,0 +1,33 @@ +/******************************************************************************* + * Copyright (c) 2011 Mia-Software. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Nicolas Bros (Mia-Software) - initial API and implementation + *******************************************************************************/ +package org.eclipse.modisco.facet.util.emf.core.internal.serialization.serializers; + +import org.eclipse.emf.common.util.URI; +import org.eclipse.modisco.facet.util.emf.core.serialization.ISerializer; + +public class EMFURISerializer implements ISerializer<URI> { + + public EMFURISerializer() { + // + } + + public Class<URI> getType() { + return URI.class; + } + + public String serialize(final URI value) { + return value.toString(); + } + + public URI deserialize(final String serializedValue) { + return URI.createURI(serializedValue); + } +}
diff --git a/org.eclipse.modisco.facet.util.emf.core/src/org/eclipse/modisco/facet/util/emf/core/internal/serialization/serializers/IResourceSerializer.java b/org.eclipse.modisco.facet.util.emf.core/src/org/eclipse/modisco/facet/util/emf/core/internal/serialization/serializers/IResourceSerializer.java new file mode 100644 index 0000000..7f30713 --- /dev/null +++ b/org.eclipse.modisco.facet.util.emf.core/src/org/eclipse/modisco/facet/util/emf/core/internal/serialization/serializers/IResourceSerializer.java
@@ -0,0 +1,34 @@ +/******************************************************************************* + * Copyright (c) 2011 Mia-Software. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Nicolas Bros (Mia-Software) - initial API and implementation + *******************************************************************************/ +package org.eclipse.modisco.facet.util.emf.core.internal.serialization.serializers; + +import org.eclipse.core.resources.IResource; +import org.eclipse.core.resources.ResourcesPlugin; +import org.eclipse.modisco.facet.util.emf.core.serialization.ISerializer; + +public class IResourceSerializer implements ISerializer<IResource> { + + public IResourceSerializer() { + // + } + + public Class<IResource> getType() { + return IResource.class; + } + + public String serialize(final IResource value) { + return value.getFullPath().toPortableString(); + } + + public IResource deserialize(final String serializedValue) { + return ResourcesPlugin.getWorkspace().getRoot().findMember(serializedValue); + } +}
diff --git a/org.eclipse.modisco.facet.util.emf.core/src/org/eclipse/modisco/facet/util/emf/core/internal/serialization/serializers/IntegerSerializer.java b/org.eclipse.modisco.facet.util.emf.core/src/org/eclipse/modisco/facet/util/emf/core/internal/serialization/serializers/IntegerSerializer.java new file mode 100644 index 0000000..2fb3c3b --- /dev/null +++ b/org.eclipse.modisco.facet.util.emf.core/src/org/eclipse/modisco/facet/util/emf/core/internal/serialization/serializers/IntegerSerializer.java
@@ -0,0 +1,32 @@ +/******************************************************************************* + * Copyright (c) 2011 Mia-Software. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Nicolas Bros (Mia-Software) - initial API and implementation + *******************************************************************************/ +package org.eclipse.modisco.facet.util.emf.core.internal.serialization.serializers; + +import org.eclipse.modisco.facet.util.emf.core.serialization.ISerializer; + +public class IntegerSerializer implements ISerializer<Integer> { + + public IntegerSerializer() { + // + } + + public Class<Integer> getType() { + return Integer.class; + } + + public String serialize(final Integer value) { + return value.toString(); + } + + public Integer deserialize(final String serializedValue) { + return Integer.valueOf(serializedValue); + } +}
diff --git a/org.eclipse.modisco.facet.util.emf.core/src/org/eclipse/modisco/facet/util/emf/core/internal/serialization/serializers/StringSerializer.java b/org.eclipse.modisco.facet.util.emf.core/src/org/eclipse/modisco/facet/util/emf/core/internal/serialization/serializers/StringSerializer.java new file mode 100644 index 0000000..4a9d21b --- /dev/null +++ b/org.eclipse.modisco.facet.util.emf.core/src/org/eclipse/modisco/facet/util/emf/core/internal/serialization/serializers/StringSerializer.java
@@ -0,0 +1,32 @@ +/******************************************************************************* + * Copyright (c) 2011 Mia-Software. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Nicolas Bros (Mia-Software) - initial API and implementation + *******************************************************************************/ +package org.eclipse.modisco.facet.util.emf.core.internal.serialization.serializers; + +import org.eclipse.modisco.facet.util.emf.core.serialization.ISerializer; + +public class StringSerializer implements ISerializer<String> { + + public StringSerializer() { + // + } + + public Class<String> getType() { + return String.class; + } + + public String serialize(final String value) { + return value; + } + + public String deserialize(final String serializedValue) { + return serializedValue; + } +}
diff --git a/org.eclipse.modisco.facet.util.emf.core/src/org/eclipse/modisco/facet/util/emf/core/serialization/ISerializationRegistry.java b/org.eclipse.modisco.facet.util.emf.core/src/org/eclipse/modisco/facet/util/emf/core/serialization/ISerializationRegistry.java new file mode 100644 index 0000000..c32ec59 --- /dev/null +++ b/org.eclipse.modisco.facet.util.emf.core/src/org/eclipse/modisco/facet/util/emf/core/serialization/ISerializationRegistry.java
@@ -0,0 +1,39 @@ +/******************************************************************************* + * Copyright (c) 2011 Mia-Software. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Nicolas Bros (Mia-Software) - initial API and implementation + *******************************************************************************/ +package org.eclipse.modisco.facet.util.emf.core.serialization; + +import java.util.List; + +import org.eclipse.modisco.facet.util.emf.core.internal.serialization.SerializationRegistry; + +/** + * The registry of {@link ISerializer}s per type. + * @noimplement This interface is not intended to be implemented by clients. + * @noextend This interface is not intended to be extended by clients. + */ +public interface ISerializationRegistry { + public static ISerializationRegistry INSTANCE = new SerializationRegistry(); + + /** Get all the serializers . */ + List<ISerializer<?>> getSerializers(); + + /** + * @return the serializer for the given type, or <code>null</code> if none has been registered. + * Also returns serializers for super-types of <code>type</code>. + */ + ISerializer<?> getSerializerFor(Class<?> type); + + /** + * @return the serializer for the given type qualified name, or <code>null</code> if none has + * been registered. Does not return serializers for super-types of <code>type</code>. + */ + ISerializer<?> getSerializerFor(String type); +}
diff --git a/org.eclipse.modisco.facet.util.emf.core/src/org/eclipse/modisco/facet/util/emf/core/serialization/ISerializationService.java b/org.eclipse.modisco.facet.util.emf.core/src/org/eclipse/modisco/facet/util/emf/core/serialization/ISerializationService.java new file mode 100644 index 0000000..9ed0cdb --- /dev/null +++ b/org.eclipse.modisco.facet.util.emf.core/src/org/eclipse/modisco/facet/util/emf/core/serialization/ISerializationService.java
@@ -0,0 +1,31 @@ +/******************************************************************************* + * Copyright (c) 2011 Mia-Software. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Nicolas Bros (Mia-Software) - initial API and implementation + * Nicolas Bros (Mia-Software) - Bug 338907 - expose serialization services from SerializationFactoryImpl + *******************************************************************************/ +package org.eclipse.modisco.facet.util.emf.core.serialization; + +import org.eclipse.modisco.facet.util.emf.core.internal.serialization.SerializationService; + +/** + * Provides a serialization service so that the following is true:<br/> + * <code>deserialize(serialize(object)) == object</code> + * @noimplement This interface is not intended to be implemented by clients. + * @noextend This interface is not intended to be extended by clients. + */ +public interface ISerializationService { + + public ISerializationService INSTANCE = new SerializationService(); + + /** Serialize the given value. */ + String serialize(Object instanceValue); + + /** Deserialize the given string back into the value. */ + Object deserialize(String serializedValue); +}
diff --git a/org.eclipse.modisco.facet.util.emf.core/src/org/eclipse/modisco/facet/util/emf/core/serialization/ISerializer.java b/org.eclipse.modisco.facet.util.emf.core/src/org/eclipse/modisco/facet/util/emf/core/serialization/ISerializer.java new file mode 100644 index 0000000..df3c9cc --- /dev/null +++ b/org.eclipse.modisco.facet.util.emf.core/src/org/eclipse/modisco/facet/util/emf/core/serialization/ISerializer.java
@@ -0,0 +1,34 @@ +/******************************************************************************* + * Copyright (c) 2011 Mia-Software. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Nicolas Bros (Mia-Software) - initial API and implementation + *******************************************************************************/ +package org.eclipse.modisco.facet.util.emf.core.serialization; + +/** + * The interface that must be implemented when adding an extension to the "serializer" extension + * point. + * + * @see ISerializationRegistry + */ +// note: the serializer has to return the {@link Class} object instead of a qualified name +// because that's the one that has it on its bundle classpath. +public interface ISerializer<T> { + + /** @return the type handled by this serializer. */ + Class<T> getType(); + + /** Serialize the given value into a String */ + String serialize(T value); + + /** + * Deserialize the given String back into the original value that was serialized with + * {@link ISerializer#serialize(Object)} + */ + T deserialize(String serializedValue); +}
diff --git a/org.eclipse.modisco.facet.util.emf.core/src/org/eclipse/modisco/facet/util/emf/core/serialization/model/serialization/SerializationFactory.java b/org.eclipse.modisco.facet.util.emf.core/src/org/eclipse/modisco/facet/util/emf/core/serialization/model/serialization/SerializationFactory.java new file mode 100644 index 0000000..7888e28 --- /dev/null +++ b/org.eclipse.modisco.facet.util.emf.core/src/org/eclipse/modisco/facet/util/emf/core/serialization/model/serialization/SerializationFactory.java
@@ -0,0 +1,41 @@ +/** + * Copyright (c) 2011 Mia-Software. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Nicolas Bros (Mia-Software) - initial API and implementation + */ +package org.eclipse.modisco.facet.util.emf.core.serialization.model.serialization; + +import org.eclipse.emf.ecore.EFactory; + +/** + * <!-- begin-user-doc --> + * The <b>Factory</b> for the model. + * It provides a create method for each non-abstract class of the model. + * <!-- end-user-doc --> + * @see org.eclipse.modisco.facet.util.emf.core.serialization.model.serialization.SerializationPackage + * @generated + */ +public interface SerializationFactory extends EFactory { + /** + * The singleton instance of the factory. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + SerializationFactory eINSTANCE = org.eclipse.modisco.facet.util.emf.core.serialization.model.serialization.impl.SerializationFactoryImpl.init(); + + /** + * Returns the package supported by this factory. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @return the package supported by this factory. + * @generated + */ + SerializationPackage getSerializationPackage(); + +} //SerializationFactory
diff --git a/org.eclipse.modisco.facet.util.emf.core/src/org/eclipse/modisco/facet/util/emf/core/serialization/model/serialization/SerializationPackage.java b/org.eclipse.modisco.facet.util.emf.core/src/org/eclipse/modisco/facet/util/emf/core/serialization/model/serialization/SerializationPackage.java new file mode 100644 index 0000000..da19b66 --- /dev/null +++ b/org.eclipse.modisco.facet.util.emf.core/src/org/eclipse/modisco/facet/util/emf/core/serialization/model/serialization/SerializationPackage.java
@@ -0,0 +1,121 @@ +/** + * Copyright (c) 2011 Mia-Software. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Nicolas Bros (Mia-Software) - initial API and implementation + */ +package org.eclipse.modisco.facet.util.emf.core.serialization.model.serialization; + +import org.eclipse.emf.ecore.EDataType; +import org.eclipse.emf.ecore.EPackage; + +/** + * <!-- begin-user-doc --> + * The <b>Package</b> for the model. + * It contains accessors for the meta objects to represent + * <ul> + * <li>each class,</li> + * <li>each feature of each class,</li> + * <li>each enum,</li> + * <li>and each data type</li> + * </ul> + * <!-- end-user-doc --> + * @see org.eclipse.modisco.facet.util.emf.core.serialization.model.serialization.SerializationFactory + * @model kind="package" + * @generated + */ +@SuppressWarnings("all") +public interface SerializationPackage extends EPackage { + /** + * The package name. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + String eNAME = "serialization"; //$NON-NLS-1$ + + /** + * The package namespace URI. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + String eNS_URI = "http://www.eclipse.org/emf/facet/serialization/0.1.incubation"; //$NON-NLS-1$ + + /** + * The package namespace name. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + String eNS_PREFIX = "serialization"; //$NON-NLS-1$ + + /** + * The singleton instance of the package. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + SerializationPackage eINSTANCE = org.eclipse.modisco.facet.util.emf.core.serialization.model.serialization.impl.SerializationPackageImpl.init(); + + /** + * The meta object id for the '<em>Extensible Serializable Java Object</em>' data type. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @see java.lang.Object + * @see org.eclipse.modisco.facet.util.emf.core.serialization.model.serialization.impl.SerializationPackageImpl#getExtensibleSerializableJavaObject() + * @generated + */ + int EXTENSIBLE_SERIALIZABLE_JAVA_OBJECT = 0; + + + /** + * Returns the meta object for data type '{@link java.lang.Object <em>Extensible Serializable Java Object</em>}'. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @return the meta object for data type '<em>Extensible Serializable Java Object</em>'. + * @see java.lang.Object + * @model instanceClass="java.lang.Object" + * @generated + */ + EDataType getExtensibleSerializableJavaObject(); + + /** + * Returns the factory that creates the instances of the model. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @return the factory that creates the instances of the model. + * @generated + */ + SerializationFactory getSerializationFactory(); + + /** + * <!-- begin-user-doc --> + * Defines literals for the meta objects that represent + * <ul> + * <li>each class,</li> + * <li>each feature of each class,</li> + * <li>each enum,</li> + * <li>and each data type</li> + * </ul> + * <!-- end-user-doc --> + * @generated + */ + interface Literals { + /** + * The meta object literal for the '<em>Extensible Serializable Java Object</em>' data type. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @see java.lang.Object + * @see org.eclipse.modisco.facet.util.emf.core.serialization.model.serialization.impl.SerializationPackageImpl#getExtensibleSerializableJavaObject() + * @generated + */ + EDataType EXTENSIBLE_SERIALIZABLE_JAVA_OBJECT = SerializationPackage.eINSTANCE.getExtensibleSerializableJavaObject(); + + } + +} //SerializationPackage
diff --git a/org.eclipse.modisco.facet.util.emf.core/src/org/eclipse/modisco/facet/util/emf/core/serialization/model/serialization/impl/SerializationFactoryImpl.java b/org.eclipse.modisco.facet.util.emf.core/src/org/eclipse/modisco/facet/util/emf/core/serialization/model/serialization/impl/SerializationFactoryImpl.java new file mode 100644 index 0000000..2e20d15 --- /dev/null +++ b/org.eclipse.modisco.facet.util.emf.core/src/org/eclipse/modisco/facet/util/emf/core/serialization/model/serialization/impl/SerializationFactoryImpl.java
@@ -0,0 +1,151 @@ +/** + * Copyright (c) 2011 Mia-Software. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Nicolas Bros (Mia-Software) - initial API and implementation + * Nicolas Bros (Mia-Software) - Bug 338907 - expose serialization services from SerializationFactoryImpl + */ +package org.eclipse.modisco.facet.util.emf.core.serialization.model.serialization.impl; + +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.EDataType; +import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.ecore.EPackage; +import org.eclipse.emf.ecore.impl.EFactoryImpl; +import org.eclipse.emf.ecore.plugin.EcorePlugin; +import org.eclipse.modisco.facet.util.emf.core.serialization.ISerializationService; +import org.eclipse.modisco.facet.util.emf.core.serialization.model.serialization.SerializationFactory; +import org.eclipse.modisco.facet.util.emf.core.serialization.model.serialization.SerializationPackage; + +/** + * <!-- begin-user-doc --> An implementation of the model <b>Factory</b>. <!-- end-user-doc --> + * + * @generated + */ +public class SerializationFactoryImpl extends EFactoryImpl implements SerializationFactory { + /** + * Creates the default factory implementation. <!-- begin-user-doc --> <!-- end-user-doc --> + * + * @generated + */ + public static SerializationFactory init() { + try { + SerializationFactory theSerializationFactory = (SerializationFactory) EPackage.Registry.INSTANCE + .getEFactory("http://www.eclipse.org/emf/facet/serialization/0.1.incubation"); //$NON-NLS-1$ + if (theSerializationFactory != null) { + return theSerializationFactory; + } + } catch (Exception exception) { + EcorePlugin.INSTANCE.log(exception); + } + return new SerializationFactoryImpl(); + } + + /** + * Creates an instance of the factory. <!-- begin-user-doc --> <!-- end-user-doc --> + * + * @generated + */ + public SerializationFactoryImpl() { + super(); + } + + /** + * <!-- begin-user-doc --> <!-- end-user-doc --> + * + * @generated + */ + @Override + public EObject create(final EClass eClass) { + switch (eClass.getClassifierID()) { + default: + throw new IllegalArgumentException( + "The class '" + eClass.getName() + "' is not a valid classifier"); //$NON-NLS-1$ //$NON-NLS-2$ + } + } + + /** + * <!-- begin-user-doc --> <!-- end-user-doc --> + * + * @generated + */ + @Override + public Object createFromString(final EDataType eDataType, final String initialValue) { + switch (eDataType.getClassifierID()) { + case SerializationPackage.EXTENSIBLE_SERIALIZABLE_JAVA_OBJECT: + return createExtensibleSerializableJavaObjectFromString(eDataType, initialValue); + default: + throw new IllegalArgumentException( + "The datatype '" + eDataType.getName() + "' is not a valid classifier"); //$NON-NLS-1$ //$NON-NLS-2$ + } + } + + /** + * <!-- begin-user-doc --> <!-- end-user-doc --> + * + * @generated + */ + @Override + public String convertToString(final EDataType eDataType, final Object instanceValue) { + switch (eDataType.getClassifierID()) { + case SerializationPackage.EXTENSIBLE_SERIALIZABLE_JAVA_OBJECT: + return convertExtensibleSerializableJavaObjectToString(eDataType, instanceValue); + default: + throw new IllegalArgumentException( + "The datatype '" + eDataType.getName() + "' is not a valid classifier"); //$NON-NLS-1$ //$NON-NLS-2$ + } + } + + /** + * <!-- begin-user-doc --> Deserializes a value. + * + * @param eDataType + * the datatype + * @param initialValue + * the serialized value to deserialize <!-- end-user-doc --> + * @generated NOT + */ + public static Object createExtensibleSerializableJavaObjectFromString( + final EDataType eDataType, final String initialValue) { + return ISerializationService.INSTANCE.deserialize(initialValue); + } + + /** + * <!-- begin-user-doc --> Serializes a value. + * + * @param eDataType + * the datatype + * @param instanceValue + * the value to serialize <!-- end-user-doc --> + * @generated NOT + */ + public static String convertExtensibleSerializableJavaObjectToString(final EDataType eDataType, + final Object instanceValue) { + return ISerializationService.INSTANCE.serialize(instanceValue); + } + + /** + * <!-- begin-user-doc --> <!-- end-user-doc --> + * + * @generated + */ + public SerializationPackage getSerializationPackage() { + return (SerializationPackage) getEPackage(); + } + + /** + * <!-- begin-user-doc --> <!-- end-user-doc --> + * + * @deprecated + * @generated + */ + @Deprecated + public static SerializationPackage getPackage() { + return SerializationPackage.eINSTANCE; + } + +} // SerializationFactoryImpl
diff --git a/org.eclipse.modisco.facet.util.emf.core/src/org/eclipse/modisco/facet/util/emf/core/serialization/model/serialization/impl/SerializationPackageImpl.java b/org.eclipse.modisco.facet.util.emf.core/src/org/eclipse/modisco/facet/util/emf/core/serialization/model/serialization/impl/SerializationPackageImpl.java new file mode 100644 index 0000000..5fd33dc --- /dev/null +++ b/org.eclipse.modisco.facet.util.emf.core/src/org/eclipse/modisco/facet/util/emf/core/serialization/model/serialization/impl/SerializationPackageImpl.java
@@ -0,0 +1,170 @@ +/** + * Copyright (c) 2011 Mia-Software. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Nicolas Bros (Mia-Software) - initial API and implementation + */ +package org.eclipse.modisco.facet.util.emf.core.serialization.model.serialization.impl; + +import org.eclipse.emf.ecore.EDataType; +import org.eclipse.emf.ecore.EPackage; +import org.eclipse.emf.ecore.impl.EPackageImpl; +import org.eclipse.modisco.facet.util.emf.core.serialization.model.serialization.SerializationFactory; +import org.eclipse.modisco.facet.util.emf.core.serialization.model.serialization.SerializationPackage; + +/** + * <!-- begin-user-doc --> + * An implementation of the model <b>Package</b>. + * <!-- end-user-doc --> + * @generated + */ +public class SerializationPackageImpl extends EPackageImpl implements SerializationPackage { + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + private EDataType extensibleSerializableJavaObjectEDataType = null; + + /** + * Creates an instance of the model <b>Package</b>, registered with + * {@link org.eclipse.emf.ecore.EPackage.Registry EPackage.Registry} by the package + * package URI value. + * <p>Note: the correct way to create the package is via the static + * factory method {@link #init init()}, which also performs + * initialization of the package, or returns the registered package, + * if one already exists. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @see org.eclipse.emf.ecore.EPackage.Registry + * @see org.eclipse.modisco.facet.util.emf.core.serialization.model.serialization.SerializationPackage#eNS_URI + * @see #init() + * @generated + */ + private SerializationPackageImpl() { + super(SerializationPackage.eNS_URI, SerializationFactory.eINSTANCE); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + private static boolean isInited = false; + + /** + * Creates, registers, and initializes the <b>Package</b> for this model, and for any others upon which it depends. + * + * <p>This method is used to initialize {@link SerializationPackage#eINSTANCE} when that field is accessed. + * Clients should not invoke it directly. Instead, they should simply access that field to obtain the package. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @see #eNS_URI + * @see #createPackageContents() + * @see #initializePackageContents() + * @generated + */ + public static SerializationPackage init() { + if (SerializationPackageImpl.isInited) { + return (SerializationPackage)EPackage.Registry.INSTANCE.getEPackage(SerializationPackage.eNS_URI); + } + + // Obtain or create and register package + SerializationPackageImpl theSerializationPackage = (SerializationPackageImpl)(EPackage.Registry.INSTANCE.get(SerializationPackage.eNS_URI) instanceof SerializationPackageImpl ? EPackage.Registry.INSTANCE.get(SerializationPackage.eNS_URI) : new SerializationPackageImpl()); + + SerializationPackageImpl.isInited = true; + + // Create package meta-data objects + theSerializationPackage.createPackageContents(); + + // Initialize created meta-data + theSerializationPackage.initializePackageContents(); + + // Mark meta-data to indicate it can't be changed + theSerializationPackage.freeze(); + + + // Update the registry and return the package + EPackage.Registry.INSTANCE.put(SerializationPackage.eNS_URI, theSerializationPackage); + return theSerializationPackage; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public EDataType getExtensibleSerializableJavaObject() { + return this.extensibleSerializableJavaObjectEDataType; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public SerializationFactory getSerializationFactory() { + return (SerializationFactory)getEFactoryInstance(); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + private boolean isCreated = false; + + /** + * Creates the meta-model objects for the package. This method is + * guarded to have no affect on any invocation but its first. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public void createPackageContents() { + if (this.isCreated) { + return; + } + this.isCreated = true; + + // Create data types + this.extensibleSerializableJavaObjectEDataType = createEDataType(SerializationPackage.EXTENSIBLE_SERIALIZABLE_JAVA_OBJECT); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + private boolean isInitialized = false; + + /** + * Complete the initialization of the package and its meta-model. This + * method is guarded to have no affect on any invocation but its first. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public void initializePackageContents() { + if (this.isInitialized) { + return; + } + this.isInitialized = true; + + // Initialize package + setName(SerializationPackage.eNAME); + setNsPrefix(SerializationPackage.eNS_PREFIX); + setNsURI(SerializationPackage.eNS_URI); + + // Initialize data types + initEDataType(this.extensibleSerializableJavaObjectEDataType, Object.class, "ExtensibleSerializableJavaObject", EPackageImpl.IS_SERIALIZABLE, !EPackageImpl.IS_GENERATED_INSTANCE_CLASS); //$NON-NLS-1$ + + // Create resource + createResource(SerializationPackage.eNS_URI); + } + +} //SerializationPackageImpl
diff --git a/org.eclipse.modisco.facet.util.emf.ui/META-INF/MANIFEST.MF b/org.eclipse.modisco.facet.util.emf.ui/META-INF/MANIFEST.MF index 968e3fb..5f9341e 100644 --- a/org.eclipse.modisco.facet.util.emf.ui/META-INF/MANIFEST.MF +++ b/org.eclipse.modisco.facet.util.emf.ui/META-INF/MANIFEST.MF
@@ -3,7 +3,7 @@ Bundle-Name: %Bundle-Name Bundle-SymbolicName: org.eclipse.emf.facet.util.emf.ui;singleton:=true Bundle-Version: 1.3.0.qualifier -Bundle-Activator: org.eclipse.emf.facet.util.emf.ui.internal.Activator +Bundle-Activator: org.eclipse.modisco.facet.util.emf.ui.internal.Activator Bundle-Vendor: %Bundle-Vendor Require-Bundle: org.eclipse.ui, org.eclipse.core.runtime, @@ -22,20 +22,20 @@ Bundle-RequiredExecutionEnvironment: JavaSE-1.8 Bundle-ActivationPolicy: lazy Export-Package: - org.eclipse.emf.facet.util.emf.ui.internal.dialogs;x-friends:="org.eclipse.emf.facet.widgets.celleditors", - org.eclipse.emf.facet.util.emf.ui.internal.exported, - org.eclipse.emf.facet.util.emf.ui.internal.exported.util.composite, - org.eclipse.emf.facet.util.emf.ui.internal.exported.util.widget.component.metaclass, - org.eclipse.emf.facet.util.emf.ui.internal.exported.util.wizard, - org.eclipse.emf.facet.util.emf.ui.internal.exported.util.wizard.page, - org.eclipse.emf.facet.util.emf.ui.internal.exported.util.wizard.page.exception, - org.eclipse.emf.facet.util.emf.ui.internal.exported.wizard, - org.eclipse.emf.facet.util.emf.ui.internal.exported.wizard.page, - org.eclipse.emf.facet.util.emf.ui.internal.utils; + org.eclipse.modisco.facet.util.emf.ui.internal.dialogs;x-friends:="org.eclipse.emf.facet.widgets.celleditors", + org.eclipse.modisco.facet.util.emf.ui.internal.exported, + org.eclipse.modisco.facet.util.emf.ui.internal.exported.util.composite, + org.eclipse.modisco.facet.util.emf.ui.internal.exported.util.widget.component.metaclass, + org.eclipse.modisco.facet.util.emf.ui.internal.exported.util.wizard, + org.eclipse.modisco.facet.util.emf.ui.internal.exported.util.wizard.page, + org.eclipse.modisco.facet.util.emf.ui.internal.exported.util.wizard.page.exception, + org.eclipse.modisco.facet.util.emf.ui.internal.exported.wizard, + org.eclipse.modisco.facet.util.emf.ui.internal.exported.wizard.page, + org.eclipse.modisco.facet.util.emf.ui.internal.utils; x-friends:="org.eclipse.emf.facet.infra.common.ui, org.eclipse.emf.facet.infra.facet.ui, org.eclipse.emf.facet.infra.query.ui, org.eclipse.emf.facet.custom.ui, org.eclipse.emf.facet.efacet.ui", - org.eclipse.emf.facet.util.emf.ui.util + org.eclipse.modisco.facet.util.emf.ui.util Automatic-Module-Name: org.eclipse.emf.facet.util.emf.ui
diff --git a/org.eclipse.modisco.facet.util.emf.ui/plugin.xml b/org.eclipse.modisco.facet.util.emf.ui/plugin.xml index 888ec2f..89daafd 100644 --- a/org.eclipse.modisco.facet.util.emf.ui/plugin.xml +++ b/org.eclipse.modisco.facet.util.emf.ui/plugin.xml
@@ -18,7 +18,7 @@ point="org.eclipse.ui.views"> <view category="org.eclipse.emf.facet.common.ui.views" - class="org.eclipse.emf.facet.util.emf.ui.internal.view.PackageRegistryView" + class="org.eclipse.modisco.facet.util.emf.ui.internal.view.PackageRegistryView" icon="icons/EPackageView.gif" id="org.eclipse.emf.facet.infra.common.ui.views.packageRegistry" name="%view.name" @@ -46,7 +46,7 @@ label="%actionSet.label" visible="true"> <action - class="org.eclipse.emf.facet.util.emf.ui.internal.actions.OpenModelFromEmfRegistryAction" + class="org.eclipse.modisco.facet.util.emf.ui.internal.actions.OpenModelFromEmfRegistryAction" definitionId="org.eclipse.emf.facet.util.emf.ui.OpenModelFromEmfRegistryCommand" icon="icons/logoEmfFacetMini.gif" id="org.eclipse.emf.facet.util.emf.actions.OpenModelFromEmfRegistry" @@ -61,7 +61,7 @@ <extension point="org.eclipse.ui.handlers"> <handler - class="org.eclipse.emf.facet.util.emf.ui.internal.handler.SaveHandler" + class="org.eclipse.modisco.facet.util.emf.ui.internal.handler.SaveHandler" commandId="org.eclipse.ui.file.save"> <activeWhen> <reference @@ -75,7 +75,7 @@ </enabledWhen> </handler> <handler - class="org.eclipse.emf.facet.util.emf.ui.internal.handler.SaveAsHandler" + class="org.eclipse.modisco.facet.util.emf.ui.internal.handler.SaveAsHandler" commandId="org.eclipse.ui.file.saveAs"> <activeWhen> <reference @@ -109,7 +109,7 @@ point="org.eclipse.ui.preferencePages"> <page category="org.eclipse.emf.facet.common.ui.preference.pages.EmfFacetRootPreferencePage" - class="org.eclipse.emf.facet.util.emf.ui.internal.preference.pages.DefaultBrowserPreferencePage" + class="org.eclipse.modisco.facet.util.emf.ui.internal.preference.pages.DefaultBrowserPreferencePage" id="org.eclipse.emf.facet.util.emf.ui.DefaultBrowserPreferencePage" name="%page.name"> </page>
diff --git a/org.eclipse.modisco.facet.util.emf.ui/src/org/eclipse/emf/facet/util/emf/ui/internal/Activator.java b/org.eclipse.modisco.facet.util.emf.ui/src/org/eclipse/emf/facet/util/emf/ui/internal/Activator.java deleted file mode 100644 index b0a88aa..0000000 --- a/org.eclipse.modisco.facet.util.emf.ui/src/org/eclipse/emf/facet/util/emf/ui/internal/Activator.java +++ /dev/null
@@ -1,73 +0,0 @@ -/** - * Copyright (c) 2011 Mia-Software. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Nicolas Guyomar (Mia-Software) - Bug 333652 Extension point offering the possibility to declare an EPackage browser - */ -package org.eclipse.emf.facet.util.emf.ui.internal; - -import org.eclipse.ui.plugin.AbstractUIPlugin; -import org.osgi.framework.BundleContext; - -/** - * The activator class controls the plug-in life cycle - */ -public class Activator extends AbstractUIPlugin { - - // The plug-in ID - public static final String PLUGIN_ID = "org.eclipse.emf.facet.util.emf.ui"; //$NON-NLS-1$ - - // The shared instance - private static Activator plugin; - - /** - * The constructor - */ - public Activator() { - } - - public static AbstractUIPlugin getPlugin() { - return Activator.plugin; - } - - /* - * (non-Javadoc) - * - * @see - * org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext - * ) - */ - @Override - public void start(final BundleContext context) throws Exception { - super.start(context); - Activator.plugin = this; - } - - /* - * (non-Javadoc) - * - * @see - * org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext - * ) - */ - @Override - public void stop(final BundleContext context) throws Exception { - Activator.plugin = null; - super.stop(context); - } - - /** - * Returns the shared instance - * - * @return the shared instance - */ - public static Activator getDefault() { - return Activator.plugin; - } - -}
diff --git a/org.eclipse.modisco.facet.util.emf.ui/src/org/eclipse/emf/facet/util/emf/ui/internal/EmfLabelProvider.java b/org.eclipse.modisco.facet.util.emf.ui/src/org/eclipse/emf/facet/util/emf/ui/internal/EmfLabelProvider.java deleted file mode 100644 index f2e9937..0000000 --- a/org.eclipse.modisco.facet.util.emf.ui/src/org/eclipse/emf/facet/util/emf/ui/internal/EmfLabelProvider.java +++ /dev/null
@@ -1,140 +0,0 @@ -/** - * Copyright (c) 2013 Mia-Software. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Gregoire Dupe (Mia-Software) - Bug 406578 - Generic Label Provider for EMF objects - */ -package org.eclipse.emf.facet.util.emf.ui.internal; - -import org.eclipse.core.runtime.IAdaptable; -import org.eclipse.emf.common.util.URI; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.EPackage; -import org.eclipse.emf.ecore.resource.Resource; -import org.eclipse.emf.ecore.resource.ResourceSet; -import org.eclipse.emf.facet.util.emf.core.ModelUtils; -import org.eclipse.emf.facet.util.emf.ui.internal.utils.ImageProvider; -import org.eclipse.emf.facet.util.emf.ui.internal.utils.ImageUtils; -import org.eclipse.jface.viewers.LabelProvider; -import org.eclipse.swt.graphics.Image; - -public class EmfLabelProvider extends LabelProvider { - - @Override - public String getText(final Object element) { - String result = super.getText(element); - if (element instanceof ResourceSet) { - final ResourceSet resourceSet = (ResourceSet) element; - result = getResourceSetLabel(resourceSet); - } else if (element instanceof Resource) { - final Resource resource = (Resource) element; - result = getResourceLabel(resource); - } else if (element instanceof EObject) { - final EObject eObject = (EObject) element; - result = ModelUtils.getName(eObject); - } else if (element instanceof IAdaptable) { - final IAdaptable adaptable = (IAdaptable) element; - result = adaptAndGetResourceLabel(adaptable); - if (result == null) { - result = adaptAndGetResourceSetLabel(adaptable); - } - } else { - result = element.toString(); - } - return result; - } - - private static String adaptAndGetResourceLabel(final IAdaptable adaptable) { - String result = null; - final Resource resource = (Resource) adaptable - .getAdapter(Resource.class); - if (resource != null) { - result = getResourceLabel(resource); - } - return result; - } - - private static String adaptAndGetResourceSetLabel(final IAdaptable adaptable) { - String result = null; - final ResourceSet resourceSet = (ResourceSet) adaptable - .getAdapter(ResourceSet.class); - if (resourceSet != null) { - result = getResourceSetLabel(resourceSet); - } - return result; - } - - private static String getResourceSetLabel(final ResourceSet resourceSet) { - String result; - result = ResourceSet.class.getSimpleName() + ' ' - + resourceSet.hashCode(); - return result; - } - - private static String getResourceLabel(final Resource resource) { - String result; - EObject firstRoot = null; - if (resource.getContents().size() > 0) { - firstRoot = resource.getContents().get(0); - } - final StringBuffer strBuffer = new StringBuffer(); - final URI uri = resource.getURI(); - final String lastSegment = uri.lastSegment(); - strBuffer.append(lastSegment); - if (firstRoot != null) { - strBuffer.append(" - "); //$NON-NLS-1$ - final EPackage ePackage = firstRoot.eClass().getEPackage(); - final String nsURI = ePackage.getName(); - strBuffer.append(nsURI); - } - if (resource.isModified()) { - strBuffer.append(" *"); //$NON-NLS-1$ - } - result = strBuffer.toString(); - return result; - } - - @Override - public Image getImage(final Object element) { - Image result = super.getImage(element); - if (element instanceof Resource) { - final Resource resource = (Resource) element; - result = getResourceImage(resource); - } else if (element instanceof IAdaptable) { - final IAdaptable adaptable = (IAdaptable) element; - result = adaptAndGetResourceImage(adaptable); - } else if (element instanceof EObject) { - final EObject eObject = (EObject) element; - result = ImageUtils.getImage(eObject); - } - return result; - } - - private static Image adaptAndGetResourceImage(final IAdaptable adaptable) { - Image result = null; - final Resource resource = (Resource) adaptable - .getAdapter(Resource.class); - if (resource != null) { - result = getResourceImage(resource); - } - return result; - } - - private static Image getResourceImage(final Resource resource) { - Image result = null; - if (resource.getContents().size() > 0) { - final EObject firstRoot = resource.getContents().get(0); - result = ImageUtils.getImage(firstRoot); - if (result == null) { - result = ImageProvider.DEFAULT.getImage(ImageProvider.MODEL); - } - } - return result; - } - -}
diff --git a/org.eclipse.modisco.facet.util.emf.ui/src/org/eclipse/emf/facet/util/emf/ui/internal/EmfLabelProviderFactory.java b/org.eclipse.modisco.facet.util.emf.ui/src/org/eclipse/emf/facet/util/emf/ui/internal/EmfLabelProviderFactory.java deleted file mode 100644 index e460196..0000000 --- a/org.eclipse.modisco.facet.util.emf.ui/src/org/eclipse/emf/facet/util/emf/ui/internal/EmfLabelProviderFactory.java +++ /dev/null
@@ -1,24 +0,0 @@ -/** - * Copyright (c) 2013 Mia-Software. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Gregoire Dupe (Mia-Software) - Bug 406578 - Generic Label Provider for EMF objects - */ -package org.eclipse.emf.facet.util.emf.ui.internal; - -import org.eclipse.emf.facet.util.emf.ui.internal.exported.IEmfLabelProviderFactory; -import org.eclipse.jface.viewers.ILabelProvider; - -public class EmfLabelProviderFactory implements - IEmfLabelProviderFactory { - - public ILabelProvider createLabelProvider() { - return new EmfLabelProvider(); - } - -}
diff --git a/org.eclipse.modisco.facet.util.emf.ui/src/org/eclipse/emf/facet/util/emf/ui/internal/Messages.java b/org.eclipse.modisco.facet.util.emf.ui/src/org/eclipse/emf/facet/util/emf/ui/internal/Messages.java deleted file mode 100644 index 07d35e3..0000000 --- a/org.eclipse.modisco.facet.util.emf.ui/src/org/eclipse/emf/facet/util/emf/ui/internal/Messages.java +++ /dev/null
@@ -1,54 +0,0 @@ -/** - * Copyright (c) 2011, 2012 Mia-Software. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Nicolas Guyomar (Mia-Software) - Bug 333652 Extension point offering the possibility to declare an EPackage browser - * Gregoire Dupe (Mia-Software) - Bug 369987 - [Restructuring][Table] Switch to the new customization and facet framework - * Alban Ménager (Soft-Maint) - Bug 387470 - [EFacet][Custom] Editors - * Gregoire Dupe (Mia-Software) - Bug 406570 - Handlers to Save and SaveAs EMF resources - */ -package org.eclipse.emf.facet.util.emf.ui.internal; - -import org.eclipse.osgi.util.NLS; - -public class Messages extends NLS { - private static final String BUNDLE_NAME = "org.eclipse.emf.facet.util.emf.ui.internal.messages"; //$NON-NLS-1$ - public static String CreateInstanceDialog_selectNewInstanceEClass; - public static String PackageRegistryView_initializing; - public static String PackageRegistryView_copyNsURI; - public static String PackageRegistryView_RefreshingPackageRegistryView; - public static String PackageRegistryView_nsURI; - public static String PackageRegistryView_Location; - public static String PackageRegistryView_Name; - public static String DialogUriSelection_RegisteredEPackages; - public static String DialogUriSelection_title_OpenModelFromEMFRegistry; - public static String EmfFacetRootPreferencePage_default_epackage_browser; - public static String EPackageBrowserPreferencePage_defaultEObjectViewer; - public static String EPackageBrowserPreferencePage_defaultResourceViewer; - - public static String Select_EClass; - public static String Select_EDataType; - public static String Select_EClassifier; - public static String Select_ETypedElement; - public static String Select_EPackage; - - public static String ResourceUiUtils_SavingFailed; - public static String ResourceUiUtils_TheResourceSavingFailed; - public static String SaveAsDialog_ResourceURI; - public static String SaveAsDialog_SaveAs; - public static String SaveAsDialog_YouHaveToProvideAValidEMFURI; - - public static String No_result_found; - static { - // initialize resource bundle - NLS.initializeMessages(BUNDLE_NAME, Messages.class); - } - - private Messages() { - } -}
diff --git a/org.eclipse.modisco.facet.util.emf.ui/src/org/eclipse/emf/facet/util/emf/ui/internal/ResourceUiUtils.java b/org.eclipse.modisco.facet.util.emf.ui/src/org/eclipse/emf/facet/util/emf/ui/internal/ResourceUiUtils.java deleted file mode 100644 index 8790f34..0000000 --- a/org.eclipse.modisco.facet.util.emf.ui/src/org/eclipse/emf/facet/util/emf/ui/internal/ResourceUiUtils.java +++ /dev/null
@@ -1,97 +0,0 @@ -/** - * Copyright (c) 2013 Mia-Software. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Gregoire Dupe (Mia-Software) - Bug 406570 - Handlers to Save and SaveAs EMF resources - */ -package org.eclipse.emf.facet.util.emf.ui.internal; - -import java.io.IOException; -import java.net.MalformedURLException; -import java.util.Collections; - -import org.eclipse.emf.common.util.URI; -import org.eclipse.emf.ecore.resource.Resource; -import org.eclipse.emf.facet.util.core.Logger; -import org.eclipse.emf.facet.util.emf.ui.internal.dialogs.SaveAsDialog; -import org.eclipse.emf.facet.util.ui.internal.exported.dialog.IDialogCallback; -import org.eclipse.emf.facet.util.ui.internal.exported.dialog.IOkDialog; -import org.eclipse.emf.facet.util.ui.internal.exported.dialog.IOkDialogFactory; -import org.eclipse.emf.facet.util.ui.internal.exported.dialog.IWithResultDialogCallback; -import org.eclipse.osgi.util.NLS; -import org.eclipse.swt.widgets.Shell; - -public final class ResourceUiUtils { - - private ResourceUiUtils() { - // Must no be used - } - - public static IOkDialog save(final Resource resource, final Shell shell) { - IOkDialog dialog = null; - try { - resource.save(Collections.EMPTY_MAP); - } catch (MalformedURLException e) { - ResourceUiUtils.openSaveAsDialog(resource, shell); - } catch (IOException e) { - final IDialogCallback<Void> callBack = new IDialogCallback<Void>() { - public void committed(final Void result2) { - // Nothing to do. - } - }; - dialog = savingFailed(e, shell, callBack); - } - return dialog; - } - - private static IOkDialog savingFailed(final IOException exception, - final Shell shell, final IDialogCallback<Void> callBack) { - Logger.logError(exception, Activator.getDefault()); - final String errorMessage = NLS.bind( - Messages.ResourceUiUtils_TheResourceSavingFailed, - exception.getMessage()); - return IOkDialogFactory.DEFAULT.openErrorDialog(shell, - Messages.ResourceUiUtils_SavingFailed, errorMessage, callBack); - } - - public static SaveAsDialog openSaveAsDialog(final Resource resource, - final Shell shell) { - final IWithResultDialogCallback<String> callBack = new IWithResultDialogCallback<String>() { - - public void commited(final String result) { - ResourceUiUtils.saveAs(resource, result, shell); - } - - public void canceled(final String result) { - // Nothing to do - } - }; - final SaveAsDialog dialog = new SaveAsDialog(shell, resource.getURI() - .toString(), callBack); - dialog.open(); - return dialog; - } - - protected static IOkDialog saveAs(final Resource resource, - final String result, final Shell shell) { - IOkDialog dialog = null; - try { - resource.setURI(URI.createURI(result)); - resource.save(Collections.EMPTY_MAP); - } catch (IOException e) { - final IDialogCallback<Void> callBack = new IDialogCallback<Void>() { - public void committed(final Void result2) { - ResourceUiUtils.openSaveAsDialog(resource, shell); - } - }; - dialog = savingFailed(e, shell, callBack); - } - return dialog; - } - -}
diff --git a/org.eclipse.modisco.facet.util.emf.ui/src/org/eclipse/emf/facet/util/emf/ui/internal/actions/OpenModelFromEmfRegistryAction.java b/org.eclipse.modisco.facet.util.emf.ui/src/org/eclipse/emf/facet/util/emf/ui/internal/actions/OpenModelFromEmfRegistryAction.java deleted file mode 100644 index 5ab11ed..0000000 --- a/org.eclipse.modisco.facet.util.emf.ui/src/org/eclipse/emf/facet/util/emf/ui/internal/actions/OpenModelFromEmfRegistryAction.java +++ /dev/null
@@ -1,58 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 2010, 2011 Mia-Software. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Gabriel Barbier (Mia-Software) - initial API and implementation - * Nicolas Bros (Mia-Software) - * Nicolas Guyomar (Mia-Software) - Bug 333652 Extension point offering the possibility to declare an EPackage browser - *******************************************************************************/ -package org.eclipse.emf.facet.util.emf.ui.internal.actions; - -import org.eclipse.emf.ecore.EPackage; -import org.eclipse.emf.facet.util.emf.core.IBrowserRegistry; -import org.eclipse.emf.facet.util.emf.ui.internal.dialogs.UriSelectionDialog; -import org.eclipse.jface.action.IAction; -import org.eclipse.jface.viewers.ISelection; -import org.eclipse.jface.window.Window; -import org.eclipse.ui.IWorkbenchPage; -import org.eclipse.ui.IWorkbenchWindow; -import org.eclipse.ui.IWorkbenchWindowActionDelegate; - -/** - * This is an action class which opens a dialog to select an EPackage to browse - */ -public class OpenModelFromEmfRegistryAction implements IWorkbenchWindowActionDelegate { - - private IWorkbenchWindow fWorkbenchWindow; - - public void dispose() { - // nothing - } - - public void init(final IWorkbenchWindow window) { - this.fWorkbenchWindow = window; - } - - public void run(final IAction action) { - final IWorkbenchPage activePage = this.fWorkbenchWindow.getActivePage(); - if (activePage != null) { - final UriSelectionDialog launcher = new UriSelectionDialog( - this.fWorkbenchWindow.getShell()); - if (launcher.open() == Window.OK) { - final String nsURI = launcher.getUriSelected(); - if (nsURI != null && nsURI.length() > 0) { - EPackage ePackage = EPackage.Registry.INSTANCE.getEPackage(nsURI); - IBrowserRegistry.INSTANCE.browseEPackage(ePackage); - } - } - } - } - - public void selectionChanged(final IAction action, final ISelection selection) { - // nothing - } -}
diff --git a/org.eclipse.modisco.facet.util.emf.ui/src/org/eclipse/emf/facet/util/emf/ui/internal/dialogs/CreateInstanceDialog.java b/org.eclipse.modisco.facet.util.emf.ui/src/org/eclipse/emf/facet/util/emf/ui/internal/dialogs/CreateInstanceDialog.java deleted file mode 100644 index 7a2b6d7..0000000 --- a/org.eclipse.modisco.facet.util.emf.ui/src/org/eclipse/emf/facet/util/emf/ui/internal/dialogs/CreateInstanceDialog.java +++ /dev/null
@@ -1,76 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 CEA LIST. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Nicolas Bros (Mia-Software) - initial API and implementation - * Gregoire Dupe (Mia-Software) - Bug 369987 - [Restructuring][Table] Switch to the new customization and facet framework - * Laurent Pichierri (Soft-Maint) - Bug 371204 - Compatibility with Helios - *******************************************************************************/ -package org.eclipse.emf.facet.util.emf.ui.internal.dialogs; - -import java.util.List; -import java.util.ListIterator; - -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.facet.util.emf.core.ModelUtils; -import org.eclipse.emf.facet.util.emf.ui.internal.Messages; -import org.eclipse.jface.viewers.LabelProvider; -import org.eclipse.swt.widgets.Shell; -import org.eclipse.ui.dialogs.ElementListSelectionDialog; - -public final class CreateInstanceDialog { - - private CreateInstanceDialog() { - // - } - - /** - * Open a dialog with a list of metaclasses that are subclasses of the given - * {@link EClass}. When the user chooses a metaclass, an instance is created - * an returned. - * - * @param shell - * the parent shell for the dialog - * @param eClass - * the {@link EClass} of the new instance - * @param labelProvider - * label provider for the displayed {@link EClass}es. - * @return the created instance, or <code>null</code> if the user cancelled - */ - public static EObject open(final Shell shell, final EClass eClass, - final LabelProvider labelProvider) { - List<EClass> allSubClasses = ModelUtils.allSubClasses(eClass); - allSubClasses.add(eClass); - // remove non-instantiable metaclasses - ListIterator<EClass> listIterator = allSubClasses.listIterator(); - while (listIterator.hasNext()) { - EClass e = listIterator.next(); - if (e.isAbstract() || e.isInterface()) { - listIterator.remove(); - } - } - - ElementListSelectionDialog eClassSelectionDialog = new ElementListSelectionDialog(shell, - labelProvider); - eClassSelectionDialog.setTitle(Messages.CreateInstanceDialog_selectNewInstanceEClass); - eClassSelectionDialog.setElements(allSubClasses.toArray()); - eClassSelectionDialog.open(); - Object selectedElement = eClassSelectionDialog.getFirstResult(); - if (selectedElement instanceof EClass) { - EClass selectedEClass = (EClass) selectedElement; - if (!selectedEClass.isInterface() && !selectedEClass.isAbstract()) { - EObject eObject = selectedEClass.getEPackage().getEFactoryInstance() - .create(selectedEClass); - return eObject; - } - } - return null; - } - -}
diff --git a/org.eclipse.modisco.facet.util.emf.ui/src/org/eclipse/emf/facet/util/emf/ui/internal/dialogs/SaveAsDialog.java b/org.eclipse.modisco.facet.util.emf.ui/src/org/eclipse/emf/facet/util/emf/ui/internal/dialogs/SaveAsDialog.java deleted file mode 100644 index c7e1314..0000000 --- a/org.eclipse.modisco.facet.util.emf.ui/src/org/eclipse/emf/facet/util/emf/ui/internal/dialogs/SaveAsDialog.java +++ /dev/null
@@ -1,70 +0,0 @@ -/** - * Copyright (c) 2013 Mia-Software. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Gregoire Dupe (Mia-Software) - Bug 406570 - Handlers to Save and SaveAs EMF resources - */ - -package org.eclipse.emf.facet.util.emf.ui.internal.dialogs; - - -import org.eclipse.emf.facet.util.emf.ui.internal.Messages; -import org.eclipse.emf.facet.util.ui.internal.exported.dialog.IWithResultDialogCallback; -import org.eclipse.jface.dialogs.Dialog; -import org.eclipse.swt.SWT; -import org.eclipse.swt.layout.GridLayout; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Control; -import org.eclipse.swt.widgets.Label; -import org.eclipse.swt.widgets.Shell; - -public class SaveAsDialog extends Dialog { - - private URIComposite uriComposite; - private final String initialText; - private final IWithResultDialogCallback<String> callBack; - - public SaveAsDialog(final Shell parent, final String initialText, - final IWithResultDialogCallback<String> callBack) { - super(parent); - this.initialText = initialText; - this.callBack = callBack; - } - - @Override - protected Control createDialogArea(final Composite parent) { - final Composite composite = new Composite(parent, SWT.NONE); - composite.setLayout(new GridLayout(1, false)); - final Label text = new Label(composite, SWT.NONE); - text.setText(Messages.SaveAsDialog_YouHaveToProvideAValidEMFURI); - this.uriComposite = new URIComposite(composite, this.initialText); - return composite; - } - - @Override - protected void cancelPressed() { - cancelled(); - } - - public void cancelled() { - final String text = this.uriComposite.getText(); - this.callBack.canceled(text); - super.cancelPressed(); - } - - @Override - protected void okPressed() { - commit(); - } - - public void commit() { - this.callBack.commited(this.uriComposite.getText()); - super.okPressed(); - } - -}
diff --git a/org.eclipse.modisco.facet.util.emf.ui/src/org/eclipse/emf/facet/util/emf/ui/internal/dialogs/URIComposite.java b/org.eclipse.modisco.facet.util.emf.ui/src/org/eclipse/emf/facet/util/emf/ui/internal/dialogs/URIComposite.java deleted file mode 100644 index efa7be7..0000000 --- a/org.eclipse.modisco.facet.util.emf.ui/src/org/eclipse/emf/facet/util/emf/ui/internal/dialogs/URIComposite.java +++ /dev/null
@@ -1,40 +0,0 @@ -/** - * Copyright (c) 2013 Mia-Software. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Gregoire Dupe (Mia-Software) - Bug 406570 - Handlers to Save and SaveAs EMF resources - */ - -package org.eclipse.emf.facet.util.emf.ui.internal.dialogs; - -import org.eclipse.emf.facet.util.emf.ui.internal.Messages; -import org.eclipse.swt.SWT; -import org.eclipse.swt.layout.GridLayout; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Label; -import org.eclipse.swt.widgets.Text; - -public class URIComposite extends Composite { - - private final Text text; - - public URIComposite(final Composite parent, final String initialText) { - super(parent, SWT.NONE); - this.setLayout(new GridLayout(2, false)); - final Label label = new Label(this, SWT.NONE); - label.setText(Messages.SaveAsDialog_ResourceURI); - this.text = new Text(this, SWT.BORDER); - this.text.setText(initialText); - this.getShell().setText(Messages.SaveAsDialog_SaveAs); - } - - public String getText() { - return this.text.getText(); - } - -}
diff --git a/org.eclipse.modisco.facet.util.emf.ui/src/org/eclipse/emf/facet/util/emf/ui/internal/dialogs/UriSelectionDialog.java b/org.eclipse.modisco.facet.util.emf.ui/src/org/eclipse/emf/facet/util/emf/ui/internal/dialogs/UriSelectionDialog.java deleted file mode 100644 index 9550028..0000000 --- a/org.eclipse.modisco.facet.util.emf.ui/src/org/eclipse/emf/facet/util/emf/ui/internal/dialogs/UriSelectionDialog.java +++ /dev/null
@@ -1,105 +0,0 @@ -/********************************************************************************** - * Copyright (c) 2011 Mia-Software. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Gabriel Barbier (Mia-Software) - initial API and implementation - * Nicolas Guyomar (Mia-Software) - Bug 333652 Extension point offering the possibility to declare an EPackage browser - ***********************************************************************************/ -package org.eclipse.emf.facet.util.emf.ui.internal.dialogs; - -import java.util.Map; -import java.util.Set; -import java.util.TreeSet; - -import org.eclipse.emf.ecore.EPackage; -import org.eclipse.emf.facet.common.ui.internal.widgets.AnywhereFilterMatcher; -import org.eclipse.emf.facet.util.emf.ui.internal.Activator; -import org.eclipse.emf.facet.util.emf.ui.internal.Messages; -import org.eclipse.emf.facet.util.emf.ui.internal.utils.ImageProvider; -import org.eclipse.jface.dialogs.IDialogSettings; -import org.eclipse.jface.viewers.LabelProvider; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Control; -import org.eclipse.swt.widgets.Shell; -import org.eclipse.ui.dialogs.ElementListSelectionDialog; - -/** - * A dialog which displays a list of URIs from the EMF package registry, and - * allows the user to open one of them. - * - * @author Gabriel Barbier - */ -public class UriSelectionDialog extends ElementListSelectionDialog { - - private static final String DIALOG_SETTINGS = "UriSelectionDialogSettings"; //$NON-NLS-1$ - private String uri = ""; //$NON-NLS-1$ - - /** - * Constructor. - * - * @param parent - * the parent shell - */ - public UriSelectionDialog(final Shell parent) { - super(parent, new LabelProvider()); - - setTitle(Messages.DialogUriSelection_title_OpenModelFromEMFRegistry); - setMessage(Messages.DialogUriSelection_RegisteredEPackages); - - final Set<String> uris = new TreeSet<String>(); - for (final Object name : ((Map<?, ?>) EPackage.Registry.INSTANCE) - .keySet()) { - uris.add((name).toString()); - } - - setElements(uris.toArray()); - } - - @Override - protected Control createDialogArea(final Composite parent) { - Composite composite = (Composite) super.createDialogArea(parent); - this.fFilteredList.setFilterMatcher(new AnywhereFilterMatcher()); - return composite; - } - - /** - * {@inheritDoc} - * - * @see org.eclipse.ui.dialogs.SelectionStatusDialog#okPressed() - */ - @Override - protected void okPressed() { - super.okPressed(); - - if (getResult().length > 0) { - this.uri = getResult()[0].toString(); - } - } - - public String getUriSelected() { - return this.uri; - } - - @Override - protected void configureShell(final Shell shell) { - super.configureShell(shell); - shell.setImage(ImageProvider.getInstance().getEmfFacetLogo()); - } - - @Override - protected IDialogSettings getDialogBoundsSettings() { - IDialogSettings settings = Activator.getPlugin().getDialogSettings(); - IDialogSettings section = settings - .getSection(UriSelectionDialog.DIALOG_SETTINGS); - if (section == null) { - section = settings - .addNewSection(UriSelectionDialog.DIALOG_SETTINGS); - } - return section; - } -} \ No newline at end of file
diff --git a/org.eclipse.modisco.facet.util.emf.ui/src/org/eclipse/emf/facet/util/emf/ui/internal/exported/IEmfLabelProviderFactory.java b/org.eclipse.modisco.facet.util.emf.ui/src/org/eclipse/emf/facet/util/emf/ui/internal/exported/IEmfLabelProviderFactory.java deleted file mode 100644 index bd98a61..0000000 --- a/org.eclipse.modisco.facet.util.emf.ui/src/org/eclipse/emf/facet/util/emf/ui/internal/exported/IEmfLabelProviderFactory.java +++ /dev/null
@@ -1,25 +0,0 @@ -/** - * Copyright (c) 2013 Mia-Software. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Gregoire Dupe (Mia-Software) - Bug 406578 - Generic Label Provider for EMF objects - */ -package org.eclipse.emf.facet.util.emf.ui.internal.exported; - -import org.eclipse.emf.facet.util.emf.ui.internal.EmfLabelProviderFactory; -import org.eclipse.jface.viewers.ILabelProvider; - -/** - * @since 0.4 - */ -public interface IEmfLabelProviderFactory { - - IEmfLabelProviderFactory DEFAULT = new EmfLabelProviderFactory(); - - ILabelProvider createLabelProvider(); -}
diff --git a/org.eclipse.modisco.facet.util.emf.ui/src/org/eclipse/emf/facet/util/emf/ui/internal/exported/util/composite/EClassifierSelectionControl.java b/org.eclipse.modisco.facet.util.emf.ui/src/org/eclipse/emf/facet/util/emf/ui/internal/exported/util/composite/EClassifierSelectionControl.java deleted file mode 100644 index 1aaebfe..0000000 --- a/org.eclipse.modisco.facet.util.emf.ui/src/org/eclipse/emf/facet/util/emf/ui/internal/exported/util/composite/EClassifierSelectionControl.java +++ /dev/null
@@ -1,88 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2011, 2012 Mia-Software. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Nicolas Bros (Mia-Software) - initial API and implementation - * Nicolas Guyomar (Mia-Software) - Bug 349546 - EMF Facet facetSet editor - * Alban Ménager (Soft-Maint) - Bug 387470 - [EFacet][Custom] Editors - *******************************************************************************/ -package org.eclipse.emf.facet.util.emf.ui.internal.exported.util.composite; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import org.eclipse.emf.common.util.EList; -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.ecore.EClassifier; -import org.eclipse.emf.ecore.EPackage; -import org.eclipse.emf.facet.util.emf.ui.internal.Messages; -import org.eclipse.emf.facet.util.ui.internal.exported.util.composite.FilteredElementSelectionComposite; -import org.eclipse.swt.widgets.Composite; - -/** - * A control to select an {@link EClass}, that can be filtered using the - * associated text field. - * - * @since 0.3 - */ -public class EClassifierSelectionControl<T extends EClassifier> extends - FilteredElementSelectionComposite { - - private final Map<String, T> stringToEClass = new HashMap<String, T>(); - private final Class<? extends EClassifier> eTypeSel; - private String metamodelNsUri; - - public EClassifierSelectionControl(final Composite parent, - final String metamodelNsUri, final Class<? extends T> eTypeSel) { - super(parent, true, false); - this.eTypeSel = eTypeSel; - this.metamodelNsUri = metamodelNsUri; - } - - public void updateList(final String metamodelNsUri2) { - this.metamodelNsUri = metamodelNsUri2; - final EPackage ePackage = EPackage.Registry.INSTANCE - .getEPackage(this.metamodelNsUri); - if (ePackage != null) { - final List<String> eClasses = new ArrayList<String>(); - final EList<EClassifier> eClassifiers = ePackage.getEClassifiers(); - addElements(eClasses, eClassifiers); - if (eClasses.isEmpty()) { - eClasses.add(Messages.No_result_found); - setEnabled(false); - } else { - setEnabled(true); - } - setElements(eClasses.toArray()); - } - } - - private void addElements(final List<String> eClasses, - final EList<? extends EClassifier> eClassifiers) { - for (final EClassifier eClassifier : eClassifiers) { - if (this.eTypeSel.isInstance(eClassifier)) { - eClasses.add(eClassifier.getName()); - @SuppressWarnings("unchecked") - // @SuppressWarnings("unchecked") checked by the surrounding if - final T eClassifier2 = (T) eClassifier; - this.stringToEClass.put(eClassifier.getName(), eClassifier2); - } - } - } - - public T getSelectedEClassifier() { - T result = null; - final Object[] selectElements = getSelectedElements(); - if ((selectElements != null) && (selectElements.length > 0) - && this.stringToEClass.containsKey(selectElements[0])) { - result = this.stringToEClass.get(selectElements[0]); - } - return result; - } -}
diff --git a/org.eclipse.modisco.facet.util.emf.ui/src/org/eclipse/emf/facet/util/emf/ui/internal/exported/util/widget/component/metaclass/AbstractGetMetaclassWidget.java b/org.eclipse.modisco.facet.util.emf.ui/src/org/eclipse/emf/facet/util/emf/ui/internal/exported/util/widget/component/metaclass/AbstractGetMetaclassWidget.java deleted file mode 100644 index 4c80123..0000000 --- a/org.eclipse.modisco.facet.util.emf.ui/src/org/eclipse/emf/facet/util/emf/ui/internal/exported/util/widget/component/metaclass/AbstractGetMetaclassWidget.java +++ /dev/null
@@ -1,163 +0,0 @@ -/** - * Copyright (c) 2012 Mia-Software. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Alban Ménager (Soft-Maint) - Bug 387470 - [EFacet][Custom] Editors - * Grégoire Dupé (Mia-Software) - Bug 387470 - [EFacet][Custom] Editors - */ -package org.eclipse.emf.facet.util.emf.ui.internal.exported.util.widget.component.metaclass; - -import org.eclipse.emf.ecore.EClassifier; -import org.eclipse.emf.ecore.EPackage; -import org.eclipse.emf.facet.util.emf.ui.internal.exported.util.wizard.SelectETypeWizardImpl; -import org.eclipse.emf.facet.util.emf.ui.internal.exported.util.wizard.SynchronizedSelectETypeWizard; -import org.eclipse.emf.facet.util.emf.ui.internal.exported.wizard.ISelectETypeWizard; -import org.eclipse.emf.facet.util.ui.internal.exported.PropertyElement; -import org.eclipse.emf.facet.util.ui.internal.exported.PropertyElement2; -import org.eclipse.emf.facet.util.ui.internal.exported.util.widget.component.getorcreate.AbstractGetOrCreateElementWithWizardButtonWidget; -import org.eclipse.swt.widgets.Composite; - -/** - * This abstract class provides a simple way for the selection of a type. - * - * Label : [ textField ][...] </p> - * - * The button will display the {@link SelectETypeWizardImpl} wizard when - * pressed. </p> - * - * The {@link #getLabel()} method have to be override and provide the label of - * the 'Label'.</p> - * - * The {@link #createTextField(boolean)} create a non editable text field.</p> - * - * The {@link #getETypeSelectionOption()} have to be override and type of the - * selection in the wizard.</p> - * - * If the value of the {@link PropertyElement} is null, then the message - * returned by {@link #getErrorMessage()} is displayed on the top of the dialog. - * - * @see SelectETypeWizardImpl - * @see ETypeSelectionOptions - * - * @see GetConformanceMetaclassWidget - * @see GetElementTypeWidget - * @see GetExtendedMetaclassWidget - * @since 0.3 - */ -public abstract class AbstractGetMetaclassWidget<T extends EClassifier> - extends - AbstractGetOrCreateElementWithWizardButtonWidget<T, ISelectETypeWizard<T>> { - - private final PropertyElement2<? extends EPackage> ePackagePropery; - private final Class<? extends T> eTypeOption; - - /** - * Constructor. - * - * @param parent - * the parent of this composite. - * @param editingDomain - * the current editing domain. - * @param typeProperty - * the property element that will be edited by this composite. - * @param ePackageProperty - * the property element to get the super, main, element of the - * model. - */ - protected AbstractGetMetaclassWidget(final Composite parent, - final PropertyElement2<T> typeProperty, - final PropertyElement2<? extends EPackage> ePackageProperty, - final Class<? extends T> eTypeOption) { - super(parent, typeProperty); - this.ePackagePropery = ePackageProperty; - this.eTypeOption = eTypeOption; - } - - /** - * Constructor. - * - * @param parent - * the parent of this composite. - * @param editingDomain - * the current editing domain. - * @param propertyElement - * the property element that will be edited by this composite. - * @param ePackageProperty - * the property element to get the super, main, element of the - * model. - * @param buttonEnabled - * boolean to set if the button is enabled or not. - */ - protected AbstractGetMetaclassWidget(final Composite parent, - final PropertyElement2<T> propertyElement, - final PropertyElement2<EPackage> ePackageProperty, - final boolean buttonEnabled, final Class<T> eTypeOption) { - this(parent, propertyElement, ePackageProperty, eTypeOption); - this.setButtonEnabled(buttonEnabled); - } - - /** - * @return return the label. Null if no label have to be displayed. - */ - @Override - protected abstract String getLabel(); - - @Override - public String getError() { - String error = null; - final EClassifier eclassifier = this.getPropertyElement().getValue2(); - if (eclassifier == null) { - error = getErrorMessage(); - } - return error; - } - - @Override - protected void onWizardCommited(final ISelectETypeWizard<T> wizard) { - final T eClassifier = wizard.getSelectedEClassifier(); - getPropertyElement().setValue2(eClassifier); - setText(eClassifier.getName()); - fireChanged(); - } - - @Override - protected void onWizardCanceled() { - fireChanged(); - } - - /** - * Return the EPackage. - * - * @return the ePackage. - */ - protected abstract EPackage getEPackage(); - - /** - * @return the facetSetProperty - */ - public PropertyElement2<? extends EPackage> getEPackageProperty() { - return this.ePackagePropery; - } - - public void setValue(final T eClassifier) { - getPropertyElement().setValue2(eClassifier); - } - - @Override - protected ISelectETypeWizard<T> createIWizard() { - final EPackage parent = getEPackage(); - return new SelectETypeWizardImpl<T>(this.eTypeOption, parent); - } - - @Override - protected ISelectETypeWizard<T> createSynchronizedWizard( - final ISelectETypeWizard<T> wizard) { - return new SynchronizedSelectETypeWizard<T>(wizard, - this.getDisplay()); - } -}
diff --git a/org.eclipse.modisco.facet.util.emf.ui/src/org/eclipse/emf/facet/util/emf/ui/internal/exported/util/widget/component/metaclass/MetamodelSelectionControl.java b/org.eclipse.modisco.facet.util.emf.ui/src/org/eclipse/emf/facet/util/emf/ui/internal/exported/util/widget/component/metaclass/MetamodelSelectionControl.java deleted file mode 100644 index f194a53..0000000 --- a/org.eclipse.modisco.facet.util.emf.ui/src/org/eclipse/emf/facet/util/emf/ui/internal/exported/util/widget/component/metaclass/MetamodelSelectionControl.java +++ /dev/null
@@ -1,45 +0,0 @@ -/** - * Copyright (c) 2012 Mia-Software. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Alban Ménager (Soft-Maint) - Bug 387470 - [EFacet][Custom] Editors - */ -package org.eclipse.emf.facet.util.emf.ui.internal.exported.util.widget.component.metaclass; - -import java.util.Map; -import java.util.Set; -import java.util.TreeSet; - -import org.eclipse.emf.ecore.EPackage; -import org.eclipse.emf.facet.util.ui.internal.exported.util.composite.FilteredElementSelectionComposite; -import org.eclipse.swt.widgets.Composite; - -/** - * A control to select a metamodel from a list of metamodels, that can be - * filtered using the associated text field. - * - * @since 0.3 - */ -public class MetamodelSelectionControl extends - FilteredElementSelectionComposite { - - public MetamodelSelectionControl(final Composite parent) { - super(parent, true, false); - final Set<String> uris = getUris(); - setElements(uris.toArray()); - } - - private static Set<String> getUris() { - final Set<String> uris = new TreeSet<String>(); - for (final Object name : ((Map<?, ?>) EPackage.Registry.INSTANCE) - .keySet()) { - uris.add(name.toString()); - } - return uris; - } -}
diff --git a/org.eclipse.modisco.facet.util.emf.ui/src/org/eclipse/emf/facet/util/emf/ui/internal/exported/util/wizard/SelectETypeWizardImpl.java b/org.eclipse.modisco.facet.util.emf.ui/src/org/eclipse/emf/facet/util/emf/ui/internal/exported/util/wizard/SelectETypeWizardImpl.java deleted file mode 100644 index 0b959a0..0000000 --- a/org.eclipse.modisco.facet.util.emf.ui/src/org/eclipse/emf/facet/util/emf/ui/internal/exported/util/wizard/SelectETypeWizardImpl.java +++ /dev/null
@@ -1,151 +0,0 @@ -/** - * Copyright (c) 2011, 2012 Mia-Software. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Nicolas Guyomar (Mia-Software) - Bug 349546 - EMF Facet facetSet editor - * Alban Ménager (Soft-Maint) - Bug 387470 - [EFacet][Custom] Editors - * Grégoire Dupé (Mia-Software) - Bug 387470 - [EFacet][Custom] Editors - */ -package org.eclipse.emf.facet.util.emf.ui.internal.exported.util.wizard; - -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.ecore.EClassifier; -import org.eclipse.emf.ecore.EDataType; -import org.eclipse.emf.ecore.EPackage; -import org.eclipse.emf.ecore.ETypedElement; -import org.eclipse.emf.facet.util.core.DebugUtils; -import org.eclipse.emf.facet.util.emf.ui.internal.Activator; -import org.eclipse.emf.facet.util.emf.ui.internal.Messages; -import org.eclipse.emf.facet.util.emf.ui.internal.exported.util.wizard.page.SelectEClassifierWizardPage; -import org.eclipse.emf.facet.util.emf.ui.internal.exported.util.wizard.page.SelectEPackageWizardPage; -import org.eclipse.emf.facet.util.emf.ui.internal.exported.util.wizard.page.SynchronizedSelectEClassifierWizardPage; -import org.eclipse.emf.facet.util.emf.ui.internal.exported.util.wizard.page.SynchronizedSelectEPackageWizardPage; -import org.eclipse.emf.facet.util.emf.ui.internal.exported.wizard.ISelectETypeWizard; -import org.eclipse.emf.facet.util.emf.ui.internal.exported.wizard.page.ISelectEClassifierWizardPage; -import org.eclipse.emf.facet.util.emf.ui.internal.exported.wizard.page.ISelectEPackageWizardPage; -import org.eclipse.jface.window.Window; -import org.eclipse.jface.wizard.IWizardPage; -import org.eclipse.jface.wizard.Wizard; -import org.eclipse.jface.wizard.WizardDialog; -import org.eclipse.swt.widgets.Display; -import org.eclipse.swt.widgets.Shell; - -/** - * @since 0.3 - */ -public class SelectETypeWizardImpl<T extends EClassifier> extends Wizard - implements ISelectETypeWizard<T> { - - private static final boolean DEBUG = DebugUtils.getDebugStatus(Activator - .getDefault()); - private final WizardDialog dialog; - private final ISelectEPackageWizardPage ePackageWP; - private final ISelectEClassifierWizardPage<T> eClassifierWP; - private T eClassifier; - - public SelectETypeWizardImpl(final Class<? extends T> eTypeOption, - final EPackage ePackage) { - super(); - this.dialog = new WizardDialog(new Shell(Display.getDefault()), - this); - this.ePackageWP = new SelectEPackageWizardPage(); - this.eClassifierWP = new SelectEClassifierWizardPage<T>(eTypeOption, - ePackage); - if (eTypeOption == EClass.class) { - setWindowTitle(Messages.Select_EClass); - } else if (eTypeOption == EDataType.class) { - setWindowTitle(Messages.Select_EDataType); - } else if (eTypeOption == EClassifier.class) { - setWindowTitle(Messages.Select_EClassifier); - } else if (eTypeOption == ETypedElement.class) { - setWindowTitle(Messages.Select_ETypedElement); - } - } - - @Override - public void addPages() { - addPage(this.ePackageWP); - addPage(this.eClassifierWP); - } - - public int open() { - int result = Window.CANCEL; - - if (this.dialog != null) { - result = this.dialog.open(); - } - return result; - } - - @Override - public boolean performFinish() { - this.eClassifier = this.eClassifierWP.getSelectedEClassifier(); - return true; - } - - public T getSelectedEClassifier() { - return this.eClassifier; - } - - public ISelectEClassifierWizardPage<T> getSelectEClassifierWizardPage() { - return this.eClassifierWP; - } - - public ISelectEPackageWizardPage getSelectEPackageWizardPage() { - return this.ePackageWP; - } - - public boolean finish() { - final boolean result = performFinish(); - dispose(); - setContainer(null); - this.dialog.close(); - return result; - } - - public IWizardPage getCurrentPage() { - return getSynchronizedPage(getContainer().getCurrentPage()); - } - - public IWizardPage next() { - DebugUtils.debug(SelectETypeWizardImpl.DEBUG); - final IWizardPage nextPage = getNextPage(getContainer() - .getCurrentPage()); - this.dialog.showPage(nextPage); - return getSynchronizedPage(nextPage); - } - - public IWizardPage previous() { - final IWizardPage previousPage = getPreviousPage(getContainer() - .getCurrentPage()); - this.dialog.showPage(previousPage); - return getSynchronizedPage(previousPage); - } - - private static IWizardPage getSynchronizedPage(final IWizardPage page) { - IWizardPage result = null; - if (page instanceof ISelectEClassifierWizardPage) { - result = new SynchronizedSelectEClassifierWizardPage( - (ISelectEClassifierWizardPage<?>) page, - Display.getDefault()); - } else if (page instanceof ISelectEPackageWizardPage) { - result = new SynchronizedSelectEPackageWizardPage( - (ISelectEPackageWizardPage) page, Display.getDefault()); - } - return result; - } - - public void selectPackage(final String packageName) { - getSelectEPackageWizardPage().selectPackage(packageName); - } - - public void selectEClassifier(final String eClassifierName) { - getSelectEClassifierWizardPage().selectEClassifier(eClassifierName); - } - -}
diff --git a/org.eclipse.modisco.facet.util.emf.ui/src/org/eclipse/emf/facet/util/emf/ui/internal/exported/util/wizard/SynchronizedSelectETypeWizard.java b/org.eclipse.modisco.facet.util.emf.ui/src/org/eclipse/emf/facet/util/emf/ui/internal/exported/util/wizard/SynchronizedSelectETypeWizard.java deleted file mode 100644 index 0ceec88..0000000 --- a/org.eclipse.modisco.facet.util.emf.ui/src/org/eclipse/emf/facet/util/emf/ui/internal/exported/util/wizard/SynchronizedSelectETypeWizard.java +++ /dev/null
@@ -1,65 +0,0 @@ -/** - * Copyright (c) 2012 Mia-Software. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Alban Ménager (Soft-Maint) - Bug 387470 - [EFacet][Custom] Editors - * Grégoire Dupé (Mia-Software) - Bug 387470 - [EFacet][Custom] Editors - */ -package org.eclipse.emf.facet.util.emf.ui.internal.exported.util.wizard; - -import org.eclipse.emf.ecore.EClassifier; -import org.eclipse.emf.facet.util.emf.ui.internal.exported.util.widget.component.metaclass.AbstractGetMetaclassWidget; -import org.eclipse.emf.facet.util.emf.ui.internal.exported.wizard.ISelectETypeWizard; -import org.eclipse.emf.facet.util.ui.internal.exported.displaysync.AbstractExceptionFreeRunnable; -import org.eclipse.emf.facet.util.ui.internal.exported.util.wizard.SynchronizedWizard; -import org.eclipse.swt.widgets.Display; - -/** - * Synchronized class for safe run. - * - * @see AbstractGetMetaclassWidget - * @since 0.3 - */ -public class SynchronizedSelectETypeWizard<T extends EClassifier> extends - SynchronizedWizard<ISelectETypeWizard<T>> implements - ISelectETypeWizard<T> { - - /** - * Constructor. - * - * @param object - * the to synchronized. - * @param display - * the display. - */ - public SynchronizedSelectETypeWizard(final ISelectETypeWizard<T> object, - final Display display) { - super(object, display); - } - - public T getSelectedEClassifier() { - return this.safeSyncExec(new AbstractExceptionFreeRunnable<T>() { - @Override - public T safeRun() { - return SynchronizedSelectETypeWizard.this - .getSynchronizedObject().getSelectedEClassifier(); - } - }); - } - - @Override - public int open() { - return this.safeSyncExec(new AbstractExceptionFreeRunnable<Integer>() { - @Override - public Integer safeRun() { - return Integer.valueOf(SynchronizedSelectETypeWizard.this - .getSynchronizedObject().open()); - } - }).intValue(); - } -}
diff --git a/org.eclipse.modisco.facet.util.emf.ui/src/org/eclipse/emf/facet/util/emf/ui/internal/exported/util/wizard/page/SelectEClassifierWizardPage.java b/org.eclipse.modisco.facet.util.emf.ui/src/org/eclipse/emf/facet/util/emf/ui/internal/exported/util/wizard/page/SelectEClassifierWizardPage.java deleted file mode 100644 index d0366e0..0000000 --- a/org.eclipse.modisco.facet.util.emf.ui/src/org/eclipse/emf/facet/util/emf/ui/internal/exported/util/wizard/page/SelectEClassifierWizardPage.java +++ /dev/null
@@ -1,188 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2011, 2012 Mia-Software. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Nicolas Bros (Mia-Software) - initial API and implementation - * Alban Ménager (Soft-Maint) - Bug 387470 - [EFacet][Custom] Editors - * Grégoire Dupé (Mia-Software) - Bug 387470 - [EFacet][Custom] Editors - *******************************************************************************/ -package org.eclipse.emf.facet.util.emf.ui.internal.exported.util.wizard.page; - -import org.eclipse.core.runtime.jobs.Job; -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.ecore.EClassifier; -import org.eclipse.emf.ecore.EDataType; -import org.eclipse.emf.ecore.EPackage; -import org.eclipse.emf.ecore.ETypedElement; -import org.eclipse.emf.facet.util.core.DebugUtils; -import org.eclipse.emf.facet.util.emf.ui.internal.Activator; -import org.eclipse.emf.facet.util.emf.ui.internal.Messages; -import org.eclipse.emf.facet.util.emf.ui.internal.exported.util.composite.EClassifierSelectionControl; -import org.eclipse.emf.facet.util.emf.ui.internal.exported.util.wizard.page.exception.SelectedEClassifierRuntimeException; -import org.eclipse.emf.facet.util.emf.ui.internal.exported.wizard.page.ISelectEClassifierWizardPage; -import org.eclipse.emf.facet.util.emf.ui.internal.exported.wizard.page.ISelectEPackageWizardPage; -import org.eclipse.jface.wizard.WizardPage; -import org.eclipse.swt.events.ModifyEvent; -import org.eclipse.swt.events.ModifyListener; -import org.eclipse.swt.events.SelectionEvent; -import org.eclipse.swt.events.SelectionListener; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Display; -import org.eclipse.ui.dialogs.FilteredList; - -/** - * @since 0.3 - */ -public class SelectEClassifierWizardPage<T extends EClassifier> extends - WizardPage implements ISelectEClassifierWizardPage<T> { - - private static final boolean DEBUG = DebugUtils.getDebugStatus(Activator - .getDefault()); - private EClassifierSelectionControl<T> eClassSelection; - private final Class<? extends T> eTypeOption; - private String metamodelNsUri; - - public SelectEClassifierWizardPage(final Class<? extends T> eTypeOption, - final EPackage ePackage) { - super("Whatever"); //$NON-NLS-1$ - if (eTypeOption == EClass.class) { - setTitle(Messages.Select_EClass); - } else if (eTypeOption == EDataType.class) { - setTitle(Messages.Select_EDataType); - } else if (eTypeOption == EClassifier.class) { - setTitle(Messages.Select_EClassifier); - } else if (eTypeOption == ETypedElement.class) { - setTitle(Messages.Select_ETypedElement); - } - if (ePackage != null) { - this.metamodelNsUri = ePackage.getNsURI(); - } - this.eTypeOption = eTypeOption; - } - - @Override - public boolean isPageComplete() { - return this.eClassSelection.getSelectedEClassifier() != null; - } - - @Override - public void setVisible(final boolean visible) { - super.setVisible(visible); - if (getPreviousPage() instanceof SelectEPackageWizardPage) { - final ISelectEPackageWizardPage selectEPackage = (ISelectEPackageWizardPage) getPreviousPage(); - this.metamodelNsUri = selectEPackage.getSelectedEPackage() - .getNsURI(); - if (this.metamodelNsUri != null) { - setDescription(selectEPackage.getSelectedEPackage() - .getNsURI()); - } - } - this.eClassSelection.updateList(this.metamodelNsUri); - } - - public void createControl(final Composite parent) { - this.eClassSelection = new EClassifierSelectionControl<T>(parent, - this.metamodelNsUri, this.eTypeOption); - final FilteredList filteredList = this.eClassSelection - .getFilteredList(); - - filteredList.addSelectionListener(new SelectionListener() { - public void widgetSelected(final SelectionEvent event) { - if (event.item != null) { - updateButton(); - // setPageComplete(filteredList.getSelection().length == 1); - } - } - - public void widgetDefaultSelected(final SelectionEvent event) { - if (getWizard().canFinish()) { - getWizard().performFinish(); - } - if (getNextPage() != null) { - goToNextPage(); - } - } - }); - - this.eClassSelection.getFilterText().addModifyListener( - new ModifyListener() { - - public void modifyText(final ModifyEvent event) { - updateButton(); - } - }); - - // avoid the page being "complete" when still on a previous page - filteredList.setSelection(new int[0]); - setPageComplete(false); - - setControl(this.eClassSelection); - } - - protected void goToNextPage() { - getContainer().showPage(getNextPage()); - } - - protected void updateButton() { - if ((getContainer() != null) && (getContainer().getCurrentPage() != null)) { - getContainer().updateButtons(); - } - } - - public T getSelectedEClassifier() { - return this.eClassSelection.getSelectedEClassifier(); - } - - /** - * Select the <code>eclassifierName</code> into the list. - * - * @param eclassifierName - * the name of the classifier to select. - */ - public void selectEClassifier(final String eclassifierName) { - DebugUtils.debug(DEBUG); - boolean doItNow = true; - // We get all the jobs - for (final Job job : Job.getJobManager().find(null)) { - // We check if the job of 'FilteredList' is ended. If not, we - // recursively call this method to check again without interfering - // with the 'FilteredList' job (doing an asynchrony call). - if (job.getClass().getName() - .startsWith(FilteredList.class.getName())) { - asyncSelectionClassifier(eclassifierName); - DebugUtils.debug(DEBUG, "Selection defered."); //$NON-NLS-1$ - doItNow = false; - break; - } - } - - // If the job 'FilteredList' is done, we can do the selection. - if (doItNow) { - internalSelectEClassifier(eclassifierName); - } - } - - private void asyncSelectionClassifier(final String eclassifierName) { - Display.getDefault().asyncExec(new Runnable() { - public void run() { - selectEClassifier(eclassifierName); - } - }); - } - - private void internalSelectEClassifier(final String packageName) { - final FilteredList filteredList = this.eClassSelection - .getFilteredList(); - filteredList.setSelection(new String[] { packageName }); - if (getSelectedEClassifier() == null) { - throw new SelectedEClassifierRuntimeException(); - } - DebugUtils.debug(DEBUG, "Selection setting finished."); //$NON-NLS-1$ - DebugUtils.debug(DEBUG, - "selectedEClassifier=" + getSelectedEClassifier()); //$NON-NLS-1$ - } -} \ No newline at end of file
diff --git a/org.eclipse.modisco.facet.util.emf.ui/src/org/eclipse/emf/facet/util/emf/ui/internal/exported/util/wizard/page/SelectEPackageWizardPage.java b/org.eclipse.modisco.facet.util.emf.ui/src/org/eclipse/emf/facet/util/emf/ui/internal/exported/util/wizard/page/SelectEPackageWizardPage.java deleted file mode 100644 index 2027eca..0000000 --- a/org.eclipse.modisco.facet.util.emf.ui/src/org/eclipse/emf/facet/util/emf/ui/internal/exported/util/wizard/page/SelectEPackageWizardPage.java +++ /dev/null
@@ -1,190 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2011, 2012 Mia-Software. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Nicolas Bros (Mia-Software) - initial API and implementation - * Alban Ménager (Soft-Maint) - Bug 387470 - [EFacet][Custom] Editors - *******************************************************************************/ -package org.eclipse.emf.facet.util.emf.ui.internal.exported.util.wizard.page; - -import org.eclipse.core.runtime.jobs.Job; -import org.eclipse.emf.common.util.URI; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.EPackage; -import org.eclipse.emf.ecore.EPackage.Registry; -import org.eclipse.emf.ecore.resource.Resource; -import org.eclipse.emf.ecore.resource.ResourceSet; -import org.eclipse.emf.facet.util.core.DebugUtils; -import org.eclipse.emf.facet.util.emf.ui.internal.Activator; -import org.eclipse.emf.facet.util.emf.ui.internal.Messages; -import org.eclipse.emf.facet.util.emf.ui.internal.exported.util.widget.component.metaclass.MetamodelSelectionControl; -import org.eclipse.emf.facet.util.emf.ui.internal.exported.util.wizard.page.exception.SelectedEPackageRuntimeException; -import org.eclipse.emf.facet.util.emf.ui.internal.exported.wizard.page.ISelectEPackageWizardPage; -import org.eclipse.emf.facet.util.emf.ui.util.EditingUtil; -import org.eclipse.jface.wizard.WizardPage; -import org.eclipse.swt.events.SelectionEvent; -import org.eclipse.swt.events.SelectionListener; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Display; -import org.eclipse.ui.dialogs.FilteredList; - -/** - * @since 0.3 - */ -public class SelectEPackageWizardPage extends WizardPage implements - ISelectEPackageWizardPage { - - private static final boolean DEBUG = DebugUtils.getDebugStatus(Activator - .getDefault()); - - private MetamodelSelectionControl mmSelectionCtl; - - public SelectEPackageWizardPage() { - super("Whatever"); //$NON-NLS-1$ - setTitle(Messages.Select_EPackage); - } - - @Override - public void setVisible(final boolean visible) { - super.setVisible(visible); - if (visible) { - this.mmSelectionCtl.getFilterText().setFocus(); - setPageComplete(true); - } - } - - public void createControl(final Composite parent) { - this.mmSelectionCtl = new MetamodelSelectionControl(parent); - this.mmSelectionCtl.setLayoutData(new GridData( - GridData.FILL_BOTH)); - final FilteredList filteredList = this.mmSelectionCtl - .getFilteredList(); - - filteredList.addSelectionListener(new SelectionListener() { - - public void widgetSelected(final SelectionEvent event) { - if (event.item != null) { - setPageComplete(filteredList.getSelection().length == 1); - } - } - - public void widgetDefaultSelected(final SelectionEvent event) { - if (getWizard().canFinish()) { - getWizard().performFinish(); - } - if (getNextPage() != null) { - goToNextPage(); - } - } - }); - - // prevent the page from being "complete" when still on a previous page - filteredList.setSelection(new int[0]); - setPageComplete(false); - setControl(this.mmSelectionCtl); - } - - protected void goToNextPage() { - getContainer().showPage(getNextPage()); - } - - public EPackage getSelectedEPackage() { - EPackage ePackage = null; - // Only one result - if (this.mmSelectionCtl.getSelectedElements() != null) { - final Object result = this.mmSelectionCtl - .getSelectedElements()[0]; - if (EPackage.Registry.INSTANCE.containsKey(result.toString())) { - ePackage = EPackage.Registry.INSTANCE - .getEPackage(result.toString()); - } - } - return ePackage; - } - - public void loadSelectedMetamodel() { - final Object[] results = this.mmSelectionCtl - .getSelectedElements(); - // if user cancel the selection of meta models, results = null - if (results != null) { - final ResourceSet resourceSet = EditingUtil.getEditingDomain() - .getResourceSet(); - for (final Object result : results) { - final URI uri = URI.createURI(result.toString()); - final Resource resource = resourceSet.getResource(uri, true); - if (!resourceSet.getResources().contains(resource)) { - final Registry packageRegistry = resourceSet - .getPackageRegistry(); - packageRegistry.putAll(putResourceContents(resource, - packageRegistry)); - resourceSet.getResources().add(resource); - } - } - } - } - - private static Registry putResourceContents(final Resource resource, - final Registry packageRegistry) { - final Registry result = packageRegistry; - for (final EObject eObject : resource.getContents()) { - if (eObject instanceof EPackage) { - final EPackage ePackage = (EPackage) eObject; - result.put(ePackage.getNsURI(), ePackage); - } - } - return result; - } - - /** - * Select the <code>packageName</code> into the list. - * - * @param packageName - * the name of the package to select. - */ - public void selectPackage(final String packageName) { - DebugUtils.debug(DEBUG); - boolean doItNow = true; - // We get all the jobs - for (final Job job : Job.getJobManager().find(null)) { - // We check if the job of 'FilteredList' is ended. If not, we - // recursively call this method to check again without interfering - // with the 'FilteredList' job (with an asynchrony call). - if (job.getClass().getName() - .startsWith(FilteredList.class.getName())) { - asyncSelectionPackage(packageName); - DebugUtils.debug(DEBUG, "Selection defered."); //$NON-NLS-1$ - doItNow = false; - break; - } - } - - // If the job 'FilteredList' is done, we can do the selection. - if (doItNow) { - internalSelectPackage(packageName); - } - } - - private void asyncSelectionPackage(final String packageName) { - Display.getDefault().asyncExec(new Runnable() { - public void run() { - selectPackage(packageName); - } - }); - } - - private void internalSelectPackage(final String packageName) { - final FilteredList filteredList = this.mmSelectionCtl - .getFilteredList(); - filteredList.setSelection(new String[] { packageName }); - if (getSelectedEPackage() == null) { - throw new SelectedEPackageRuntimeException(); - } - DebugUtils.debug(DEBUG, "Selection setting finished."); //$NON-NLS-1$ - DebugUtils.debug(DEBUG, "selectedEPackage=" + getSelectedEPackage()); //$NON-NLS-1$ - } -}
diff --git a/org.eclipse.modisco.facet.util.emf.ui/src/org/eclipse/emf/facet/util/emf/ui/internal/exported/util/wizard/page/SynchronizedSelectEClassifierWizardPage.java b/org.eclipse.modisco.facet.util.emf.ui/src/org/eclipse/emf/facet/util/emf/ui/internal/exported/util/wizard/page/SynchronizedSelectEClassifierWizardPage.java deleted file mode 100644 index c2b2ad3..0000000 --- a/org.eclipse.modisco.facet.util.emf.ui/src/org/eclipse/emf/facet/util/emf/ui/internal/exported/util/wizard/page/SynchronizedSelectEClassifierWizardPage.java +++ /dev/null
@@ -1,78 +0,0 @@ -/** - * Copyright (c) 2012 Mia-Software. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Alban Ménager (Soft-Maint) - Bug 387470 - [EFacet][Custom] Editors - */ -package org.eclipse.emf.facet.util.emf.ui.internal.exported.util.wizard.page; - -import org.eclipse.emf.ecore.EClassifier; -import org.eclipse.emf.facet.util.core.DebugUtils; -import org.eclipse.emf.facet.util.emf.ui.internal.Activator; -import org.eclipse.emf.facet.util.emf.ui.internal.exported.wizard.page.ISelectEClassifierWizardPage; -import org.eclipse.emf.facet.util.ui.internal.exported.displaysync.AbstractExceptionFreeRunnable; -import org.eclipse.emf.facet.util.ui.internal.exported.displaysync.AbstractVoidExceptionFreeRunnable; -import org.eclipse.swt.widgets.Display; - -/** - * Synchronized class for safe run. - * - * @since 0.3 - * - */ -public class SynchronizedSelectEClassifierWizardPage extends - SynchronizedWizardPage<ISelectEClassifierWizardPage> implements - ISelectEClassifierWizardPage { - - private static final boolean DEBUG = DebugUtils.getDebugStatus(Activator - .getDefault()); - - /** - * Constructor. - * - * @param object - * the to synchronized. - * @param display - * the display. - */ - public SynchronizedSelectEClassifierWizardPage( - final ISelectEClassifierWizardPage object, final Display display) { - super(object, display); - } - - public EClassifier getSelectedEClassifier() { - return this - .safeSyncExec(new AbstractExceptionFreeRunnable<EClassifier>() { - @Override - public EClassifier safeRun() { - return SynchronizedSelectEClassifierWizardPage.this - .getSynchronizedObject() - .getSelectedEClassifier(); - } - }); - } - - public void selectEClassifier(final String selection) { - this.voidExceptionFreeRunnable(new AbstractVoidExceptionFreeRunnable() { - @Override - public void voidSafeRun() { - SynchronizedSelectEClassifierWizardPage.this - .getSynchronizedObject().selectEClassifier( - selection); - } - }); - - // We keep the thread waiting until the selection is not done. - // If we release the thread, the selection may not be done and made some - // errors - while (this.getSelectedEClassifier() == null) { - DebugUtils.debug(DEBUG, "Waiting."); //$NON-NLS-1$ - } - } - -}
diff --git a/org.eclipse.modisco.facet.util.emf.ui/src/org/eclipse/emf/facet/util/emf/ui/internal/exported/util/wizard/page/SynchronizedSelectEPackageWizardPage.java b/org.eclipse.modisco.facet.util.emf.ui/src/org/eclipse/emf/facet/util/emf/ui/internal/exported/util/wizard/page/SynchronizedSelectEPackageWizardPage.java deleted file mode 100644 index 630d474..0000000 --- a/org.eclipse.modisco.facet.util.emf.ui/src/org/eclipse/emf/facet/util/emf/ui/internal/exported/util/wizard/page/SynchronizedSelectEPackageWizardPage.java +++ /dev/null
@@ -1,75 +0,0 @@ -/** - * Copyright (c) 2012 Mia-Software. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Alban Ménager (Soft-Maint) - Bug 387470 - [EFacet][Custom] Editors - */ -package org.eclipse.emf.facet.util.emf.ui.internal.exported.util.wizard.page; - -import org.eclipse.emf.ecore.EPackage; -import org.eclipse.emf.facet.util.core.DebugUtils; -import org.eclipse.emf.facet.util.emf.ui.internal.Activator; -import org.eclipse.emf.facet.util.emf.ui.internal.exported.wizard.page.ISelectEPackageWizardPage; -import org.eclipse.emf.facet.util.ui.internal.exported.displaysync.AbstractExceptionFreeRunnable; -import org.eclipse.emf.facet.util.ui.internal.exported.displaysync.AbstractVoidExceptionFreeRunnable; -import org.eclipse.swt.widgets.Display; - -/** - * Synchronized class for safe run. - * - * @author amenager_stage - * @since 0.3 - * - */ -public class SynchronizedSelectEPackageWizardPage extends - SynchronizedWizardPage<ISelectEPackageWizardPage> implements - ISelectEPackageWizardPage { - - private static final boolean DEBUG = DebugUtils.getDebugStatus(Activator - .getDefault()); - - /** - * Constructor. - * - * @param object - * the to synchronized. - * @param display - * the display. - */ - public SynchronizedSelectEPackageWizardPage( - final ISelectEPackageWizardPage object, final Display display) { - super(object, display); - } - - public EPackage getSelectedEPackage() { - return this.safeSyncExec(new AbstractExceptionFreeRunnable<EPackage>() { - @Override - public EPackage safeRun() { - return SynchronizedSelectEPackageWizardPage.this - .getSynchronizedObject().getSelectedEPackage(); - } - }); - } - - public void selectPackage(final String selection) { - this.voidExceptionFreeRunnable(new AbstractVoidExceptionFreeRunnable() { - @Override - public void voidSafeRun() { - SynchronizedSelectEPackageWizardPage.this - .getSynchronizedObject().selectPackage(selection); - } - }); - - // We keep the thread waiting until the selection is not done. - // If we release the thread, the selection may not be done and made some - // errors - while (this.getSelectedEPackage() == null) { - DebugUtils.debug(DEBUG, "Waiting."); //$NON-NLS-1$ - } - } -}
diff --git a/org.eclipse.modisco.facet.util.emf.ui/src/org/eclipse/emf/facet/util/emf/ui/internal/exported/util/wizard/page/SynchronizedWizardPage.java b/org.eclipse.modisco.facet.util.emf.ui/src/org/eclipse/emf/facet/util/emf/ui/internal/exported/util/wizard/page/SynchronizedWizardPage.java deleted file mode 100644 index 33f4a15..0000000 --- a/org.eclipse.modisco.facet.util.emf.ui/src/org/eclipse/emf/facet/util/emf/ui/internal/exported/util/wizard/page/SynchronizedWizardPage.java +++ /dev/null
@@ -1,260 +0,0 @@ -/** - * Copyright (c) 2012 Mia-Software. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Alban Ménager (Soft-Maint) - Bug 387470 - [EFacet][Custom] Editors - */ -package org.eclipse.emf.facet.util.emf.ui.internal.exported.util.wizard.page; - -import org.eclipse.emf.facet.util.ui.internal.exported.displaysync.AbstractExceptionFreeRunnable; -import org.eclipse.emf.facet.util.ui.internal.exported.displaysync.AbstractVoidExceptionFreeRunnable; -import org.eclipse.emf.facet.util.ui.internal.exported.displaysync.SynchronizedObject; -import org.eclipse.jface.resource.ImageDescriptor; -import org.eclipse.jface.wizard.IWizard; -import org.eclipse.jface.wizard.IWizardPage; -import org.eclipse.swt.graphics.Image; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Control; -import org.eclipse.swt.widgets.Display; - -/** - * Synchronized class for safe run. - * - * @author amenager_stage - * @since 0.3 - * - */ -public class SynchronizedWizardPage<WP extends IWizardPage> extends - SynchronizedObject<WP> - implements IWizardPage { - - /** - * Constructor. - * - * @param object - * the to synchronized. - * @param display - * the display. - */ - public SynchronizedWizardPage(final WP object, - final Display display) { - super(object, display); - } - - public void createControl(final Composite parent) { - this.voidExceptionFreeRunnable(new AbstractVoidExceptionFreeRunnable() { - @Override - public void voidSafeRun() { - SynchronizedWizardPage.this.getSynchronizedObject() - .createControl(parent); - } - }); - } - - public void dispose() { - this.voidExceptionFreeRunnable(new AbstractVoidExceptionFreeRunnable() { - @Override - public void voidSafeRun() { - SynchronizedWizardPage.this.getSynchronizedObject().dispose(); - } - }); - } - - public Control getControl() { - return this.safeSyncExec(new AbstractExceptionFreeRunnable<Control>() { - @Override - public Control safeRun() { - return SynchronizedWizardPage.this.getSynchronizedObject() - .getControl(); - } - }); - } - - public String getDescription() { - return this.safeSyncExec(new AbstractExceptionFreeRunnable<String>() { - @Override - public String safeRun() { - return SynchronizedWizardPage.this.getSynchronizedObject() - .getDescription(); - } - }); - } - - public String getErrorMessage() { - return this.safeSyncExec(new AbstractExceptionFreeRunnable<String>() { - @Override - public String safeRun() { - return SynchronizedWizardPage.this.getSynchronizedObject() - .getErrorMessage(); - } - }); - } - - public Image getImage() { - return this.safeSyncExec(new AbstractExceptionFreeRunnable<Image>() { - @Override - public Image safeRun() { - return SynchronizedWizardPage.this.getSynchronizedObject() - .getImage(); - } - }); - } - - public String getMessage() { - return this.safeSyncExec(new AbstractExceptionFreeRunnable<String>() { - @Override - public String safeRun() { - return SynchronizedWizardPage.this.getSynchronizedObject() - .getMessage(); - } - }); - } - - public String getTitle() { - return this.safeSyncExec(new AbstractExceptionFreeRunnable<String>() { - @Override - public String safeRun() { - return SynchronizedWizardPage.this.getSynchronizedObject() - .getTitle(); - } - }); - } - - public void performHelp() { - this.voidExceptionFreeRunnable(new AbstractVoidExceptionFreeRunnable() { - @Override - public void voidSafeRun() { - SynchronizedWizardPage.this.getSynchronizedObject() - .performHelp(); - } - }); - } - - public void setDescription(final String description) { - this.voidExceptionFreeRunnable(new AbstractVoidExceptionFreeRunnable() { - @Override - public void voidSafeRun() { - SynchronizedWizardPage.this.getSynchronizedObject() - .setDescription(description); - } - }); - } - - public void setImageDescriptor(final ImageDescriptor image) { - this.voidExceptionFreeRunnable(new AbstractVoidExceptionFreeRunnable() { - @Override - public void voidSafeRun() { - SynchronizedWizardPage.this.getSynchronizedObject() - .setImageDescriptor(image); - } - }); - } - - public void setTitle(final String title) { - this.voidExceptionFreeRunnable(new AbstractVoidExceptionFreeRunnable() { - @Override - public void voidSafeRun() { - SynchronizedWizardPage.this.getSynchronizedObject().setTitle( - title); - } - }); - } - - public void setVisible(final boolean visible) { - this.voidExceptionFreeRunnable(new AbstractVoidExceptionFreeRunnable() { - @Override - public void voidSafeRun() { - SynchronizedWizardPage.this.getSynchronizedObject().setVisible( - visible); - } - }); - } - - public boolean canFlipToNextPage() { - return this.safeSyncExec(new AbstractExceptionFreeRunnable<Boolean>() { - @Override - public Boolean safeRun() { - return Boolean.valueOf(SynchronizedWizardPage.this - .getSynchronizedObject() - .canFlipToNextPage()); - } - }).booleanValue(); - } - - public IWizardPage getNextPage() { - return this - .safeSyncExec(new AbstractExceptionFreeRunnable<IWizardPage>() { - @Override - public IWizardPage safeRun() { - return SynchronizedWizardPage.this - .getSynchronizedObject().getNextPage(); - } - }); - } - - public IWizardPage getPreviousPage() { - return this - .safeSyncExec(new AbstractExceptionFreeRunnable<IWizardPage>() { - @Override - public IWizardPage safeRun() { - return SynchronizedWizardPage.this - .getSynchronizedObject().getPreviousPage(); - } - }); - } - - public IWizard getWizard() { - return this.safeSyncExec(new AbstractExceptionFreeRunnable<IWizard>() { - @Override - public IWizard safeRun() { - return SynchronizedWizardPage.this.getSynchronizedObject() - .getWizard(); - } - }); - } - - public boolean isPageComplete() { - return this.safeSyncExec(new AbstractExceptionFreeRunnable<Boolean>() { - @Override - public Boolean safeRun() { - return Boolean.valueOf(SynchronizedWizardPage.this - .getSynchronizedObject().isPageComplete()); - } - }).booleanValue(); - } - - public void setPreviousPage(final IWizardPage page) { - this.voidExceptionFreeRunnable(new AbstractVoidExceptionFreeRunnable() { - @Override - public void voidSafeRun() { - SynchronizedWizardPage.this.getSynchronizedObject() - .setPreviousPage(page); - } - }); - } - - public void setWizard(final IWizard newWizard) { - this.voidExceptionFreeRunnable(new AbstractVoidExceptionFreeRunnable() { - @Override - public void voidSafeRun() { - SynchronizedWizardPage.this.getSynchronizedObject().setWizard( - newWizard); - } - }); - } - - public String getName() { - return this.safeSyncExec(new AbstractExceptionFreeRunnable<String>() { - @Override - public String safeRun() { - return SynchronizedWizardPage.this.getSynchronizedObject() - .getName(); - } - }); - } -}
diff --git a/org.eclipse.modisco.facet.util.emf.ui/src/org/eclipse/emf/facet/util/emf/ui/internal/exported/util/wizard/page/exception/SelectedEClassifierRuntimeException.java b/org.eclipse.modisco.facet.util.emf.ui/src/org/eclipse/emf/facet/util/emf/ui/internal/exported/util/wizard/page/exception/SelectedEClassifierRuntimeException.java deleted file mode 100644 index 383775d..0000000 --- a/org.eclipse.modisco.facet.util.emf.ui/src/org/eclipse/emf/facet/util/emf/ui/internal/exported/util/wizard/page/exception/SelectedEClassifierRuntimeException.java +++ /dev/null
@@ -1,39 +0,0 @@ -/** - * Copyright (c) 2012 Mia-Software. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Alban Ménager (Soft-Maint) - Bug 387470 - [EFacet][Custom] Editors - */ -package org.eclipse.emf.facet.util.emf.ui.internal.exported.util.wizard.page.exception; - -/** - * @since 0.3 - */ -public class SelectedEClassifierRuntimeException extends RuntimeException { - - - private static final long serialVersionUID = -1021467669726982508L; - - public SelectedEClassifierRuntimeException() { - super( - "List not totally loaded. Check if the list's job is done before doing the selection."); //$NON-NLS-1$ - } - - public SelectedEClassifierRuntimeException(final String message) { - super(message); - } - - public SelectedEClassifierRuntimeException(final String message, - final Throwable cause) { - super(message, cause); - } - - public SelectedEClassifierRuntimeException(final Throwable cause) { - super(cause); - } -}
diff --git a/org.eclipse.modisco.facet.util.emf.ui/src/org/eclipse/emf/facet/util/emf/ui/internal/exported/util/wizard/page/exception/SelectedEPackageRuntimeException.java b/org.eclipse.modisco.facet.util.emf.ui/src/org/eclipse/emf/facet/util/emf/ui/internal/exported/util/wizard/page/exception/SelectedEPackageRuntimeException.java deleted file mode 100644 index 0c8f96d..0000000 --- a/org.eclipse.modisco.facet.util.emf.ui/src/org/eclipse/emf/facet/util/emf/ui/internal/exported/util/wizard/page/exception/SelectedEPackageRuntimeException.java +++ /dev/null
@@ -1,41 +0,0 @@ -/** - * Copyright (c) 2012 Mia-Software. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Alban Ménager (Soft-Maint) - Bug 387470 - [EFacet][Custom] Editors - */ -package org.eclipse.emf.facet.util.emf.ui.internal.exported.util.wizard.page.exception; - -/** - * Exception when the list (where the selection has to be done) is not totally - * loaded. - * - * @since 0.3 - */ -public class SelectedEPackageRuntimeException extends RuntimeException { - - private static final long serialVersionUID = -5317379187255054199L; - - public SelectedEPackageRuntimeException() { - super( - "List not totally loaded. Check if the list's job is done before doing the selection."); //$NON-NLS-1$ - } - - public SelectedEPackageRuntimeException(final String message) { - super(message); - } - - public SelectedEPackageRuntimeException(final String message, - final Throwable cause) { - super(message, cause); - } - - public SelectedEPackageRuntimeException(final Throwable cause) { - super(cause); - } -}
diff --git a/org.eclipse.modisco.facet.util.emf.ui/src/org/eclipse/emf/facet/util/emf/ui/internal/exported/wizard/ISelectETypeWizard.java b/org.eclipse.modisco.facet.util.emf.ui/src/org/eclipse/emf/facet/util/emf/ui/internal/exported/wizard/ISelectETypeWizard.java deleted file mode 100644 index fdbf283..0000000 --- a/org.eclipse.modisco.facet.util.emf.ui/src/org/eclipse/emf/facet/util/emf/ui/internal/exported/wizard/ISelectETypeWizard.java +++ /dev/null
@@ -1,25 +0,0 @@ -/** - * Copyright (c) 2012 Mia-Software. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Alban Ménager (Soft-Maint) - Bug 387470 - [EFacet][Custom] Editors - * Grégoire Dupé (Mia-Software) - Bug 387470 - [EFacet][Custom] Editors - */ -package org.eclipse.emf.facet.util.emf.ui.internal.exported.wizard; - -import org.eclipse.emf.ecore.EClassifier; -import org.eclipse.emf.facet.util.ui.internal.exported.wizard.IExtendedWizard; - -/** - * @since 0.3 - */ -public interface ISelectETypeWizard<T extends EClassifier> extends - IExtendedWizard { - - T getSelectedEClassifier(); -}
diff --git a/org.eclipse.modisco.facet.util.emf.ui/src/org/eclipse/emf/facet/util/emf/ui/internal/exported/wizard/page/ISelectEClassifierWizardPage.java b/org.eclipse.modisco.facet.util.emf.ui/src/org/eclipse/emf/facet/util/emf/ui/internal/exported/wizard/page/ISelectEClassifierWizardPage.java deleted file mode 100644 index 29e736b..0000000 --- a/org.eclipse.modisco.facet.util.emf.ui/src/org/eclipse/emf/facet/util/emf/ui/internal/exported/wizard/page/ISelectEClassifierWizardPage.java +++ /dev/null
@@ -1,43 +0,0 @@ -/** - * Copyright (c) 2012 Mia-Software. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Alban Ménager (Soft-Maint) - Bug 387470 - [EFacet][Custom] Editors - * Grégoire Dupé (Mia-Software) - Bug 387470 - [EFacet][Custom] Editors - */ -package org.eclipse.emf.facet.util.emf.ui.internal.exported.wizard.page; - -import org.eclipse.emf.ecore.EClassifier; -import org.eclipse.emf.facet.util.emf.ui.internal.exported.util.wizard.page.SelectEClassifierWizardPage; -import org.eclipse.jface.wizard.IWizardPage; - -/** - * Interface for {@link SelectEClassifierWizardPage}. - * - * @see SelectEClassifierWizardPage - * @since 0.3 - * @noextend This interface is not intended to be extended by clients. - * @noimplement This interface is not intended to be implemented by clients. - */ -public interface ISelectEClassifierWizardPage<T extends EClassifier> extends - IWizardPage { - - /** - * @return the selected {@link EClassifier}. - */ - T getSelectedEClassifier(); - - /** - * Set the {@link EClassifier}. - * - * @param selection - * the name of the {@link EClassifier} to select. - */ - void selectEClassifier(final String selection); - -} \ No newline at end of file
diff --git a/org.eclipse.modisco.facet.util.emf.ui/src/org/eclipse/emf/facet/util/emf/ui/internal/exported/wizard/page/ISelectEPackageWizardPage.java b/org.eclipse.modisco.facet.util.emf.ui/src/org/eclipse/emf/facet/util/emf/ui/internal/exported/wizard/page/ISelectEPackageWizardPage.java deleted file mode 100644 index c0cd3dc..0000000 --- a/org.eclipse.modisco.facet.util.emf.ui/src/org/eclipse/emf/facet/util/emf/ui/internal/exported/wizard/page/ISelectEPackageWizardPage.java +++ /dev/null
@@ -1,40 +0,0 @@ -/** - * Copyright (c) 2012 Mia-Software. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Alban Ménager (Soft-Maint) - Bug 387470 - [EFacet][Custom] Editors - */ -package org.eclipse.emf.facet.util.emf.ui.internal.exported.wizard.page; - -import org.eclipse.emf.ecore.EPackage; -import org.eclipse.jface.wizard.IWizardPage; - -/** - * Interface for {@link SelectEPackageWizardPage}. - * - * @see SelectEPackageWizardPage - * @since 0.3 - * @noextend This interface is not intended to be extended by clients. - * @noimplement This interface is not intended to be implemented by clients. - */ -public interface ISelectEPackageWizardPage extends IWizardPage { - - /** - * @return the first {@link EPackage} selected in the list. - */ - EPackage getSelectedEPackage(); - - /** - * Set the {@link EPackage} to select. - * - * @param selection - * the name of the {@link EPackage} to select. - */ - void selectPackage(final String selection); - -} \ No newline at end of file
diff --git a/org.eclipse.modisco.facet.util.emf.ui/src/org/eclipse/emf/facet/util/emf/ui/internal/handler/SaveAsHandler.java b/org.eclipse.modisco.facet.util.emf.ui/src/org/eclipse/emf/facet/util/emf/ui/internal/handler/SaveAsHandler.java deleted file mode 100644 index 326818b..0000000 --- a/org.eclipse.modisco.facet.util.emf.ui/src/org/eclipse/emf/facet/util/emf/ui/internal/handler/SaveAsHandler.java +++ /dev/null
@@ -1,94 +0,0 @@ -/** - * Copyright (c) 2013 Mia-Software. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Gregoire Dupe (Mia-Software) - Bug 406570 - Handlers to Save and SaveAs EMF resources - */ -package org.eclipse.emf.facet.util.emf.ui.internal.handler; - -import java.util.ArrayList; -import java.util.List; - -import org.eclipse.core.commands.ExecutionEvent; -import org.eclipse.core.commands.ExecutionException; -import org.eclipse.core.commands.IHandler; -import org.eclipse.core.commands.IHandlerListener; -import org.eclipse.core.runtime.IAdaptable; -import org.eclipse.emf.ecore.resource.Resource; -import org.eclipse.emf.facet.util.emf.ui.internal.ResourceUiUtils; -import org.eclipse.jface.viewers.ISelection; -import org.eclipse.jface.viewers.StructuredSelection; -import org.eclipse.swt.widgets.Shell; -import org.eclipse.ui.ISelectionService; -import org.eclipse.ui.IWorkbench; -import org.eclipse.ui.IWorkbenchWindow; -import org.eclipse.ui.PlatformUI; -import org.eclipse.ui.handlers.HandlerUtil; - -public class SaveAsHandler implements IHandler { - - public void addHandlerListener(final IHandlerListener handlerListener) { - // Nothing to do - } - - public void dispose() { - // Nothing to do - } - - public Object execute(final ExecutionEvent event) throws ExecutionException { - final Shell shell = HandlerUtil.getActiveShell(event); - for (Object object : getSelection()) { - if (object instanceof Resource) { - final Resource resource = (Resource) object; - ResourceUiUtils.openSaveAsDialog(resource, shell); - } else if (object instanceof IAdaptable) { - final IAdaptable adaptable = (IAdaptable) object; - final Resource resource = (Resource) adaptable - .getAdapter(Resource.class); - if (resource != null) { - ResourceUiUtils.openSaveAsDialog(resource, shell); - } - } - } - return null; - } - - public boolean isEnabled() { - return true; - } - - public boolean isHandled() { - return isEnabled(); - } - - public void removeHandlerListener(final IHandlerListener handlerListener) { - // Nothing to do - } - - private static <E> List<E> getSelection() { - final List<E> result = new ArrayList<E>(); - final IWorkbenchWindow wWindow = getActiveWindow(); - final ISelectionService selectService = wWindow.getSelectionService(); - final ISelection selection = selectService.getSelection(); - if (selection instanceof StructuredSelection) { - final StructuredSelection structS = (StructuredSelection) selection; - @SuppressWarnings("unchecked") - // @SuppressWarnings This cast is unsafe but the framework does not - // provide other way to do - final List<E> list = structS.toList(); - result.addAll(list); - } - return result; - } - - private static IWorkbenchWindow getActiveWindow() { - final IWorkbench workbench = PlatformUI.getWorkbench(); - return workbench.getActiveWorkbenchWindow(); - } - -}
diff --git a/org.eclipse.modisco.facet.util.emf.ui/src/org/eclipse/emf/facet/util/emf/ui/internal/handler/SaveHandler.java b/org.eclipse.modisco.facet.util.emf.ui/src/org/eclipse/emf/facet/util/emf/ui/internal/handler/SaveHandler.java deleted file mode 100644 index cf9585f..0000000 --- a/org.eclipse.modisco.facet.util.emf.ui/src/org/eclipse/emf/facet/util/emf/ui/internal/handler/SaveHandler.java +++ /dev/null
@@ -1,95 +0,0 @@ -/** - * Copyright (c) 2013 Mia-Software. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Gregoire Dupe (Mia-Software) - Bug 406570 - Handlers to Save and SaveAs EMF resources - */ -package org.eclipse.emf.facet.util.emf.ui.internal.handler; - -import java.util.ArrayList; -import java.util.List; - -import org.eclipse.core.commands.ExecutionEvent; -import org.eclipse.core.commands.ExecutionException; -import org.eclipse.core.commands.IHandler; -import org.eclipse.core.commands.IHandlerListener; -import org.eclipse.core.runtime.IAdaptable; -import org.eclipse.emf.ecore.resource.Resource; -import org.eclipse.emf.facet.util.emf.ui.internal.ResourceUiUtils; -import org.eclipse.jface.viewers.ISelection; -import org.eclipse.jface.viewers.StructuredSelection; -import org.eclipse.swt.widgets.Shell; -import org.eclipse.ui.ISelectionService; -import org.eclipse.ui.IWorkbench; -import org.eclipse.ui.IWorkbenchWindow; -import org.eclipse.ui.PlatformUI; -import org.eclipse.ui.handlers.HandlerUtil; - -public class SaveHandler implements IHandler { - - public void addHandlerListener(final IHandlerListener handlerListener) { - // Nothing to do - } - - public void dispose() { - // Nothing to do - } - - public Object execute(final ExecutionEvent event) throws ExecutionException { - final Shell shell = HandlerUtil.getActiveShell(event); - for (Object object : getSelection()) { - if (object instanceof Resource) { - final Resource resource = (Resource) object; - ResourceUiUtils.save(resource, shell); - } else if (object instanceof IAdaptable) { - final IAdaptable adaptable = (IAdaptable) object; - final Resource resource = (Resource) adaptable - .getAdapter(Resource.class); - if (resource != null) { - ResourceUiUtils.save(resource, shell); - } - } - } - return null; - } - - public boolean isEnabled() { - return true; - } - - public boolean isHandled() { - return isEnabled(); - } - - public void removeHandlerListener(final IHandlerListener handlerListener) { - // Nothing to do - } - - private static <E> List<E> getSelection() { - final List<E> result = new ArrayList<E>(); - final IWorkbenchWindow wWindow = getActiveWindow(); - final ISelectionService selectService = wWindow.getSelectionService(); - wWindow.getActivePage().getActivePart(); - final ISelection selection = selectService.getSelection(); - if (selection instanceof StructuredSelection) { - final StructuredSelection structS = (StructuredSelection) selection; - @SuppressWarnings("unchecked") - // @SuppressWarnings This cast is unsafe but the framework does not - // provide other way to do - final List<E> list = structS.toList(); - result.addAll(list); - } - return result; - } - - private static IWorkbenchWindow getActiveWindow() { - final IWorkbench workbench = PlatformUI.getWorkbench(); - return workbench.getActiveWorkbenchWindow(); - } - -}
diff --git a/org.eclipse.modisco.facet.util.emf.ui/src/org/eclipse/emf/facet/util/emf/ui/internal/preference/pages/DefaultBrowserPreferencePage.java b/org.eclipse.modisco.facet.util.emf.ui/src/org/eclipse/emf/facet/util/emf/ui/internal/preference/pages/DefaultBrowserPreferencePage.java deleted file mode 100644 index b31b500..0000000 --- a/org.eclipse.modisco.facet.util.emf.ui/src/org/eclipse/emf/facet/util/emf/ui/internal/preference/pages/DefaultBrowserPreferencePage.java +++ /dev/null
@@ -1,106 +0,0 @@ -/********************************************************************************** - * Copyright (c) 2009, 2011 Mia-Software. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Nicolas Bros (Mia-Software) - * Nicolas Guyomar (Mia-Software) - Bug 333652 Extension point offering the possibility to declare an EPackage browser - * Nicolas Bros (Mia-Software) - Bug 335218 - Extension point for registering EObject, EPackage, model editor - ***********************************************************************************/ -package org.eclipse.emf.facet.util.emf.ui.internal.preference.pages; - -import java.util.List; - -import org.eclipse.core.runtime.preferences.InstanceScope; -import org.eclipse.emf.facet.util.emf.core.IBrowserRegistry; -import org.eclipse.emf.facet.util.emf.core.IEObjectBrowserOpener; -import org.eclipse.emf.facet.util.emf.core.IEPackageBrowserOpener; -import org.eclipse.emf.facet.util.emf.core.IResourceBrowserOpener; -import org.eclipse.emf.facet.util.emf.core.internal.preferences.PreferenceConstants; -import org.eclipse.emf.facet.util.emf.ui.internal.Messages; -import org.eclipse.jface.preference.ComboFieldEditor; -import org.eclipse.jface.preference.FieldEditorPreferencePage; -import org.eclipse.ui.IWorkbench; -import org.eclipse.ui.IWorkbenchPreferencePage; -import org.eclipse.ui.preferences.ScopedPreferenceStore; - -/** - * This class implements a preference page that allows the user to choose which EPackage Browser - * they want to use. - */ -public class DefaultBrowserPreferencePage extends FieldEditorPreferencePage implements - IWorkbenchPreferencePage { - - public DefaultBrowserPreferencePage() { - super(FieldEditorPreferencePage.GRID); - ScopedPreferenceStore scopedPreferenceStore = new ScopedPreferenceStore( - new InstanceScope(), - org.eclipse.emf.facet.util.emf.core.internal.Activator.PLUGIN_ID); - setPreferenceStore(scopedPreferenceStore); - } - - /** - * Creates the field editors. Field editors are abstractions of the common GUI blocks needed to - * manipulate various types of preferences. Each field editor knows how to save and restore - * itself. - */ - @Override - public void createFieldEditors() { - createResourceOpenerField(); - createEObjectOpenerField(); - createEPackageOpenerField(); - } - - private void createEPackageOpenerField() { - List<IEPackageBrowserOpener> openers = IBrowserRegistry.INSTANCE - .getAllRegisteredEPackageBrowsers(); - int size = openers.size(); - String[][] entryNamesAndValues = new String[size][2]; - for (int i = 0; i < size; i++) { - IEPackageBrowserOpener opener = openers.get(i); - entryNamesAndValues[i][0] = opener.getBrowserName(); - entryNamesAndValues[i][1] = opener.getClass().getName(); - } - addField(new ComboFieldEditor(PreferenceConstants.P_DEFAULT_EPACKAGE_VIEWER, - Messages.EmfFacetRootPreferencePage_default_epackage_browser, entryNamesAndValues, - getFieldEditorParent())); - } - - private void createEObjectOpenerField() { - List<IEObjectBrowserOpener> openers = IBrowserRegistry.INSTANCE - .getAllRegisteredEObjectBrowsers(); - int size = openers.size(); - String[][] entryNamesAndValues = new String[size][2]; - for (int i = 0; i < size; i++) { - IEObjectBrowserOpener opener = openers.get(i); - entryNamesAndValues[i][0] = opener.getBrowserName(); - entryNamesAndValues[i][1] = opener.getClass().getName(); - } - addField(new ComboFieldEditor(PreferenceConstants.P_DEFAULT_EOBJECT_VIEWER, - Messages.EPackageBrowserPreferencePage_defaultEObjectViewer, entryNamesAndValues, - getFieldEditorParent())); - } - - private void createResourceOpenerField() { - List<IResourceBrowserOpener> openers = IBrowserRegistry.INSTANCE - .getAllRegisteredResourceBrowsers(); - int size = openers.size(); - String[][] entryNamesAndValues = new String[size][2]; - for (int i = 0; i < size; i++) { - IResourceBrowserOpener opener = openers.get(i); - entryNamesAndValues[i][0] = opener.getBrowserName(); - entryNamesAndValues[i][1] = opener.getClass().getName(); - } - addField(new ComboFieldEditor(PreferenceConstants.P_DEFAULT_RESOURCE_VIEWER, - Messages.EPackageBrowserPreferencePage_defaultResourceViewer, entryNamesAndValues, - getFieldEditorParent())); - } - - public void init(final IWorkbench workbench) { - // Nothing to do - } - -} \ No newline at end of file
diff --git a/org.eclipse.modisco.facet.util.emf.ui/src/org/eclipse/emf/facet/util/emf/ui/internal/utils/ImageProvider.java b/org.eclipse.modisco.facet.util.emf.ui/src/org/eclipse/emf/facet/util/emf/ui/internal/utils/ImageProvider.java deleted file mode 100644 index da2d7f4..0000000 --- a/org.eclipse.modisco.facet.util.emf.ui/src/org/eclipse/emf/facet/util/emf/ui/internal/utils/ImageProvider.java +++ /dev/null
@@ -1,62 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2011 Mia-Software. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Nicolas Guyomar (Mia-Software) - Bug 333652 Extension point offering the possibility to declare an EPackage browser - * Gregoire Dupe (Mia-Software) - Bug 406578 - Generic Label Provider for EMF objects - *******************************************************************************/ -package org.eclipse.emf.facet.util.emf.ui.internal.utils; - -import org.eclipse.emf.facet.util.emf.ui.internal.Activator; -import org.eclipse.emf.facet.util.swt.imageprovider.IImageProvider; -import org.eclipse.emf.facet.util.swt.imageprovider.IImageProviderFactory; -import org.eclipse.jface.resource.ImageDescriptor; -import org.eclipse.swt.graphics.Image; - -/** - * Provides icons for EMF Facet, and caches them. - */ -public final class ImageProvider { - public static final String EMFFACET_LOGO = "icons/logoEmfFacetMini.gif"; //$NON-NLS-1$ - public static final String CATALOG = "icons/catalog.png"; //$NON-NLS-1$ - public static final String MODEL = "icons/ModelIcon.gif"; //$NON-NLS-1$ - - private static final ImageProvider SINGLETON = new ImageProvider(); - public static final IImageProvider DEFAULT = IImageProviderFactory.DEFAULT - .createIImageProvider(Activator.getDefault()); - - private ImageProvider() { - // Must not be used - } - - @Deprecated - public static ImageProvider getInstance() { - return ImageProvider.SINGLETON; - } - - @SuppressWarnings("static-method") - // @SuppressWarnings("static-method") This warning is caused by the - // redirection code associated to the deprecation of this method. - @Deprecated - public Image getEmfFacetLogo() { - return DEFAULT.getImage(EMFFACET_LOGO); - } - - @Deprecated - public static ImageDescriptor getEmfFacetLogoDescriptor() { - return DEFAULT.createImageDescriptor(ImageProvider.EMFFACET_LOGO); - } - - /** Return the icon representing a bidirectional link */ - @SuppressWarnings("static-method") - // @SuppressWarnings("static-method") This warning is caused by the - // redirection code associated to the deprecation of this method. - @Deprecated - public Image getCatalogIcon() { - return DEFAULT.getImage(CATALOG); - } -}
diff --git a/org.eclipse.modisco.facet.util.emf.ui/src/org/eclipse/emf/facet/util/emf/ui/internal/utils/ImageUtils.java b/org.eclipse.modisco.facet.util.emf.ui/src/org/eclipse/emf/facet/util/emf/ui/internal/utils/ImageUtils.java deleted file mode 100644 index 75bee2e..0000000 --- a/org.eclipse.modisco.facet.util.emf.ui/src/org/eclipse/emf/facet/util/emf/ui/internal/utils/ImageUtils.java +++ /dev/null
@@ -1,55 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009 Mia-Software. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Gregoire Dupe (Mia-Software) - *******************************************************************************/ -package org.eclipse.emf.facet.util.emf.ui.internal.utils; - -import org.eclipse.emf.common.notify.AdapterFactory; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.edit.provider.ComposedAdapterFactory; -import org.eclipse.emf.edit.provider.IItemLabelProvider; -import org.eclipse.emf.edit.ui.provider.ExtendedImageRegistry; -import org.eclipse.swt.graphics.Image; - -/** - * Utility class for handling {@link Image}s. - * - * @author Gregoire Dupe - */ -public final class ImageUtils { - private static AdapterFactory composedAdapterFactory = new ComposedAdapterFactory( - ComposedAdapterFactory.Descriptor.Registry.INSTANCE); - - private ImageUtils() { - // Nothing to do - } - - /** - * Returns an image for the given model element from the EMF global - * registry. - * - * @param object - * an {@link EObject} for which an {@link Image} is required - * @return an image or <code>null</code> if none was found for the given - * element, or the element is not an {@link EObject} - */ - public static Image getImage(final Object object) { - Image result = null; - if (object instanceof EObject) { - EObject eObject = (EObject) object; - IItemLabelProvider itemLabelProvider = (IItemLabelProvider) ImageUtils.composedAdapterFactory - .adapt(eObject, IItemLabelProvider.class); - if (itemLabelProvider != null) { - Object image = itemLabelProvider.getImage(eObject); - result = ExtendedImageRegistry.getInstance().getImage(image); - } - } - return result; - } -}
diff --git a/org.eclipse.modisco.facet.util.emf.ui/src/org/eclipse/emf/facet/util/emf/ui/internal/view/PackageRegistryView.java b/org.eclipse.modisco.facet.util.emf.ui/src/org/eclipse/emf/facet/util/emf/ui/internal/view/PackageRegistryView.java deleted file mode 100644 index a2c185c..0000000 --- a/org.eclipse.modisco.facet.util.emf.ui/src/org/eclipse/emf/facet/util/emf/ui/internal/view/PackageRegistryView.java +++ /dev/null
@@ -1,335 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2010, 2011 Mia-Software. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Gregoire Dupe (Mia-Software) - initial API and implementation - * Nicolas Bros (Mia-Software) - * Nicolas Guyomar (Mia-Software) - Bug 333652 Extension point offering the possibility to declare an EPackage browser - *******************************************************************************/ -package org.eclipse.emf.facet.util.emf.ui.internal.view; - -import java.util.ArrayList; -import java.util.List; - -import org.eclipse.core.resources.IFile; -import org.eclipse.core.runtime.Platform; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.EPackage; -import org.eclipse.emf.ecore.EPackage.Registry; -import org.eclipse.emf.facet.common.ui.internal.views.AbstractTreeView; -import org.eclipse.emf.facet.util.core.Logger; -import org.eclipse.emf.facet.util.emf.core.IBrowserRegistry; -import org.eclipse.emf.facet.util.emf.ui.internal.Activator; -import org.eclipse.emf.facet.util.emf.ui.internal.Messages; -import org.eclipse.emf.facet.util.emf.ui.internal.utils.ImageUtils; -import org.eclipse.jface.action.Action; -import org.eclipse.jface.action.GroupMarker; -import org.eclipse.jface.action.IAction; -import org.eclipse.jface.action.IMenuListener; -import org.eclipse.jface.action.IMenuManager; -import org.eclipse.jface.action.MenuManager; -import org.eclipse.jface.viewers.ColumnLabelProvider; -import org.eclipse.jface.viewers.IContentProvider; -import org.eclipse.jface.viewers.ISelection; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.jface.viewers.ITreeContentProvider; -import org.eclipse.jface.viewers.Viewer; -import org.eclipse.swt.dnd.Clipboard; -import org.eclipse.swt.dnd.TextTransfer; -import org.eclipse.swt.dnd.Transfer; -import org.eclipse.swt.graphics.Image; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Display; -import org.eclipse.swt.widgets.Menu; -import org.eclipse.ui.IWorkbenchActionConstants; - -/** - * An Eclipse view that displays a list of available Ecore meta-models. - */ -public class PackageRegistryView extends AbstractTreeView implements IMenuListener { - - private static final String NAME_COLUMN = "PackageRegistryView_NameColumn"; //$NON-NLS-1$ - private static final String NSURI_COLUMN = "PackageRegistryView_NsURIColumn"; //$NON-NLS-1$ - - private static final int COLUMN_WIDTH = 200; - - private static final String DEBUG_ID = "org.eclipse.emf.facet.infra.common.ui/debug/PackageRegistryView/event_debug"; //$NON-NLS-1$ - private static final boolean DEBUG = Activator.getDefault().isDebugging() - && new Boolean(Platform.getDebugOption(PackageRegistryView.DEBUG_ID)).booleanValue(); - - @Override - public void createPartControl(final Composite parent) { - super.createPartControl(parent); - createContextMenu(); - } - - @Override - protected void createContextMenu() { - final MenuManager contextMenu = new MenuManager("#PopUp"); //$NON-NLS-1$ - contextMenu.add(this.actionCopyNsURI); - contextMenu.add(new GroupMarker(IWorkbenchActionConstants.MB_ADDITIONS)); - contextMenu.addMenuListener(this); - final Menu menu = contextMenu.createContextMenu(getViewer().getControl()); - getViewer().getControl().setMenu(menu); - getSite().registerContextMenu(contextMenu, getViewer()); - } - - @Override - public void dispose() { - super.dispose(); - } - - @Override - protected void createColumns() { - createNameColumn(); - createNsUriColumn(); - } - - private void createNameColumn() { - ColumnLabelProvider columnLabelProvider = new ColumnLabelProvider() { - @Override - public String getText(final Object element) { - if (element instanceof EPackage) { - EPackage ePackage = (EPackage) element; - return ePackage.getName(); - } else if (element instanceof String) { - return (String) element; - } - return ""; //$NON-NLS-1$ - } - - @Override - public Image getImage(final Object element) { - return ImageUtils.getImage(element); - } - }; - createColumn(Messages.PackageRegistryView_Name, PackageRegistryView.NAME_COLUMN, - PackageRegistryView.COLUMN_WIDTH, columnLabelProvider); - } - - private void createNsUriColumn() { - ColumnLabelProvider columnLabelProvider = new ColumnLabelProvider() { - @Override - public String getText(final Object element) { - if (!(element instanceof EPackage)) { - return ""; //$NON-NLS-1$ - } - EPackage ePackage = (EPackage) element; - return ePackage.getNsURI(); - } - }; - createColumn(Messages.PackageRegistryView_nsURI, PackageRegistryView.NSURI_COLUMN, - PackageRegistryView.COLUMN_WIDTH * 2, columnLabelProvider); - } - - /** - * Reads the registry in a non-UI thread, so that the UI thread will be able to access it faster - * - * @param registry - * the registry to preload - */ - private static void preloadRegistry(final Registry registry) { - // avoid ConcurrentModificationException - List<String> keys = new ArrayList<String>(); - keys.addAll(registry.keySet()); - for (String nsURI : keys) { - try { - registry.getEPackage(nsURI); - } catch (Exception e) { - Logger.logWarning(e, - "An error happened while loading an EPackage from Package.Registry.INSTANCE: " //$NON-NLS-1$ - + nsURI, Activator.getDefault()); - } catch (LinkageError e) { - Logger.logError(e, "An error prevented an EPackage from being loaded: " //$NON-NLS-1$ - + nsURI, Activator.getDefault()); - } - } - } - - /** - * An {@link EObject} was added to the package registry - * - * @param eObject - * @param file - */ - public void added(final EObject eObject, final IFile file) { - if (PackageRegistryView.DEBUG) { - System.out.println(this.getClass().getSimpleName() + ".added(EObject,IFile)"); //$NON-NLS-1$ - } - refresh(true); - } - - /** - * An {@link EObject} was changed in the package registry - * - * @param eObject - * @param file - */ - public void changed(final EObject eObject, final IFile file) { - if (PackageRegistryView.DEBUG) { - System.out.println(this.getClass().getSimpleName() + ".changed(EObject,IFile)"); //$NON-NLS-1$ - } - refresh(true); - } - - /** - * A file was removed from the package registry - * - * @param file - */ - public void removed(final IFile file) { - if (PackageRegistryView.DEBUG) { - System.out.println(this.getClass().getSimpleName() + ".removed(EObject,IFile)"); //$NON-NLS-1$ - } - refresh(true); - } - - @Override - protected IContentProvider getContentProvider() { - return new ITreeContentProvider() { - public Object[] getElements(final Object inputElement) { - if (inputElement instanceof EPackage.Registry) { - EPackage.Registry registry = (EPackage.Registry) inputElement; - List<EPackage> ePackages = new ArrayList<EPackage>(); - // avoid a ConcurrentModificationException - List<String> keys = new ArrayList<String>(); - keys.addAll(registry.keySet()); - for (String nsURI : keys) { - try { - EPackage ePackage = registry.getEPackage(nsURI); - if (ePackage == null) { - throw new Exception("ePackage is null for : " //$NON-NLS-1$ - + nsURI); - } - ePackages.add(ePackage); - } catch (Exception e) { - Logger.logWarning(e, - "An error happened while loading an EPackage from Package.Registry.INSTANCE: " //$NON-NLS-1$ - + nsURI, Activator.getDefault()); - } - } - return ePackages.toArray(); - } else if (inputElement == null) { - return new Object[] {}; - } else if (inputElement instanceof String) { - String message = (String) inputElement; - return new Object[] { message }; - } else { - throw new RuntimeException("Unexpected element type: " //$NON-NLS-1$ - + inputElement.getClass().getName()); - } - } - - public void inputChanged(final Viewer viewer, final Object oldInput, - final Object newInput) { - // Nothing to do - } - - public Object[] getChildren(final Object parentElement) { - if (parentElement instanceof EPackage.Registry) { - EPackage.Registry registry = (EPackage.Registry) parentElement; - return registry.values().toArray(); - } else if (parentElement == null || parentElement instanceof String) { - return new Object[] {}; - } else { - throw new RuntimeException("Unexpected element type: " //$NON-NLS-1$ - + parentElement.getClass().getName()); - } - } - - public Object getParent(final Object element) { - return null; - } - - public boolean hasChildren(final Object element) { - if (element instanceof EPackage.Registry) { - return true; - } - return false; - } - - public void dispose() { - // Nothing to do - } - }; - } - - @Override - protected void openElement(final Object element) { - if (element instanceof EPackage) { - EPackage ePackage = (EPackage) element; - IBrowserRegistry.INSTANCE.browseEPackage(ePackage); - } - } - - @Override - protected String getRefreshMessage() { - return Messages.PackageRegistryView_RefreshingPackageRegistryView; - } - - @Override - protected void doRefresh() { - // display a message while initializing - // (initialization can take a while) - Display.getDefault().syncExec(new Runnable() { - public void run() { - getViewer().setInput(Messages.PackageRegistryView_initializing); - } - }); - final EPackage.Registry registry = EPackage.Registry.INSTANCE; - // Read a first time in a non-UI thread so as to avoid - // blocking. Then it will be cached for the UI thread. - preloadRegistry(registry); - Display.getDefault().syncExec(new Runnable() { - public void run() { - // the control might be disposed if the view was closed - // in the meantime - if (!getViewer().getControl().isDisposed()) { - getViewer().setInput(registry); - getViewer().refresh(); - } - } - }); - } - - @Override - protected Object getInput() { - return EPackage.Registry.INSTANCE; - } - - private final Action actionCopyNsURI = new Action(Messages.PackageRegistryView_copyNsURI, - IAction.AS_PUSH_BUTTON) { - @Override - public void run() { - EPackage selectedPackage = PackageRegistryView.this.getSelectedPackage(); - if (selectedPackage != null) { - String nsURI = selectedPackage.getNsURI(); - Clipboard clipboard = new Clipboard(Display.getDefault()); - clipboard.setContents(new Object[] { nsURI }, - new Transfer[] { TextTransfer.getInstance() }); - clipboard.dispose(); - } - } - }; - - protected EPackage getSelectedPackage() { - ISelection selection = getViewer().getSelection(); - if (selection instanceof IStructuredSelection) { - IStructuredSelection structuredSelection = (IStructuredSelection) selection; - Object element = structuredSelection.getFirstElement(); - if (element instanceof EPackage) { - EPackage ePackage = (EPackage) element; - return ePackage; - } - } - return null; - } - - public void menuAboutToShow(final IMenuManager manager) { - this.actionCopyNsURI.setEnabled(getSelectedPackage() != null); - } -}
diff --git a/org.eclipse.modisco.facet.util.emf.ui/src/org/eclipse/emf/facet/util/emf/ui/util/EditingUtil.java b/org.eclipse.modisco.facet.util.emf.ui/src/org/eclipse/emf/facet/util/emf/ui/util/EditingUtil.java deleted file mode 100644 index 2de24b1..0000000 --- a/org.eclipse.modisco.facet.util.emf.ui/src/org/eclipse/emf/facet/util/emf/ui/util/EditingUtil.java +++ /dev/null
@@ -1,60 +0,0 @@ -/** - * Copyright (c) 2012 Mia-Software. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Alban Ménager (Soft-Maint) - Bug 387470 - [EFacet][Custom] Editors - */ -package org.eclipse.emf.facet.util.emf.ui.util; - -import java.io.File; - -import org.eclipse.emf.common.util.URI; -import org.eclipse.emf.ecore.resource.Resource; -import org.eclipse.emf.edit.domain.EditingDomain; -import org.eclipse.emf.edit.domain.IEditingDomainProvider; -import org.eclipse.ui.IWorkbenchPart; -import org.eclipse.ui.PlatformUI; - -/** - * @since 0.3 - */ -public final class EditingUtil { - - private EditingUtil() { - // Hidden constructor. - } - - /** - * Return the current editing domain. - * - * @return the current editing domain. - */ - public static EditingDomain getEditingDomain() { - // Retrieve the editor - final IWorkbenchPart editor = PlatformUI.getWorkbench() - .getWorkbenchWindows()[0].getPages()[0].getActivePart(); - // Retrieve the editing domain - final IEditingDomainProvider edProvider = (IEditingDomainProvider) editor - .getAdapter(IEditingDomainProvider.class); - EditingDomain editingDomain = null; - if (edProvider != null) { - editingDomain = edProvider.getEditingDomain(); - } - return editingDomain; - } - - /** - * Create and return a new {@link Resource}. - * - * @return the new {@link Resource}. - */ - public static Resource createDefaultResource(final File file) { - return getEditingDomain().getResourceSet().createResource( - URI.createFileURI(file.getPath())); - } -}
diff --git a/org.eclipse.modisco.facet.util.emf.ui/src/org/eclipse/modisco/facet/util/emf/ui/internal/Activator.java b/org.eclipse.modisco.facet.util.emf.ui/src/org/eclipse/modisco/facet/util/emf/ui/internal/Activator.java new file mode 100644 index 0000000..d9eb4b6 --- /dev/null +++ b/org.eclipse.modisco.facet.util.emf.ui/src/org/eclipse/modisco/facet/util/emf/ui/internal/Activator.java
@@ -0,0 +1,73 @@ +/** + * Copyright (c) 2011 Mia-Software. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Nicolas Guyomar (Mia-Software) - Bug 333652 Extension point offering the possibility to declare an EPackage browser + */ +package org.eclipse.modisco.facet.util.emf.ui.internal; + +import org.eclipse.ui.plugin.AbstractUIPlugin; +import org.osgi.framework.BundleContext; + +/** + * The activator class controls the plug-in life cycle + */ +public class Activator extends AbstractUIPlugin { + + // The plug-in ID + public static final String PLUGIN_ID = "org.eclipse.emf.facet.util.emf.ui"; //$NON-NLS-1$ + + // The shared instance + private static Activator plugin; + + /** + * The constructor + */ + public Activator() { + } + + public static AbstractUIPlugin getPlugin() { + return Activator.plugin; + } + + /* + * (non-Javadoc) + * + * @see + * org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext + * ) + */ + @Override + public void start(final BundleContext context) throws Exception { + super.start(context); + Activator.plugin = this; + } + + /* + * (non-Javadoc) + * + * @see + * org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext + * ) + */ + @Override + public void stop(final BundleContext context) throws Exception { + Activator.plugin = null; + super.stop(context); + } + + /** + * Returns the shared instance + * + * @return the shared instance + */ + public static Activator getDefault() { + return Activator.plugin; + } + +}
diff --git a/org.eclipse.modisco.facet.util.emf.ui/src/org/eclipse/modisco/facet/util/emf/ui/internal/EmfLabelProvider.java b/org.eclipse.modisco.facet.util.emf.ui/src/org/eclipse/modisco/facet/util/emf/ui/internal/EmfLabelProvider.java new file mode 100644 index 0000000..38c04e8 --- /dev/null +++ b/org.eclipse.modisco.facet.util.emf.ui/src/org/eclipse/modisco/facet/util/emf/ui/internal/EmfLabelProvider.java
@@ -0,0 +1,140 @@ +/** + * Copyright (c) 2013 Mia-Software. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Gregoire Dupe (Mia-Software) - Bug 406578 - Generic Label Provider for EMF objects + */ +package org.eclipse.modisco.facet.util.emf.ui.internal; + +import org.eclipse.core.runtime.IAdaptable; +import org.eclipse.emf.common.util.URI; +import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.ecore.EPackage; +import org.eclipse.emf.ecore.resource.Resource; +import org.eclipse.emf.ecore.resource.ResourceSet; +import org.eclipse.jface.viewers.LabelProvider; +import org.eclipse.modisco.facet.util.emf.core.ModelUtils; +import org.eclipse.modisco.facet.util.emf.ui.internal.utils.ImageProvider; +import org.eclipse.modisco.facet.util.emf.ui.internal.utils.ImageUtils; +import org.eclipse.swt.graphics.Image; + +public class EmfLabelProvider extends LabelProvider { + + @Override + public String getText(final Object element) { + String result = super.getText(element); + if (element instanceof ResourceSet) { + final ResourceSet resourceSet = (ResourceSet) element; + result = getResourceSetLabel(resourceSet); + } else if (element instanceof Resource) { + final Resource resource = (Resource) element; + result = getResourceLabel(resource); + } else if (element instanceof EObject) { + final EObject eObject = (EObject) element; + result = ModelUtils.getName(eObject); + } else if (element instanceof IAdaptable) { + final IAdaptable adaptable = (IAdaptable) element; + result = adaptAndGetResourceLabel(adaptable); + if (result == null) { + result = adaptAndGetResourceSetLabel(adaptable); + } + } else { + result = element.toString(); + } + return result; + } + + private static String adaptAndGetResourceLabel(final IAdaptable adaptable) { + String result = null; + final Resource resource = (Resource) adaptable + .getAdapter(Resource.class); + if (resource != null) { + result = getResourceLabel(resource); + } + return result; + } + + private static String adaptAndGetResourceSetLabel(final IAdaptable adaptable) { + String result = null; + final ResourceSet resourceSet = (ResourceSet) adaptable + .getAdapter(ResourceSet.class); + if (resourceSet != null) { + result = getResourceSetLabel(resourceSet); + } + return result; + } + + private static String getResourceSetLabel(final ResourceSet resourceSet) { + String result; + result = ResourceSet.class.getSimpleName() + ' ' + + resourceSet.hashCode(); + return result; + } + + private static String getResourceLabel(final Resource resource) { + String result; + EObject firstRoot = null; + if (resource.getContents().size() > 0) { + firstRoot = resource.getContents().get(0); + } + final StringBuffer strBuffer = new StringBuffer(); + final URI uri = resource.getURI(); + final String lastSegment = uri.lastSegment(); + strBuffer.append(lastSegment); + if (firstRoot != null) { + strBuffer.append(" - "); //$NON-NLS-1$ + final EPackage ePackage = firstRoot.eClass().getEPackage(); + final String nsURI = ePackage.getName(); + strBuffer.append(nsURI); + } + if (resource.isModified()) { + strBuffer.append(" *"); //$NON-NLS-1$ + } + result = strBuffer.toString(); + return result; + } + + @Override + public Image getImage(final Object element) { + Image result = super.getImage(element); + if (element instanceof Resource) { + final Resource resource = (Resource) element; + result = getResourceImage(resource); + } else if (element instanceof IAdaptable) { + final IAdaptable adaptable = (IAdaptable) element; + result = adaptAndGetResourceImage(adaptable); + } else if (element instanceof EObject) { + final EObject eObject = (EObject) element; + result = ImageUtils.getImage(eObject); + } + return result; + } + + private static Image adaptAndGetResourceImage(final IAdaptable adaptable) { + Image result = null; + final Resource resource = (Resource) adaptable + .getAdapter(Resource.class); + if (resource != null) { + result = getResourceImage(resource); + } + return result; + } + + private static Image getResourceImage(final Resource resource) { + Image result = null; + if (resource.getContents().size() > 0) { + final EObject firstRoot = resource.getContents().get(0); + result = ImageUtils.getImage(firstRoot); + if (result == null) { + result = ImageProvider.DEFAULT.getImage(ImageProvider.MODEL); + } + } + return result; + } + +}
diff --git a/org.eclipse.modisco.facet.util.emf.ui/src/org/eclipse/modisco/facet/util/emf/ui/internal/EmfLabelProviderFactory.java b/org.eclipse.modisco.facet.util.emf.ui/src/org/eclipse/modisco/facet/util/emf/ui/internal/EmfLabelProviderFactory.java new file mode 100644 index 0000000..c5d71bb --- /dev/null +++ b/org.eclipse.modisco.facet.util.emf.ui/src/org/eclipse/modisco/facet/util/emf/ui/internal/EmfLabelProviderFactory.java
@@ -0,0 +1,24 @@ +/** + * Copyright (c) 2013 Mia-Software. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Gregoire Dupe (Mia-Software) - Bug 406578 - Generic Label Provider for EMF objects + */ +package org.eclipse.modisco.facet.util.emf.ui.internal; + +import org.eclipse.jface.viewers.ILabelProvider; +import org.eclipse.modisco.facet.util.emf.ui.internal.exported.IEmfLabelProviderFactory; + +public class EmfLabelProviderFactory implements + IEmfLabelProviderFactory { + + public ILabelProvider createLabelProvider() { + return new EmfLabelProvider(); + } + +}
diff --git a/org.eclipse.modisco.facet.util.emf.ui/src/org/eclipse/modisco/facet/util/emf/ui/internal/Messages.java b/org.eclipse.modisco.facet.util.emf.ui/src/org/eclipse/modisco/facet/util/emf/ui/internal/Messages.java new file mode 100644 index 0000000..0bd31cb --- /dev/null +++ b/org.eclipse.modisco.facet.util.emf.ui/src/org/eclipse/modisco/facet/util/emf/ui/internal/Messages.java
@@ -0,0 +1,54 @@ +/** + * Copyright (c) 2011, 2012 Mia-Software. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Nicolas Guyomar (Mia-Software) - Bug 333652 Extension point offering the possibility to declare an EPackage browser + * Gregoire Dupe (Mia-Software) - Bug 369987 - [Restructuring][Table] Switch to the new customization and facet framework + * Alban Ménager (Soft-Maint) - Bug 387470 - [EFacet][Custom] Editors + * Gregoire Dupe (Mia-Software) - Bug 406570 - Handlers to Save and SaveAs EMF resources + */ +package org.eclipse.modisco.facet.util.emf.ui.internal; + +import org.eclipse.osgi.util.NLS; + +public class Messages extends NLS { + private static final String BUNDLE_NAME = "org.eclipse.emf.facet.util.emf.ui.internal.messages"; //$NON-NLS-1$ + public static String CreateInstanceDialog_selectNewInstanceEClass; + public static String PackageRegistryView_initializing; + public static String PackageRegistryView_copyNsURI; + public static String PackageRegistryView_RefreshingPackageRegistryView; + public static String PackageRegistryView_nsURI; + public static String PackageRegistryView_Location; + public static String PackageRegistryView_Name; + public static String DialogUriSelection_RegisteredEPackages; + public static String DialogUriSelection_title_OpenModelFromEMFRegistry; + public static String EmfFacetRootPreferencePage_default_epackage_browser; + public static String EPackageBrowserPreferencePage_defaultEObjectViewer; + public static String EPackageBrowserPreferencePage_defaultResourceViewer; + + public static String Select_EClass; + public static String Select_EDataType; + public static String Select_EClassifier; + public static String Select_ETypedElement; + public static String Select_EPackage; + + public static String ResourceUiUtils_SavingFailed; + public static String ResourceUiUtils_TheResourceSavingFailed; + public static String SaveAsDialog_ResourceURI; + public static String SaveAsDialog_SaveAs; + public static String SaveAsDialog_YouHaveToProvideAValidEMFURI; + + public static String No_result_found; + static { + // initialize resource bundle + NLS.initializeMessages(BUNDLE_NAME, Messages.class); + } + + private Messages() { + } +}
diff --git a/org.eclipse.modisco.facet.util.emf.ui/src/org/eclipse/modisco/facet/util/emf/ui/internal/ResourceUiUtils.java b/org.eclipse.modisco.facet.util.emf.ui/src/org/eclipse/modisco/facet/util/emf/ui/internal/ResourceUiUtils.java new file mode 100644 index 0000000..1028103 --- /dev/null +++ b/org.eclipse.modisco.facet.util.emf.ui/src/org/eclipse/modisco/facet/util/emf/ui/internal/ResourceUiUtils.java
@@ -0,0 +1,97 @@ +/** + * Copyright (c) 2013 Mia-Software. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Gregoire Dupe (Mia-Software) - Bug 406570 - Handlers to Save and SaveAs EMF resources + */ +package org.eclipse.modisco.facet.util.emf.ui.internal; + +import java.io.IOException; +import java.net.MalformedURLException; +import java.util.Collections; + +import org.eclipse.emf.common.util.URI; +import org.eclipse.emf.ecore.resource.Resource; +import org.eclipse.modisco.facet.util.core.Logger; +import org.eclipse.modisco.facet.util.emf.ui.internal.dialogs.SaveAsDialog; +import org.eclipse.modisco.facet.util.ui.internal.exported.dialog.IDialogCallback; +import org.eclipse.modisco.facet.util.ui.internal.exported.dialog.IOkDialog; +import org.eclipse.modisco.facet.util.ui.internal.exported.dialog.IOkDialogFactory; +import org.eclipse.modisco.facet.util.ui.internal.exported.dialog.IWithResultDialogCallback; +import org.eclipse.osgi.util.NLS; +import org.eclipse.swt.widgets.Shell; + +public final class ResourceUiUtils { + + private ResourceUiUtils() { + // Must no be used + } + + public static IOkDialog save(final Resource resource, final Shell shell) { + IOkDialog dialog = null; + try { + resource.save(Collections.EMPTY_MAP); + } catch (MalformedURLException e) { + ResourceUiUtils.openSaveAsDialog(resource, shell); + } catch (IOException e) { + final IDialogCallback<Void> callBack = new IDialogCallback<Void>() { + public void committed(final Void result2) { + // Nothing to do. + } + }; + dialog = savingFailed(e, shell, callBack); + } + return dialog; + } + + private static IOkDialog savingFailed(final IOException exception, + final Shell shell, final IDialogCallback<Void> callBack) { + Logger.logError(exception, Activator.getDefault()); + final String errorMessage = NLS.bind( + Messages.ResourceUiUtils_TheResourceSavingFailed, + exception.getMessage()); + return IOkDialogFactory.DEFAULT.openErrorDialog(shell, + Messages.ResourceUiUtils_SavingFailed, errorMessage, callBack); + } + + public static SaveAsDialog openSaveAsDialog(final Resource resource, + final Shell shell) { + final IWithResultDialogCallback<String> callBack = new IWithResultDialogCallback<String>() { + + public void commited(final String result) { + ResourceUiUtils.saveAs(resource, result, shell); + } + + public void canceled(final String result) { + // Nothing to do + } + }; + final SaveAsDialog dialog = new SaveAsDialog(shell, resource.getURI() + .toString(), callBack); + dialog.open(); + return dialog; + } + + protected static IOkDialog saveAs(final Resource resource, + final String result, final Shell shell) { + IOkDialog dialog = null; + try { + resource.setURI(URI.createURI(result)); + resource.save(Collections.EMPTY_MAP); + } catch (IOException e) { + final IDialogCallback<Void> callBack = new IDialogCallback<Void>() { + public void committed(final Void result2) { + ResourceUiUtils.openSaveAsDialog(resource, shell); + } + }; + dialog = savingFailed(e, shell, callBack); + } + return dialog; + } + +}
diff --git a/org.eclipse.modisco.facet.util.emf.ui/src/org/eclipse/modisco/facet/util/emf/ui/internal/actions/OpenModelFromEmfRegistryAction.java b/org.eclipse.modisco.facet.util.emf.ui/src/org/eclipse/modisco/facet/util/emf/ui/internal/actions/OpenModelFromEmfRegistryAction.java new file mode 100644 index 0000000..821b854 --- /dev/null +++ b/org.eclipse.modisco.facet.util.emf.ui/src/org/eclipse/modisco/facet/util/emf/ui/internal/actions/OpenModelFromEmfRegistryAction.java
@@ -0,0 +1,58 @@ +/******************************************************************************* + * Copyright (c) 2008, 2010, 2011 Mia-Software. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Gabriel Barbier (Mia-Software) - initial API and implementation + * Nicolas Bros (Mia-Software) + * Nicolas Guyomar (Mia-Software) - Bug 333652 Extension point offering the possibility to declare an EPackage browser + *******************************************************************************/ +package org.eclipse.modisco.facet.util.emf.ui.internal.actions; + +import org.eclipse.emf.ecore.EPackage; +import org.eclipse.jface.action.IAction; +import org.eclipse.jface.viewers.ISelection; +import org.eclipse.jface.window.Window; +import org.eclipse.modisco.facet.util.emf.core.IBrowserRegistry; +import org.eclipse.modisco.facet.util.emf.ui.internal.dialogs.UriSelectionDialog; +import org.eclipse.ui.IWorkbenchPage; +import org.eclipse.ui.IWorkbenchWindow; +import org.eclipse.ui.IWorkbenchWindowActionDelegate; + +/** + * This is an action class which opens a dialog to select an EPackage to browse + */ +public class OpenModelFromEmfRegistryAction implements IWorkbenchWindowActionDelegate { + + private IWorkbenchWindow fWorkbenchWindow; + + public void dispose() { + // nothing + } + + public void init(final IWorkbenchWindow window) { + this.fWorkbenchWindow = window; + } + + public void run(final IAction action) { + final IWorkbenchPage activePage = this.fWorkbenchWindow.getActivePage(); + if (activePage != null) { + final UriSelectionDialog launcher = new UriSelectionDialog( + this.fWorkbenchWindow.getShell()); + if (launcher.open() == Window.OK) { + final String nsURI = launcher.getUriSelected(); + if (nsURI != null && nsURI.length() > 0) { + EPackage ePackage = EPackage.Registry.INSTANCE.getEPackage(nsURI); + IBrowserRegistry.INSTANCE.browseEPackage(ePackage); + } + } + } + } + + public void selectionChanged(final IAction action, final ISelection selection) { + // nothing + } +}
diff --git a/org.eclipse.modisco.facet.util.emf.ui/src/org/eclipse/modisco/facet/util/emf/ui/internal/dialogs/CreateInstanceDialog.java b/org.eclipse.modisco.facet.util.emf.ui/src/org/eclipse/modisco/facet/util/emf/ui/internal/dialogs/CreateInstanceDialog.java new file mode 100644 index 0000000..5b04f97 --- /dev/null +++ b/org.eclipse.modisco.facet.util.emf.ui/src/org/eclipse/modisco/facet/util/emf/ui/internal/dialogs/CreateInstanceDialog.java
@@ -0,0 +1,76 @@ +/******************************************************************************* + * Copyright (c) 2010 CEA LIST. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Nicolas Bros (Mia-Software) - initial API and implementation + * Gregoire Dupe (Mia-Software) - Bug 369987 - [Restructuring][Table] Switch to the new customization and facet framework + * Laurent Pichierri (Soft-Maint) - Bug 371204 - Compatibility with Helios + *******************************************************************************/ +package org.eclipse.modisco.facet.util.emf.ui.internal.dialogs; + +import java.util.List; +import java.util.ListIterator; + +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.EObject; +import org.eclipse.jface.viewers.LabelProvider; +import org.eclipse.modisco.facet.util.emf.core.ModelUtils; +import org.eclipse.modisco.facet.util.emf.ui.internal.Messages; +import org.eclipse.swt.widgets.Shell; +import org.eclipse.ui.dialogs.ElementListSelectionDialog; + +public final class CreateInstanceDialog { + + private CreateInstanceDialog() { + // + } + + /** + * Open a dialog with a list of metaclasses that are subclasses of the given + * {@link EClass}. When the user chooses a metaclass, an instance is created + * an returned. + * + * @param shell + * the parent shell for the dialog + * @param eClass + * the {@link EClass} of the new instance + * @param labelProvider + * label provider for the displayed {@link EClass}es. + * @return the created instance, or <code>null</code> if the user cancelled + */ + public static EObject open(final Shell shell, final EClass eClass, + final LabelProvider labelProvider) { + List<EClass> allSubClasses = ModelUtils.allSubClasses(eClass); + allSubClasses.add(eClass); + // remove non-instantiable metaclasses + ListIterator<EClass> listIterator = allSubClasses.listIterator(); + while (listIterator.hasNext()) { + EClass e = listIterator.next(); + if (e.isAbstract() || e.isInterface()) { + listIterator.remove(); + } + } + + ElementListSelectionDialog eClassSelectionDialog = new ElementListSelectionDialog(shell, + labelProvider); + eClassSelectionDialog.setTitle(Messages.CreateInstanceDialog_selectNewInstanceEClass); + eClassSelectionDialog.setElements(allSubClasses.toArray()); + eClassSelectionDialog.open(); + Object selectedElement = eClassSelectionDialog.getFirstResult(); + if (selectedElement instanceof EClass) { + EClass selectedEClass = (EClass) selectedElement; + if (!selectedEClass.isInterface() && !selectedEClass.isAbstract()) { + EObject eObject = selectedEClass.getEPackage().getEFactoryInstance() + .create(selectedEClass); + return eObject; + } + } + return null; + } + +}
diff --git a/org.eclipse.modisco.facet.util.emf.ui/src/org/eclipse/modisco/facet/util/emf/ui/internal/dialogs/SaveAsDialog.java b/org.eclipse.modisco.facet.util.emf.ui/src/org/eclipse/modisco/facet/util/emf/ui/internal/dialogs/SaveAsDialog.java new file mode 100644 index 0000000..50812c6 --- /dev/null +++ b/org.eclipse.modisco.facet.util.emf.ui/src/org/eclipse/modisco/facet/util/emf/ui/internal/dialogs/SaveAsDialog.java
@@ -0,0 +1,70 @@ +/** + * Copyright (c) 2013 Mia-Software. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Gregoire Dupe (Mia-Software) - Bug 406570 - Handlers to Save and SaveAs EMF resources + */ + +package org.eclipse.modisco.facet.util.emf.ui.internal.dialogs; + + +import org.eclipse.jface.dialogs.Dialog; +import org.eclipse.modisco.facet.util.emf.ui.internal.Messages; +import org.eclipse.modisco.facet.util.ui.internal.exported.dialog.IWithResultDialogCallback; +import org.eclipse.swt.SWT; +import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Control; +import org.eclipse.swt.widgets.Label; +import org.eclipse.swt.widgets.Shell; + +public class SaveAsDialog extends Dialog { + + private URIComposite uriComposite; + private final String initialText; + private final IWithResultDialogCallback<String> callBack; + + public SaveAsDialog(final Shell parent, final String initialText, + final IWithResultDialogCallback<String> callBack) { + super(parent); + this.initialText = initialText; + this.callBack = callBack; + } + + @Override + protected Control createDialogArea(final Composite parent) { + final Composite composite = new Composite(parent, SWT.NONE); + composite.setLayout(new GridLayout(1, false)); + final Label text = new Label(composite, SWT.NONE); + text.setText(Messages.SaveAsDialog_YouHaveToProvideAValidEMFURI); + this.uriComposite = new URIComposite(composite, this.initialText); + return composite; + } + + @Override + protected void cancelPressed() { + cancelled(); + } + + public void cancelled() { + final String text = this.uriComposite.getText(); + this.callBack.canceled(text); + super.cancelPressed(); + } + + @Override + protected void okPressed() { + commit(); + } + + public void commit() { + this.callBack.commited(this.uriComposite.getText()); + super.okPressed(); + } + +}
diff --git a/org.eclipse.modisco.facet.util.emf.ui/src/org/eclipse/modisco/facet/util/emf/ui/internal/dialogs/URIComposite.java b/org.eclipse.modisco.facet.util.emf.ui/src/org/eclipse/modisco/facet/util/emf/ui/internal/dialogs/URIComposite.java new file mode 100644 index 0000000..a83197e --- /dev/null +++ b/org.eclipse.modisco.facet.util.emf.ui/src/org/eclipse/modisco/facet/util/emf/ui/internal/dialogs/URIComposite.java
@@ -0,0 +1,40 @@ +/** + * Copyright (c) 2013 Mia-Software. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Gregoire Dupe (Mia-Software) - Bug 406570 - Handlers to Save and SaveAs EMF resources + */ + +package org.eclipse.modisco.facet.util.emf.ui.internal.dialogs; + +import org.eclipse.modisco.facet.util.emf.ui.internal.Messages; +import org.eclipse.swt.SWT; +import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Label; +import org.eclipse.swt.widgets.Text; + +public class URIComposite extends Composite { + + private final Text text; + + public URIComposite(final Composite parent, final String initialText) { + super(parent, SWT.NONE); + this.setLayout(new GridLayout(2, false)); + final Label label = new Label(this, SWT.NONE); + label.setText(Messages.SaveAsDialog_ResourceURI); + this.text = new Text(this, SWT.BORDER); + this.text.setText(initialText); + this.getShell().setText(Messages.SaveAsDialog_SaveAs); + } + + public String getText() { + return this.text.getText(); + } + +}
diff --git a/org.eclipse.modisco.facet.util.emf.ui/src/org/eclipse/modisco/facet/util/emf/ui/internal/dialogs/UriSelectionDialog.java b/org.eclipse.modisco.facet.util.emf.ui/src/org/eclipse/modisco/facet/util/emf/ui/internal/dialogs/UriSelectionDialog.java new file mode 100644 index 0000000..6a1283e --- /dev/null +++ b/org.eclipse.modisco.facet.util.emf.ui/src/org/eclipse/modisco/facet/util/emf/ui/internal/dialogs/UriSelectionDialog.java
@@ -0,0 +1,105 @@ +/********************************************************************************** + * Copyright (c) 2011 Mia-Software. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Gabriel Barbier (Mia-Software) - initial API and implementation + * Nicolas Guyomar (Mia-Software) - Bug 333652 Extension point offering the possibility to declare an EPackage browser + ***********************************************************************************/ +package org.eclipse.modisco.facet.util.emf.ui.internal.dialogs; + +import java.util.Map; +import java.util.Set; +import java.util.TreeSet; + +import org.eclipse.emf.ecore.EPackage; +import org.eclipse.jface.dialogs.IDialogSettings; +import org.eclipse.jface.viewers.LabelProvider; +import org.eclipse.modisco.facet.common.ui.internal.widgets.AnywhereFilterMatcher; +import org.eclipse.modisco.facet.util.emf.ui.internal.Activator; +import org.eclipse.modisco.facet.util.emf.ui.internal.Messages; +import org.eclipse.modisco.facet.util.emf.ui.internal.utils.ImageProvider; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Control; +import org.eclipse.swt.widgets.Shell; +import org.eclipse.ui.dialogs.ElementListSelectionDialog; + +/** + * A dialog which displays a list of URIs from the EMF package registry, and + * allows the user to open one of them. + * + * @author Gabriel Barbier + */ +public class UriSelectionDialog extends ElementListSelectionDialog { + + private static final String DIALOG_SETTINGS = "UriSelectionDialogSettings"; //$NON-NLS-1$ + private String uri = ""; //$NON-NLS-1$ + + /** + * Constructor. + * + * @param parent + * the parent shell + */ + public UriSelectionDialog(final Shell parent) { + super(parent, new LabelProvider()); + + setTitle(Messages.DialogUriSelection_title_OpenModelFromEMFRegistry); + setMessage(Messages.DialogUriSelection_RegisteredEPackages); + + final Set<String> uris = new TreeSet<String>(); + for (final Object name : ((Map<?, ?>) EPackage.Registry.INSTANCE) + .keySet()) { + uris.add((name).toString()); + } + + setElements(uris.toArray()); + } + + @Override + protected Control createDialogArea(final Composite parent) { + Composite composite = (Composite) super.createDialogArea(parent); + this.fFilteredList.setFilterMatcher(new AnywhereFilterMatcher()); + return composite; + } + + /** + * {@inheritDoc} + * + * @see org.eclipse.ui.dialogs.SelectionStatusDialog#okPressed() + */ + @Override + protected void okPressed() { + super.okPressed(); + + if (getResult().length > 0) { + this.uri = getResult()[0].toString(); + } + } + + public String getUriSelected() { + return this.uri; + } + + @Override + protected void configureShell(final Shell shell) { + super.configureShell(shell); + shell.setImage(ImageProvider.getInstance().getEmfFacetLogo()); + } + + @Override + protected IDialogSettings getDialogBoundsSettings() { + IDialogSettings settings = Activator.getPlugin().getDialogSettings(); + IDialogSettings section = settings + .getSection(UriSelectionDialog.DIALOG_SETTINGS); + if (section == null) { + section = settings + .addNewSection(UriSelectionDialog.DIALOG_SETTINGS); + } + return section; + } +} \ No newline at end of file
diff --git a/org.eclipse.modisco.facet.util.emf.ui/src/org/eclipse/modisco/facet/util/emf/ui/internal/exported/IEmfLabelProviderFactory.java b/org.eclipse.modisco.facet.util.emf.ui/src/org/eclipse/modisco/facet/util/emf/ui/internal/exported/IEmfLabelProviderFactory.java new file mode 100644 index 0000000..79f1784 --- /dev/null +++ b/org.eclipse.modisco.facet.util.emf.ui/src/org/eclipse/modisco/facet/util/emf/ui/internal/exported/IEmfLabelProviderFactory.java
@@ -0,0 +1,25 @@ +/** + * Copyright (c) 2013 Mia-Software. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Gregoire Dupe (Mia-Software) - Bug 406578 - Generic Label Provider for EMF objects + */ +package org.eclipse.modisco.facet.util.emf.ui.internal.exported; + +import org.eclipse.jface.viewers.ILabelProvider; +import org.eclipse.modisco.facet.util.emf.ui.internal.EmfLabelProviderFactory; + +/** + * @since 0.4 + */ +public interface IEmfLabelProviderFactory { + + IEmfLabelProviderFactory DEFAULT = new EmfLabelProviderFactory(); + + ILabelProvider createLabelProvider(); +}
diff --git a/org.eclipse.modisco.facet.util.emf.ui/src/org/eclipse/modisco/facet/util/emf/ui/internal/exported/util/composite/EClassifierSelectionControl.java b/org.eclipse.modisco.facet.util.emf.ui/src/org/eclipse/modisco/facet/util/emf/ui/internal/exported/util/composite/EClassifierSelectionControl.java new file mode 100644 index 0000000..e4356e7 --- /dev/null +++ b/org.eclipse.modisco.facet.util.emf.ui/src/org/eclipse/modisco/facet/util/emf/ui/internal/exported/util/composite/EClassifierSelectionControl.java
@@ -0,0 +1,88 @@ +/******************************************************************************* + * Copyright (c) 2009, 2011, 2012 Mia-Software. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Nicolas Bros (Mia-Software) - initial API and implementation + * Nicolas Guyomar (Mia-Software) - Bug 349546 - EMF Facet facetSet editor + * Alban Ménager (Soft-Maint) - Bug 387470 - [EFacet][Custom] Editors + *******************************************************************************/ +package org.eclipse.modisco.facet.util.emf.ui.internal.exported.util.composite; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import org.eclipse.emf.common.util.EList; +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.EClassifier; +import org.eclipse.emf.ecore.EPackage; +import org.eclipse.modisco.facet.util.emf.ui.internal.Messages; +import org.eclipse.modisco.facet.util.ui.internal.exported.util.composite.FilteredElementSelectionComposite; +import org.eclipse.swt.widgets.Composite; + +/** + * A control to select an {@link EClass}, that can be filtered using the + * associated text field. + * + * @since 0.3 + */ +public class EClassifierSelectionControl<T extends EClassifier> extends + FilteredElementSelectionComposite { + + private final Map<String, T> stringToEClass = new HashMap<String, T>(); + private final Class<? extends EClassifier> eTypeSel; + private String metamodelNsUri; + + public EClassifierSelectionControl(final Composite parent, + final String metamodelNsUri, final Class<? extends T> eTypeSel) { + super(parent, true, false); + this.eTypeSel = eTypeSel; + this.metamodelNsUri = metamodelNsUri; + } + + public void updateList(final String metamodelNsUri2) { + this.metamodelNsUri = metamodelNsUri2; + final EPackage ePackage = EPackage.Registry.INSTANCE + .getEPackage(this.metamodelNsUri); + if (ePackage != null) { + final List<String> eClasses = new ArrayList<String>(); + final EList<EClassifier> eClassifiers = ePackage.getEClassifiers(); + addElements(eClasses, eClassifiers); + if (eClasses.isEmpty()) { + eClasses.add(Messages.No_result_found); + setEnabled(false); + } else { + setEnabled(true); + } + setElements(eClasses.toArray()); + } + } + + private void addElements(final List<String> eClasses, + final EList<? extends EClassifier> eClassifiers) { + for (final EClassifier eClassifier : eClassifiers) { + if (this.eTypeSel.isInstance(eClassifier)) { + eClasses.add(eClassifier.getName()); + @SuppressWarnings("unchecked") + // @SuppressWarnings("unchecked") checked by the surrounding if + final T eClassifier2 = (T) eClassifier; + this.stringToEClass.put(eClassifier.getName(), eClassifier2); + } + } + } + + public T getSelectedEClassifier() { + T result = null; + final Object[] selectElements = getSelectedElements(); + if ((selectElements != null) && (selectElements.length > 0) + && this.stringToEClass.containsKey(selectElements[0])) { + result = this.stringToEClass.get(selectElements[0]); + } + return result; + } +}
diff --git a/org.eclipse.modisco.facet.util.emf.ui/src/org/eclipse/modisco/facet/util/emf/ui/internal/exported/util/widget/component/metaclass/AbstractGetMetaclassWidget.java b/org.eclipse.modisco.facet.util.emf.ui/src/org/eclipse/modisco/facet/util/emf/ui/internal/exported/util/widget/component/metaclass/AbstractGetMetaclassWidget.java new file mode 100644 index 0000000..562ca7c --- /dev/null +++ b/org.eclipse.modisco.facet.util.emf.ui/src/org/eclipse/modisco/facet/util/emf/ui/internal/exported/util/widget/component/metaclass/AbstractGetMetaclassWidget.java
@@ -0,0 +1,163 @@ +/** + * Copyright (c) 2012 Mia-Software. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Alban Ménager (Soft-Maint) - Bug 387470 - [EFacet][Custom] Editors + * Grégoire Dupé (Mia-Software) - Bug 387470 - [EFacet][Custom] Editors + */ +package org.eclipse.modisco.facet.util.emf.ui.internal.exported.util.widget.component.metaclass; + +import org.eclipse.emf.ecore.EClassifier; +import org.eclipse.emf.ecore.EPackage; +import org.eclipse.modisco.facet.util.emf.ui.internal.exported.util.wizard.SelectETypeWizardImpl; +import org.eclipse.modisco.facet.util.emf.ui.internal.exported.util.wizard.SynchronizedSelectETypeWizard; +import org.eclipse.modisco.facet.util.emf.ui.internal.exported.wizard.ISelectETypeWizard; +import org.eclipse.modisco.facet.util.ui.internal.exported.PropertyElement; +import org.eclipse.modisco.facet.util.ui.internal.exported.PropertyElement2; +import org.eclipse.modisco.facet.util.ui.internal.exported.util.widget.component.getorcreate.AbstractGetOrCreateElementWithWizardButtonWidget; +import org.eclipse.swt.widgets.Composite; + +/** + * This abstract class provides a simple way for the selection of a type. + * + * Label : [ textField ][...] </p> + * + * The button will display the {@link SelectETypeWizardImpl} wizard when + * pressed. </p> + * + * The {@link #getLabel()} method have to be override and provide the label of + * the 'Label'.</p> + * + * The {@link #createTextField(boolean)} create a non editable text field.</p> + * + * The {@link #getETypeSelectionOption()} have to be override and type of the + * selection in the wizard.</p> + * + * If the value of the {@link PropertyElement} is null, then the message + * returned by {@link #getErrorMessage()} is displayed on the top of the dialog. + * + * @see SelectETypeWizardImpl + * @see ETypeSelectionOptions + * + * @see GetConformanceMetaclassWidget + * @see GetElementTypeWidget + * @see GetExtendedMetaclassWidget + * @since 0.3 + */ +public abstract class AbstractGetMetaclassWidget<T extends EClassifier> + extends + AbstractGetOrCreateElementWithWizardButtonWidget<T, ISelectETypeWizard<T>> { + + private final PropertyElement2<? extends EPackage> ePackagePropery; + private final Class<? extends T> eTypeOption; + + /** + * Constructor. + * + * @param parent + * the parent of this composite. + * @param editingDomain + * the current editing domain. + * @param typeProperty + * the property element that will be edited by this composite. + * @param ePackageProperty + * the property element to get the super, main, element of the + * model. + */ + protected AbstractGetMetaclassWidget(final Composite parent, + final PropertyElement2<T> typeProperty, + final PropertyElement2<? extends EPackage> ePackageProperty, + final Class<? extends T> eTypeOption) { + super(parent, typeProperty); + this.ePackagePropery = ePackageProperty; + this.eTypeOption = eTypeOption; + } + + /** + * Constructor. + * + * @param parent + * the parent of this composite. + * @param editingDomain + * the current editing domain. + * @param propertyElement + * the property element that will be edited by this composite. + * @param ePackageProperty + * the property element to get the super, main, element of the + * model. + * @param buttonEnabled + * boolean to set if the button is enabled or not. + */ + protected AbstractGetMetaclassWidget(final Composite parent, + final PropertyElement2<T> propertyElement, + final PropertyElement2<EPackage> ePackageProperty, + final boolean buttonEnabled, final Class<T> eTypeOption) { + this(parent, propertyElement, ePackageProperty, eTypeOption); + this.setButtonEnabled(buttonEnabled); + } + + /** + * @return return the label. Null if no label have to be displayed. + */ + @Override + protected abstract String getLabel(); + + @Override + public String getError() { + String error = null; + final EClassifier eclassifier = this.getPropertyElement().getValue2(); + if (eclassifier == null) { + error = getErrorMessage(); + } + return error; + } + + @Override + protected void onWizardCommited(final ISelectETypeWizard<T> wizard) { + final T eClassifier = wizard.getSelectedEClassifier(); + getPropertyElement().setValue2(eClassifier); + setText(eClassifier.getName()); + fireChanged(); + } + + @Override + protected void onWizardCanceled() { + fireChanged(); + } + + /** + * Return the EPackage. + * + * @return the ePackage. + */ + protected abstract EPackage getEPackage(); + + /** + * @return the facetSetProperty + */ + public PropertyElement2<? extends EPackage> getEPackageProperty() { + return this.ePackagePropery; + } + + public void setValue(final T eClassifier) { + getPropertyElement().setValue2(eClassifier); + } + + @Override + protected ISelectETypeWizard<T> createIWizard() { + final EPackage parent = getEPackage(); + return new SelectETypeWizardImpl<T>(this.eTypeOption, parent); + } + + @Override + protected ISelectETypeWizard<T> createSynchronizedWizard( + final ISelectETypeWizard<T> wizard) { + return new SynchronizedSelectETypeWizard<T>(wizard, + this.getDisplay()); + } +}
diff --git a/org.eclipse.modisco.facet.util.emf.ui/src/org/eclipse/modisco/facet/util/emf/ui/internal/exported/util/widget/component/metaclass/MetamodelSelectionControl.java b/org.eclipse.modisco.facet.util.emf.ui/src/org/eclipse/modisco/facet/util/emf/ui/internal/exported/util/widget/component/metaclass/MetamodelSelectionControl.java new file mode 100644 index 0000000..489bddf --- /dev/null +++ b/org.eclipse.modisco.facet.util.emf.ui/src/org/eclipse/modisco/facet/util/emf/ui/internal/exported/util/widget/component/metaclass/MetamodelSelectionControl.java
@@ -0,0 +1,45 @@ +/** + * Copyright (c) 2012 Mia-Software. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Alban Ménager (Soft-Maint) - Bug 387470 - [EFacet][Custom] Editors + */ +package org.eclipse.modisco.facet.util.emf.ui.internal.exported.util.widget.component.metaclass; + +import java.util.Map; +import java.util.Set; +import java.util.TreeSet; + +import org.eclipse.emf.ecore.EPackage; +import org.eclipse.modisco.facet.util.ui.internal.exported.util.composite.FilteredElementSelectionComposite; +import org.eclipse.swt.widgets.Composite; + +/** + * A control to select a metamodel from a list of metamodels, that can be + * filtered using the associated text field. + * + * @since 0.3 + */ +public class MetamodelSelectionControl extends + FilteredElementSelectionComposite { + + public MetamodelSelectionControl(final Composite parent) { + super(parent, true, false); + final Set<String> uris = getUris(); + setElements(uris.toArray()); + } + + private static Set<String> getUris() { + final Set<String> uris = new TreeSet<String>(); + for (final Object name : ((Map<?, ?>) EPackage.Registry.INSTANCE) + .keySet()) { + uris.add(name.toString()); + } + return uris; + } +}
diff --git a/org.eclipse.modisco.facet.util.emf.ui/src/org/eclipse/modisco/facet/util/emf/ui/internal/exported/util/wizard/SelectETypeWizardImpl.java b/org.eclipse.modisco.facet.util.emf.ui/src/org/eclipse/modisco/facet/util/emf/ui/internal/exported/util/wizard/SelectETypeWizardImpl.java new file mode 100644 index 0000000..267df5e --- /dev/null +++ b/org.eclipse.modisco.facet.util.emf.ui/src/org/eclipse/modisco/facet/util/emf/ui/internal/exported/util/wizard/SelectETypeWizardImpl.java
@@ -0,0 +1,151 @@ +/** + * Copyright (c) 2011, 2012 Mia-Software. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Nicolas Guyomar (Mia-Software) - Bug 349546 - EMF Facet facetSet editor + * Alban Ménager (Soft-Maint) - Bug 387470 - [EFacet][Custom] Editors + * Grégoire Dupé (Mia-Software) - Bug 387470 - [EFacet][Custom] Editors + */ +package org.eclipse.modisco.facet.util.emf.ui.internal.exported.util.wizard; + +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.EClassifier; +import org.eclipse.emf.ecore.EDataType; +import org.eclipse.emf.ecore.EPackage; +import org.eclipse.emf.ecore.ETypedElement; +import org.eclipse.jface.window.Window; +import org.eclipse.jface.wizard.IWizardPage; +import org.eclipse.jface.wizard.Wizard; +import org.eclipse.jface.wizard.WizardDialog; +import org.eclipse.modisco.facet.util.core.DebugUtils; +import org.eclipse.modisco.facet.util.emf.ui.internal.Activator; +import org.eclipse.modisco.facet.util.emf.ui.internal.Messages; +import org.eclipse.modisco.facet.util.emf.ui.internal.exported.util.wizard.page.SelectEClassifierWizardPage; +import org.eclipse.modisco.facet.util.emf.ui.internal.exported.util.wizard.page.SelectEPackageWizardPage; +import org.eclipse.modisco.facet.util.emf.ui.internal.exported.util.wizard.page.SynchronizedSelectEClassifierWizardPage; +import org.eclipse.modisco.facet.util.emf.ui.internal.exported.util.wizard.page.SynchronizedSelectEPackageWizardPage; +import org.eclipse.modisco.facet.util.emf.ui.internal.exported.wizard.ISelectETypeWizard; +import org.eclipse.modisco.facet.util.emf.ui.internal.exported.wizard.page.ISelectEClassifierWizardPage; +import org.eclipse.modisco.facet.util.emf.ui.internal.exported.wizard.page.ISelectEPackageWizardPage; +import org.eclipse.swt.widgets.Display; +import org.eclipse.swt.widgets.Shell; + +/** + * @since 0.3 + */ +public class SelectETypeWizardImpl<T extends EClassifier> extends Wizard + implements ISelectETypeWizard<T> { + + private static final boolean DEBUG = DebugUtils.getDebugStatus(Activator + .getDefault()); + private final WizardDialog dialog; + private final ISelectEPackageWizardPage ePackageWP; + private final ISelectEClassifierWizardPage<T> eClassifierWP; + private T eClassifier; + + public SelectETypeWizardImpl(final Class<? extends T> eTypeOption, + final EPackage ePackage) { + super(); + this.dialog = new WizardDialog(new Shell(Display.getDefault()), + this); + this.ePackageWP = new SelectEPackageWizardPage(); + this.eClassifierWP = new SelectEClassifierWizardPage<T>(eTypeOption, + ePackage); + if (eTypeOption == EClass.class) { + setWindowTitle(Messages.Select_EClass); + } else if (eTypeOption == EDataType.class) { + setWindowTitle(Messages.Select_EDataType); + } else if (eTypeOption == EClassifier.class) { + setWindowTitle(Messages.Select_EClassifier); + } else if (eTypeOption == ETypedElement.class) { + setWindowTitle(Messages.Select_ETypedElement); + } + } + + @Override + public void addPages() { + addPage(this.ePackageWP); + addPage(this.eClassifierWP); + } + + public int open() { + int result = Window.CANCEL; + + if (this.dialog != null) { + result = this.dialog.open(); + } + return result; + } + + @Override + public boolean performFinish() { + this.eClassifier = this.eClassifierWP.getSelectedEClassifier(); + return true; + } + + public T getSelectedEClassifier() { + return this.eClassifier; + } + + public ISelectEClassifierWizardPage<T> getSelectEClassifierWizardPage() { + return this.eClassifierWP; + } + + public ISelectEPackageWizardPage getSelectEPackageWizardPage() { + return this.ePackageWP; + } + + public boolean finish() { + final boolean result = performFinish(); + dispose(); + setContainer(null); + this.dialog.close(); + return result; + } + + public IWizardPage getCurrentPage() { + return getSynchronizedPage(getContainer().getCurrentPage()); + } + + public IWizardPage next() { + DebugUtils.debug(SelectETypeWizardImpl.DEBUG); + final IWizardPage nextPage = getNextPage(getContainer() + .getCurrentPage()); + this.dialog.showPage(nextPage); + return getSynchronizedPage(nextPage); + } + + public IWizardPage previous() { + final IWizardPage previousPage = getPreviousPage(getContainer() + .getCurrentPage()); + this.dialog.showPage(previousPage); + return getSynchronizedPage(previousPage); + } + + private static IWizardPage getSynchronizedPage(final IWizardPage page) { + IWizardPage result = null; + if (page instanceof ISelectEClassifierWizardPage) { + result = new SynchronizedSelectEClassifierWizardPage( + (ISelectEClassifierWizardPage<?>) page, + Display.getDefault()); + } else if (page instanceof ISelectEPackageWizardPage) { + result = new SynchronizedSelectEPackageWizardPage( + (ISelectEPackageWizardPage) page, Display.getDefault()); + } + return result; + } + + public void selectPackage(final String packageName) { + getSelectEPackageWizardPage().selectPackage(packageName); + } + + public void selectEClassifier(final String eClassifierName) { + getSelectEClassifierWizardPage().selectEClassifier(eClassifierName); + } + +}
diff --git a/org.eclipse.modisco.facet.util.emf.ui/src/org/eclipse/modisco/facet/util/emf/ui/internal/exported/util/wizard/SynchronizedSelectETypeWizard.java b/org.eclipse.modisco.facet.util.emf.ui/src/org/eclipse/modisco/facet/util/emf/ui/internal/exported/util/wizard/SynchronizedSelectETypeWizard.java new file mode 100644 index 0000000..fae8f11 --- /dev/null +++ b/org.eclipse.modisco.facet.util.emf.ui/src/org/eclipse/modisco/facet/util/emf/ui/internal/exported/util/wizard/SynchronizedSelectETypeWizard.java
@@ -0,0 +1,65 @@ +/** + * Copyright (c) 2012 Mia-Software. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Alban Ménager (Soft-Maint) - Bug 387470 - [EFacet][Custom] Editors + * Grégoire Dupé (Mia-Software) - Bug 387470 - [EFacet][Custom] Editors + */ +package org.eclipse.modisco.facet.util.emf.ui.internal.exported.util.wizard; + +import org.eclipse.emf.ecore.EClassifier; +import org.eclipse.modisco.facet.util.emf.ui.internal.exported.util.widget.component.metaclass.AbstractGetMetaclassWidget; +import org.eclipse.modisco.facet.util.emf.ui.internal.exported.wizard.ISelectETypeWizard; +import org.eclipse.modisco.facet.util.ui.internal.exported.displaysync.AbstractExceptionFreeRunnable; +import org.eclipse.modisco.facet.util.ui.internal.exported.util.wizard.SynchronizedWizard; +import org.eclipse.swt.widgets.Display; + +/** + * Synchronized class for safe run. + * + * @see AbstractGetMetaclassWidget + * @since 0.3 + */ +public class SynchronizedSelectETypeWizard<T extends EClassifier> extends + SynchronizedWizard<ISelectETypeWizard<T>> implements + ISelectETypeWizard<T> { + + /** + * Constructor. + * + * @param object + * the to synchronized. + * @param display + * the display. + */ + public SynchronizedSelectETypeWizard(final ISelectETypeWizard<T> object, + final Display display) { + super(object, display); + } + + public T getSelectedEClassifier() { + return this.safeSyncExec(new AbstractExceptionFreeRunnable<T>() { + @Override + public T safeRun() { + return SynchronizedSelectETypeWizard.this + .getSynchronizedObject().getSelectedEClassifier(); + } + }); + } + + @Override + public int open() { + return this.safeSyncExec(new AbstractExceptionFreeRunnable<Integer>() { + @Override + public Integer safeRun() { + return Integer.valueOf(SynchronizedSelectETypeWizard.this + .getSynchronizedObject().open()); + } + }).intValue(); + } +}
diff --git a/org.eclipse.modisco.facet.util.emf.ui/src/org/eclipse/modisco/facet/util/emf/ui/internal/exported/util/wizard/page/SelectEClassifierWizardPage.java b/org.eclipse.modisco.facet.util.emf.ui/src/org/eclipse/modisco/facet/util/emf/ui/internal/exported/util/wizard/page/SelectEClassifierWizardPage.java new file mode 100644 index 0000000..5468e5a --- /dev/null +++ b/org.eclipse.modisco.facet.util.emf.ui/src/org/eclipse/modisco/facet/util/emf/ui/internal/exported/util/wizard/page/SelectEClassifierWizardPage.java
@@ -0,0 +1,188 @@ +/******************************************************************************* + * Copyright (c) 2009, 2011, 2012 Mia-Software. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Nicolas Bros (Mia-Software) - initial API and implementation + * Alban Ménager (Soft-Maint) - Bug 387470 - [EFacet][Custom] Editors + * Grégoire Dupé (Mia-Software) - Bug 387470 - [EFacet][Custom] Editors + *******************************************************************************/ +package org.eclipse.modisco.facet.util.emf.ui.internal.exported.util.wizard.page; + +import org.eclipse.core.runtime.jobs.Job; +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.EClassifier; +import org.eclipse.emf.ecore.EDataType; +import org.eclipse.emf.ecore.EPackage; +import org.eclipse.emf.ecore.ETypedElement; +import org.eclipse.jface.wizard.WizardPage; +import org.eclipse.modisco.facet.util.core.DebugUtils; +import org.eclipse.modisco.facet.util.emf.ui.internal.Activator; +import org.eclipse.modisco.facet.util.emf.ui.internal.Messages; +import org.eclipse.modisco.facet.util.emf.ui.internal.exported.util.composite.EClassifierSelectionControl; +import org.eclipse.modisco.facet.util.emf.ui.internal.exported.util.wizard.page.exception.SelectedEClassifierRuntimeException; +import org.eclipse.modisco.facet.util.emf.ui.internal.exported.wizard.page.ISelectEClassifierWizardPage; +import org.eclipse.modisco.facet.util.emf.ui.internal.exported.wizard.page.ISelectEPackageWizardPage; +import org.eclipse.swt.events.ModifyEvent; +import org.eclipse.swt.events.ModifyListener; +import org.eclipse.swt.events.SelectionEvent; +import org.eclipse.swt.events.SelectionListener; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Display; +import org.eclipse.ui.dialogs.FilteredList; + +/** + * @since 0.3 + */ +public class SelectEClassifierWizardPage<T extends EClassifier> extends + WizardPage implements ISelectEClassifierWizardPage<T> { + + private static final boolean DEBUG = DebugUtils.getDebugStatus(Activator + .getDefault()); + private EClassifierSelectionControl<T> eClassSelection; + private final Class<? extends T> eTypeOption; + private String metamodelNsUri; + + public SelectEClassifierWizardPage(final Class<? extends T> eTypeOption, + final EPackage ePackage) { + super("Whatever"); //$NON-NLS-1$ + if (eTypeOption == EClass.class) { + setTitle(Messages.Select_EClass); + } else if (eTypeOption == EDataType.class) { + setTitle(Messages.Select_EDataType); + } else if (eTypeOption == EClassifier.class) { + setTitle(Messages.Select_EClassifier); + } else if (eTypeOption == ETypedElement.class) { + setTitle(Messages.Select_ETypedElement); + } + if (ePackage != null) { + this.metamodelNsUri = ePackage.getNsURI(); + } + this.eTypeOption = eTypeOption; + } + + @Override + public boolean isPageComplete() { + return this.eClassSelection.getSelectedEClassifier() != null; + } + + @Override + public void setVisible(final boolean visible) { + super.setVisible(visible); + if (getPreviousPage() instanceof SelectEPackageWizardPage) { + final ISelectEPackageWizardPage selectEPackage = (ISelectEPackageWizardPage) getPreviousPage(); + this.metamodelNsUri = selectEPackage.getSelectedEPackage() + .getNsURI(); + if (this.metamodelNsUri != null) { + setDescription(selectEPackage.getSelectedEPackage() + .getNsURI()); + } + } + this.eClassSelection.updateList(this.metamodelNsUri); + } + + public void createControl(final Composite parent) { + this.eClassSelection = new EClassifierSelectionControl<T>(parent, + this.metamodelNsUri, this.eTypeOption); + final FilteredList filteredList = this.eClassSelection + .getFilteredList(); + + filteredList.addSelectionListener(new SelectionListener() { + public void widgetSelected(final SelectionEvent event) { + if (event.item != null) { + updateButton(); + // setPageComplete(filteredList.getSelection().length == 1); + } + } + + public void widgetDefaultSelected(final SelectionEvent event) { + if (getWizard().canFinish()) { + getWizard().performFinish(); + } + if (getNextPage() != null) { + goToNextPage(); + } + } + }); + + this.eClassSelection.getFilterText().addModifyListener( + new ModifyListener() { + + public void modifyText(final ModifyEvent event) { + updateButton(); + } + }); + + // avoid the page being "complete" when still on a previous page + filteredList.setSelection(new int[0]); + setPageComplete(false); + + setControl(this.eClassSelection); + } + + protected void goToNextPage() { + getContainer().showPage(getNextPage()); + } + + protected void updateButton() { + if ((getContainer() != null) && (getContainer().getCurrentPage() != null)) { + getContainer().updateButtons(); + } + } + + public T getSelectedEClassifier() { + return this.eClassSelection.getSelectedEClassifier(); + } + + /** + * Select the <code>eclassifierName</code> into the list. + * + * @param eclassifierName + * the name of the classifier to select. + */ + public void selectEClassifier(final String eclassifierName) { + DebugUtils.debug(DEBUG); + boolean doItNow = true; + // We get all the jobs + for (final Job job : Job.getJobManager().find(null)) { + // We check if the job of 'FilteredList' is ended. If not, we + // recursively call this method to check again without interfering + // with the 'FilteredList' job (doing an asynchrony call). + if (job.getClass().getName() + .startsWith(FilteredList.class.getName())) { + asyncSelectionClassifier(eclassifierName); + DebugUtils.debug(DEBUG, "Selection defered."); //$NON-NLS-1$ + doItNow = false; + break; + } + } + + // If the job 'FilteredList' is done, we can do the selection. + if (doItNow) { + internalSelectEClassifier(eclassifierName); + } + } + + private void asyncSelectionClassifier(final String eclassifierName) { + Display.getDefault().asyncExec(new Runnable() { + public void run() { + selectEClassifier(eclassifierName); + } + }); + } + + private void internalSelectEClassifier(final String packageName) { + final FilteredList filteredList = this.eClassSelection + .getFilteredList(); + filteredList.setSelection(new String[] { packageName }); + if (getSelectedEClassifier() == null) { + throw new SelectedEClassifierRuntimeException(); + } + DebugUtils.debug(DEBUG, "Selection setting finished."); //$NON-NLS-1$ + DebugUtils.debug(DEBUG, + "selectedEClassifier=" + getSelectedEClassifier()); //$NON-NLS-1$ + } +} \ No newline at end of file
diff --git a/org.eclipse.modisco.facet.util.emf.ui/src/org/eclipse/modisco/facet/util/emf/ui/internal/exported/util/wizard/page/SelectEPackageWizardPage.java b/org.eclipse.modisco.facet.util.emf.ui/src/org/eclipse/modisco/facet/util/emf/ui/internal/exported/util/wizard/page/SelectEPackageWizardPage.java new file mode 100644 index 0000000..24ba887 --- /dev/null +++ b/org.eclipse.modisco.facet.util.emf.ui/src/org/eclipse/modisco/facet/util/emf/ui/internal/exported/util/wizard/page/SelectEPackageWizardPage.java
@@ -0,0 +1,190 @@ +/******************************************************************************* + * Copyright (c) 2009, 2011, 2012 Mia-Software. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Nicolas Bros (Mia-Software) - initial API and implementation + * Alban Ménager (Soft-Maint) - Bug 387470 - [EFacet][Custom] Editors + *******************************************************************************/ +package org.eclipse.modisco.facet.util.emf.ui.internal.exported.util.wizard.page; + +import org.eclipse.core.runtime.jobs.Job; +import org.eclipse.emf.common.util.URI; +import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.ecore.EPackage; +import org.eclipse.emf.ecore.EPackage.Registry; +import org.eclipse.emf.ecore.resource.Resource; +import org.eclipse.emf.ecore.resource.ResourceSet; +import org.eclipse.jface.wizard.WizardPage; +import org.eclipse.modisco.facet.util.core.DebugUtils; +import org.eclipse.modisco.facet.util.emf.ui.internal.Activator; +import org.eclipse.modisco.facet.util.emf.ui.internal.Messages; +import org.eclipse.modisco.facet.util.emf.ui.internal.exported.util.widget.component.metaclass.MetamodelSelectionControl; +import org.eclipse.modisco.facet.util.emf.ui.internal.exported.util.wizard.page.exception.SelectedEPackageRuntimeException; +import org.eclipse.modisco.facet.util.emf.ui.internal.exported.wizard.page.ISelectEPackageWizardPage; +import org.eclipse.modisco.facet.util.emf.ui.util.EditingUtil; +import org.eclipse.swt.events.SelectionEvent; +import org.eclipse.swt.events.SelectionListener; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Display; +import org.eclipse.ui.dialogs.FilteredList; + +/** + * @since 0.3 + */ +public class SelectEPackageWizardPage extends WizardPage implements + ISelectEPackageWizardPage { + + private static final boolean DEBUG = DebugUtils.getDebugStatus(Activator + .getDefault()); + + private MetamodelSelectionControl mmSelectionCtl; + + public SelectEPackageWizardPage() { + super("Whatever"); //$NON-NLS-1$ + setTitle(Messages.Select_EPackage); + } + + @Override + public void setVisible(final boolean visible) { + super.setVisible(visible); + if (visible) { + this.mmSelectionCtl.getFilterText().setFocus(); + setPageComplete(true); + } + } + + public void createControl(final Composite parent) { + this.mmSelectionCtl = new MetamodelSelectionControl(parent); + this.mmSelectionCtl.setLayoutData(new GridData( + GridData.FILL_BOTH)); + final FilteredList filteredList = this.mmSelectionCtl + .getFilteredList(); + + filteredList.addSelectionListener(new SelectionListener() { + + public void widgetSelected(final SelectionEvent event) { + if (event.item != null) { + setPageComplete(filteredList.getSelection().length == 1); + } + } + + public void widgetDefaultSelected(final SelectionEvent event) { + if (getWizard().canFinish()) { + getWizard().performFinish(); + } + if (getNextPage() != null) { + goToNextPage(); + } + } + }); + + // prevent the page from being "complete" when still on a previous page + filteredList.setSelection(new int[0]); + setPageComplete(false); + setControl(this.mmSelectionCtl); + } + + protected void goToNextPage() { + getContainer().showPage(getNextPage()); + } + + public EPackage getSelectedEPackage() { + EPackage ePackage = null; + // Only one result + if (this.mmSelectionCtl.getSelectedElements() != null) { + final Object result = this.mmSelectionCtl + .getSelectedElements()[0]; + if (EPackage.Registry.INSTANCE.containsKey(result.toString())) { + ePackage = EPackage.Registry.INSTANCE + .getEPackage(result.toString()); + } + } + return ePackage; + } + + public void loadSelectedMetamodel() { + final Object[] results = this.mmSelectionCtl + .getSelectedElements(); + // if user cancel the selection of meta models, results = null + if (results != null) { + final ResourceSet resourceSet = EditingUtil.getEditingDomain() + .getResourceSet(); + for (final Object result : results) { + final URI uri = URI.createURI(result.toString()); + final Resource resource = resourceSet.getResource(uri, true); + if (!resourceSet.getResources().contains(resource)) { + final Registry packageRegistry = resourceSet + .getPackageRegistry(); + packageRegistry.putAll(putResourceContents(resource, + packageRegistry)); + resourceSet.getResources().add(resource); + } + } + } + } + + private static Registry putResourceContents(final Resource resource, + final Registry packageRegistry) { + final Registry result = packageRegistry; + for (final EObject eObject : resource.getContents()) { + if (eObject instanceof EPackage) { + final EPackage ePackage = (EPackage) eObject; + result.put(ePackage.getNsURI(), ePackage); + } + } + return result; + } + + /** + * Select the <code>packageName</code> into the list. + * + * @param packageName + * the name of the package to select. + */ + public void selectPackage(final String packageName) { + DebugUtils.debug(DEBUG); + boolean doItNow = true; + // We get all the jobs + for (final Job job : Job.getJobManager().find(null)) { + // We check if the job of 'FilteredList' is ended. If not, we + // recursively call this method to check again without interfering + // with the 'FilteredList' job (with an asynchrony call). + if (job.getClass().getName() + .startsWith(FilteredList.class.getName())) { + asyncSelectionPackage(packageName); + DebugUtils.debug(DEBUG, "Selection defered."); //$NON-NLS-1$ + doItNow = false; + break; + } + } + + // If the job 'FilteredList' is done, we can do the selection. + if (doItNow) { + internalSelectPackage(packageName); + } + } + + private void asyncSelectionPackage(final String packageName) { + Display.getDefault().asyncExec(new Runnable() { + public void run() { + selectPackage(packageName); + } + }); + } + + private void internalSelectPackage(final String packageName) { + final FilteredList filteredList = this.mmSelectionCtl + .getFilteredList(); + filteredList.setSelection(new String[] { packageName }); + if (getSelectedEPackage() == null) { + throw new SelectedEPackageRuntimeException(); + } + DebugUtils.debug(DEBUG, "Selection setting finished."); //$NON-NLS-1$ + DebugUtils.debug(DEBUG, "selectedEPackage=" + getSelectedEPackage()); //$NON-NLS-1$ + } +}
diff --git a/org.eclipse.modisco.facet.util.emf.ui/src/org/eclipse/modisco/facet/util/emf/ui/internal/exported/util/wizard/page/SynchronizedSelectEClassifierWizardPage.java b/org.eclipse.modisco.facet.util.emf.ui/src/org/eclipse/modisco/facet/util/emf/ui/internal/exported/util/wizard/page/SynchronizedSelectEClassifierWizardPage.java new file mode 100644 index 0000000..8a09fa0 --- /dev/null +++ b/org.eclipse.modisco.facet.util.emf.ui/src/org/eclipse/modisco/facet/util/emf/ui/internal/exported/util/wizard/page/SynchronizedSelectEClassifierWizardPage.java
@@ -0,0 +1,78 @@ +/** + * Copyright (c) 2012 Mia-Software. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Alban Ménager (Soft-Maint) - Bug 387470 - [EFacet][Custom] Editors + */ +package org.eclipse.modisco.facet.util.emf.ui.internal.exported.util.wizard.page; + +import org.eclipse.emf.ecore.EClassifier; +import org.eclipse.modisco.facet.util.core.DebugUtils; +import org.eclipse.modisco.facet.util.emf.ui.internal.Activator; +import org.eclipse.modisco.facet.util.emf.ui.internal.exported.wizard.page.ISelectEClassifierWizardPage; +import org.eclipse.modisco.facet.util.ui.internal.exported.displaysync.AbstractExceptionFreeRunnable; +import org.eclipse.modisco.facet.util.ui.internal.exported.displaysync.AbstractVoidExceptionFreeRunnable; +import org.eclipse.swt.widgets.Display; + +/** + * Synchronized class for safe run. + * + * @since 0.3 + * + */ +public class SynchronizedSelectEClassifierWizardPage extends + SynchronizedWizardPage<ISelectEClassifierWizardPage> implements + ISelectEClassifierWizardPage { + + private static final boolean DEBUG = DebugUtils.getDebugStatus(Activator + .getDefault()); + + /** + * Constructor. + * + * @param object + * the to synchronized. + * @param display + * the display. + */ + public SynchronizedSelectEClassifierWizardPage( + final ISelectEClassifierWizardPage object, final Display display) { + super(object, display); + } + + public EClassifier getSelectedEClassifier() { + return this + .safeSyncExec(new AbstractExceptionFreeRunnable<EClassifier>() { + @Override + public EClassifier safeRun() { + return SynchronizedSelectEClassifierWizardPage.this + .getSynchronizedObject() + .getSelectedEClassifier(); + } + }); + } + + public void selectEClassifier(final String selection) { + this.voidExceptionFreeRunnable(new AbstractVoidExceptionFreeRunnable() { + @Override + public void voidSafeRun() { + SynchronizedSelectEClassifierWizardPage.this + .getSynchronizedObject().selectEClassifier( + selection); + } + }); + + // We keep the thread waiting until the selection is not done. + // If we release the thread, the selection may not be done and made some + // errors + while (this.getSelectedEClassifier() == null) { + DebugUtils.debug(DEBUG, "Waiting."); //$NON-NLS-1$ + } + } + +}
diff --git a/org.eclipse.modisco.facet.util.emf.ui/src/org/eclipse/modisco/facet/util/emf/ui/internal/exported/util/wizard/page/SynchronizedSelectEPackageWizardPage.java b/org.eclipse.modisco.facet.util.emf.ui/src/org/eclipse/modisco/facet/util/emf/ui/internal/exported/util/wizard/page/SynchronizedSelectEPackageWizardPage.java new file mode 100644 index 0000000..5d07ba9 --- /dev/null +++ b/org.eclipse.modisco.facet.util.emf.ui/src/org/eclipse/modisco/facet/util/emf/ui/internal/exported/util/wizard/page/SynchronizedSelectEPackageWizardPage.java
@@ -0,0 +1,75 @@ +/** + * Copyright (c) 2012 Mia-Software. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Alban Ménager (Soft-Maint) - Bug 387470 - [EFacet][Custom] Editors + */ +package org.eclipse.modisco.facet.util.emf.ui.internal.exported.util.wizard.page; + +import org.eclipse.emf.ecore.EPackage; +import org.eclipse.modisco.facet.util.core.DebugUtils; +import org.eclipse.modisco.facet.util.emf.ui.internal.Activator; +import org.eclipse.modisco.facet.util.emf.ui.internal.exported.wizard.page.ISelectEPackageWizardPage; +import org.eclipse.modisco.facet.util.ui.internal.exported.displaysync.AbstractExceptionFreeRunnable; +import org.eclipse.modisco.facet.util.ui.internal.exported.displaysync.AbstractVoidExceptionFreeRunnable; +import org.eclipse.swt.widgets.Display; + +/** + * Synchronized class for safe run. + * + * @author amenager_stage + * @since 0.3 + * + */ +public class SynchronizedSelectEPackageWizardPage extends + SynchronizedWizardPage<ISelectEPackageWizardPage> implements + ISelectEPackageWizardPage { + + private static final boolean DEBUG = DebugUtils.getDebugStatus(Activator + .getDefault()); + + /** + * Constructor. + * + * @param object + * the to synchronized. + * @param display + * the display. + */ + public SynchronizedSelectEPackageWizardPage( + final ISelectEPackageWizardPage object, final Display display) { + super(object, display); + } + + public EPackage getSelectedEPackage() { + return this.safeSyncExec(new AbstractExceptionFreeRunnable<EPackage>() { + @Override + public EPackage safeRun() { + return SynchronizedSelectEPackageWizardPage.this + .getSynchronizedObject().getSelectedEPackage(); + } + }); + } + + public void selectPackage(final String selection) { + this.voidExceptionFreeRunnable(new AbstractVoidExceptionFreeRunnable() { + @Override + public void voidSafeRun() { + SynchronizedSelectEPackageWizardPage.this + .getSynchronizedObject().selectPackage(selection); + } + }); + + // We keep the thread waiting until the selection is not done. + // If we release the thread, the selection may not be done and made some + // errors + while (this.getSelectedEPackage() == null) { + DebugUtils.debug(DEBUG, "Waiting."); //$NON-NLS-1$ + } + } +}
diff --git a/org.eclipse.modisco.facet.util.emf.ui/src/org/eclipse/modisco/facet/util/emf/ui/internal/exported/util/wizard/page/SynchronizedWizardPage.java b/org.eclipse.modisco.facet.util.emf.ui/src/org/eclipse/modisco/facet/util/emf/ui/internal/exported/util/wizard/page/SynchronizedWizardPage.java new file mode 100644 index 0000000..a4268b7 --- /dev/null +++ b/org.eclipse.modisco.facet.util.emf.ui/src/org/eclipse/modisco/facet/util/emf/ui/internal/exported/util/wizard/page/SynchronizedWizardPage.java
@@ -0,0 +1,260 @@ +/** + * Copyright (c) 2012 Mia-Software. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Alban Ménager (Soft-Maint) - Bug 387470 - [EFacet][Custom] Editors + */ +package org.eclipse.modisco.facet.util.emf.ui.internal.exported.util.wizard.page; + +import org.eclipse.jface.resource.ImageDescriptor; +import org.eclipse.jface.wizard.IWizard; +import org.eclipse.jface.wizard.IWizardPage; +import org.eclipse.modisco.facet.util.ui.internal.exported.displaysync.AbstractExceptionFreeRunnable; +import org.eclipse.modisco.facet.util.ui.internal.exported.displaysync.AbstractVoidExceptionFreeRunnable; +import org.eclipse.modisco.facet.util.ui.internal.exported.displaysync.SynchronizedObject; +import org.eclipse.swt.graphics.Image; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Control; +import org.eclipse.swt.widgets.Display; + +/** + * Synchronized class for safe run. + * + * @author amenager_stage + * @since 0.3 + * + */ +public class SynchronizedWizardPage<WP extends IWizardPage> extends + SynchronizedObject<WP> + implements IWizardPage { + + /** + * Constructor. + * + * @param object + * the to synchronized. + * @param display + * the display. + */ + public SynchronizedWizardPage(final WP object, + final Display display) { + super(object, display); + } + + public void createControl(final Composite parent) { + this.voidExceptionFreeRunnable(new AbstractVoidExceptionFreeRunnable() { + @Override + public void voidSafeRun() { + SynchronizedWizardPage.this.getSynchronizedObject() + .createControl(parent); + } + }); + } + + public void dispose() { + this.voidExceptionFreeRunnable(new AbstractVoidExceptionFreeRunnable() { + @Override + public void voidSafeRun() { + SynchronizedWizardPage.this.getSynchronizedObject().dispose(); + } + }); + } + + public Control getControl() { + return this.safeSyncExec(new AbstractExceptionFreeRunnable<Control>() { + @Override + public Control safeRun() { + return SynchronizedWizardPage.this.getSynchronizedObject() + .getControl(); + } + }); + } + + public String getDescription() { + return this.safeSyncExec(new AbstractExceptionFreeRunnable<String>() { + @Override + public String safeRun() { + return SynchronizedWizardPage.this.getSynchronizedObject() + .getDescription(); + } + }); + } + + public String getErrorMessage() { + return this.safeSyncExec(new AbstractExceptionFreeRunnable<String>() { + @Override + public String safeRun() { + return SynchronizedWizardPage.this.getSynchronizedObject() + .getErrorMessage(); + } + }); + } + + public Image getImage() { + return this.safeSyncExec(new AbstractExceptionFreeRunnable<Image>() { + @Override + public Image safeRun() { + return SynchronizedWizardPage.this.getSynchronizedObject() + .getImage(); + } + }); + } + + public String getMessage() { + return this.safeSyncExec(new AbstractExceptionFreeRunnable<String>() { + @Override + public String safeRun() { + return SynchronizedWizardPage.this.getSynchronizedObject() + .getMessage(); + } + }); + } + + public String getTitle() { + return this.safeSyncExec(new AbstractExceptionFreeRunnable<String>() { + @Override + public String safeRun() { + return SynchronizedWizardPage.this.getSynchronizedObject() + .getTitle(); + } + }); + } + + public void performHelp() { + this.voidExceptionFreeRunnable(new AbstractVoidExceptionFreeRunnable() { + @Override + public void voidSafeRun() { + SynchronizedWizardPage.this.getSynchronizedObject() + .performHelp(); + } + }); + } + + public void setDescription(final String description) { + this.voidExceptionFreeRunnable(new AbstractVoidExceptionFreeRunnable() { + @Override + public void voidSafeRun() { + SynchronizedWizardPage.this.getSynchronizedObject() + .setDescription(description); + } + }); + } + + public void setImageDescriptor(final ImageDescriptor image) { + this.voidExceptionFreeRunnable(new AbstractVoidExceptionFreeRunnable() { + @Override + public void voidSafeRun() { + SynchronizedWizardPage.this.getSynchronizedObject() + .setImageDescriptor(image); + } + }); + } + + public void setTitle(final String title) { + this.voidExceptionFreeRunnable(new AbstractVoidExceptionFreeRunnable() { + @Override + public void voidSafeRun() { + SynchronizedWizardPage.this.getSynchronizedObject().setTitle( + title); + } + }); + } + + public void setVisible(final boolean visible) { + this.voidExceptionFreeRunnable(new AbstractVoidExceptionFreeRunnable() { + @Override + public void voidSafeRun() { + SynchronizedWizardPage.this.getSynchronizedObject().setVisible( + visible); + } + }); + } + + public boolean canFlipToNextPage() { + return this.safeSyncExec(new AbstractExceptionFreeRunnable<Boolean>() { + @Override + public Boolean safeRun() { + return Boolean.valueOf(SynchronizedWizardPage.this + .getSynchronizedObject() + .canFlipToNextPage()); + } + }).booleanValue(); + } + + public IWizardPage getNextPage() { + return this + .safeSyncExec(new AbstractExceptionFreeRunnable<IWizardPage>() { + @Override + public IWizardPage safeRun() { + return SynchronizedWizardPage.this + .getSynchronizedObject().getNextPage(); + } + }); + } + + public IWizardPage getPreviousPage() { + return this + .safeSyncExec(new AbstractExceptionFreeRunnable<IWizardPage>() { + @Override + public IWizardPage safeRun() { + return SynchronizedWizardPage.this + .getSynchronizedObject().getPreviousPage(); + } + }); + } + + public IWizard getWizard() { + return this.safeSyncExec(new AbstractExceptionFreeRunnable<IWizard>() { + @Override + public IWizard safeRun() { + return SynchronizedWizardPage.this.getSynchronizedObject() + .getWizard(); + } + }); + } + + public boolean isPageComplete() { + return this.safeSyncExec(new AbstractExceptionFreeRunnable<Boolean>() { + @Override + public Boolean safeRun() { + return Boolean.valueOf(SynchronizedWizardPage.this + .getSynchronizedObject().isPageComplete()); + } + }).booleanValue(); + } + + public void setPreviousPage(final IWizardPage page) { + this.voidExceptionFreeRunnable(new AbstractVoidExceptionFreeRunnable() { + @Override + public void voidSafeRun() { + SynchronizedWizardPage.this.getSynchronizedObject() + .setPreviousPage(page); + } + }); + } + + public void setWizard(final IWizard newWizard) { + this.voidExceptionFreeRunnable(new AbstractVoidExceptionFreeRunnable() { + @Override + public void voidSafeRun() { + SynchronizedWizardPage.this.getSynchronizedObject().setWizard( + newWizard); + } + }); + } + + public String getName() { + return this.safeSyncExec(new AbstractExceptionFreeRunnable<String>() { + @Override + public String safeRun() { + return SynchronizedWizardPage.this.getSynchronizedObject() + .getName(); + } + }); + } +}
diff --git a/org.eclipse.modisco.facet.util.emf.ui/src/org/eclipse/modisco/facet/util/emf/ui/internal/exported/util/wizard/page/exception/SelectedEClassifierRuntimeException.java b/org.eclipse.modisco.facet.util.emf.ui/src/org/eclipse/modisco/facet/util/emf/ui/internal/exported/util/wizard/page/exception/SelectedEClassifierRuntimeException.java new file mode 100644 index 0000000..1ae3c0c --- /dev/null +++ b/org.eclipse.modisco.facet.util.emf.ui/src/org/eclipse/modisco/facet/util/emf/ui/internal/exported/util/wizard/page/exception/SelectedEClassifierRuntimeException.java
@@ -0,0 +1,39 @@ +/** + * Copyright (c) 2012 Mia-Software. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Alban Ménager (Soft-Maint) - Bug 387470 - [EFacet][Custom] Editors + */ +package org.eclipse.modisco.facet.util.emf.ui.internal.exported.util.wizard.page.exception; + +/** + * @since 0.3 + */ +public class SelectedEClassifierRuntimeException extends RuntimeException { + + + private static final long serialVersionUID = -1021467669726982508L; + + public SelectedEClassifierRuntimeException() { + super( + "List not totally loaded. Check if the list's job is done before doing the selection."); //$NON-NLS-1$ + } + + public SelectedEClassifierRuntimeException(final String message) { + super(message); + } + + public SelectedEClassifierRuntimeException(final String message, + final Throwable cause) { + super(message, cause); + } + + public SelectedEClassifierRuntimeException(final Throwable cause) { + super(cause); + } +}
diff --git a/org.eclipse.modisco.facet.util.emf.ui/src/org/eclipse/modisco/facet/util/emf/ui/internal/exported/util/wizard/page/exception/SelectedEPackageRuntimeException.java b/org.eclipse.modisco.facet.util.emf.ui/src/org/eclipse/modisco/facet/util/emf/ui/internal/exported/util/wizard/page/exception/SelectedEPackageRuntimeException.java new file mode 100644 index 0000000..e854703 --- /dev/null +++ b/org.eclipse.modisco.facet.util.emf.ui/src/org/eclipse/modisco/facet/util/emf/ui/internal/exported/util/wizard/page/exception/SelectedEPackageRuntimeException.java
@@ -0,0 +1,41 @@ +/** + * Copyright (c) 2012 Mia-Software. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Alban Ménager (Soft-Maint) - Bug 387470 - [EFacet][Custom] Editors + */ +package org.eclipse.modisco.facet.util.emf.ui.internal.exported.util.wizard.page.exception; + +/** + * Exception when the list (where the selection has to be done) is not totally + * loaded. + * + * @since 0.3 + */ +public class SelectedEPackageRuntimeException extends RuntimeException { + + private static final long serialVersionUID = -5317379187255054199L; + + public SelectedEPackageRuntimeException() { + super( + "List not totally loaded. Check if the list's job is done before doing the selection."); //$NON-NLS-1$ + } + + public SelectedEPackageRuntimeException(final String message) { + super(message); + } + + public SelectedEPackageRuntimeException(final String message, + final Throwable cause) { + super(message, cause); + } + + public SelectedEPackageRuntimeException(final Throwable cause) { + super(cause); + } +}
diff --git a/org.eclipse.modisco.facet.util.emf.ui/src/org/eclipse/modisco/facet/util/emf/ui/internal/exported/wizard/ISelectETypeWizard.java b/org.eclipse.modisco.facet.util.emf.ui/src/org/eclipse/modisco/facet/util/emf/ui/internal/exported/wizard/ISelectETypeWizard.java new file mode 100644 index 0000000..bd982ac --- /dev/null +++ b/org.eclipse.modisco.facet.util.emf.ui/src/org/eclipse/modisco/facet/util/emf/ui/internal/exported/wizard/ISelectETypeWizard.java
@@ -0,0 +1,25 @@ +/** + * Copyright (c) 2012 Mia-Software. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Alban Ménager (Soft-Maint) - Bug 387470 - [EFacet][Custom] Editors + * Grégoire Dupé (Mia-Software) - Bug 387470 - [EFacet][Custom] Editors + */ +package org.eclipse.modisco.facet.util.emf.ui.internal.exported.wizard; + +import org.eclipse.emf.ecore.EClassifier; +import org.eclipse.modisco.facet.util.ui.internal.exported.wizard.IExtendedWizard; + +/** + * @since 0.3 + */ +public interface ISelectETypeWizard<T extends EClassifier> extends + IExtendedWizard { + + T getSelectedEClassifier(); +}
diff --git a/org.eclipse.modisco.facet.util.emf.ui/src/org/eclipse/modisco/facet/util/emf/ui/internal/exported/wizard/page/ISelectEClassifierWizardPage.java b/org.eclipse.modisco.facet.util.emf.ui/src/org/eclipse/modisco/facet/util/emf/ui/internal/exported/wizard/page/ISelectEClassifierWizardPage.java new file mode 100644 index 0000000..f65a3da --- /dev/null +++ b/org.eclipse.modisco.facet.util.emf.ui/src/org/eclipse/modisco/facet/util/emf/ui/internal/exported/wizard/page/ISelectEClassifierWizardPage.java
@@ -0,0 +1,43 @@ +/** + * Copyright (c) 2012 Mia-Software. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Alban Ménager (Soft-Maint) - Bug 387470 - [EFacet][Custom] Editors + * Grégoire Dupé (Mia-Software) - Bug 387470 - [EFacet][Custom] Editors + */ +package org.eclipse.modisco.facet.util.emf.ui.internal.exported.wizard.page; + +import org.eclipse.emf.ecore.EClassifier; +import org.eclipse.jface.wizard.IWizardPage; +import org.eclipse.modisco.facet.util.emf.ui.internal.exported.util.wizard.page.SelectEClassifierWizardPage; + +/** + * Interface for {@link SelectEClassifierWizardPage}. + * + * @see SelectEClassifierWizardPage + * @since 0.3 + * @noextend This interface is not intended to be extended by clients. + * @noimplement This interface is not intended to be implemented by clients. + */ +public interface ISelectEClassifierWizardPage<T extends EClassifier> extends + IWizardPage { + + /** + * @return the selected {@link EClassifier}. + */ + T getSelectedEClassifier(); + + /** + * Set the {@link EClassifier}. + * + * @param selection + * the name of the {@link EClassifier} to select. + */ + void selectEClassifier(final String selection); + +} \ No newline at end of file
diff --git a/org.eclipse.modisco.facet.util.emf.ui/src/org/eclipse/modisco/facet/util/emf/ui/internal/exported/wizard/page/ISelectEPackageWizardPage.java b/org.eclipse.modisco.facet.util.emf.ui/src/org/eclipse/modisco/facet/util/emf/ui/internal/exported/wizard/page/ISelectEPackageWizardPage.java new file mode 100644 index 0000000..b11403c --- /dev/null +++ b/org.eclipse.modisco.facet.util.emf.ui/src/org/eclipse/modisco/facet/util/emf/ui/internal/exported/wizard/page/ISelectEPackageWizardPage.java
@@ -0,0 +1,40 @@ +/** + * Copyright (c) 2012 Mia-Software. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Alban Ménager (Soft-Maint) - Bug 387470 - [EFacet][Custom] Editors + */ +package org.eclipse.modisco.facet.util.emf.ui.internal.exported.wizard.page; + +import org.eclipse.emf.ecore.EPackage; +import org.eclipse.jface.wizard.IWizardPage; + +/** + * Interface for {@link SelectEPackageWizardPage}. + * + * @see SelectEPackageWizardPage + * @since 0.3 + * @noextend This interface is not intended to be extended by clients. + * @noimplement This interface is not intended to be implemented by clients. + */ +public interface ISelectEPackageWizardPage extends IWizardPage { + + /** + * @return the first {@link EPackage} selected in the list. + */ + EPackage getSelectedEPackage(); + + /** + * Set the {@link EPackage} to select. + * + * @param selection + * the name of the {@link EPackage} to select. + */ + void selectPackage(final String selection); + +} \ No newline at end of file
diff --git a/org.eclipse.modisco.facet.util.emf.ui/src/org/eclipse/modisco/facet/util/emf/ui/internal/handler/SaveAsHandler.java b/org.eclipse.modisco.facet.util.emf.ui/src/org/eclipse/modisco/facet/util/emf/ui/internal/handler/SaveAsHandler.java new file mode 100644 index 0000000..5e4afc4 --- /dev/null +++ b/org.eclipse.modisco.facet.util.emf.ui/src/org/eclipse/modisco/facet/util/emf/ui/internal/handler/SaveAsHandler.java
@@ -0,0 +1,94 @@ +/** + * Copyright (c) 2013 Mia-Software. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Gregoire Dupe (Mia-Software) - Bug 406570 - Handlers to Save and SaveAs EMF resources + */ +package org.eclipse.modisco.facet.util.emf.ui.internal.handler; + +import java.util.ArrayList; +import java.util.List; + +import org.eclipse.core.commands.ExecutionEvent; +import org.eclipse.core.commands.ExecutionException; +import org.eclipse.core.commands.IHandler; +import org.eclipse.core.commands.IHandlerListener; +import org.eclipse.core.runtime.IAdaptable; +import org.eclipse.emf.ecore.resource.Resource; +import org.eclipse.jface.viewers.ISelection; +import org.eclipse.jface.viewers.StructuredSelection; +import org.eclipse.modisco.facet.util.emf.ui.internal.ResourceUiUtils; +import org.eclipse.swt.widgets.Shell; +import org.eclipse.ui.ISelectionService; +import org.eclipse.ui.IWorkbench; +import org.eclipse.ui.IWorkbenchWindow; +import org.eclipse.ui.PlatformUI; +import org.eclipse.ui.handlers.HandlerUtil; + +public class SaveAsHandler implements IHandler { + + public void addHandlerListener(final IHandlerListener handlerListener) { + // Nothing to do + } + + public void dispose() { + // Nothing to do + } + + public Object execute(final ExecutionEvent event) throws ExecutionException { + final Shell shell = HandlerUtil.getActiveShell(event); + for (Object object : getSelection()) { + if (object instanceof Resource) { + final Resource resource = (Resource) object; + ResourceUiUtils.openSaveAsDialog(resource, shell); + } else if (object instanceof IAdaptable) { + final IAdaptable adaptable = (IAdaptable) object; + final Resource resource = (Resource) adaptable + .getAdapter(Resource.class); + if (resource != null) { + ResourceUiUtils.openSaveAsDialog(resource, shell); + } + } + } + return null; + } + + public boolean isEnabled() { + return true; + } + + public boolean isHandled() { + return isEnabled(); + } + + public void removeHandlerListener(final IHandlerListener handlerListener) { + // Nothing to do + } + + private static <E> List<E> getSelection() { + final List<E> result = new ArrayList<E>(); + final IWorkbenchWindow wWindow = getActiveWindow(); + final ISelectionService selectService = wWindow.getSelectionService(); + final ISelection selection = selectService.getSelection(); + if (selection instanceof StructuredSelection) { + final StructuredSelection structS = (StructuredSelection) selection; + @SuppressWarnings("unchecked") + // @SuppressWarnings This cast is unsafe but the framework does not + // provide other way to do + final List<E> list = structS.toList(); + result.addAll(list); + } + return result; + } + + private static IWorkbenchWindow getActiveWindow() { + final IWorkbench workbench = PlatformUI.getWorkbench(); + return workbench.getActiveWorkbenchWindow(); + } + +}
diff --git a/org.eclipse.modisco.facet.util.emf.ui/src/org/eclipse/modisco/facet/util/emf/ui/internal/handler/SaveHandler.java b/org.eclipse.modisco.facet.util.emf.ui/src/org/eclipse/modisco/facet/util/emf/ui/internal/handler/SaveHandler.java new file mode 100644 index 0000000..5604702 --- /dev/null +++ b/org.eclipse.modisco.facet.util.emf.ui/src/org/eclipse/modisco/facet/util/emf/ui/internal/handler/SaveHandler.java
@@ -0,0 +1,95 @@ +/** + * Copyright (c) 2013 Mia-Software. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Gregoire Dupe (Mia-Software) - Bug 406570 - Handlers to Save and SaveAs EMF resources + */ +package org.eclipse.modisco.facet.util.emf.ui.internal.handler; + +import java.util.ArrayList; +import java.util.List; + +import org.eclipse.core.commands.ExecutionEvent; +import org.eclipse.core.commands.ExecutionException; +import org.eclipse.core.commands.IHandler; +import org.eclipse.core.commands.IHandlerListener; +import org.eclipse.core.runtime.IAdaptable; +import org.eclipse.emf.ecore.resource.Resource; +import org.eclipse.jface.viewers.ISelection; +import org.eclipse.jface.viewers.StructuredSelection; +import org.eclipse.modisco.facet.util.emf.ui.internal.ResourceUiUtils; +import org.eclipse.swt.widgets.Shell; +import org.eclipse.ui.ISelectionService; +import org.eclipse.ui.IWorkbench; +import org.eclipse.ui.IWorkbenchWindow; +import org.eclipse.ui.PlatformUI; +import org.eclipse.ui.handlers.HandlerUtil; + +public class SaveHandler implements IHandler { + + public void addHandlerListener(final IHandlerListener handlerListener) { + // Nothing to do + } + + public void dispose() { + // Nothing to do + } + + public Object execute(final ExecutionEvent event) throws ExecutionException { + final Shell shell = HandlerUtil.getActiveShell(event); + for (Object object : getSelection()) { + if (object instanceof Resource) { + final Resource resource = (Resource) object; + ResourceUiUtils.save(resource, shell); + } else if (object instanceof IAdaptable) { + final IAdaptable adaptable = (IAdaptable) object; + final Resource resource = (Resource) adaptable + .getAdapter(Resource.class); + if (resource != null) { + ResourceUiUtils.save(resource, shell); + } + } + } + return null; + } + + public boolean isEnabled() { + return true; + } + + public boolean isHandled() { + return isEnabled(); + } + + public void removeHandlerListener(final IHandlerListener handlerListener) { + // Nothing to do + } + + private static <E> List<E> getSelection() { + final List<E> result = new ArrayList<E>(); + final IWorkbenchWindow wWindow = getActiveWindow(); + final ISelectionService selectService = wWindow.getSelectionService(); + wWindow.getActivePage().getActivePart(); + final ISelection selection = selectService.getSelection(); + if (selection instanceof StructuredSelection) { + final StructuredSelection structS = (StructuredSelection) selection; + @SuppressWarnings("unchecked") + // @SuppressWarnings This cast is unsafe but the framework does not + // provide other way to do + final List<E> list = structS.toList(); + result.addAll(list); + } + return result; + } + + private static IWorkbenchWindow getActiveWindow() { + final IWorkbench workbench = PlatformUI.getWorkbench(); + return workbench.getActiveWorkbenchWindow(); + } + +}
diff --git a/org.eclipse.modisco.facet.util.emf.ui/src/org/eclipse/emf/facet/util/emf/ui/internal/messages.properties b/org.eclipse.modisco.facet.util.emf.ui/src/org/eclipse/modisco/facet/util/emf/ui/internal/messages.properties similarity index 100% rename from org.eclipse.modisco.facet.util.emf.ui/src/org/eclipse/emf/facet/util/emf/ui/internal/messages.properties rename to org.eclipse.modisco.facet.util.emf.ui/src/org/eclipse/modisco/facet/util/emf/ui/internal/messages.properties
diff --git a/org.eclipse.modisco.facet.util.emf.ui/src/org/eclipse/modisco/facet/util/emf/ui/internal/preference/pages/DefaultBrowserPreferencePage.java b/org.eclipse.modisco.facet.util.emf.ui/src/org/eclipse/modisco/facet/util/emf/ui/internal/preference/pages/DefaultBrowserPreferencePage.java new file mode 100644 index 0000000..bc8fa40 --- /dev/null +++ b/org.eclipse.modisco.facet.util.emf.ui/src/org/eclipse/modisco/facet/util/emf/ui/internal/preference/pages/DefaultBrowserPreferencePage.java
@@ -0,0 +1,106 @@ +/********************************************************************************** + * Copyright (c) 2009, 2011 Mia-Software. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Nicolas Bros (Mia-Software) + * Nicolas Guyomar (Mia-Software) - Bug 333652 Extension point offering the possibility to declare an EPackage browser + * Nicolas Bros (Mia-Software) - Bug 335218 - Extension point for registering EObject, EPackage, model editor + ***********************************************************************************/ +package org.eclipse.modisco.facet.util.emf.ui.internal.preference.pages; + +import java.util.List; + +import org.eclipse.core.runtime.preferences.InstanceScope; +import org.eclipse.jface.preference.ComboFieldEditor; +import org.eclipse.jface.preference.FieldEditorPreferencePage; +import org.eclipse.modisco.facet.util.emf.core.IBrowserRegistry; +import org.eclipse.modisco.facet.util.emf.core.IEObjectBrowserOpener; +import org.eclipse.modisco.facet.util.emf.core.IEPackageBrowserOpener; +import org.eclipse.modisco.facet.util.emf.core.IResourceBrowserOpener; +import org.eclipse.modisco.facet.util.emf.core.internal.preferences.PreferenceConstants; +import org.eclipse.modisco.facet.util.emf.ui.internal.Messages; +import org.eclipse.ui.IWorkbench; +import org.eclipse.ui.IWorkbenchPreferencePage; +import org.eclipse.ui.preferences.ScopedPreferenceStore; + +/** + * This class implements a preference page that allows the user to choose which EPackage Browser + * they want to use. + */ +public class DefaultBrowserPreferencePage extends FieldEditorPreferencePage implements + IWorkbenchPreferencePage { + + public DefaultBrowserPreferencePage() { + super(FieldEditorPreferencePage.GRID); + ScopedPreferenceStore scopedPreferenceStore = new ScopedPreferenceStore( + new InstanceScope(), + org.eclipse.modisco.facet.util.emf.core.internal.Activator.PLUGIN_ID); + setPreferenceStore(scopedPreferenceStore); + } + + /** + * Creates the field editors. Field editors are abstractions of the common GUI blocks needed to + * manipulate various types of preferences. Each field editor knows how to save and restore + * itself. + */ + @Override + public void createFieldEditors() { + createResourceOpenerField(); + createEObjectOpenerField(); + createEPackageOpenerField(); + } + + private void createEPackageOpenerField() { + List<IEPackageBrowserOpener> openers = IBrowserRegistry.INSTANCE + .getAllRegisteredEPackageBrowsers(); + int size = openers.size(); + String[][] entryNamesAndValues = new String[size][2]; + for (int i = 0; i < size; i++) { + IEPackageBrowserOpener opener = openers.get(i); + entryNamesAndValues[i][0] = opener.getBrowserName(); + entryNamesAndValues[i][1] = opener.getClass().getName(); + } + addField(new ComboFieldEditor(PreferenceConstants.P_DEFAULT_EPACKAGE_VIEWER, + Messages.EmfFacetRootPreferencePage_default_epackage_browser, entryNamesAndValues, + getFieldEditorParent())); + } + + private void createEObjectOpenerField() { + List<IEObjectBrowserOpener> openers = IBrowserRegistry.INSTANCE + .getAllRegisteredEObjectBrowsers(); + int size = openers.size(); + String[][] entryNamesAndValues = new String[size][2]; + for (int i = 0; i < size; i++) { + IEObjectBrowserOpener opener = openers.get(i); + entryNamesAndValues[i][0] = opener.getBrowserName(); + entryNamesAndValues[i][1] = opener.getClass().getName(); + } + addField(new ComboFieldEditor(PreferenceConstants.P_DEFAULT_EOBJECT_VIEWER, + Messages.EPackageBrowserPreferencePage_defaultEObjectViewer, entryNamesAndValues, + getFieldEditorParent())); + } + + private void createResourceOpenerField() { + List<IResourceBrowserOpener> openers = IBrowserRegistry.INSTANCE + .getAllRegisteredResourceBrowsers(); + int size = openers.size(); + String[][] entryNamesAndValues = new String[size][2]; + for (int i = 0; i < size; i++) { + IResourceBrowserOpener opener = openers.get(i); + entryNamesAndValues[i][0] = opener.getBrowserName(); + entryNamesAndValues[i][1] = opener.getClass().getName(); + } + addField(new ComboFieldEditor(PreferenceConstants.P_DEFAULT_RESOURCE_VIEWER, + Messages.EPackageBrowserPreferencePage_defaultResourceViewer, entryNamesAndValues, + getFieldEditorParent())); + } + + public void init(final IWorkbench workbench) { + // Nothing to do + } + +} \ No newline at end of file
diff --git a/org.eclipse.modisco.facet.util.emf.ui/src/org/eclipse/modisco/facet/util/emf/ui/internal/utils/ImageProvider.java b/org.eclipse.modisco.facet.util.emf.ui/src/org/eclipse/modisco/facet/util/emf/ui/internal/utils/ImageProvider.java new file mode 100644 index 0000000..83b8548 --- /dev/null +++ b/org.eclipse.modisco.facet.util.emf.ui/src/org/eclipse/modisco/facet/util/emf/ui/internal/utils/ImageProvider.java
@@ -0,0 +1,62 @@ +/******************************************************************************* + * Copyright (c) 2011 Mia-Software. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Nicolas Guyomar (Mia-Software) - Bug 333652 Extension point offering the possibility to declare an EPackage browser + * Gregoire Dupe (Mia-Software) - Bug 406578 - Generic Label Provider for EMF objects + *******************************************************************************/ +package org.eclipse.modisco.facet.util.emf.ui.internal.utils; + +import org.eclipse.jface.resource.ImageDescriptor; +import org.eclipse.modisco.facet.util.emf.ui.internal.Activator; +import org.eclipse.modisco.facet.util.swt.imageprovider.IImageProvider; +import org.eclipse.modisco.facet.util.swt.imageprovider.IImageProviderFactory; +import org.eclipse.swt.graphics.Image; + +/** + * Provides icons for EMF Facet, and caches them. + */ +public final class ImageProvider { + public static final String EMFFACET_LOGO = "icons/logoEmfFacetMini.gif"; //$NON-NLS-1$ + public static final String CATALOG = "icons/catalog.png"; //$NON-NLS-1$ + public static final String MODEL = "icons/ModelIcon.gif"; //$NON-NLS-1$ + + private static final ImageProvider SINGLETON = new ImageProvider(); + public static final IImageProvider DEFAULT = IImageProviderFactory.DEFAULT + .createIImageProvider(Activator.getDefault()); + + private ImageProvider() { + // Must not be used + } + + @Deprecated + public static ImageProvider getInstance() { + return ImageProvider.SINGLETON; + } + + @SuppressWarnings("static-method") + // @SuppressWarnings("static-method") This warning is caused by the + // redirection code associated to the deprecation of this method. + @Deprecated + public Image getEmfFacetLogo() { + return DEFAULT.getImage(EMFFACET_LOGO); + } + + @Deprecated + public static ImageDescriptor getEmfFacetLogoDescriptor() { + return DEFAULT.createImageDescriptor(ImageProvider.EMFFACET_LOGO); + } + + /** Return the icon representing a bidirectional link */ + @SuppressWarnings("static-method") + // @SuppressWarnings("static-method") This warning is caused by the + // redirection code associated to the deprecation of this method. + @Deprecated + public Image getCatalogIcon() { + return DEFAULT.getImage(CATALOG); + } +}
diff --git a/org.eclipse.modisco.facet.util.emf.ui/src/org/eclipse/modisco/facet/util/emf/ui/internal/utils/ImageUtils.java b/org.eclipse.modisco.facet.util.emf.ui/src/org/eclipse/modisco/facet/util/emf/ui/internal/utils/ImageUtils.java new file mode 100644 index 0000000..256a5d8 --- /dev/null +++ b/org.eclipse.modisco.facet.util.emf.ui/src/org/eclipse/modisco/facet/util/emf/ui/internal/utils/ImageUtils.java
@@ -0,0 +1,55 @@ +/******************************************************************************* + * Copyright (c) 2009 Mia-Software. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Gregoire Dupe (Mia-Software) + *******************************************************************************/ +package org.eclipse.modisco.facet.util.emf.ui.internal.utils; + +import org.eclipse.emf.common.notify.AdapterFactory; +import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.edit.provider.ComposedAdapterFactory; +import org.eclipse.emf.edit.provider.IItemLabelProvider; +import org.eclipse.emf.edit.ui.provider.ExtendedImageRegistry; +import org.eclipse.swt.graphics.Image; + +/** + * Utility class for handling {@link Image}s. + * + * @author Gregoire Dupe + */ +public final class ImageUtils { + private static AdapterFactory composedAdapterFactory = new ComposedAdapterFactory( + ComposedAdapterFactory.Descriptor.Registry.INSTANCE); + + private ImageUtils() { + // Nothing to do + } + + /** + * Returns an image for the given model element from the EMF global + * registry. + * + * @param object + * an {@link EObject} for which an {@link Image} is required + * @return an image or <code>null</code> if none was found for the given + * element, or the element is not an {@link EObject} + */ + public static Image getImage(final Object object) { + Image result = null; + if (object instanceof EObject) { + EObject eObject = (EObject) object; + IItemLabelProvider itemLabelProvider = (IItemLabelProvider) ImageUtils.composedAdapterFactory + .adapt(eObject, IItemLabelProvider.class); + if (itemLabelProvider != null) { + Object image = itemLabelProvider.getImage(eObject); + result = ExtendedImageRegistry.getInstance().getImage(image); + } + } + return result; + } +}
diff --git a/org.eclipse.modisco.facet.util.emf.ui/src/org/eclipse/modisco/facet/util/emf/ui/internal/view/PackageRegistryView.java b/org.eclipse.modisco.facet.util.emf.ui/src/org/eclipse/modisco/facet/util/emf/ui/internal/view/PackageRegistryView.java new file mode 100644 index 0000000..d82d905 --- /dev/null +++ b/org.eclipse.modisco.facet.util.emf.ui/src/org/eclipse/modisco/facet/util/emf/ui/internal/view/PackageRegistryView.java
@@ -0,0 +1,335 @@ +/******************************************************************************* + * Copyright (c) 2009, 2010, 2011 Mia-Software. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Gregoire Dupe (Mia-Software) - initial API and implementation + * Nicolas Bros (Mia-Software) + * Nicolas Guyomar (Mia-Software) - Bug 333652 Extension point offering the possibility to declare an EPackage browser + *******************************************************************************/ +package org.eclipse.modisco.facet.util.emf.ui.internal.view; + +import java.util.ArrayList; +import java.util.List; + +import org.eclipse.core.resources.IFile; +import org.eclipse.core.runtime.Platform; +import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.ecore.EPackage; +import org.eclipse.emf.ecore.EPackage.Registry; +import org.eclipse.jface.action.Action; +import org.eclipse.jface.action.GroupMarker; +import org.eclipse.jface.action.IAction; +import org.eclipse.jface.action.IMenuListener; +import org.eclipse.jface.action.IMenuManager; +import org.eclipse.jface.action.MenuManager; +import org.eclipse.jface.viewers.ColumnLabelProvider; +import org.eclipse.jface.viewers.IContentProvider; +import org.eclipse.jface.viewers.ISelection; +import org.eclipse.jface.viewers.IStructuredSelection; +import org.eclipse.jface.viewers.ITreeContentProvider; +import org.eclipse.jface.viewers.Viewer; +import org.eclipse.modisco.facet.common.ui.internal.views.AbstractTreeView; +import org.eclipse.modisco.facet.util.core.Logger; +import org.eclipse.modisco.facet.util.emf.core.IBrowserRegistry; +import org.eclipse.modisco.facet.util.emf.ui.internal.Activator; +import org.eclipse.modisco.facet.util.emf.ui.internal.Messages; +import org.eclipse.modisco.facet.util.emf.ui.internal.utils.ImageUtils; +import org.eclipse.swt.dnd.Clipboard; +import org.eclipse.swt.dnd.TextTransfer; +import org.eclipse.swt.dnd.Transfer; +import org.eclipse.swt.graphics.Image; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Display; +import org.eclipse.swt.widgets.Menu; +import org.eclipse.ui.IWorkbenchActionConstants; + +/** + * An Eclipse view that displays a list of available Ecore meta-models. + */ +public class PackageRegistryView extends AbstractTreeView implements IMenuListener { + + private static final String NAME_COLUMN = "PackageRegistryView_NameColumn"; //$NON-NLS-1$ + private static final String NSURI_COLUMN = "PackageRegistryView_NsURIColumn"; //$NON-NLS-1$ + + private static final int COLUMN_WIDTH = 200; + + private static final String DEBUG_ID = "org.eclipse.emf.facet.infra.common.ui/debug/PackageRegistryView/event_debug"; //$NON-NLS-1$ + private static final boolean DEBUG = Activator.getDefault().isDebugging() + && new Boolean(Platform.getDebugOption(PackageRegistryView.DEBUG_ID)).booleanValue(); + + @Override + public void createPartControl(final Composite parent) { + super.createPartControl(parent); + createContextMenu(); + } + + @Override + protected void createContextMenu() { + final MenuManager contextMenu = new MenuManager("#PopUp"); //$NON-NLS-1$ + contextMenu.add(this.actionCopyNsURI); + contextMenu.add(new GroupMarker(IWorkbenchActionConstants.MB_ADDITIONS)); + contextMenu.addMenuListener(this); + final Menu menu = contextMenu.createContextMenu(getViewer().getControl()); + getViewer().getControl().setMenu(menu); + getSite().registerContextMenu(contextMenu, getViewer()); + } + + @Override + public void dispose() { + super.dispose(); + } + + @Override + protected void createColumns() { + createNameColumn(); + createNsUriColumn(); + } + + private void createNameColumn() { + ColumnLabelProvider columnLabelProvider = new ColumnLabelProvider() { + @Override + public String getText(final Object element) { + if (element instanceof EPackage) { + EPackage ePackage = (EPackage) element; + return ePackage.getName(); + } else if (element instanceof String) { + return (String) element; + } + return ""; //$NON-NLS-1$ + } + + @Override + public Image getImage(final Object element) { + return ImageUtils.getImage(element); + } + }; + createColumn(Messages.PackageRegistryView_Name, PackageRegistryView.NAME_COLUMN, + PackageRegistryView.COLUMN_WIDTH, columnLabelProvider); + } + + private void createNsUriColumn() { + ColumnLabelProvider columnLabelProvider = new ColumnLabelProvider() { + @Override + public String getText(final Object element) { + if (!(element instanceof EPackage)) { + return ""; //$NON-NLS-1$ + } + EPackage ePackage = (EPackage) element; + return ePackage.getNsURI(); + } + }; + createColumn(Messages.PackageRegistryView_nsURI, PackageRegistryView.NSURI_COLUMN, + PackageRegistryView.COLUMN_WIDTH * 2, columnLabelProvider); + } + + /** + * Reads the registry in a non-UI thread, so that the UI thread will be able to access it faster + * + * @param registry + * the registry to preload + */ + private static void preloadRegistry(final Registry registry) { + // avoid ConcurrentModificationException + List<String> keys = new ArrayList<String>(); + keys.addAll(registry.keySet()); + for (String nsURI : keys) { + try { + registry.getEPackage(nsURI); + } catch (Exception e) { + Logger.logWarning(e, + "An error happened while loading an EPackage from Package.Registry.INSTANCE: " //$NON-NLS-1$ + + nsURI, Activator.getDefault()); + } catch (LinkageError e) { + Logger.logError(e, "An error prevented an EPackage from being loaded: " //$NON-NLS-1$ + + nsURI, Activator.getDefault()); + } + } + } + + /** + * An {@link EObject} was added to the package registry + * + * @param eObject + * @param file + */ + public void added(final EObject eObject, final IFile file) { + if (PackageRegistryView.DEBUG) { + System.out.println(this.getClass().getSimpleName() + ".added(EObject,IFile)"); //$NON-NLS-1$ + } + refresh(true); + } + + /** + * An {@link EObject} was changed in the package registry + * + * @param eObject + * @param file + */ + public void changed(final EObject eObject, final IFile file) { + if (PackageRegistryView.DEBUG) { + System.out.println(this.getClass().getSimpleName() + ".changed(EObject,IFile)"); //$NON-NLS-1$ + } + refresh(true); + } + + /** + * A file was removed from the package registry + * + * @param file + */ + public void removed(final IFile file) { + if (PackageRegistryView.DEBUG) { + System.out.println(this.getClass().getSimpleName() + ".removed(EObject,IFile)"); //$NON-NLS-1$ + } + refresh(true); + } + + @Override + protected IContentProvider getContentProvider() { + return new ITreeContentProvider() { + public Object[] getElements(final Object inputElement) { + if (inputElement instanceof EPackage.Registry) { + EPackage.Registry registry = (EPackage.Registry) inputElement; + List<EPackage> ePackages = new ArrayList<EPackage>(); + // avoid a ConcurrentModificationException + List<String> keys = new ArrayList<String>(); + keys.addAll(registry.keySet()); + for (String nsURI : keys) { + try { + EPackage ePackage = registry.getEPackage(nsURI); + if (ePackage == null) { + throw new Exception("ePackage is null for : " //$NON-NLS-1$ + + nsURI); + } + ePackages.add(ePackage); + } catch (Exception e) { + Logger.logWarning(e, + "An error happened while loading an EPackage from Package.Registry.INSTANCE: " //$NON-NLS-1$ + + nsURI, Activator.getDefault()); + } + } + return ePackages.toArray(); + } else if (inputElement == null) { + return new Object[] {}; + } else if (inputElement instanceof String) { + String message = (String) inputElement; + return new Object[] { message }; + } else { + throw new RuntimeException("Unexpected element type: " //$NON-NLS-1$ + + inputElement.getClass().getName()); + } + } + + public void inputChanged(final Viewer viewer, final Object oldInput, + final Object newInput) { + // Nothing to do + } + + public Object[] getChildren(final Object parentElement) { + if (parentElement instanceof EPackage.Registry) { + EPackage.Registry registry = (EPackage.Registry) parentElement; + return registry.values().toArray(); + } else if (parentElement == null || parentElement instanceof String) { + return new Object[] {}; + } else { + throw new RuntimeException("Unexpected element type: " //$NON-NLS-1$ + + parentElement.getClass().getName()); + } + } + + public Object getParent(final Object element) { + return null; + } + + public boolean hasChildren(final Object element) { + if (element instanceof EPackage.Registry) { + return true; + } + return false; + } + + public void dispose() { + // Nothing to do + } + }; + } + + @Override + protected void openElement(final Object element) { + if (element instanceof EPackage) { + EPackage ePackage = (EPackage) element; + IBrowserRegistry.INSTANCE.browseEPackage(ePackage); + } + } + + @Override + protected String getRefreshMessage() { + return Messages.PackageRegistryView_RefreshingPackageRegistryView; + } + + @Override + protected void doRefresh() { + // display a message while initializing + // (initialization can take a while) + Display.getDefault().syncExec(new Runnable() { + public void run() { + getViewer().setInput(Messages.PackageRegistryView_initializing); + } + }); + final EPackage.Registry registry = EPackage.Registry.INSTANCE; + // Read a first time in a non-UI thread so as to avoid + // blocking. Then it will be cached for the UI thread. + preloadRegistry(registry); + Display.getDefault().syncExec(new Runnable() { + public void run() { + // the control might be disposed if the view was closed + // in the meantime + if (!getViewer().getControl().isDisposed()) { + getViewer().setInput(registry); + getViewer().refresh(); + } + } + }); + } + + @Override + protected Object getInput() { + return EPackage.Registry.INSTANCE; + } + + private final Action actionCopyNsURI = new Action(Messages.PackageRegistryView_copyNsURI, + IAction.AS_PUSH_BUTTON) { + @Override + public void run() { + EPackage selectedPackage = PackageRegistryView.this.getSelectedPackage(); + if (selectedPackage != null) { + String nsURI = selectedPackage.getNsURI(); + Clipboard clipboard = new Clipboard(Display.getDefault()); + clipboard.setContents(new Object[] { nsURI }, + new Transfer[] { TextTransfer.getInstance() }); + clipboard.dispose(); + } + } + }; + + protected EPackage getSelectedPackage() { + ISelection selection = getViewer().getSelection(); + if (selection instanceof IStructuredSelection) { + IStructuredSelection structuredSelection = (IStructuredSelection) selection; + Object element = structuredSelection.getFirstElement(); + if (element instanceof EPackage) { + EPackage ePackage = (EPackage) element; + return ePackage; + } + } + return null; + } + + public void menuAboutToShow(final IMenuManager manager) { + this.actionCopyNsURI.setEnabled(getSelectedPackage() != null); + } +}
diff --git a/org.eclipse.modisco.facet.util.emf.ui/src/org/eclipse/modisco/facet/util/emf/ui/util/EditingUtil.java b/org.eclipse.modisco.facet.util.emf.ui/src/org/eclipse/modisco/facet/util/emf/ui/util/EditingUtil.java new file mode 100644 index 0000000..b329dc2 --- /dev/null +++ b/org.eclipse.modisco.facet.util.emf.ui/src/org/eclipse/modisco/facet/util/emf/ui/util/EditingUtil.java
@@ -0,0 +1,60 @@ +/** + * Copyright (c) 2012 Mia-Software. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Alban Ménager (Soft-Maint) - Bug 387470 - [EFacet][Custom] Editors + */ +package org.eclipse.modisco.facet.util.emf.ui.util; + +import java.io.File; + +import org.eclipse.emf.common.util.URI; +import org.eclipse.emf.ecore.resource.Resource; +import org.eclipse.emf.edit.domain.EditingDomain; +import org.eclipse.emf.edit.domain.IEditingDomainProvider; +import org.eclipse.ui.IWorkbenchPart; +import org.eclipse.ui.PlatformUI; + +/** + * @since 0.3 + */ +public final class EditingUtil { + + private EditingUtil() { + // Hidden constructor. + } + + /** + * Return the current editing domain. + * + * @return the current editing domain. + */ + public static EditingDomain getEditingDomain() { + // Retrieve the editor + final IWorkbenchPart editor = PlatformUI.getWorkbench() + .getWorkbenchWindows()[0].getPages()[0].getActivePart(); + // Retrieve the editing domain + final IEditingDomainProvider edProvider = (IEditingDomainProvider) editor + .getAdapter(IEditingDomainProvider.class); + EditingDomain editingDomain = null; + if (edProvider != null) { + editingDomain = edProvider.getEditingDomain(); + } + return editingDomain; + } + + /** + * Create and return a new {@link Resource}. + * + * @return the new {@link Resource}. + */ + public static Resource createDefaultResource(final File file) { + return getEditingDomain().getResourceSet().createResource( + URI.createFileURI(file.getPath())); + } +}
diff --git a/org.eclipse.modisco.facet.util.jface.ui/META-INF/MANIFEST.MF b/org.eclipse.modisco.facet.util.jface.ui/META-INF/MANIFEST.MF index 5175db0..0ff3d1d 100644 --- a/org.eclipse.modisco.facet.util.jface.ui/META-INF/MANIFEST.MF +++ b/org.eclipse.modisco.facet.util.jface.ui/META-INF/MANIFEST.MF
@@ -3,7 +3,7 @@ Bundle-Name: %Bundle-Name Bundle-SymbolicName: org.eclipse.emf.facet.util.jface.ui Bundle-Version: 1.3.0.qualifier -Bundle-Activator: org.eclipse.emf.facet.util.jface.ui.internal.Activator +Bundle-Activator: org.eclipse.modisco.facet.util.jface.ui.internal.Activator Require-Bundle: org.eclipse.core.runtime;bundle-version="3.6.0", org.eclipse.jface;bundle-version="3.6.0", org.eclipse.emf.facet.util.core;bundle-version="0.4.0", @@ -11,5 +11,5 @@ Bundle-ActivationPolicy: lazy Bundle-RequiredExecutionEnvironment: JavaSE-1.8 Bundle-Vendor: %Bundle-Vendor -Export-Package: org.eclipse.emf.facet.util.jface.ui.imageprovider +Export-Package: org.eclipse.modisco.facet.util.jface.ui.imageprovider Automatic-Module-Name: org.eclipse.emf.facet.util.jface.ui
diff --git a/org.eclipse.modisco.facet.util.jface.ui/src/org/eclipse/emf/facet/util/jface/ui/imageprovider/IImageProvider.java b/org.eclipse.modisco.facet.util.jface.ui/src/org/eclipse/emf/facet/util/jface/ui/imageprovider/IImageProvider.java deleted file mode 100644 index ac4ff5f..0000000 --- a/org.eclipse.modisco.facet.util.jface.ui/src/org/eclipse/emf/facet/util/jface/ui/imageprovider/IImageProvider.java +++ /dev/null
@@ -1,66 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2013 Soft-Maint. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Thomas Cicognani (Soft-Maint) - Bug 424416 - Plug-in for JFace Utilities - ******************************************************************************/ - -package org.eclipse.emf.facet.util.jface.ui.imageprovider; - -import org.eclipse.jface.resource.ImageDescriptor; -import org.eclipse.jface.viewers.DecorationOverlayIcon; -import org.eclipse.swt.graphics.Image; - -/** - * JFace Image Provider - * - * @noextend This interface is not intended to be extended by clients. - * @noimplement This interface is not intended to be implemented by clients. - * @since 0.4.0* - * @deprecated replaced by {@link org.eclipse.emf.facet.util.swt.imageprovider.IImageProvider} - */ -@Deprecated -public interface IImageProvider { - - /** - * Return an image from an Overlay Icon description. - * - * @param imgDescriptor - * Overlay Icon description - * @return A new image - */ - Image getImage(DecorationOverlayIcon imgDescriptor); - - /** - * Return an image from its path - * - * @param path - * The path of the image - * @return A new image - */ - Image getImage(String path); - - /** - * Return an image descriptor from its path - * - * @param resourcePath - * The path from which to create the descriptor - * @return The new image descriptor - */ - ImageDescriptor createImageDescriptor(String resourcePath); - - /** - * Return an image from an image descriptor - * - * @param imgDescriptor - * An image descriptor to create the image - * @return A new image - */ - Image getImage(ImageDescriptor imgDescriptor); - -}
diff --git a/org.eclipse.modisco.facet.util.jface.ui/src/org/eclipse/emf/facet/util/jface/ui/imageprovider/IImageProviderFactory.java b/org.eclipse.modisco.facet.util.jface.ui/src/org/eclipse/emf/facet/util/jface/ui/imageprovider/IImageProviderFactory.java deleted file mode 100644 index 452dc93..0000000 --- a/org.eclipse.modisco.facet.util.jface.ui/src/org/eclipse/emf/facet/util/jface/ui/imageprovider/IImageProviderFactory.java +++ /dev/null
@@ -1,39 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2013 Soft-Maint. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Thomas Cicognani (Soft-Maint) - Bug 424416 - Plug-in for JFace Utilities - ******************************************************************************/ -package org.eclipse.emf.facet.util.jface.ui.imageprovider; - -import org.eclipse.core.runtime.Plugin; -import org.eclipse.emf.facet.util.jface.ui.internal.imageprovider.ImageProviderFactory; - -/** - * JFace Image Provider Factory - * - * @noextend This interface is not intended to be extended by clients. - * @noimplement This interface is not intended to be implemented by clients. - * @since 0.4.0 - * @deprecated replaced by {@link org.eclipse.emf.facet.util.swt.imageprovider.IImageProviderFactory} - */ -@Deprecated -public interface IImageProviderFactory { - - IImageProviderFactory DEFAULT = new ImageProviderFactory(); - - /** - * Create a new Image Provider Factory. Factories are cached with plugin - * instances. - * - * @param plugin - * Current plugin which wants an image provider - * @return An image provider factory - */ - IImageProvider createIImageProvider(Plugin plugin); -}
diff --git a/org.eclipse.modisco.facet.util.jface.ui/src/org/eclipse/emf/facet/util/jface/ui/internal/Activator.java b/org.eclipse.modisco.facet.util.jface.ui/src/org/eclipse/emf/facet/util/jface/ui/internal/Activator.java deleted file mode 100644 index 70b206f..0000000 --- a/org.eclipse.modisco.facet.util.jface.ui/src/org/eclipse/emf/facet/util/jface/ui/internal/Activator.java +++ /dev/null
@@ -1,50 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2013 Soft-Maint. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Thomas Cicognani (Soft-Maint) - Bug 424416 - Plug-in for JFace Utilities - ******************************************************************************/ -package org.eclipse.emf.facet.util.jface.ui.internal; - -import org.eclipse.core.runtime.Plugin; -import org.osgi.framework.BundleContext; - -@SuppressWarnings("PMD.UseSingleton") -//@SuppressWarnings("PMD.UseSingleton") We cannot conforms to this rule because -//this class is an Eclipse plug-in activator which will be instantiated by the -//Eclipse framework. -public class Activator extends Plugin { - - private static Activator plugin; - - @Override - @SuppressWarnings("PMD.SignatureDeclareThrowsException") - // @SuppressWarnings("PMD.SignatureDeclareThrowsException") We have to use - // this signature because this is an override of an Eclipse framework's - // method. - public void start(final BundleContext bundleContext) throws Exception { - super.start(bundleContext); - Activator.plugin = this; - } - - @Override - @SuppressWarnings("PMD.SignatureDeclareThrowsException") - // @SuppressWarnings("PMD.SignatureDeclareThrowsException") We have to use - // this signature because this is an override of an Eclipse framework's - // method. - public void stop(final BundleContext bundleContext) throws Exception { - // NOPMD: PMD say "Assigning an Object to null is a code smell." - // No choice to right it in another way : this is an Eclipse pattern. - Activator.plugin = null; // NOPMD by gdupe on 30/03/12 10:19 - super.stop(bundleContext); - } - - public static Plugin getDefault() { - return Activator.plugin; - } -}
diff --git a/org.eclipse.modisco.facet.util.jface.ui/src/org/eclipse/emf/facet/util/jface/ui/internal/imageprovider/ImageProvider.java b/org.eclipse.modisco.facet.util.jface.ui/src/org/eclipse/emf/facet/util/jface/ui/internal/imageprovider/ImageProvider.java deleted file mode 100644 index 36af51a..0000000 --- a/org.eclipse.modisco.facet.util.jface.ui/src/org/eclipse/emf/facet/util/jface/ui/internal/imageprovider/ImageProvider.java +++ /dev/null
@@ -1,47 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2013 Soft-Maint. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Thomas Cicognani (Soft-Maint) - Bug 424416 - Plug-in for JFace Utilities - ******************************************************************************/ - -package org.eclipse.emf.facet.util.jface.ui.internal.imageprovider; - -import org.eclipse.core.runtime.Plugin; -import org.eclipse.emf.facet.util.jface.ui.imageprovider.IImageProvider; -import org.eclipse.emf.facet.util.swt.imageprovider.IImageProviderFactory; -import org.eclipse.jface.resource.ImageDescriptor; -import org.eclipse.jface.viewers.DecorationOverlayIcon; -import org.eclipse.swt.graphics.Image; - -@Deprecated -public final class ImageProvider implements IImageProvider { - - private final org.eclipse.emf.facet.util.swt.imageprovider.IImageProvider delegate; - - ImageProvider(final Plugin plugin) { - this.delegate = IImageProviderFactory.DEFAULT - .createIImageProvider(plugin); - } - - public Image getImage(final DecorationOverlayIcon imgDescriptor) { - return this.delegate.getImage(imgDescriptor); - } - - public Image getImage(final String path) { - return this.delegate.getImage(path); - } - - public ImageDescriptor createImageDescriptor(final String resourcePath) { - return this.delegate.createImageDescriptor(resourcePath); - } - - public Image getImage(final ImageDescriptor imgDescriptor) { - return this.delegate.getImage(imgDescriptor); - } -}
diff --git a/org.eclipse.modisco.facet.util.jface.ui/src/org/eclipse/emf/facet/util/jface/ui/internal/imageprovider/ImageProviderFactory.java b/org.eclipse.modisco.facet.util.jface.ui/src/org/eclipse/emf/facet/util/jface/ui/internal/imageprovider/ImageProviderFactory.java deleted file mode 100644 index 2d139a4..0000000 --- a/org.eclipse.modisco.facet.util.jface.ui/src/org/eclipse/emf/facet/util/jface/ui/internal/imageprovider/ImageProviderFactory.java +++ /dev/null
@@ -1,35 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2013 Soft-Maint. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Thomas Cicognani (Soft-Maint) - Bug 424416 - Plug-in for JFace Utilities - ******************************************************************************/ -package org.eclipse.emf.facet.util.jface.ui.internal.imageprovider; - -import java.util.HashMap; -import java.util.Map; - -import org.eclipse.core.runtime.Plugin; -import org.eclipse.emf.facet.util.jface.ui.imageprovider.IImageProvider; -import org.eclipse.emf.facet.util.jface.ui.imageprovider.IImageProviderFactory; - -@Deprecated -public class ImageProviderFactory implements IImageProviderFactory { - - private final Map<Plugin, IImageProvider> map = new HashMap<Plugin, IImageProvider>(); - - public IImageProvider createIImageProvider(final Plugin plugin) { - IImageProvider result = this.map.get(plugin); - if (result == null) { - result = new ImageProvider(plugin); - this.map.put(plugin, result); - } - return result; - } - -}
diff --git a/org.eclipse.modisco.facet.util.jface.ui/src/org/eclipse/modisco/facet/util/jface/ui/imageprovider/IImageProvider.java b/org.eclipse.modisco.facet.util.jface.ui/src/org/eclipse/modisco/facet/util/jface/ui/imageprovider/IImageProvider.java new file mode 100644 index 0000000..56b2674 --- /dev/null +++ b/org.eclipse.modisco.facet.util.jface.ui/src/org/eclipse/modisco/facet/util/jface/ui/imageprovider/IImageProvider.java
@@ -0,0 +1,66 @@ +/******************************************************************************* + * Copyright (c) 2013 Soft-Maint. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Thomas Cicognani (Soft-Maint) - Bug 424416 - Plug-in for JFace Utilities + ******************************************************************************/ + +package org.eclipse.modisco.facet.util.jface.ui.imageprovider; + +import org.eclipse.jface.resource.ImageDescriptor; +import org.eclipse.jface.viewers.DecorationOverlayIcon; +import org.eclipse.swt.graphics.Image; + +/** + * JFace Image Provider + * + * @noextend This interface is not intended to be extended by clients. + * @noimplement This interface is not intended to be implemented by clients. + * @since 0.4.0* + * @deprecated replaced by {@link org.eclipse.modisco.facet.util.swt.imageprovider.IImageProvider} + */ +@Deprecated +public interface IImageProvider { + + /** + * Return an image from an Overlay Icon description. + * + * @param imgDescriptor + * Overlay Icon description + * @return A new image + */ + Image getImage(DecorationOverlayIcon imgDescriptor); + + /** + * Return an image from its path + * + * @param path + * The path of the image + * @return A new image + */ + Image getImage(String path); + + /** + * Return an image descriptor from its path + * + * @param resourcePath + * The path from which to create the descriptor + * @return The new image descriptor + */ + ImageDescriptor createImageDescriptor(String resourcePath); + + /** + * Return an image from an image descriptor + * + * @param imgDescriptor + * An image descriptor to create the image + * @return A new image + */ + Image getImage(ImageDescriptor imgDescriptor); + +}
diff --git a/org.eclipse.modisco.facet.util.jface.ui/src/org/eclipse/modisco/facet/util/jface/ui/imageprovider/IImageProviderFactory.java b/org.eclipse.modisco.facet.util.jface.ui/src/org/eclipse/modisco/facet/util/jface/ui/imageprovider/IImageProviderFactory.java new file mode 100644 index 0000000..a377a8b --- /dev/null +++ b/org.eclipse.modisco.facet.util.jface.ui/src/org/eclipse/modisco/facet/util/jface/ui/imageprovider/IImageProviderFactory.java
@@ -0,0 +1,39 @@ +/******************************************************************************* + * Copyright (c) 2013 Soft-Maint. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Thomas Cicognani (Soft-Maint) - Bug 424416 - Plug-in for JFace Utilities + ******************************************************************************/ +package org.eclipse.modisco.facet.util.jface.ui.imageprovider; + +import org.eclipse.core.runtime.Plugin; +import org.eclipse.modisco.facet.util.jface.ui.internal.imageprovider.ImageProviderFactory; + +/** + * JFace Image Provider Factory + * + * @noextend This interface is not intended to be extended by clients. + * @noimplement This interface is not intended to be implemented by clients. + * @since 0.4.0 + * @deprecated replaced by {@link org.eclipse.modisco.facet.util.swt.imageprovider.IImageProviderFactory} + */ +@Deprecated +public interface IImageProviderFactory { + + IImageProviderFactory DEFAULT = new ImageProviderFactory(); + + /** + * Create a new Image Provider Factory. Factories are cached with plugin + * instances. + * + * @param plugin + * Current plugin which wants an image provider + * @return An image provider factory + */ + IImageProvider createIImageProvider(Plugin plugin); +}
diff --git a/org.eclipse.modisco.facet.util.jface.ui/src/org/eclipse/modisco/facet/util/jface/ui/internal/Activator.java b/org.eclipse.modisco.facet.util.jface.ui/src/org/eclipse/modisco/facet/util/jface/ui/internal/Activator.java new file mode 100644 index 0000000..c289068 --- /dev/null +++ b/org.eclipse.modisco.facet.util.jface.ui/src/org/eclipse/modisco/facet/util/jface/ui/internal/Activator.java
@@ -0,0 +1,50 @@ +/******************************************************************************* + * Copyright (c) 2013 Soft-Maint. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Thomas Cicognani (Soft-Maint) - Bug 424416 - Plug-in for JFace Utilities + ******************************************************************************/ +package org.eclipse.modisco.facet.util.jface.ui.internal; + +import org.eclipse.core.runtime.Plugin; +import org.osgi.framework.BundleContext; + +@SuppressWarnings("PMD.UseSingleton") +//@SuppressWarnings("PMD.UseSingleton") We cannot conforms to this rule because +//this class is an Eclipse plug-in activator which will be instantiated by the +//Eclipse framework. +public class Activator extends Plugin { + + private static Activator plugin; + + @Override + @SuppressWarnings("PMD.SignatureDeclareThrowsException") + // @SuppressWarnings("PMD.SignatureDeclareThrowsException") We have to use + // this signature because this is an override of an Eclipse framework's + // method. + public void start(final BundleContext bundleContext) throws Exception { + super.start(bundleContext); + Activator.plugin = this; + } + + @Override + @SuppressWarnings("PMD.SignatureDeclareThrowsException") + // @SuppressWarnings("PMD.SignatureDeclareThrowsException") We have to use + // this signature because this is an override of an Eclipse framework's + // method. + public void stop(final BundleContext bundleContext) throws Exception { + // NOPMD: PMD say "Assigning an Object to null is a code smell." + // No choice to right it in another way : this is an Eclipse pattern. + Activator.plugin = null; // NOPMD by gdupe on 30/03/12 10:19 + super.stop(bundleContext); + } + + public static Plugin getDefault() { + return Activator.plugin; + } +}
diff --git a/org.eclipse.modisco.facet.util.jface.ui/src/org/eclipse/modisco/facet/util/jface/ui/internal/imageprovider/ImageProvider.java b/org.eclipse.modisco.facet.util.jface.ui/src/org/eclipse/modisco/facet/util/jface/ui/internal/imageprovider/ImageProvider.java new file mode 100644 index 0000000..c8c9ae3 --- /dev/null +++ b/org.eclipse.modisco.facet.util.jface.ui/src/org/eclipse/modisco/facet/util/jface/ui/internal/imageprovider/ImageProvider.java
@@ -0,0 +1,47 @@ +/******************************************************************************* + * Copyright (c) 2013 Soft-Maint. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Thomas Cicognani (Soft-Maint) - Bug 424416 - Plug-in for JFace Utilities + ******************************************************************************/ + +package org.eclipse.modisco.facet.util.jface.ui.internal.imageprovider; + +import org.eclipse.core.runtime.Plugin; +import org.eclipse.jface.resource.ImageDescriptor; +import org.eclipse.jface.viewers.DecorationOverlayIcon; +import org.eclipse.modisco.facet.util.jface.ui.imageprovider.IImageProvider; +import org.eclipse.modisco.facet.util.swt.imageprovider.IImageProviderFactory; +import org.eclipse.swt.graphics.Image; + +@Deprecated +public final class ImageProvider implements IImageProvider { + + private final org.eclipse.modisco.facet.util.swt.imageprovider.IImageProvider delegate; + + ImageProvider(final Plugin plugin) { + this.delegate = IImageProviderFactory.DEFAULT + .createIImageProvider(plugin); + } + + public Image getImage(final DecorationOverlayIcon imgDescriptor) { + return this.delegate.getImage(imgDescriptor); + } + + public Image getImage(final String path) { + return this.delegate.getImage(path); + } + + public ImageDescriptor createImageDescriptor(final String resourcePath) { + return this.delegate.createImageDescriptor(resourcePath); + } + + public Image getImage(final ImageDescriptor imgDescriptor) { + return this.delegate.getImage(imgDescriptor); + } +}
diff --git a/org.eclipse.modisco.facet.util.jface.ui/src/org/eclipse/modisco/facet/util/jface/ui/internal/imageprovider/ImageProviderFactory.java b/org.eclipse.modisco.facet.util.jface.ui/src/org/eclipse/modisco/facet/util/jface/ui/internal/imageprovider/ImageProviderFactory.java new file mode 100644 index 0000000..1608793 --- /dev/null +++ b/org.eclipse.modisco.facet.util.jface.ui/src/org/eclipse/modisco/facet/util/jface/ui/internal/imageprovider/ImageProviderFactory.java
@@ -0,0 +1,35 @@ +/******************************************************************************* + * Copyright (c) 2013 Soft-Maint. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Thomas Cicognani (Soft-Maint) - Bug 424416 - Plug-in for JFace Utilities + ******************************************************************************/ +package org.eclipse.modisco.facet.util.jface.ui.internal.imageprovider; + +import java.util.HashMap; +import java.util.Map; + +import org.eclipse.core.runtime.Plugin; +import org.eclipse.modisco.facet.util.jface.ui.imageprovider.IImageProvider; +import org.eclipse.modisco.facet.util.jface.ui.imageprovider.IImageProviderFactory; + +@Deprecated +public class ImageProviderFactory implements IImageProviderFactory { + + private final Map<Plugin, IImageProvider> map = new HashMap<Plugin, IImageProvider>(); + + public IImageProvider createIImageProvider(final Plugin plugin) { + IImageProvider result = this.map.get(plugin); + if (result == null) { + result = new ImageProvider(plugin); + this.map.put(plugin, result); + } + return result; + } + +}
diff --git a/org.eclipse.modisco.facet.util.pde.core/META-INF/MANIFEST.MF b/org.eclipse.modisco.facet.util.pde.core/META-INF/MANIFEST.MF index a32e86d..fefc454 100644 --- a/org.eclipse.modisco.facet.util.pde.core/META-INF/MANIFEST.MF +++ b/org.eclipse.modisco.facet.util.pde.core/META-INF/MANIFEST.MF
@@ -3,7 +3,7 @@ Bundle-Name: EMF Facet PDE Core Utils Bundle-SymbolicName: org.eclipse.emf.facet.util.pde.core Bundle-Version: 1.3.0.qualifier -Bundle-Activator: org.eclipse.emf.facet.util.pde.core.internal.Activator +Bundle-Activator: org.eclipse.modisco.facet.util.pde.core.internal.Activator Bundle-Vendor: Eclipse Modeling Project Require-Bundle: org.eclipse.core.runtime;bundle-version="3.6.0", org.eclipse.pde.core;bundle-version="3.6.0", @@ -13,6 +13,6 @@ com.ibm.icu;bundle-version="4.2.1" Bundle-RequiredExecutionEnvironment: JavaSE-1.8 Bundle-ActivationPolicy: lazy -Export-Package: org.eclipse.emf.facet.util.pde.core.internal.exported, - org.eclipse.emf.facet.util.pde.core.internal.exported.exception +Export-Package: org.eclipse.modisco.facet.util.pde.core.internal.exported, + org.eclipse.modisco.facet.util.pde.core.internal.exported.exception Automatic-Module-Name: org.eclipse.emf.facet.util.pde.core
diff --git a/org.eclipse.modisco.facet.util.pde.core/src/org/eclipse/emf/facet/util/pde/core/internal/Activator.java b/org.eclipse.modisco.facet.util.pde.core/src/org/eclipse/emf/facet/util/pde/core/internal/Activator.java deleted file mode 100644 index fe427a0..0000000 --- a/org.eclipse.modisco.facet.util.pde.core/src/org/eclipse/emf/facet/util/pde/core/internal/Activator.java +++ /dev/null
@@ -1,50 +0,0 @@ -/** - * Copyright (c) 2013 Mia-Software - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Gregoire Dupe (Mia-Software) - Bug 417789 - org.eclipse.emf.facet.util.core should not so much dependencies - */ - package org.eclipse.emf.facet.util.pde.core.internal; - -import org.eclipse.core.runtime.Plugin; -import org.osgi.framework.BundleContext; - -@SuppressWarnings("PMD.UseSingleton") -// @SuppressWarnings("PMD.UseSingleton") We cannot conforms to this rule because -// this class is an Eclipse plug-in activator which will be instantiated by the -// Eclipse framework. -public class Activator extends Plugin { - - private static Activator plugin; - - @Override - @SuppressWarnings("PMD.SignatureDeclareThrowsException") - // @SuppressWarnings("PMD.SignatureDeclareThrowsException") We have to use - // this signature because this is an override of an Eclipse framework's - // method. - public void start(final BundleContext bundleContext) throws Exception { - super.start(bundleContext); - Activator.plugin = this; - } - - @Override - @SuppressWarnings("PMD.SignatureDeclareThrowsException") - // @SuppressWarnings("PMD.SignatureDeclareThrowsException") We have to use - // this signature because this is an override of an Eclipse framework's - // method. - public void stop(final BundleContext bundleContext) throws Exception { - // NOPMD: PMD say "Assigning an Object to null is a code smell." - // No choice to right it in another way : this is an Eclipse pattern. - Activator.plugin = null; // NOPMD - super.stop(bundleContext); - } - - public static Plugin getDefault() { - return Activator.plugin; - } - -}
diff --git a/org.eclipse.modisco.facet.util.pde.core/src/org/eclipse/emf/facet/util/pde/core/internal/BuildPropertiesUtils.java b/org.eclipse.modisco.facet.util.pde.core/src/org/eclipse/emf/facet/util/pde/core/internal/BuildPropertiesUtils.java deleted file mode 100644 index 820c738..0000000 --- a/org.eclipse.modisco.facet.util.pde.core/src/org/eclipse/emf/facet/util/pde/core/internal/BuildPropertiesUtils.java +++ /dev/null
@@ -1,146 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010-2013 Mia-Software. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Nicolas Bros (Mia-Software) - initial API and implementation - * Nicolas Bros (Mia-Software) - Bug 339991 - don't use internal APIs in org.eclipse.emf.facet.util.core.internal.BuildPropertiesUtils - * Laurent Pichierri (Soft-Maint) - Bug 371204 - Compatibility with Helios - * Gregoire Dupe (Mia-Software) - Bug 371204 - Compatibility with Helios - * Gregoire Dupe (Mia-Software) - Bug 417789 - org.eclipse.emf.facet.util.core should not so much dependencies - *******************************************************************************/ -package org.eclipse.emf.facet.util.pde.core.internal; - -import java.io.ByteArrayInputStream; -import java.lang.reflect.Method; - -import org.eclipse.core.resources.IFile; -import org.eclipse.core.resources.IProject; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IPath; -import org.eclipse.core.runtime.NullProgressMonitor; -import org.eclipse.core.runtime.Path; -import org.eclipse.emf.facet.util.core.Logger; -import org.eclipse.emf.facet.util.pde.core.internal.exception.PdeCoreUtilsRuntimeException; -import org.eclipse.pde.core.IEditableModel; -import org.eclipse.pde.core.build.IBuild; -import org.eclipse.pde.core.build.IBuildEntry; -import org.eclipse.pde.core.build.IBuildModel; -import org.eclipse.pde.core.plugin.IPluginModelBase; -import org.eclipse.pde.core.plugin.PluginRegistry; - -public final class BuildPropertiesUtils { - - // This class has been copied from org.eclipse.emf.facet.infra.common.core.internal.utils.BuildPropertiesUtils - - private BuildPropertiesUtils() { - // utilities class - } - - /** - * Get the build model of an Eclipse plug-in - * - * @param model - * a plug-in's PDE model - * @return a build model or <code>null</code> if the build.properties file - * does not exist - * @throws CoreException - */ - public static IBuildModel getBuildModel(final IPluginModelBase model) throws CoreException { - final IProject project = model.getUnderlyingResource().getProject(); - final IPluginModelBase pluginModelBase = PluginRegistry.findModel(project); - //Here we use a reflexive call to be able to build against an Helios platform. - //This method will build with Helios, but will fail at runtime. - //We do not have a better solution. Otherwise we would have to use an internal API. - //We prefer some loose of functionality with Helios that to use internal API. - IBuildModel buildModel = null; - try { - final Class<? extends IPluginModelBase> class1 = pluginModelBase.getClass(); - final Method method = class1.getMethod("getBuildModel"); //$NON-NLS-1$ - if (method != null) { - buildModel = (IBuildModel) method.invoke(pluginModelBase); - } - } catch (Exception e) { - Logger.logError(e, Activator.getDefault()); - } - return buildModel; - } - - /** - * @param project - * the project for which to get a build model top level object - * @return a build model top level object or <code>null</code> if the - * build.properties file does not exist - * @throws CoreException - */ - public static IBuild getBuild(final IProject project) throws CoreException { - IBuild result = null; - final IPluginModelBase pluginModel = PluginRegistry.findModel(project); - if (pluginModel != null) { - final IBuildModel buildModel = getBuildModel(pluginModel); - if (buildModel != null) { - result = buildModel.getBuild(); - } - } - return result; - } - - /** - * @param elementFile - * the file whose presence in the build.properties is being - * tested - * @return whether the file is in the build.properties (<code>false</code> - * if the build.properties file does not exist) - * @throws CoreException - */ - public static boolean isInBuild(final IFile elementFile) throws CoreException { - final IProject project = elementFile.getProject(); - final IPath filePath = elementFile.getFullPath().removeFirstSegments(1); - final IBuild build = getBuild(project); - boolean result = false; - if (build != null) { - final IBuildEntry entry = build.getEntry(IBuildEntry.BIN_INCLUDES); - if (entry != null) { - final String[] tokens = entry.getTokens(); - for (String token : tokens) { - final IPath path = new Path(token); - // if "abc/" is included, then "abc/def/" is too - if (path.isPrefixOf(filePath)) { - result = true; - } - } - } - } - return result; - } - - public static void addToBuild(final IFile elementFile) throws CoreException { - final IProject project = elementFile.getProject(); - if (isInBuild(elementFile)) { - return; - } - final IPath filePath = elementFile.getFullPath().removeFirstSegments(1); - final IPluginModelBase pluginModel = PluginRegistry.findModel(project); - final IFile buildProperties = elementFile.getProject().getFile("build.properties"); //$NON-NLS-1$ - if (!buildProperties.exists()) { - buildProperties.create(new ByteArrayInputStream(new byte[0]), true, - new NullProgressMonitor()); - } - final IBuildModel buildModel = getBuildModel(pluginModel); - if (buildModel == null) { - throw new PdeCoreUtilsRuntimeException("Couldn't get build model"); //$NON-NLS-1$ - } - final IBuild build = buildModel.getBuild(); - IBuildEntry entry = build.getEntry(IBuildEntry.BIN_INCLUDES); - // if entry "bin.includes" does not exist, then create it - if (entry == null) { - entry = buildModel.getFactory().createEntry(IBuildEntry.BIN_INCLUDES); - build.add(entry); - } - entry.addToken(filePath.toPortableString()); - ((IEditableModel) buildModel).save(); - } -}
diff --git a/org.eclipse.modisco.facet.util.pde.core/src/org/eclipse/emf/facet/util/pde/core/internal/PluginUtils.java b/org.eclipse.modisco.facet.util.pde.core/src/org/eclipse/emf/facet/util/pde/core/internal/PluginUtils.java deleted file mode 100644 index 1b0d3a7..0000000 --- a/org.eclipse.modisco.facet.util.pde.core/src/org/eclipse/emf/facet/util/pde/core/internal/PluginUtils.java +++ /dev/null
@@ -1,605 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010-2013 Mia-Software. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Nicolas Bros (Mia-Software) - initial API and implementation - * Nicolas Guyomar (Mia-Software) - Bug 340339 - Need some Utils class for Folder/File/Project management - * Gregoire Dupe (Mia-Software) - Bug 340339 - Need some Utils class for Folder/File/Project management - * Nicolas Guyomar (Mia-Software) - Bug 340681 - Facet column implementation - * Nicolas Bros (Mia-Software) - Bug 380391 - PluginUtils#importPlugin should use the Bundle API - * Gregoire Dupe (Mia-Software) - Bug 408344 - [Releng] Deep folders cause build break - *******************************************************************************/ -package org.eclipse.emf.facet.util.pde.core.internal; - -import java.io.ByteArrayInputStream; -import java.io.FileNotFoundException; -import java.io.IOException; -import java.io.InputStream; -import java.io.StringWriter; -import java.net.URISyntaxException; -import java.net.URL; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Enumeration; -import java.util.List; - -import javax.xml.parsers.DocumentBuilder; -import javax.xml.parsers.DocumentBuilderFactory; -import javax.xml.parsers.ParserConfigurationException; -import javax.xml.transform.OutputKeys; -import javax.xml.transform.Transformer; -import javax.xml.transform.TransformerException; -import javax.xml.transform.TransformerFactory; -import javax.xml.transform.dom.DOMSource; -import javax.xml.transform.stream.StreamResult; - -import org.eclipse.core.resources.IContainer; -import org.eclipse.core.resources.IFile; -import org.eclipse.core.resources.IFolder; -import org.eclipse.core.resources.IProject; -import org.eclipse.core.resources.IProjectDescription; -import org.eclipse.core.resources.IResource; -import org.eclipse.core.resources.IWorkspace; -import org.eclipse.core.resources.IWorkspaceRoot; -import org.eclipse.core.resources.IWorkspaceRunnable; -import org.eclipse.core.resources.IncrementalProjectBuilder; -import org.eclipse.core.resources.ResourcesPlugin; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IPath; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.MultiStatus; -import org.eclipse.core.runtime.NullProgressMonitor; -import org.eclipse.core.runtime.Path; -import org.eclipse.core.runtime.Status; -import org.eclipse.emf.facet.util.core.Logger; -import org.eclipse.emf.facet.util.core.internal.exported.FileUtils; -import org.eclipse.emf.facet.util.core.internal.exported.FolderUtils; -import org.eclipse.emf.facet.util.core.internal.exported.IFilter; -import org.eclipse.jdt.core.IClasspathEntry; -import org.eclipse.jdt.core.IJavaProject; -import org.eclipse.jdt.core.JavaConventions; -import org.eclipse.jdt.core.JavaCore; -import org.eclipse.jdt.core.JavaModelException; -import org.eclipse.osgi.util.NLS; -import org.eclipse.pde.core.plugin.IExtensions; -import org.eclipse.pde.core.plugin.IPluginAttribute; -import org.eclipse.pde.core.plugin.IPluginElement; -import org.eclipse.pde.core.plugin.IPluginExtension; -import org.eclipse.pde.core.plugin.IPluginModelBase; -import org.eclipse.pde.core.plugin.IPluginObject; -import org.eclipse.pde.core.plugin.PluginRegistry; -import org.osgi.framework.Bundle; -import org.w3c.dom.Attr; -import org.w3c.dom.Document; -import org.w3c.dom.Element; -import org.w3c.dom.Node; -import org.w3c.dom.Text; -import org.xml.sax.SAXException; - -import com.ibm.icu.lang.UCharacter; - -public final class PluginUtils { - - // This class has been copied from - // org.eclipse.emf.facet.infra.common.core.internal.utils.PluginUtils - - private PluginUtils() { - // utilities class - } - - /** - * Returns whether the given file is registered in the plugin.xml of the - * given project, using the given extension point. - * - * @param extensionPoint - * the extension point that is used to register elements of this - * kind (elements must be declared with a "file" attribute) - */ - public static boolean isRegistered(final IFile elementFile, final String extensionPoint) { - final IProject project = elementFile.getProject(); - final IPluginModelBase pluginModel = PluginRegistry.findModel(project); - boolean result = false; - if (pluginModel != null) { - final IExtensions extensions2 = pluginModel.getExtensions(); - final IPluginExtension[] extensions = extensions2.getExtensions(); - for (IPluginExtension pluginExtension : extensions) { - if (extensionPoint.equals(pluginExtension.getPoint())) { - final IPluginObject[] children = pluginExtension.getChildren(); - for (IPluginObject child : children) { - if (child instanceof IPluginElement) { - final IPluginElement pluginElement = (IPluginElement) child; - final IPluginAttribute[] attributes = pluginElement.getAttributes(); - for (IPluginAttribute pluginAttribute : attributes) { - if ("file".equalsIgnoreCase(pluginAttribute.getName())) { //$NON-NLS-1$ - final String strFile = pluginAttribute.getValue(); - if (strFile != null && strFile.length() > 0) { - final IFile file = project.getFile(strFile); - if (file.exists() && elementFile.equals(file)) { - result = true; - } - } - } - } - } - } - } - } - } - return result; - } - - /** - * Registers the given file in the plugin.xml of the given project, using - * the given extension point. - * - * @param project - * the project in which the element should be registered - * @param extensionToCheck - * the file extension of the element that should be registered - * @param extensionPoint - * the extension point that is used to register elements of this - * kind (elements must be declared with a "file" attribute) - */ - /** - * Registers the given file in the plugin.xml of the given project, using - * the given extension point. - * - * @param file - * the file to register - * @param extensionPointId - * the extension point that is used to register the file - * @param elementName - * the name of the XML element in which an attribute named "file" - * will be set to the path of the file - * @throws ParserConfigurationException - * @throws IOException - * @throws SAXException - * @throws TransformerException - * @throws CoreException - */ - public static void register(final IFile file, final String extensionPointId, - final String elementName) { - if (isRegistered(file, extensionPointId)) { - return; - } - - final IPath filePath = file.getFullPath().removeFirstSegments(1); - final IProject project = file.getProject(); - - final IFile pluginXML = project.getFile("plugin.xml"); //$NON-NLS-1$ - if (pluginXML.exists()) { - final DocumentBuilderFactory docFactory = DocumentBuilderFactory.newInstance(); - DocumentBuilder docBuilder; - - try { - docBuilder = docFactory.newDocumentBuilder(); - final String pluginXmlLoc = pluginXML.getLocation().toOSString(); - final Document doc = docBuilder.parse(pluginXmlLoc); - final Element root = doc.getDocumentElement(); - - final Text whitespace = doc.createTextNode(" "); //$NON-NLS-1$ - root.appendChild(whitespace); - - final Node extensionNode = doc.createElement("extension"); //$NON-NLS-1$ - final Attr pointAttr = doc.createAttribute("point"); //$NON-NLS-1$ - pointAttr.setValue(extensionPointId); - extensionNode.getAttributes().setNamedItem(pointAttr); - root.appendChild(extensionNode); - - final Node elementNode = doc.createElement(elementName); - final Attr fileAttr = doc.createAttribute("file"); //$NON-NLS-1$ - fileAttr.setValue(filePath.toString()); - elementNode.getAttributes().setNamedItem(fileAttr); - extensionNode.appendChild(elementNode); - - final TransformerFactory trFactory = TransformerFactory.newInstance(); - final int indent = 3; - trFactory.setAttribute("indent-number", Integer.valueOf(indent)); //$NON-NLS-1$ - final Transformer transformer = trFactory.newTransformer(); - transformer.setOutputProperty(OutputKeys.ENCODING, "UTF-8"); //$NON-NLS-1$ - transformer.setOutputProperty(OutputKeys.INDENT, "yes"); //$NON-NLS-1$ - final StreamResult result = new StreamResult(new StringWriter()); - final DOMSource source = new DOMSource(doc); - transformer.transform(source, result); - final String xmlString = result.getWriter().toString(); - - final byte[] byteArray = xmlString.getBytes("UTF-8"); //$NON-NLS-1$ - pluginXML.setContents(new ByteArrayInputStream(byteArray), true, true, - new NullProgressMonitor()); - - } catch (Exception e) { - Logger.logError(e, Activator.getDefault()); - } - } else { - try { - // create plugin.xml - final String template = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" //$NON-NLS-1$ - + "<?eclipse version=\"3.4\"?>\n" + "<plugin>\n" //$NON-NLS-1$ //$NON-NLS-2$ - + " <extension point=\"{0}\">\n" + " <{1} file=\"{2}\"/>\n" //$NON-NLS-1$ //$NON-NLS-2$ - + " </extension>\n" //$NON-NLS-1$ - + "</plugin>\n"; //$NON-NLS-1$ - - final String content = NLS.bind(template, new Object[] { extensionPointId, elementName, - filePath.toString() }); - byte[] byteArray; - byteArray = content.getBytes("UTF-8"); //$NON-NLS-1$ - pluginXML.create(new ByteArrayInputStream(byteArray), true, - new NullProgressMonitor()); - try { - BuildPropertiesUtils.addToBuild(pluginXML); - } catch (Exception e) { - Logger.logError(e, "Error adding file " + pluginXML.getFullPath() //$NON-NLS-1$ - + " to the build.properties", null); //$NON-NLS-1$ - } - } catch (Exception e) { - Logger.logError(e, Activator.getDefault()); - } - } - } - - private static final String JAVA_VERSION = "JavaSE-1.8"; //$NON-NLS-1$ - private static final String ACTIVATOR_NAME = "Activator"; //$NON-NLS-1$ - private static final String MANIFEST_MF_TPL = "resources/MANIFEST.MF.template"; //$NON-NLS-1$ - private static final String ACTIVATOR_TPL = "resources/Activator.java.template"; //$NON-NLS-1$ - private static final String PDE_CLASSPATH_ID = "org.eclipse.pde.core.requiredPlugins"; //$NON-NLS-1$ - private static final String PLUGIN_NATURE = "org.eclipse.pde.PluginNature"; //$NON-NLS-1$ - - private static void addPdeClassPath(final IProject project) - throws JavaModelException { - final IJavaProject javaProject = JavaCore.create(project); - final IClasspathEntry[] oldClassPath = javaProject.getRawClasspath(); - for (IClasspathEntry classpathEntry : oldClassPath) { - if (classpathEntry.getPath().equals(new Path(PluginUtils.PDE_CLASSPATH_ID))) { - return; - } - } - final IClasspathEntry[] newClassPath = new IClasspathEntry[oldClassPath.length + 1]; - System.arraycopy(oldClassPath, 0, newClassPath, 0, oldClassPath.length); - newClassPath[oldClassPath.length] = JavaCore - .newContainerEntry(new Path(PluginUtils.PDE_CLASSPATH_ID)); - javaProject.setRawClasspath(newClassPath, new NullProgressMonitor()); - } - - /** - * @author Gregoire Dupe (Mia-Software) - Removing "Require-Bundle" - * statement - * @throws IOException - */ - private static void createManifest(final IProject project) - throws CoreException, IOException { - final IFolder folder = project.getFolder("META-INF"); //$NON-NLS-1$ - if (!folder.exists()) { - folder.create(true, true, new NullProgressMonitor()); - } - final IFile manifestFile = folder.getFile("MANIFEST.MF"); //$NON-NLS-1$ - if (!manifestFile.exists()) { - String template = FileUtils.getFileContents(Activator.getDefault() - .getBundle(), PluginUtils.MANIFEST_MF_TPL); - template = template.replace("{projectName}", project.getName()); //$NON-NLS-1$ - final String packageName = PluginUtils - .stringToValidPackageName(project.getName()); - template = template.replace("{packageName}", packageName); //$NON-NLS-1$ - final String activator = PluginUtils - .bundleActivatorQualifiedName(packageName); - template = template.replace("{activator}", activator); //$NON-NLS-1$ - template = template.replace("{javaVersion}", //$NON-NLS-1$ - PluginUtils.JAVA_VERSION); - final InputStream source = new ByteArrayInputStream( - template.getBytes()); - manifestFile.create(source, true, new NullProgressMonitor()); - } - } - - private static String bundleActivatorQualifiedName(final String packageName) { - return packageName + '.' + PluginUtils.ACTIVATOR_NAME; - } - - private static void createActivator(final IProject project) - throws CoreException, IOException { - final String packageName = PluginUtils.stringToValidPackageName(project - .getName()); - final String qualifiedName = PluginUtils - .bundleActivatorQualifiedName(packageName); - final String path = qualifiedName.replaceAll("\\.", "/"); //$NON-NLS-1$ //$NON-NLS-2$ - final IFile activatorFile = project - .getFile(new Path("src").append(path).addFileExtension("java")); //$NON-NLS-1$ //$NON-NLS-2$ - FolderUtils.createFolder((IFolder) activatorFile.getParent()); - if (!activatorFile.exists()) { - final String template = FileUtils.getFileContents(Activator - .getDefault().getBundle(), PluginUtils.ACTIVATOR_TPL); - final String activatorContents = template.replace("{0}", packageName); //$NON-NLS-1$ - final InputStream source = new ByteArrayInputStream( - activatorContents.getBytes()); - activatorFile.create(source, true, new NullProgressMonitor()); - } - } - - /** Transform the given name into a valid package and bundle name */ - private static String stringToValidPackageName(final String name) { - final StringBuilder builder = new StringBuilder(); - char prev = ' '; - for (int i = 0; i < name.length(); i++) { - final char character = name.charAt(i); - if (character >= 'a' && character <= 'z' || character >= 'A' - && character <= 'Z' || character == '_') { - builder.append(character); - prev = character; - } else if (character >= '0' && character <= '9') { - if (builder.length() == 0 || prev == '.') { - builder.append("_"); //$NON-NLS-1$ - } - builder.append(character); - prev = character; - } else if (character == '.') { - if (prev == '.') { - continue; - } - if (builder.length() == 0 || prev >= '0' && prev <= '9') { - builder.append("_"); //$NON-NLS-1$ - } - builder.append(character); - prev = character; - } else { - builder.append("_"); //$NON-NLS-1$ - } - } - - String result = builder.toString(); - // first letter to lowercase - if (result.length() > 0 && UCharacter.isUpperCase(result.charAt(0))) { - result = UCharacter.toLowerCase(result.charAt(0)) - + result.substring(1); - } - - final IStatus status = JavaConventions.validatePackageName(result, - JavaCore.VERSION_1_5, JavaCore.VERSION_1_5); - if (!status.isOK()) { - Logger.logWarning( - "Couldn't make valid package name from project name: " //$NON-NLS-1$ - + status.getMessage(), Activator.getDefault()); - result = name; - } - return result; - } - - private static void addPdeNature(final IProject project) - throws CoreException { - final String pluginNature = PluginUtils.PLUGIN_NATURE; - final IProjectDescription description = project.getDescription(); - final String[] natures = description.getNatureIds(); - if (!Arrays.asList(natures).contains(pluginNature)) { - String[] newNatures = new String[natures.length + 1]; - System.arraycopy(natures, 0, newNatures, 0, natures.length); - newNatures[natures.length] = pluginNature; - description.setNatureIds(newNatures); - project.setDescription(description, new NullProgressMonitor()); - } - } - - /** - * This method transforms a Java project into a plug-in project by creating - * a MANIFEST.MF and an activator and by adding a the PDE nature and the PDE - * classpath. - * - * @param project - * The project to transform in an plug-in project - * @throws CoreException - * @throws IOException - */ - public static void configureAsPluginProject(final IProject project) - throws CoreException, IOException { - PluginUtils.addPdeNature(project); - // PDE builders are automatically added when the PDE nature is added - PluginUtils.addPdeClassPath(project); - PluginUtils.createManifest(project); - PluginUtils.createActivator(project); - } - - /** - * This method returns true if the project is a plug-in project. - * - * @param project - * @return True if the project is a plug-in project. - * @throws CoreException - */ - public static boolean isPluginProject(final IProject project) - throws CoreException { - boolean result = false; - if (project.isAccessible()) { - result = project.getNature(PluginUtils.PLUGIN_NATURE) != null; - } - return result; - } - - /** - * This method returns true if the path refers a file or a folder contained - * in a plug-in project. - * - * @param path - * @return True if the path refers a file or a folder contained in a plug-in - * project. - * @throws CoreException - */ - public static boolean isInPluginProject(final IPath path) - throws CoreException { - IProject project; - if (path.segmentCount() == 1) { - project = ResourcesPlugin.getWorkspace().getRoot() - .getProject(path.segment(0)); - } else { - final IFolder folder = ResourcesPlugin.getWorkspace().getRoot() - .getFolder(path); - project = folder.getProject(); - } - return isPluginProject(project); - } - - /** - * This method imports a plug-in in the workspace. - * - * @param bundle - * the bundle to import into a new project - * @return the created project - * @throws CoreException - * in case of error - */ - public static IProject importPlugin(final Bundle bundle) throws CoreException { - return PluginUtils.importPlugin(bundle, new IFilter<String>() { - public boolean filter(final String fileName) { - return true; - } - }); - } - - /** - * This method imports a plug-in in the workspace. - * - * @param bundle - * the bundle to import into a new project - * @param filter - * can be used to filter out files or folders from the import - * @return the created project - * @throws CoreException - * in case of error - */ - public static IProject importPlugin(final Bundle bundle, final IFilter<String> filter) throws CoreException { - final IProject[] project = new IProject[1]; - final IWorkspaceRunnable workspaceRunnable = new IWorkspaceRunnable() { - public void run(final IProgressMonitor monitor) throws CoreException { - project[0] = internalImportPlugin(bundle, filter); - } - }; - ResourcesPlugin.getWorkspace().run(workspaceRunnable, new NullProgressMonitor()); - return project[0]; - } - - /** - * This method imports a plug-in in the workspace. - * - * @param bundle - * the bundle to import into a new project - * @param filter - * can be used to filter out files or folders from the import - * @return the created project - * @throws CoreException - * in case of error - */ - protected static IProject internalImportPlugin(final Bundle bundle, final IFilter<String> filter) throws CoreException { - final IProject project = createProjectWithUniqueName(bundle.getSymbolicName()); - final List<IStatus> errors = new ArrayList<IStatus>(); - final List<URL> urls = getURLsToCopy(bundle, project, - "/", filter, errors); //$NON-NLS-1$ - for (URL url : urls) { - copyUrlToFile(project, errors, url); - } - handleErrors(errors); - project.refreshLocal(IResource.DEPTH_INFINITE, new NullProgressMonitor()); - project.build(IncrementalProjectBuilder.CLEAN_BUILD, new NullProgressMonitor()); - project.build(IncrementalProjectBuilder.FULL_BUILD, new NullProgressMonitor()); - return project; - } - - private static void copyUrlToFile(final IProject project, - final List<IStatus> errors, final URL url) throws CoreException { - try { - final InputStream inputStream = url.openStream(); - final String strSubpath = url.toString().replaceAll( - "bundleentry://[^/]*/", ""); //$NON-NLS-1$ //$NON-NLS-2$ - final IFile file = project.getFile(new Path(strSubpath)); - if (file.exists()) { - file.delete(true, new NullProgressMonitor()); - } - final IContainer parent = file.getParent(); - if ((!parent.exists()) && parent instanceof IFolder) { - createDir((IFolder) parent); - } - file.create(inputStream, true, new NullProgressMonitor()); - inputStream.close(); - } catch (FileNotFoundException e) { - /* - * gdupe> We ignore files removed during the execution of - * internalImportPlugin. - */ - String message; - try { - message = String.format("Ignoring the missing file %s.", //$NON-NLS-1$ - url.toURI()); - } catch (URISyntaxException e1) { - message = String.format("Ignoring the missing file."); //$NON-NLS-1$ - } - Logger.logError(message, Activator.getDefault()); - } catch (IOException e) { - final Bundle localBundle = Activator.getDefault().getBundle(); - final String symbolicName = localBundle.getSymbolicName(); - final Status status = new Status(IStatus.ERROR, symbolicName, - e.getMessage(), e); - errors.add(status); - } - } - - private static void createDir(final IFolder folder) throws CoreException { - final IContainer parent = folder.getParent(); - if ((!parent.exists()) && parent instanceof IFolder) { - createDir((IFolder) parent); - } - folder.create(true, true, new NullProgressMonitor()); - } - protected static void handleErrors(final List<IStatus> errors) throws CoreException { - if (!errors.isEmpty()) { - final IStatus[] statusArray = errors.toArray(new IStatus[errors.size()]); - final IStatus status = new MultiStatus(Activator.getDefault().getBundle().getSymbolicName(), - IStatus.ERROR, statusArray, "Errors importing project", new Exception()); //$NON-NLS-1$ - throw new CoreException(status); - } - } - - private static List<URL> getURLsToCopy(final Bundle bundle, - final IProject project, final String path, - final IFilter<String> filter, final List<IStatus> errors) { - final List<URL> result = new ArrayList<URL>(); - final Enumeration<?> entryPaths = bundle.getEntryPaths(path); - while (entryPaths != null && entryPaths.hasMoreElements()) { - final Object nextElement = entryPaths.nextElement(); - if (nextElement instanceof String) { - final String strSubpath = (String) nextElement; - if (filter.filter(strSubpath)) { - // directory - if (strSubpath.endsWith("/")) { //$NON-NLS-1$ - final List<URL> fromSubFolder = getURLsToCopy(bundle, - project, strSubpath, filter, errors); - result.addAll(fromSubFolder); - } else { - final URL url = bundle.getEntry(strSubpath); - if (url != null) { - result.add(url); - } - } - } - } - } - return result; - } - - protected static IProject createProjectWithUniqueName(final String baseName) throws CoreException { - final IWorkspace workspace = ResourcesPlugin.getWorkspace(); - final IWorkspaceRoot root = workspace.getRoot(); - IProject project = root.getProject(baseName); - if (project.exists()) { - int version = 1; - final int maxIter = 100; - while (project.exists() && version < maxIter) { - final String uniqueName = baseName + " (" + version + ')'; //$NON-NLS-1$ - project = root.getProject(uniqueName); - version++; - } - } - project.create(new NullProgressMonitor()); - project.open(new NullProgressMonitor()); - return project; - } -}
diff --git a/org.eclipse.modisco.facet.util.pde.core/src/org/eclipse/emf/facet/util/pde/core/internal/exception/PdeCoreUtilsRuntimeException.java b/org.eclipse.modisco.facet.util.pde.core/src/org/eclipse/emf/facet/util/pde/core/internal/exception/PdeCoreUtilsRuntimeException.java deleted file mode 100644 index 984c4f1..0000000 --- a/org.eclipse.modisco.facet.util.pde.core/src/org/eclipse/emf/facet/util/pde/core/internal/exception/PdeCoreUtilsRuntimeException.java +++ /dev/null
@@ -1,33 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2013 Mia-Software. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Gregoire Dupe (Mia-Software) - Bug 408344 - [Releng] Deep folders cause build break - *******************************************************************************/ -package org.eclipse.emf.facet.util.pde.core.internal.exception; - -public class PdeCoreUtilsRuntimeException extends RuntimeException { - - private static final long serialVersionUID = -7462304304846835284L; - - public PdeCoreUtilsRuntimeException() { - super(); - } - - public PdeCoreUtilsRuntimeException(final String message) { - super(message); - } - - public PdeCoreUtilsRuntimeException(final Throwable cause) { - super(cause); - } - - public PdeCoreUtilsRuntimeException(final String message, final Throwable cause) { - super(message, cause); - } - -}
diff --git a/org.eclipse.modisco.facet.util.pde.core/src/org/eclipse/emf/facet/util/pde/core/internal/exported/BuildPropertiesUtils.java b/org.eclipse.modisco.facet.util.pde.core/src/org/eclipse/emf/facet/util/pde/core/internal/exported/BuildPropertiesUtils.java deleted file mode 100644 index 246d88c..0000000 --- a/org.eclipse.modisco.facet.util.pde.core/src/org/eclipse/emf/facet/util/pde/core/internal/exported/BuildPropertiesUtils.java +++ /dev/null
@@ -1,37 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2012 Mia-Software. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Gregoire Dupe (Mia-Software) - Bug 387470 - [EFacet][Custom] Editors - *******************************************************************************/ -package org.eclipse.emf.facet.util.pde.core.internal.exported; - -import org.eclipse.core.resources.IFile; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.pde.core.build.IBuildModel; -import org.eclipse.pde.core.plugin.IPluginModelBase; - -/** - * @since 0.3 - */ -public final class BuildPropertiesUtils { - - private BuildPropertiesUtils() { - // Must not be used - } - - public static void addToBuild(final IFile file) throws CoreException { - org.eclipse.emf.facet.util.pde.core.internal.BuildPropertiesUtils - .addToBuild(file); - } - - public static IBuildModel getBuildModel(final IPluginModelBase model) - throws CoreException { - return org.eclipse.emf.facet.util.pde.core.internal.BuildPropertiesUtils - .getBuildModel(model); - } -}
diff --git a/org.eclipse.modisco.facet.util.pde.core/src/org/eclipse/emf/facet/util/pde/core/internal/exported/PluginUtils.java b/org.eclipse.modisco.facet.util.pde.core/src/org/eclipse/emf/facet/util/pde/core/internal/exported/PluginUtils.java deleted file mode 100644 index 5ac7457..0000000 --- a/org.eclipse.modisco.facet.util.pde.core/src/org/eclipse/emf/facet/util/pde/core/internal/exported/PluginUtils.java +++ /dev/null
@@ -1,73 +0,0 @@ -/** - * Copyright (c) 2011 Mia-Software. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Grégoire Dupé (Soft-Maint) - Bug 387470 - [EFacet][Custom] Editors - */ -package org.eclipse.emf.facet.util.pde.core.internal.exported; - -import java.io.IOException; - -import org.eclipse.core.resources.IFile; -import org.eclipse.core.resources.IProject; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IPath; -import org.eclipse.emf.facet.util.core.internal.exported.IFilter; -import org.osgi.framework.Bundle; - -/** - * @since 0.4 - */ -public final class PluginUtils { - - private PluginUtils() { - // Must not be used. - } - - public static boolean isInPluginProject(final IPath path) - throws CoreException { - return org.eclipse.emf.facet.util.pde.core.internal.PluginUtils - .isInPluginProject(path); - } - - public static void register(final IFile file, - final String extensionPointId, final String elementName) { - org.eclipse.emf.facet.util.pde.core.internal.PluginUtils.register(file, - extensionPointId, elementName); - } - - public static boolean isRegistered(final IFile iFile, - final String extensionPointId) { - return org.eclipse.emf.facet.util.pde.core.internal.PluginUtils - .isRegistered(iFile, extensionPointId); - } - - public static void configureAsPluginProject(final IProject project) - throws CoreException, IOException { - org.eclipse.emf.facet.util.pde.core.internal.PluginUtils - .configureAsPluginProject(project); - } - - public static boolean isPluginProject(final IProject project) - throws CoreException { - return org.eclipse.emf.facet.util.pde.core.internal.PluginUtils - .isPluginProject(project); - } - - public static IProject importPlugin(final Bundle bundle, - final IFilter<String> filter) throws CoreException { - return org.eclipse.emf.facet.util.pde.core.internal.PluginUtils - .importPlugin(bundle, filter); - } - - public static IProject importPlugin(final Bundle bundle) - throws CoreException { - return org.eclipse.emf.facet.util.pde.core.internal.PluginUtils - .importPlugin(bundle); - } -}
diff --git a/org.eclipse.modisco.facet.util.pde.core/src/org/eclipse/emf/facet/util/pde/core/internal/exported/TargetPlatformUtils.java b/org.eclipse.modisco.facet.util.pde.core/src/org/eclipse/emf/facet/util/pde/core/internal/exported/TargetPlatformUtils.java deleted file mode 100644 index 6166d60..0000000 --- a/org.eclipse.modisco.facet.util.pde.core/src/org/eclipse/emf/facet/util/pde/core/internal/exported/TargetPlatformUtils.java +++ /dev/null
@@ -1,594 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2011, 2015 Soft-Maint, and Mia-Software. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Fabien Treguer (Soft-Maint) - Bug 418565 - [Unit Test Failure] Missing dependencies during tests, target platform creation and load - * Grégoire Dupé (Mia-Software) - Bug 468648 - TargetPlatformUtils.loadTargetPlatform: wrong number of arguments - ******************************************************************************/ -package org.eclipse.emf.facet.util.pde.core.internal.exported; - -import java.io.File; -import java.io.FileOutputStream; -import java.io.IOException; -import java.io.InputStream; -import java.lang.reflect.Array; -import java.lang.reflect.Constructor; -import java.lang.reflect.Method; -import java.util.Arrays; -import java.util.Enumeration; -import java.util.Iterator; -import java.util.LinkedList; -import java.util.List; -import java.util.jar.JarEntry; -import java.util.jar.JarFile; -import java.util.jar.JarOutputStream; - -import org.eclipse.core.runtime.NullProgressMonitor; -import org.eclipse.core.runtime.Platform; -import org.eclipse.emf.facet.util.pde.core.internal.Activator; -import org.eclipse.emf.facet.util.pde.core.internal.exported.exception.PdeCoreUtilsException; -import org.eclipse.emf.facet.util.pde.core.internal.exported.exception.ReflexiveDiscouragedAccessException; -import org.osgi.framework.Bundle; -import org.osgi.framework.Version; - -public final class TargetPlatformUtils { - - private static final String BUNDLE_SEPARATOR = ","; //$NON-NLS-1$ - private static final String JAR_EXT = ".jar"; //$NON-NLS-1$ - private static final String JAR_DIRECTORY = "jarFiles"; //$NON-NLS-1$ - private static final int BUFFER_SIZE = 4096; - private static final String BUNDLE_PREFIX = "reference:file:"; //$NON-NLS-1$ - private static final String FRAMEWORK_PREFIX = "file:"; //$NON-NLS-1$ - private static final String OSGI_PROP = "osgi.bundles"; //$NON-NLS-1$ - private static final String OSGI_PROP_FRK = "osgi.framework"; //$NON-NLS-1$ - private static final String ARRAY_PREFIX = "[L"; //$NON-NLS-1$ - - private TargetPlatformUtils() { - //Must not be used. - } - - /** - * Creates and loads a target platform with all needed bundles. - * @throws PdeCoreUtilsException - * @throws IOException - */ - public static void loadTargetPlatform() throws PdeCoreUtilsException { - String copyDirectoryPath; - try { - /*ITargetPlatformService*/ - final Object targetPlServ = reflexiveCall( - true, - "org.eclipse.pde.internal.core.target.TargetPlatformService", //$NON-NLS-1$ - "getDefault", //$NON-NLS-1$ - new Object[]{}); - /*ITargetDefinition*/ - final Object targetDefinition = reflexiveCall( - false, - targetPlServ, - "newTarget", //$NON-NLS-1$ - new Object[]{}); - copyDirectoryPath = Activator.getDefault().getStateLocation() - + File.separator + JAR_DIRECTORY; - - final File copyDirectory = new File(copyDirectoryPath); - copyDirectory.mkdirs(); - - final List<String> dirPaths = parseBundlesList(); - - /*IBundleContainer*/ - final Object[] dirContainers = - copyJarsAndGetContainers(dirPaths, copyDirectory); - reflexiveCall( - false, - targetDefinition, - getContainerSetterName(), - new Object[]{dirContainers}); - reflexiveCall( - false, - targetDefinition, - "resolve", //$NON-NLS-1$ - new Object[]{new NullProgressMonitor()}); - reflexiveCall( - true, - getLoadTargetDefinitionJobQualifiedName(), - "load", //$NON-NLS-1$ - new Object[]{targetDefinition}); - reflexiveCall( - false, - targetPlServ, - "saveTargetDefinition", //$NON-NLS-1$ - new Object[]{targetDefinition}); - } catch (Exception e) { - throw new PdeCoreUtilsException(e); - } - new File(copyDirectoryPath).delete(); - } - - private static boolean isHigherVersion() { - final Version version = new Version(3, 7, 1); - final Bundle bundle = Platform.getBundle("org.eclipse.pde.core"); //$NON-NLS-1$ - final Version currentVersion = bundle.getVersion(); - return currentVersion.compareTo(version) > 0; - } - - private static String getLoadTargetDefinitionJobQualifiedName() { - String lTDefJobName; - if (isHigherVersion()) { - lTDefJobName = - "org.eclipse.pde.core.target.LoadTargetDefinitionJob"; //$NON-NLS-1$ - } else { - lTDefJobName = - "org.eclipse.pde.internal.core.target.provisional.LoadTargetDefinitionJob"; //$NON-NLS-1$ - } - return lTDefJobName; - } - - private static String getContainerSetterName() { - String setterName; - if (isHigherVersion()) { - setterName = - "setTargetLocations"; //$NON-NLS-1$ - } else { - setterName = - "setBundleContainers"; //$NON-NLS-1$ - } - return setterName; - } - - /** - * Parses osgi.bundles property value to load all required bundles directories. - * @return List<String> array - * @throws PdeCoreUtilsException - * @throws IOException - */ - private static List<String> parseBundlesList() - throws PdeCoreUtilsException, IOException { - final LinkedList<String> result = new LinkedList<String>(); - final String bundlesFromConfig = System.getProperty(OSGI_PROP); - final String frwkFromConfig = System.getProperty(OSGI_PROP_FRK); - if (bundlesFromConfig != null && !"".equals(bundlesFromConfig)) { //$NON-NLS-1$ - final String[] bundlesStr = - bundlesFromConfig.split(BUNDLE_SEPARATOR); - result.addAll(trimPaths(bundlesStr, BUNDLE_PREFIX)); - } - if (frwkFromConfig != null && !"".equals(frwkFromConfig)) { //$NON-NLS-1$ - final String[] frameworkStr = - frwkFromConfig.split(BUNDLE_SEPARATOR); - result.addAll(trimPaths(frameworkStr, FRAMEWORK_PREFIX)); - } - return result; - } - - /** - * Returns list of trimmed paths; - * @param paths String[] - * @param prefix String - * @return List<String> - */ - private static List<String> trimPaths(final String[] paths, - final String prefix) { - final LinkedList<String> result = new LinkedList<String>(); - for (String path : paths) { - int indexSuffix = path.indexOf("@"); //$NON-NLS-1$ - if (indexSuffix < 0) { - indexSuffix = path.length(); - } - result.add(path.substring(prefix.length(), - indexSuffix)); - } - return result; - } - - /** - * Reflexive call of DirectoryBundleContainer constructor. - * @param containerPath String - * @return Object - * @throws PdeCoreUtilsException - */ - private static Object newDirectoryBundleContainer( - final String containerPath) - throws PdeCoreUtilsException { - Object container = null; - try { - final Bundle bundle = Activator.getDefault().getBundle(); - final Class<?> classs = - bundle.loadClass("org.eclipse.pde.internal.core.target.DirectoryBundleContainer"); //$NON-NLS-1$ - final Class<?>[] paramTypes = new Class[] {containerPath.getClass()}; - final Constructor<?> constructor = classs.getConstructor(paramTypes); - final Object[] initargs = new Object[] { containerPath }; - container = constructor.newInstance(initargs); - } catch (Exception e) { - throw new PdeCoreUtilsException(e); - } - return container; - } - - /** - * Copies all needed jar files in a directory and returns set of containers. - * @param bundlesStr List<String> - * @param copyDirectory File - * @return Object[] - * @throws PdeCoreUtilsException - * @throws IOException - */ - private static Object[] copyJarsAndGetContainers( - final List<String> bundlesStr, final File copyDirectory) - throws PdeCoreUtilsException, IOException { - final List<Object> bundleContainers = new LinkedList<Object>(); - final Iterator<String> bundlesStrIter = bundlesStr.iterator(); - while (bundlesStrIter.hasNext()) { - final File bundleFile = new File(bundlesStrIter.next()); // NOPMD - // NOPMD: gdupe> No other way to write this code - if (bundleFile.exists()) { - if (bundleFile.isDirectory()) { - copyJarFileOrAddContainerDirectory(bundleFile, - bundleContainers, copyDirectory); - } else { - try { - //FIXME gdupe> is a call to close() required ? - final JarFile jarFile = new JarFile(bundleFile); // NOPMD - // NOPMD: gdupe> No other way to write this code - copyJarFile(jarFile, copyDirectory); - } catch (IOException e) { - throw new PdeCoreUtilsException(e); - } - } - } - } - final Object copyDirContainer = - newDirectoryBundleContainer(copyDirectory.getAbsolutePath()); - bundleContainers.add(copyDirContainer); - return bundleContainers.toArray(); - } - - /** - * Copies jarFile to the specified directory or creates a container - * if bundleFile is a directory. - * @param bundleFile File - * @param bundleContainers List<Object> - * @param copyDirectory File - * @throws PdeCoreUtilsException - * @throws IOException - */ - private static void copyJarFileOrAddContainerDirectory( - final File bundleFile, final List<Object> bundleContainers, - final File copyDirectory) - throws PdeCoreUtilsException, IOException { - Object container; - //FIXME gdupe> is a call to close() required ? - final JarFile jarFile = getFirstMatchingJarFile(bundleFile); - if (jarFile == null) { - container = newDirectoryBundleContainer(bundleFile.getAbsolutePath()); - bundleContainers.add(container); - } else { - copyJarFile(jarFile, copyDirectory); - } - } - - /** - * Return first jar file that match with the bundle directory. - * @param bundleFile File - * @return JarFile - * @throws IOException - */ - private static JarFile getFirstMatchingJarFile(final File bundleFile) - throws IOException { - JarFile result = null; - if (bundleFile.exists() && bundleFile.isDirectory()) { - final String bundleFileName = bundleFile.getName(); - final File jar = findJarFile(bundleFile, bundleFileName); - if (jar != null) { - result = new JarFile(jar); - } - } - return result; - } - - /** - * Search jar file in directory and sub-directories. - * @param directory File - * @param fileName String - * @return File - */ - private static File findJarFile(final File directory, - final String fileName) { - final File[] children = directory.listFiles(); - final LinkedList<File> toVisit = new LinkedList<File>(); - int cpt = 0; - File foundFile = null; - String childName; - while (foundFile != null && cpt < children.length) { - final File child = children[cpt]; - if (child.isFile()) { - childName = child.getName(); - if (childName.startsWith(fileName) - && childName.endsWith(JAR_EXT)) { - foundFile = child; - } - } else { - toVisit.add(child); - } - cpt++; - } - if (foundFile == null) { - foundFile = searchInSubDirectories(fileName, toVisit); - } - return foundFile; - } - - /** - * Search jar file and sub-directories. - * @param fileName String - * @param toVisit List<File> - * @return File - */ - private static File searchInSubDirectories(final String fileName, - final List<File> toVisit) { - File result = null; - final Iterator<File> childrenIterator = toVisit.iterator(); - while (childrenIterator.hasNext() && result != null) { - final File child = childrenIterator.next(); - result = findJarFile(child.getAbsoluteFile(), fileName); - } - return result; - } - - - /** - * Copies a jarFile into specified directory. - * @param jarFile JarFile - * @param copyTo File - * @throws PdeCoreUtilsException - */ - private static void copyJarFile(final JarFile jarFile, final File copyTo) - throws PdeCoreUtilsException { - final String fileName = jarFile.getName(); - final String bundleName = fileName.substring(fileName - .lastIndexOf(File.separator)); - final File copyToDirectory = new File(copyTo, bundleName); - JarOutputStream jarOutputStream = null; - try { - jarOutputStream = new JarOutputStream( - new FileOutputStream(copyToDirectory)); - final Enumeration<JarEntry> jarFileEntries = jarFile.entries(); - final byte[] buffer = new byte[BUFFER_SIZE]; - while (jarFileEntries.hasMoreElements()) { - final JarEntry sourceEntry = jarFileEntries.nextElement(); - final InputStream inputStream = - jarFile.getInputStream(sourceEntry); - final JarEntry targetEntry = - new JarEntry(sourceEntry.getName()); // NOPMD - // ftreguer> NOPMD This loop has to create one jar entry for - // each loop iteration - jarOutputStream.putNextEntry(targetEntry); - int bytesRead = inputStream.read(buffer); - while (bytesRead != -1) { - jarOutputStream.write(buffer, 0, bytesRead); - bytesRead = inputStream.read(buffer); - } - inputStream.close(); - jarOutputStream.flush(); - jarOutputStream.closeEntry(); - } - } catch (IOException e) { - throw new PdeCoreUtilsException(e); - } finally { // NOPMD gdupe> No other choice if I want to managed the - // stream closing - if (jarOutputStream != null) { - try { - jarOutputStream.close(); - } catch (IOException e) { - throw new PdeCoreUtilsException(e); - } - } - } - } - - /** - * Calls a method reflexively on an object or a class (static call) with - * specified arguments. - * @param staticCall boolean - * @param callOn Object - * @param calledMethodName String - * @param args Object[] - * @throws ExpException - */ - private static Object reflexiveCall(final boolean staticCall, - final Object callOn, final String calledMethodName, - final Object[] args) throws ReflexiveDiscouragedAccessException { - Object result = null; - Method aMethod = null; - final Class<?>[] classes = getClassesFromArgs(args); - try { - if (staticCall) { - // ftreguer> Static Call, the second parameter should be a - // String representing Class name. - if (callOn instanceof String) { - final Class<?> clazz = Activator.getDefault() - .getBundle().loadClass((String) callOn); - aMethod = getMethod(clazz, calledMethodName, classes); - } else { - throw new ReflexiveDiscouragedAccessException( - "Invalid parameter, callOn parameter should be a String. (Static Call)"); //$NON-NLS-1$ - } - } else { - aMethod = getMethod(callOn.getClass(), - calledMethodName, classes); - } - if (aMethod == null) { - String staticStr = ""; //$NON-NLS-1$ - if (staticCall) { - staticStr = "static"; //$NON-NLS-1$ - } - final String message = String.format( - "No method with specified arguments found. API break ? Loking for : %s %s.%s(%s)", //$NON-NLS-1$ - staticStr, - callOn.toString(), - calledMethodName, - Arrays.toString(args) - ); - throw new ReflexiveDiscouragedAccessException(message); - } - result = aMethod.invoke(callOn, manageArguments(args)); - } catch (Exception e) { - String message = calledMethodName; - if (aMethod != null) { - message = String.format("Failed to call %s", aMethod.toString()); //$NON-NLS-1$ - } - throw new ReflexiveDiscouragedAccessException(message, e); - } - return result; - } - - - /** - * Transforms Object arrays to specific arrays. - * @param arguments Object[] - * @return Object[] - */ - private static Object[] manageArguments(final Object[] arguments) { - Object[] result; - if (arguments != null && arguments.length > 0) { - result = new Object[arguments.length]; - Object arg; - for (int i = 0; i < arguments.length; i++) { - arg = arguments[i]; - if (isArray(arg)) { - final Object argElement = ((Object[]) arg)[0]; - final int arraySize = Array.getLength(arg); - Object[] argTmp = (Object[]) Array.newInstance( - argElement.getClass(), arraySize); - for (int y = 0; y < arraySize; y++) { - argTmp[y] = ((Object[]) arg)[y]; - } - result[i] = argTmp; - } else { - result[i] = arg; - } - } - } else { - result = arguments; - } - return result; - } - - /** - * Returns true if the parameter represents an array. - * @param obj Object - * @return boolean - */ - private static boolean isArray(final Object obj) { - return obj.getClass().getName().startsWith(ARRAY_PREFIX); - } - - /** - * Returns array of Class that represents types of each arguments. - * @param args Object[] - * @return Class<?>[] - */ - private static Class<?>[] getClassesFromArgs(final Object[] args) { - Class<?>[] classes = null; - if (args != null) { - classes = new Class[args.length]; - Object arg = null; - for (int i = 0; i < args.length; i++) { - arg = args[i]; - if (arg != null) { - if (isArray(arg)) { - arg = ((Object[]) arg)[0]; - arg = Array.newInstance(arg.getClass(), 0); - } - classes[i] = arg.getClass(); - } - } - } - return classes; - } - - /** - * Returns a Method object that correspond to the specified name - * and parameters. - * @param clazz Class<?> - * @param methodName String - * @param parameterTypes Class<?>[] - * @return Method - * @throws ClassNotFoundException - */ - private static Method getMethod(final Class<?> clazz, - final String methodName, final Class<?>... parameterTypes) - throws ClassNotFoundException { - Method result = null; - final Method[] methods = clazz.getMethods(); - for (Method method : methods) { - if (methodName.equals(method.getName())) { - final Class<?>[] parameters = method.getParameterTypes(); - if (checkTypes(parameters, parameterTypes)) { - result = method; - break; - } - } - } - return result; - } - - /** - * Checks if all parameters are the same in both arrays. - * @param refParams - * @param parameterToTest - * @return boolean - * @throws ClassNotFoundException - */ - private static boolean checkTypes(final Class<?>[] refParams, - final Class<?>[] parameterToTest) throws ClassNotFoundException { - boolean result = false; - if (refParams.length == parameterToTest.length) { - if (refParams.length == 0) { - result = true; - } - String refClazzName = null; - String clazzName = null; - for (int i = 0; i < parameterToTest.length; i++) { - refClazzName = refParams[i].getName(); - clazzName = parameterToTest[i].getName(); - if (!clazzName.equals(refClazzName)) { - final boolean isRefArray = refClazzName - .startsWith(ARRAY_PREFIX); - final boolean isParamArray = clazzName - .startsWith(ARRAY_PREFIX); - if (isRefArray == isParamArray) { - if (isRefArray) { - refClazzName = refClazzName - .substring(ARRAY_PREFIX.length(), - refClazzName.length() - 1); - clazzName = clazzName - .substring(ARRAY_PREFIX.length(), - clazzName.length() - 1); - } - result = paramExtendsRef(refClazzName, clazzName); - } - } - } - } - return result; - } - - /** - * Returns true if className is a SubType of refClassName. - * @param refClassName String - * @param className String - * @return boolean - * @throws ClassNotFoundException - */ - private static boolean paramExtendsRef(final String refClassName, - final String className) throws ClassNotFoundException { - final Bundle bundle = Activator.getDefault().getBundle(); - final Class<?> refClazz = bundle.loadClass(refClassName); - final Class<?> clazz = bundle.loadClass(className); - return refClazz.isAssignableFrom(clazz); - } - -}
diff --git a/org.eclipse.modisco.facet.util.pde.core/src/org/eclipse/emf/facet/util/pde/core/internal/exported/exception/PdeCoreUtilsException.java b/org.eclipse.modisco.facet.util.pde.core/src/org/eclipse/emf/facet/util/pde/core/internal/exported/exception/PdeCoreUtilsException.java deleted file mode 100644 index 23e6b5a..0000000 --- a/org.eclipse.modisco.facet.util.pde.core/src/org/eclipse/emf/facet/util/pde/core/internal/exported/exception/PdeCoreUtilsException.java +++ /dev/null
@@ -1,33 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2013 Soft-Maint. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Fabien Treguer (Soft-Maint) - Bug 418565 - [Unit Test Failure] Missing dependencies during tests, target platform creation and load - ******************************************************************************/ -package org.eclipse.emf.facet.util.pde.core.internal.exported.exception; - -public class PdeCoreUtilsException extends Exception { - - private static final long serialVersionUID = -7462304304846835284L; - - public PdeCoreUtilsException() { - super(); - } - - public PdeCoreUtilsException(final String message) { - super(message); - } - - public PdeCoreUtilsException(final Throwable cause) { - super(cause); - } - - public PdeCoreUtilsException(final String message, final Throwable cause) { - super(message, cause); - } - -}
diff --git a/org.eclipse.modisco.facet.util.pde.core/src/org/eclipse/emf/facet/util/pde/core/internal/exported/exception/ReflexiveDiscouragedAccessException.java b/org.eclipse.modisco.facet.util.pde.core/src/org/eclipse/emf/facet/util/pde/core/internal/exported/exception/ReflexiveDiscouragedAccessException.java deleted file mode 100644 index 653c482..0000000 --- a/org.eclipse.modisco.facet.util.pde.core/src/org/eclipse/emf/facet/util/pde/core/internal/exported/exception/ReflexiveDiscouragedAccessException.java +++ /dev/null
@@ -1,33 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2013 Soft-Maint. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Fabien Treguer (Soft-Maint) - Bug 418565 - [Unit Test Failure] Missing dependencies during tests, target platform creation and load - ******************************************************************************/ -package org.eclipse.emf.facet.util.pde.core.internal.exported.exception; - -public class ReflexiveDiscouragedAccessException extends Exception { - - private static final long serialVersionUID = -7462304304846835284L; - - public ReflexiveDiscouragedAccessException() { - super(); - } - - public ReflexiveDiscouragedAccessException(final String message) { - super(message); - } - - public ReflexiveDiscouragedAccessException(final Throwable cause) { - super(cause); - } - - public ReflexiveDiscouragedAccessException(final String message, final Throwable cause) { - super(message, cause); - } - -}
diff --git a/org.eclipse.modisco.facet.util.pde.core/src/org/eclipse/modisco/facet/util/pde/core/internal/Activator.java b/org.eclipse.modisco.facet.util.pde.core/src/org/eclipse/modisco/facet/util/pde/core/internal/Activator.java new file mode 100644 index 0000000..6bbbd15 --- /dev/null +++ b/org.eclipse.modisco.facet.util.pde.core/src/org/eclipse/modisco/facet/util/pde/core/internal/Activator.java
@@ -0,0 +1,50 @@ +/** + * Copyright (c) 2013 Mia-Software + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Gregoire Dupe (Mia-Software) - Bug 417789 - org.eclipse.emf.facet.util.core should not so much dependencies + */ + package org.eclipse.modisco.facet.util.pde.core.internal; + +import org.eclipse.core.runtime.Plugin; +import org.osgi.framework.BundleContext; + +@SuppressWarnings("PMD.UseSingleton") +// @SuppressWarnings("PMD.UseSingleton") We cannot conforms to this rule because +// this class is an Eclipse plug-in activator which will be instantiated by the +// Eclipse framework. +public class Activator extends Plugin { + + private static Activator plugin; + + @Override + @SuppressWarnings("PMD.SignatureDeclareThrowsException") + // @SuppressWarnings("PMD.SignatureDeclareThrowsException") We have to use + // this signature because this is an override of an Eclipse framework's + // method. + public void start(final BundleContext bundleContext) throws Exception { + super.start(bundleContext); + Activator.plugin = this; + } + + @Override + @SuppressWarnings("PMD.SignatureDeclareThrowsException") + // @SuppressWarnings("PMD.SignatureDeclareThrowsException") We have to use + // this signature because this is an override of an Eclipse framework's + // method. + public void stop(final BundleContext bundleContext) throws Exception { + // NOPMD: PMD say "Assigning an Object to null is a code smell." + // No choice to right it in another way : this is an Eclipse pattern. + Activator.plugin = null; // NOPMD + super.stop(bundleContext); + } + + public static Plugin getDefault() { + return Activator.plugin; + } + +}
diff --git a/org.eclipse.modisco.facet.util.pde.core/src/org/eclipse/modisco/facet/util/pde/core/internal/BuildPropertiesUtils.java b/org.eclipse.modisco.facet.util.pde.core/src/org/eclipse/modisco/facet/util/pde/core/internal/BuildPropertiesUtils.java new file mode 100644 index 0000000..4b2b41c --- /dev/null +++ b/org.eclipse.modisco.facet.util.pde.core/src/org/eclipse/modisco/facet/util/pde/core/internal/BuildPropertiesUtils.java
@@ -0,0 +1,146 @@ +/******************************************************************************* + * Copyright (c) 2010-2013 Mia-Software. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Nicolas Bros (Mia-Software) - initial API and implementation + * Nicolas Bros (Mia-Software) - Bug 339991 - don't use internal APIs in org.eclipse.emf.facet.util.core.internal.BuildPropertiesUtils + * Laurent Pichierri (Soft-Maint) - Bug 371204 - Compatibility with Helios + * Gregoire Dupe (Mia-Software) - Bug 371204 - Compatibility with Helios + * Gregoire Dupe (Mia-Software) - Bug 417789 - org.eclipse.emf.facet.util.core should not so much dependencies + *******************************************************************************/ +package org.eclipse.modisco.facet.util.pde.core.internal; + +import java.io.ByteArrayInputStream; +import java.lang.reflect.Method; + +import org.eclipse.core.resources.IFile; +import org.eclipse.core.resources.IProject; +import org.eclipse.core.runtime.CoreException; +import org.eclipse.core.runtime.IPath; +import org.eclipse.core.runtime.NullProgressMonitor; +import org.eclipse.core.runtime.Path; +import org.eclipse.modisco.facet.util.core.Logger; +import org.eclipse.modisco.facet.util.pde.core.internal.exception.PdeCoreUtilsRuntimeException; +import org.eclipse.pde.core.IEditableModel; +import org.eclipse.pde.core.build.IBuild; +import org.eclipse.pde.core.build.IBuildEntry; +import org.eclipse.pde.core.build.IBuildModel; +import org.eclipse.pde.core.plugin.IPluginModelBase; +import org.eclipse.pde.core.plugin.PluginRegistry; + +public final class BuildPropertiesUtils { + + // This class has been copied from org.eclipse.emf.facet.infra.common.core.internal.utils.BuildPropertiesUtils + + private BuildPropertiesUtils() { + // utilities class + } + + /** + * Get the build model of an Eclipse plug-in + * + * @param model + * a plug-in's PDE model + * @return a build model or <code>null</code> if the build.properties file + * does not exist + * @throws CoreException + */ + public static IBuildModel getBuildModel(final IPluginModelBase model) throws CoreException { + final IProject project = model.getUnderlyingResource().getProject(); + final IPluginModelBase pluginModelBase = PluginRegistry.findModel(project); + //Here we use a reflexive call to be able to build against an Helios platform. + //This method will build with Helios, but will fail at runtime. + //We do not have a better solution. Otherwise we would have to use an internal API. + //We prefer some loose of functionality with Helios that to use internal API. + IBuildModel buildModel = null; + try { + final Class<? extends IPluginModelBase> class1 = pluginModelBase.getClass(); + final Method method = class1.getMethod("getBuildModel"); //$NON-NLS-1$ + if (method != null) { + buildModel = (IBuildModel) method.invoke(pluginModelBase); + } + } catch (Exception e) { + Logger.logError(e, Activator.getDefault()); + } + return buildModel; + } + + /** + * @param project + * the project for which to get a build model top level object + * @return a build model top level object or <code>null</code> if the + * build.properties file does not exist + * @throws CoreException + */ + public static IBuild getBuild(final IProject project) throws CoreException { + IBuild result = null; + final IPluginModelBase pluginModel = PluginRegistry.findModel(project); + if (pluginModel != null) { + final IBuildModel buildModel = getBuildModel(pluginModel); + if (buildModel != null) { + result = buildModel.getBuild(); + } + } + return result; + } + + /** + * @param elementFile + * the file whose presence in the build.properties is being + * tested + * @return whether the file is in the build.properties (<code>false</code> + * if the build.properties file does not exist) + * @throws CoreException + */ + public static boolean isInBuild(final IFile elementFile) throws CoreException { + final IProject project = elementFile.getProject(); + final IPath filePath = elementFile.getFullPath().removeFirstSegments(1); + final IBuild build = getBuild(project); + boolean result = false; + if (build != null) { + final IBuildEntry entry = build.getEntry(IBuildEntry.BIN_INCLUDES); + if (entry != null) { + final String[] tokens = entry.getTokens(); + for (String token : tokens) { + final IPath path = new Path(token); + // if "abc/" is included, then "abc/def/" is too + if (path.isPrefixOf(filePath)) { + result = true; + } + } + } + } + return result; + } + + public static void addToBuild(final IFile elementFile) throws CoreException { + final IProject project = elementFile.getProject(); + if (isInBuild(elementFile)) { + return; + } + final IPath filePath = elementFile.getFullPath().removeFirstSegments(1); + final IPluginModelBase pluginModel = PluginRegistry.findModel(project); + final IFile buildProperties = elementFile.getProject().getFile("build.properties"); //$NON-NLS-1$ + if (!buildProperties.exists()) { + buildProperties.create(new ByteArrayInputStream(new byte[0]), true, + new NullProgressMonitor()); + } + final IBuildModel buildModel = getBuildModel(pluginModel); + if (buildModel == null) { + throw new PdeCoreUtilsRuntimeException("Couldn't get build model"); //$NON-NLS-1$ + } + final IBuild build = buildModel.getBuild(); + IBuildEntry entry = build.getEntry(IBuildEntry.BIN_INCLUDES); + // if entry "bin.includes" does not exist, then create it + if (entry == null) { + entry = buildModel.getFactory().createEntry(IBuildEntry.BIN_INCLUDES); + build.add(entry); + } + entry.addToken(filePath.toPortableString()); + ((IEditableModel) buildModel).save(); + } +}
diff --git a/org.eclipse.modisco.facet.util.pde.core/src/org/eclipse/modisco/facet/util/pde/core/internal/PluginUtils.java b/org.eclipse.modisco.facet.util.pde.core/src/org/eclipse/modisco/facet/util/pde/core/internal/PluginUtils.java new file mode 100644 index 0000000..6ebf35d --- /dev/null +++ b/org.eclipse.modisco.facet.util.pde.core/src/org/eclipse/modisco/facet/util/pde/core/internal/PluginUtils.java
@@ -0,0 +1,605 @@ +/******************************************************************************* + * Copyright (c) 2010-2013 Mia-Software. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Nicolas Bros (Mia-Software) - initial API and implementation + * Nicolas Guyomar (Mia-Software) - Bug 340339 - Need some Utils class for Folder/File/Project management + * Gregoire Dupe (Mia-Software) - Bug 340339 - Need some Utils class for Folder/File/Project management + * Nicolas Guyomar (Mia-Software) - Bug 340681 - Facet column implementation + * Nicolas Bros (Mia-Software) - Bug 380391 - PluginUtils#importPlugin should use the Bundle API + * Gregoire Dupe (Mia-Software) - Bug 408344 - [Releng] Deep folders cause build break + *******************************************************************************/ +package org.eclipse.modisco.facet.util.pde.core.internal; + +import java.io.ByteArrayInputStream; +import java.io.FileNotFoundException; +import java.io.IOException; +import java.io.InputStream; +import java.io.StringWriter; +import java.net.URISyntaxException; +import java.net.URL; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Enumeration; +import java.util.List; + +import javax.xml.parsers.DocumentBuilder; +import javax.xml.parsers.DocumentBuilderFactory; +import javax.xml.parsers.ParserConfigurationException; +import javax.xml.transform.OutputKeys; +import javax.xml.transform.Transformer; +import javax.xml.transform.TransformerException; +import javax.xml.transform.TransformerFactory; +import javax.xml.transform.dom.DOMSource; +import javax.xml.transform.stream.StreamResult; + +import org.eclipse.core.resources.IContainer; +import org.eclipse.core.resources.IFile; +import org.eclipse.core.resources.IFolder; +import org.eclipse.core.resources.IProject; +import org.eclipse.core.resources.IProjectDescription; +import org.eclipse.core.resources.IResource; +import org.eclipse.core.resources.IWorkspace; +import org.eclipse.core.resources.IWorkspaceRoot; +import org.eclipse.core.resources.IWorkspaceRunnable; +import org.eclipse.core.resources.IncrementalProjectBuilder; +import org.eclipse.core.resources.ResourcesPlugin; +import org.eclipse.core.runtime.CoreException; +import org.eclipse.core.runtime.IPath; +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.core.runtime.IStatus; +import org.eclipse.core.runtime.MultiStatus; +import org.eclipse.core.runtime.NullProgressMonitor; +import org.eclipse.core.runtime.Path; +import org.eclipse.core.runtime.Status; +import org.eclipse.jdt.core.IClasspathEntry; +import org.eclipse.jdt.core.IJavaProject; +import org.eclipse.jdt.core.JavaConventions; +import org.eclipse.jdt.core.JavaCore; +import org.eclipse.jdt.core.JavaModelException; +import org.eclipse.modisco.facet.util.core.Logger; +import org.eclipse.modisco.facet.util.core.internal.exported.FileUtils; +import org.eclipse.modisco.facet.util.core.internal.exported.FolderUtils; +import org.eclipse.modisco.facet.util.core.internal.exported.IFilter; +import org.eclipse.osgi.util.NLS; +import org.eclipse.pde.core.plugin.IExtensions; +import org.eclipse.pde.core.plugin.IPluginAttribute; +import org.eclipse.pde.core.plugin.IPluginElement; +import org.eclipse.pde.core.plugin.IPluginExtension; +import org.eclipse.pde.core.plugin.IPluginModelBase; +import org.eclipse.pde.core.plugin.IPluginObject; +import org.eclipse.pde.core.plugin.PluginRegistry; +import org.osgi.framework.Bundle; +import org.w3c.dom.Attr; +import org.w3c.dom.Document; +import org.w3c.dom.Element; +import org.w3c.dom.Node; +import org.w3c.dom.Text; +import org.xml.sax.SAXException; + +import com.ibm.icu.lang.UCharacter; + +public final class PluginUtils { + + // This class has been copied from + // org.eclipse.emf.facet.infra.common.core.internal.utils.PluginUtils + + private PluginUtils() { + // utilities class + } + + /** + * Returns whether the given file is registered in the plugin.xml of the + * given project, using the given extension point. + * + * @param extensionPoint + * the extension point that is used to register elements of this + * kind (elements must be declared with a "file" attribute) + */ + public static boolean isRegistered(final IFile elementFile, final String extensionPoint) { + final IProject project = elementFile.getProject(); + final IPluginModelBase pluginModel = PluginRegistry.findModel(project); + boolean result = false; + if (pluginModel != null) { + final IExtensions extensions2 = pluginModel.getExtensions(); + final IPluginExtension[] extensions = extensions2.getExtensions(); + for (IPluginExtension pluginExtension : extensions) { + if (extensionPoint.equals(pluginExtension.getPoint())) { + final IPluginObject[] children = pluginExtension.getChildren(); + for (IPluginObject child : children) { + if (child instanceof IPluginElement) { + final IPluginElement pluginElement = (IPluginElement) child; + final IPluginAttribute[] attributes = pluginElement.getAttributes(); + for (IPluginAttribute pluginAttribute : attributes) { + if ("file".equalsIgnoreCase(pluginAttribute.getName())) { //$NON-NLS-1$ + final String strFile = pluginAttribute.getValue(); + if (strFile != null && strFile.length() > 0) { + final IFile file = project.getFile(strFile); + if (file.exists() && elementFile.equals(file)) { + result = true; + } + } + } + } + } + } + } + } + } + return result; + } + + /** + * Registers the given file in the plugin.xml of the given project, using + * the given extension point. + * + * @param project + * the project in which the element should be registered + * @param extensionToCheck + * the file extension of the element that should be registered + * @param extensionPoint + * the extension point that is used to register elements of this + * kind (elements must be declared with a "file" attribute) + */ + /** + * Registers the given file in the plugin.xml of the given project, using + * the given extension point. + * + * @param file + * the file to register + * @param extensionPointId + * the extension point that is used to register the file + * @param elementName + * the name of the XML element in which an attribute named "file" + * will be set to the path of the file + * @throws ParserConfigurationException + * @throws IOException + * @throws SAXException + * @throws TransformerException + * @throws CoreException + */ + public static void register(final IFile file, final String extensionPointId, + final String elementName) { + if (isRegistered(file, extensionPointId)) { + return; + } + + final IPath filePath = file.getFullPath().removeFirstSegments(1); + final IProject project = file.getProject(); + + final IFile pluginXML = project.getFile("plugin.xml"); //$NON-NLS-1$ + if (pluginXML.exists()) { + final DocumentBuilderFactory docFactory = DocumentBuilderFactory.newInstance(); + DocumentBuilder docBuilder; + + try { + docBuilder = docFactory.newDocumentBuilder(); + final String pluginXmlLoc = pluginXML.getLocation().toOSString(); + final Document doc = docBuilder.parse(pluginXmlLoc); + final Element root = doc.getDocumentElement(); + + final Text whitespace = doc.createTextNode(" "); //$NON-NLS-1$ + root.appendChild(whitespace); + + final Node extensionNode = doc.createElement("extension"); //$NON-NLS-1$ + final Attr pointAttr = doc.createAttribute("point"); //$NON-NLS-1$ + pointAttr.setValue(extensionPointId); + extensionNode.getAttributes().setNamedItem(pointAttr); + root.appendChild(extensionNode); + + final Node elementNode = doc.createElement(elementName); + final Attr fileAttr = doc.createAttribute("file"); //$NON-NLS-1$ + fileAttr.setValue(filePath.toString()); + elementNode.getAttributes().setNamedItem(fileAttr); + extensionNode.appendChild(elementNode); + + final TransformerFactory trFactory = TransformerFactory.newInstance(); + final int indent = 3; + trFactory.setAttribute("indent-number", Integer.valueOf(indent)); //$NON-NLS-1$ + final Transformer transformer = trFactory.newTransformer(); + transformer.setOutputProperty(OutputKeys.ENCODING, "UTF-8"); //$NON-NLS-1$ + transformer.setOutputProperty(OutputKeys.INDENT, "yes"); //$NON-NLS-1$ + final StreamResult result = new StreamResult(new StringWriter()); + final DOMSource source = new DOMSource(doc); + transformer.transform(source, result); + final String xmlString = result.getWriter().toString(); + + final byte[] byteArray = xmlString.getBytes("UTF-8"); //$NON-NLS-1$ + pluginXML.setContents(new ByteArrayInputStream(byteArray), true, true, + new NullProgressMonitor()); + + } catch (Exception e) { + Logger.logError(e, Activator.getDefault()); + } + } else { + try { + // create plugin.xml + final String template = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" //$NON-NLS-1$ + + "<?eclipse version=\"3.4\"?>\n" + "<plugin>\n" //$NON-NLS-1$ //$NON-NLS-2$ + + " <extension point=\"{0}\">\n" + " <{1} file=\"{2}\"/>\n" //$NON-NLS-1$ //$NON-NLS-2$ + + " </extension>\n" //$NON-NLS-1$ + + "</plugin>\n"; //$NON-NLS-1$ + + final String content = NLS.bind(template, new Object[] { extensionPointId, elementName, + filePath.toString() }); + byte[] byteArray; + byteArray = content.getBytes("UTF-8"); //$NON-NLS-1$ + pluginXML.create(new ByteArrayInputStream(byteArray), true, + new NullProgressMonitor()); + try { + BuildPropertiesUtils.addToBuild(pluginXML); + } catch (Exception e) { + Logger.logError(e, "Error adding file " + pluginXML.getFullPath() //$NON-NLS-1$ + + " to the build.properties", null); //$NON-NLS-1$ + } + } catch (Exception e) { + Logger.logError(e, Activator.getDefault()); + } + } + } + + private static final String JAVA_VERSION = "JavaSE-1.8"; //$NON-NLS-1$ + private static final String ACTIVATOR_NAME = "Activator"; //$NON-NLS-1$ + private static final String MANIFEST_MF_TPL = "resources/MANIFEST.MF.template"; //$NON-NLS-1$ + private static final String ACTIVATOR_TPL = "resources/Activator.java.template"; //$NON-NLS-1$ + private static final String PDE_CLASSPATH_ID = "org.eclipse.pde.core.requiredPlugins"; //$NON-NLS-1$ + private static final String PLUGIN_NATURE = "org.eclipse.pde.PluginNature"; //$NON-NLS-1$ + + private static void addPdeClassPath(final IProject project) + throws JavaModelException { + final IJavaProject javaProject = JavaCore.create(project); + final IClasspathEntry[] oldClassPath = javaProject.getRawClasspath(); + for (IClasspathEntry classpathEntry : oldClassPath) { + if (classpathEntry.getPath().equals(new Path(PluginUtils.PDE_CLASSPATH_ID))) { + return; + } + } + final IClasspathEntry[] newClassPath = new IClasspathEntry[oldClassPath.length + 1]; + System.arraycopy(oldClassPath, 0, newClassPath, 0, oldClassPath.length); + newClassPath[oldClassPath.length] = JavaCore + .newContainerEntry(new Path(PluginUtils.PDE_CLASSPATH_ID)); + javaProject.setRawClasspath(newClassPath, new NullProgressMonitor()); + } + + /** + * @author Gregoire Dupe (Mia-Software) - Removing "Require-Bundle" + * statement + * @throws IOException + */ + private static void createManifest(final IProject project) + throws CoreException, IOException { + final IFolder folder = project.getFolder("META-INF"); //$NON-NLS-1$ + if (!folder.exists()) { + folder.create(true, true, new NullProgressMonitor()); + } + final IFile manifestFile = folder.getFile("MANIFEST.MF"); //$NON-NLS-1$ + if (!manifestFile.exists()) { + String template = FileUtils.getFileContents(Activator.getDefault() + .getBundle(), PluginUtils.MANIFEST_MF_TPL); + template = template.replace("{projectName}", project.getName()); //$NON-NLS-1$ + final String packageName = PluginUtils + .stringToValidPackageName(project.getName()); + template = template.replace("{packageName}", packageName); //$NON-NLS-1$ + final String activator = PluginUtils + .bundleActivatorQualifiedName(packageName); + template = template.replace("{activator}", activator); //$NON-NLS-1$ + template = template.replace("{javaVersion}", //$NON-NLS-1$ + PluginUtils.JAVA_VERSION); + final InputStream source = new ByteArrayInputStream( + template.getBytes()); + manifestFile.create(source, true, new NullProgressMonitor()); + } + } + + private static String bundleActivatorQualifiedName(final String packageName) { + return packageName + '.' + PluginUtils.ACTIVATOR_NAME; + } + + private static void createActivator(final IProject project) + throws CoreException, IOException { + final String packageName = PluginUtils.stringToValidPackageName(project + .getName()); + final String qualifiedName = PluginUtils + .bundleActivatorQualifiedName(packageName); + final String path = qualifiedName.replaceAll("\\.", "/"); //$NON-NLS-1$ //$NON-NLS-2$ + final IFile activatorFile = project + .getFile(new Path("src").append(path).addFileExtension("java")); //$NON-NLS-1$ //$NON-NLS-2$ + FolderUtils.createFolder((IFolder) activatorFile.getParent()); + if (!activatorFile.exists()) { + final String template = FileUtils.getFileContents(Activator + .getDefault().getBundle(), PluginUtils.ACTIVATOR_TPL); + final String activatorContents = template.replace("{0}", packageName); //$NON-NLS-1$ + final InputStream source = new ByteArrayInputStream( + activatorContents.getBytes()); + activatorFile.create(source, true, new NullProgressMonitor()); + } + } + + /** Transform the given name into a valid package and bundle name */ + private static String stringToValidPackageName(final String name) { + final StringBuilder builder = new StringBuilder(); + char prev = ' '; + for (int i = 0; i < name.length(); i++) { + final char character = name.charAt(i); + if (character >= 'a' && character <= 'z' || character >= 'A' + && character <= 'Z' || character == '_') { + builder.append(character); + prev = character; + } else if (character >= '0' && character <= '9') { + if (builder.length() == 0 || prev == '.') { + builder.append("_"); //$NON-NLS-1$ + } + builder.append(character); + prev = character; + } else if (character == '.') { + if (prev == '.') { + continue; + } + if (builder.length() == 0 || prev >= '0' && prev <= '9') { + builder.append("_"); //$NON-NLS-1$ + } + builder.append(character); + prev = character; + } else { + builder.append("_"); //$NON-NLS-1$ + } + } + + String result = builder.toString(); + // first letter to lowercase + if (result.length() > 0 && UCharacter.isUpperCase(result.charAt(0))) { + result = UCharacter.toLowerCase(result.charAt(0)) + + result.substring(1); + } + + final IStatus status = JavaConventions.validatePackageName(result, + JavaCore.VERSION_1_5, JavaCore.VERSION_1_5); + if (!status.isOK()) { + Logger.logWarning( + "Couldn't make valid package name from project name: " //$NON-NLS-1$ + + status.getMessage(), Activator.getDefault()); + result = name; + } + return result; + } + + private static void addPdeNature(final IProject project) + throws CoreException { + final String pluginNature = PluginUtils.PLUGIN_NATURE; + final IProjectDescription description = project.getDescription(); + final String[] natures = description.getNatureIds(); + if (!Arrays.asList(natures).contains(pluginNature)) { + String[] newNatures = new String[natures.length + 1]; + System.arraycopy(natures, 0, newNatures, 0, natures.length); + newNatures[natures.length] = pluginNature; + description.setNatureIds(newNatures); + project.setDescription(description, new NullProgressMonitor()); + } + } + + /** + * This method transforms a Java project into a plug-in project by creating + * a MANIFEST.MF and an activator and by adding a the PDE nature and the PDE + * classpath. + * + * @param project + * The project to transform in an plug-in project + * @throws CoreException + * @throws IOException + */ + public static void configureAsPluginProject(final IProject project) + throws CoreException, IOException { + PluginUtils.addPdeNature(project); + // PDE builders are automatically added when the PDE nature is added + PluginUtils.addPdeClassPath(project); + PluginUtils.createManifest(project); + PluginUtils.createActivator(project); + } + + /** + * This method returns true if the project is a plug-in project. + * + * @param project + * @return True if the project is a plug-in project. + * @throws CoreException + */ + public static boolean isPluginProject(final IProject project) + throws CoreException { + boolean result = false; + if (project.isAccessible()) { + result = project.getNature(PluginUtils.PLUGIN_NATURE) != null; + } + return result; + } + + /** + * This method returns true if the path refers a file or a folder contained + * in a plug-in project. + * + * @param path + * @return True if the path refers a file or a folder contained in a plug-in + * project. + * @throws CoreException + */ + public static boolean isInPluginProject(final IPath path) + throws CoreException { + IProject project; + if (path.segmentCount() == 1) { + project = ResourcesPlugin.getWorkspace().getRoot() + .getProject(path.segment(0)); + } else { + final IFolder folder = ResourcesPlugin.getWorkspace().getRoot() + .getFolder(path); + project = folder.getProject(); + } + return isPluginProject(project); + } + + /** + * This method imports a plug-in in the workspace. + * + * @param bundle + * the bundle to import into a new project + * @return the created project + * @throws CoreException + * in case of error + */ + public static IProject importPlugin(final Bundle bundle) throws CoreException { + return PluginUtils.importPlugin(bundle, new IFilter<String>() { + public boolean filter(final String fileName) { + return true; + } + }); + } + + /** + * This method imports a plug-in in the workspace. + * + * @param bundle + * the bundle to import into a new project + * @param filter + * can be used to filter out files or folders from the import + * @return the created project + * @throws CoreException + * in case of error + */ + public static IProject importPlugin(final Bundle bundle, final IFilter<String> filter) throws CoreException { + final IProject[] project = new IProject[1]; + final IWorkspaceRunnable workspaceRunnable = new IWorkspaceRunnable() { + public void run(final IProgressMonitor monitor) throws CoreException { + project[0] = internalImportPlugin(bundle, filter); + } + }; + ResourcesPlugin.getWorkspace().run(workspaceRunnable, new NullProgressMonitor()); + return project[0]; + } + + /** + * This method imports a plug-in in the workspace. + * + * @param bundle + * the bundle to import into a new project + * @param filter + * can be used to filter out files or folders from the import + * @return the created project + * @throws CoreException + * in case of error + */ + protected static IProject internalImportPlugin(final Bundle bundle, final IFilter<String> filter) throws CoreException { + final IProject project = createProjectWithUniqueName(bundle.getSymbolicName()); + final List<IStatus> errors = new ArrayList<IStatus>(); + final List<URL> urls = getURLsToCopy(bundle, project, + "/", filter, errors); //$NON-NLS-1$ + for (URL url : urls) { + copyUrlToFile(project, errors, url); + } + handleErrors(errors); + project.refreshLocal(IResource.DEPTH_INFINITE, new NullProgressMonitor()); + project.build(IncrementalProjectBuilder.CLEAN_BUILD, new NullProgressMonitor()); + project.build(IncrementalProjectBuilder.FULL_BUILD, new NullProgressMonitor()); + return project; + } + + private static void copyUrlToFile(final IProject project, + final List<IStatus> errors, final URL url) throws CoreException { + try { + final InputStream inputStream = url.openStream(); + final String strSubpath = url.toString().replaceAll( + "bundleentry://[^/]*/", ""); //$NON-NLS-1$ //$NON-NLS-2$ + final IFile file = project.getFile(new Path(strSubpath)); + if (file.exists()) { + file.delete(true, new NullProgressMonitor()); + } + final IContainer parent = file.getParent(); + if ((!parent.exists()) && parent instanceof IFolder) { + createDir((IFolder) parent); + } + file.create(inputStream, true, new NullProgressMonitor()); + inputStream.close(); + } catch (FileNotFoundException e) { + /* + * gdupe> We ignore files removed during the execution of + * internalImportPlugin. + */ + String message; + try { + message = String.format("Ignoring the missing file %s.", //$NON-NLS-1$ + url.toURI()); + } catch (URISyntaxException e1) { + message = String.format("Ignoring the missing file."); //$NON-NLS-1$ + } + Logger.logError(message, Activator.getDefault()); + } catch (IOException e) { + final Bundle localBundle = Activator.getDefault().getBundle(); + final String symbolicName = localBundle.getSymbolicName(); + final Status status = new Status(IStatus.ERROR, symbolicName, + e.getMessage(), e); + errors.add(status); + } + } + + private static void createDir(final IFolder folder) throws CoreException { + final IContainer parent = folder.getParent(); + if ((!parent.exists()) && parent instanceof IFolder) { + createDir((IFolder) parent); + } + folder.create(true, true, new NullProgressMonitor()); + } + protected static void handleErrors(final List<IStatus> errors) throws CoreException { + if (!errors.isEmpty()) { + final IStatus[] statusArray = errors.toArray(new IStatus[errors.size()]); + final IStatus status = new MultiStatus(Activator.getDefault().getBundle().getSymbolicName(), + IStatus.ERROR, statusArray, "Errors importing project", new Exception()); //$NON-NLS-1$ + throw new CoreException(status); + } + } + + private static List<URL> getURLsToCopy(final Bundle bundle, + final IProject project, final String path, + final IFilter<String> filter, final List<IStatus> errors) { + final List<URL> result = new ArrayList<URL>(); + final Enumeration<?> entryPaths = bundle.getEntryPaths(path); + while (entryPaths != null && entryPaths.hasMoreElements()) { + final Object nextElement = entryPaths.nextElement(); + if (nextElement instanceof String) { + final String strSubpath = (String) nextElement; + if (filter.filter(strSubpath)) { + // directory + if (strSubpath.endsWith("/")) { //$NON-NLS-1$ + final List<URL> fromSubFolder = getURLsToCopy(bundle, + project, strSubpath, filter, errors); + result.addAll(fromSubFolder); + } else { + final URL url = bundle.getEntry(strSubpath); + if (url != null) { + result.add(url); + } + } + } + } + } + return result; + } + + protected static IProject createProjectWithUniqueName(final String baseName) throws CoreException { + final IWorkspace workspace = ResourcesPlugin.getWorkspace(); + final IWorkspaceRoot root = workspace.getRoot(); + IProject project = root.getProject(baseName); + if (project.exists()) { + int version = 1; + final int maxIter = 100; + while (project.exists() && version < maxIter) { + final String uniqueName = baseName + " (" + version + ')'; //$NON-NLS-1$ + project = root.getProject(uniqueName); + version++; + } + } + project.create(new NullProgressMonitor()); + project.open(new NullProgressMonitor()); + return project; + } +}
diff --git a/org.eclipse.modisco.facet.util.pde.core/src/org/eclipse/modisco/facet/util/pde/core/internal/exception/PdeCoreUtilsRuntimeException.java b/org.eclipse.modisco.facet.util.pde.core/src/org/eclipse/modisco/facet/util/pde/core/internal/exception/PdeCoreUtilsRuntimeException.java new file mode 100644 index 0000000..fddcc1e --- /dev/null +++ b/org.eclipse.modisco.facet.util.pde.core/src/org/eclipse/modisco/facet/util/pde/core/internal/exception/PdeCoreUtilsRuntimeException.java
@@ -0,0 +1,33 @@ +/******************************************************************************* + * Copyright (c) 2013 Mia-Software. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Gregoire Dupe (Mia-Software) - Bug 408344 - [Releng] Deep folders cause build break + *******************************************************************************/ +package org.eclipse.modisco.facet.util.pde.core.internal.exception; + +public class PdeCoreUtilsRuntimeException extends RuntimeException { + + private static final long serialVersionUID = -7462304304846835284L; + + public PdeCoreUtilsRuntimeException() { + super(); + } + + public PdeCoreUtilsRuntimeException(final String message) { + super(message); + } + + public PdeCoreUtilsRuntimeException(final Throwable cause) { + super(cause); + } + + public PdeCoreUtilsRuntimeException(final String message, final Throwable cause) { + super(message, cause); + } + +}
diff --git a/org.eclipse.modisco.facet.util.pde.core/src/org/eclipse/modisco/facet/util/pde/core/internal/exported/BuildPropertiesUtils.java b/org.eclipse.modisco.facet.util.pde.core/src/org/eclipse/modisco/facet/util/pde/core/internal/exported/BuildPropertiesUtils.java new file mode 100644 index 0000000..5c9030a --- /dev/null +++ b/org.eclipse.modisco.facet.util.pde.core/src/org/eclipse/modisco/facet/util/pde/core/internal/exported/BuildPropertiesUtils.java
@@ -0,0 +1,37 @@ +/******************************************************************************* + * Copyright (c) 2012 Mia-Software. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Gregoire Dupe (Mia-Software) - Bug 387470 - [EFacet][Custom] Editors + *******************************************************************************/ +package org.eclipse.modisco.facet.util.pde.core.internal.exported; + +import org.eclipse.core.resources.IFile; +import org.eclipse.core.runtime.CoreException; +import org.eclipse.pde.core.build.IBuildModel; +import org.eclipse.pde.core.plugin.IPluginModelBase; + +/** + * @since 0.3 + */ +public final class BuildPropertiesUtils { + + private BuildPropertiesUtils() { + // Must not be used + } + + public static void addToBuild(final IFile file) throws CoreException { + org.eclipse.modisco.facet.util.pde.core.internal.BuildPropertiesUtils + .addToBuild(file); + } + + public static IBuildModel getBuildModel(final IPluginModelBase model) + throws CoreException { + return org.eclipse.modisco.facet.util.pde.core.internal.BuildPropertiesUtils + .getBuildModel(model); + } +}
diff --git a/org.eclipse.modisco.facet.util.pde.core/src/org/eclipse/modisco/facet/util/pde/core/internal/exported/PluginUtils.java b/org.eclipse.modisco.facet.util.pde.core/src/org/eclipse/modisco/facet/util/pde/core/internal/exported/PluginUtils.java new file mode 100644 index 0000000..9544b37 --- /dev/null +++ b/org.eclipse.modisco.facet.util.pde.core/src/org/eclipse/modisco/facet/util/pde/core/internal/exported/PluginUtils.java
@@ -0,0 +1,73 @@ +/** + * Copyright (c) 2011 Mia-Software. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Grégoire Dupé (Soft-Maint) - Bug 387470 - [EFacet][Custom] Editors + */ +package org.eclipse.modisco.facet.util.pde.core.internal.exported; + +import java.io.IOException; + +import org.eclipse.core.resources.IFile; +import org.eclipse.core.resources.IProject; +import org.eclipse.core.runtime.CoreException; +import org.eclipse.core.runtime.IPath; +import org.eclipse.modisco.facet.util.core.internal.exported.IFilter; +import org.osgi.framework.Bundle; + +/** + * @since 0.4 + */ +public final class PluginUtils { + + private PluginUtils() { + // Must not be used. + } + + public static boolean isInPluginProject(final IPath path) + throws CoreException { + return org.eclipse.modisco.facet.util.pde.core.internal.PluginUtils + .isInPluginProject(path); + } + + public static void register(final IFile file, + final String extensionPointId, final String elementName) { + org.eclipse.modisco.facet.util.pde.core.internal.PluginUtils.register(file, + extensionPointId, elementName); + } + + public static boolean isRegistered(final IFile iFile, + final String extensionPointId) { + return org.eclipse.modisco.facet.util.pde.core.internal.PluginUtils + .isRegistered(iFile, extensionPointId); + } + + public static void configureAsPluginProject(final IProject project) + throws CoreException, IOException { + org.eclipse.modisco.facet.util.pde.core.internal.PluginUtils + .configureAsPluginProject(project); + } + + public static boolean isPluginProject(final IProject project) + throws CoreException { + return org.eclipse.modisco.facet.util.pde.core.internal.PluginUtils + .isPluginProject(project); + } + + public static IProject importPlugin(final Bundle bundle, + final IFilter<String> filter) throws CoreException { + return org.eclipse.modisco.facet.util.pde.core.internal.PluginUtils + .importPlugin(bundle, filter); + } + + public static IProject importPlugin(final Bundle bundle) + throws CoreException { + return org.eclipse.modisco.facet.util.pde.core.internal.PluginUtils + .importPlugin(bundle); + } +}
diff --git a/org.eclipse.modisco.facet.util.pde.core/src/org/eclipse/modisco/facet/util/pde/core/internal/exported/TargetPlatformUtils.java b/org.eclipse.modisco.facet.util.pde.core/src/org/eclipse/modisco/facet/util/pde/core/internal/exported/TargetPlatformUtils.java new file mode 100644 index 0000000..5f85e80 --- /dev/null +++ b/org.eclipse.modisco.facet.util.pde.core/src/org/eclipse/modisco/facet/util/pde/core/internal/exported/TargetPlatformUtils.java
@@ -0,0 +1,594 @@ +/******************************************************************************* + * Copyright (c) 2011, 2015 Soft-Maint, and Mia-Software. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Fabien Treguer (Soft-Maint) - Bug 418565 - [Unit Test Failure] Missing dependencies during tests, target platform creation and load + * Grégoire Dupé (Mia-Software) - Bug 468648 - TargetPlatformUtils.loadTargetPlatform: wrong number of arguments + ******************************************************************************/ +package org.eclipse.modisco.facet.util.pde.core.internal.exported; + +import java.io.File; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.InputStream; +import java.lang.reflect.Array; +import java.lang.reflect.Constructor; +import java.lang.reflect.Method; +import java.util.Arrays; +import java.util.Enumeration; +import java.util.Iterator; +import java.util.LinkedList; +import java.util.List; +import java.util.jar.JarEntry; +import java.util.jar.JarFile; +import java.util.jar.JarOutputStream; + +import org.eclipse.core.runtime.NullProgressMonitor; +import org.eclipse.core.runtime.Platform; +import org.eclipse.modisco.facet.util.pde.core.internal.Activator; +import org.eclipse.modisco.facet.util.pde.core.internal.exported.exception.PdeCoreUtilsException; +import org.eclipse.modisco.facet.util.pde.core.internal.exported.exception.ReflexiveDiscouragedAccessException; +import org.osgi.framework.Bundle; +import org.osgi.framework.Version; + +public final class TargetPlatformUtils { + + private static final String BUNDLE_SEPARATOR = ","; //$NON-NLS-1$ + private static final String JAR_EXT = ".jar"; //$NON-NLS-1$ + private static final String JAR_DIRECTORY = "jarFiles"; //$NON-NLS-1$ + private static final int BUFFER_SIZE = 4096; + private static final String BUNDLE_PREFIX = "reference:file:"; //$NON-NLS-1$ + private static final String FRAMEWORK_PREFIX = "file:"; //$NON-NLS-1$ + private static final String OSGI_PROP = "osgi.bundles"; //$NON-NLS-1$ + private static final String OSGI_PROP_FRK = "osgi.framework"; //$NON-NLS-1$ + private static final String ARRAY_PREFIX = "[L"; //$NON-NLS-1$ + + private TargetPlatformUtils() { + //Must not be used. + } + + /** + * Creates and loads a target platform with all needed bundles. + * @throws PdeCoreUtilsException + * @throws IOException + */ + public static void loadTargetPlatform() throws PdeCoreUtilsException { + String copyDirectoryPath; + try { + /*ITargetPlatformService*/ + final Object targetPlServ = reflexiveCall( + true, + "org.eclipse.pde.internal.core.target.TargetPlatformService", //$NON-NLS-1$ + "getDefault", //$NON-NLS-1$ + new Object[]{}); + /*ITargetDefinition*/ + final Object targetDefinition = reflexiveCall( + false, + targetPlServ, + "newTarget", //$NON-NLS-1$ + new Object[]{}); + copyDirectoryPath = Activator.getDefault().getStateLocation() + + File.separator + JAR_DIRECTORY; + + final File copyDirectory = new File(copyDirectoryPath); + copyDirectory.mkdirs(); + + final List<String> dirPaths = parseBundlesList(); + + /*IBundleContainer*/ + final Object[] dirContainers = + copyJarsAndGetContainers(dirPaths, copyDirectory); + reflexiveCall( + false, + targetDefinition, + getContainerSetterName(), + new Object[]{dirContainers}); + reflexiveCall( + false, + targetDefinition, + "resolve", //$NON-NLS-1$ + new Object[]{new NullProgressMonitor()}); + reflexiveCall( + true, + getLoadTargetDefinitionJobQualifiedName(), + "load", //$NON-NLS-1$ + new Object[]{targetDefinition}); + reflexiveCall( + false, + targetPlServ, + "saveTargetDefinition", //$NON-NLS-1$ + new Object[]{targetDefinition}); + } catch (Exception e) { + throw new PdeCoreUtilsException(e); + } + new File(copyDirectoryPath).delete(); + } + + private static boolean isHigherVersion() { + final Version version = new Version(3, 7, 1); + final Bundle bundle = Platform.getBundle("org.eclipse.pde.core"); //$NON-NLS-1$ + final Version currentVersion = bundle.getVersion(); + return currentVersion.compareTo(version) > 0; + } + + private static String getLoadTargetDefinitionJobQualifiedName() { + String lTDefJobName; + if (isHigherVersion()) { + lTDefJobName = + "org.eclipse.pde.core.target.LoadTargetDefinitionJob"; //$NON-NLS-1$ + } else { + lTDefJobName = + "org.eclipse.pde.internal.core.target.provisional.LoadTargetDefinitionJob"; //$NON-NLS-1$ + } + return lTDefJobName; + } + + private static String getContainerSetterName() { + String setterName; + if (isHigherVersion()) { + setterName = + "setTargetLocations"; //$NON-NLS-1$ + } else { + setterName = + "setBundleContainers"; //$NON-NLS-1$ + } + return setterName; + } + + /** + * Parses osgi.bundles property value to load all required bundles directories. + * @return List<String> array + * @throws PdeCoreUtilsException + * @throws IOException + */ + private static List<String> parseBundlesList() + throws PdeCoreUtilsException, IOException { + final LinkedList<String> result = new LinkedList<String>(); + final String bundlesFromConfig = System.getProperty(OSGI_PROP); + final String frwkFromConfig = System.getProperty(OSGI_PROP_FRK); + if (bundlesFromConfig != null && !"".equals(bundlesFromConfig)) { //$NON-NLS-1$ + final String[] bundlesStr = + bundlesFromConfig.split(BUNDLE_SEPARATOR); + result.addAll(trimPaths(bundlesStr, BUNDLE_PREFIX)); + } + if (frwkFromConfig != null && !"".equals(frwkFromConfig)) { //$NON-NLS-1$ + final String[] frameworkStr = + frwkFromConfig.split(BUNDLE_SEPARATOR); + result.addAll(trimPaths(frameworkStr, FRAMEWORK_PREFIX)); + } + return result; + } + + /** + * Returns list of trimmed paths; + * @param paths String[] + * @param prefix String + * @return List<String> + */ + private static List<String> trimPaths(final String[] paths, + final String prefix) { + final LinkedList<String> result = new LinkedList<String>(); + for (String path : paths) { + int indexSuffix = path.indexOf("@"); //$NON-NLS-1$ + if (indexSuffix < 0) { + indexSuffix = path.length(); + } + result.add(path.substring(prefix.length(), + indexSuffix)); + } + return result; + } + + /** + * Reflexive call of DirectoryBundleContainer constructor. + * @param containerPath String + * @return Object + * @throws PdeCoreUtilsException + */ + private static Object newDirectoryBundleContainer( + final String containerPath) + throws PdeCoreUtilsException { + Object container = null; + try { + final Bundle bundle = Activator.getDefault().getBundle(); + final Class<?> classs = + bundle.loadClass("org.eclipse.pde.internal.core.target.DirectoryBundleContainer"); //$NON-NLS-1$ + final Class<?>[] paramTypes = new Class[] {containerPath.getClass()}; + final Constructor<?> constructor = classs.getConstructor(paramTypes); + final Object[] initargs = new Object[] { containerPath }; + container = constructor.newInstance(initargs); + } catch (Exception e) { + throw new PdeCoreUtilsException(e); + } + return container; + } + + /** + * Copies all needed jar files in a directory and returns set of containers. + * @param bundlesStr List<String> + * @param copyDirectory File + * @return Object[] + * @throws PdeCoreUtilsException + * @throws IOException + */ + private static Object[] copyJarsAndGetContainers( + final List<String> bundlesStr, final File copyDirectory) + throws PdeCoreUtilsException, IOException { + final List<Object> bundleContainers = new LinkedList<Object>(); + final Iterator<String> bundlesStrIter = bundlesStr.iterator(); + while (bundlesStrIter.hasNext()) { + final File bundleFile = new File(bundlesStrIter.next()); // NOPMD + // NOPMD: gdupe> No other way to write this code + if (bundleFile.exists()) { + if (bundleFile.isDirectory()) { + copyJarFileOrAddContainerDirectory(bundleFile, + bundleContainers, copyDirectory); + } else { + try { + //FIXME gdupe> is a call to close() required ? + final JarFile jarFile = new JarFile(bundleFile); // NOPMD + // NOPMD: gdupe> No other way to write this code + copyJarFile(jarFile, copyDirectory); + } catch (IOException e) { + throw new PdeCoreUtilsException(e); + } + } + } + } + final Object copyDirContainer = + newDirectoryBundleContainer(copyDirectory.getAbsolutePath()); + bundleContainers.add(copyDirContainer); + return bundleContainers.toArray(); + } + + /** + * Copies jarFile to the specified directory or creates a container + * if bundleFile is a directory. + * @param bundleFile File + * @param bundleContainers List<Object> + * @param copyDirectory File + * @throws PdeCoreUtilsException + * @throws IOException + */ + private static void copyJarFileOrAddContainerDirectory( + final File bundleFile, final List<Object> bundleContainers, + final File copyDirectory) + throws PdeCoreUtilsException, IOException { + Object container; + //FIXME gdupe> is a call to close() required ? + final JarFile jarFile = getFirstMatchingJarFile(bundleFile); + if (jarFile == null) { + container = newDirectoryBundleContainer(bundleFile.getAbsolutePath()); + bundleContainers.add(container); + } else { + copyJarFile(jarFile, copyDirectory); + } + } + + /** + * Return first jar file that match with the bundle directory. + * @param bundleFile File + * @return JarFile + * @throws IOException + */ + private static JarFile getFirstMatchingJarFile(final File bundleFile) + throws IOException { + JarFile result = null; + if (bundleFile.exists() && bundleFile.isDirectory()) { + final String bundleFileName = bundleFile.getName(); + final File jar = findJarFile(bundleFile, bundleFileName); + if (jar != null) { + result = new JarFile(jar); + } + } + return result; + } + + /** + * Search jar file in directory and sub-directories. + * @param directory File + * @param fileName String + * @return File + */ + private static File findJarFile(final File directory, + final String fileName) { + final File[] children = directory.listFiles(); + final LinkedList<File> toVisit = new LinkedList<File>(); + int cpt = 0; + File foundFile = null; + String childName; + while (foundFile != null && cpt < children.length) { + final File child = children[cpt]; + if (child.isFile()) { + childName = child.getName(); + if (childName.startsWith(fileName) + && childName.endsWith(JAR_EXT)) { + foundFile = child; + } + } else { + toVisit.add(child); + } + cpt++; + } + if (foundFile == null) { + foundFile = searchInSubDirectories(fileName, toVisit); + } + return foundFile; + } + + /** + * Search jar file and sub-directories. + * @param fileName String + * @param toVisit List<File> + * @return File + */ + private static File searchInSubDirectories(final String fileName, + final List<File> toVisit) { + File result = null; + final Iterator<File> childrenIterator = toVisit.iterator(); + while (childrenIterator.hasNext() && result != null) { + final File child = childrenIterator.next(); + result = findJarFile(child.getAbsoluteFile(), fileName); + } + return result; + } + + + /** + * Copies a jarFile into specified directory. + * @param jarFile JarFile + * @param copyTo File + * @throws PdeCoreUtilsException + */ + private static void copyJarFile(final JarFile jarFile, final File copyTo) + throws PdeCoreUtilsException { + final String fileName = jarFile.getName(); + final String bundleName = fileName.substring(fileName + .lastIndexOf(File.separator)); + final File copyToDirectory = new File(copyTo, bundleName); + JarOutputStream jarOutputStream = null; + try { + jarOutputStream = new JarOutputStream( + new FileOutputStream(copyToDirectory)); + final Enumeration<JarEntry> jarFileEntries = jarFile.entries(); + final byte[] buffer = new byte[BUFFER_SIZE]; + while (jarFileEntries.hasMoreElements()) { + final JarEntry sourceEntry = jarFileEntries.nextElement(); + final InputStream inputStream = + jarFile.getInputStream(sourceEntry); + final JarEntry targetEntry = + new JarEntry(sourceEntry.getName()); // NOPMD + // ftreguer> NOPMD This loop has to create one jar entry for + // each loop iteration + jarOutputStream.putNextEntry(targetEntry); + int bytesRead = inputStream.read(buffer); + while (bytesRead != -1) { + jarOutputStream.write(buffer, 0, bytesRead); + bytesRead = inputStream.read(buffer); + } + inputStream.close(); + jarOutputStream.flush(); + jarOutputStream.closeEntry(); + } + } catch (IOException e) { + throw new PdeCoreUtilsException(e); + } finally { // NOPMD gdupe> No other choice if I want to managed the + // stream closing + if (jarOutputStream != null) { + try { + jarOutputStream.close(); + } catch (IOException e) { + throw new PdeCoreUtilsException(e); + } + } + } + } + + /** + * Calls a method reflexively on an object or a class (static call) with + * specified arguments. + * @param staticCall boolean + * @param callOn Object + * @param calledMethodName String + * @param args Object[] + * @throws ExpException + */ + private static Object reflexiveCall(final boolean staticCall, + final Object callOn, final String calledMethodName, + final Object[] args) throws ReflexiveDiscouragedAccessException { + Object result = null; + Method aMethod = null; + final Class<?>[] classes = getClassesFromArgs(args); + try { + if (staticCall) { + // ftreguer> Static Call, the second parameter should be a + // String representing Class name. + if (callOn instanceof String) { + final Class<?> clazz = Activator.getDefault() + .getBundle().loadClass((String) callOn); + aMethod = getMethod(clazz, calledMethodName, classes); + } else { + throw new ReflexiveDiscouragedAccessException( + "Invalid parameter, callOn parameter should be a String. (Static Call)"); //$NON-NLS-1$ + } + } else { + aMethod = getMethod(callOn.getClass(), + calledMethodName, classes); + } + if (aMethod == null) { + String staticStr = ""; //$NON-NLS-1$ + if (staticCall) { + staticStr = "static"; //$NON-NLS-1$ + } + final String message = String.format( + "No method with specified arguments found. API break ? Loking for : %s %s.%s(%s)", //$NON-NLS-1$ + staticStr, + callOn.toString(), + calledMethodName, + Arrays.toString(args) + ); + throw new ReflexiveDiscouragedAccessException(message); + } + result = aMethod.invoke(callOn, manageArguments(args)); + } catch (Exception e) { + String message = calledMethodName; + if (aMethod != null) { + message = String.format("Failed to call %s", aMethod.toString()); //$NON-NLS-1$ + } + throw new ReflexiveDiscouragedAccessException(message, e); + } + return result; + } + + + /** + * Transforms Object arrays to specific arrays. + * @param arguments Object[] + * @return Object[] + */ + private static Object[] manageArguments(final Object[] arguments) { + Object[] result; + if (arguments != null && arguments.length > 0) { + result = new Object[arguments.length]; + Object arg; + for (int i = 0; i < arguments.length; i++) { + arg = arguments[i]; + if (isArray(arg)) { + final Object argElement = ((Object[]) arg)[0]; + final int arraySize = Array.getLength(arg); + Object[] argTmp = (Object[]) Array.newInstance( + argElement.getClass(), arraySize); + for (int y = 0; y < arraySize; y++) { + argTmp[y] = ((Object[]) arg)[y]; + } + result[i] = argTmp; + } else { + result[i] = arg; + } + } + } else { + result = arguments; + } + return result; + } + + /** + * Returns true if the parameter represents an array. + * @param obj Object + * @return boolean + */ + private static boolean isArray(final Object obj) { + return obj.getClass().getName().startsWith(ARRAY_PREFIX); + } + + /** + * Returns array of Class that represents types of each arguments. + * @param args Object[] + * @return Class<?>[] + */ + private static Class<?>[] getClassesFromArgs(final Object[] args) { + Class<?>[] classes = null; + if (args != null) { + classes = new Class[args.length]; + Object arg = null; + for (int i = 0; i < args.length; i++) { + arg = args[i]; + if (arg != null) { + if (isArray(arg)) { + arg = ((Object[]) arg)[0]; + arg = Array.newInstance(arg.getClass(), 0); + } + classes[i] = arg.getClass(); + } + } + } + return classes; + } + + /** + * Returns a Method object that correspond to the specified name + * and parameters. + * @param clazz Class<?> + * @param methodName String + * @param parameterTypes Class<?>[] + * @return Method + * @throws ClassNotFoundException + */ + private static Method getMethod(final Class<?> clazz, + final String methodName, final Class<?>... parameterTypes) + throws ClassNotFoundException { + Method result = null; + final Method[] methods = clazz.getMethods(); + for (Method method : methods) { + if (methodName.equals(method.getName())) { + final Class<?>[] parameters = method.getParameterTypes(); + if (checkTypes(parameters, parameterTypes)) { + result = method; + break; + } + } + } + return result; + } + + /** + * Checks if all parameters are the same in both arrays. + * @param refParams + * @param parameterToTest + * @return boolean + * @throws ClassNotFoundException + */ + private static boolean checkTypes(final Class<?>[] refParams, + final Class<?>[] parameterToTest) throws ClassNotFoundException { + boolean result = false; + if (refParams.length == parameterToTest.length) { + if (refParams.length == 0) { + result = true; + } + String refClazzName = null; + String clazzName = null; + for (int i = 0; i < parameterToTest.length; i++) { + refClazzName = refParams[i].getName(); + clazzName = parameterToTest[i].getName(); + if (!clazzName.equals(refClazzName)) { + final boolean isRefArray = refClazzName + .startsWith(ARRAY_PREFIX); + final boolean isParamArray = clazzName + .startsWith(ARRAY_PREFIX); + if (isRefArray == isParamArray) { + if (isRefArray) { + refClazzName = refClazzName + .substring(ARRAY_PREFIX.length(), + refClazzName.length() - 1); + clazzName = clazzName + .substring(ARRAY_PREFIX.length(), + clazzName.length() - 1); + } + result = paramExtendsRef(refClazzName, clazzName); + } + } + } + } + return result; + } + + /** + * Returns true if className is a SubType of refClassName. + * @param refClassName String + * @param className String + * @return boolean + * @throws ClassNotFoundException + */ + private static boolean paramExtendsRef(final String refClassName, + final String className) throws ClassNotFoundException { + final Bundle bundle = Activator.getDefault().getBundle(); + final Class<?> refClazz = bundle.loadClass(refClassName); + final Class<?> clazz = bundle.loadClass(className); + return refClazz.isAssignableFrom(clazz); + } + +}
diff --git a/org.eclipse.modisco.facet.util.pde.core/src/org/eclipse/modisco/facet/util/pde/core/internal/exported/exception/PdeCoreUtilsException.java b/org.eclipse.modisco.facet.util.pde.core/src/org/eclipse/modisco/facet/util/pde/core/internal/exported/exception/PdeCoreUtilsException.java new file mode 100644 index 0000000..2204f79 --- /dev/null +++ b/org.eclipse.modisco.facet.util.pde.core/src/org/eclipse/modisco/facet/util/pde/core/internal/exported/exception/PdeCoreUtilsException.java
@@ -0,0 +1,33 @@ +/******************************************************************************* + * Copyright (c) 2013 Soft-Maint. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Fabien Treguer (Soft-Maint) - Bug 418565 - [Unit Test Failure] Missing dependencies during tests, target platform creation and load + ******************************************************************************/ +package org.eclipse.modisco.facet.util.pde.core.internal.exported.exception; + +public class PdeCoreUtilsException extends Exception { + + private static final long serialVersionUID = -7462304304846835284L; + + public PdeCoreUtilsException() { + super(); + } + + public PdeCoreUtilsException(final String message) { + super(message); + } + + public PdeCoreUtilsException(final Throwable cause) { + super(cause); + } + + public PdeCoreUtilsException(final String message, final Throwable cause) { + super(message, cause); + } + +}
diff --git a/org.eclipse.modisco.facet.util.pde.core/src/org/eclipse/modisco/facet/util/pde/core/internal/exported/exception/ReflexiveDiscouragedAccessException.java b/org.eclipse.modisco.facet.util.pde.core/src/org/eclipse/modisco/facet/util/pde/core/internal/exported/exception/ReflexiveDiscouragedAccessException.java new file mode 100644 index 0000000..15e7d99 --- /dev/null +++ b/org.eclipse.modisco.facet.util.pde.core/src/org/eclipse/modisco/facet/util/pde/core/internal/exported/exception/ReflexiveDiscouragedAccessException.java
@@ -0,0 +1,33 @@ +/******************************************************************************* + * Copyright (c) 2013 Soft-Maint. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Fabien Treguer (Soft-Maint) - Bug 418565 - [Unit Test Failure] Missing dependencies during tests, target platform creation and load + ******************************************************************************/ +package org.eclipse.modisco.facet.util.pde.core.internal.exported.exception; + +public class ReflexiveDiscouragedAccessException extends Exception { + + private static final long serialVersionUID = -7462304304846835284L; + + public ReflexiveDiscouragedAccessException() { + super(); + } + + public ReflexiveDiscouragedAccessException(final String message) { + super(message); + } + + public ReflexiveDiscouragedAccessException(final Throwable cause) { + super(cause); + } + + public ReflexiveDiscouragedAccessException(final String message, final Throwable cause) { + super(message, cause); + } + +}
diff --git a/org.eclipse.modisco.facet.util.swt/META-INF/MANIFEST.MF b/org.eclipse.modisco.facet.util.swt/META-INF/MANIFEST.MF index 71218ee..8b30872 100644 --- a/org.eclipse.modisco.facet.util.swt/META-INF/MANIFEST.MF +++ b/org.eclipse.modisco.facet.util.swt/META-INF/MANIFEST.MF
@@ -3,7 +3,7 @@ Bundle-Name: %Bundle-Name Bundle-SymbolicName: org.eclipse.emf.facet.util.swt;singleton:=true Bundle-Version: 1.3.0.qualifier -Bundle-Activator: org.eclipse.emf.facet.util.swt.internal.Activator +Bundle-Activator: org.eclipse.modisco.facet.util.swt.internal.Activator Bundle-Vendor: %Bundle-Vendor Require-Bundle: org.eclipse.core.runtime, org.eclipse.swt;bundle-version="3.6.0", @@ -11,13 +11,13 @@ org.eclipse.emf.facet.util.core;bundle-version="0.3.0" Bundle-RequiredExecutionEnvironment: JavaSE-1.8 Bundle-ActivationPolicy: lazy -Export-Package: org.eclipse.emf.facet.util.swt.colorprovider, - org.eclipse.emf.facet.util.swt.fontprovider, - org.eclipse.emf.facet.util.swt.imageprovider, - org.eclipse.emf.facet.util.swt.internal.exported; +Export-Package: org.eclipse.modisco.facet.util.swt.colorprovider, + org.eclipse.modisco.facet.util.swt.fontprovider, + org.eclipse.modisco.facet.util.swt.imageprovider, + org.eclipse.modisco.facet.util.swt.internal.exported; x-friends:="org.eclipse.emf.facet.aggregate.tests, org.eclipse.emf.facet.efacet.tests, org.eclipse.emf.facet.custom.tests, org.eclipse.emf.facet.widgets.table.tests, - org.eclipse.emf.facet.util.emf.ui.tests + org.eclipse.emf.facet.util.emf.ui.tests" Automatic-Module-Name: org.eclipse.emf.facet.util.swt
diff --git a/org.eclipse.modisco.facet.util.swt/src/org/eclipse/emf/facet/util/swt/colorprovider/IColorProvider.java b/org.eclipse.modisco.facet.util.swt/src/org/eclipse/emf/facet/util/swt/colorprovider/IColorProvider.java deleted file mode 100644 index e8bcd2f..0000000 --- a/org.eclipse.modisco.facet.util.swt/src/org/eclipse/emf/facet/util/swt/colorprovider/IColorProvider.java +++ /dev/null
@@ -1,22 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2013 Mia-Software. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Grégoire Dupé (Mia-Software) - Bug 424122 - [Table] Images, fonts and colors are not shared between the instances of table - ******************************************************************************/ - -package org.eclipse.emf.facet.util.swt.colorprovider; - -import org.eclipse.swt.graphics.Color; -import org.eclipse.swt.graphics.RGB; - -public interface IColorProvider { - - Color getColor(RGB path); - -}
diff --git a/org.eclipse.modisco.facet.util.swt/src/org/eclipse/emf/facet/util/swt/colorprovider/IColorProviderFactory.java b/org.eclipse.modisco.facet.util.swt/src/org/eclipse/emf/facet/util/swt/colorprovider/IColorProviderFactory.java deleted file mode 100644 index d1585a5..0000000 --- a/org.eclipse.modisco.facet.util.swt/src/org/eclipse/emf/facet/util/swt/colorprovider/IColorProviderFactory.java +++ /dev/null
@@ -1,22 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2013 Mia-Software. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Grégoire Dupé (Mia-Software) - Bug 424122 - [Table] Images, fonts and colors are not shared between the instances of table - ******************************************************************************/ -package org.eclipse.emf.facet.util.swt.colorprovider; - -import org.eclipse.emf.facet.util.swt.internal.colorprovider.ColorProviderFactory; -import org.eclipse.swt.graphics.Device; - -public interface IColorProviderFactory { - - IColorProviderFactory DEFAULT = new ColorProviderFactory(); - - IColorProvider getOrCreateIColorProvider(Device device); -}
diff --git a/org.eclipse.modisco.facet.util.swt/src/org/eclipse/emf/facet/util/swt/fontprovider/IFontProvider.java b/org.eclipse.modisco.facet.util.swt/src/org/eclipse/emf/facet/util/swt/fontprovider/IFontProvider.java deleted file mode 100644 index e9299f3..0000000 --- a/org.eclipse.modisco.facet.util.swt/src/org/eclipse/emf/facet/util/swt/fontprovider/IFontProvider.java +++ /dev/null
@@ -1,22 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2013 Mia-Software. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Grégoire Dupé (Mia-Software) - Bug 424122 - [Table] Images, fonts and colors are not shared between the instances of table - ******************************************************************************/ - -package org.eclipse.emf.facet.util.swt.fontprovider; - -import org.eclipse.swt.graphics.Font; -import org.eclipse.swt.graphics.FontData; - -public interface IFontProvider { - - Font getFont(FontData fontData); - -}
diff --git a/org.eclipse.modisco.facet.util.swt/src/org/eclipse/emf/facet/util/swt/fontprovider/IFontProviderFactory.java b/org.eclipse.modisco.facet.util.swt/src/org/eclipse/emf/facet/util/swt/fontprovider/IFontProviderFactory.java deleted file mode 100644 index e4d3117..0000000 --- a/org.eclipse.modisco.facet.util.swt/src/org/eclipse/emf/facet/util/swt/fontprovider/IFontProviderFactory.java +++ /dev/null
@@ -1,22 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2013 Mia-Software. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Grégoire Dupé (Mia-Software) - Bug 424122 - [Table] Images, fonts and colors are not shared between the instances of table - ******************************************************************************/ -package org.eclipse.emf.facet.util.swt.fontprovider; - -import org.eclipse.emf.facet.util.swt.internal.fontprovider.FontProviderFactory; -import org.eclipse.swt.graphics.Device; - -public interface IFontProviderFactory { - - IFontProviderFactory DEFAULT = new FontProviderFactory(); - - IFontProvider getOrCreateIFontProvider(Device device); -}
diff --git a/org.eclipse.modisco.facet.util.swt/src/org/eclipse/emf/facet/util/swt/imageprovider/IImageProvider.java b/org.eclipse.modisco.facet.util.swt/src/org/eclipse/emf/facet/util/swt/imageprovider/IImageProvider.java deleted file mode 100644 index e0b1a34..0000000 --- a/org.eclipse.modisco.facet.util.swt/src/org/eclipse/emf/facet/util/swt/imageprovider/IImageProvider.java +++ /dev/null
@@ -1,27 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2013 Mia-Software. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Gregoire Dupe (Mia-Software) - Bug 406569 - Image provider factory - * Gregoire Dupe (Mia-Software) - Bug 424122 - [Table] Images, fonts and colors are not shared between the instances of table - ******************************************************************************/ - -package org.eclipse.emf.facet.util.swt.imageprovider; - -import org.eclipse.jface.resource.ImageDescriptor; -import org.eclipse.swt.graphics.Image; - -public interface IImageProvider { - - Image getImage(String path); - - ImageDescriptor createImageDescriptor(String resourcePath); - - Image getImage(ImageDescriptor imgDescriptor); - -}
diff --git a/org.eclipse.modisco.facet.util.swt/src/org/eclipse/emf/facet/util/swt/imageprovider/IImageProviderFactory.java b/org.eclipse.modisco.facet.util.swt/src/org/eclipse/emf/facet/util/swt/imageprovider/IImageProviderFactory.java deleted file mode 100644 index 05f2cdf..0000000 --- a/org.eclipse.modisco.facet.util.swt/src/org/eclipse/emf/facet/util/swt/imageprovider/IImageProviderFactory.java +++ /dev/null
@@ -1,22 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2013 Mia-Software. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Gregoire Dupe (Mia-Software) - Bug 406569 - Image provider factory - ******************************************************************************/ -package org.eclipse.emf.facet.util.swt.imageprovider; - -import org.eclipse.core.runtime.Plugin; -import org.eclipse.emf.facet.util.swt.internal.imageprovider.ImageProviderFactory; - -public interface IImageProviderFactory { - - IImageProviderFactory DEFAULT = new ImageProviderFactory(); - - IImageProvider createIImageProvider(Plugin plugin); -}
diff --git a/org.eclipse.modisco.facet.util.swt/src/org/eclipse/emf/facet/util/swt/internal/Activator.java b/org.eclipse.modisco.facet.util.swt/src/org/eclipse/emf/facet/util/swt/internal/Activator.java deleted file mode 100644 index 51807fb..0000000 --- a/org.eclipse.modisco.facet.util.swt/src/org/eclipse/emf/facet/util/swt/internal/Activator.java +++ /dev/null
@@ -1,45 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2012 CEA LIST. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Nicolas Bros (Mia-Software) - Bug 372865 - FacetSet selection dialog - *******************************************************************************/ -package org.eclipse.emf.facet.util.swt.internal; - -import org.eclipse.core.runtime.Plugin; -import org.osgi.framework.BundleContext; - -/** The activator class controls the plug-in life cycle */ -public class Activator extends Plugin { - - // The plug-in ID - public static final String PLUGIN_ID = "org.eclipse.emf.facet.util.swt"; //$NON-NLS-1$ - - // The shared instance - private static Activator plugin; - - @Override - public void start(final BundleContext context) throws Exception { - super.start(context); - Activator.plugin = this; - } - - @Override - public void stop(final BundleContext context) throws Exception { - Activator.plugin = null; - super.stop(context); - } - - /** - * Returns the shared instance - * - * @return the shared instance - */ - public static Activator getDefault() { - return Activator.plugin; - } -}
diff --git a/org.eclipse.modisco.facet.util.swt/src/org/eclipse/emf/facet/util/swt/internal/colorprovider/ColorProvider.java b/org.eclipse.modisco.facet.util.swt/src/org/eclipse/emf/facet/util/swt/internal/colorprovider/ColorProvider.java deleted file mode 100644 index 776e58a..0000000 --- a/org.eclipse.modisco.facet.util.swt/src/org/eclipse/emf/facet/util/swt/internal/colorprovider/ColorProvider.java +++ /dev/null
@@ -1,40 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2013 Mia-Software. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Grégoire Dupé (Mia-Software) - Bug 424122 - [Table] Images, fonts and colors are not shared between the instances of table - ******************************************************************************/ -package org.eclipse.emf.facet.util.swt.internal.colorprovider; - -import java.util.HashMap; -import java.util.Map; - -import org.eclipse.emf.facet.util.swt.colorprovider.IColorProvider; -import org.eclipse.swt.graphics.Color; -import org.eclipse.swt.graphics.Device; -import org.eclipse.swt.graphics.RGB; - -public class ColorProvider implements IColorProvider { - - private Map<RGB, Color> cash = new HashMap<RGB, Color>(); - private Device device; - - public ColorProvider(final Device device) { - this.device = device; - } - - public Color getColor(final RGB rgb) { - Color result = this.cash.get(rgb); - if (result == null) { - result = new Color(this.device, rgb); - this.cash.put(rgb, result); - } - return result; - } - -}
diff --git a/org.eclipse.modisco.facet.util.swt/src/org/eclipse/emf/facet/util/swt/internal/colorprovider/ColorProviderFactory.java b/org.eclipse.modisco.facet.util.swt/src/org/eclipse/emf/facet/util/swt/internal/colorprovider/ColorProviderFactory.java deleted file mode 100644 index 1e1b2f7..0000000 --- a/org.eclipse.modisco.facet.util.swt/src/org/eclipse/emf/facet/util/swt/internal/colorprovider/ColorProviderFactory.java +++ /dev/null
@@ -1,34 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2013 Mia-Software. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Grégoire Dupé (Mia-Software) - Bug 424122 - [Table] Images, fonts and colors are not shared between the instances of table - ******************************************************************************/ -package org.eclipse.emf.facet.util.swt.internal.colorprovider; - -import java.util.HashMap; -import java.util.Map; - -import org.eclipse.emf.facet.util.swt.colorprovider.IColorProvider; -import org.eclipse.emf.facet.util.swt.colorprovider.IColorProviderFactory; -import org.eclipse.swt.graphics.Device; - -public class ColorProviderFactory implements IColorProviderFactory { - - private Map<Device, IColorProvider> cash = new HashMap<Device, IColorProvider>(); - - public IColorProvider getOrCreateIColorProvider(final Device device) { - IColorProvider result = this.cash.get(device); - if (result == null) { - result = new ColorProvider(device); - this.cash.put(device, result); - } - return result; - } - -}
diff --git a/org.eclipse.modisco.facet.util.swt/src/org/eclipse/emf/facet/util/swt/internal/exported/SWTTestUtils.java b/org.eclipse.modisco.facet.util.swt/src/org/eclipse/emf/facet/util/swt/internal/exported/SWTTestUtils.java deleted file mode 100644 index 6f939d7..0000000 --- a/org.eclipse.modisco.facet.util.swt/src/org/eclipse/emf/facet/util/swt/internal/exported/SWTTestUtils.java +++ /dev/null
@@ -1,65 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2012, 2015 CEA LIST, and Mia-Software. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Nicolas Bros (Mia-Software) - Bug 372865 - FacetSet selection dialog - * Grégoire Dupé (Mia-Software) - Bug 470191 - [Unit Test Failure] org.eclipse.emf.facet.aggregate.tests.internal.CustomizationsCatalogViewTests.testCustomizationsView - *******************************************************************************/ -package org.eclipse.emf.facet.util.swt.internal.exported; - -import org.eclipse.swt.widgets.Tree; -import org.eclipse.swt.widgets.TreeItem; - -public final class SWTTestUtils { - private SWTTestUtils() { - // utility class - } - - /** - * Find a tree item with the given text among the list of tree items. - * - * @param text - * the text of the tree item to find - * @param items - * the list of tree items to search - * @return the tree item or <code>null</code> if not found - */ - public static TreeItem findTreeItem(final String text, final TreeItem[] items) { - TreeItem result = null; - for (TreeItem item : items) { - if (text.equals(item.getText())) { - result = item; - } - } - return result; - } - - public static TreeItem findRootTreeItem(final String text, final Tree tree) { - TreeItem result = null; - int nbItems = tree.getItemCount(); - for (int i = 0; i < nbItems; i++) { - final TreeItem treeItem = tree.getItem(i); - final String itemText = treeItem.getText(); - if (text.equals(itemText)) { - result = treeItem; - break; - } - } - return result; - } - - public static String itemsStr(final TreeItem[] items) { - final StringBuffer strBuffer = new StringBuffer(); - for (TreeItem item : items) { - if (strBuffer.length() > 0) { - strBuffer.append(", "); //$NON-NLS-1$ - } - strBuffer.append(item.getText()); - } - return strBuffer.toString(); - } -}
diff --git a/org.eclipse.modisco.facet.util.swt/src/org/eclipse/emf/facet/util/swt/internal/exported/TestUtils.java b/org.eclipse.modisco.facet.util.swt/src/org/eclipse/emf/facet/util/swt/internal/exported/TestUtils.java deleted file mode 100644 index 2400db1..0000000 --- a/org.eclipse.modisco.facet.util.swt/src/org/eclipse/emf/facet/util/swt/internal/exported/TestUtils.java +++ /dev/null
@@ -1,46 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2012 Mia-Software. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Nicolas Bros (Mia-Software) - Bug 378475 - unit test failures after table refactoring - *******************************************************************************/ -package org.eclipse.emf.facet.util.swt.internal.exported; - -import org.eclipse.swt.widgets.Display; -import org.eclipse.ui.IViewPart; -import org.eclipse.ui.IWorkbenchPart; -import org.eclipse.ui.PlatformUI; -import org.eclipse.ui.part.IntroPart; - -public final class TestUtils { - - private TestUtils() { - // utility class - } - - public static void closeWelcomePage() { - Display.getDefault().syncExec(new Runnable() { - public void run() { - IWorkbenchPart activePart = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActivePart(); - if (activePart != null) { - IntroPart adapter = (IntroPart) activePart.getAdapter(IntroPart.class); - if (adapter != null) { - PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().hideView((IViewPart) activePart); - } - } - } - }); - } - - public static void closeAllEditors() { - Display.getDefault().syncExec(new Runnable() { - public void run() { - PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().closeAllEditors(false); - } - }); - } -}
diff --git a/org.eclipse.modisco.facet.util.swt/src/org/eclipse/emf/facet/util/swt/internal/fontprovider/FontProvider.java b/org.eclipse.modisco.facet.util.swt/src/org/eclipse/emf/facet/util/swt/internal/fontprovider/FontProvider.java deleted file mode 100644 index cb3eb17..0000000 --- a/org.eclipse.modisco.facet.util.swt/src/org/eclipse/emf/facet/util/swt/internal/fontprovider/FontProvider.java +++ /dev/null
@@ -1,40 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2013 Mia-Software. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Grégoire Dupé (Mia-Software) - Bug 424122 - [Table] Images, fonts and colors are not shared between the instances of table - ******************************************************************************/ -package org.eclipse.emf.facet.util.swt.internal.fontprovider; - -import java.util.HashMap; -import java.util.Map; - -import org.eclipse.emf.facet.util.swt.fontprovider.IFontProvider; -import org.eclipse.swt.graphics.Device; -import org.eclipse.swt.graphics.Font; -import org.eclipse.swt.graphics.FontData; - -public class FontProvider implements IFontProvider { - - private Map<FontData, Font> cash = new HashMap<FontData, Font>(); - private Device device; - - public FontProvider(final Device device) { - this.device = device; - } - - public Font getFont(final FontData fontData) { - Font result = this.cash.get(fontData); - if (result == null) { - result = new Font(this.device, fontData); - this.cash.put(fontData, result); - } - return result; - } - -}
diff --git a/org.eclipse.modisco.facet.util.swt/src/org/eclipse/emf/facet/util/swt/internal/fontprovider/FontProviderFactory.java b/org.eclipse.modisco.facet.util.swt/src/org/eclipse/emf/facet/util/swt/internal/fontprovider/FontProviderFactory.java deleted file mode 100644 index 822b280..0000000 --- a/org.eclipse.modisco.facet.util.swt/src/org/eclipse/emf/facet/util/swt/internal/fontprovider/FontProviderFactory.java +++ /dev/null
@@ -1,34 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2013 Mia-Software. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Grégoire Dupé (Mia-Software) - Bug 424122 - [Table] Images, fonts and colors are not shared between the instances of table - ******************************************************************************/ -package org.eclipse.emf.facet.util.swt.internal.fontprovider; - -import java.util.HashMap; -import java.util.Map; - -import org.eclipse.emf.facet.util.swt.fontprovider.IFontProvider; -import org.eclipse.emf.facet.util.swt.fontprovider.IFontProviderFactory; -import org.eclipse.swt.graphics.Device; - -public class FontProviderFactory implements IFontProviderFactory { - - private Map<Device, IFontProvider> cash = new HashMap<Device, IFontProvider>(); - - public IFontProvider getOrCreateIFontProvider(final Device device) { - IFontProvider result = this.cash.get(device); - if (result == null) { - result = new FontProvider(device); - this.cash.put(device, result); - } - return result; - } - -}
diff --git a/org.eclipse.modisco.facet.util.swt/src/org/eclipse/emf/facet/util/swt/internal/imageprovider/ImageProvider.java b/org.eclipse.modisco.facet.util.swt/src/org/eclipse/emf/facet/util/swt/internal/imageprovider/ImageProvider.java deleted file mode 100644 index 8993086..0000000 --- a/org.eclipse.modisco.facet.util.swt/src/org/eclipse/emf/facet/util/swt/internal/imageprovider/ImageProvider.java +++ /dev/null
@@ -1,95 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2013, 2015 Mia-Software. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Grégoire Dupé (Mia-Software) - Bug 406569 - Image provider factory - * Grégoire Dupé (Mia-Software) - Bug 423611 - ImageProvider doesn't use singleton instance - * Grégoire Dupé (Mia-Software) - Bug 424122 - [Table] Images, fonts and colors are not shared between the instances of table - * Grégoire Dupé (Mia-Software) - Bug 478270 - Error message are missing ImageProvider - ******************************************************************************/ - -package org.eclipse.emf.facet.util.swt.internal.imageprovider; - -import java.net.URL; -import java.util.HashMap; -import java.util.Map; - -import org.eclipse.core.runtime.Plugin; -import org.eclipse.emf.facet.util.core.DebugUtils; -import org.eclipse.emf.facet.util.core.Logger; -import org.eclipse.emf.facet.util.swt.imageprovider.IImageProvider; -import org.eclipse.emf.facet.util.swt.internal.Activator; -import org.eclipse.jface.resource.ImageDescriptor; -import org.eclipse.osgi.util.NLS; -import org.eclipse.swt.graphics.Image; -import org.osgi.framework.Bundle; - -public final class ImageProvider implements IImageProvider { - - private static final boolean DEBUG = DebugUtils.getDebugStatus(Activator.getDefault()); - private final Map<Object, Image> map = new HashMap<Object, Image>(); - private final Plugin activator; - - /** - * @param activator must not be null. - */ - ImageProvider(final Plugin activator) { - if (activator == null) { - throw new IllegalArgumentException("The parameter 'activator' must no be null"); //$NON-NLS-1$ - } - this.activator = activator; - } - - public ImageDescriptor createImageDescriptor(final String resourcePath) { - ImageDescriptor result; - final Bundle bundle = this.activator.getBundle(); - final URL url = bundle.getResource(resourcePath); - if (url == null) { - final String message = NLS.bind("Resource not found: {0}", //$NON-NLS-1$ - resourcePath); - Logger.logError(message, this.activator); - result = ImageDescriptor.getMissingImageDescriptor(); - } else { - result = ImageDescriptor.createFromURL(url); - } - return result; - } - - public Image getImage(final String path) { - Image result = this.map.get(path); - if (result == null) { - result = createImageDescriptor(path).createImage(); - this.map.put(path, result); - if (DEBUG) { - final Bundle bundle = this.activator.getBundle(); - final String bundleId = bundle.getSymbolicName(); - final String message = String.format("New image loaded: %s:%s", //$NON-NLS-1$ - bundleId, path); - DebugUtils.debug(message); - } - } - return result; - } - - public Image getImage(final ImageDescriptor imgDescriptor) { - Image result = this.map.get(imgDescriptor); - if (result == null) { - result = imgDescriptor.createImage(); - this.map.put(imgDescriptor, result); - if (DEBUG) { - final Bundle bundle = this.activator.getBundle(); - final String bundleId = bundle.getSymbolicName(); - final String message = String.format("New image loaded from an image descriptor (bundle=%s)", //$NON-NLS-1$ - bundleId); - DebugUtils.debug(message); - } - } - return result; - } - -}
diff --git a/org.eclipse.modisco.facet.util.swt/src/org/eclipse/emf/facet/util/swt/internal/imageprovider/ImageProviderFactory.java b/org.eclipse.modisco.facet.util.swt/src/org/eclipse/emf/facet/util/swt/internal/imageprovider/ImageProviderFactory.java deleted file mode 100644 index 7c2d64d..0000000 --- a/org.eclipse.modisco.facet.util.swt/src/org/eclipse/emf/facet/util/swt/internal/imageprovider/ImageProviderFactory.java +++ /dev/null
@@ -1,39 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2013, 2015 Mia-Software. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Grégoire Dupé (Mia-Software) - Bug 406569 - Image provider factory - * Grégoire Dupé (Mia-Software) - Bug 423611 - ImageProvider doesn't use singleton instance - * Grégoire Dupé (Mia-Software) - Bug 478270 - Error message are missing ImageProvider - ******************************************************************************/ -package org.eclipse.emf.facet.util.swt.internal.imageprovider; - -import java.util.HashMap; -import java.util.Map; - -import org.eclipse.core.runtime.Plugin; -import org.eclipse.emf.facet.util.swt.imageprovider.IImageProvider; -import org.eclipse.emf.facet.util.swt.imageprovider.IImageProviderFactory; - -public class ImageProviderFactory implements IImageProviderFactory { - - private final Map<Plugin, IImageProvider> map = new HashMap<Plugin, IImageProvider>(); - - /** - * @param plugin must no be null. - */ - public IImageProvider createIImageProvider(final Plugin plugin) { - IImageProvider result = this.map.get(plugin); - if (result == null) { - result = new ImageProvider(plugin); - this.map.put(plugin, result); - } - return result; - } - -}
diff --git a/org.eclipse.modisco.facet.util.swt/src/org/eclipse/modisco/facet/util/swt/colorprovider/IColorProvider.java b/org.eclipse.modisco.facet.util.swt/src/org/eclipse/modisco/facet/util/swt/colorprovider/IColorProvider.java new file mode 100644 index 0000000..1f657c1 --- /dev/null +++ b/org.eclipse.modisco.facet.util.swt/src/org/eclipse/modisco/facet/util/swt/colorprovider/IColorProvider.java
@@ -0,0 +1,22 @@ +/******************************************************************************* + * Copyright (c) 2013 Mia-Software. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Grégoire Dupé (Mia-Software) - Bug 424122 - [Table] Images, fonts and colors are not shared between the instances of table + ******************************************************************************/ + +package org.eclipse.modisco.facet.util.swt.colorprovider; + +import org.eclipse.swt.graphics.Color; +import org.eclipse.swt.graphics.RGB; + +public interface IColorProvider { + + Color getColor(RGB path); + +}
diff --git a/org.eclipse.modisco.facet.util.swt/src/org/eclipse/modisco/facet/util/swt/colorprovider/IColorProviderFactory.java b/org.eclipse.modisco.facet.util.swt/src/org/eclipse/modisco/facet/util/swt/colorprovider/IColorProviderFactory.java new file mode 100644 index 0000000..3638c03 --- /dev/null +++ b/org.eclipse.modisco.facet.util.swt/src/org/eclipse/modisco/facet/util/swt/colorprovider/IColorProviderFactory.java
@@ -0,0 +1,22 @@ +/******************************************************************************* + * Copyright (c) 2013 Mia-Software. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Grégoire Dupé (Mia-Software) - Bug 424122 - [Table] Images, fonts and colors are not shared between the instances of table + ******************************************************************************/ +package org.eclipse.modisco.facet.util.swt.colorprovider; + +import org.eclipse.modisco.facet.util.swt.internal.colorprovider.ColorProviderFactory; +import org.eclipse.swt.graphics.Device; + +public interface IColorProviderFactory { + + IColorProviderFactory DEFAULT = new ColorProviderFactory(); + + IColorProvider getOrCreateIColorProvider(Device device); +}
diff --git a/org.eclipse.modisco.facet.util.swt/src/org/eclipse/modisco/facet/util/swt/fontprovider/IFontProvider.java b/org.eclipse.modisco.facet.util.swt/src/org/eclipse/modisco/facet/util/swt/fontprovider/IFontProvider.java new file mode 100644 index 0000000..d5aa18a --- /dev/null +++ b/org.eclipse.modisco.facet.util.swt/src/org/eclipse/modisco/facet/util/swt/fontprovider/IFontProvider.java
@@ -0,0 +1,22 @@ +/******************************************************************************* + * Copyright (c) 2013 Mia-Software. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Grégoire Dupé (Mia-Software) - Bug 424122 - [Table] Images, fonts and colors are not shared between the instances of table + ******************************************************************************/ + +package org.eclipse.modisco.facet.util.swt.fontprovider; + +import org.eclipse.swt.graphics.Font; +import org.eclipse.swt.graphics.FontData; + +public interface IFontProvider { + + Font getFont(FontData fontData); + +}
diff --git a/org.eclipse.modisco.facet.util.swt/src/org/eclipse/modisco/facet/util/swt/fontprovider/IFontProviderFactory.java b/org.eclipse.modisco.facet.util.swt/src/org/eclipse/modisco/facet/util/swt/fontprovider/IFontProviderFactory.java new file mode 100644 index 0000000..04f513e --- /dev/null +++ b/org.eclipse.modisco.facet.util.swt/src/org/eclipse/modisco/facet/util/swt/fontprovider/IFontProviderFactory.java
@@ -0,0 +1,22 @@ +/******************************************************************************* + * Copyright (c) 2013 Mia-Software. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Grégoire Dupé (Mia-Software) - Bug 424122 - [Table] Images, fonts and colors are not shared between the instances of table + ******************************************************************************/ +package org.eclipse.modisco.facet.util.swt.fontprovider; + +import org.eclipse.modisco.facet.util.swt.internal.fontprovider.FontProviderFactory; +import org.eclipse.swt.graphics.Device; + +public interface IFontProviderFactory { + + IFontProviderFactory DEFAULT = new FontProviderFactory(); + + IFontProvider getOrCreateIFontProvider(Device device); +}
diff --git a/org.eclipse.modisco.facet.util.swt/src/org/eclipse/modisco/facet/util/swt/imageprovider/IImageProvider.java b/org.eclipse.modisco.facet.util.swt/src/org/eclipse/modisco/facet/util/swt/imageprovider/IImageProvider.java new file mode 100644 index 0000000..0fab7e6 --- /dev/null +++ b/org.eclipse.modisco.facet.util.swt/src/org/eclipse/modisco/facet/util/swt/imageprovider/IImageProvider.java
@@ -0,0 +1,27 @@ +/******************************************************************************* + * Copyright (c) 2013 Mia-Software. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Gregoire Dupe (Mia-Software) - Bug 406569 - Image provider factory + * Gregoire Dupe (Mia-Software) - Bug 424122 - [Table] Images, fonts and colors are not shared between the instances of table + ******************************************************************************/ + +package org.eclipse.modisco.facet.util.swt.imageprovider; + +import org.eclipse.jface.resource.ImageDescriptor; +import org.eclipse.swt.graphics.Image; + +public interface IImageProvider { + + Image getImage(String path); + + ImageDescriptor createImageDescriptor(String resourcePath); + + Image getImage(ImageDescriptor imgDescriptor); + +}
diff --git a/org.eclipse.modisco.facet.util.swt/src/org/eclipse/modisco/facet/util/swt/imageprovider/IImageProviderFactory.java b/org.eclipse.modisco.facet.util.swt/src/org/eclipse/modisco/facet/util/swt/imageprovider/IImageProviderFactory.java new file mode 100644 index 0000000..92a984d --- /dev/null +++ b/org.eclipse.modisco.facet.util.swt/src/org/eclipse/modisco/facet/util/swt/imageprovider/IImageProviderFactory.java
@@ -0,0 +1,22 @@ +/******************************************************************************* + * Copyright (c) 2013 Mia-Software. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Gregoire Dupe (Mia-Software) - Bug 406569 - Image provider factory + ******************************************************************************/ +package org.eclipse.modisco.facet.util.swt.imageprovider; + +import org.eclipse.core.runtime.Plugin; +import org.eclipse.modisco.facet.util.swt.internal.imageprovider.ImageProviderFactory; + +public interface IImageProviderFactory { + + IImageProviderFactory DEFAULT = new ImageProviderFactory(); + + IImageProvider createIImageProvider(Plugin plugin); +}
diff --git a/org.eclipse.modisco.facet.util.swt/src/org/eclipse/modisco/facet/util/swt/internal/Activator.java b/org.eclipse.modisco.facet.util.swt/src/org/eclipse/modisco/facet/util/swt/internal/Activator.java new file mode 100644 index 0000000..c31056d --- /dev/null +++ b/org.eclipse.modisco.facet.util.swt/src/org/eclipse/modisco/facet/util/swt/internal/Activator.java
@@ -0,0 +1,45 @@ +/******************************************************************************* + * Copyright (c) 2012 CEA LIST. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Nicolas Bros (Mia-Software) - Bug 372865 - FacetSet selection dialog + *******************************************************************************/ +package org.eclipse.modisco.facet.util.swt.internal; + +import org.eclipse.core.runtime.Plugin; +import org.osgi.framework.BundleContext; + +/** The activator class controls the plug-in life cycle */ +public class Activator extends Plugin { + + // The plug-in ID + public static final String PLUGIN_ID = "org.eclipse.emf.facet.util.swt"; //$NON-NLS-1$ + + // The shared instance + private static Activator plugin; + + @Override + public void start(final BundleContext context) throws Exception { + super.start(context); + Activator.plugin = this; + } + + @Override + public void stop(final BundleContext context) throws Exception { + Activator.plugin = null; + super.stop(context); + } + + /** + * Returns the shared instance + * + * @return the shared instance + */ + public static Activator getDefault() { + return Activator.plugin; + } +}
diff --git a/org.eclipse.modisco.facet.util.swt/src/org/eclipse/modisco/facet/util/swt/internal/colorprovider/ColorProvider.java b/org.eclipse.modisco.facet.util.swt/src/org/eclipse/modisco/facet/util/swt/internal/colorprovider/ColorProvider.java new file mode 100644 index 0000000..774e8e5 --- /dev/null +++ b/org.eclipse.modisco.facet.util.swt/src/org/eclipse/modisco/facet/util/swt/internal/colorprovider/ColorProvider.java
@@ -0,0 +1,40 @@ +/******************************************************************************* + * Copyright (c) 2013 Mia-Software. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Grégoire Dupé (Mia-Software) - Bug 424122 - [Table] Images, fonts and colors are not shared between the instances of table + ******************************************************************************/ +package org.eclipse.modisco.facet.util.swt.internal.colorprovider; + +import java.util.HashMap; +import java.util.Map; + +import org.eclipse.modisco.facet.util.swt.colorprovider.IColorProvider; +import org.eclipse.swt.graphics.Color; +import org.eclipse.swt.graphics.Device; +import org.eclipse.swt.graphics.RGB; + +public class ColorProvider implements IColorProvider { + + private Map<RGB, Color> cash = new HashMap<RGB, Color>(); + private Device device; + + public ColorProvider(final Device device) { + this.device = device; + } + + public Color getColor(final RGB rgb) { + Color result = this.cash.get(rgb); + if (result == null) { + result = new Color(this.device, rgb); + this.cash.put(rgb, result); + } + return result; + } + +}
diff --git a/org.eclipse.modisco.facet.util.swt/src/org/eclipse/modisco/facet/util/swt/internal/colorprovider/ColorProviderFactory.java b/org.eclipse.modisco.facet.util.swt/src/org/eclipse/modisco/facet/util/swt/internal/colorprovider/ColorProviderFactory.java new file mode 100644 index 0000000..7cb534f --- /dev/null +++ b/org.eclipse.modisco.facet.util.swt/src/org/eclipse/modisco/facet/util/swt/internal/colorprovider/ColorProviderFactory.java
@@ -0,0 +1,34 @@ +/******************************************************************************* + * Copyright (c) 2013 Mia-Software. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Grégoire Dupé (Mia-Software) - Bug 424122 - [Table] Images, fonts and colors are not shared between the instances of table + ******************************************************************************/ +package org.eclipse.modisco.facet.util.swt.internal.colorprovider; + +import java.util.HashMap; +import java.util.Map; + +import org.eclipse.modisco.facet.util.swt.colorprovider.IColorProvider; +import org.eclipse.modisco.facet.util.swt.colorprovider.IColorProviderFactory; +import org.eclipse.swt.graphics.Device; + +public class ColorProviderFactory implements IColorProviderFactory { + + private Map<Device, IColorProvider> cash = new HashMap<Device, IColorProvider>(); + + public IColorProvider getOrCreateIColorProvider(final Device device) { + IColorProvider result = this.cash.get(device); + if (result == null) { + result = new ColorProvider(device); + this.cash.put(device, result); + } + return result; + } + +}
diff --git a/org.eclipse.modisco.facet.util.swt/src/org/eclipse/modisco/facet/util/swt/internal/exported/SWTTestUtils.java b/org.eclipse.modisco.facet.util.swt/src/org/eclipse/modisco/facet/util/swt/internal/exported/SWTTestUtils.java new file mode 100644 index 0000000..668818b --- /dev/null +++ b/org.eclipse.modisco.facet.util.swt/src/org/eclipse/modisco/facet/util/swt/internal/exported/SWTTestUtils.java
@@ -0,0 +1,65 @@ +/******************************************************************************* + * Copyright (c) 2012, 2015 CEA LIST, and Mia-Software. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Nicolas Bros (Mia-Software) - Bug 372865 - FacetSet selection dialog + * Grégoire Dupé (Mia-Software) - Bug 470191 - [Unit Test Failure] org.eclipse.emf.facet.aggregate.tests.internal.CustomizationsCatalogViewTests.testCustomizationsView + *******************************************************************************/ +package org.eclipse.modisco.facet.util.swt.internal.exported; + +import org.eclipse.swt.widgets.Tree; +import org.eclipse.swt.widgets.TreeItem; + +public final class SWTTestUtils { + private SWTTestUtils() { + // utility class + } + + /** + * Find a tree item with the given text among the list of tree items. + * + * @param text + * the text of the tree item to find + * @param items + * the list of tree items to search + * @return the tree item or <code>null</code> if not found + */ + public static TreeItem findTreeItem(final String text, final TreeItem[] items) { + TreeItem result = null; + for (TreeItem item : items) { + if (text.equals(item.getText())) { + result = item; + } + } + return result; + } + + public static TreeItem findRootTreeItem(final String text, final Tree tree) { + TreeItem result = null; + int nbItems = tree.getItemCount(); + for (int i = 0; i < nbItems; i++) { + final TreeItem treeItem = tree.getItem(i); + final String itemText = treeItem.getText(); + if (text.equals(itemText)) { + result = treeItem; + break; + } + } + return result; + } + + public static String itemsStr(final TreeItem[] items) { + final StringBuffer strBuffer = new StringBuffer(); + for (TreeItem item : items) { + if (strBuffer.length() > 0) { + strBuffer.append(", "); //$NON-NLS-1$ + } + strBuffer.append(item.getText()); + } + return strBuffer.toString(); + } +}
diff --git a/org.eclipse.modisco.facet.util.swt/src/org/eclipse/modisco/facet/util/swt/internal/exported/TestUtils.java b/org.eclipse.modisco.facet.util.swt/src/org/eclipse/modisco/facet/util/swt/internal/exported/TestUtils.java new file mode 100644 index 0000000..afb5805 --- /dev/null +++ b/org.eclipse.modisco.facet.util.swt/src/org/eclipse/modisco/facet/util/swt/internal/exported/TestUtils.java
@@ -0,0 +1,46 @@ +/******************************************************************************* + * Copyright (c) 2012 Mia-Software. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Nicolas Bros (Mia-Software) - Bug 378475 - unit test failures after table refactoring + *******************************************************************************/ +package org.eclipse.modisco.facet.util.swt.internal.exported; + +import org.eclipse.swt.widgets.Display; +import org.eclipse.ui.IViewPart; +import org.eclipse.ui.IWorkbenchPart; +import org.eclipse.ui.PlatformUI; +import org.eclipse.ui.part.IntroPart; + +public final class TestUtils { + + private TestUtils() { + // utility class + } + + public static void closeWelcomePage() { + Display.getDefault().syncExec(new Runnable() { + public void run() { + IWorkbenchPart activePart = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActivePart(); + if (activePart != null) { + IntroPart adapter = (IntroPart) activePart.getAdapter(IntroPart.class); + if (adapter != null) { + PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().hideView((IViewPart) activePart); + } + } + } + }); + } + + public static void closeAllEditors() { + Display.getDefault().syncExec(new Runnable() { + public void run() { + PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().closeAllEditors(false); + } + }); + } +}
diff --git a/org.eclipse.modisco.facet.util.swt/src/org/eclipse/modisco/facet/util/swt/internal/fontprovider/FontProvider.java b/org.eclipse.modisco.facet.util.swt/src/org/eclipse/modisco/facet/util/swt/internal/fontprovider/FontProvider.java new file mode 100644 index 0000000..a526fc9 --- /dev/null +++ b/org.eclipse.modisco.facet.util.swt/src/org/eclipse/modisco/facet/util/swt/internal/fontprovider/FontProvider.java
@@ -0,0 +1,40 @@ +/******************************************************************************* + * Copyright (c) 2013 Mia-Software. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Grégoire Dupé (Mia-Software) - Bug 424122 - [Table] Images, fonts and colors are not shared between the instances of table + ******************************************************************************/ +package org.eclipse.modisco.facet.util.swt.internal.fontprovider; + +import java.util.HashMap; +import java.util.Map; + +import org.eclipse.modisco.facet.util.swt.fontprovider.IFontProvider; +import org.eclipse.swt.graphics.Device; +import org.eclipse.swt.graphics.Font; +import org.eclipse.swt.graphics.FontData; + +public class FontProvider implements IFontProvider { + + private Map<FontData, Font> cash = new HashMap<FontData, Font>(); + private Device device; + + public FontProvider(final Device device) { + this.device = device; + } + + public Font getFont(final FontData fontData) { + Font result = this.cash.get(fontData); + if (result == null) { + result = new Font(this.device, fontData); + this.cash.put(fontData, result); + } + return result; + } + +}
diff --git a/org.eclipse.modisco.facet.util.swt/src/org/eclipse/modisco/facet/util/swt/internal/fontprovider/FontProviderFactory.java b/org.eclipse.modisco.facet.util.swt/src/org/eclipse/modisco/facet/util/swt/internal/fontprovider/FontProviderFactory.java new file mode 100644 index 0000000..d7c9989 --- /dev/null +++ b/org.eclipse.modisco.facet.util.swt/src/org/eclipse/modisco/facet/util/swt/internal/fontprovider/FontProviderFactory.java
@@ -0,0 +1,34 @@ +/******************************************************************************* + * Copyright (c) 2013 Mia-Software. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Grégoire Dupé (Mia-Software) - Bug 424122 - [Table] Images, fonts and colors are not shared between the instances of table + ******************************************************************************/ +package org.eclipse.modisco.facet.util.swt.internal.fontprovider; + +import java.util.HashMap; +import java.util.Map; + +import org.eclipse.modisco.facet.util.swt.fontprovider.IFontProvider; +import org.eclipse.modisco.facet.util.swt.fontprovider.IFontProviderFactory; +import org.eclipse.swt.graphics.Device; + +public class FontProviderFactory implements IFontProviderFactory { + + private Map<Device, IFontProvider> cash = new HashMap<Device, IFontProvider>(); + + public IFontProvider getOrCreateIFontProvider(final Device device) { + IFontProvider result = this.cash.get(device); + if (result == null) { + result = new FontProvider(device); + this.cash.put(device, result); + } + return result; + } + +}
diff --git a/org.eclipse.modisco.facet.util.swt/src/org/eclipse/modisco/facet/util/swt/internal/imageprovider/ImageProvider.java b/org.eclipse.modisco.facet.util.swt/src/org/eclipse/modisco/facet/util/swt/internal/imageprovider/ImageProvider.java new file mode 100644 index 0000000..0e2f562 --- /dev/null +++ b/org.eclipse.modisco.facet.util.swt/src/org/eclipse/modisco/facet/util/swt/internal/imageprovider/ImageProvider.java
@@ -0,0 +1,95 @@ +/******************************************************************************* + * Copyright (c) 2013, 2015 Mia-Software. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Grégoire Dupé (Mia-Software) - Bug 406569 - Image provider factory + * Grégoire Dupé (Mia-Software) - Bug 423611 - ImageProvider doesn't use singleton instance + * Grégoire Dupé (Mia-Software) - Bug 424122 - [Table] Images, fonts and colors are not shared between the instances of table + * Grégoire Dupé (Mia-Software) - Bug 478270 - Error message are missing ImageProvider + ******************************************************************************/ + +package org.eclipse.modisco.facet.util.swt.internal.imageprovider; + +import java.net.URL; +import java.util.HashMap; +import java.util.Map; + +import org.eclipse.core.runtime.Plugin; +import org.eclipse.jface.resource.ImageDescriptor; +import org.eclipse.modisco.facet.util.core.DebugUtils; +import org.eclipse.modisco.facet.util.core.Logger; +import org.eclipse.modisco.facet.util.swt.imageprovider.IImageProvider; +import org.eclipse.modisco.facet.util.swt.internal.Activator; +import org.eclipse.osgi.util.NLS; +import org.eclipse.swt.graphics.Image; +import org.osgi.framework.Bundle; + +public final class ImageProvider implements IImageProvider { + + private static final boolean DEBUG = DebugUtils.getDebugStatus(Activator.getDefault()); + private final Map<Object, Image> map = new HashMap<Object, Image>(); + private final Plugin activator; + + /** + * @param activator must not be null. + */ + ImageProvider(final Plugin activator) { + if (activator == null) { + throw new IllegalArgumentException("The parameter 'activator' must no be null"); //$NON-NLS-1$ + } + this.activator = activator; + } + + public ImageDescriptor createImageDescriptor(final String resourcePath) { + ImageDescriptor result; + final Bundle bundle = this.activator.getBundle(); + final URL url = bundle.getResource(resourcePath); + if (url == null) { + final String message = NLS.bind("Resource not found: {0}", //$NON-NLS-1$ + resourcePath); + Logger.logError(message, this.activator); + result = ImageDescriptor.getMissingImageDescriptor(); + } else { + result = ImageDescriptor.createFromURL(url); + } + return result; + } + + public Image getImage(final String path) { + Image result = this.map.get(path); + if (result == null) { + result = createImageDescriptor(path).createImage(); + this.map.put(path, result); + if (DEBUG) { + final Bundle bundle = this.activator.getBundle(); + final String bundleId = bundle.getSymbolicName(); + final String message = String.format("New image loaded: %s:%s", //$NON-NLS-1$ + bundleId, path); + DebugUtils.debug(message); + } + } + return result; + } + + public Image getImage(final ImageDescriptor imgDescriptor) { + Image result = this.map.get(imgDescriptor); + if (result == null) { + result = imgDescriptor.createImage(); + this.map.put(imgDescriptor, result); + if (DEBUG) { + final Bundle bundle = this.activator.getBundle(); + final String bundleId = bundle.getSymbolicName(); + final String message = String.format("New image loaded from an image descriptor (bundle=%s)", //$NON-NLS-1$ + bundleId); + DebugUtils.debug(message); + } + } + return result; + } + +}
diff --git a/org.eclipse.modisco.facet.util.swt/src/org/eclipse/modisco/facet/util/swt/internal/imageprovider/ImageProviderFactory.java b/org.eclipse.modisco.facet.util.swt/src/org/eclipse/modisco/facet/util/swt/internal/imageprovider/ImageProviderFactory.java new file mode 100644 index 0000000..31f25ed --- /dev/null +++ b/org.eclipse.modisco.facet.util.swt/src/org/eclipse/modisco/facet/util/swt/internal/imageprovider/ImageProviderFactory.java
@@ -0,0 +1,39 @@ +/******************************************************************************* + * Copyright (c) 2013, 2015 Mia-Software. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Grégoire Dupé (Mia-Software) - Bug 406569 - Image provider factory + * Grégoire Dupé (Mia-Software) - Bug 423611 - ImageProvider doesn't use singleton instance + * Grégoire Dupé (Mia-Software) - Bug 478270 - Error message are missing ImageProvider + ******************************************************************************/ +package org.eclipse.modisco.facet.util.swt.internal.imageprovider; + +import java.util.HashMap; +import java.util.Map; + +import org.eclipse.core.runtime.Plugin; +import org.eclipse.modisco.facet.util.swt.imageprovider.IImageProvider; +import org.eclipse.modisco.facet.util.swt.imageprovider.IImageProviderFactory; + +public class ImageProviderFactory implements IImageProviderFactory { + + private final Map<Plugin, IImageProvider> map = new HashMap<Plugin, IImageProvider>(); + + /** + * @param plugin must no be null. + */ + public IImageProvider createIImageProvider(final Plugin plugin) { + IImageProvider result = this.map.get(plugin); + if (result == null) { + result = new ImageProvider(plugin); + this.map.put(plugin, result); + } + return result; + } + +}
diff --git a/org.eclipse.modisco.facet.util.tests.swtbot/META-INF/MANIFEST.MF b/org.eclipse.modisco.facet.util.tests.swtbot/META-INF/MANIFEST.MF index 250d240..c02a05f 100644 --- a/org.eclipse.modisco.facet.util.tests.swtbot/META-INF/MANIFEST.MF +++ b/org.eclipse.modisco.facet.util.tests.swtbot/META-INF/MANIFEST.MF
@@ -3,7 +3,7 @@ Bundle-Name: EMF Facet Util for SwtBot Bundle-SymbolicName: org.eclipse.emf.facet.util.tests.swtbot Bundle-Version: 1.3.0.qualifier -Bundle-Activator: org.eclipse.emf.facet.util.tests.swtbot.internal.Activator +Bundle-Activator: org.eclipse.modisco.facet.util.tests.swtbot.internal.Activator Bundle-Vendor: Eclipse Modeling Project Require-Bundle: org.eclipse.ui, org.eclipse.core.runtime, @@ -14,9 +14,9 @@ org.eclipse.emf.facet.util.core;bundle-version="0.2.0" Bundle-RequiredExecutionEnvironment: JavaSE-1.8 Bundle-ActivationPolicy: lazy -Export-Package: org.eclipse.emf.facet.util.tests.swtbot.internal; +Export-Package: org.eclipse.modisco.facet.util.tests.swtbot.internal; x-friends:="org.eclipse.emf.facet.widgets.nattable.tests, org.eclipse.emf.facet.query.java.ui.tests, org.eclipse.modisco.infra.browser.tests, org.eclipse.emf.facet.util.emf.ui.tests", - org.eclipse.emf.facet.util.tests.swtbot.internal.exported + org.eclipse.modisco.facet.util.tests.swtbot.internal.exported
diff --git a/org.eclipse.modisco.facet.util.tests.swtbot/src/org/eclipse/emf/facet/util/tests/swtbot/internal/Activator.java b/org.eclipse.modisco.facet.util.tests.swtbot/src/org/eclipse/emf/facet/util/tests/swtbot/internal/Activator.java deleted file mode 100644 index 4ba8b2a..0000000 --- a/org.eclipse.modisco.facet.util.tests.swtbot/src/org/eclipse/emf/facet/util/tests/swtbot/internal/Activator.java +++ /dev/null
@@ -1,64 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2011 CEA LIST. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Nicolas Guyomar (Mia-Software) - Bug 343811 - EMF Facet Regression : Created elements in a table are not serialized - *******************************************************************************/ -package org.eclipse.emf.facet.util.tests.swtbot.internal; - -import org.eclipse.ui.plugin.AbstractUIPlugin; -import org.osgi.framework.BundleContext; - -/** - * The activator class controls the plug-in life cycle - */ -public class Activator extends AbstractUIPlugin { - - // The plug-in ID - public static final String PLUGIN_ID = "org.eclipse.emf.facet.tests.util.swtbot"; //$NON-NLS-1$ - - // The shared instance - private static Activator plugin; - - /** - * The constructor - */ - public Activator() { - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext) - */ - @Override - public void start(final BundleContext context) throws Exception { - super.start(context); - Activator.plugin = this; - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext) - */ - @Override - public void stop(final BundleContext context) throws Exception { - Activator.plugin = null; - super.stop(context); - } - - /** - * Returns the shared instance - * - * @return the shared instance - */ - public static Activator getDefault() { - return Activator.plugin; - } - -}
diff --git a/org.eclipse.modisco.facet.util.tests.swtbot/src/org/eclipse/emf/facet/util/tests/swtbot/internal/ContextMenuUtils.java b/org.eclipse.modisco.facet.util.tests.swtbot/src/org/eclipse/emf/facet/util/tests/swtbot/internal/ContextMenuUtils.java deleted file mode 100644 index 2dff6ef..0000000 --- a/org.eclipse.modisco.facet.util.tests.swtbot/src/org/eclipse/emf/facet/util/tests/swtbot/internal/ContextMenuUtils.java +++ /dev/null
@@ -1,123 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2011 Mia-Software - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Nicolas Bros (Mia-Software) - Bug 356368 - [Unit Test Failure] junit.framework.TestSuite.org.eclipse.gmt.modisco.infra.browser.tests.* - * Nicolas Guyomar (Mia-Software) - *******************************************************************************/ -package org.eclipse.emf.facet.util.tests.swtbot.internal; - -import static org.eclipse.swtbot.swt.finder.matchers.WidgetMatcherFactory.withMnemonic; -import static org.hamcrest.Matchers.allOf; -import static org.hamcrest.Matchers.instanceOf; - -import org.eclipse.swt.SWT; -import org.eclipse.swt.widgets.Control; -import org.eclipse.swt.widgets.Event; -import org.eclipse.swt.widgets.Menu; -import org.eclipse.swt.widgets.MenuItem; -import org.eclipse.swtbot.swt.finder.exceptions.WidgetNotFoundException; -import org.eclipse.swtbot.swt.finder.finders.UIThreadRunnable; -import org.eclipse.swtbot.swt.finder.results.VoidResult; -import org.eclipse.swtbot.swt.finder.results.WidgetResult; -import org.hamcrest.Matcher; - -public final class ContextMenuUtils { - - private ContextMenuUtils() { - // utility class : not meant to be instantiated - } - - /** Workaround for SWTBot Bug 279351. Clicks the menu with the given path from the given control. */ - public static void clickContextMenu(final Control control, - final String... menuPath) { - - // retrieve the menu item to click - final MenuItem menuItem = UIThreadRunnable - .syncExec(new WidgetResult<MenuItem>() { - public MenuItem run() { - return getMenuItem(control, menuPath); - } - }); - // display meaningful error if not found - if (menuItem == null) { - StringBuilder builder = new StringBuilder(); - boolean first = true; - for (String part : menuPath) { - if (first) { - first = false; - } else { - builder.append(" > "); - } - builder.append("\"" + part + "\""); - - } - throw new WidgetNotFoundException("MenuItem with path [" + builder.toString() + "] not found."); - } - - // click the menu item - click(menuItem); - - // hide the menu item instead of disposing it to avoid the "widget is disposed" bug - UIThreadRunnable.syncExec(new VoidResult() { - public void run() { - hide(menuItem.getParent()); - } - }); - } - - private static MenuItem getMenuItem(final Control control, final String[] menuPath) { - Menu menu = control.getMenu(); - MenuItem menuItem = null; - for (String part : menuPath) { - menuItem = getSubMenu(menu, part); - if (menuItem != null) { - menu = menuItem.getMenu(); - } else { - hide(menu); - break; - } - } - return menuItem; - } - - private static MenuItem getSubMenu(final Menu menu, final String subMenuText) { - if (menu != null) { - @SuppressWarnings("unchecked") - Matcher<?> matcher = allOf(instanceOf(MenuItem.class), withMnemonic(subMenuText)); - menu.notifyListeners(SWT.Show, new Event()); - for (final MenuItem menuItem : menu.getItems()) { - if (matcher.matches(menuItem)) { - return menuItem; - } - } - menu.notifyListeners(SWT.Hide, new Event()); - } - return null; - } - - private static void click(final MenuItem menuItem) { - final Event event = new Event(); - event.time = (int) System.currentTimeMillis(); - event.widget = menuItem; - event.display = menuItem.getDisplay(); - event.type = SWT.Selection; - - UIThreadRunnable.asyncExec(menuItem.getDisplay(), new VoidResult() { - public void run() { - menuItem.notifyListeners(SWT.Selection, event); - } - }); - } - - private static void hide(final Menu menu) { - menu.notifyListeners(SWT.Hide, new Event()); - if (menu.getParentMenu() != null) { - hide(menu.getParentMenu()); - } - } -} \ No newline at end of file
diff --git a/org.eclipse.modisco.facet.util.tests.swtbot/src/org/eclipse/emf/facet/util/tests/swtbot/internal/exported/SWTBotUtils.java b/org.eclipse.modisco.facet.util.tests.swtbot/src/org/eclipse/emf/facet/util/tests/swtbot/internal/exported/SWTBotUtils.java deleted file mode 100644 index 84fead0..0000000 --- a/org.eclipse.modisco.facet.util.tests.swtbot/src/org/eclipse/emf/facet/util/tests/swtbot/internal/exported/SWTBotUtils.java +++ /dev/null
@@ -1,255 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2011 CEA LIST. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Nicolas Guyomar (Mia-Software) - Bug 343811 - EMF Facet Regression : Created elements in a table are not serialized - * Nicolas Guyomar (Mia-Software) - Bug 342154 - EMF Facet API should be covered with Unit tests - * Gregoire Dupe (Mia-Software) - Bug 368030 - [Unit Test Failure] org.eclipse.emf.facet.widgets.table.tests.internal.v0_1.swtbot.NatTableUITests.testAddQueryColumn - * Gregoire Dupe (Mia-Software) - Bug 382109 - [Unit Test Failure] Timeout after: 5000 ms.: Timed out waiting for Shell {Resource - } to close - *******************************************************************************/ -package org.eclipse.emf.facet.util.tests.swtbot.internal.exported; - -import static org.eclipse.swtbot.swt.finder.matchers.WidgetMatcherFactory.allOf; -import static org.eclipse.swtbot.swt.finder.matchers.WidgetMatcherFactory.widgetOfType; - -import java.io.IOException; -import java.util.List; - -import org.eclipse.core.resources.IProject; -import org.eclipse.core.resources.IWorkspace; -import org.eclipse.core.resources.ResourcesPlugin; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.NullProgressMonitor; -import org.eclipse.emf.facet.util.core.Logger; -import org.eclipse.emf.facet.util.tests.swtbot.internal.Activator; -import org.eclipse.swt.SWT; -import org.eclipse.swt.widgets.Display; -import org.eclipse.swt.widgets.ToolItem; -import org.eclipse.swtbot.eclipse.finder.SWTWorkbenchBot; -import org.eclipse.swtbot.eclipse.finder.widgets.SWTBotView; -import org.eclipse.swtbot.swt.finder.finders.UIThreadRunnable; -import org.eclipse.swtbot.swt.finder.matchers.AbstractMatcher; -import org.eclipse.swtbot.swt.finder.results.VoidResult; -import org.eclipse.swtbot.swt.finder.utils.SWTUtils; -import org.eclipse.swtbot.swt.finder.waits.DefaultCondition; -import org.eclipse.swtbot.swt.finder.widgets.SWTBotShell; -import org.eclipse.swtbot.swt.finder.widgets.SWTBotToolbarButton; -import org.eclipse.swtbot.swt.finder.widgets.SWTBotToolbarDropDownButton; -import org.eclipse.swtbot.swt.finder.widgets.SWTBotToolbarPushButton; -import org.eclipse.swtbot.swt.finder.widgets.SWTBotToolbarRadioButton; -import org.eclipse.swtbot.swt.finder.widgets.SWTBotToolbarSeparatorButton; -import org.eclipse.swtbot.swt.finder.widgets.SWTBotToolbarToggleButton; -import org.eclipse.swtbot.swt.finder.widgets.SWTBotTree; -import org.eclipse.ui.IViewReference; -import org.eclipse.ui.IWorkbenchPage; -import org.eclipse.ui.IWorkbenchWindow; -import org.eclipse.ui.PlatformUI; -import org.eclipse.ui.handlers.IHandlerService; -import org.hamcrest.Description; -import org.hamcrest.Matcher; - -public final class SWTBotUtils { - - private static boolean enableDebugScreenshots = true; - private static final String SCREENSHOT_DIR = "SWTBotScreenShots/"; //$NON-NLS-1$ - private static final String SCREENSHOT_FORMAT = ".png"; //$NON-NLS-1$ - - private SWTBotUtils() { - // Util class should not be instantiable - } - - public static SWTBotToolbarButton getToolbarButton(final String tooltipPrefix, final int index, final SWTWorkbenchBot pBot) { - Matcher<ToolItem> widgetOfTypeToolItem = widgetOfType(ToolItem.class); - PrefixTextMatcher<ToolItem> prefixTextMatcher = new PrefixTextMatcher<ToolItem>(tooltipPrefix); - @SuppressWarnings("unchecked") - // The method allOf use varargs type with parameterized type, this is not supported by Java - // cf. http://download.oracle.com/javase/tutorial/java/generics/non-reifiable-varargs-type.html - Matcher<ToolItem> matcher = allOf(widgetOfTypeToolItem, prefixTextMatcher); - ToolItem item = pBot.widget(matcher, index); - - if (SWTUtils.hasStyle(item, SWT.PUSH)) { - return new SWTBotToolbarPushButton(item, matcher); - } - if (SWTUtils.hasStyle(item, SWT.CHECK)) { - return new SWTBotToolbarToggleButton(item, matcher); - } - if (SWTUtils.hasStyle(item, SWT.RADIO)) { - return new SWTBotToolbarRadioButton(item, matcher); - } - if (SWTUtils.hasStyle(item, SWT.DROP_DOWN)) { - return new SWTBotToolbarDropDownButton(item, matcher); - } - if (SWTUtils.hasStyle(item, SWT.SEPARATOR)) { - return new SWTBotToolbarSeparatorButton(item, matcher); - } - - throw new RuntimeException("toolbar button not found: " + tooltipPrefix); //$NON-NLS-1$ - } - - public static void captureScreenShot(final String imageName) { - ScreenShotUtils.capture(imageName, 1); - } - - public static class PrefixTextMatcher<T> extends AbstractMatcher<T> { - - private final String prefix; - - public PrefixTextMatcher(final String prefix) { - this.prefix = prefix; - } - - public void describeTo(final Description description) { - description.appendText("with a label that starts with(" + this.prefix + ")"); //$NON-NLS-1$ //$NON-NLS-2$ - } - - @Override - protected boolean doMatch(final Object item) { - try { - return SWTUtils.invokeMethod(item, "getToolTipText").toString().startsWith(this.prefix); //$NON-NLS-1$ - } catch (Exception e) { - return false; - } - } - } - - public static void waitUntilNotEmpty(final SWTBotTree tree, final int timeout) { - SWTWorkbenchBot bot = new SWTWorkbenchBot(); - bot.waitUntil(new DefaultCondition() { - public boolean test() throws Exception { - return tree.getAllItems().length > 0; - } - - public String getFailureMessage() { - return "Tree still empty after timeout"; - } - }, timeout); - } - - public static void waitUntilAssertListSize(final int expected, final List<?> list) { - new SWTWorkbenchBot().waitUntil(new DefaultCondition() { - - public boolean test() throws Exception { - return expected == list.size(); - } - - public String getFailureMessage() { - return "List size assertion failed: expected " + expected + " elements; got " + list.size(); - } - }); - } - - public static void executeCommand(final String commandID) { - final IHandlerService handlerService = (IHandlerService) PlatformUI.getWorkbench() - .getService(IHandlerService.class); - Display.getDefault().asyncExec(new Runnable() { - public void run() { - try { - handlerService.executeCommand(commandID, null); - } catch (Exception e) { - throw new RuntimeException(e); - } - } - }); - } - - /** - * Clears the workbench UI : close the welcome page if present, all editors, and all shells. This method is meant to - * be called between tests, in order to ensure that if one test fails and leaves a dialog open, subsequent tests can - * still pass. - */ - public static void closeWelcomeAndEditorsAndShells() { - // close Welcome page if present - SWTWorkbenchBot bot = new SWTWorkbenchBot(); - for (SWTBotView view : bot.views()) { - if (view.getTitle().equals("Welcome")) { - view.close(); - } - } - // close all open editors - UIThreadRunnable.syncExec(new VoidResult() { - public void run() { - PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage() - .closeAllEditors(false); - } - }); - // close all open views - UIThreadRunnable.syncExec(new VoidResult() { - public void run() { - IWorkbenchPage activePage = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage(); - IViewReference[] viewReferences = activePage.getViewReferences(); - for (IViewReference viewReference : viewReferences) { - activePage.hideView(viewReference); - } - } - }); - // close all shells except the main one - for (SWTBotShell sbShell : bot.shells()) { - for (IWorkbenchWindow window : PlatformUI.getWorkbench() - .getWorkbenchWindows()) { - if (window.getShell() != sbShell.widget) { - sbShell.close(); - } - } - } - } - - public static void deleteAllProjects() throws CoreException { - final int sleepInterval = 100; - final IWorkspace workspace = ResourcesPlugin.getWorkspace(); - for (IProject project : workspace.getRoot().getProjects()) { - project.close(new NullProgressMonitor()); - project.delete(true, new NullProgressMonitor()); - while (project.exists()) { - try { - Thread.sleep(sleepInterval); - } catch (InterruptedException e) { - Logger.logWarning(e, Activator.getDefault()); - } - } - } - } - - private static final boolean DUMP_ENABLED = true; - private static final int DUMP_INTERVAL = 30000; - private static boolean dumpStarted = false; - - public static synchronized void startDebugDumpingIfEnabled() { - if (System.getProperty("os.name").toLowerCase().contains("win")) { - System.err.println("no dump on Windows"); - return; - } - if (!SWTBotUtils.DUMP_ENABLED || SWTBotUtils.dumpStarted) { - return; - } - SWTBotUtils.dumpStarted = true; - - Thread thread = new Thread(new Runnable() { - public void run() { - try { - int dumpCount = 0; - while (true) { - String filename = "stackdump_" + String.format("%03d", dumpCount) + ".txt"; - ProcessBuilder processBuilder = new ProcessBuilder("/bin/bash", "-c", "jstack $PPID 1> " + filename + " 2> " + filename); - processBuilder.redirectErrorStream(true); - System.out.println("TAKING STACKDUMP: " + filename); - processBuilder.start(); - try { - Thread.sleep(SWTBotUtils.DUMP_INTERVAL); - } catch (InterruptedException e) { - e.printStackTrace(); - } - dumpCount++; - } - } catch (IOException e) { - e.printStackTrace(); - } - } - }); - thread.start(); - System.err.println("starting stackdump every " + SWTBotUtils.DUMP_INTERVAL + " ms"); - } -}
diff --git a/org.eclipse.modisco.facet.util.tests.swtbot/src/org/eclipse/emf/facet/util/tests/swtbot/internal/exported/ScreenShotUtils.java b/org.eclipse.modisco.facet.util.tests.swtbot/src/org/eclipse/emf/facet/util/tests/swtbot/internal/exported/ScreenShotUtils.java deleted file mode 100644 index e7df50d..0000000 --- a/org.eclipse.modisco.facet.util.tests.swtbot/src/org/eclipse/emf/facet/util/tests/swtbot/internal/exported/ScreenShotUtils.java +++ /dev/null
@@ -1,79 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2011 Mia-Software. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Gregoire Dupe (Mia-Software) - Bug 367700 - [Unit Test Failure][0.2/3.8] org.eclipse.emf.facet.widgets.table.tests.internal.v0_2.swtbot.NatTableUITests.testOpenLoadCustomizationDialog - * Gregoire Dupe (Mia-Software) - Bug 368006 - [Unit Test Failure][0.2/3.8] org.eclipse.emf.facet.widgets.table.tests.internal.v0_2.swtbot.TableEditabilityTest.testSingleLineStringEditability - * Gregoire Dupe (Mia-Software) - Bug 368030 - [Unit Test Failure] org.eclipse.emf.facet.widgets.table.tests.internal.v0_1.swtbot.NatTableUITests.testAddQueryColumn - *******************************************************************************/ -package org.eclipse.emf.facet.util.tests.swtbot.internal.exported; - -import java.io.File; - -import org.eclipse.core.resources.ResourcesPlugin; -import org.eclipse.emf.facet.util.core.Logger; -import org.eclipse.emf.facet.util.tests.swtbot.internal.Activator; -import org.eclipse.swtbot.eclipse.finder.SWTWorkbenchBot; - -public final class ScreenShotUtils { - - private static final String SCREENSHOTS_DIR = "screenshots"; //$NON-NLS-1$ - private static final String SCREENSHOTS_FORMAT = ".png"; //$NON-NLS-1$ - - private ScreenShotUtils() { - // Must not be used. - } - - public static void capture() { - final String fileName = getPrefix() + getMethodName(2) - + ScreenShotUtils.SCREENSHOTS_FORMAT; - final File pictureFile = new File(getLocation(), fileName); - new SWTWorkbenchBot().captureScreenshot(pictureFile.toString()); - } - - public static void capture(final String imageName) { - final String fileName = getPrefix() + getMethodName(2) - + cleanName(imageName) + ScreenShotUtils.SCREENSHOTS_FORMAT; - final File pictureFile = new File(getLocation(), fileName); - new SWTWorkbenchBot().captureScreenshot(pictureFile.toString()); - } - - public static void capture(final String imageName, final int offset) { - final String fileName = getPrefix() + getMethodName(2 + offset) - + cleanName(imageName) + ScreenShotUtils.SCREENSHOTS_FORMAT; - final File pictureFile = new File(getLocation(), fileName); - new SWTWorkbenchBot().captureScreenshot(pictureFile.toString()); - } - - private static String getPrefix() { - try { - Thread.sleep(1); - } catch (final InterruptedException e) { - Logger.logWarning(e, Activator.getDefault()); - } - return Long.toString(System.currentTimeMillis()) + '_'; - } - - private static String cleanName(final String imageName) { - return imageName.replaceAll("[\\/\\\\\\?\\%\\*\\:\\|\\\"\\<\\>\\.]", //$NON-NLS-1$ - "_"); //$NON-NLS-1$ - } - - private static String getMethodName(final int offset) { - final StackTraceElement[] stackTrace = Thread.currentThread() - .getStackTrace(); - final StackTraceElement caller = stackTrace[1 + offset]; - return caller.getClassName() + '.' + caller.getMethodName() + '_'; - } - - private static File getLocation() { - final File workspaceDir = ResourcesPlugin.getWorkspace().getRoot() - .getLocation().toFile(); - return new File(workspaceDir, ScreenShotUtils.SCREENSHOTS_DIR); - } - -}
diff --git a/org.eclipse.modisco.facet.util.tests.swtbot/src/org/eclipse/modisco/facet/util/tests/swtbot/internal/Activator.java b/org.eclipse.modisco.facet.util.tests.swtbot/src/org/eclipse/modisco/facet/util/tests/swtbot/internal/Activator.java new file mode 100644 index 0000000..19a5470 --- /dev/null +++ b/org.eclipse.modisco.facet.util.tests.swtbot/src/org/eclipse/modisco/facet/util/tests/swtbot/internal/Activator.java
@@ -0,0 +1,64 @@ +/******************************************************************************* + * Copyright (c) 2011 CEA LIST. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Nicolas Guyomar (Mia-Software) - Bug 343811 - EMF Facet Regression : Created elements in a table are not serialized + *******************************************************************************/ +package org.eclipse.modisco.facet.util.tests.swtbot.internal; + +import org.eclipse.ui.plugin.AbstractUIPlugin; +import org.osgi.framework.BundleContext; + +/** + * The activator class controls the plug-in life cycle + */ +public class Activator extends AbstractUIPlugin { + + // The plug-in ID + public static final String PLUGIN_ID = "org.eclipse.emf.facet.tests.util.swtbot"; //$NON-NLS-1$ + + // The shared instance + private static Activator plugin; + + /** + * The constructor + */ + public Activator() { + } + + /* + * (non-Javadoc) + * + * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext) + */ + @Override + public void start(final BundleContext context) throws Exception { + super.start(context); + Activator.plugin = this; + } + + /* + * (non-Javadoc) + * + * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext) + */ + @Override + public void stop(final BundleContext context) throws Exception { + Activator.plugin = null; + super.stop(context); + } + + /** + * Returns the shared instance + * + * @return the shared instance + */ + public static Activator getDefault() { + return Activator.plugin; + } + +}
diff --git a/org.eclipse.modisco.facet.util.tests.swtbot/src/org/eclipse/modisco/facet/util/tests/swtbot/internal/ContextMenuUtils.java b/org.eclipse.modisco.facet.util.tests.swtbot/src/org/eclipse/modisco/facet/util/tests/swtbot/internal/ContextMenuUtils.java new file mode 100644 index 0000000..2a17061 --- /dev/null +++ b/org.eclipse.modisco.facet.util.tests.swtbot/src/org/eclipse/modisco/facet/util/tests/swtbot/internal/ContextMenuUtils.java
@@ -0,0 +1,123 @@ +/******************************************************************************* + * Copyright (c) 2011 Mia-Software + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Nicolas Bros (Mia-Software) - Bug 356368 - [Unit Test Failure] junit.framework.TestSuite.org.eclipse.gmt.modisco.infra.browser.tests.* + * Nicolas Guyomar (Mia-Software) + *******************************************************************************/ +package org.eclipse.modisco.facet.util.tests.swtbot.internal; + +import static org.eclipse.swtbot.swt.finder.matchers.WidgetMatcherFactory.withMnemonic; +import static org.hamcrest.Matchers.allOf; +import static org.hamcrest.Matchers.instanceOf; + +import org.eclipse.swt.SWT; +import org.eclipse.swt.widgets.Control; +import org.eclipse.swt.widgets.Event; +import org.eclipse.swt.widgets.Menu; +import org.eclipse.swt.widgets.MenuItem; +import org.eclipse.swtbot.swt.finder.exceptions.WidgetNotFoundException; +import org.eclipse.swtbot.swt.finder.finders.UIThreadRunnable; +import org.eclipse.swtbot.swt.finder.results.VoidResult; +import org.eclipse.swtbot.swt.finder.results.WidgetResult; +import org.hamcrest.Matcher; + +public final class ContextMenuUtils { + + private ContextMenuUtils() { + // utility class : not meant to be instantiated + } + + /** Workaround for SWTBot Bug 279351. Clicks the menu with the given path from the given control. */ + public static void clickContextMenu(final Control control, + final String... menuPath) { + + // retrieve the menu item to click + final MenuItem menuItem = UIThreadRunnable + .syncExec(new WidgetResult<MenuItem>() { + public MenuItem run() { + return getMenuItem(control, menuPath); + } + }); + // display meaningful error if not found + if (menuItem == null) { + StringBuilder builder = new StringBuilder(); + boolean first = true; + for (String part : menuPath) { + if (first) { + first = false; + } else { + builder.append(" > "); + } + builder.append("\"" + part + "\""); + + } + throw new WidgetNotFoundException("MenuItem with path [" + builder.toString() + "] not found."); + } + + // click the menu item + click(menuItem); + + // hide the menu item instead of disposing it to avoid the "widget is disposed" bug + UIThreadRunnable.syncExec(new VoidResult() { + public void run() { + hide(menuItem.getParent()); + } + }); + } + + private static MenuItem getMenuItem(final Control control, final String[] menuPath) { + Menu menu = control.getMenu(); + MenuItem menuItem = null; + for (String part : menuPath) { + menuItem = getSubMenu(menu, part); + if (menuItem != null) { + menu = menuItem.getMenu(); + } else { + hide(menu); + break; + } + } + return menuItem; + } + + private static MenuItem getSubMenu(final Menu menu, final String subMenuText) { + if (menu != null) { + @SuppressWarnings("unchecked") + Matcher<?> matcher = allOf(instanceOf(MenuItem.class), withMnemonic(subMenuText)); + menu.notifyListeners(SWT.Show, new Event()); + for (final MenuItem menuItem : menu.getItems()) { + if (matcher.matches(menuItem)) { + return menuItem; + } + } + menu.notifyListeners(SWT.Hide, new Event()); + } + return null; + } + + private static void click(final MenuItem menuItem) { + final Event event = new Event(); + event.time = (int) System.currentTimeMillis(); + event.widget = menuItem; + event.display = menuItem.getDisplay(); + event.type = SWT.Selection; + + UIThreadRunnable.asyncExec(menuItem.getDisplay(), new VoidResult() { + public void run() { + menuItem.notifyListeners(SWT.Selection, event); + } + }); + } + + private static void hide(final Menu menu) { + menu.notifyListeners(SWT.Hide, new Event()); + if (menu.getParentMenu() != null) { + hide(menu.getParentMenu()); + } + } +} \ No newline at end of file
diff --git a/org.eclipse.modisco.facet.util.tests.swtbot/src/org/eclipse/modisco/facet/util/tests/swtbot/internal/exported/SWTBotUtils.java b/org.eclipse.modisco.facet.util.tests.swtbot/src/org/eclipse/modisco/facet/util/tests/swtbot/internal/exported/SWTBotUtils.java new file mode 100644 index 0000000..6c65bf0 --- /dev/null +++ b/org.eclipse.modisco.facet.util.tests.swtbot/src/org/eclipse/modisco/facet/util/tests/swtbot/internal/exported/SWTBotUtils.java
@@ -0,0 +1,255 @@ +/******************************************************************************* + * Copyright (c) 2011 CEA LIST. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Nicolas Guyomar (Mia-Software) - Bug 343811 - EMF Facet Regression : Created elements in a table are not serialized + * Nicolas Guyomar (Mia-Software) - Bug 342154 - EMF Facet API should be covered with Unit tests + * Gregoire Dupe (Mia-Software) - Bug 368030 - [Unit Test Failure] org.eclipse.emf.facet.widgets.table.tests.internal.v0_1.swtbot.NatTableUITests.testAddQueryColumn + * Gregoire Dupe (Mia-Software) - Bug 382109 - [Unit Test Failure] Timeout after: 5000 ms.: Timed out waiting for Shell {Resource - } to close + *******************************************************************************/ +package org.eclipse.modisco.facet.util.tests.swtbot.internal.exported; + +import static org.eclipse.swtbot.swt.finder.matchers.WidgetMatcherFactory.allOf; +import static org.eclipse.swtbot.swt.finder.matchers.WidgetMatcherFactory.widgetOfType; + +import java.io.IOException; +import java.util.List; + +import org.eclipse.core.resources.IProject; +import org.eclipse.core.resources.IWorkspace; +import org.eclipse.core.resources.ResourcesPlugin; +import org.eclipse.core.runtime.CoreException; +import org.eclipse.core.runtime.NullProgressMonitor; +import org.eclipse.modisco.facet.util.core.Logger; +import org.eclipse.modisco.facet.util.tests.swtbot.internal.Activator; +import org.eclipse.swt.SWT; +import org.eclipse.swt.widgets.Display; +import org.eclipse.swt.widgets.ToolItem; +import org.eclipse.swtbot.eclipse.finder.SWTWorkbenchBot; +import org.eclipse.swtbot.eclipse.finder.widgets.SWTBotView; +import org.eclipse.swtbot.swt.finder.finders.UIThreadRunnable; +import org.eclipse.swtbot.swt.finder.matchers.AbstractMatcher; +import org.eclipse.swtbot.swt.finder.results.VoidResult; +import org.eclipse.swtbot.swt.finder.utils.SWTUtils; +import org.eclipse.swtbot.swt.finder.waits.DefaultCondition; +import org.eclipse.swtbot.swt.finder.widgets.SWTBotShell; +import org.eclipse.swtbot.swt.finder.widgets.SWTBotToolbarButton; +import org.eclipse.swtbot.swt.finder.widgets.SWTBotToolbarDropDownButton; +import org.eclipse.swtbot.swt.finder.widgets.SWTBotToolbarPushButton; +import org.eclipse.swtbot.swt.finder.widgets.SWTBotToolbarRadioButton; +import org.eclipse.swtbot.swt.finder.widgets.SWTBotToolbarSeparatorButton; +import org.eclipse.swtbot.swt.finder.widgets.SWTBotToolbarToggleButton; +import org.eclipse.swtbot.swt.finder.widgets.SWTBotTree; +import org.eclipse.ui.IViewReference; +import org.eclipse.ui.IWorkbenchPage; +import org.eclipse.ui.IWorkbenchWindow; +import org.eclipse.ui.PlatformUI; +import org.eclipse.ui.handlers.IHandlerService; +import org.hamcrest.Description; +import org.hamcrest.Matcher; + +public final class SWTBotUtils { + + private static boolean enableDebugScreenshots = true; + private static final String SCREENSHOT_DIR = "SWTBotScreenShots/"; //$NON-NLS-1$ + private static final String SCREENSHOT_FORMAT = ".png"; //$NON-NLS-1$ + + private SWTBotUtils() { + // Util class should not be instantiable + } + + public static SWTBotToolbarButton getToolbarButton(final String tooltipPrefix, final int index, final SWTWorkbenchBot pBot) { + Matcher<ToolItem> widgetOfTypeToolItem = widgetOfType(ToolItem.class); + PrefixTextMatcher<ToolItem> prefixTextMatcher = new PrefixTextMatcher<ToolItem>(tooltipPrefix); + @SuppressWarnings("unchecked") + // The method allOf use varargs type with parameterized type, this is not supported by Java + // cf. http://download.oracle.com/javase/tutorial/java/generics/non-reifiable-varargs-type.html + Matcher<ToolItem> matcher = allOf(widgetOfTypeToolItem, prefixTextMatcher); + ToolItem item = pBot.widget(matcher, index); + + if (SWTUtils.hasStyle(item, SWT.PUSH)) { + return new SWTBotToolbarPushButton(item, matcher); + } + if (SWTUtils.hasStyle(item, SWT.CHECK)) { + return new SWTBotToolbarToggleButton(item, matcher); + } + if (SWTUtils.hasStyle(item, SWT.RADIO)) { + return new SWTBotToolbarRadioButton(item, matcher); + } + if (SWTUtils.hasStyle(item, SWT.DROP_DOWN)) { + return new SWTBotToolbarDropDownButton(item, matcher); + } + if (SWTUtils.hasStyle(item, SWT.SEPARATOR)) { + return new SWTBotToolbarSeparatorButton(item, matcher); + } + + throw new RuntimeException("toolbar button not found: " + tooltipPrefix); //$NON-NLS-1$ + } + + public static void captureScreenShot(final String imageName) { + ScreenShotUtils.capture(imageName, 1); + } + + public static class PrefixTextMatcher<T> extends AbstractMatcher<T> { + + private final String prefix; + + public PrefixTextMatcher(final String prefix) { + this.prefix = prefix; + } + + public void describeTo(final Description description) { + description.appendText("with a label that starts with(" + this.prefix + ")"); //$NON-NLS-1$ //$NON-NLS-2$ + } + + @Override + protected boolean doMatch(final Object item) { + try { + return SWTUtils.invokeMethod(item, "getToolTipText").toString().startsWith(this.prefix); //$NON-NLS-1$ + } catch (Exception e) { + return false; + } + } + } + + public static void waitUntilNotEmpty(final SWTBotTree tree, final int timeout) { + SWTWorkbenchBot bot = new SWTWorkbenchBot(); + bot.waitUntil(new DefaultCondition() { + public boolean test() throws Exception { + return tree.getAllItems().length > 0; + } + + public String getFailureMessage() { + return "Tree still empty after timeout"; + } + }, timeout); + } + + public static void waitUntilAssertListSize(final int expected, final List<?> list) { + new SWTWorkbenchBot().waitUntil(new DefaultCondition() { + + public boolean test() throws Exception { + return expected == list.size(); + } + + public String getFailureMessage() { + return "List size assertion failed: expected " + expected + " elements; got " + list.size(); + } + }); + } + + public static void executeCommand(final String commandID) { + final IHandlerService handlerService = (IHandlerService) PlatformUI.getWorkbench() + .getService(IHandlerService.class); + Display.getDefault().asyncExec(new Runnable() { + public void run() { + try { + handlerService.executeCommand(commandID, null); + } catch (Exception e) { + throw new RuntimeException(e); + } + } + }); + } + + /** + * Clears the workbench UI : close the welcome page if present, all editors, and all shells. This method is meant to + * be called between tests, in order to ensure that if one test fails and leaves a dialog open, subsequent tests can + * still pass. + */ + public static void closeWelcomeAndEditorsAndShells() { + // close Welcome page if present + SWTWorkbenchBot bot = new SWTWorkbenchBot(); + for (SWTBotView view : bot.views()) { + if (view.getTitle().equals("Welcome")) { + view.close(); + } + } + // close all open editors + UIThreadRunnable.syncExec(new VoidResult() { + public void run() { + PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage() + .closeAllEditors(false); + } + }); + // close all open views + UIThreadRunnable.syncExec(new VoidResult() { + public void run() { + IWorkbenchPage activePage = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage(); + IViewReference[] viewReferences = activePage.getViewReferences(); + for (IViewReference viewReference : viewReferences) { + activePage.hideView(viewReference); + } + } + }); + // close all shells except the main one + for (SWTBotShell sbShell : bot.shells()) { + for (IWorkbenchWindow window : PlatformUI.getWorkbench() + .getWorkbenchWindows()) { + if (window.getShell() != sbShell.widget) { + sbShell.close(); + } + } + } + } + + public static void deleteAllProjects() throws CoreException { + final int sleepInterval = 100; + final IWorkspace workspace = ResourcesPlugin.getWorkspace(); + for (IProject project : workspace.getRoot().getProjects()) { + project.close(new NullProgressMonitor()); + project.delete(true, new NullProgressMonitor()); + while (project.exists()) { + try { + Thread.sleep(sleepInterval); + } catch (InterruptedException e) { + Logger.logWarning(e, Activator.getDefault()); + } + } + } + } + + private static final boolean DUMP_ENABLED = true; + private static final int DUMP_INTERVAL = 30000; + private static boolean dumpStarted = false; + + public static synchronized void startDebugDumpingIfEnabled() { + if (System.getProperty("os.name").toLowerCase().contains("win")) { + System.err.println("no dump on Windows"); + return; + } + if (!SWTBotUtils.DUMP_ENABLED || SWTBotUtils.dumpStarted) { + return; + } + SWTBotUtils.dumpStarted = true; + + Thread thread = new Thread(new Runnable() { + public void run() { + try { + int dumpCount = 0; + while (true) { + String filename = "stackdump_" + String.format("%03d", dumpCount) + ".txt"; + ProcessBuilder processBuilder = new ProcessBuilder("/bin/bash", "-c", "jstack $PPID 1> " + filename + " 2> " + filename); + processBuilder.redirectErrorStream(true); + System.out.println("TAKING STACKDUMP: " + filename); + processBuilder.start(); + try { + Thread.sleep(SWTBotUtils.DUMP_INTERVAL); + } catch (InterruptedException e) { + e.printStackTrace(); + } + dumpCount++; + } + } catch (IOException e) { + e.printStackTrace(); + } + } + }); + thread.start(); + System.err.println("starting stackdump every " + SWTBotUtils.DUMP_INTERVAL + " ms"); + } +}
diff --git a/org.eclipse.modisco.facet.util.tests.swtbot/src/org/eclipse/modisco/facet/util/tests/swtbot/internal/exported/ScreenShotUtils.java b/org.eclipse.modisco.facet.util.tests.swtbot/src/org/eclipse/modisco/facet/util/tests/swtbot/internal/exported/ScreenShotUtils.java new file mode 100644 index 0000000..1ce40f9 --- /dev/null +++ b/org.eclipse.modisco.facet.util.tests.swtbot/src/org/eclipse/modisco/facet/util/tests/swtbot/internal/exported/ScreenShotUtils.java
@@ -0,0 +1,79 @@ +/******************************************************************************* + * Copyright (c) 2011 Mia-Software. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Gregoire Dupe (Mia-Software) - Bug 367700 - [Unit Test Failure][0.2/3.8] org.eclipse.emf.facet.widgets.table.tests.internal.v0_2.swtbot.NatTableUITests.testOpenLoadCustomizationDialog + * Gregoire Dupe (Mia-Software) - Bug 368006 - [Unit Test Failure][0.2/3.8] org.eclipse.emf.facet.widgets.table.tests.internal.v0_2.swtbot.TableEditabilityTest.testSingleLineStringEditability + * Gregoire Dupe (Mia-Software) - Bug 368030 - [Unit Test Failure] org.eclipse.emf.facet.widgets.table.tests.internal.v0_1.swtbot.NatTableUITests.testAddQueryColumn + *******************************************************************************/ +package org.eclipse.modisco.facet.util.tests.swtbot.internal.exported; + +import java.io.File; + +import org.eclipse.core.resources.ResourcesPlugin; +import org.eclipse.modisco.facet.util.core.Logger; +import org.eclipse.modisco.facet.util.tests.swtbot.internal.Activator; +import org.eclipse.swtbot.eclipse.finder.SWTWorkbenchBot; + +public final class ScreenShotUtils { + + private static final String SCREENSHOTS_DIR = "screenshots"; //$NON-NLS-1$ + private static final String SCREENSHOTS_FORMAT = ".png"; //$NON-NLS-1$ + + private ScreenShotUtils() { + // Must not be used. + } + + public static void capture() { + final String fileName = getPrefix() + getMethodName(2) + + ScreenShotUtils.SCREENSHOTS_FORMAT; + final File pictureFile = new File(getLocation(), fileName); + new SWTWorkbenchBot().captureScreenshot(pictureFile.toString()); + } + + public static void capture(final String imageName) { + final String fileName = getPrefix() + getMethodName(2) + + cleanName(imageName) + ScreenShotUtils.SCREENSHOTS_FORMAT; + final File pictureFile = new File(getLocation(), fileName); + new SWTWorkbenchBot().captureScreenshot(pictureFile.toString()); + } + + public static void capture(final String imageName, final int offset) { + final String fileName = getPrefix() + getMethodName(2 + offset) + + cleanName(imageName) + ScreenShotUtils.SCREENSHOTS_FORMAT; + final File pictureFile = new File(getLocation(), fileName); + new SWTWorkbenchBot().captureScreenshot(pictureFile.toString()); + } + + private static String getPrefix() { + try { + Thread.sleep(1); + } catch (final InterruptedException e) { + Logger.logWarning(e, Activator.getDefault()); + } + return Long.toString(System.currentTimeMillis()) + '_'; + } + + private static String cleanName(final String imageName) { + return imageName.replaceAll("[\\/\\\\\\?\\%\\*\\:\\|\\\"\\<\\>\\.]", //$NON-NLS-1$ + "_"); //$NON-NLS-1$ + } + + private static String getMethodName(final int offset) { + final StackTraceElement[] stackTrace = Thread.currentThread() + .getStackTrace(); + final StackTraceElement caller = stackTrace[1 + offset]; + return caller.getClassName() + '.' + caller.getMethodName() + '_'; + } + + private static File getLocation() { + final File workspaceDir = ResourcesPlugin.getWorkspace().getRoot() + .getLocation().toFile(); + return new File(workspaceDir, ScreenShotUtils.SCREENSHOTS_DIR); + } + +}
diff --git a/org.eclipse.modisco.facet.util.ui/META-INF/MANIFEST.MF b/org.eclipse.modisco.facet.util.ui/META-INF/MANIFEST.MF index d6eedd2..230b462 100644 --- a/org.eclipse.modisco.facet.util.ui/META-INF/MANIFEST.MF +++ b/org.eclipse.modisco.facet.util.ui/META-INF/MANIFEST.MF
@@ -3,7 +3,7 @@ Bundle-Name: %Bundle-Name Bundle-SymbolicName: org.eclipse.emf.facet.util.ui Bundle-Version: 1.3.0.qualifier -Bundle-Activator: org.eclipse.emf.facet.util.ui.internal.Activator +Bundle-Activator: org.eclipse.modisco.facet.util.ui.internal.Activator Bundle-Vendor: %Bundle-Vendor Require-Bundle: org.eclipse.core.runtime, org.eclipse.swt;bundle-version="3.6.0", @@ -15,29 +15,29 @@ Bundle-RequiredExecutionEnvironment: JavaSE-1.8 Bundle-ActivationPolicy: lazy Export-Package: - org.eclipse.emf.facet.util.ui.internal.exported, - org.eclipse.emf.facet.util.ui.internal.exported.composite, - org.eclipse.emf.facet.util.ui.internal.exported.dialog, - org.eclipse.emf.facet.util.ui.internal.exported.displaysync, - org.eclipse.emf.facet.util.ui.internal.exported.handler, - org.eclipse.emf.facet.util.ui.internal.exported.tree.menu, - org.eclipse.emf.facet.util.ui.internal.exported.util.composite, - org.eclipse.emf.facet.util.ui.internal.exported.util.dialog, - org.eclipse.emf.facet.util.ui.internal.exported.util.handler, - org.eclipse.emf.facet.util.ui.internal.exported.util.tree, - org.eclipse.emf.facet.util.ui.internal.exported.util.tree.item, - org.eclipse.emf.facet.util.ui.internal.exported.util.tree.menu, - org.eclipse.emf.facet.util.ui.internal.exported.util.widget, - org.eclipse.emf.facet.util.ui.internal.exported.util.widget.command, - org.eclipse.emf.facet.util.ui.internal.exported.util.widget.component, - org.eclipse.emf.facet.util.ui.internal.exported.util.widget.component.getorcreate, - org.eclipse.emf.facet.util.ui.internal.exported.util.widget.component.properties, - org.eclipse.emf.facet.util.ui.internal.exported.util.widget.component.properties.bounds, - org.eclipse.emf.facet.util.ui.internal.exported.util.widget.component.properties.name, - org.eclipse.emf.facet.util.ui.internal.exported.util.widget.query, - org.eclipse.emf.facet.util.ui.internal.exported.util.wizard, - org.eclipse.emf.facet.util.ui.internal.exported.widget, - org.eclipse.emf.facet.util.ui.internal.exported.widget.getorcreate, - org.eclipse.emf.facet.util.ui.internal.exported.wizard, - org.eclipse.emf.facet.util.ui.utils + org.eclipse.modisco.facet.util.ui.internal.exported, + org.eclipse.modisco.facet.util.ui.internal.exported.composite, + org.eclipse.modisco.facet.util.ui.internal.exported.dialog, + org.eclipse.modisco.facet.util.ui.internal.exported.displaysync, + org.eclipse.modisco.facet.util.ui.internal.exported.handler, + org.eclipse.modisco.facet.util.ui.internal.exported.tree.menu, + org.eclipse.modisco.facet.util.ui.internal.exported.util.composite, + org.eclipse.modisco.facet.util.ui.internal.exported.util.dialog, + org.eclipse.modisco.facet.util.ui.internal.exported.util.handler, + org.eclipse.modisco.facet.util.ui.internal.exported.util.tree, + org.eclipse.modisco.facet.util.ui.internal.exported.util.tree.item, + org.eclipse.modisco.facet.util.ui.internal.exported.util.tree.menu, + org.eclipse.modisco.facet.util.ui.internal.exported.util.widget, + org.eclipse.modisco.facet.util.ui.internal.exported.util.widget.command, + org.eclipse.modisco.facet.util.ui.internal.exported.util.widget.component, + org.eclipse.modisco.facet.util.ui.internal.exported.util.widget.component.getorcreate, + org.eclipse.modisco.facet.util.ui.internal.exported.util.widget.component.properties, + org.eclipse.modisco.facet.util.ui.internal.exported.util.widget.component.properties.bounds, + org.eclipse.modisco.facet.util.ui.internal.exported.util.widget.component.properties.name, + org.eclipse.modisco.facet.util.ui.internal.exported.util.widget.query, + org.eclipse.modisco.facet.util.ui.internal.exported.util.wizard, + org.eclipse.modisco.facet.util.ui.internal.exported.widget, + org.eclipse.modisco.facet.util.ui.internal.exported.widget.getorcreate, + org.eclipse.modisco.facet.util.ui.internal.exported.wizard, + org.eclipse.modisco.facet.util.ui.utils Automatic-Module-Name: org.eclipse.emf.facet.util.ui
diff --git a/org.eclipse.modisco.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/Activator.java b/org.eclipse.modisco.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/Activator.java deleted file mode 100644 index 78ea2cb..0000000 --- a/org.eclipse.modisco.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/Activator.java +++ /dev/null
@@ -1,52 +0,0 @@ -/** - * Copyright (c) 2012 Mia-Software. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Alban Ménager (Soft-Maint) - Bug 387470 - [EFacet][Custom] Editors - */ -package org.eclipse.emf.facet.util.ui.internal; - -import org.eclipse.core.runtime.Plugin; -import org.osgi.framework.BundleContext; - -@SuppressWarnings("PMD.UseSingleton") -// @SuppressWarnings("PMD.UseSingleton") We cannot conforms to this rule because -// this class is an Eclipse plug-in activator which will be instantiated by the -// Eclipse framework. -public class Activator extends Plugin { - - private static Activator plugin; - - @Override - @SuppressWarnings("PMD.SignatureDeclareThrowsException") - // @SuppressWarnings("PMD.SignatureDeclareThrowsException") We have to use - // this signature because this is an override of an Eclipse framework's - // method. - public void start(final BundleContext bundleContext) throws Exception { - super.start(bundleContext); - Activator.plugin = this; - } - - @Override - @SuppressWarnings({ "PMD.SignatureDeclareThrowsException", - "PMD.NullAssignment" }) - // @SuppressWarnings("PMD.SignatureDeclareThrowsException") We have to use - // this signature because this is an override of an Eclipse framework's - // method. - // @SuppressWarnings("PMD.NullAssignment") - // No choice to right it in another way : this is an Eclipse pattern. - public void stop(final BundleContext bundleContext) throws Exception { - Activator.plugin = null; - super.stop(bundleContext); - } - - public static Plugin getDefault() { - return Activator.plugin; - } - -}
diff --git a/org.eclipse.modisco.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/Messages.java b/org.eclipse.modisco.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/Messages.java deleted file mode 100644 index 3491bf3..0000000 --- a/org.eclipse.modisco.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/Messages.java +++ /dev/null
@@ -1,37 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2011 Mia-Software. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Nicolas Bros (Mia-Software) - Bug 366367 - To be able to change the "CanBePresentedInTheTable" query - * Alban Ménager (Soft-Maint) - Bug 387470 - [EFacet][Custom] Editors - * Thomas Cicognani (Soft-Maint) - Bug 406565 - Ok Dialog - *******************************************************************************/ -package org.eclipse.emf.facet.util.ui.internal; - -import org.eclipse.osgi.util.NLS; - -public final class Messages extends NLS { - private static final String BUNDLE_NAME = "org.eclipse.emf.facet.util.ui.internal.messages"; //$NON-NLS-1$ - public static String FilteredElementSelectionControl_type_filter_text; - public static String QuestionDialog_yes; - public static String QuestionDialog_no; - public static String OK; - - public static String item_todo; - public static String Type; - public static String Select; - public static String New; - - public static String Select_Facet; - static { - // initialize resource bundle - NLS.initializeMessages(Messages.BUNDLE_NAME, Messages.class); - } - - private Messages() { - } -}
diff --git a/org.eclipse.modisco.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/dialog/OkDialog.java b/org.eclipse.modisco.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/dialog/OkDialog.java deleted file mode 100644 index 3dcefb7..0000000 --- a/org.eclipse.modisco.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/dialog/OkDialog.java +++ /dev/null
@@ -1,170 +0,0 @@ -/** - * Copyright (c) Soft-Maint. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Thomas Cicognani (Soft-Maint) - Bug 406565 - Ok Dialog - * Khira Boukhiar (Sodifrance) - Bug 526361 - Focus on the "Ok" button - */ -package org.eclipse.emf.facet.util.ui.internal.dialog; - -import java.util.ArrayList; -import java.util.List; - -import org.eclipse.emf.facet.util.ui.internal.Messages; -import org.eclipse.emf.facet.util.ui.internal.exported.dialog.IDialogCallback; -import org.eclipse.emf.facet.util.ui.internal.exported.dialog.IOkDialog; -import org.eclipse.swt.SWT; -import org.eclipse.swt.events.SelectionAdapter; -import org.eclipse.swt.events.SelectionEvent; -import org.eclipse.swt.graphics.Point; -import org.eclipse.swt.graphics.Rectangle; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.layout.GridLayout; -import org.eclipse.swt.widgets.Button; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Display; -import org.eclipse.swt.widgets.Label; -import org.eclipse.swt.widgets.Shell; -import org.eclipse.swt.widgets.Text; - -public class OkDialog implements IOkDialog { - private static final int SHELL_WIDTH = 450; - private static final int SHELL_HEIGHT = 170; - private static final int BUTTON_WIDTH_HINT = 80; - private static final int MARGIN_LEFT = 5; - private static final int MARGIN_TOP = 8; - private static final int VERTICAL_SPACING = 10; - private static final int HORIZONT_SPACING = 15; - private static final int BUTTONS_COMP_COL = 3; - - private final List<Runnable> listeners = new ArrayList<Runnable>(); - - private final Shell parentShell; - private final String title; - private final String message; - private final IDialogCallback<Void> callback; - private Shell shell; - private final int kind; - - public OkDialog(final Shell parentShell, final int kind, - final String title, final String message, - final IDialogCallback<Void> iDialogCallback) { - this.parentShell = parentShell; - this.title = title; - this.message = message; - this.callback = iDialogCallback; - this.kind = kind; - createContents(); - } - - private void createContents() { - this.shell = new Shell(this.parentShell, SWT.BORDER | SWT.RESIZE - | SWT.TITLE | SWT.APPLICATION_MODAL); - this.shell.setSize(OkDialog.SHELL_WIDTH, OkDialog.SHELL_HEIGHT); - this.shell.setText(this.title); - final GridLayout shellLayout = new GridLayout(2, false); - - // constants to make checkstyle happy - shellLayout.marginLeft = OkDialog.MARGIN_LEFT; - shellLayout.marginTop = OkDialog.MARGIN_TOP; - shellLayout.verticalSpacing = OkDialog.VERTICAL_SPACING; - shellLayout.horizontalSpacing = OkDialog.HORIZONT_SPACING; - - this.shell.setLayout(shellLayout); - - final Label image = new Label(this.shell, SWT.NONE); - image.setLayoutData(new GridData(SWT.LEFT, SWT.TOP, false, false, 1, 1)); - image.setImage(Display.getDefault().getSystemImage(this.kind)); - - final Text labelMessage = new Text(this.shell, SWT.WRAP | SWT.H_SCROLL - | SWT.V_SCROLL | SWT.READ_ONLY); - labelMessage.setText(this.message); - labelMessage - .setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true)); - - final Composite buttonsComposite = new Composite(this.shell, SWT.NONE); - buttonsComposite.setLayout(new GridLayout(OkDialog.BUTTONS_COMP_COL, - false)); - buttonsComposite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, - false, 2, 1)); - - final Composite paddingComposite = new Composite(buttonsComposite, - SWT.NONE); - final GridData paddCompGridData = new GridData(SWT.FILL, SWT.CENTER, - true, false, 1, 1); - paddCompGridData.heightHint = 0; - paddingComposite.setLayoutData(paddCompGridData); - - final Button btnOk = new Button(buttonsComposite, SWT.NONE); - final GridData button1GridData = new GridData(SWT.LEFT, SWT.BOTTOM, - false, false, 1, 1); - button1GridData.widthHint = OkDialog.BUTTON_WIDTH_HINT; - btnOk.setLayoutData(button1GridData); - btnOk.setText(Messages.OK); - btnOk.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(final SelectionEvent event) { - commit(); - } - }); - btnOk.setFocus(); - } - - public void open() { - this.shell.layout(); - // center the shell on its parent (if not parent shell then it will not - // be centered) - if (this.parentShell != null) { - final Rectangle parentShellBounds = this.parentShell.getBounds(); - final Point shellSize = this.shell.getSize(); - this.shell.setLocation(parentShellBounds.x - + (parentShellBounds.width - shellSize.x) / 2, - parentShellBounds.y - + (parentShellBounds.height - shellSize.y) / 2); - } - this.shell.open(); - } - - public final void commit() { - if (this.shell.isDisposed()) { - throw new UnsupportedOperationException("Dialog is disposed"); //$NON-NLS-1$ - } - this.shell.dispose(); - notifyListeners(); - } - - private void notifyListeners() { - if (this.callback != null) { - this.callback.committed(null); - } - for (final Runnable listener : this.listeners) { - listener.run(); - } - } - - public void addCloseListener(final Runnable paramRunnable) { - this.listeners.add(paramRunnable); - } - - public Shell getShell() { - return this.shell; - } - - public boolean isInformation() { - return this.kind == SWT.ICON_INFORMATION; - } - - public boolean isWarning() { - return this.kind == SWT.ICON_WARNING; - } - - public boolean isError() { - return this.kind == SWT.ICON_ERROR; - } - -}
diff --git a/org.eclipse.modisco.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/dialog/OkDialogFactory.java b/org.eclipse.modisco.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/dialog/OkDialogFactory.java deleted file mode 100644 index 2e6d9dd..0000000 --- a/org.eclipse.modisco.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/dialog/OkDialogFactory.java +++ /dev/null
@@ -1,104 +0,0 @@ -/** - * Copyright (c) Soft-Maint. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Thomas Cicognani (Soft-Maint) - Bug 406565 - Ok Dialog - * Thomas Cicognani (Soft-Maint) - Bug 430545 - OKDialog may throws InvalidThreadAccess - */ -package org.eclipse.emf.facet.util.ui.internal.dialog; - -import org.eclipse.emf.facet.util.ui.internal.exported.dialog.IDialogCallback; -import org.eclipse.emf.facet.util.ui.internal.exported.dialog.IOkDialog; -import org.eclipse.emf.facet.util.ui.internal.exported.dialog.IOkDialogFactory; -import org.eclipse.emf.facet.util.ui.internal.sync.generated.SynchronizedOkDialog; -import org.eclipse.swt.SWT; -import org.eclipse.swt.widgets.Display; -import org.eclipse.swt.widgets.Shell; - -public class OkDialogFactory implements IOkDialogFactory { - - private final IDialogCallback<Void> noDialogCallback = new IDialogCallback<Void>() { - public void committed(final Void paramT) { - // Nothing to do - } - }; - - public IOkDialog openDialog(final Shell parentShell, final int kind, - final String title, final String message, - final IDialogCallback<Void> iDialogCallback) { - final OkDialog okDialog = new OkDialog(parentShell, kind, title, - message, iDialogCallback); - Display.getDefault().asyncExec(new Runnable() { - public void run() { - okDialog.open(); - } - }); - return new SynchronizedOkDialog(okDialog, Display.getDefault()); - } - - public IOkDialog openDialog(final Shell parentShell, final int kind, - final String title, final String message) { - return openDialog(parentShell, kind, title, message, - this.noDialogCallback); - } - - public IOkDialog openInformationDialog(final Shell parentShell, - final String title, final String message, - final IDialogCallback<Void> iDialogCallback) { - return openDialog(parentShell, SWT.ICON_INFORMATION, title, message, - iDialogCallback); - } - - public IOkDialog openInformationDialog(final Shell parentShell, - final String title, final String message) { - return openInformationDialog(parentShell, title, message, - this.noDialogCallback); - } - - public IOkDialog openWarningDialog(final Shell parentShell, - final String title, final String message, - final IDialogCallback<Void> iDialogCallback) { - return openDialog(parentShell, SWT.ICON_WARNING, title, message, - iDialogCallback); - } - - public IOkDialog openWarningDialog(final Shell parentShell, - final String title, final String message) { - return openWarningDialog(parentShell, title, message, - this.noDialogCallback); - } - - public IOkDialog openErrorDialog(final Shell parentShell, - final String title, final String message, - final IDialogCallback<Void> iDialogCallback) { - return openDialog(parentShell, SWT.ICON_ERROR, title, message, - iDialogCallback); - } - - public IOkDialog openErrorDialog(final Shell parentShell, - final String title, final String message) { - return openErrorDialog(parentShell, title, message, - this.noDialogCallback); - } - - public IOkDialog openErrorDialog(final Shell parentShell, - final Exception exception, final String message) { - final StringBuffer strBuffer = new StringBuffer(); - strBuffer.append(message); - strBuffer.append("\n\n"); //$NON-NLS-1$ - strBuffer.append(exception.getMessage()); - strBuffer.append("\n\n"); //$NON-NLS-1$ - for (StackTraceElement stkElt : exception.getStackTrace()) { - strBuffer.append(stkElt.toString()); - strBuffer.append('\n'); - } - return openErrorDialog(parentShell, exception.getClass().getName(), - strBuffer.toString(), this.noDialogCallback); - } - -}
diff --git a/org.eclipse.modisco.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/dialog/QuestionDialog.java b/org.eclipse.modisco.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/dialog/QuestionDialog.java deleted file mode 100644 index 5ff97dd..0000000 --- a/org.eclipse.modisco.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/dialog/QuestionDialog.java +++ /dev/null
@@ -1,184 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2011 CEA LIST. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Nicolas Bros (Mia-Software) - Bug 366367 - To be able to change the "CanBePresentedInTheTable" query - * Gregoire Dupe (Mia-Software) - Bug 373248 - Clean PMD errors - * Gregoire Dupe (Mia-Software) - Bug 374903 - [Table] ITableWidget.setLoadedFacetSets - *******************************************************************************/ -package org.eclipse.emf.facet.util.ui.internal.dialog; - -import java.util.ArrayList; -import java.util.List; - -import org.eclipse.emf.facet.util.ui.internal.Messages; -import org.eclipse.emf.facet.util.ui.internal.exported.dialog.IDialogCallback; -import org.eclipse.emf.facet.util.ui.internal.exported.dialog.IQuestionDialog; -import org.eclipse.swt.SWT; -import org.eclipse.swt.events.SelectionAdapter; -import org.eclipse.swt.events.SelectionEvent; -import org.eclipse.swt.graphics.Point; -import org.eclipse.swt.graphics.Rectangle; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.layout.GridLayout; -import org.eclipse.swt.widgets.Button; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Display; -import org.eclipse.swt.widgets.Label; -import org.eclipse.swt.widgets.Shell; - -/** - * A yes/no dialog, that replicates the JFace MessageDialog#openQuestion, but is designed to be easily testable with JUnit - * - * @since 0.2 - */ -public class QuestionDialog implements IQuestionDialog { - - private static final int SHELL_WIDTH = 450; - private static final int SHELL_HEIGHT = 170; - - private final Shell parentShell; - private final List<Runnable> listeners = new ArrayList<Runnable>(); - private Boolean result = null; - private Shell shell; - private Button btnYes; - private Button btnNo; - private final String title; - private final String message; - private IDialogCallback<Boolean> callback; - - public QuestionDialog(final Shell parent, final String title, - final String message, final IDialogCallback<Boolean> callback) { - this.parentShell = parent; - this.title = title; - this.message = message; - this.callback = callback; - createContents(); - } - - /** - * Open the dialog. - * - * @return the result - */ - public final void open() { - this.shell.layout(); - // center the shell on its parent (if not parent shell then it will not be centered) - if (this.parentShell != null) { - final Rectangle parentShellBounds = this.parentShell.getBounds(); - final Point shellSize = this.shell.getSize(); - this.shell.setLocation( - parentShellBounds.x + (parentShellBounds.width - shellSize.x) / 2, - parentShellBounds.y + (parentShellBounds.height - shellSize.y) / 2); - } - this.shell.open(); - } - - /** Create the contents of the dialog. */ - private void createContents() { - final int buttonWidthHint = 80; - this.shell = new Shell(this.parentShell, SWT.BORDER | SWT.RESIZE | SWT.TITLE - | SWT.APPLICATION_MODAL); - this.shell.setSize(QuestionDialog.SHELL_WIDTH, - QuestionDialog.SHELL_HEIGHT); - this.shell.setText(this.title); - final GridLayout shellLayout = new GridLayout(2, false); - - // constants to make checkstyle happy - final int marginLeft = 5; - final int marginTop = 8; - final int verticalSpacing = 10; - final int horizontalSpacing = 15; - shellLayout.marginLeft = marginLeft; - shellLayout.marginTop = marginTop; - shellLayout.verticalSpacing = verticalSpacing; - shellLayout.horizontalSpacing = horizontalSpacing; - - this.shell.setLayout(shellLayout); - - final Label image = new Label(this.shell, SWT.NONE); - image.setLayoutData(new GridData(SWT.LEFT, SWT.TOP, false, false, 1, 1)); - image.setImage(Display.getDefault().getSystemImage(SWT.ICON_QUESTION)); - - final Label labelMessage = new Label(this.shell, SWT.WRAP); - labelMessage.setText(this.message); - labelMessage.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true)); - - final Composite buttonsComposite = new Composite(this.shell, SWT.NONE); - final int buttonsCompositeColumns = 3; - buttonsComposite.setLayout(new GridLayout(buttonsCompositeColumns, false)); - buttonsComposite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false, 2, 1)); - - final Composite paddingComposite = new Composite(buttonsComposite, SWT.NONE); - final GridData paddingCompositeGridData = new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1); - paddingCompositeGridData.heightHint = 0; - paddingComposite.setLayoutData(paddingCompositeGridData); - - this.btnYes = new Button(buttonsComposite, SWT.NONE); - final GridData button1GridData = new GridData(SWT.LEFT, SWT.BOTTOM, false, false, 1, 1); - button1GridData.widthHint = buttonWidthHint; - this.btnYes.setLayoutData(button1GridData); - this.btnYes.setText(Messages.QuestionDialog_yes); - this.btnYes.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(final SelectionEvent e) { - pressYes(); - } - }); - - this.btnNo = new Button(buttonsComposite, SWT.NONE); - final GridData button2GridData = new GridData(SWT.LEFT, SWT.BOTTOM, false, false, 1, 1); - button2GridData.widthHint = buttonWidthHint; - this.btnNo.setLayoutData(button2GridData); - this.btnNo.setText(Messages.QuestionDialog_no); - this.btnNo.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(final SelectionEvent e) { - pressNo(); - } - }); - } - - public final void pressYes() { - if (this.shell.isDisposed()) { - throw new UnsupportedOperationException("Dialog is disposed"); //$NON-NLS-1$ - } - this.result = Boolean.TRUE; - this.shell.dispose(); - notifyListeners(); - } - - public final void pressNo() { - if (this.shell.isDisposed()) { - throw new UnsupportedOperationException("Dialog is disposed"); //$NON-NLS-1$ - } - this.result = Boolean.FALSE; - this.shell.dispose(); - notifyListeners(); - } - - private synchronized void notifyListeners() { - if (this.callback != null) { - this.callback.committed(getResult()); - } - for (final Runnable listener : new ArrayList<Runnable>(this.listeners)) { - listener.run(); - } - } - - public synchronized void addCloseListener(final Runnable runnable) { - this.listeners.add(runnable); - } - - public final Boolean getResult() { - return this.result; - } - - public final Shell getShell() { - return this.shell; - } -}
diff --git a/org.eclipse.modisco.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/dialog/QuestionDialogFactory.java b/org.eclipse.modisco.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/dialog/QuestionDialogFactory.java deleted file mode 100644 index b04f94d..0000000 --- a/org.eclipse.modisco.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/dialog/QuestionDialogFactory.java +++ /dev/null
@@ -1,37 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2012, 2016 CEA LIST, and Mia-Software. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Nicolas Bros (Mia-Software) - Bug 366367 - To be able to change the "CanBePresentedInTheTable" query - * Gregoire Dupe (Mia-Software) - Bug 374903 - [Table] ITableWidget.setLoadedFacetSets - * Thomas Cicognani (Mia-Software) - Bug 500437 - IQuestionDialogFactory not synchronized - *******************************************************************************/ -package org.eclipse.emf.facet.util.ui.internal.dialog; - -import org.eclipse.emf.facet.util.ui.internal.exported.dialog.IDialogCallback; -import org.eclipse.emf.facet.util.ui.internal.exported.dialog.IQuestionDialog; -import org.eclipse.emf.facet.util.ui.internal.exported.dialog.IQuestionDialogFactory; -import org.eclipse.emf.facet.util.ui.internal.sync.generated.SynchronizedQuestionDialog; -import org.eclipse.swt.widgets.Display; -import org.eclipse.swt.widgets.Shell; - -public class QuestionDialogFactory implements IQuestionDialogFactory { - - public IQuestionDialog createQuestionDialog(final Shell parent, final String title, final String message) { - final QuestionDialog questionDialog = new QuestionDialog(parent, title, message, null); - return new SynchronizedQuestionDialog(questionDialog, Display.getDefault()); - } - - public IQuestionDialog createQuestionDialog(final Shell parent, - final String title, final String message, - final IDialogCallback<Boolean> callback) { - final QuestionDialog questionDialog = new QuestionDialog(parent, title, message, callback); - return new SynchronizedQuestionDialog(questionDialog, Display.getDefault()); - } - -} -
diff --git a/org.eclipse.modisco.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/exported/PropertyElement.java b/org.eclipse.modisco.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/exported/PropertyElement.java deleted file mode 100644 index b2959e6..0000000 --- a/org.eclipse.modisco.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/exported/PropertyElement.java +++ /dev/null
@@ -1,111 +0,0 @@ -/** - * Copyright (c) 2012 Mia-Software. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Alban Ménager (Soft-Maint) - Bug 387470 - [EFacet][Custom] Editors - * Grégoire Dupé (Mia-Software) - Bug 387470 - [EFacet][Custom] Editors - */ -package org.eclipse.emf.facet.util.ui.internal.exported; - -/** - * Generic class representing all the properties like: - * <ol> - * <li>facetName</li> - * <li>upperBound</li> - * <li>unique</li> - * <li>...</li> - * </ol> - * - * @since 1.0 - */ -public class PropertyElement { - - private final String name; - private final Class<?> type; - private boolean changeable; - private Object value; - - /** - * Constructor - * - * @param name - * the name of the property. - * @param type - * the type of the property. - * @param changeable - * if the property can be changed (edited) or not. - */ - public PropertyElement(final String name, final Class<?> type, - final boolean changeable) { - this(name, type, changeable, null); - } - - /** - * Constructor - * - * @param name - * the name of the property. - * @param type - * the type of the property. - * @param changeable - * if the property can be changed (edited) or not. - * @param value - * the initial value of the property. - */ - public PropertyElement(final String name, final Class<?> type, - final boolean changeable, final Object value) { - super(); - this.name = name; - this.type = type; - this.changeable = changeable; - this.value = value; - } - - /** - * @return the name - */ - public String getName() { - return this.name; - } - - /** - * @return the changeable - */ - public boolean isChangeable() { - return this.changeable; - } - - /** - * @return the type - */ - public Class<?> getType() { - return this.type; - } - - /** - * @return the value - */ - public Object getValue() { - return this.value; - } - - /** - * set the value. - */ - public void setValue(final Object value) { - this.value = value; - } - - /** - * @param changeable - * the changeable to set - */ - public void setChangeable(final boolean changeable) { - this.changeable = changeable; - } -}
diff --git a/org.eclipse.modisco.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/exported/PropertyElement2.java b/org.eclipse.modisco.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/exported/PropertyElement2.java deleted file mode 100644 index fa0929f..0000000 --- a/org.eclipse.modisco.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/exported/PropertyElement2.java +++ /dev/null
@@ -1,55 +0,0 @@ -/** - * Copyright (c) 2012 Mia-Software. - * - * All rights reserved. - * - * Contributors: - * Alban Ménager (Soft-Maint) - Bug 387470 - [EFacet][Custom] Editors - * Grégoire Dupé (Mia-Software) - Integration into ITM-Factory - * Grégoire Dupé (Mia-Software) - Bug 387470 - [EFacet][Custom] Editors - */ -package org.eclipse.emf.facet.util.ui.internal.exported; - - - -/** - * @since 0.3 - */ -public class PropertyElement2<T extends Object> extends PropertyElement { - - private final boolean canBeNull; - - public PropertyElement2(final boolean changeable) { - super("", Object.class, changeable); //$NON-NLS-1$ - this.canBeNull = false; - } - - public PropertyElement2(final boolean changeable, final T value) { - super("", Object.class, changeable, value); //$NON-NLS-1$ - this.canBeNull = false; - } - - public PropertyElement2(final boolean changeable, final boolean canBeNull) { - super("", Object.class, changeable); //$NON-NLS-1$ - this.canBeNull = canBeNull; - } - - public T getValue2() { - @SuppressWarnings("unchecked") - // @SuppressWarnings("unchecked") This cast is safe because the value - // has to be a instance of T. - // PropertyElement a refactoring of PropertyElement is expected. - final T result = (T) this.getValue(); - return result; // NOPMD by gdupe on 19/10/12 16:59 - // NOPMD to isolate @SuppressWarnings("unchecked") - } - - public void setValue2(final T value) { - this.setValue(value); - } - - public boolean isCanBeNull() { - return this.canBeNull; - } - -}
diff --git a/org.eclipse.modisco.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/exported/WidgetProperties.java b/org.eclipse.modisco.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/exported/WidgetProperties.java deleted file mode 100644 index 1ad817d..0000000 --- a/org.eclipse.modisco.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/exported/WidgetProperties.java +++ /dev/null
@@ -1,67 +0,0 @@ -/** - * Copyright (c) 2012 Mia-Software. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Alban Ménager (Soft-Maint) - Bug 387470 - [EFacet][Custom] Editors - * Grégoire Dupé (Mia-Software) - Bug 387470 - [EFacet][Custom] Editors - */ -package org.eclipse.emf.facet.util.ui.internal.exported; - -import java.util.HashMap; -import java.util.Map; - -import org.eclipse.emf.ecore.ETypedElement; - -/** - * This class contain all the possible properties for the facets creations. - * - * @since 0.3 - */ -public class WidgetProperties<T extends Object> { - - // TODO This class must not be exposed. - - private final Map<T, PropertyElement> properties; - - public WidgetProperties() { - this.properties = new HashMap<T, PropertyElement>(); - } - - /** - * Add a new property in the map. - * - * @param element - * the key, the {@link ETypedElement} of the property. - * @param property - * the property. - */ - public void addProperty(final T element, - final PropertyElement property) { - getProperties().put(element, property); - } - - /** - * Get the list of properties. - * - * @return a map of the properties. - */ - private Map<T, PropertyElement> getProperties() { - return this.properties; - } - - /** - * Return the {@link PropertyElement} for the given element. - * - * @param element - * the element. - * @return the property. - */ - public PropertyElement getProperty(final T element) { - return getProperties().get(element); - } -}
diff --git a/org.eclipse.modisco.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/exported/composite/IFilteredElementSelectionComposite.java b/org.eclipse.modisco.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/exported/composite/IFilteredElementSelectionComposite.java deleted file mode 100644 index 0221177..0000000 --- a/org.eclipse.modisco.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/exported/composite/IFilteredElementSelectionComposite.java +++ /dev/null
@@ -1,34 +0,0 @@ -/** - * Copyright (c) 2012 Mia-Software. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Alban Ménager (Soft-Maint) - Bug 387470 - [EFacet][Custom] Editors - */ -package org.eclipse.emf.facet.util.ui.internal.exported.composite; - -import org.eclipse.swt.widgets.Text; -import org.eclipse.ui.dialogs.FilteredList; - -/** - * @since 0.3 - * @noextend This interface is not intended to be extended by clients. - * @noimplement This interface is not intended to be implemented by clients. - */ -public interface IFilteredElementSelectionComposite { - - void setElements(final Object[] elements); - - Object getFirstSelectedElement(); - - Object[] getSelectedElements(); - - FilteredList getFilteredList(); - - Text getFilterText(); - -} \ No newline at end of file
diff --git a/org.eclipse.modisco.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/exported/dialog/IDialog.java b/org.eclipse.modisco.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/exported/dialog/IDialog.java deleted file mode 100644 index 33e36c5..0000000 --- a/org.eclipse.modisco.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/exported/dialog/IDialog.java +++ /dev/null
@@ -1,51 +0,0 @@ -/** - * Copyright (c) 2012 Mia-Software. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Alban Ménager (Soft-Maint) - Bug 387470 - [EFacet][Custom] Editors - * Grégoire Dupé (Mia-Software) - Bug 387470 - [EFacet][Custom] Editors - */ -package org.eclipse.emf.facet.util.ui.internal.exported.dialog; - -import org.eclipse.emf.facet.util.ui.internal.exported.util.dialog.AbstractDialog; - -/** - * @see AbstractDialog - * @since 0.3 - * @noextend This interface is not intended to be extended by clients. - * @noimplement This interface is not intended to be implemented by clients. - */ -public interface IDialog<W extends Object> { - - /** - * Press the "Ok" button. - */ - void commit(); - - /** - * Press the "Cancel" button. - */ - void cancel(); - - /** - * Open the dialog. This method is used for to open the dialog into the - * thread UI. So, this method has no to be called into the constructor. - * - * @return the result of the dialog (OK or CANCEL). - */ - int open(); - - /** - * Return if the dialog is valid or not. - * - * @return true if all the necessaries properties are set. - */ - boolean isDialogValid(); - - W getWidget(); -} \ No newline at end of file
diff --git a/org.eclipse.modisco.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/exported/dialog/IDialogCallback.java b/org.eclipse.modisco.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/exported/dialog/IDialogCallback.java deleted file mode 100644 index 34e56f4..0000000 --- a/org.eclipse.modisco.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/exported/dialog/IDialogCallback.java +++ /dev/null
@@ -1,28 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2012 CEA LIST. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Gregoire Dupe (Mia-Software) - Initial API - * Nicolas Bros (Mia-Software) - Bug 372865 - FacetSet selection dialog - *******************************************************************************/ -package org.eclipse.emf.facet.util.ui.internal.exported.dialog; - -/** - * A callback used to return a dialog's result asynchronously. - * - * @param <T> - * the type of the result - */ -public interface IDialogCallback<T> { - /** - * The user committed their selection in the dialog. - * - * @param result - * the result - */ - void committed(T result); -}
diff --git a/org.eclipse.modisco.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/exported/dialog/IDialogCallbackWithPreCommit.java b/org.eclipse.modisco.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/exported/dialog/IDialogCallbackWithPreCommit.java deleted file mode 100644 index b53f3b1..0000000 --- a/org.eclipse.modisco.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/exported/dialog/IDialogCallbackWithPreCommit.java +++ /dev/null
@@ -1,59 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2012 CEA LIST. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Gregoire Dupe (Mia-Software) - Initial API - * Nicolas Bros (Mia-Software) - Bug 372865 - FacetSet selection dialog - *******************************************************************************/ -package org.eclipse.emf.facet.util.ui.internal.exported.dialog; - -/** - * A callback used to return a dialog's result asynchronously. This interface makes it possible to open a second - * "pre-commit" dialog when the user commits their selection in the first dialog. This second dialog is given the - * opportunity to open before the first dialog closes. This can be useful to ask the user for confirmation for example. - * <p> - * The second dialog should either: - * <ul> - * <li>call {@link IDialogCallback#committed(Object) committed} on the callback passed to - * {@link IDialogCallbackWithPreCommit#openPrecommitDialog(Object, IDialogCallback) openPrecommitDialog} with the - * definitive result - * <li>do nothing if the pre-commit dialog was canceled - * </ul> - * - * @param <T1> - * the type of the result for the first dialog - * @param <T2> - * the type of the result for the pre-commit dialog - * @param <D> - * the type of the pre-commit dialog - */ -public interface IDialogCallbackWithPreCommit<T1, T2, D> { - /** - * The user confirmed their choice in the pre-commit dialog. - * - * @param result - * the result of the first dialog - * @param precommitResult - * the result of the pre-commit dialog - */ - void committed(T1 result, T2 precommitResult); - - /** - * The user committed their selection in the first dialog. This method is called to let you open a second - * "pre-commit" dialog, that can prompt the user for confirmation. - * - * @param result - * the result from the first dialog - * @param precommitCallback - * you must call {@link IDialogCallback#committed(Object) committed} on this callback if the user - * confirms their choice in the second (pre-commit) dialog, and pass the result of the pre-commit dialog. - * Or do nothing if the user chose to cancel. If you return <code>null</code> from this method, you - * mustn't call {@link IDialogCallback#committed(Object)} or the commit will be done twice - * @return the pre-commit dialog (for unit tests), or <code>null</code> if no pre-commit callback is needed - */ - D openPrecommitDialog(T1 result, IDialogCallback<T2> precommitCallback); -}
diff --git a/org.eclipse.modisco.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/exported/dialog/IDialogWithoutResultCallback.java b/org.eclipse.modisco.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/exported/dialog/IDialogWithoutResultCallback.java deleted file mode 100644 index c2f4477..0000000 --- a/org.eclipse.modisco.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/exported/dialog/IDialogWithoutResultCallback.java +++ /dev/null
@@ -1,33 +0,0 @@ -/** - * Copyright (c) 2012 Mia-Software. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Alban Ménager (Soft-Maint) - Bug 387470 - [EFacet][Custom] Editors - */ -package org.eclipse.emf.facet.util.ui.internal.exported.dialog; - - -/** - * A callback used to return a dialog's result asynchronously. - * - * @since 0.3 - * @noextend This interface is not intended to be extended by clients. - * @noimplement This interface is not intended to be implemented by clients. - */ -public interface IDialogWithoutResultCallback { - - /** - * The user commit his action. - */ - void commited(); - - /** - * The user cancel his action. - */ - void canceled(); -}
diff --git a/org.eclipse.modisco.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/exported/dialog/IOkDialog.java b/org.eclipse.modisco.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/exported/dialog/IOkDialog.java deleted file mode 100644 index c578bdd..0000000 --- a/org.eclipse.modisco.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/exported/dialog/IOkDialog.java +++ /dev/null
@@ -1,32 +0,0 @@ -/** - * Copyright (c) Soft-Maint. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Thomas Cicognani (Soft-Maint) - Bug 406565 - Ok Dialog - */ -package org.eclipse.emf.facet.util.ui.internal.exported.dialog; - - -/** - * - * @author tcicognani - * @noextend This interface is not intended to be extended by clients. - * @noimplement This interface is not intended to be implemented by clients. - * @since 0.4 - */ -public interface IOkDialog { - - void commit(); - - boolean isInformation(); - - boolean isWarning(); - - boolean isError(); - -}
diff --git a/org.eclipse.modisco.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/exported/dialog/IOkDialogFactory.java b/org.eclipse.modisco.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/exported/dialog/IOkDialogFactory.java deleted file mode 100644 index 8e8129f..0000000 --- a/org.eclipse.modisco.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/exported/dialog/IOkDialogFactory.java +++ /dev/null
@@ -1,56 +0,0 @@ -/** - * Copyright (c) Soft-Maint. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Thomas Cicognani (Soft-Maint) - Bug 406565 - Ok Dialog - * Thomas Cicognani (Soft-Maint) - Bug 430545 - OKDialog may throws InvalidThreadAccess - */ -package org.eclipse.emf.facet.util.ui.internal.exported.dialog; - -import org.eclipse.emf.facet.util.ui.internal.dialog.OkDialogFactory; -import org.eclipse.emf.facet.util.ui.internal.sync.generated.SynchronizedOkDialogFactory; -import org.eclipse.swt.widgets.Display; -import org.eclipse.swt.widgets.Shell; - -/** - * - * @author tcicognani - * - * @noextend This interface is not intended to be extended by clients. - * @noimplement This interface is not intended to be implemented by clients. - * @since 0.4 - */ -public interface IOkDialogFactory { - IOkDialogFactory DEFAULT = new SynchronizedOkDialogFactory( - new OkDialogFactory(), Display.getDefault()); - - IOkDialog openDialog(Shell parentShell, int kind, String title, - String message, IDialogCallback<Void> iDialogCallback); - - IOkDialog openDialog(Shell parentShell, int kind, String title, - String message); - - IOkDialog openInformationDialog(Shell parentShell, String title, - String message, IDialogCallback<Void> iDialogCallback); - - IOkDialog openInformationDialog(Shell parentShell, String title, - String message); - - IOkDialog openWarningDialog(Shell parentShell, String title, - String message, IDialogCallback<Void> iDialogCallback); - - IOkDialog openWarningDialog(Shell parentShell, String title, String message); - - IOkDialog openErrorDialog(Shell parentShell, String title, String message, - IDialogCallback<Void> iDialogCallback); - - IOkDialog openErrorDialog(Shell parentShell, String title, String message); - - IOkDialog openErrorDialog(Shell parentShell, Exception exception, - String message); -}
diff --git a/org.eclipse.modisco.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/exported/dialog/IQuestionDialog.java b/org.eclipse.modisco.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/exported/dialog/IQuestionDialog.java deleted file mode 100644 index d336f89..0000000 --- a/org.eclipse.modisco.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/exported/dialog/IQuestionDialog.java +++ /dev/null
@@ -1,43 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2012 CEA LIST. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Nicolas Bros (Mia-Software) - Bug 366367 - To be able to change the "CanBePresentedInTheTable" query - *******************************************************************************/ -package org.eclipse.emf.facet.util.ui.internal.exported.dialog; - -import org.eclipse.swt.widgets.Shell; - -/** A simple dialog with a title, a message, and "yes" and "no" buttons */ -public interface IQuestionDialog { - - /** Opens the dialog */ - void open(); - - /** Programmatically emulate a press on the "Yes" button */ - void pressYes(); - - /** Programmatically emulate a press on the "No" button */ - void pressNo(); - - /** Add a listener that will be modified when the dialog closes */ - void addCloseListener(final Runnable runnable); - - /** - * Get the user's answer - * - * @return <ul> - * <li><code>true</code> if the user clicked "Yes" - * <li><code>false</code> if the user clicked "No" - * <li><code>null</code> if the user closed the dialog without clicking either on "Yes" or "No" - * </ul> - */ - Boolean getResult(); - - /** @return the dialog's shell */ - Shell getShell(); -}
diff --git a/org.eclipse.modisco.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/exported/dialog/IQuestionDialogFactory.java b/org.eclipse.modisco.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/exported/dialog/IQuestionDialogFactory.java deleted file mode 100644 index 31ce79c..0000000 --- a/org.eclipse.modisco.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/exported/dialog/IQuestionDialogFactory.java +++ /dev/null
@@ -1,53 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2012, 2016 CEA LIST, and Mia-Software. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Nicolas Bros (Mia-Software) - Bug 366367 - To be able to change the "CanBePresentedInTheTable" query - * Gregoire Dupe (Mia-Software) - Bug 374903 - [Table] ITableWidget.setLoadedFacetSets - * Thomas Cicognani (Mia-Software) - Bug 500437 - IQuestionDialogFactory not synchronized - *******************************************************************************/ -package org.eclipse.emf.facet.util.ui.internal.exported.dialog; - -import org.eclipse.emf.facet.util.ui.internal.dialog.QuestionDialogFactory; -import org.eclipse.emf.facet.util.ui.internal.sync.generated.SynchronizedQuestionDialogFactory; -import org.eclipse.swt.widgets.Display; -import org.eclipse.swt.widgets.Shell; - -/** A factory to instantiate {@link IQuestionDialog} */ -public interface IQuestionDialogFactory { - IQuestionDialogFactory INSTANCE = new SynchronizedQuestionDialogFactory(new QuestionDialogFactory(), - Display.getDefault()); - - /** - * Instantiates a question dialog (without opening it) - * - * @param parent - * the parent shell for the new dialog - * @param title - * the text that appears in the title of the dialog - * @param message - * the text that appears in the message area of the dialog - * @return the dialog, ready to be {@link IQuestionDialog#open() opened} - */ - @Deprecated - IQuestionDialog createQuestionDialog(Shell parent, String title, String message); - - /** - * Instantiates a question dialog (without opening it) - * - * @param parent - * the parent shell for the new dialog - * @param title - * the text that appears in the title of the dialog - * @param message - * the text that appears in the message area of the dialog - * @return the dialog, ready to be {@link IQuestionDialog#open() opened} - * @since 0.2 - */ - IQuestionDialog createQuestionDialog(Shell parent, String title, - String message, IDialogCallback<Boolean> callback); -}
diff --git a/org.eclipse.modisco.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/exported/dialog/IWithResultDialogCallback.java b/org.eclipse.modisco.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/exported/dialog/IWithResultDialogCallback.java deleted file mode 100644 index e611014..0000000 --- a/org.eclipse.modisco.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/exported/dialog/IWithResultDialogCallback.java +++ /dev/null
@@ -1,34 +0,0 @@ -/** - * Copyright (c) 2012 Mia-Software. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Alban Ménager (Soft-Maint) - Bug 387470 - [EFacet][Custom] Editors - * Grégoire Dupé (Mia-Software) - Bug 387470 - [EFacet][Custom] Editors - * Grégoire Dupé (Mia-Software) - Bug 406570 - Handlers to Save and SaveAs EMF resources - */ -package org.eclipse.emf.facet.util.ui.internal.exported.dialog; - - -/** - * A callback used to return a dialog's result asynchronously. - * - * @since 0.3 - * @noextend This interface is not intended to be extended by clients. - */ -public interface IWithResultDialogCallback<T> { - - /** - * The user commit his action. - */ - void commited(T result); - - /** - * The user cancel his action. - */ - void canceled(T result); -}
diff --git a/org.eclipse.modisco.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/exported/displaysync/AbstractExceptionFreeRunnable.java b/org.eclipse.modisco.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/exported/displaysync/AbstractExceptionFreeRunnable.java deleted file mode 100644 index ced86df..0000000 --- a/org.eclipse.modisco.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/exported/displaysync/AbstractExceptionFreeRunnable.java +++ /dev/null
@@ -1,20 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2011 Mia-Software. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Grégoire Dupé (Mia-Software) - Bug 365808 - [Unit Test Failure][0.2/4.2][0.2/3.8] org.eclipse.emf.facet.widgets.nattable.tests.NatTableAPITests - * Grégoire Dupé (Mia-Software) - Bug 367153 - synchronization utilities - *******************************************************************************/ -package org.eclipse.emf.facet.util.ui.internal.exported.displaysync; - -public abstract class AbstractExceptionFreeRunnable<T> implements IRunnable<T, Exception> { - public abstract T safeRun(); - - public T run() throws Exception { - return this.safeRun(); - } -}
diff --git a/org.eclipse.modisco.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/exported/displaysync/AbstractVoidExceptionFreeRunnable.java b/org.eclipse.modisco.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/exported/displaysync/AbstractVoidExceptionFreeRunnable.java deleted file mode 100644 index 1d86484..0000000 --- a/org.eclipse.modisco.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/exported/displaysync/AbstractVoidExceptionFreeRunnable.java +++ /dev/null
@@ -1,22 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2011 Mia-Software. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Grégoire Dupé (Mia-Software) - Bug 365808 - [Unit Test Failure][0.2/4.2][0.2/3.8] org.eclipse.emf.facet.widgets.nattable.tests.NatTableAPITests - * Grégoire Dupé (Mia-Software) - Bug 367153 - synchronization utilities - *******************************************************************************/ -package org.eclipse.emf.facet.util.ui.internal.exported.displaysync; - -public abstract class AbstractVoidExceptionFreeRunnable implements - IRunnable<Object, Exception> { - public abstract void voidSafeRun(); - - public Object run() throws Exception { - voidSafeRun(); - return null; - } -}
diff --git a/org.eclipse.modisco.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/exported/displaysync/AbstractVoidRunnable.java b/org.eclipse.modisco.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/exported/displaysync/AbstractVoidRunnable.java deleted file mode 100644 index df769c3..0000000 --- a/org.eclipse.modisco.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/exported/displaysync/AbstractVoidRunnable.java +++ /dev/null
@@ -1,22 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2011 Mia-Software. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Grégoire Dupé (Mia-Software) - Bug 365808 - [Unit Test Failure][0.2/4.2][0.2/3.8] org.eclipse.emf.facet.widgets.nattable.tests.NatTableAPITests - * Grégoire Dupé (Mia-Software) - Bug 367153 - synchronization utilities - *******************************************************************************/ -package org.eclipse.emf.facet.util.ui.internal.exported.displaysync; - -public abstract class AbstractVoidRunnable<E extends Exception> implements - IRunnable<Object, E> { - public abstract void voidRun() throws E; - - public Object run() throws E { - this.voidRun(); - return null; - } -}
diff --git a/org.eclipse.modisco.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/exported/displaysync/DisplaySyncRuntimeException.java b/org.eclipse.modisco.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/exported/displaysync/DisplaySyncRuntimeException.java deleted file mode 100644 index 095c38e..0000000 --- a/org.eclipse.modisco.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/exported/displaysync/DisplaySyncRuntimeException.java +++ /dev/null
@@ -1,34 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2011 Mia-Software. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Grégoire Dupé (Mia-Software) - Bug 365808 - [Unit Test Failure][0.2/4.2][0.2/3.8] org.eclipse.emf.facet.widgets.nattable.tests.NatTableAPITests - * Grégoire Dupé (Mia-Software) - Bug 367153 - synchronization utilities - *******************************************************************************/ -package org.eclipse.emf.facet.util.ui.internal.exported.displaysync; - -class DisplaySyncRuntimeException extends RuntimeException { - - private static final long serialVersionUID = -4424355632936609905L; - - public DisplaySyncRuntimeException() { - super(); - } - - public DisplaySyncRuntimeException(final String message) { - super(message); - } - - public DisplaySyncRuntimeException(final Throwable cause) { - super(cause); - } - - public DisplaySyncRuntimeException(final String message, final Throwable cause) { - super(message, cause); - } - -}
diff --git a/org.eclipse.modisco.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/exported/displaysync/IRunnable.java b/org.eclipse.modisco.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/exported/displaysync/IRunnable.java deleted file mode 100644 index fdc86d5..0000000 --- a/org.eclipse.modisco.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/exported/displaysync/IRunnable.java +++ /dev/null
@@ -1,16 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2011 Mia-Software. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Grégoire Dupé (Mia-Software) - Bug 365808 - [Unit Test Failure][0.2/4.2][0.2/3.8] org.eclipse.emf.facet.widgets.nattable.tests.NatTableAPITests - * Grégoire Dupé (Mia-Software) - Bug 367153 - synchronization utilities - *******************************************************************************/ -package org.eclipse.emf.facet.util.ui.internal.exported.displaysync; - -public interface IRunnable<T extends Object, E extends Exception> { - T run() throws E; -}
diff --git a/org.eclipse.modisco.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/exported/displaysync/SynchronizedComposite.java b/org.eclipse.modisco.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/exported/displaysync/SynchronizedComposite.java deleted file mode 100644 index 2e9f7ae..0000000 --- a/org.eclipse.modisco.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/exported/displaysync/SynchronizedComposite.java +++ /dev/null
@@ -1,38 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2011-2012 Mia-Software. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Grégoire Dupé (Mia-Software) - Bug 365808 - [Unit Test Failure][0.2/4.2][0.2/3.8] org.eclipse.emf.facet.widgets.nattable.tests.NatTableAPITests - * Grégoire Dupé (Mia-Software) - Bug 367153 - synchronization utilities - * Nicolas Bros (Mia-Software) - Bug 370442 - rewrite the Facet loading dialog for v0.2 - * Gregoire Dupe (Mia-Software) - Bug 369987 - [Restructuring][Table] Switch to the new customization and facet framework - *******************************************************************************/ -package org.eclipse.emf.facet.util.ui.internal.exported.displaysync; - -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Display; - -/** - * <ul> - * <li>syncExecWithResult (has return type, throws exception) - * <li>safeSyncExec (has return type, no exception) - * <li>voidSyncExec (no return type, throws exception) - * <li>voidExceptionFreeRunnable (no return type, no exception) - * </ul> - */ -public class SynchronizedComposite<C extends Composite> extends SynchronizedObject<C> { - - public SynchronizedComposite(final C composite) { - super(composite, composite.getDisplay()); - } - - @Deprecated - protected C getSynchronizedComposite() { - return getSynchronizedObject(); - } - -}
diff --git a/org.eclipse.modisco.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/exported/displaysync/SynchronizedObject.java b/org.eclipse.modisco.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/exported/displaysync/SynchronizedObject.java deleted file mode 100644 index 6302ad4..0000000 --- a/org.eclipse.modisco.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/exported/displaysync/SynchronizedObject.java +++ /dev/null
@@ -1,115 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2011 Mia-Software. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Grégoire Dupé (Mia-Software) - Bug 365808 - [Unit Test Failure][0.2/4.2][0.2/3.8] org.eclipse.emf.facet.widgets.nattable.tests.NatTableAPITests - * Grégoire Dupé (Mia-Software) - Bug 367153 - synchronization utilities - * Gregoire Dupe (Mia-Software) - Bug 369987 - [Restructuring][Table] Switch to the new customization and facet framework - * Grégoire Dupé (Mia-Software) - Bug 387470 - [EFacet][Custom] Editors - *******************************************************************************/ -package org.eclipse.emf.facet.util.ui.internal.exported.displaysync; - -import org.eclipse.swt.widgets.Display; - -/** - * <ul> - * <li>syncExecWithResult (has return type, throws exception) - * <li>safeSyncExec (has return type, no exception) - * <li>voidSyncExec (no return type, throws exception) - * <li>voidExceptionFreeRunnable (no return type, no exception) - * </ul> - */ -public class SynchronizedObject<O extends Object> { - - private final O object; - private final Thread widgetThread; - private final Display display; - - public SynchronizedObject(final O object, final Display display) { - this.object = object; - this.display = display; - this.widgetThread = this.display.getThread(); - } - - protected final <T, E extends Exception> T syncExecWithResult( - final IRunnable<T, E> runnable) throws E { - T result; - if (this.widgetThread == Thread.currentThread()) { - result = runnable.run(); - } else { - final ExceptionHandler exceptionHandler = new ExceptionHandler(); - final Object[] resultHandler = new Object[1]; - this.display.syncExec(new java.lang.Runnable() { - public void run() { - try { - resultHandler[0] = runnable.run(); - } catch (final Exception e) { - exceptionHandler.setException(e); - } - - } - }); - if (exceptionHandler.getException() != null) { - @SuppressWarnings("unchecked") - // @SuppressWarnings("unchecked") This cast is safe because - // "exceptionHandler" contains an exception thrown by "runnable" - // and - // "runnable" throws by definition a instance of E - final E castException = (E) exceptionHandler.getException(); - throw castException; - } - @SuppressWarnings("unchecked") - // @SuppressWarnings("unchecked") This cast is safe because - // "resultHandler" contains a value returned by "runnable" and - // "runnable" returns by definition a instance of T - final T tmpResult = (T) resultHandler[0]; - result = tmpResult; - } - return result; - } - - protected class ExceptionHandler { - - private Exception exception; - - public Exception getException() { - return this.exception; - } - - public void setException(final Exception exception) { - this.exception = exception; - } - } - - protected final <E extends Exception> void voidSyncExec( - final AbstractVoidRunnable<E> runnable) throws E { - this.syncExecWithResult(runnable); - } - - protected final <T> T safeSyncExec( - final AbstractExceptionFreeRunnable<T> runnable) { - try { - return this.syncExecWithResult(runnable); - } catch (final Exception e) { - throw new DisplaySyncRuntimeException(e); - } - } - - protected final void voidExceptionFreeRunnable( - final AbstractVoidExceptionFreeRunnable runnable) { - try { - this.syncExecWithResult(runnable); - } catch (final Exception e) { - throw new DisplaySyncRuntimeException(e); - } - } - - public O getSynchronizedObject() { - return this.object; - } - -}
diff --git a/org.eclipse.modisco.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/exported/handler/HandlerUtils.java b/org.eclipse.modisco.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/exported/handler/HandlerUtils.java deleted file mode 100644 index 283beed..0000000 --- a/org.eclipse.modisco.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/exported/handler/HandlerUtils.java +++ /dev/null
@@ -1,153 +0,0 @@ -/** - * Copyright (c) 2011, 2015 Mia-Software, and Soft-Maint. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Alban Ménager (Soft-Maint) - Bug 387470 - [EFacet][Custom] Editors - * Grégoire Dupé (Soft-Maint) - Bug 387470 - [EFacet][Custom] Editors - * Grégoire Dupé (Mia-Software) - Bug 423181 - Unchecked cast in HandlerUtils.getStructuredSelection() - * Thomas Cicognani (Soft-Maint) - Bug 438994 - Optimization of selection in TableWidget - * Jonathan Pepin (Soft-Maint) - Bug 479754 - NullPointer on HandlerUtils.getStructuredSelection() on close Eclipse - */ -package org.eclipse.emf.facet.util.ui.internal.exported.handler; - -import org.eclipse.emf.facet.util.core.DebugUtils; -import org.eclipse.emf.facet.util.ui.internal.Activator; -import org.eclipse.jface.viewers.ISelection; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.swt.widgets.Display; -import org.eclipse.swt.widgets.Shell; -import org.eclipse.ui.IWorkbench; -import org.eclipse.ui.IWorkbenchPage; -import org.eclipse.ui.IWorkbenchPart; -import org.eclipse.ui.IWorkbenchPartSite; -import org.eclipse.ui.IWorkbenchWindow; -import org.eclipse.ui.PlatformUI; - -/** - * Util class for Handlers. - * - * @since 0.3 - */ -public final class HandlerUtils { - - private static final boolean DEBUG = DebugUtils.getDebugStatus(Activator.getDefault()); - - private HandlerUtils() { - // Hidden constructor. - } - - /** - * @since 1.0 - */ - public static IWorkbenchWindow getWorkbenchWindow() { - final IWorkbenchWindow[] result = new IWorkbenchWindow[1]; - final Runnable runnable = new Runnable() { - public void run() { - final IWorkbench workbench = PlatformUI.getWorkbench(); - DebugUtils.debug(HandlerUtils.DEBUG, - "PlatformUI.getWorkbench()==" + workbench); //$NON-NLS-1$ - if (workbench != null) { - final IWorkbenchWindow[] workbenchWindows = workbench - .getWorkbenchWindows(); - DebugUtils - .debug(HandlerUtils.DEBUG, - "PlatformUI.getWorkbench().getWorkbenchWindows().length==" //$NON-NLS-1$ - + workbenchWindows.length); - if ((workbenchWindows.length > 0) - && (workbenchWindows[0].getSelectionService() != null)) { - result[0] = workbenchWindows[0]; - } - } - } - }; - if (Thread.currentThread() == Display.getDefault().getThread()) { - runnable.run(); - } else { - Display.getDefault().syncExec(runnable); - } - return result[0]; - } - - /** - * Return the tree selection of the user's selection. - * - * @return the current tree selection. - */ - public static IStructuredSelection getStructuredSelection() { - IStructuredSelection result = null; - final IWorkbenchWindow workbenchWindow = getWorkbenchWindow(); - if (workbenchWindow != null) { - final ISelection selection = workbenchWindow.getSelectionService() - .getSelection(); - if (selection instanceof IStructuredSelection) { - result = (IStructuredSelection) selection; - } - } - return result; - } - - /** - * Return the current selection. - * - * @return the current selection. - */ - public static Object getSelection() { - Object result = null; - // on a facet model, the selection is obviously a TreeSelection - final IStructuredSelection structSelection = getStructuredSelection(); - if (structSelection != null) { - result = structSelection.getFirstElement(); - } - return result; - } - - /** - * Return the active workbench window. - * - * @return the active workbench window. - */ - public static Shell getWorkbenchWindowShell() { - final IWorkbenchWindow iWorkbenchWindow = PlatformUI.getWorkbench() - .getWorkbenchWindows()[0]; - final IWorkbenchPage iWorkbenchPage = iWorkbenchWindow.getPages()[0]; - final IWorkbenchPart activePart = iWorkbenchPage.getActivePart(); - final IWorkbenchPartSite site = activePart.getSite(); - - return site.getShell(); - } - - /** - * @return The active page - * @since 1.0 - */ - public static IWorkbenchPage getActivePage() { - IWorkbenchPage activePage = null; - final IWorkbench workbench = PlatformUI.getWorkbench(); - if (workbench != null) { - final IWorkbenchWindow window = workbench - .getActiveWorkbenchWindow(); - if (window != null) { - activePage = window.getActivePage(); - } - } - return activePage; - } - - /** - * @return The active part - * @since 1.0 - */ - public static IWorkbenchPart getActivePart() { - IWorkbenchPart activePart = null; - final IWorkbenchPage activePage = getActivePage(); - if (activePage != null) { - activePart = activePage.getActivePart(); - } - return activePart; - } -}
diff --git a/org.eclipse.modisco.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/exported/tree/menu/ITreeMenu.java b/org.eclipse.modisco.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/exported/tree/menu/ITreeMenu.java deleted file mode 100644 index 7c3ff45..0000000 --- a/org.eclipse.modisco.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/exported/tree/menu/ITreeMenu.java +++ /dev/null
@@ -1,44 +0,0 @@ -/** - * Copyright (c) 2012 Mia-Software. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Alban Ménager (Soft-Maint) - Bug 387470 - [EFacet][Custom] Editors - */ -package org.eclipse.emf.facet.util.ui.internal.exported.tree.menu; - -import java.util.List; - -import org.eclipse.emf.facet.util.ui.internal.exported.util.tree.item.AbstractTreeItem; -import org.eclipse.emf.facet.util.ui.internal.exported.util.tree.menu.AbstractTreeMenuItem; -import org.eclipse.emf.facet.util.ui.internal.exported.util.tree.menu.ExtendedTreeMenu; - -/** - * @see ExtendedTreeMenu - * @since 0.3 - * @noextend This interface is not intended to be extended by clients. - * @noimplement This interface is not intended to be implemented by clients. - */ -public interface ITreeMenu<T extends Object> { - - /** - * Select a menu item in the tree menu. - * - * @param menuItemType - * @return an instance of T. - */ - T selectMenuItem(Class<? extends AbstractTreeMenuItem<T>> menuItemType); - - /** - * Select all the items of the tree with the name <code>treeItemName</code> - * - * @param treeItemName - * the name of the item to select. - * @return the list of all the tree item with the name in parameter. - */ - List<AbstractTreeItem<T>> getTreeItems(String treeItemName); -} \ No newline at end of file
diff --git a/org.eclipse.modisco.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/exported/util/composite/FilteredElementSelectionComposite.java b/org.eclipse.modisco.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/exported/util/composite/FilteredElementSelectionComposite.java deleted file mode 100644 index 11f0e55..0000000 --- a/org.eclipse.modisco.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/exported/util/composite/FilteredElementSelectionComposite.java +++ /dev/null
@@ -1,174 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010, 2011, 2012 Mia-Software. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Nicolas Bros (Mia-Software) - initial API and implementation - * Alban Ménager (Soft-Maint) - Bug 387470 - [EFacet][Custom] Editors - *******************************************************************************/ -package org.eclipse.emf.facet.util.ui.internal.exported.util.composite; - -import org.eclipse.emf.facet.util.ui.internal.Messages; -import org.eclipse.emf.facet.util.ui.internal.exported.composite.IFilteredElementSelectionComposite; -import org.eclipse.jface.viewers.LabelProvider; -import org.eclipse.swt.SWT; -import org.eclipse.swt.events.KeyEvent; -import org.eclipse.swt.events.KeyListener; -import org.eclipse.swt.events.ModifyEvent; -import org.eclipse.swt.events.ModifyListener; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.layout.GridLayout; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Text; -import org.eclipse.ui.dialogs.FilteredList; - -/** - * A control for selecting an element from a list of elements, that can be - * filtered using the associated text field. - * - * @since 0.3 - */ -public class FilteredElementSelectionComposite extends Composite implements - IFilteredElementSelectionComposite { - - private final Text filterText; - private final FilteredList fFilteredList; - private String matchPrefix; - - public FilteredElementSelectionComposite(final Composite parent, - final boolean matchAnywhere, final boolean multiSelection) { - super(parent, SWT.BORDER); - setLayout(new GridLayout()); - - this.filterText = createFilterText(this); - this.fFilteredList = createFilteredList(this, multiSelection); - - this.filterText.addModifyListener(new ModifyListener() { - public void modifyText(final ModifyEvent event) { - getfFilteredList().setFilter( - getMatchPrefix(matchAnywhere) - + getFilterText().getText()); - } - }); - - this.filterText.addKeyListener(new KeyListener() { - public void keyPressed(final KeyEvent event) { - if (event.keyCode == SWT.ARROW_DOWN) { - getfFilteredList().setFocus(); - } - } - - public void keyReleased(final KeyEvent event) { - // nothing - } - }); - } - - protected String getMatchPrefix(final boolean matchAnywhere) { - if (matchAnywhere) { - this.matchPrefix = "*"; //$NON-NLS-1$ - } else { - this.matchPrefix = ""; //$NON-NLS-1$ - } - return this.matchPrefix; - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.emf.facet.util.ui.internal.exported.util.composite. - * IFilteredElementSelectionComposite#setElements(java.lang.Object[]) - */ - public void setElements(final Object[] elements) { - this.fFilteredList.setElements(elements); - } - - protected static FilteredList createFilteredList(final Composite parent, - final boolean multiSelection) { - int multi; - if (multiSelection) { - multi = SWT.MULTI; - } else { - multi = SWT.SINGLE; - } - final FilteredList filteredList = new FilteredList(parent, SWT.BORDER - | SWT.V_SCROLL | SWT.H_SCROLL | multi, new LabelProvider(), - true, false, true); - final GridData data = new GridData(); - data.grabExcessVerticalSpace = true; - data.grabExcessHorizontalSpace = true; - data.horizontalAlignment = GridData.FILL; - data.verticalAlignment = GridData.FILL; - filteredList.setLayoutData(data); - filteredList.setFilter(""); //$NON-NLS-1$ - return filteredList; - } - - protected static Text createFilterText(final Composite parent) { - final Text text = new Text(parent, SWT.BORDER); - text.setMessage(Messages.FilteredElementSelectionControl_type_filter_text); - final GridData data = new GridData(); - data.grabExcessVerticalSpace = false; - data.grabExcessHorizontalSpace = true; - data.horizontalAlignment = GridData.FILL; - data.verticalAlignment = GridData.BEGINNING; - text.setLayoutData(data); - return text; - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.emf.facet.util.ui.internal.exported.util.composite. - * IFilteredElementSelectionComposite#getFirstSelectedElement() - */ - public Object getFirstSelectedElement() { - Object result = null; - final Object[] selection = this.fFilteredList.getSelection(); - if (selection.length > 0) { - result = selection[0]; - } - return result; - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.emf.facet.util.ui.internal.exported.util.composite. - * IFilteredElementSelectionComposite#getSelectedElements() - */ - public Object[] getSelectedElements() { - Object[] result = null; - if (this.fFilteredList.getSelection().length > 0) { - result = this.fFilteredList.getSelection(); - } - return result; - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.emf.facet.util.ui.internal.exported.util.composite. - * IFilteredElementSelectionComposite#getFilteredList() - */ - public FilteredList getFilteredList() { - return this.fFilteredList; - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.emf.facet.util.ui.internal.exported.util.composite. - * IFilteredElementSelectionComposite#getFilterText() - */ - public Text getFilterText() { - return this.filterText; - } - - protected FilteredList getfFilteredList() { - return this.fFilteredList; - } -}
diff --git a/org.eclipse.modisco.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/exported/util/composite/SynchronizedFilteredElementSelectionComposite.java b/org.eclipse.modisco.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/exported/util/composite/SynchronizedFilteredElementSelectionComposite.java deleted file mode 100644 index a889860..0000000 --- a/org.eclipse.modisco.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/exported/util/composite/SynchronizedFilteredElementSelectionComposite.java +++ /dev/null
@@ -1,89 +0,0 @@ -/** - * Copyright (c) 2012 Mia-Software. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Alban Ménager (Soft-Maint) - Bug 387470 - [EFacet][Custom] Editors - */ -package org.eclipse.emf.facet.util.ui.internal.exported.util.composite; - -import org.eclipse.emf.facet.util.ui.internal.exported.composite.IFilteredElementSelectionComposite; -import org.eclipse.emf.facet.util.ui.internal.exported.displaysync.AbstractExceptionFreeRunnable; -import org.eclipse.emf.facet.util.ui.internal.exported.displaysync.AbstractVoidExceptionFreeRunnable; -import org.eclipse.emf.facet.util.ui.internal.exported.displaysync.SynchronizedObject; -import org.eclipse.swt.widgets.Display; -import org.eclipse.swt.widgets.Text; -import org.eclipse.ui.dialogs.FilteredList; - -/** - * @since 0.3 - */ -public class SynchronizedFilteredElementSelectionComposite<T extends IFilteredElementSelectionComposite> - extends SynchronizedObject<T> implements - IFilteredElementSelectionComposite { - - /** - * @param object - * @param display - */ - public SynchronizedFilteredElementSelectionComposite(final T object, - final Display display) { - super(object, display); - } - - public void setElements(final Object[] elements) { - this.voidExceptionFreeRunnable(new AbstractVoidExceptionFreeRunnable() { - @Override - public void voidSafeRun() { - SynchronizedFilteredElementSelectionComposite.this - .getSynchronizedObject().setElements(elements); - } - }); - } - - public Object getFirstSelectedElement() { - return this.safeSyncExec(new AbstractExceptionFreeRunnable<Object>() { - @Override - public Object safeRun() { - return SynchronizedFilteredElementSelectionComposite.this - .getSynchronizedObject().getFirstSelectedElement(); - } - }); - } - - public Object[] getSelectedElements() { - return this.safeSyncExec(new AbstractExceptionFreeRunnable<Object[]>() { - @Override - public Object[] safeRun() { - return SynchronizedFilteredElementSelectionComposite.this - .getSynchronizedObject().getSelectedElements(); - } - }); - } - - public FilteredList getFilteredList() { - return this - .safeSyncExec(new AbstractExceptionFreeRunnable<FilteredList>() { - @Override - public FilteredList safeRun() { - return SynchronizedFilteredElementSelectionComposite.this - .getSynchronizedObject().getFilteredList(); - } - }); - } - - public Text getFilterText() { - return this.safeSyncExec(new AbstractExceptionFreeRunnable<Text>() { - @Override - public Text safeRun() { - return SynchronizedFilteredElementSelectionComposite.this - .getSynchronizedObject().getFilterText(); - } - }); - } - -}
diff --git a/org.eclipse.modisco.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/exported/util/dialog/AbstractDialog.java b/org.eclipse.modisco.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/exported/util/dialog/AbstractDialog.java deleted file mode 100644 index 260d499..0000000 --- a/org.eclipse.modisco.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/exported/util/dialog/AbstractDialog.java +++ /dev/null
@@ -1,169 +0,0 @@ -/** - * Copyright (c) 2012 Mia-Software. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Alban Ménager (Soft-Maint) - Bug 387470 - [EFacet][Custom] Editors - * Grégoire Dupé (Mia-Software) - Bug 387470 - [EFacet][Custom] Editors - */ -package org.eclipse.emf.facet.util.ui.internal.exported.util.dialog; - -import org.eclipse.core.commands.Command; -import org.eclipse.emf.facet.util.ui.internal.exported.WidgetProperties; -import org.eclipse.emf.facet.util.ui.internal.exported.dialog.IDialog; -import org.eclipse.emf.facet.util.ui.internal.exported.util.widget.command.ICommandWidget; -import org.eclipse.jface.dialogs.TitleAreaDialog; -import org.eclipse.swt.graphics.Rectangle; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Control; -import org.eclipse.swt.widgets.Display; -import org.eclipse.swt.widgets.Monitor; -import org.eclipse.swt.widgets.Shell; - -/** - * Abstract class representing a dialog. Some methods are implemented to avoid - * unnecessary duplication code. - * - * @param <CB> - * The type of the callback. - * @param <P> - * The type of the key of the {@link WidgetProperties} - * @since 0.3 - */ -public abstract class AbstractDialog<CB extends Object, W extends ICommandWidget> - extends TitleAreaDialog implements IDialog<W> { - - // Attributes. - private W widget; - private Composite dialogComposite; - private CB callback; - - /** - * Constructor. - * - * @param callback - * the callback - * @param properties - * the properties that the widget needs - */ - protected AbstractDialog(final CB callback) { - this(); - this.callback = callback; - } - - /** - * Constructor. - */ - protected AbstractDialog() { - super(createDisplayedShell()); - } - - private static Shell createDisplayedShell() { - final Display display = Display.getDefault(); - final Shell shell = new Shell(display); - final Monitor primary = display.getPrimaryMonitor(); - final Rectangle bounds = primary.getBounds(); - final Rectangle rect = shell.getBounds(); - final int xLocation = bounds.x + ((bounds.width - rect.width) / 2); - final int yLocation = bounds.y + ((bounds.height - rect.height) / 2); - shell.setLocation(xLocation, yLocation); - return shell; - } - - /** - * Execute the widget {@link Command}. - */ - protected abstract void execute(); - - /** - * Check if all the required attributes are setted ({@link #isDialogValid()} - * and call the method {@link #execute()} to get and execute the widget - * command. If the dialog is not valid, this method display the errors with - * the method {@link #setErrorMessage(String)}. - */ - @Override - protected void okPressed() { - if (isDialogValid()) { - getWidget().onDialogValidation(); - execute(); - super.okPressed(); - } else { - setErrorMessage(getWidget().getError()); - } - } - - /** - * Set the title and the message dialog. Create the associated widget and - * all sub widgets of this widget. - */ - @Override - protected Control createDialogArea(final Composite parent) { - setTitle(getDialogTitle()); - setMessage(getDialogMessage()); - // Composite is a subtype of Control. - this.dialogComposite = (Composite) super.createDialogArea(parent); - this.widget = createWidget(); - this.widget.createWidgetContent(); - return this.widget.adapt(Control.class); - } - - public Composite getDialogComposite() { - return this.dialogComposite; - } - - /** - * Create the associated widget to the dialog. - * - * @return an instance of the widget. - */ - protected abstract W createWidget(); - - /** - * Return the message at the top of the dialog. - * - * @return the message. - */ - protected abstract String getDialogMessage(); - - /** - * Return the title of the dialog. - * - * @return the title. - */ - protected abstract String getDialogTitle(); - - - public boolean isDialogValid() { - boolean result = true; - final String error = getWidget().getError(); - if (error != null) { - result = false; - } - - return result; - } - - public W getWidget() { - return this.widget; - } - - public void commit() { - okPressed(); - } - - public void cancel() { - cancelPressed(); - } - - /** - * @return the callback - */ - public CB getCallback() { - return this.callback; - } - -}
diff --git a/org.eclipse.modisco.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/exported/util/dialog/AbstractDialogWithCallback.java b/org.eclipse.modisco.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/exported/util/dialog/AbstractDialogWithCallback.java deleted file mode 100644 index 1ce1301..0000000 --- a/org.eclipse.modisco.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/exported/util/dialog/AbstractDialogWithCallback.java +++ /dev/null
@@ -1,58 +0,0 @@ -/** - * Copyright (c) 2012 Mia-Software. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Alban Ménager (Soft-Maint) - Bug 387470 - [EFacet][Custom] Editors - * Grégoire Dupé (Mia-Software) - Bug 387470 - [EFacet][Custom] Editors - */ -package org.eclipse.emf.facet.util.ui.internal.exported.util.dialog; - -import org.eclipse.emf.facet.util.ui.internal.exported.dialog.IDialogWithoutResultCallback; -import org.eclipse.emf.facet.util.ui.internal.exported.dialog.IWithResultDialogCallback; -import org.eclipse.emf.facet.util.ui.internal.exported.util.widget.command.ICommandWidget; - -/** - * Abstract dialog with an {@link IDialogWithoutResultCallback} in parameter. - * - * @since 0.3 - */ -public abstract class AbstractDialogWithCallback<T extends Object, W extends ICommandWidget> - extends AbstractDialog<IWithResultDialogCallback<T>, W> { - - /** - * Constructor. - * - * @param editingDomain - * the current editing domain - * @param properties - * the properties that the widget needs - */ - protected AbstractDialogWithCallback( - final IWithResultDialogCallback<T> callback) { - super(callback); - } - - @Override - protected void okPressed() { - if (isDialogValid() && (getCallback() != null)) { - getCallback().commited(getResult()); - } - super.okPressed(); - } - - protected abstract T getResult(); - - @Override - protected void cancelPressed() { - if (getCallback() != null) { - getCallback().canceled(getResult()); - } - super.cancelPressed(); - } - -}
diff --git a/org.eclipse.modisco.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/exported/util/dialog/AbstractMainDialog.java b/org.eclipse.modisco.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/exported/util/dialog/AbstractMainDialog.java deleted file mode 100644 index 5b01c6d..0000000 --- a/org.eclipse.modisco.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/exported/util/dialog/AbstractMainDialog.java +++ /dev/null
@@ -1,62 +0,0 @@ -/** - * Copyright (c) 2012 Mia-Software. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Alban Ménager (Soft-Maint) - Bug 387470 - [EFacet][Custom] Editors - * Grégoire Dupé (Mia-Software) - Bug 387470 - [EFacet][Custom] Editors - */ -package org.eclipse.emf.facet.util.ui.internal.exported.util.dialog; - -import org.eclipse.emf.facet.util.ui.internal.exported.WidgetProperties; -import org.eclipse.emf.facet.util.ui.internal.exported.util.widget.AbstractWidget; -import org.eclipse.emf.facet.util.ui.internal.exported.util.widget.command.AbstractCommandWidget; -import org.eclipse.emf.facet.util.ui.internal.exported.util.widget.command.ICommandWidget; - -/** - * This abstract class will create a dialog. All the action's dialog must - * extends this class. It provides a simple way to create a standard dialog for - * this ui.</p> - * - * A single {@link AbstractCommandWidget} is created by the dialog wich will - * contain all the subwidgets {@link AbstractWidget}. - * - * The dialog have to create all the properties {@link WidgetProperties} that - * the widgets {@link AbstractCommandWidget} will need. - * - * @see AbstractCommandWidget - * @see AbstractWidget - * @see AbstractAddElementDialog - * @since 0.3 - */ -public abstract class AbstractMainDialog<W extends ICommandWidget> - extends AbstractDialog<Object, W> { - - private final Object selection; - - /** - * Constructor. - * - * @param callback - * the callback. - * @param editedElement - * the selection in the model (ecore file). - */ - protected AbstractMainDialog(final Object editedElement) { - super(); - this.selection = editedElement; - } - - /** - * @return the selection in the model. - */ - protected Object getSelection() { - return this.selection; - } - - -}
diff --git a/org.eclipse.modisco.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/exported/util/dialog/SynchronizedAbstractDialog.java b/org.eclipse.modisco.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/exported/util/dialog/SynchronizedAbstractDialog.java deleted file mode 100644 index 165391f..0000000 --- a/org.eclipse.modisco.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/exported/util/dialog/SynchronizedAbstractDialog.java +++ /dev/null
@@ -1,94 +0,0 @@ -/** - * Copyright (c) 2012 Mia-Software. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Alban Ménager (Soft-Maint) - Bug 387470 - [EFacet][Custom] Editors - * Grégoire Dupé (Mia-Software) - Bug 387470 - [EFacet][Custom] Editors - */ -package org.eclipse.emf.facet.util.ui.internal.exported.util.dialog; - -import org.eclipse.emf.facet.util.ui.internal.exported.dialog.IDialog; -import org.eclipse.emf.facet.util.ui.internal.exported.displaysync.AbstractExceptionFreeRunnable; -import org.eclipse.emf.facet.util.ui.internal.exported.displaysync.AbstractVoidExceptionFreeRunnable; -import org.eclipse.emf.facet.util.ui.internal.exported.displaysync.SynchronizedObject; -import org.eclipse.swt.widgets.Display; - -/** - * Synchronized class for safe run. - * - * @see AbstractDialog - * @since 0.3 - * - */ -public class SynchronizedAbstractDialog<W extends Object> extends - SynchronizedObject<IDialog<W>> implements IDialog<W> { - - /** - * Constructor. - * - * @param object - * the to synchronized. - * @param display - * the display. - */ - public SynchronizedAbstractDialog(final IDialog<W> object, - final Display display) { - super(object, display); - } - - public void commit() { - this.voidExceptionFreeRunnable(new AbstractVoidExceptionFreeRunnable() { - @Override - public void voidSafeRun() { - SynchronizedAbstractDialog.this.getSynchronizedObject() - .commit(); - } - }); - } - - public void cancel() { - this.voidExceptionFreeRunnable(new AbstractVoidExceptionFreeRunnable() { - @Override - public void voidSafeRun() { - SynchronizedAbstractDialog.this.getSynchronizedObject() - .cancel(); - } - }); - } - - public int open() { - return this.safeSyncExec(new AbstractExceptionFreeRunnable<Integer>() { - @Override - public Integer safeRun() { - return Integer.valueOf(SynchronizedAbstractDialog.this - .getSynchronizedObject().open()); - } - }).intValue(); - } - - public boolean isDialogValid() { - return this.safeSyncExec(new AbstractExceptionFreeRunnable<Boolean>() { - @Override - public Boolean safeRun() { - return Boolean.valueOf(SynchronizedAbstractDialog.this - .getSynchronizedObject().isDialogValid()); - } - }).booleanValue(); - } - - public W getWidget() { - return this.safeSyncExec(new AbstractExceptionFreeRunnable<W>() { - @Override - public W safeRun() { - return SynchronizedAbstractDialog.this.getSynchronizedObject() - .getWidget(); - } - }); - } - -}
diff --git a/org.eclipse.modisco.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/exported/util/handler/AbstractSelectionExpectedTypeHandler.java b/org.eclipse.modisco.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/exported/util/handler/AbstractSelectionExpectedTypeHandler.java deleted file mode 100644 index dddd61c..0000000 --- a/org.eclipse.modisco.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/exported/util/handler/AbstractSelectionExpectedTypeHandler.java +++ /dev/null
@@ -1,51 +0,0 @@ -/** - * Copyright (c) 2012 Mia-Software. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Alban Ménager (Soft-Maint) - Bug 387470 - [EFacet][Custom] Editors - * Grégoire Dupé (Soft-Maint) - Bug 387470 - [EFacet][Custom] Editors - */ -package org.eclipse.emf.facet.util.ui.internal.exported.util.handler; - -import org.eclipse.core.commands.AbstractHandler; -import org.eclipse.emf.facet.util.ui.internal.exported.handler.HandlerUtils; - -/** - * Abstract handler. All handlers must extends this class. - * - * @see IFunctionDialogFactory - * - * @see CreateFacetInFacetSetHandler - * @see CreateFacetSetInFacetSetHandler - * @see AddAttributeInFacetHandler - * @see AddOperationInFacetHandler - * @see AddReferenceInFacetHandler - * @see AddParameterInOperationHandler - * @since 0.3 - */ -public abstract class AbstractSelectionExpectedTypeHandler extends AbstractHandler { - - @Override - public boolean isEnabled() { - boolean result = false; - if ((HandlerUtils.getStructuredSelection() != null && HandlerUtils - .getStructuredSelection().size() == 1) - && getSelectionExpectedType().isInstance( - HandlerUtils.getSelection())) { - result = true; - } - return result; - } - - /** - * Return the expected type of the selection. - * - * @return the type expected. - */ - protected abstract Class<?> getSelectionExpectedType(); -}
diff --git a/org.eclipse.modisco.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/exported/util/tree/ExtendedTree.java b/org.eclipse.modisco.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/exported/util/tree/ExtendedTree.java deleted file mode 100644 index 427cb70..0000000 --- a/org.eclipse.modisco.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/exported/util/tree/ExtendedTree.java +++ /dev/null
@@ -1,174 +0,0 @@ -/** - * Copyright (c) 2012 Mia-Software. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Alban Ménager (Soft-Maint) - Bug 387470 - [EFacet][Custom] Editors - */ -package org.eclipse.emf.facet.util.ui.internal.exported.util.tree; - -import java.util.List; -import java.util.Map; - -import org.eclipse.emf.facet.util.ui.internal.exported.dialog.IDialog; -import org.eclipse.emf.facet.util.ui.internal.exported.util.tree.item.AbstractTreeItem; -import org.eclipse.emf.facet.util.ui.internal.exported.util.tree.menu.AbstractTreeMenu; -import org.eclipse.emf.facet.util.ui.internal.exported.util.tree.menu.ExtendedTreeMenu; -import org.eclipse.swt.SWT; -import org.eclipse.swt.events.KeyEvent; -import org.eclipse.swt.events.KeyListener; -import org.eclipse.swt.events.MouseEvent; -import org.eclipse.swt.events.MouseListener; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Listener; -import org.eclipse.swt.widgets.Tree; - -/** - * This class provides the creation of a {@link Tree} but with extended - * elements.</p> - * - * This tree creates its menu {@link ExtendedTreeMenu} and had the list of all the items - * of the tree accessible with the method {@link #getTreeItems()}. - * - * </p> Only one element of the tree can be selected at the same time. - * - * @since 0.3 - */ -public class ExtendedTree { - - private static final int TREE_HEIGHT = 250; - private final Tree tree; - private final ExtendedTreeMenu<IDialog> treeMenu; - private Listener listener; - - /** - * Constructor. - * - * Create a new instance of a {@link Tree} and create the {@link ExtendedTreeMenu} - * with the <code>menuItems</code> in parameter. - * - * @param parent - * the parent of the TreeExtended. - * @param menuItems - * the items of the menu. - * - * @see ExtendedTreeMenu - * @see AbstractTreeMenu - */ - public ExtendedTree(final Composite parent, - final List<AbstractTreeMenu<IDialog>> menuItems) { - - // SWT.SINGLE -> a unique selection on the tree possible - this.tree = new Tree(parent, SWT.SINGLE | SWT.NONE); - final GridData gridData = new GridData(GridData.FILL_HORIZONTAL); - gridData.heightHint = TREE_HEIGHT; - this.tree.setLayoutData(gridData); - this.tree.addMouseListener(new MouseListener() { - - public void mouseUp(final MouseEvent mouseEvent) { - // Nothing. - } - - public void mouseDown(final MouseEvent mouseEvent) { - // Nothing. - } - - public void mouseDoubleClick(final MouseEvent mouseEvent) { - onMouseDoubleClick(); - } - }); - this.tree.addKeyListener(new KeyListener() { - - public void keyReleased(final KeyEvent event) { - // Nothing. - } - - public void keyPressed(final KeyEvent event) { - onKeyPressed(event); - } - }); - this.treeMenu = new ExtendedTreeMenu<IDialog>(parent, this, menuItems); - this.getTreeMenu().createMenu(); - this.tree.setMenu(this.getTreeMenu().getMenu()); - } - - /** - * This method is called when a key is pressed on the tree. - */ - protected void onKeyPressed(final KeyEvent event) { - if (event.keyCode == SWT.DEL) { - this.getTreeMenu().removeCurrentItemSelected(); - } - } - - /** - * When the mouse does a double click on an element of the tree. - */ - protected void onMouseDoubleClick() { - if (getTree().getSelection().length > 0) { - // new Tree(parent, SWT.SINGLE | SWT.NONE) -> the tree can only had - // one selection at the same time. - this.getTreeMenu().onMouseSelection(); - } - } - - /** - * @return the {@link Tree} created by this class. - */ - public Tree getTree() { - return this.tree; - } - - /** - * Add a {@link ModificationListener} to the list of listeners of the tree. - * - * @param listener - */ - public void setListener(final Listener listener) { - this.listener = listener; - } - - /** - * When a modification appends, this method has to be called and the method - * {@link #notifyChanged()} is called for the listener of this Tree. - */ - public void fireChanged() { - this.listener.handleEvent(null); - } - - /** - * @return a map of properties to pass to the {@link AbstractTreeItem}. Each - * items add to override the method - * {@link AbstractTreeItem#getExtraProperties(Map)} to get this - * properties. - */ - public void putExtraPropertiesToItems(final Map<String, Object> properties) { - this.getTreeMenu().putExtraProperties(properties); - } - - /** - * Return the first {@link AbstractTreeItem} of the tree. - * - * @return the first item of the tree. - */ - public AbstractTreeItem<IDialog> getFirstTreeItem() { - AbstractTreeItem<IDialog> result = null; - if (this.tree.getItemCount() > 0) { - result = this.getTreeMenu().getTreeItemExtended(this.tree.getItem(0)); - } - return result; - } - - /** - * @return the treeMenu of this tree. - */ - public ExtendedTreeMenu<IDialog> getTreeMenu() { - return this.treeMenu; - } - -}
diff --git a/org.eclipse.modisco.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/exported/util/tree/item/AbstractTreeItem.java b/org.eclipse.modisco.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/exported/util/tree/item/AbstractTreeItem.java deleted file mode 100644 index d2f6920..0000000 --- a/org.eclipse.modisco.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/exported/util/tree/item/AbstractTreeItem.java +++ /dev/null
@@ -1,210 +0,0 @@ -/** - * Copyright (c) 2012 Mia-Software. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Alban Ménager (Soft-Maint) - Bug 387470 - [EFacet][Custom] Editors - */ -package org.eclipse.emf.facet.util.ui.internal.exported.util.tree.item; - -import java.util.Map; - -import org.eclipse.emf.facet.util.ui.internal.Messages; -import org.eclipse.emf.facet.util.ui.internal.exported.dialog.IDialog; -import org.eclipse.emf.facet.util.ui.internal.exported.util.tree.ExtendedTree; -import org.eclipse.emf.facet.util.ui.internal.exported.util.tree.menu.AbstractTreeMenuItem; -import org.eclipse.swt.SWT; -import org.eclipse.swt.widgets.Tree; -import org.eclipse.swt.widgets.TreeItem; - -/** - * This abstract class represent an item of the tree. All the item types of the - * tree must extend this abstract class. - * - * @since 0.3 - */ -public abstract class AbstractTreeItem<T extends Object> { - - private AbstractTreeMenuItem<T> menuItem; - private TreeItem treeItem; - private Map<String, Object> extraProperties; - - /** - * Create a new item {@link TreeItem} into the parent. - * - * @param parent - * the parent of the item to create. - */ - public TreeItem createItem(final AbstractTreeMenuItem<T> itemMenu, - final Tree parent) { - this.menuItem = itemMenu; - final TreeItem item = new TreeItem(parent, SWT.NONE); - initialize(item); - return item; - } - - /** - * Create a new item {@link TreeItem} into the parent. - * - * @param parent - * the parent of the item to create. - */ - public TreeItem createItem(final AbstractTreeMenuItem<T> itemMenu, - final TreeItem parent) { - this.menuItem = itemMenu; - final TreeItem item = new TreeItem(parent, SWT.NONE); - // Open the parent of the item on the tree. - parent.setExpanded(true); - initialize(item); - return item; - } - - /** - * Initialize the tree item with the text and call the method - * {@link #onItemCreation()} if the user wants an extra action. - */ - private void initialize(final TreeItem item) { - item.setChecked(true); - if ((getItemText() == null) || "".equals(getItemText())) { //$NON-NLS-1$ - item.setText(getDefaultItemText()); - } else { - item.setText(getItemText()); - } - fireChanged(); - this.setTreeItem(item); - } - - /** - * Return the default message when the item is created. - * - * @return the default message. - */ - public static String getDefaultItemText() { - return Messages.item_todo; - } - - /** - * Return the text to display for the item. This text can be null or an - * empty string (the value of the string will be {@link Messages#item_todo} - * ). The item text can be setted later with {@link #setItemText(String)}. - * - * @return the text of the item in the tree. - */ - public abstract String getItemText(); - - /** - * Called when this object will be instantiate. - */ - public abstract T onItemCreation(); - - /** - * This method is called when the item of the tree is selected. - */ - public abstract IDialog onItemMouseSelection(); - - /** - * Return the value of this item. - * - * @return the value. - */ - public abstract Object returnValue(); - - /** - * Delete the item and all his children of the tree. - */ - public void removeItem() { - for (final TreeItem item : getChildren()) { - findTreeItemExtended(item).removeItem(); - } - this.getTreeItem().dispose(); - fireChanged(); - } - - /** - * Return the children of this item in the tree. - * - * @return the list of the children. - */ - public TreeItem[] getChildren() { - return this.getTreeItem().getItems(); - } - - /** - * Return the parent of this item on the tree. - * - * @return the parent of the item or null if the item is root. - */ - public AbstractTreeItem<T> getParent() { - return findTreeItemExtended(getTreeItem().getParentItem()); - } - - /** - * Edit the text of the item into the tree. - * - * @param newText - * the new text. - */ - public void setTreeItemText(final String newText) { - this.getTreeItem().setText(newText); - } - - /** - * When a modification append, this method has to be called and the method - * {@link #notifyChanged()} is called for the listener of this Tree. - */ - protected void fireChanged() { - this.getMenuItem().fireChanged(); - } - - /** - * @return the treeItem - */ - public TreeItem getTreeItem() { - return this.treeItem; - } - - /** - * @param treeItem - * the treeItem to set - */ - private void setTreeItem(final TreeItem treeItem) { - this.treeItem = treeItem; - } - - /** - * @return the menuItem - */ - public AbstractTreeMenuItem<T> getMenuItem() { - return this.menuItem; - } - - /** - * @param item - * @return - */ - public AbstractTreeItem<T> findTreeItemExtended(final TreeItem item) { - return getMenuItem().findTreeItemExtended(item); - } - - /** - * This method gets the <code>properties</code> passed by the - * {@link #treeExtended} via the method - * {@link ExtendedTree#putExtraPropertiesToItems(Map)}. - * - * @return the extraProperties - */ - public Map<String, Object> getExtraProperties() { - return this.extraProperties; - } - - /** - * @param extraProperties the extraProperties to set - */ - public void setExtraProperties(final Map<String, Object> extraProperties) { - this.extraProperties = extraProperties; - } -}
diff --git a/org.eclipse.modisco.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/exported/util/tree/menu/AbstractTreeMenu.java b/org.eclipse.modisco.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/exported/util/tree/menu/AbstractTreeMenu.java deleted file mode 100644 index 4f3f0d5..0000000 --- a/org.eclipse.modisco.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/exported/util/tree/menu/AbstractTreeMenu.java +++ /dev/null
@@ -1,205 +0,0 @@ -/** - * Copyright (c) 2012 Mia-Software. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Alban Ménager (Soft-Maint) - Bug 387470 - [EFacet][Custom] Editors - */ -package org.eclipse.emf.facet.util.ui.internal.exported.util.tree.menu; - -import java.util.Map; - -import org.eclipse.emf.facet.util.ui.internal.exported.util.tree.item.AbstractTreeItem; -import org.eclipse.swt.SWT; -import org.eclipse.swt.events.SelectionEvent; -import org.eclipse.swt.events.SelectionListener; -import org.eclipse.swt.widgets.Menu; -import org.eclipse.swt.widgets.MenuItem; -import org.eclipse.swt.widgets.Tree; -import org.eclipse.swt.widgets.TreeItem; - -/** - * Abstract class providing the creation of any item into the menu. - * - * @see AbstractTreeMenuItem - * @see AbstractTreeSubMenu - * @since 0.3 - */ -public abstract class AbstractTreeMenu<T extends Object> { - - private ExtendedTreeMenu<T> treeMenu; - private MenuItem menuItem; - private boolean menuItemCreated; - private Map<String, Object> properties; - - /** - * Refresh the the menu according to the actual context. - */ - public void refresh(final ExtendedTreeMenu<T> menu) { - this.treeMenu = menu; - refreshMenu(this.treeMenu.getMenu()); - } - - /** - * Refresh the the menu according to the actual context. - */ - public void refresh(final ExtendedTreeMenu<T> menuTree, final Menu menu) { - this.treeMenu = menuTree; - refreshMenu(menu); - } - - /** - * Refresh the the menu according to the actual context. - */ - private void refreshMenu(final Menu menu) { - if (isEnabled()) { - if (this.isMenuItemCreated()) { - deleteMenuItem(); - } - this.setMenuItemCreated(true); - this.menuItem = createMenuItem(menu); - } else { - deleteMenuItem(); - this.setMenuItemCreated(false); - } - } - - /** - * Return if the menu item has to be enabled or not (by checking if the - * associated AbstractTreeItem is enabled or not). - * - * @return if the menu item has to be enabled or not. - */ - public boolean isEnabled(final ExtendedTreeMenu<T> menuTree) { - this.treeMenu = menuTree; - return isEnabled(); - } - - /** - * Return if the menu item has to be enabled or not (by checking if the - * associated AbstractTreeItem is enabled or not). - * - * @return if the menu item has to be enabled or not. - */ - public abstract boolean isEnabled(); - - /** - * Create the concrete item. Has to be overrided by the classes extending - * this abstract class. - * - * @param parent - * the parent of the item. - * @return the item created. - */ - protected MenuItem createMenuItem(final Menu parent) { - final MenuItem item = new MenuItem(parent, SWT.NONE); - item.setText(getMenuName()); - item.addSelectionListener(new SelectionListener() { - - public void widgetSelected(final SelectionEvent selectionEvent) { - onMenuItemSelection(); - } - - public void widgetDefaultSelected( - final SelectionEvent selectionEvent) { - // Nothing. - } - }); - return item; - } - - /** - * @return the menu item name. - */ - public abstract String getMenuName(); - - /** - * This method is called when the menu item is selected. - * - * @return can return an instance of T. - */ - public abstract T onMenuItemSelection(); - - /** - * Delete the item of the menu. - */ - public void deleteMenuItem() { - if (this.isMenuItemCreated() && (this.menuItem != null) - && !this.menuItem.isDisposed()) { - if (this.menuItem.getMenu() != null) { - this.menuItem.getMenu().dispose(); - } - this.menuItem.dispose(); - } - } - - /** - * @return the treeMenu of the tree. - */ - public ExtendedTreeMenu<T> getTreeMenu() { - return this.treeMenu; - } - - /** - * Set the properties to pass to the new items. - * - * @param extraProperties - * the properties to pass. - * - */ - public void setExtraProperties(final Map<String, Object> extraProperties) { - this.properties = extraProperties; - } - - /** - * @return the {@link Tree}. - */ - public Tree getTree() { - return this.treeMenu.getTree(); - } - - /** - * @return the properties. - */ - public Map<String, Object> getProperties() { - return this.properties; - } - - /** - * @return true if the menu for this concrete item is created or not. - */ - public boolean isMenuItemCreated() { - return this.menuItemCreated; - } - - /** - * @param menuItemCreated - * the menuItemCreated to set. - */ - public void setMenuItemCreated(final boolean menuItemCreated) { - this.menuItemCreated = menuItemCreated; - } - - /** - * Return the {@link AbstractTreeItem} according to the {@link TreeItem}. - * - * @param treeItem - * the treeItem related. - * @return the {@link AbstractTreeItem} related to the <code>treeItem</code> - * . - */ - public abstract AbstractTreeItem<T> getTreeItemExtended( - final TreeItem treeItem); - - /** - * Remove the item in parameter of the tree. - * - * @param item - * the item to remove. - */ - public abstract boolean removeItem(final TreeItem item); -}
diff --git a/org.eclipse.modisco.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/exported/util/tree/menu/AbstractTreeMenuItem.java b/org.eclipse.modisco.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/exported/util/tree/menu/AbstractTreeMenuItem.java deleted file mode 100644 index 1be61eb..0000000 --- a/org.eclipse.modisco.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/exported/util/tree/menu/AbstractTreeMenuItem.java +++ /dev/null
@@ -1,213 +0,0 @@ -/** - * Copyright (c) 2012 Mia-Software. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Alban Ménager (Soft-Maint) - Bug 387470 - [EFacet][Custom] Editors - */ -package org.eclipse.emf.facet.util.ui.internal.exported.util.tree.menu; - -import java.util.LinkedList; -import java.util.List; - -import org.eclipse.emf.facet.util.core.Logger; -import org.eclipse.emf.facet.util.ui.internal.Activator; -import org.eclipse.emf.facet.util.ui.internal.exported.util.tree.item.AbstractTreeItem; -import org.eclipse.swt.widgets.Tree; -import org.eclipse.swt.widgets.TreeItem; - -/** - * Abstract class for the tree menu item. Each Menu Item had an handler which - * provide the methods: <li>{@link #isEnabled()} : return if the menu item has - * to be displayed.</li> <li>{@link #onMenuItemSelection()} : this method will - * be execute when the item is selected.</li> <li> - * {@link #getAssociatedTreeItemClass()} : links this class with an - * {@link AbstractTreeItem}. This item will be instantiate when the user select - * this element on the tree menu.</li> - * - * @see AbstractTreeItem - * @see AbstractTreeMenu - * @since 0.3 - */ -public abstract class AbstractTreeMenuItem<T extends Object> extends - AbstractTreeMenu<T> { - - private final List<AbstractTreeItem<T>> items; - - /** - * Constructor. - */ - public AbstractTreeMenuItem() { - super(); - this.items = new LinkedList<AbstractTreeItem<T>>(); - } - - /** - * This method creates the associated item and set the extra properties to - * it. - */ - @Override - public T onMenuItemSelection() { - AbstractTreeItem<T> item = null; - if (getCurrentItemSelected() == null) { - item = createItem(getTree()); - } else { - item = createItem(getCurrentItemSelected()); - } - this.getItems().add(item); - item.setExtraProperties(getProperties()); - fireChanged(); - return item.onItemCreation(); - } - - /** - * Create a new item {@link TreeItem} into the parent. - * - * @param parent - * the parent of the item to create. - */ - public AbstractTreeItem<T> createItem(final Tree parent) { - return createTreeItem(parent); - } - - /** - * Create a new item {@link TreeItem} into the parent. - * - * @param parent - * the parent of the item to create. - */ - public AbstractTreeItem<T> createItem(final TreeItem parent) { - return createTreeItem(parent); - } - - /** - * Create a new item {@link TreeItem} into the parent. - * - * @param parent - * the parent of the item to create. - */ - protected AbstractTreeItem<T> createTreeItem(final Object parent) { - AbstractTreeItem<T> newTreeItem = null; - try { - newTreeItem = getAssociatedTreeItemClass().newInstance(); - if (parent instanceof Tree) { - newTreeItem.createItem(this, (Tree) parent); - } else if (parent instanceof TreeItem) { - newTreeItem.createItem(this, (TreeItem) parent); - } - } catch (final SecurityException e) { - Logger.logError(e, Activator.getDefault()); - } catch (final IllegalArgumentException e) { - Logger.logError(e, Activator.getDefault()); - } catch (final InstantiationException e) { - Logger.logError(e, Activator.getDefault()); - } catch (final IllegalAccessException e) { - Logger.logError(e, Activator.getDefault()); - } - - return newTreeItem; - } - - /** - * Find the treeItem searching into the all tree. - * - * @param treeItem - * the treeItem to find. - * @return the corresponding {@link AbstractTreeItem}. Null if not. - */ - public AbstractTreeItem<T> findTreeItemExtended(final TreeItem treeItem) { - return this.getTreeMenu().getTreeItemExtended(treeItem); - } - - /** - * This method only find the item into the corresponding element of this - * menu item. To find an element searching it into the all tree, use the - * method {@link #findTreeItemExtended(TreeItem)}. - */ - @Override - public AbstractTreeItem<T> getTreeItemExtended(final TreeItem item) { - AbstractTreeItem<T> result = null; - for (final AbstractTreeItem<T> itemExtended : this.getItems()) { - if (itemExtended.getTreeItem().equals(item)) { - result = itemExtended; - break; - } - } - return result; - } - - @Override - public boolean removeItem(final TreeItem item) { - boolean removed = false; - final AbstractTreeItem<T> itemExtended = findTreeItemExtended(item); - if (itemExtended != null) { - this.getItems().remove(itemExtended); - itemExtended.removeItem(); - removed = true; - fireChanged(); - } - return removed; - } - - /** - * @return get the current selection of the tree. - */ - public TreeItem getCurrentItemSelected() { - return getTreeMenu().getCurrentItemSelected(); - } - - /** - * Remove the last item created. - */ - protected void removeLastItem() { - // The list created is a LinkedList<AbstractTreeItem> - ((LinkedList<AbstractTreeItem<T>>) this.getItems()).getLast() - .removeItem(); - fireChanged(); - } - - /** - * Set a new text to the last item created. - * - * @param newText - * the new text to set. - */ - protected void setLastItemText(final String newText) { - // The list created is a LinkedList<AbstractTreeItem> - ((LinkedList<AbstractTreeItem<T>>) this.getItems()).getLast() - .setTreeItemText(newText); - fireChanged(); - } - - /** - * When a modification append, this method has to be called and the method - * {@link #notifyChanged()} is called for the listener of this Tree. - */ - public void fireChanged() { - final ExtendedTreeMenu<T> treeMenu = getTreeMenu(); - if (treeMenu != null) { - treeMenu.fireChanged(); - } - } - - /** - * Return the class associated with this menu item. When this menu item will - * be selected, a new instance of this associated {@link AbstractTreeItem} - * will be created. - * - * @return the associated class. - */ - public abstract Class<? extends AbstractTreeItem<T>> getAssociatedTreeItemClass(); - - - /** - * @return the items created by this menu item. - */ - public List<AbstractTreeItem<T>> getItems() { - return this.items; - } -}
diff --git a/org.eclipse.modisco.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/exported/util/tree/menu/AbstractTreeSubMenu.java b/org.eclipse.modisco.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/exported/util/tree/menu/AbstractTreeSubMenu.java deleted file mode 100644 index 9cd8a72..0000000 --- a/org.eclipse.modisco.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/exported/util/tree/menu/AbstractTreeSubMenu.java +++ /dev/null
@@ -1,128 +0,0 @@ -/** - * Copyright (c) 2012 Mia-Software. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Alban Ménager (Soft-Maint) - Bug 387470 - [EFacet][Custom] Editors - */ -package org.eclipse.emf.facet.util.ui.internal.exported.util.tree.menu; - -import java.util.LinkedList; -import java.util.List; - -import org.eclipse.emf.facet.util.ui.internal.exported.util.tree.item.AbstractTreeItem; -import org.eclipse.swt.SWT; -import org.eclipse.swt.widgets.Menu; -import org.eclipse.swt.widgets.MenuItem; -import org.eclipse.swt.widgets.TreeItem; - -/** - * Class for the creation of a sub-menu in the menu. The sub-menu is not - * selectable and own a list of sub-items (declared by the contributor with the - * extension point). - * - * @since 0.3 - */ -public abstract class AbstractTreeSubMenu<T extends Object> extends - AbstractTreeMenu<T> { - - private final List<AbstractTreeMenu<T>> items; - - /** - * Constructor. - */ - public AbstractTreeSubMenu() { - super(); - this.items = new LinkedList<AbstractTreeMenu<T>>(); - } - - /** - * Add an item to the list of the sub-menu items. - * - * @param item - * the item to add. - */ - public void addItem(final AbstractTreeMenu<T> item) { - this.getItems().add(item); - } - - /** - * Creation of the sub-menu and all his children. - */ - @Override - protected MenuItem createMenuItem(final Menu parent) { - MenuItem menuItem = null; - for (final AbstractTreeMenu<T> item : this.getItems()) { - if (item.isEnabled(getTreeMenu())) { - if (menuItem == null) { - menuItem = createConcreteMenu(parent); - } - item.setExtraProperties(getProperties()); - item.refresh(getTreeMenu(), menuItem.getMenu()); - } - } - return menuItem; - } - - /** - * Create the concrete sub menu into the tree menu. - * - * @param parent - * the menu parent of this sub menu. - * @return the new item into the menu. - */ - protected MenuItem createConcreteMenu(final Menu parent) { - final MenuItem menuItem = new MenuItem(parent, SWT.CASCADE); - menuItem.setText(getMenuName()); - menuItem.setMenu(new Menu(parent)); - return menuItem; - } - - @Override - public boolean isEnabled() { - boolean result = false; - for (final AbstractTreeMenu<T> item : this.getItems()) { - if (item.isEnabled(getTreeMenu())) { - result = true; - } - } - return result; - } - - @Override - public AbstractTreeItem<T> getTreeItemExtended(final TreeItem treeItem) { - AbstractTreeItem<T> result = null; - for (final AbstractTreeMenu<T> menuItem : this.getItems()) { - final AbstractTreeItem<T> itemExtended = menuItem - .getTreeItemExtended(treeItem); - if (itemExtended != null) { - result = itemExtended; - break; - } - } - return result; - } - - @Override - public boolean removeItem(final TreeItem item) { - boolean removed = false; - for (final AbstractTreeMenu<T> menuItem : this.getItems()) { - removed = menuItem.removeItem(item); - if (removed) { - break; - } - } - return removed; - } - - /** - * @return the items - */ - public List<AbstractTreeMenu<T>> getItems() { - return this.items; - } -}
diff --git a/org.eclipse.modisco.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/exported/util/tree/menu/ExtendedTreeMenu.java b/org.eclipse.modisco.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/exported/util/tree/menu/ExtendedTreeMenu.java deleted file mode 100644 index aebaed0..0000000 --- a/org.eclipse.modisco.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/exported/util/tree/menu/ExtendedTreeMenu.java +++ /dev/null
@@ -1,341 +0,0 @@ -/** - * Copyright (c) 2012 Mia-Software. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Alban Ménager (Soft-Maint) - Bug 387470 - [EFacet][Custom] Editors - */ -package org.eclipse.emf.facet.util.ui.internal.exported.util.tree.menu; - -import java.util.LinkedList; -import java.util.List; -import java.util.Map; - -import org.eclipse.emf.facet.util.ui.internal.exported.tree.menu.ITreeMenu; -import org.eclipse.emf.facet.util.ui.internal.exported.util.tree.ExtendedTree; -import org.eclipse.emf.facet.util.ui.internal.exported.util.tree.item.AbstractTreeItem; -import org.eclipse.swt.events.MenuEvent; -import org.eclipse.swt.events.MenuListener; -import org.eclipse.swt.widgets.Control; -import org.eclipse.swt.widgets.Menu; -import org.eclipse.swt.widgets.Tree; -import org.eclipse.swt.widgets.TreeItem; - -/** - * This class provide the creation of the menu {@link Menu} of the tree ( - * {@link #createMenu(Control, ExtendedTree)}. The menu add a list of - * {@link AbstractTreeItem} and for each an {@link AbstractTreeItem} which will - * be instantiate when the menu item is selected. - * - * @since 0.3 - */ -public class ExtendedTreeMenu<IDialog> implements ITreeMenu<IDialog> { - - private final Control parent; - private final ExtendedTree treeExtended; - private final List<AbstractTreeMenu<IDialog>> menuItems; - private Menu menu; - - /** - * Constructor. - * - * @param parent - * the parent of the menu. - * @param treeExtended - * the tree to which the menu will be linked. - * @param menuItems - */ - public ExtendedTreeMenu(final Control parent, final ExtendedTree treeExtended, - final List<AbstractTreeMenu<IDialog>> menuItems) { - this.parent = parent; - this.treeExtended = treeExtended; - this.menuItems = menuItems; - } - - /** - * This method creates the tree menu, add put the listener into the menu. - * - * @param parent - * the parent of the menu. - * @param treeExtended - * the associated {@link ExtendedTree} of the menu. - */ - public void createMenu() { - this.menu = new Menu(this.parent); - this.menu.addMenuListener(new MenuListener() { - - public void menuShown(final MenuEvent menuEvent) { - onMenuShown(); - } - - public void menuHidden(final MenuEvent menuEvent) { - // Nothing. - } - }); - } - - /** - * This method is called when the menu is displayed. It calls all the - * {@link AbstractTreeMenu#refresh(TreeMenu)} method of each element of the - * menu. - */ - public void onMenuShown() { - for (final AbstractTreeMenu<IDialog> menuItem : this.getMenuItems()) { - menuItem.refresh(this); - } - } - - /** - * Return the list of all the items of this menu. - * - * @return the list of the {@link AbstractTreeMenu} of this menu. - */ - public List<AbstractTreeMenu<IDialog>> getTreeMenuItems() { - return this.getMenuItems(); - } - - /** - * Return the {@link Menu} of this TreeMenu. - * - * @return the menu. - */ - public Menu getMenu() { - return this.menu; - } - - /** - * Put this <code>properties</code> to each items created. - * - * @param properties - * the list of properties to pass. - */ - public void putExtraProperties(final Map<String, Object> properties) { - for (final AbstractTreeMenu<IDialog> menuItem : this.getMenuItems()) { - menuItem.setExtraProperties(properties); - } - } - - /** - * @return the current {@link TreeItem} selected on the tree. - */ - public TreeItem getCurrentItemSelected() { - TreeItem result = null; - final TreeItem[] items = this.treeExtended.getTree().getSelection(); - if (items.length > 0) { - result = this.treeExtended.getTree().getSelection()[0]; - } - return result; - } - - /** - * @return the {@link AbstractTreeItem} selected on the tree. Can be null. - */ - public AbstractTreeItem<IDialog> getTreeItemExtended(final TreeItem treeItem) { - AbstractTreeItem<IDialog> result = null; - for (final AbstractTreeMenu<IDialog> menuItem : this.getMenuItems()) { - final AbstractTreeItem<IDialog> itemExtended = menuItem - .getTreeItemExtended(treeItem); - if (itemExtended != null) { - result = itemExtended; - break; - } - } - return result; - } - - /** - * @return the {@link AbstractTreeMenu} selected on the tree. Can be null. - */ - public AbstractTreeMenu<IDialog> getTreeMenu(final TreeItem treeItem) { - AbstractTreeMenu<IDialog> result = null; - - for (final AbstractTreeMenu<IDialog> menuItem : this.getMenuItems()) { - final AbstractTreeItem<IDialog> itemExtended = menuItem - .getTreeItemExtended(treeItem); - if (itemExtended != null) { - result = menuItem; - break; - } - } - return result; - } - - /** - * Remove the current item selected of the tree. - */ - public void removeCurrentItemSelected() { - final AbstractTreeMenu<IDialog> treeMenu = getTreeMenu(getCurrentItemSelected()); - if (treeMenu != null) { - treeMenu.removeItem(getCurrentItemSelected()); - } - } - - /** - * @return the {@link Tree}. - */ - public Tree getTree() { - return this.treeExtended.getTree(); - } - - /** - * This method call the method - * {@link AbstractTreeItem#onItemMouseSelection()} of the current selection. - */ - public void onMouseSelection() { - final AbstractTreeItem<IDialog> treeMenu = getTreeItemExtended(getCurrentItemSelected()); - if (treeMenu != null) { - treeMenu.onItemMouseSelection(); - fireChanged(); - } - } - - /** - * When a modification append, this method has to be called and the method - * {@link #notifyChanged()} is called for the listener of this Tree. - */ - public void fireChanged() { - this.treeExtended.fireChanged(); - } - - /** - * @return the all the items of the menu. - */ - private List<AbstractTreeMenu<IDialog>> getMenuItems() { - return this.menuItems; - } - - /** - * Select the item into the menu (if the item exist). - * - * @return can return a {@link IDialog}. Can be null. - */ - public IDialog selectMenuItem( - final Class<? extends AbstractTreeMenuItem<IDialog>> menuItemType) { - IDialog result = null; - final AbstractTreeMenu<IDialog> treeMenu = findMenuItem(menuItemType); - if (treeMenu != null) { - result = treeMenu.onMenuItemSelection(); - } - return result; - } - - /** - * Return (if exist) the {@link AbstractTreeMenu} with the name - * <code>menuItemName</code> into the items of the tree menu. - * - * @param menuItemType - * the name of the element to find. - * @return the item menu with the name in parameter (can be null). - */ - private AbstractTreeMenuItem<IDialog> findMenuItem( - final Class<? extends AbstractTreeMenuItem<IDialog>> menuItemType) { - AbstractTreeMenuItem<IDialog> result = null; - for (final AbstractTreeMenuItem<IDialog> item : getAllTreeMenuItems()) { - if (item.getClass().isInstance(menuItemType)) { - result = item; - } - } - return result; - } - - private List<AbstractTreeMenuItem<IDialog>> getAllTreeMenuItems() { - final List<AbstractTreeMenuItem<IDialog>> result = new LinkedList<AbstractTreeMenuItem<IDialog>>(); - for (final AbstractTreeMenu<IDialog> menuItem : getMenuItems()) { - if (menuItem instanceof AbstractTreeSubMenu) { - result.addAll(getAllTreeMenuItems((AbstractTreeSubMenu<IDialog>) menuItem)); - } else { - result.add((AbstractTreeMenuItem<IDialog>) menuItem); - } - } - return result; - } - - private List<AbstractTreeMenuItem<IDialog>> getAllTreeMenuItems( - final AbstractTreeSubMenu<IDialog> subMenu) { - final List<AbstractTreeMenuItem<IDialog>> result = new LinkedList<AbstractTreeMenuItem<IDialog>>(); - for (final AbstractTreeMenu<IDialog> menuItem : subMenu.getItems()) { - if (menuItem instanceof AbstractTreeSubMenu) { - result.addAll(getAllTreeMenuItems((AbstractTreeSubMenu<IDialog>) menuItem)); - } else { - result.add((AbstractTreeMenuItem<IDialog>) menuItem); - } - } - return result; - } - - /** - * @return the treeMenuItem into the menu with is an instance of the type in - * parameter. - */ - public AbstractTreeMenu<IDialog> getTreeMenuItem(final Class<?> treeMenuType) { - AbstractTreeMenu<IDialog> result = null; - final List<AbstractTreeMenu<IDialog>> treeMenuItems = getTreeMenuItems(); - for (final AbstractTreeMenu<IDialog> item : treeMenuItems) { - result = getTreeMenuItem(item, treeMenuType); - if (result != null) { - break; - } - } - return result; - } - - private AbstractTreeMenu<IDialog> getTreeMenuItem( - final AbstractTreeSubMenu<IDialog> item, - final Class<?> treeMenuType) { - AbstractTreeMenu<IDialog> result = null; - for (final AbstractTreeMenu<IDialog> subItem : item.getItems()) { - result = getTreeMenuItem(subItem, treeMenuType); - if (result != null) { - break; - } - } - return result; - } - - private AbstractTreeMenu<IDialog> getTreeMenuItem( - final AbstractTreeMenu<IDialog> item, - final Class<?> treeMenuType) { - AbstractTreeMenu<IDialog> result = null; - if (treeMenuType.isInstance(item)) { - result = item; - } else if (item instanceof AbstractTreeSubMenu) { - result = getTreeMenuItem((AbstractTreeSubMenu<IDialog>) item, - treeMenuType); - } - return result; - } - - /** - * get all the items of the tree with the name <code>treeItemName</code> - * - * @param treeItemName - * the name of the item to select. - * @return the list of all the tree item with the name in parameter. - */ - public List<AbstractTreeItem<IDialog>> getTreeItems( - final String treeItemName) { - final List<AbstractTreeItem<IDialog>> result = new LinkedList<AbstractTreeItem<IDialog>>(); - for (final AbstractTreeMenuItem<IDialog> menuItem : getAllTreeMenuItems()) { - for (final AbstractTreeItem<IDialog> treeItem : menuItem.getItems()) { - if (treeItemName.equals(treeItem.getItemText())) { - result.add(treeItem); - } - } - } - return result; - } - - /** - * Select a item into the tree. - * - * @param treeItem - * the {@link AbstractTreeItem} to select - */ - public void selectTreeItem(final AbstractTreeItem<IDialog> treeItem) { - this.treeExtended.getTree().setSelection(treeItem.getTreeItem()); - } -}
diff --git a/org.eclipse.modisco.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/exported/util/widget/AbstractWidget.java b/org.eclipse.modisco.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/exported/util/widget/AbstractWidget.java deleted file mode 100644 index 278fd86..0000000 --- a/org.eclipse.modisco.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/exported/util/widget/AbstractWidget.java +++ /dev/null
@@ -1,155 +0,0 @@ -/** - * Copyright (c) 2012 Mia-Software. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Alban Ménager (Soft-Maint) - Bug 387470 - [EFacet][Custom] Editors - * Grégoire Dupé (Mia-Software) - Bug 387470 - [EFacet][Custom] Editors - */ -package org.eclipse.emf.facet.util.ui.internal.exported.util.widget; - -import java.util.LinkedList; -import java.util.List; - -import org.eclipse.emf.facet.util.ui.internal.exported.util.widget.command.AbstractCommandWidget; -import org.eclipse.emf.facet.util.ui.internal.exported.util.widget.command.AbstractGetOrCreateFilteredElementCommandWidget; -import org.eclipse.emf.facet.util.ui.internal.exported.util.widget.component.properties.AbstractGetPropertyWidget; -import org.eclipse.emf.facet.util.ui.internal.exported.util.widget.component.properties.bounds.AbstractGetBoundsWidget; -import org.eclipse.emf.facet.util.ui.internal.exported.widget.IAbstractWidget; -import org.eclipse.emf.facet.util.ui.internal.widget.metaclass.FilteredElementSelectionWidget; -import org.eclipse.swt.SWT; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.layout.GridLayout; -import org.eclipse.swt.widgets.Composite; - -/** - * An abstract class providing the creation of a specific action widget.</p> - * - * The listener provided by the {@link #getWidgetListener()} is applied on the - * widget and called when the mouse move into the dialog. - * - * @see AbstractCommandWidget - * @see AbstractGetOrCreateFilteredElementCommandWidget - * @see FilteredElementSelectionWidget - * @see SelectSubTypingTypeWidget - * @see AbstractGetBoundsWidget - * @see AbstractGetPropertyWidget - * @see GetQueryWidgetComposite - * @see SelectQueryTypeWidget - * @since 0.3 - */ -public abstract class AbstractWidget extends Composite implements IAbstractWidget { - - protected static final int VERTICAL_SPACING = 2; - protected static final int WIDTH_HINT = 110; - private final Composite widgetParent; - private final List<IAbstractWidget> subWidgets; - private final List<IAbstractWidget> listeners; - - /** - * The constructor. - * - * @param parent - * the parent of the widget. - * @param editingDomain - * the editing domain. - */ - public AbstractWidget(final Composite parent) { - super(parent, SWT.NONE); - this.widgetParent = parent; - this.subWidgets = new LinkedList<IAbstractWidget>(); - this.setLayout(new GridLayout()); - this.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); - this.listeners = new LinkedList<IAbstractWidget>(); - } - - /** - * Add the widget to the list of sub widgets. - * - * @param widget - * the widget to add. - */ - protected void addSubWidget(final IAbstractWidget widget) { - this.subWidgets.add(widget); - } - - /** - * This method add all the sub widgets of this widget. - * <p/> - * Use the method {@link #addSubWidget(AbstractCommandWidget)} - */ - protected abstract void addSubWidgets(); - - /** - * @return the widget parent. - */ - protected Composite getWidgetParent() { - return this.widgetParent; - } - - /** - * Return the string containing the error for this widget. - * - * @return null if there is no error. The string containing the error if - * there is an error. - */ - public abstract String getError(); - - /** - * Create the content of the widget (call {@link #addSubWidgets()}) and - * sub-widgets. - */ - public void createWidgetContent() { - addSubWidgets(); - for (final IAbstractWidget widget : this.subWidgets) { - widget.createWidgetContent(); - widget.addListener(this); - } - } - - /** - * Add the abstractWidget in parameter to the list of listeners of the - * widget. - * - * @param abstractWidget - * the abstractWidget to listen. - */ - public void addListener(final AbstractWidget abstractWidget) { - // This method is public because PMD doesn't want it to be private... - // This is due to the fact that this method is used on the method - // 'createWidgetContent' but it is called on the same object type but - // not on the same instance. So, programatly, put the method private is - // correct because the object type is the same that the owner but not on - // the same instance. - this.listeners.add(abstractWidget); - } - - /** - * When a modification append, this method is called and the method - * {@link #notifyChanged()} is called for each listeners of this widget. - */ - protected void fireChanged() { - for (final IAbstractWidget listener : this.listeners) { - listener.notifyChanged(); - } - } - - /** - * When a change in a sub-widget append, this method is execute. If no - * action has to be done when a modification append, this method has to be - * void. - */ - public abstract void notifyChanged(); - - /** - * @return the subWidgets - */ - public List<IAbstractWidget> getSubWidgets() { - return this.subWidgets; - } - -}
diff --git a/org.eclipse.modisco.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/exported/util/widget/command/AbstractCommandWidget.java b/org.eclipse.modisco.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/exported/util/widget/command/AbstractCommandWidget.java deleted file mode 100644 index 6bef960..0000000 --- a/org.eclipse.modisco.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/exported/util/widget/command/AbstractCommandWidget.java +++ /dev/null
@@ -1,86 +0,0 @@ -/** - * Copyright (c) 2012 Mia-Software. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Alban Ménager (Soft-Maint) - Bug 387470 - [EFacet][Custom] Editors - * Grégoire Dupé (Mia-Software) - Bug 387470 - [EFacet][Custom] Editors - */ -package org.eclipse.emf.facet.util.ui.internal.exported.util.widget.command; - -import org.eclipse.core.commands.Command; -import org.eclipse.emf.facet.util.ui.internal.exported.WidgetProperties; -import org.eclipse.emf.facet.util.ui.internal.exported.util.dialog.AbstractDialog; -import org.eclipse.emf.facet.util.ui.internal.exported.util.dialog.AbstractMainDialog; -import org.eclipse.emf.facet.util.ui.internal.exported.util.widget.AbstractWidget; -import org.eclipse.emf.facet.util.ui.internal.exported.widget.IAbstractWidget; -import org.eclipse.swt.widgets.Composite; - -/** - * This abstract class provides all the necessary methods for the creation of a - * widget. The widget must return a {@link Command} (with the method - * {@link #getCommand()}) that will be executed when the "ok" button of the - * dialog will be pressed.</p> - * - * The widget have to get all the necessary properties for the creation of the - * element (with the command). To get all the properties, the widget have to add - * all the subwidgets he needs for the edition of the command. Each subwidget - * {@link AbstractWidget} will edit a specific property of the - * {@link WidgetProperties}. - * - * @since 0.3 - */ -public abstract class AbstractCommandWidget extends AbstractWidget implements ICommandWidget { - - /** - * Constructor. Initialize the {@link IFacetCommandFactory} for the creation - * of the command. - * - * @param parent - * the parent {@link AbstractDialog} of this widget. - * @param editingDomain - * the current editing domain. - * @param properties - * The {@link WidgetProperties} provided by the - * {@link AbstractMainDialog} that the widget had to edit. - */ - public AbstractCommandWidget(final Composite parent) { - super(parent); - } - - /* (non-Javadoc) - * @see org.eclipse.emf.facet.util.ui.internal.exported.util.widget.command.ICommandWidget#getCommand() - */ - public abstract Object getCommand(); - - @Override - public String getError() { - String result = null; - for (final IAbstractWidget widgets : this.getSubWidgets()) { - final String error = widgets.getError(); - if (error != null) { - result = error; - break; - } - } - return result; - } - - - public abstract void onDialogValidation(); - - public <A> A adapt(final Class<A> adapterType) { - A result = null; - if (adapterType.isInstance(this)) { - @SuppressWarnings("unchecked") - final A adapted = (A) this; - result = adapted; - } - return result; - } - -}
diff --git a/org.eclipse.modisco.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/exported/util/widget/command/AbstractGetOrCreateFilteredElementCommandWidget.java b/org.eclipse.modisco.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/exported/util/widget/command/AbstractGetOrCreateFilteredElementCommandWidget.java deleted file mode 100644 index f03aacf..0000000 --- a/org.eclipse.modisco.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/exported/util/widget/command/AbstractGetOrCreateFilteredElementCommandWidget.java +++ /dev/null
@@ -1,147 +0,0 @@ -/** - * Copyright (c) 2012 Mia-Software. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Alban Ménager (Soft-Maint) - Bug 387470 - [EFacet][Custom] Editors - * Grégoire Dupé (Mia-Software) - Bug 387470 - [EFacet][Custom] Editors - */ -package org.eclipse.emf.facet.util.ui.internal.exported.util.widget.command; - -import java.util.Map; - -import org.eclipse.emf.facet.util.ui.internal.exported.dialog.IDialog; -import org.eclipse.emf.facet.util.ui.internal.exported.util.dialog.AbstractDialog; -import org.eclipse.emf.facet.util.ui.internal.exported.util.dialog.SynchronizedAbstractDialog; -import org.eclipse.emf.facet.util.ui.internal.exported.util.widget.component.CreateElementWidget; -import org.eclipse.emf.facet.util.ui.internal.widget.metaclass.FilteredElementSelectionWidget; -import org.eclipse.swt.layout.GridLayout; -import org.eclipse.swt.widgets.Composite; - -/** - * This abstract class allows the user to select or create an element (the - * concretes classes extending this abstract class will specify the type for - * this elements).</p> - * - * The widget contains two composite: - * <nl> - * <li> {@link FilteredElementSelectionWidget} : display a filtered list with the - * elements returned by {@link #getElements()}</li> - * <li> {@link CreateElementWidget} : create a "new..." button, and display the - * dialog returned by {@link #createDialog()} when clicked</li> - * </nl> - * - * @see GetOrCreateFacetSetWidget - * @see GetOrCreateFacetWidget - * @see GetOrCreateOperationWidget - * @see FilteredElementSelectionWidget - * @see CreateElementWidget - * @since 0.3 - */ -public abstract class AbstractGetOrCreateFilteredElementCommandWidget<T extends Object, W extends Object> - extends AbstractCommandWidget implements IGetOrCreateFilteredElementCommmandWidget<T, W> { - - private static final int COLUMNS_NUMBER = 2; - private FilteredElementSelectionWidget elementSelection; - private CreateElementWidget<W> createElementW; - - /** - * Constructor. Initialize a new layout containing {@value #COLUMN_NUMBER} - * columns. - * - * @param parent - * the parent of this widget. - * @param editingDomain - * the current editing domain. - * @param properties - * the properties. - */ - protected AbstractGetOrCreateFilteredElementCommandWidget( - final Composite parent) { - super(parent); - this.setLayout(new GridLayout(COLUMNS_NUMBER, false)); - } - - @Override - protected void addSubWidgets() { - final Object[] array = getElements().keySet().toArray(); - this.elementSelection = new FilteredElementSelectionWidget(this, array); - addSubWidget(this.elementSelection); - final IDialog<W> dialog = createDialog(); - if (dialog != null) { - this.createElementW = new CreateElementWidget<W>(this, dialog); - addSubWidget(this.createElementW); - } - } - - /** - * This method must return the all the elements that the user can choose - * (with the name to display has the key to the map). The method - * {@link #getSuperFacetSet(Object)} can be useful. - * - * @return a map of the elements to display. - */ - protected abstract Map<String, T> getElements(); - - /** - * @return the dialog that the "New..." button of this widget will open. - * Null if you want no "New..." button. - * - * @see AbstractDialog - */ - protected abstract IDialog<W> createDialog(); - - /** - * Update the filtered list. The list will be updated with the elements - * returned by {@link #getElements()}. - */ - public void updateFilteredList() { - this.elementSelection.setElements(getElements().keySet().toArray()); - } - - /* (non-Javadoc) - * @see org.eclipse.emf.facet.util.ui.internal.exported.util.widget.command.IGetOrCreateFilteredElementCommmandWidget#getElementSelected() - */ - public T getElementSelected() { - T result = null; - final Object selectedElement = this.elementSelection - .getFirstSelectedElement(); - if (selectedElement != null) { - final String elementName = selectedElement.toString(); - result = getElements().get(elementName); - } - return result; - } - - /* (non-Javadoc) - * @see org.eclipse.emf.facet.util.ui.internal.exported.util.widget.command.IGetOrCreateFilteredElementCommmandWidget#selectElement(T) - */ - public void selectElement(final T element) { - Object[] selectionsParam = new Object[1]; - for (String key : getElements().keySet()) { - if (getElements().get(key) == element) { - selectionsParam[0] = key; - this.elementSelection.getFilteredList().setSelection( - selectionsParam); - break; - } - } - } - - public void selectElementByName(final String name) { - final T element = this.getElements().get(name); - selectElement(element); - } - - /* (non-Javadoc) - * @see org.eclipse.emf.facet.util.ui.internal.exported.util.widget.command.IGetOrCreateFilteredElementCommmandWidget#pressNewButton() - */ - public IDialog<W> pressNewButton() { - return new SynchronizedAbstractDialog<W>( - this.createElementW.pressNewButton(), this.getDisplay()); - } -}
diff --git a/org.eclipse.modisco.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/exported/util/widget/command/ICommandWidget.java b/org.eclipse.modisco.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/exported/util/widget/command/ICommandWidget.java deleted file mode 100644 index d1ea42c..0000000 --- a/org.eclipse.modisco.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/exported/util/widget/command/ICommandWidget.java +++ /dev/null
@@ -1,40 +0,0 @@ -/** - * Copyright (c) 2012 Mia-Software. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Grégoire Dupé (Mia-Software) - Bug 387470 - [EFacet][Custom] Editors - */ -package org.eclipse.emf.facet.util.ui.internal.exported.util.widget.command; - -import org.eclipse.core.commands.Command; -import org.eclipse.emf.facet.util.ui.internal.exported.widget.IAbstractWidget; - -/** - * @since 0.3 - */ -public interface ICommandWidget extends IAbstractWidget { - - /** - * Return the command for the widget specific action. The factory can be - * used for the creation of the {@link Command}. - * - * @see IFacetCommandFactory - * - * @return the command. - */ - Object getCommand(); - - /** - * This method is execute when the "OK" button of the {@link #parent} is - * pressed. - */ - void onDialogValidation(); - - <A> A adapt(Class<A> adapterType); - -} \ No newline at end of file
diff --git a/org.eclipse.modisco.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/exported/util/widget/command/IGetOrCreateFilteredElementCommmandWidget.java b/org.eclipse.modisco.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/exported/util/widget/command/IGetOrCreateFilteredElementCommmandWidget.java deleted file mode 100644 index c40efb7..0000000 --- a/org.eclipse.modisco.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/exported/util/widget/command/IGetOrCreateFilteredElementCommmandWidget.java +++ /dev/null
@@ -1,33 +0,0 @@ -/** - * Copyright (c) 2012 Mia-Software. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Grégoire Dupé (Mia-Software) - Bug 387470 - [EFacet][Custom] Editors - */ -package org.eclipse.emf.facet.util.ui.internal.exported.util.widget.command; - -import org.eclipse.emf.facet.util.ui.internal.exported.dialog.IDialog; - -/** - * @since 0.3 - */ -public interface IGetOrCreateFilteredElementCommmandWidget<T extends Object, W extends Object> - extends ICommandWidget { - - /** - * @return the selected element in the filtredList. - */ - T getElementSelected(); - - void selectElement(T element); - - void selectElementByName(String name); - - IDialog<W> pressNewButton(); - -} \ No newline at end of file
diff --git a/org.eclipse.modisco.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/exported/util/widget/component/CreateElementWidget.java b/org.eclipse.modisco.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/exported/util/widget/component/CreateElementWidget.java deleted file mode 100644 index 15a9cdb..0000000 --- a/org.eclipse.modisco.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/exported/util/widget/component/CreateElementWidget.java +++ /dev/null
@@ -1,132 +0,0 @@ -/** - * Copyright (c) 2012 Mia-Software. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Alban Ménager (Soft-Maint) - Bug 387470 - [EFacet][Custom] Editors - * Grégoire Dupé (Mia-Software) - Bug 387470 - [EFacet][Custom] Editors - */ -package org.eclipse.emf.facet.util.ui.internal.exported.util.widget.component; - -import org.eclipse.emf.facet.util.ui.internal.Messages; -import org.eclipse.emf.facet.util.ui.internal.exported.dialog.IDialog; -import org.eclipse.emf.facet.util.ui.internal.exported.util.widget.AbstractWidget; -import org.eclipse.emf.facet.util.ui.internal.exported.util.widget.command.AbstractGetOrCreateFilteredElementCommandWidget; -import org.eclipse.jface.viewers.CellEditor.LayoutData; -import org.eclipse.jface.window.Window; -import org.eclipse.swt.SWT; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.widgets.Button; -import org.eclipse.swt.widgets.Display; -import org.eclipse.swt.widgets.Event; -import org.eclipse.swt.widgets.Listener; - -/** - * WidgetComposite for the creation of the "New..." button. This widget will - * open the dialog passed in the constructor. - * - * @since 0.3 - */ -public class CreateElementWidget<W extends Object> extends AbstractWidget { - - private final IDialog<W> dialog; - private final AbstractGetOrCreateFilteredElementCommandWidget<?, ?> typedParent; - - /** - * Constructor. Initialize the {@link LayoutData} with the - * {@link AbstractWidget} attribute 'fillGridData'. - * - * @param parent - * the parent of this composite. - * @param editingDomain - * the current editing domain. - * @param dialog - * the dialog displayed when the "new.." is pressed. - */ - public CreateElementWidget( - final AbstractGetOrCreateFilteredElementCommandWidget<?, ?> parent, - final IDialog<W> dialog) { - super(parent); - // Set the new button at the TOP. - setLayoutData(new GridData(SWT.CENTER, SWT.BEGINNING, true, false)); - this.typedParent = parent; - this.dialog = dialog; - } - - /** - * @return the dialog - */ - public IDialog<W> getDialog() { - return this.dialog; - } - - @Override - protected void addSubWidgets() { - createButton(); - } - - /** - * Creation of the 'new...' button. When pressed, the {@link #dialog} will - * be displayed. - */ - private void createButton() { - final Button button = new Button(this, SWT.NONE); - button.setText(Messages.New); - button.addListener(SWT.Selection, new Listener() { - - public void handleEvent(final Event event) { - onWidgetSelected(); - } - - }); - } - - public IDialog<W> onWidgetSelected() { - final IDialog<W> newDialog = getDialog(); - Display.getDefault().asyncExec(new Runnable() { - public void run() { - final int result = newDialog.open(); - if (result == Window.OK) { - onCommited(); - } else { - onCanceled(); - } - } - }); - return newDialog; - } - - /** - * Action to do when the dialog opened with the button "..." is closed with - * the "Ok" button. - */ - protected void onCommited() { - this.typedParent.updateFilteredList(); - } - - /** - * Action to do when the dialog opened with the button "..." is closed with - * the "Cancel" button. - */ - protected void onCanceled() { - // Nothing - } - - @Override - public String getError() { - return null; - } - - @Override - public void notifyChanged() { - // No action has to be done if a change appends. - } - - public IDialog<W> pressNewButton() { - return onWidgetSelected(); - } -}
diff --git a/org.eclipse.modisco.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/exported/util/widget/component/getorcreate/AbstractGetOrCreateElementWidget.java b/org.eclipse.modisco.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/exported/util/widget/component/getorcreate/AbstractGetOrCreateElementWidget.java deleted file mode 100644 index e2948ca..0000000 --- a/org.eclipse.modisco.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/exported/util/widget/component/getorcreate/AbstractGetOrCreateElementWidget.java +++ /dev/null
@@ -1,168 +0,0 @@ -/** - * Copyright (c) 2012 Mia-Software. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Alban Ménager (Soft-Maint) - Bug 387470 - [EFacet][Custom] Editors - * Grégoire Dupé (Mia-Software) - Bug 387470 - [EFacet][Custom] Editors - */ -package org.eclipse.emf.facet.util.ui.internal.exported.util.widget.component.getorcreate; - -import org.eclipse.emf.facet.util.ui.internal.exported.PropertyElement2; -import org.eclipse.emf.facet.util.ui.internal.exported.util.widget.AbstractWidget; -import org.eclipse.emf.facet.util.ui.internal.exported.util.widget.component.properties.name.AbstractGetElementNameWidget; -import org.eclipse.emf.facet.util.ui.internal.exported.widget.getorcreate.IAbstractGetOrCreateElementWidget; -import org.eclipse.emf.facet.util.ui.utils.UIUtils; -import org.eclipse.swt.events.ModifyEvent; -import org.eclipse.swt.events.ModifyListener; -import org.eclipse.swt.layout.GridLayout; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Text; - -/** - * Abstract class for the creation of a composite that allows the selection or - * creation of an element. Classes implementing this class must overrides - * {@link #getSubWidgets()} method. This class prepare the composite for - * {@link #COLUMN_NUMBER} subComposites and provide the method - * {@link #createTextField(boolean)} for the creation of a textField area. - * - * @see AbstractGetOrCreateElementWithButtonWidget - * @see AbstractGetElementNameWidget - * @since 0.3 - */ -public abstract class AbstractGetOrCreateElementWidget<T extends Object> - extends AbstractWidget - implements IAbstractGetOrCreateElementWidget { - - /** - * The number of columns of this composite. - */ - public static final int COLUMN_NUMBER = 3; - private PropertyElement2<T> propertyElement; - private Text text; - - /** - * Constructor. Initialize the composite with a layout of - * {@value #COLUMN_NUMBER} columns. - * - * @param parent - * the parent containing this composite. - * @param style - * the style of the composite. - * @param editingDomain - * the current editing domain. - * @param propertyElement - * the property element that this composite will edit. - */ - protected AbstractGetOrCreateElementWidget(final Composite parent, - final PropertyElement2<T> propertyElement) { - super(parent); - this.propertyElement = propertyElement; - this.setLayout(new GridLayout(COLUMN_NUMBER, false)); - } - - /** - * @return the property element. - */ - public final PropertyElement2<T> getPropertyElement() { - return this.propertyElement; - } - - public Text getTextField() { - return this.text; - } - - /** - * Create the text field in the composite.</p> If the property - * {@link #propertyElement} has a value, the field is not editable. - * - * @param enabled - * set if the field must be editable or not. - */ - protected void createTextField(final boolean enabled) { - ModifyListener modifyListener = null; - if (enabled) { - modifyListener = new ModifyListener() { - - public void modifyText(final ModifyEvent event) { - onTextModfified(); - } - }; - } - String initialText = ""; //$NON-NLS-1$ - if ((this.propertyElement.getValue() != null) - && (getTextFieldInitialText() != null)) { - initialText = getTextFieldInitialText(); - } - this.text = UIUtils.createTextField(this, initialText, enabled, - modifyListener); - fireChanged(); - } - - protected void onTextModfified() { - this.propertyElement.setValue(this.text.getText().toString()); - onFieldEdited(); - } - - /** - * Execute an action when the text field is edited. If not override, nothing - * appends. Can be override if needed. - */ - protected void onFieldEdited() { - fireChanged(); - } - - /** - * @return the initial text of the textField of this composite. Null or void - * if no text has to be displayed. - */ - protected String getTextFieldInitialText() { - String result = ""; //$NON-NLS-1$ - final Object value = this.getPropertyElement().getValue(); - if (value != null) { - result = value.toString(); - } - return result; - } - - @Override - public String getError() { - String error = null; - final Object value = this.propertyElement.getValue(); - if (value == null && !this.propertyElement.isCanBeNull()) { - error = getErrorMessage(); - } - return error; - } - - /** - * @return the error message if the {@link #propertyElement} is not edited. - * Return 'null' if no error can be returned. - */ - protected abstract String getErrorMessage(); - - /** - * @param propertyElement - * the propertyElement to set - */ - public void setPropertyElement(final PropertyElement2<T> propertyElement) { - this.propertyElement = propertyElement; - } - - public T getElement() { - return getPropertyElement().getValue2(); - } - - public String getText() { - return this.text.getText(); - } - - public void setText(final String text) { - this.text.setText(text); - } - -}
diff --git a/org.eclipse.modisco.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/exported/util/widget/component/getorcreate/AbstractGetOrCreateElementWithButtonWidget.java b/org.eclipse.modisco.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/exported/util/widget/component/getorcreate/AbstractGetOrCreateElementWithButtonWidget.java deleted file mode 100644 index 4e9ddaa..0000000 --- a/org.eclipse.modisco.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/exported/util/widget/component/getorcreate/AbstractGetOrCreateElementWithButtonWidget.java +++ /dev/null
@@ -1,120 +0,0 @@ -/** - * Copyright (c) 2012 Mia-Software. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Alban Ménager (Soft-Maint) - Bug 387470 - [EFacet][Custom] Editors - * Grégoire Dupé (Mia-Software) - Bug 387470 - [EFacet][Custom] Editors - */ -package org.eclipse.emf.facet.util.ui.internal.exported.util.widget.component.getorcreate; - -import org.eclipse.emf.facet.util.ui.internal.exported.PropertyElement2; -import org.eclipse.emf.facet.util.ui.internal.exported.widget.getorcreate.IAbstractGetOrCreateElementWithButtonWidget; -import org.eclipse.emf.facet.util.ui.utils.UIUtils; -import org.eclipse.swt.events.SelectionEvent; -import org.eclipse.swt.events.SelectionListener; -import org.eclipse.swt.layout.GridLayout; -import org.eclipse.swt.widgets.Button; -import org.eclipse.swt.widgets.Composite; - -/** - * Provide all the necessary for the creation of a composite that have: </p> - * - * Label : [ textField ][...] </p> - * - * The button will execute {@link #openDialog()} method when pressed. </p> - * - * The {@link #getLabel()} method have to be override and provide the label of - * the 'Label'. - * - * @see GetOrCreateFacetSetWidget - * @see GetOrCreateFacetWidget - * @see GetOrCreateOperationWidget - * @since 0.3 - */ -public abstract class AbstractGetOrCreateElementWithButtonWidget<T extends Object, D extends Object> - extends AbstractGetOrCreateElementWidget<T> implements - IAbstractGetOrCreateElementWithButtonWidget<D> { - - private Button button; - private boolean buttonEnabled; - - /** - * Constructor. - * - * @param parent - * the parent of this composite. - * @param editingDomain - * the current editing domain. - * @param propertyElement - * the property element that be edited with this composite. - */ - protected AbstractGetOrCreateElementWithButtonWidget( - final Composite parent, - final PropertyElement2<T> propertyElement) { - super(parent, propertyElement); - this.setPropertyElement(propertyElement); - this.setLayout(new GridLayout(COLUMN_NUMBER, false)); - this.buttonEnabled = propertyElement.isChangeable(); - } - - @Override - protected void addSubWidgets() { - if ((getLabel() != null) && !"".equals(getLabel())) { //$NON-NLS-1$ - UIUtils.createLabel(this, getLabel()); - } - createTextField(false); - createButton(); - } - - public void setButtonEnabled(final boolean buttonEnabled) { - this.buttonEnabled = buttonEnabled; - this.button.setEnabled(this.buttonEnabled); - } - - /** - * Create a button [...]. When pressed, the {@link #openDialog()} method is - * called. - */ - private void createButton() { - final SelectionListener selectionListener = new SelectionListener() { - - public void widgetSelected(final SelectionEvent selectionEvent) { - onButtonPressed(); - } - - public void widgetDefaultSelected( - final SelectionEvent selectionEvent) { - // Nothing. - } - }; - this.button = UIUtils.createButton(this, "...", this.buttonEnabled, //$NON-NLS-1$ - selectionListener); - } - - /** - * The method will be called when the button "..." is pressed. - */ - public abstract D onButtonPressed(); - - /** - * @return the label for this composite. If no label has to be displayed, - * null or void must be returned. - */ - protected abstract String getLabel(); - - /** - * @return the button - */ - public Button getButton() { - return this.button; - } - - public D pressButton() { - return onButtonPressed(); - } -}
diff --git a/org.eclipse.modisco.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/exported/util/widget/component/getorcreate/AbstractGetOrCreateElementWithDialogButtonWidget.java b/org.eclipse.modisco.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/exported/util/widget/component/getorcreate/AbstractGetOrCreateElementWithDialogButtonWidget.java deleted file mode 100644 index 155f3dc..0000000 --- a/org.eclipse.modisco.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/exported/util/widget/component/getorcreate/AbstractGetOrCreateElementWithDialogButtonWidget.java +++ /dev/null
@@ -1,89 +0,0 @@ -/** - * Copyright (c) 2012 Mia-Software. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Alban Ménager (Soft-Maint) - Bug 387470 - [EFacet][Custom] Editors - * Grégoire Dupé (Mia-Software) - Bug 387470 - [EFacet][Custom] Editors - */ -package org.eclipse.emf.facet.util.ui.internal.exported.util.widget.component.getorcreate; - -import org.eclipse.emf.ecore.ENamedElement; -import org.eclipse.emf.facet.util.ui.internal.exported.PropertyElement2; -import org.eclipse.emf.facet.util.ui.internal.exported.dialog.IDialog; -import org.eclipse.emf.facet.util.ui.internal.exported.dialog.IWithResultDialogCallback; -import org.eclipse.emf.facet.util.ui.internal.exported.util.dialog.SynchronizedAbstractDialog; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Display; -import org.eclipse.swt.widgets.Text; - -/** - * Has the same goal than {@link AbstractGetOrCreateElementWithButtonWidget} but - * especially for dialogs. - * - * @since 0.3 - */ -public abstract class AbstractGetOrCreateElementWithDialogButtonWidget<T extends ENamedElement, W extends Object> - extends AbstractGetOrCreateElementWithButtonWidget<T, IDialog<W>> { - - protected AbstractGetOrCreateElementWithDialogButtonWidget( - final Composite parent, - final PropertyElement2<T> propertyElement) { - super(parent, propertyElement); - } - - @Override - public IDialog<W> onButtonPressed() { - final IWithResultDialogCallback<T> callback = new IWithResultDialogCallback<T>() { - public void commited(final T result) { - onCommited(result); - } - public void canceled(final T result) { - onCanceled(); - } - }; - final IDialog<W> dialog = getCreationDialog(callback); - Display.getDefault().asyncExec(new Runnable() { - public void run() { - dialog.open(); - } - }); - return createSynchronizedDialog(dialog); - } - - protected final void onCommited(final T result) { - this.getPropertyElement().setValue2(result); - final String name = result.getName(); - final Text textField = this.getTextField(); - textField.setText(name); - } - - /** - * Action to do when the dialog opened with the button "..." is closed with - * the "Cancel" button. - */ - protected abstract void onCanceled(); - - /** - * Create and return the dialog that will be display when the [...] button - * is pressed. - * - * @return the dialog. - */ - protected abstract IDialog<W> getCreationDialog( - final IWithResultDialogCallback<T> callback); - - /** - * Create the synchronized dialog for the selection of the type. - * - * @return the dialog. - */ - private IDialog<W> createSynchronizedDialog(final IDialog<W> dialog) { - return new SynchronizedAbstractDialog<W>(dialog, this.getDisplay()); - } - -}
diff --git a/org.eclipse.modisco.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/exported/util/widget/component/getorcreate/AbstractGetOrCreateElementWithWizardButtonWidget.java b/org.eclipse.modisco.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/exported/util/widget/component/getorcreate/AbstractGetOrCreateElementWithWizardButtonWidget.java deleted file mode 100644 index b610801..0000000 --- a/org.eclipse.modisco.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/exported/util/widget/component/getorcreate/AbstractGetOrCreateElementWithWizardButtonWidget.java +++ /dev/null
@@ -1,85 +0,0 @@ -/** - * Copyright (c) 2012 Mia-Software. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Alban Ménager (Soft-Maint) - Bug 387470 - [EFacet][Custom] Editors - * Grégoire Dupé (Mia-Software) - Bug 387470 - [EFacet][Custom] Editors - */ -package org.eclipse.emf.facet.util.ui.internal.exported.util.widget.component.getorcreate; - -import org.eclipse.emf.facet.util.ui.internal.exported.PropertyElement2; -import org.eclipse.emf.facet.util.ui.internal.exported.wizard.IExtendedWizard; -import org.eclipse.jface.window.Window; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Display; - -/** - * Has the same goal than {@link AbstractGetOrCreateElementWithButtonWidget} but - * especially for dialogs. - * - * @since 0.3 - */ -public abstract class AbstractGetOrCreateElementWithWizardButtonWidget<T extends Object, W extends IExtendedWizard> - extends AbstractGetOrCreateElementWithButtonWidget<T, W> { - - /** - * @since 1.0 - */ - protected AbstractGetOrCreateElementWithWizardButtonWidget( - final Composite parent, - final PropertyElement2<T> propertyElement) { - super(parent, propertyElement); - } - - @Override - public W onButtonPressed() { - final W wizard = createIWizard(); - Display.getDefault().asyncExec(new Runnable() { - public void run() { - final int openResult = wizard.open(); - // TODO The wizard closing events must be cached by the use of - // call back pattern. The use of this pattern must be done in - // the subclass of this class, like in - // org.eclipse.emf.facet.util.ui.internal.exported.util.widget.component.getorcreate.AbstractGetOrCreateElementWithWizardButtonWidget<ETypedElement> - // The following if statement and the methods 'onWizardCommited' - // 'onWizardCanceled' must be removed (replaced by the use of - // call backs) - if (openResult == Window.OK) { - onWizardCommited(wizard); - } else { - onWizardCanceled(); - } - } - }); - return createSynchronizedWizard(wizard); - } - - /** - * Create the wizard for the selection of the type. - * - * @return the wizard. - */ - protected abstract W createIWizard(); - - /** - * Action to do when the dialog opened with the button "..." is closed with - * the "Ok" button. - * - * @param selectETypeDialog - */ - protected abstract void onWizardCommited(W wizard); - - /** - * Action to do when the dialog opened with the button "..." is closed with - * the "Cancel" button. - */ - protected abstract void onWizardCanceled(); - - protected abstract W createSynchronizedWizard(final W wizard); - -}
diff --git a/org.eclipse.modisco.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/exported/util/widget/component/properties/AbstractGetPropertyWidget.java b/org.eclipse.modisco.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/exported/util/widget/component/properties/AbstractGetPropertyWidget.java deleted file mode 100644 index 9fd91eb..0000000 --- a/org.eclipse.modisco.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/exported/util/widget/component/properties/AbstractGetPropertyWidget.java +++ /dev/null
@@ -1,159 +0,0 @@ -/** - * Copyright (c) 2012 Mia-Software. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Alban Ménager (Soft-Maint) - Bug 387470 - [EFacet][Custom] Editors - */ -package org.eclipse.emf.facet.util.ui.internal.exported.util.widget.component.properties; - -import org.eclipse.emf.facet.util.ui.internal.exported.PropertyElement; -import org.eclipse.emf.facet.util.ui.internal.exported.util.widget.AbstractWidget; -import org.eclipse.emf.facet.util.ui.utils.UIUtils; -import org.eclipse.swt.SWT; -import org.eclipse.swt.events.SelectionEvent; -import org.eclipse.swt.events.SelectionListener; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.layout.GridLayout; -import org.eclipse.swt.widgets.Button; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Label; - -/** - * This Abstract class provides all the elements to create:</p> - * - * Label : [x]</p> - * - * The label is set by {@link #getLabel()}. The checkbox is initialized with the - * {@link PropertyElement} attributes - * <nl> - * <li>{@link PropertyElement#getValue()} (the value of the property must be a - * boolean)</li> - * <li>{@link PropertyElement#isChangeable()}</li> - * </nl> - * - * The {@link #getError()} method return 'null' because no error can be returned - * (the value of the checkbox is 'true' or 'false'). - * - * @see GetChangeableWidget - * @see GetOrderedWidget - * @see GetDerivedWidget - * @see GetTransientWidget - * @see GetUniqueWidget - * @see GetVolatileWidget - * @since 0.3 - */ -public abstract class AbstractGetPropertyWidget extends AbstractWidget { - - private static final int COLUMN_NUMBER = 2; - private static final int WIDTH_HINT_DEF = 65; - private int labelWidthHint; - private final PropertyElement propertyElement; - private Button propertyButton; - - /** - * Constructor. Initialize the composite with a layout of - * {@value #COLUMN_NUMBER} columns and the layoutData with the - * 'fillGridData' attribute of {@link AbstractWidget}. - * - * @param parent - * the parent containing this composite. - * @param style - * the style of the composite. - * @param editingDomain - * the current editing domain. - * @param propertyElement - * the property element that this composite will edit. - * - * @see AbstractWidget - */ - protected AbstractGetPropertyWidget(final Composite parent, - final PropertyElement propertyElement) { - super(parent); - this.propertyElement = propertyElement; - this.labelWidthHint = WIDTH_HINT_DEF; - this.setLayout(new GridLayout(COLUMN_NUMBER, false)); - this.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); - } - - @Override - protected void addSubWidgets() { - if ((getLabel() != null) && !"".equals(getLabel())) { //$NON-NLS-1$ - final Label label = UIUtils.createLabel(this, getLabel()); - final GridData layoutData = new GridData(SWT.FILL); - layoutData.widthHint = this.labelWidthHint; - label.setLayoutData(layoutData); - label.setEnabled(this.propertyElement.isChangeable()); - } - createCheckbox(); - } - - public void setPropertyEnabled(final boolean enabled) { - this.propertyButton.setSelection(enabled); - } - - /** - * Create a checkbox initialized with the {@link PropertyElement} attributes - * <nl> - * <li>Default value : {@link PropertyElement#getValue()} (the value of the - * property must be a boolean)</li> - * <li>Enabled : {@link PropertyElement#isChangeable()}</li> - * </nl> - */ - private void createCheckbox() { - if (this.propertyElement.getValue() == null) { - this.propertyElement.setValue(Boolean.TRUE); - } - SelectionListener selectionListener = null; - if (this.propertyElement.isChangeable()) { - selectionListener = new SelectionListener() { - - public void widgetSelected(final SelectionEvent event) { - onSelection((Button) event.getSource()); - } - - public void widgetDefaultSelected(final SelectionEvent event) { - // Nothing. - } - }; - } - this.propertyButton = UIUtils.createCheckbox(this, - this.propertyElement.isChangeable(), - ((Boolean) this.propertyElement.getValue()).booleanValue(), - selectionListener); - } - - /** - * @param source - */ - protected void onSelection(final Button source) { - this.propertyElement.setValue(Boolean.valueOf(source.getSelection())); - } - - /** - * @return the label of the label field. If no label has to be displayed, - * null or void must be returned. - */ - protected abstract String getLabel(); - - /** - * Method to change the distance between the label and the checkbox. - * - * @param lABEL_WIDTH_HINT - * the lABEL_WIDTH_HINT to set - */ - public void setLabelWidthHint(final int labelWidthHint) { - this.labelWidthHint = labelWidthHint; - } - - /** - * @return the value of the property. - */ - public boolean isSelected() { - return this.propertyButton.getSelection(); - } -}
diff --git a/org.eclipse.modisco.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/exported/util/widget/component/properties/bounds/AbstractGetBoundsWidget.java b/org.eclipse.modisco.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/exported/util/widget/component/properties/bounds/AbstractGetBoundsWidget.java deleted file mode 100644 index f1cc592..0000000 --- a/org.eclipse.modisco.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/exported/util/widget/component/properties/bounds/AbstractGetBoundsWidget.java +++ /dev/null
@@ -1,127 +0,0 @@ -/** - * Copyright (c) 2012 Mia-Software. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Alban Ménager (Soft-Maint) - Bug 387470 - [EFacet][Custom] Editors - * Grégoire Dupé (Mia-Software) - Bug 387470 - [EFacet][Custom] Editors - */ -package org.eclipse.emf.facet.util.ui.internal.exported.util.widget.component.properties.bounds; - -import org.eclipse.emf.facet.util.ui.internal.exported.PropertyElement; -import org.eclipse.emf.facet.util.ui.internal.exported.PropertyElement2; -import org.eclipse.emf.facet.util.ui.internal.exported.util.widget.AbstractWidget; -import org.eclipse.emf.facet.util.ui.utils.UIUtils; -import org.eclipse.swt.events.ModifyEvent; -import org.eclipse.swt.events.ModifyListener; -import org.eclipse.swt.layout.GridLayout; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Spinner; - -/** - * This abstract class provide a simple way to create a composite for the - * edition of bounds. The {@link Spinner} composite is used for the edition of - * number.</p> - * - * No error is return because the default value is 0. - * - * @see Spinner - * @see GetUpperBoundWidget - * @see GetLowerBoundWidget - * @since 0.3 - */ -public abstract class AbstractGetBoundsWidget extends AbstractWidget { - - private static final int COLUMN_NUMBER = 3; - private static final int MAX_VALUE = Integer.MAX_VALUE; - private static final int MIN_VALUE = Integer.MIN_VALUE; - private static final int INCREMENT = 1; - - private final PropertyElement2<Integer> propertyElement; - private Spinner spinner; - - /** - * Constructor. Initialize the composite with a layout of - * {@value #COLUMN_NUMBER} columns. - * - * @param parent - * the parent containing this composite. - * @param style - * the style of the composite. - * @param editingDomain - * the current editing domain. - * @param propertyElement - * the property element that this composite will edit. - */ - protected AbstractGetBoundsWidget(final Composite parent, - final PropertyElement2<Integer> propertyElement) { - super(parent); - this.propertyElement = propertyElement; - this.setLayout(new GridLayout(COLUMN_NUMBER, false)); - } - - /** - * @return the propertyElement - */ - public PropertyElement getPropertyElement() { - return this.propertyElement; - } - - @Override - protected void addSubWidgets() { - if ((getLabel() != null) && !"".equals(getLabel())) { //$NON-NLS-1$ - UIUtils.createLabel(this, getLabel()); - } - createSpinner(); - } - - /** - * Creation of a spinner. - */ - private void createSpinner() { - // SPINNER - final ModifyListener modifyListener = new ModifyListener() { - public void modifyText(final ModifyEvent event) { - textModified(); - } - }; - this.spinner = UIUtils.createSpinner(this, MAX_VALUE, MIN_VALUE, - INCREMENT, this.propertyElement.isChangeable(), modifyListener); - final Integer value = this.propertyElement.getValue2(); - if (value != null) { - setBoundValue(value.intValue()); - } - } - - /** - * Method called when the text is modified. - */ - protected void textModified() { - getPropertyElement().setValue(Integer.valueOf(this.spinner.getText())); - } - - /** - * @return the label. If no label has to be displayed, null or void must be - * returned. - */ - protected abstract String getLabel(); - - /** - * Set the bound value. - * - * @param value - * the value to set. - */ - public void setBoundValue(final int value) { - this.spinner.setSelection(value); - } - - public int getBoundValue() { - final String text = this.spinner.getText(); - return Integer.parseInt(text); - } -}
diff --git a/org.eclipse.modisco.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/exported/util/widget/component/properties/name/AbstractGetElementNameWidget.java b/org.eclipse.modisco.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/exported/util/widget/component/properties/name/AbstractGetElementNameWidget.java deleted file mode 100644 index 7ca3a54..0000000 --- a/org.eclipse.modisco.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/exported/util/widget/component/properties/name/AbstractGetElementNameWidget.java +++ /dev/null
@@ -1,86 +0,0 @@ -/** - * Copyright (c) 2012 Mia-Software. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Alban Ménager (Soft-Maint) - Bug 387470 - [EFacet][Custom] Editors - * Grégoire Dupé (Mia-Software) - Bug 387470 - [EFacet][Custom] Editors - */ -package org.eclipse.emf.facet.util.ui.internal.exported.util.widget.component.properties.name; - -import org.eclipse.emf.facet.util.ui.internal.exported.PropertyElement; -import org.eclipse.emf.facet.util.ui.internal.exported.PropertyElement2; -import org.eclipse.emf.facet.util.ui.internal.exported.util.widget.component.getorcreate.AbstractGetOrCreateElementWidget; -import org.eclipse.emf.facet.util.ui.utils.UIUtils; -import org.eclipse.swt.widgets.Composite; - -/** - * This abstract class provide the creation of:</p> - * - * Label : [ TextFiled ]</p> - * - * Where the label is getted by {@link #getLabel()}. The TextField will set the - * value of the {@link PropertyElement} when edited. If the field is not setted, - * an error will be displayed at the top of the dialog when the 'ok' button is - * pressed. - * - * @see GetAttributeNameWidget - * @see GetFacetNameWidget - * @see GetFacetSetNameWidget - * @see GetOperationNameWidget - * @see GetReferenceNameWidget - * @see GetQueryNameWidget - * @since 0.3 - */ -public abstract class AbstractGetElementNameWidget extends - AbstractGetOrCreateElementWidget<String> { - - /** - * Constructor. - * - * @param parent - * the parent of this composite. - * @param editingDomain - * the current editing domain. - * @param propertyElement - * the property element that be edited with this composite. - */ - protected AbstractGetElementNameWidget(final Composite parent, - final PropertyElement2<String> propertyElement) { - super(parent, propertyElement); - } - - @Override - protected void addSubWidgets() { - if ((getLabel() != null) && !"".equals(getLabel())) { //$NON-NLS-1$ - UIUtils.createLabel(this, getLabel()); - } - createTextField(this.getPropertyElement().isChangeable()); - } - - /** - * @return the label for this composite. If no label has to be displayed, - * null or empty string must be returned. - */ - protected abstract String getLabel(); - - @Override - public String getError() { - String result = null; - final String elementName = this.getPropertyElement().getValue2(); - if ((elementName == null) || "".equals(elementName)) { //$NON-NLS-1$ - result = getErrorMessage(); - } - return result; - } - - /** - * @return the error message. - */ - @Override - protected abstract String getErrorMessage(); -}
diff --git a/org.eclipse.modisco.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/exported/util/widget/component/properties/name/AbstractPrintElementWidget.java b/org.eclipse.modisco.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/exported/util/widget/component/properties/name/AbstractPrintElementWidget.java deleted file mode 100644 index 05ecedb..0000000 --- a/org.eclipse.modisco.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/exported/util/widget/component/properties/name/AbstractPrintElementWidget.java +++ /dev/null
@@ -1,60 +0,0 @@ -/** - * Copyright (c) 2012 Mia-Software. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Alban Ménager (Soft-Maint) - Bug 387470 - [EFacet][Custom] Editors - * Grégoire Dupé (Mia-Software) - Bug 387470 - [EFacet][Custom] Editors - */ -package org.eclipse.emf.facet.util.ui.internal.exported.util.widget.component.properties.name; - -import org.eclipse.emf.facet.util.ui.internal.exported.PropertyElement2; -import org.eclipse.emf.facet.util.ui.internal.exported.util.widget.component.getorcreate.AbstractGetOrCreateElementWidget; -import org.eclipse.emf.facet.util.ui.utils.UIUtils; -import org.eclipse.swt.widgets.Composite; - -/** - * This abstract class provide the creation of:</p> - * - * Label : [//TextFiled//]</p> - * - * Where the label is getted by {@link #getLabel()}. The textField is disabled - * an initializated with the value of the {@link #getTextFieldInitialText()}. - * - * @since 0.3 - */ -public abstract class AbstractPrintElementWidget<T extends Object> extends - AbstractGetOrCreateElementWidget<T> { - - /** - * Constructor. - * - * @param parent - * the parent of this composite. - * @param editingDomain - * the current editing domain. - * @since 1.0 - */ - protected AbstractPrintElementWidget(final Composite parent, - final PropertyElement2<T> propertyElement) { - super(parent, propertyElement); - } - - @Override - protected void addSubWidgets() { - if ((getLabel() != null) && !"".equals(getLabel())) { //$NON-NLS-1$ - UIUtils.createLabel(this, getLabel()); - } - createTextField(false); - } - - /** - * @return the label for this composite. If no label has to be displayed, - * null or void must be returned. - */ - protected abstract String getLabel(); -}
diff --git a/org.eclipse.modisco.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/exported/util/widget/query/AbstractQueryWidget.java b/org.eclipse.modisco.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/exported/util/widget/query/AbstractQueryWidget.java deleted file mode 100644 index 6115a9e..0000000 --- a/org.eclipse.modisco.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/exported/util/widget/query/AbstractQueryWidget.java +++ /dev/null
@@ -1,40 +0,0 @@ -/** - * Copyright (c) 2012 Mia-Software. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Alban Ménager (Soft-Maint) - Bug 387470 - [EFacet][Custom] Editors - * Grégoire Dupé (Mia-Software) - Bug 387470 - [EFacet][Custom] Editors - */ -package org.eclipse.emf.facet.util.ui.internal.exported.util.widget.query; - -import org.eclipse.emf.facet.util.ui.internal.exported.util.widget.command.AbstractCommandWidget; -import org.eclipse.swt.widgets.Composite; - -/** - * This abstract class must be used by the plug-ins extending this plug-in. It - * provides a simple way to create the widget for the edition of the query. - * - * @since 0.3 - */ -public abstract class AbstractQueryWidget<P extends Object> extends - AbstractCommandWidget { - - /** - * Constructor. - * - * @param parent - * the parent of this widget. - * @param editingDomain - * the current editing domain. - * @param properties - * the properties. - */ - protected AbstractQueryWidget(final Composite parent) { - super(parent); - } -}
diff --git a/org.eclipse.modisco.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/exported/util/wizard/SynchronizedWizard.java b/org.eclipse.modisco.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/exported/util/wizard/SynchronizedWizard.java deleted file mode 100644 index 5e51c80..0000000 --- a/org.eclipse.modisco.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/exported/util/wizard/SynchronizedWizard.java +++ /dev/null
@@ -1,314 +0,0 @@ -/** - * Copyright (c) 2012 Mia-Software. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Alban Ménager (Soft-Maint) - Bug 387470 - [EFacet][Custom] Editors - */ -package org.eclipse.emf.facet.util.ui.internal.exported.util.wizard; - -import org.eclipse.emf.facet.util.ui.internal.exported.displaysync.AbstractExceptionFreeRunnable; -import org.eclipse.emf.facet.util.ui.internal.exported.displaysync.AbstractVoidExceptionFreeRunnable; -import org.eclipse.emf.facet.util.ui.internal.exported.displaysync.SynchronizedObject; -import org.eclipse.emf.facet.util.ui.internal.exported.wizard.IExtendedWizard; -import org.eclipse.jface.dialogs.IDialogSettings; -import org.eclipse.jface.wizard.IWizardContainer; -import org.eclipse.jface.wizard.IWizardPage; -import org.eclipse.swt.graphics.Image; -import org.eclipse.swt.graphics.RGB; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Display; - -/** - * Synchronized class for safe run. - * - * @see WizardFactoryImpl - * @since 0.3 - */ -public class SynchronizedWizard<T extends IExtendedWizard> extends - SynchronizedObject<T> implements IExtendedWizard { - - /** - * Constructor. - * - * @param object - * the to synchronized. - * @param display - * the display. - */ - public SynchronizedWizard(final T object, final Display display) { - super(object, display); - } - - public int open() { - return this.safeSyncExec(new AbstractExceptionFreeRunnable<Integer>() { - @Override - public Integer safeRun() { - return Integer.valueOf(SynchronizedWizard.this - .getSynchronizedObject().open()); - } - }).intValue(); - } - - public IWizardPage getCurrentPage() { - return this - .safeSyncExec(new AbstractExceptionFreeRunnable<IWizardPage>() { - @Override - public IWizardPage safeRun() { - return SynchronizedWizard.this.getSynchronizedObject() - .getCurrentPage(); - } - }); - } - - public IWizardPage next() { - return this - .safeSyncExec(new AbstractExceptionFreeRunnable<IWizardPage>() { - @Override - public IWizardPage safeRun() { - return SynchronizedWizard.this.getSynchronizedObject() - .next(); - } - }); - } - - public IWizardPage previous() { - return this - .safeSyncExec(new AbstractExceptionFreeRunnable<IWizardPage>() { - @Override - public IWizardPage safeRun() { - return SynchronizedWizard.this.getSynchronizedObject() - .previous(); - } - }); - } - - public boolean finish() { - return this.safeSyncExec(new AbstractExceptionFreeRunnable<Boolean>() { - @Override - public Boolean safeRun() { - return Boolean.valueOf(SynchronizedWizard.this - .getSynchronizedObject().finish()); - } - }).booleanValue(); - } - - public void addPages() { - this.voidExceptionFreeRunnable(new AbstractVoidExceptionFreeRunnable() { - @Override - public void voidSafeRun() { - SynchronizedWizard.this.getSynchronizedObject().addPages(); - } - }); - } - - public boolean canFinish() { - return this.safeSyncExec(new AbstractExceptionFreeRunnable<Boolean>() { - @Override - public Boolean safeRun() { - return Boolean.valueOf(SynchronizedWizard.this - .getSynchronizedObject().canFinish()); - } - }).booleanValue(); - } - - public void createPageControls(final Composite pageContainer) { - this.voidExceptionFreeRunnable(new AbstractVoidExceptionFreeRunnable() { - @Override - public void voidSafeRun() { - SynchronizedWizard.this.getSynchronizedObject() - .createPageControls(pageContainer); - } - }); - } - - public void dispose() { - this.voidExceptionFreeRunnable(new AbstractVoidExceptionFreeRunnable() { - @Override - public void voidSafeRun() { - SynchronizedWizard.this.getSynchronizedObject().dispose(); - } - }); - } - - public IWizardContainer getContainer() { - return this - .safeSyncExec(new AbstractExceptionFreeRunnable<IWizardContainer>() { - @Override - public IWizardContainer safeRun() { - return SynchronizedWizard.this.getSynchronizedObject() - .getContainer(); - } - }); - } - - public Image getDefaultPageImage() { - return this.safeSyncExec(new AbstractExceptionFreeRunnable<Image>() { - @Override - public Image safeRun() { - return SynchronizedWizard.this.getSynchronizedObject() - .getDefaultPageImage(); - } - }); - } - - public IDialogSettings getDialogSettings() { - return this - .safeSyncExec(new AbstractExceptionFreeRunnable<IDialogSettings>() { - @Override - public IDialogSettings safeRun() { - return SynchronizedWizard.this.getSynchronizedObject() - .getDialogSettings(); - } - }); - } - - public IWizardPage getNextPage(final IWizardPage page) { - return this - .safeSyncExec(new AbstractExceptionFreeRunnable<IWizardPage>() { - @Override - public IWizardPage safeRun() { - return SynchronizedWizard.this.getSynchronizedObject() - .getNextPage(page); - } - }); - } - - public IWizardPage getPage(final String pageName) { - return this - .safeSyncExec(new AbstractExceptionFreeRunnable<IWizardPage>() { - @Override - public IWizardPage safeRun() { - return SynchronizedWizard.this.getSynchronizedObject() - .getPage(pageName); - } - }); - } - - public int getPageCount() { - return this.safeSyncExec(new AbstractExceptionFreeRunnable<Integer>() { - @Override - public Integer safeRun() { - return Integer.valueOf(SynchronizedWizard.this - .getSynchronizedObject().getPageCount()); - } - }).intValue(); - } - - public IWizardPage[] getPages() { - return this - .safeSyncExec(new AbstractExceptionFreeRunnable<IWizardPage[]>() { - @Override - public IWizardPage[] safeRun() { - return SynchronizedWizard.this.getSynchronizedObject() - .getPages(); - } - }); - } - - public IWizardPage getPreviousPage(final IWizardPage page) { - return this - .safeSyncExec(new AbstractExceptionFreeRunnable<IWizardPage>() { - @Override - public IWizardPage safeRun() { - return SynchronizedWizard.this.getSynchronizedObject() - .getPreviousPage(page); - } - }); - } - - public IWizardPage getStartingPage() { - return this - .safeSyncExec(new AbstractExceptionFreeRunnable<IWizardPage>() { - @Override - public IWizardPage safeRun() { - return SynchronizedWizard.this.getSynchronizedObject() - .getStartingPage(); - } - }); - } - - public RGB getTitleBarColor() { - return this.safeSyncExec(new AbstractExceptionFreeRunnable<RGB>() { - @Override - public RGB safeRun() { - return SynchronizedWizard.this.getSynchronizedObject() - .getTitleBarColor(); - } - }); - } - - public String getWindowTitle() { - return this.safeSyncExec(new AbstractExceptionFreeRunnable<String>() { - @Override - public String safeRun() { - return SynchronizedWizard.this.getSynchronizedObject() - .getWindowTitle(); - } - }); - } - - public boolean isHelpAvailable() { - return this.safeSyncExec(new AbstractExceptionFreeRunnable<Boolean>() { - @Override - public Boolean safeRun() { - return Boolean.valueOf(SynchronizedWizard.this - .getSynchronizedObject().isHelpAvailable()); - } - }).booleanValue(); - } - - public boolean needsPreviousAndNextButtons() { - return this.safeSyncExec(new AbstractExceptionFreeRunnable<Boolean>() { - @Override - public Boolean safeRun() { - return Boolean.valueOf(SynchronizedWizard.this - .getSynchronizedObject().needsPreviousAndNextButtons()); - } - }).booleanValue(); - } - - public boolean needsProgressMonitor() { - return this.safeSyncExec(new AbstractExceptionFreeRunnable<Boolean>() { - @Override - public Boolean safeRun() { - return Boolean.valueOf(SynchronizedWizard.this - .getSynchronizedObject().needsProgressMonitor()); - } - }).booleanValue(); - } - - public boolean performCancel() { - return this.safeSyncExec(new AbstractExceptionFreeRunnable<Boolean>() { - @Override - public Boolean safeRun() { - return Boolean.valueOf(SynchronizedWizard.this - .getSynchronizedObject().performCancel()); - } - }).booleanValue(); - } - - public boolean performFinish() { - return this.safeSyncExec(new AbstractExceptionFreeRunnable<Boolean>() { - @Override - public Boolean safeRun() { - return Boolean.valueOf(SynchronizedWizard.this - .getSynchronizedObject().performFinish()); - } - }).booleanValue(); - } - - public void setContainer(final IWizardContainer wizardContainer) { - this.voidExceptionFreeRunnable(new AbstractVoidExceptionFreeRunnable() { - @Override - public void voidSafeRun() { - SynchronizedWizard.this.getSynchronizedObject().setContainer( - wizardContainer); - } - }); - } -}
diff --git a/org.eclipse.modisco.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/exported/widget/IAbstractWidget.java b/org.eclipse.modisco.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/exported/widget/IAbstractWidget.java deleted file mode 100644 index 078f8db..0000000 --- a/org.eclipse.modisco.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/exported/widget/IAbstractWidget.java +++ /dev/null
@@ -1,56 +0,0 @@ -/** - * Copyright (c) 2012 Mia-Software. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Alban Ménager (Soft-Maint) - Bug 387470 - [EFacet][Custom] Editors - * Grégoire Dupé (Mia-Software) - Bug 387470 - [EFacet][Custom] Editors - */ -package org.eclipse.emf.facet.util.ui.internal.exported.widget; - -import org.eclipse.emf.facet.util.ui.internal.exported.util.widget.AbstractWidget; - -/** - * - * @see AbstractWidget - * @since 0.3 - * @noextend This interface is not intended to be extended by clients. - * @noimplement This interface is not intended to be implemented by clients. - */ -public interface IAbstractWidget { - - /** - * Add the abstractWidget in parameter to the list of listeners of the - * widget. - * - * @param abstractWidget - * the abstractWidget to listen. - */ - void addListener(final AbstractWidget abstractWidget); - - /** - * When a change in a sub-widget append, this method is execute. If no - * action has to be done when a modification append, this method has to be - * void. - */ - void notifyChanged(); - - /** - * Create the content of the widget (call {@link #addSubWidgets()}) and - * sub-widgets. - */ - void createWidgetContent(); - - /** - * Return the string containing the error for this widget. - * - * @return null if there is no error. The string containing the error if - * there is an error. - */ - String getError(); - -} \ No newline at end of file
diff --git a/org.eclipse.modisco.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/exported/widget/getorcreate/IAbstractGetOrCreateElementWidget.java b/org.eclipse.modisco.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/exported/widget/getorcreate/IAbstractGetOrCreateElementWidget.java deleted file mode 100644 index 3f786c1..0000000 --- a/org.eclipse.modisco.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/exported/widget/getorcreate/IAbstractGetOrCreateElementWidget.java +++ /dev/null
@@ -1,43 +0,0 @@ -/** - * Copyright (c) 2012 Mia-Software. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Alban Ménager (Soft-Maint) - Bug 387470 - [EFacet][Custom] Editors - * Grégoire Dupé (Mia-Software) - Bug 387470 - [EFacet][Custom] Editors - */ -package org.eclipse.emf.facet.util.ui.internal.exported.widget.getorcreate; - -import org.eclipse.emf.facet.util.ui.internal.exported.util.widget.component.getorcreate.AbstractGetOrCreateElementWidget; -import org.eclipse.emf.facet.util.ui.internal.exported.widget.IAbstractWidget; - - -/** - * Interface. - * - * - * @see AbstractGetOrCreateElementWidget - * @since 0.3 - * @noextend This interface is not intended to be extended by clients. - * @noimplement This interface is not intended to be implemented by clients. - */ -public interface IAbstractGetOrCreateElementWidget extends IAbstractWidget { - - /** - * @return the text field. - */ - String getText(); - - /** - * Set the text field. - * - * @param text - * the new text. - */ - void setText(String text); - -} \ No newline at end of file
diff --git a/org.eclipse.modisco.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/exported/widget/getorcreate/IAbstractGetOrCreateElementWithButtonWidget.java b/org.eclipse.modisco.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/exported/widget/getorcreate/IAbstractGetOrCreateElementWithButtonWidget.java deleted file mode 100644 index 3fc0533..0000000 --- a/org.eclipse.modisco.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/exported/widget/getorcreate/IAbstractGetOrCreateElementWithButtonWidget.java +++ /dev/null
@@ -1,41 +0,0 @@ -/** - * Copyright (c) 2012 Mia-Software. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Alban Ménager (Soft-Maint) - Bug 387470 - [EFacet][Custom] Editors - * Grégoire Dupé (Mia-Software) - Bug 387470 - [EFacet][Custom] Editors - */ -package org.eclipse.emf.facet.util.ui.internal.exported.widget.getorcreate; - -import org.eclipse.emf.facet.util.ui.internal.exported.util.widget.component.getorcreate.AbstractGetOrCreateElementWithButtonWidget; - -/** - * @see AbstractGetOrCreateElementWithButtonWidget - * @since 0.3 - * @noextend This interface is not intended to be extended by clients. - * @noimplement This interface is not intended to be implemented by clients. - */ -public interface IAbstractGetOrCreateElementWithButtonWidget<D> - extends - IAbstractGetOrCreateElementWidget { - - /** - * @param buttonEnabled - * the buttonEnabled to set - */ - void setButtonEnabled(final boolean buttonEnabled); - - /** - * Press the button. - * - * @return the potential object return when the button is pressed. Can be - * null. - */ - D pressButton(); - -} \ No newline at end of file
diff --git a/org.eclipse.modisco.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/exported/wizard/IExtendedWizard.java b/org.eclipse.modisco.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/exported/wizard/IExtendedWizard.java deleted file mode 100644 index 3f3e6bb..0000000 --- a/org.eclipse.modisco.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/exported/wizard/IExtendedWizard.java +++ /dev/null
@@ -1,56 +0,0 @@ -/** - * Copyright (c) 2012 Mia-Software. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Alban Ménager (Soft-Maint) - Bug 387470 - [EFacet][Custom] Editors - */ -package org.eclipse.emf.facet.util.ui.internal.exported.wizard; - -import org.eclipse.jface.wizard.IWizard; -import org.eclipse.jface.wizard.IWizardPage; - -/** - * Interface for the facets wizards. - * - * @since 0.3 - */ -public interface IExtendedWizard extends IWizard { - - /** - * @return the current page of the wizard. - */ - IWizardPage getCurrentPage(); - - /** - * Simulate the action of pressing the next button. - * - * @return the next page. - */ - IWizardPage next(); - - /** - * Simulate the action of pressing the previous button. - * - * @return the previous page. - */ - IWizardPage previous(); - - /** - * Simulate the action of pressing the finish button. - * - * @return true if the wizard finish correctly. - */ - boolean finish(); - - /** - * Open the wizard. - * - * @return the return code when the wizard closes. - */ - int open(); -}
diff --git a/org.eclipse.modisco.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/sync/generated/SynchronizedAbstractGetOrCreateElementWidget.java b/org.eclipse.modisco.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/sync/generated/SynchronizedAbstractGetOrCreateElementWidget.java deleted file mode 100644 index 32dba13..0000000 --- a/org.eclipse.modisco.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/sync/generated/SynchronizedAbstractGetOrCreateElementWidget.java +++ /dev/null
@@ -1,92 +0,0 @@ -/** - * Copyright (c) 2012 Mia-Software. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Grégoire Dupé (Mia-Software) - Bug 387470 - [EFacet][Custom] Editors - */ -package org.eclipse.emf.facet.util.ui.internal.sync.generated; - -import org.eclipse.emf.facet.util.ui.internal.exported.displaysync.SynchronizedObject; -import org.eclipse.swt.widgets.Display; -import org.eclipse.emf.facet.util.ui.internal.exported.displaysync.AbstractVoidExceptionFreeRunnable; -import org.eclipse.emf.facet.util.ui.internal.exported.displaysync.AbstractExceptionFreeRunnable; - -public class SynchronizedAbstractGetOrCreateElementWidget - extends - SynchronizedObject<org.eclipse.emf.facet.util.ui.internal.exported.widget.getorcreate.IAbstractGetOrCreateElementWidget> - implements - org.eclipse.emf.facet.util.ui.internal.exported.widget.getorcreate.IAbstractGetOrCreateElementWidget { - - public SynchronizedAbstractGetOrCreateElementWidget( - final org.eclipse.emf.facet.util.ui.internal.exported.widget.getorcreate.IAbstractGetOrCreateElementWidget object, - final Display display) { - super(object, display); - } - - public final void addListener( - final org.eclipse.emf.facet.util.ui.internal.exported.util.widget.AbstractWidget parm0) { - voidExceptionFreeRunnable(new AbstractVoidExceptionFreeRunnable() { - @Override - public void voidSafeRun() { - SynchronizedAbstractGetOrCreateElementWidget.this - .getSynchronizedObject().addListener(parm0); - } - }); - } - - public final void createWidgetContent() { - voidExceptionFreeRunnable(new AbstractVoidExceptionFreeRunnable() { - @Override - public void voidSafeRun() { - SynchronizedAbstractGetOrCreateElementWidget.this - .getSynchronizedObject().createWidgetContent(); - } - }); - } - - public final java.lang.String getError() { - return safeSyncExec(new AbstractExceptionFreeRunnable<java.lang.String>() { - @Override - public java.lang.String safeRun() { - return SynchronizedAbstractGetOrCreateElementWidget.this - .getSynchronizedObject().getError(); - } - }); - } - - public final void notifyChanged() { - voidExceptionFreeRunnable(new AbstractVoidExceptionFreeRunnable() { - @Override - public void voidSafeRun() { - SynchronizedAbstractGetOrCreateElementWidget.this - .getSynchronizedObject().notifyChanged(); - } - }); - } - - public final java.lang.String getText() { - return safeSyncExec(new AbstractExceptionFreeRunnable<java.lang.String>() { - @Override - public java.lang.String safeRun() { - return SynchronizedAbstractGetOrCreateElementWidget.this - .getSynchronizedObject().getText(); - } - }); - } - - public final void setText(final java.lang.String parm0) { - voidExceptionFreeRunnable(new AbstractVoidExceptionFreeRunnable() { - @Override - public void voidSafeRun() { - SynchronizedAbstractGetOrCreateElementWidget.this - .getSynchronizedObject().setText(parm0); - } - }); - } - -}
diff --git a/org.eclipse.modisco.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/sync/generated/SynchronizedAbstractGetOrCreateElementWithButtonWidget.java b/org.eclipse.modisco.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/sync/generated/SynchronizedAbstractGetOrCreateElementWithButtonWidget.java deleted file mode 100644 index 502af8c..0000000 --- a/org.eclipse.modisco.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/sync/generated/SynchronizedAbstractGetOrCreateElementWithButtonWidget.java +++ /dev/null
@@ -1,112 +0,0 @@ -/** - * Copyright (c) 2012 Mia-Software. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Grégoire Dupé (Mia-Software) - Bug 387470 - [EFacet][Custom] Editors - */ -package org.eclipse.emf.facet.util.ui.internal.sync.generated; - -import org.eclipse.emf.facet.util.ui.internal.exported.displaysync.SynchronizedObject; -import org.eclipse.swt.widgets.Display; -import org.eclipse.emf.facet.util.ui.internal.exported.displaysync.AbstractVoidExceptionFreeRunnable; -import org.eclipse.emf.facet.util.ui.internal.exported.displaysync.AbstractExceptionFreeRunnable; - -public class SynchronizedAbstractGetOrCreateElementWithButtonWidget<D extends java.lang.Object> - extends - SynchronizedObject<org.eclipse.emf.facet.util.ui.internal.exported.widget.getorcreate.IAbstractGetOrCreateElementWithButtonWidget<D>> - implements - org.eclipse.emf.facet.util.ui.internal.exported.widget.getorcreate.IAbstractGetOrCreateElementWithButtonWidget<D> { - - public SynchronizedAbstractGetOrCreateElementWithButtonWidget( - final org.eclipse.emf.facet.util.ui.internal.exported.widget.getorcreate.IAbstractGetOrCreateElementWithButtonWidget<D> object, - final Display display) { - super(object, display); - } - - public final void addListener( - final org.eclipse.emf.facet.util.ui.internal.exported.util.widget.AbstractWidget parm0) { - voidExceptionFreeRunnable(new AbstractVoidExceptionFreeRunnable() { - @Override - public void voidSafeRun() { - SynchronizedAbstractGetOrCreateElementWithButtonWidget.this - .getSynchronizedObject().addListener(parm0); - } - }); - } - - public final void createWidgetContent() { - voidExceptionFreeRunnable(new AbstractVoidExceptionFreeRunnable() { - @Override - public void voidSafeRun() { - SynchronizedAbstractGetOrCreateElementWithButtonWidget.this - .getSynchronizedObject().createWidgetContent(); - } - }); - } - - public final java.lang.String getError() { - return safeSyncExec(new AbstractExceptionFreeRunnable<java.lang.String>() { - @Override - public java.lang.String safeRun() { - return SynchronizedAbstractGetOrCreateElementWithButtonWidget.this - .getSynchronizedObject().getError(); - } - }); - } - - public final void notifyChanged() { - voidExceptionFreeRunnable(new AbstractVoidExceptionFreeRunnable() { - @Override - public void voidSafeRun() { - SynchronizedAbstractGetOrCreateElementWithButtonWidget.this - .getSynchronizedObject().notifyChanged(); - } - }); - } - - public final java.lang.String getText() { - return safeSyncExec(new AbstractExceptionFreeRunnable<java.lang.String>() { - @Override - public java.lang.String safeRun() { - return SynchronizedAbstractGetOrCreateElementWithButtonWidget.this - .getSynchronizedObject().getText(); - } - }); - } - - public final void setText(final java.lang.String parm0) { - voidExceptionFreeRunnable(new AbstractVoidExceptionFreeRunnable() { - @Override - public void voidSafeRun() { - SynchronizedAbstractGetOrCreateElementWithButtonWidget.this - .getSynchronizedObject().setText(parm0); - } - }); - } - - public final D pressButton() { - return safeSyncExec(new AbstractExceptionFreeRunnable<D>() { - @Override - public D safeRun() { - return SynchronizedAbstractGetOrCreateElementWithButtonWidget.this - .getSynchronizedObject().pressButton(); - } - }); - } - - public final void setButtonEnabled(final boolean parm0) { - voidExceptionFreeRunnable(new AbstractVoidExceptionFreeRunnable() { - @Override - public void voidSafeRun() { - SynchronizedAbstractGetOrCreateElementWithButtonWidget.this - .getSynchronizedObject().setButtonEnabled(parm0); - } - }); - } - -}
diff --git a/org.eclipse.modisco.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/sync/generated/SynchronizedGetOrCreateFilteredElementCommmandWidget.java b/org.eclipse.modisco.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/sync/generated/SynchronizedGetOrCreateFilteredElementCommmandWidget.java deleted file mode 100644 index 1544ea3..0000000 --- a/org.eclipse.modisco.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/sync/generated/SynchronizedGetOrCreateFilteredElementCommmandWidget.java +++ /dev/null
@@ -1,142 +0,0 @@ -/** - * Copyright (c) 2012 Mia-Software. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Grégoire Dupé (Mia-Software) - Bug 387470 - [EFacet][Custom] Editors - */ -package org.eclipse.emf.facet.util.ui.internal.sync.generated; - -import org.eclipse.emf.facet.util.ui.internal.exported.displaysync.SynchronizedObject; -import org.eclipse.swt.widgets.Display; -import org.eclipse.emf.facet.util.ui.internal.exported.displaysync.AbstractVoidExceptionFreeRunnable; -import org.eclipse.emf.facet.util.ui.internal.exported.displaysync.AbstractExceptionFreeRunnable; - -public class SynchronizedGetOrCreateFilteredElementCommmandWidget<T extends java.lang.Object, W extends java.lang.Object> - extends - SynchronizedObject<org.eclipse.emf.facet.util.ui.internal.exported.util.widget.command.IGetOrCreateFilteredElementCommmandWidget<T, W>> - implements - org.eclipse.emf.facet.util.ui.internal.exported.util.widget.command.IGetOrCreateFilteredElementCommmandWidget<T, W> { - - public SynchronizedGetOrCreateFilteredElementCommmandWidget( - final org.eclipse.emf.facet.util.ui.internal.exported.util.widget.command.IGetOrCreateFilteredElementCommmandWidget<T, W> object, - final Display display) { - super(object, display); - } - - public final void addListener( - final org.eclipse.emf.facet.util.ui.internal.exported.util.widget.AbstractWidget parm0) { - voidExceptionFreeRunnable(new AbstractVoidExceptionFreeRunnable() { - @Override - public void voidSafeRun() { - SynchronizedGetOrCreateFilteredElementCommmandWidget.this - .getSynchronizedObject().addListener(parm0); - } - }); - } - - public final void createWidgetContent() { - voidExceptionFreeRunnable(new AbstractVoidExceptionFreeRunnable() { - @Override - public void voidSafeRun() { - SynchronizedGetOrCreateFilteredElementCommmandWidget.this - .getSynchronizedObject().createWidgetContent(); - } - }); - } - - public final java.lang.String getError() { - return safeSyncExec(new AbstractExceptionFreeRunnable<java.lang.String>() { - @Override - public java.lang.String safeRun() { - return SynchronizedGetOrCreateFilteredElementCommmandWidget.this - .getSynchronizedObject().getError(); - } - }); - } - - public final void notifyChanged() { - voidExceptionFreeRunnable(new AbstractVoidExceptionFreeRunnable() { - @Override - public void voidSafeRun() { - SynchronizedGetOrCreateFilteredElementCommmandWidget.this - .getSynchronizedObject().notifyChanged(); - } - }); - } - - public final <A> A adapt(final java.lang.Class<A> parm0) { - return safeSyncExec(new AbstractExceptionFreeRunnable<A>() { - @Override - public A safeRun() { - return SynchronizedGetOrCreateFilteredElementCommmandWidget.this - .getSynchronizedObject().adapt(parm0); - } - }); - } - - public final java.lang.Object getCommand() { - return safeSyncExec(new AbstractExceptionFreeRunnable<java.lang.Object>() { - @Override - public java.lang.Object safeRun() { - return SynchronizedGetOrCreateFilteredElementCommmandWidget.this - .getSynchronizedObject().getCommand(); - } - }); - } - - public final void onDialogValidation() { - voidExceptionFreeRunnable(new AbstractVoidExceptionFreeRunnable() { - @Override - public void voidSafeRun() { - SynchronizedGetOrCreateFilteredElementCommmandWidget.this - .getSynchronizedObject().onDialogValidation(); - } - }); - } - - public final T getElementSelected() { - return safeSyncExec(new AbstractExceptionFreeRunnable<T>() { - @Override - public T safeRun() { - return SynchronizedGetOrCreateFilteredElementCommmandWidget.this - .getSynchronizedObject().getElementSelected(); - } - }); - } - - public final org.eclipse.emf.facet.util.ui.internal.exported.dialog.IDialog<W> pressNewButton() { - return safeSyncExec(new AbstractExceptionFreeRunnable<org.eclipse.emf.facet.util.ui.internal.exported.dialog.IDialog<W>>() { - @Override - public org.eclipse.emf.facet.util.ui.internal.exported.dialog.IDialog<W> safeRun() { - return SynchronizedGetOrCreateFilteredElementCommmandWidget.this - .getSynchronizedObject().pressNewButton(); - } - }); - } - - public final void selectElement(final T parm0) { - voidExceptionFreeRunnable(new AbstractVoidExceptionFreeRunnable() { - @Override - public void voidSafeRun() { - SynchronizedGetOrCreateFilteredElementCommmandWidget.this - .getSynchronizedObject().selectElement(parm0); - } - }); - } - - public final void selectElementByName(final java.lang.String parm0) { - voidExceptionFreeRunnable(new AbstractVoidExceptionFreeRunnable() { - @Override - public void voidSafeRun() { - SynchronizedGetOrCreateFilteredElementCommmandWidget.this - .getSynchronizedObject().selectElementByName(parm0); - } - }); - } - -}
diff --git a/org.eclipse.modisco.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/sync/generated/SynchronizedOkDialog.java b/org.eclipse.modisco.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/sync/generated/SynchronizedOkDialog.java deleted file mode 100644 index 261d006..0000000 --- a/org.eclipse.modisco.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/sync/generated/SynchronizedOkDialog.java +++ /dev/null
@@ -1,64 +0,0 @@ -/** - * Copyright (c) Soft-Maint. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Thomas Cicognani (Soft-Maint) - Bug 406565 - Ok Dialog - */ - -package org.eclipse.emf.facet.util.ui.internal.sync.generated; - -import org.eclipse.emf.facet.util.ui.internal.exported.dialog.IOkDialog; -import org.eclipse.emf.facet.util.ui.internal.exported.displaysync.AbstractExceptionFreeRunnable; -import org.eclipse.emf.facet.util.ui.internal.exported.displaysync.AbstractVoidExceptionFreeRunnable; -import org.eclipse.emf.facet.util.ui.internal.exported.displaysync.SynchronizedObject; -import org.eclipse.swt.widgets.Display; - -@SuppressWarnings("PMD.ExcessivePublicCount") -public class SynchronizedOkDialog extends SynchronizedObject<IOkDialog> - implements IOkDialog { - - public SynchronizedOkDialog(final IOkDialog object, final Display display) { - super(object, display); - } - public final void commit() { - voidExceptionFreeRunnable(new AbstractVoidExceptionFreeRunnable() { - @Override - public void voidSafeRun() { - SynchronizedOkDialog.this.getSynchronizedObject().commit(); - } - }); - } - - public final boolean isError() { - return safeSyncExec(new AbstractExceptionFreeRunnable<Boolean>() { - @Override - public Boolean safeRun() { - return Boolean.valueOf(SynchronizedOkDialog.this.getSynchronizedObject().isError()); - } - }).booleanValue(); - } - - public final boolean isInformation() { - return safeSyncExec(new AbstractExceptionFreeRunnable<Boolean>() { - @Override - public Boolean safeRun() { - return Boolean.valueOf(SynchronizedOkDialog.this.getSynchronizedObject().isInformation()); - } - }).booleanValue(); - } - - public final boolean isWarning() { - return safeSyncExec(new AbstractExceptionFreeRunnable<Boolean>() { - @Override - public Boolean safeRun() { - return Boolean.valueOf(SynchronizedOkDialog.this.getSynchronizedObject().isWarning()); - } - }).booleanValue(); - } - -}
diff --git a/org.eclipse.modisco.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/sync/generated/SynchronizedOkDialogFactory.java b/org.eclipse.modisco.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/sync/generated/SynchronizedOkDialogFactory.java deleted file mode 100644 index bd89716..0000000 --- a/org.eclipse.modisco.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/sync/generated/SynchronizedOkDialogFactory.java +++ /dev/null
@@ -1,106 +0,0 @@ -/** - * Copyright (c) Soft-Maint. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Thomas Cicognani (Soft-Maint) - Bug 430545 - OKDialog may throws InvalidThreadAccess - */ - -package org.eclipse.emf.facet.util.ui.internal.sync.generated; - -import org.eclipse.emf.facet.util.ui.internal.exported.displaysync.SynchronizedObject; -import org.eclipse.swt.widgets.Display; -import org.eclipse.emf.facet.util.ui.internal.exported.displaysync.AbstractExceptionFreeRunnable; - -@SuppressWarnings("PMD.ExcessivePublicCount") -public class SynchronizedOkDialogFactory extends SynchronizedObject<org.eclipse.emf.facet.util.ui.internal.exported.dialog.IOkDialogFactory> implements org.eclipse.emf.facet.util.ui.internal.exported.dialog.IOkDialogFactory { - - public SynchronizedOkDialogFactory(final org.eclipse.emf.facet.util.ui.internal.exported.dialog.IOkDialogFactory object, final Display display) { - super(object, display); - } - public final org.eclipse.emf.facet.util.ui.internal.exported.dialog.IOkDialog openDialog(final org.eclipse.swt.widgets.Shell parm0, final int parm1, final java.lang.String parm2, final java.lang.String parm3, final org.eclipse.emf.facet.util.ui.internal.exported.dialog.IDialogCallback<java.lang.Void> parm4) { - return safeSyncExec(new AbstractExceptionFreeRunnable<org.eclipse.emf.facet.util.ui.internal.exported.dialog.IOkDialog>() { - @Override - public org.eclipse.emf.facet.util.ui.internal.exported.dialog.IOkDialog safeRun() { - return SynchronizedOkDialogFactory.this.getSynchronizedObject().openDialog(parm0, parm1, parm2, parm3, parm4); - } - }); - } - - public final org.eclipse.emf.facet.util.ui.internal.exported.dialog.IOkDialog openDialog(final org.eclipse.swt.widgets.Shell parm0, final int parm1, final java.lang.String parm2, final java.lang.String parm3) { - return safeSyncExec(new AbstractExceptionFreeRunnable<org.eclipse.emf.facet.util.ui.internal.exported.dialog.IOkDialog>() { - @Override - public org.eclipse.emf.facet.util.ui.internal.exported.dialog.IOkDialog safeRun() { - return SynchronizedOkDialogFactory.this.getSynchronizedObject().openDialog(parm0, parm1, parm2, parm3); - } - }); - } - - public final org.eclipse.emf.facet.util.ui.internal.exported.dialog.IOkDialog openErrorDialog(final org.eclipse.swt.widgets.Shell parm0, final java.lang.String parm1, final java.lang.String parm2, final org.eclipse.emf.facet.util.ui.internal.exported.dialog.IDialogCallback<java.lang.Void> parm3) { - return safeSyncExec(new AbstractExceptionFreeRunnable<org.eclipse.emf.facet.util.ui.internal.exported.dialog.IOkDialog>() { - @Override - public org.eclipse.emf.facet.util.ui.internal.exported.dialog.IOkDialog safeRun() { - return SynchronizedOkDialogFactory.this.getSynchronizedObject().openErrorDialog(parm0, parm1, parm2, parm3); - } - }); - } - - public final org.eclipse.emf.facet.util.ui.internal.exported.dialog.IOkDialog openErrorDialog(final org.eclipse.swt.widgets.Shell parm0, final java.lang.String parm1, final java.lang.String parm2) { - return safeSyncExec(new AbstractExceptionFreeRunnable<org.eclipse.emf.facet.util.ui.internal.exported.dialog.IOkDialog>() { - @Override - public org.eclipse.emf.facet.util.ui.internal.exported.dialog.IOkDialog safeRun() { - return SynchronizedOkDialogFactory.this.getSynchronizedObject().openErrorDialog(parm0, parm1, parm2); - } - }); - } - - public final org.eclipse.emf.facet.util.ui.internal.exported.dialog.IOkDialog openErrorDialog(final org.eclipse.swt.widgets.Shell parm0, final java.lang.Exception parm1, final java.lang.String parm2) { - return safeSyncExec(new AbstractExceptionFreeRunnable<org.eclipse.emf.facet.util.ui.internal.exported.dialog.IOkDialog>() { - @Override - public org.eclipse.emf.facet.util.ui.internal.exported.dialog.IOkDialog safeRun() { - return SynchronizedOkDialogFactory.this.getSynchronizedObject().openErrorDialog(parm0, parm1, parm2); - } - }); - } - - public final org.eclipse.emf.facet.util.ui.internal.exported.dialog.IOkDialog openInformationDialog(final org.eclipse.swt.widgets.Shell parm0, final java.lang.String parm1, final java.lang.String parm2, final org.eclipse.emf.facet.util.ui.internal.exported.dialog.IDialogCallback<java.lang.Void> parm3) { - return safeSyncExec(new AbstractExceptionFreeRunnable<org.eclipse.emf.facet.util.ui.internal.exported.dialog.IOkDialog>() { - @Override - public org.eclipse.emf.facet.util.ui.internal.exported.dialog.IOkDialog safeRun() { - return SynchronizedOkDialogFactory.this.getSynchronizedObject().openInformationDialog(parm0, parm1, parm2, parm3); - } - }); - } - - public final org.eclipse.emf.facet.util.ui.internal.exported.dialog.IOkDialog openInformationDialog(final org.eclipse.swt.widgets.Shell parm0, final java.lang.String parm1, final java.lang.String parm2) { - return safeSyncExec(new AbstractExceptionFreeRunnable<org.eclipse.emf.facet.util.ui.internal.exported.dialog.IOkDialog>() { - @Override - public org.eclipse.emf.facet.util.ui.internal.exported.dialog.IOkDialog safeRun() { - return SynchronizedOkDialogFactory.this.getSynchronizedObject().openInformationDialog(parm0, parm1, parm2); - } - }); - } - - public final org.eclipse.emf.facet.util.ui.internal.exported.dialog.IOkDialog openWarningDialog(final org.eclipse.swt.widgets.Shell parm0, final java.lang.String parm1, final java.lang.String parm2, final org.eclipse.emf.facet.util.ui.internal.exported.dialog.IDialogCallback<java.lang.Void> parm3) { - return safeSyncExec(new AbstractExceptionFreeRunnable<org.eclipse.emf.facet.util.ui.internal.exported.dialog.IOkDialog>() { - @Override - public org.eclipse.emf.facet.util.ui.internal.exported.dialog.IOkDialog safeRun() { - return SynchronizedOkDialogFactory.this.getSynchronizedObject().openWarningDialog(parm0, parm1, parm2, parm3); - } - }); - } - - public final org.eclipse.emf.facet.util.ui.internal.exported.dialog.IOkDialog openWarningDialog(final org.eclipse.swt.widgets.Shell parm0, final java.lang.String parm1, final java.lang.String parm2) { - return safeSyncExec(new AbstractExceptionFreeRunnable<org.eclipse.emf.facet.util.ui.internal.exported.dialog.IOkDialog>() { - @Override - public org.eclipse.emf.facet.util.ui.internal.exported.dialog.IOkDialog safeRun() { - return SynchronizedOkDialogFactory.this.getSynchronizedObject().openWarningDialog(parm0, parm1, parm2); - } - }); - } - -}
diff --git a/org.eclipse.modisco.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/sync/generated/SynchronizedQuestionDialog.java b/org.eclipse.modisco.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/sync/generated/SynchronizedQuestionDialog.java deleted file mode 100644 index 15939f6..0000000 --- a/org.eclipse.modisco.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/sync/generated/SynchronizedQuestionDialog.java +++ /dev/null
@@ -1,78 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2016 Mia-Software. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Thomas Cicognani (Mia-Software) - Bug 500437 - IQuestionDialogFactory not synchronized - *******************************************************************************/ -package org.eclipse.emf.facet.util.ui.internal.sync.generated; - -import org.eclipse.emf.facet.util.ui.internal.exported.displaysync.SynchronizedObject; -import org.eclipse.swt.widgets.Display; -import org.eclipse.emf.facet.util.ui.internal.exported.displaysync.AbstractVoidExceptionFreeRunnable; -import org.eclipse.emf.facet.util.ui.internal.exported.displaysync.AbstractExceptionFreeRunnable; - -@SuppressWarnings("PMD.ExcessivePublicCount") -public class SynchronizedQuestionDialog extends SynchronizedObject<org.eclipse.emf.facet.util.ui.internal.exported.dialog.IQuestionDialog> implements org.eclipse.emf.facet.util.ui.internal.exported.dialog.IQuestionDialog { - - public SynchronizedQuestionDialog(final org.eclipse.emf.facet.util.ui.internal.exported.dialog.IQuestionDialog object, final Display display) { - super(object, display); - } - public final void addCloseListener(final java.lang.Runnable parm0) { - voidExceptionFreeRunnable(new AbstractVoidExceptionFreeRunnable() { - @Override - public void voidSafeRun() { - SynchronizedQuestionDialog.this.getSynchronizedObject().addCloseListener(parm0); - } - }); - } - - public final java.lang.Boolean getResult() { - return safeSyncExec(new AbstractExceptionFreeRunnable<java.lang.Boolean>() { - @Override - public java.lang.Boolean safeRun() { - return SynchronizedQuestionDialog.this.getSynchronizedObject().getResult(); - } - }); - } - - public final org.eclipse.swt.widgets.Shell getShell() { - return safeSyncExec(new AbstractExceptionFreeRunnable<org.eclipse.swt.widgets.Shell>() { - @Override - public org.eclipse.swt.widgets.Shell safeRun() { - return SynchronizedQuestionDialog.this.getSynchronizedObject().getShell(); - } - }); - } - - public final void open() { - voidExceptionFreeRunnable(new AbstractVoidExceptionFreeRunnable() { - @Override - public void voidSafeRun() { - SynchronizedQuestionDialog.this.getSynchronizedObject().open(); - } - }); - } - - public final void pressNo() { - voidExceptionFreeRunnable(new AbstractVoidExceptionFreeRunnable() { - @Override - public void voidSafeRun() { - SynchronizedQuestionDialog.this.getSynchronizedObject().pressNo(); - } - }); - } - - public final void pressYes() { - voidExceptionFreeRunnable(new AbstractVoidExceptionFreeRunnable() { - @Override - public void voidSafeRun() { - SynchronizedQuestionDialog.this.getSynchronizedObject().pressYes(); - } - }); - } - -}
diff --git a/org.eclipse.modisco.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/sync/generated/SynchronizedQuestionDialogFactory.java b/org.eclipse.modisco.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/sync/generated/SynchronizedQuestionDialogFactory.java deleted file mode 100644 index 14344a6..0000000 --- a/org.eclipse.modisco.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/sync/generated/SynchronizedQuestionDialogFactory.java +++ /dev/null
@@ -1,41 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2016 Mia-Software. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Thomas Cicognani (Mia-Software) - Bug 500437 - IQuestionDialogFactory not synchronized - *******************************************************************************/ -package org.eclipse.emf.facet.util.ui.internal.sync.generated; - -import org.eclipse.emf.facet.util.ui.internal.exported.displaysync.SynchronizedObject; -import org.eclipse.swt.widgets.Display; -import org.eclipse.emf.facet.util.ui.internal.exported.displaysync.AbstractExceptionFreeRunnable; - -@SuppressWarnings("PMD.ExcessivePublicCount") -public class SynchronizedQuestionDialogFactory extends SynchronizedObject<org.eclipse.emf.facet.util.ui.internal.exported.dialog.IQuestionDialogFactory> implements org.eclipse.emf.facet.util.ui.internal.exported.dialog.IQuestionDialogFactory { - - public SynchronizedQuestionDialogFactory(final org.eclipse.emf.facet.util.ui.internal.exported.dialog.IQuestionDialogFactory object, final Display display) { - super(object, display); - } - public final org.eclipse.emf.facet.util.ui.internal.exported.dialog.IQuestionDialog createQuestionDialog(final org.eclipse.swt.widgets.Shell parm0, final java.lang.String parm1, final java.lang.String parm2) { - return safeSyncExec(new AbstractExceptionFreeRunnable<org.eclipse.emf.facet.util.ui.internal.exported.dialog.IQuestionDialog>() { - @Override - public org.eclipse.emf.facet.util.ui.internal.exported.dialog.IQuestionDialog safeRun() { - return SynchronizedQuestionDialogFactory.this.getSynchronizedObject().createQuestionDialog(parm0, parm1, parm2); - } - }); - } - - public final org.eclipse.emf.facet.util.ui.internal.exported.dialog.IQuestionDialog createQuestionDialog(final org.eclipse.swt.widgets.Shell parm0, final java.lang.String parm1, final java.lang.String parm2, final org.eclipse.emf.facet.util.ui.internal.exported.dialog.IDialogCallback<java.lang.Boolean> parm3) { - return safeSyncExec(new AbstractExceptionFreeRunnable<org.eclipse.emf.facet.util.ui.internal.exported.dialog.IQuestionDialog>() { - @Override - public org.eclipse.emf.facet.util.ui.internal.exported.dialog.IQuestionDialog safeRun() { - return SynchronizedQuestionDialogFactory.this.getSynchronizedObject().createQuestionDialog(parm0, parm1, parm2, parm3); - } - }); - } - -}
diff --git a/org.eclipse.modisco.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/widget/metaclass/FilteredElementSelectionWidget.java b/org.eclipse.modisco.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/widget/metaclass/FilteredElementSelectionWidget.java deleted file mode 100644 index 1326f16..0000000 --- a/org.eclipse.modisco.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/widget/metaclass/FilteredElementSelectionWidget.java +++ /dev/null
@@ -1,150 +0,0 @@ -/** - * Copyright (c) 2012 Mia-Software. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Alban Ménager (Soft-Maint) - Bug 387470 - [EFacet][Custom] Editors - */ -package org.eclipse.emf.facet.util.ui.internal.widget.metaclass; - -import org.eclipse.emf.facet.util.ui.internal.Messages; -import org.eclipse.emf.facet.util.ui.internal.exported.util.widget.AbstractWidget; -import org.eclipse.jface.viewers.LabelProvider; -import org.eclipse.swt.SWT; -import org.eclipse.swt.events.KeyEvent; -import org.eclipse.swt.events.KeyListener; -import org.eclipse.swt.events.ModifyEvent; -import org.eclipse.swt.events.ModifyListener; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Text; -import org.eclipse.ui.dialogs.FilteredList; - -/** - * A control for selecting an element from a list of elements, that can be - * filtered using the associated text field. - */ -public class FilteredElementSelectionWidget extends - AbstractWidget { - - private static final String MATCH_PREFIX = "*"; //$NON-NLS-1$ - private static final int FILTER_WIDTH_HINT = 350; - - private Text filterText; - private FilteredList fFilteredList; - private final Object[] elements; - private static final boolean MULTISELECTION = false; - - public FilteredElementSelectionWidget(final Composite parent, - final Object[] elements) { - super(parent); - this.elements = elements.clone(); - final GridData gridData = new GridData(SWT.FILL); - gridData.widthHint = FILTER_WIDTH_HINT; - setLayoutData(gridData); - } - - public void setElements(final Object[] elements) { - this.fFilteredList.setElements(elements); - } - - private void createFilteredList(final Composite parent) { - int multi; - if (MULTISELECTION) { - multi = SWT.MULTI; - } else { - multi = SWT.SINGLE; - } - this.fFilteredList = new FilteredList(parent, SWT.BORDER | SWT.V_SCROLL - | SWT.H_SCROLL | multi, new LabelProvider(), true, false, true); - - final GridData data = new GridData(); - data.grabExcessVerticalSpace = true; - data.grabExcessHorizontalSpace = true; - data.horizontalAlignment = GridData.FILL; - data.verticalAlignment = GridData.FILL; - this.fFilteredList.setLayoutData(data); - this.fFilteredList.setFilter(""); //$NON-NLS-1$ - this.fFilteredList.setElements(this.elements); - } - - private void createFilterText(final Composite parent) { - this.filterText = new Text(parent, SWT.BORDER); - this.filterText - .setMessage(Messages.FilteredElementSelectionControl_type_filter_text); - final GridData data = new GridData(); - data.grabExcessVerticalSpace = false; - data.grabExcessHorizontalSpace = true; - data.horizontalAlignment = GridData.FILL; - data.verticalAlignment = GridData.BEGINNING; - this.filterText.setLayoutData(data); - this.filterText.addModifyListener(new ModifyListener() { - public void modifyText(final ModifyEvent event) { - getfFilteredList().setFilter( - MATCH_PREFIX + getFilterText().getText()); - } - }); - this.filterText.addKeyListener(new KeyListener() { - - public void keyPressed(final KeyEvent event) { - if (event.keyCode == SWT.ARROW_DOWN) { - getfFilteredList().setFocus(); - } - } - - public void keyReleased(final KeyEvent event) { - // nothing - } - }); - } - - public Object getFirstSelectedElement() { - Object result = null; - final Object[] selection = this.fFilteredList.getSelection(); - if (selection.length > 0) { - result = selection[0]; - } - return result; - } - - public Object[] getSelectedElements() { - Object[] result = null; - final Object[] selection = this.fFilteredList.getSelection(); - if (selection.length != 0) { - result = selection; - } - return result; - } - - public FilteredList getFilteredList() { - return this.fFilteredList; - } - - public Text getFilterText() { - return this.filterText; - } - - protected FilteredList getfFilteredList() { - return this.fFilteredList; - } - - @Override - protected void addSubWidgets() { - createFilterText(this); - createFilteredList(this); - } - - @Override - public String getError() { - return null; - } - - @Override - public void notifyChanged() { - // No action has to be done if a change appends. - } -}
diff --git a/org.eclipse.modisco.facet.util.ui/src/org/eclipse/emf/facet/util/ui/utils/UIUtils.java b/org.eclipse.modisco.facet.util.ui/src/org/eclipse/emf/facet/util/ui/utils/UIUtils.java deleted file mode 100644 index 00c34cd..0000000 --- a/org.eclipse.modisco.facet.util.ui/src/org/eclipse/emf/facet/util/ui/utils/UIUtils.java +++ /dev/null
@@ -1,248 +0,0 @@ -/** - * Copyright (c) 2012 Mia-Software. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Alban Ménager (Soft-Maint) - Bug 387470 - [EFacet][Custom] Editors - */ -package org.eclipse.emf.facet.util.ui.utils; - -import java.util.List; - -import org.eclipse.swt.SWT; -import org.eclipse.swt.events.ModifyListener; -import org.eclipse.swt.events.SelectionListener; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.layout.GridLayout; -import org.eclipse.swt.widgets.Button; -import org.eclipse.swt.widgets.Combo; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Label; -import org.eclipse.swt.widgets.Spinner; -import org.eclipse.swt.widgets.Text; - -/** - * This util class provides methods for the creation of basics ui components - * like buttons or text field. - * - * @since 0.3 - */ -public final class UIUtils { - - private static final int WIDTH_HINT = 110; - - private UIUtils() { - // Private constructor. - } - - /** - * Create the label (with the given labelName) in the given composite. The - * layoutData of the label is {@link #getLabelGridData()}. - * - * @param parent - * the composite parent. - * @param labelName - * the label name. - */ - public static Label createLabel(final Composite parent, - final String labelName) { - final Label label = new Label(parent, SWT.NONE); - label.setText(labelName); - label.setLayoutData(getLabelGridData()); - return label; - } - - /** - * Create and return a new button. - * - * @param parent - * the button parent. - * @param text - * the text to display on the button. - * @param enabled - * set if the button can be pressed or not. - * @param selectionListener - * the listener when the button is pressed (can be null). - * @return the new button. - */ - public static Button createButton(final Composite parent, - final String text, final boolean enabled, - final SelectionListener selectionListener) { - final Button button = new Button(parent, SWT.NONE); - button.setText(text); - button.setEnabled(enabled); - if (selectionListener != null) { - button.addSelectionListener(selectionListener); - } - return button; - } - - /** - * Create and return a new text field. - * - * @param parent - * the text field parent. - * @param text - * the text to display on the text field. - * @param enabled - * set if the text field can be edit or not. - * @param selectListener - * the listener when the text field is edited (can be null). - * @return the new text field. - */ - public static Text createTextField(final Composite parent, - final String text, final boolean enabled, - final ModifyListener modifyListener) { - final Text textField = new Text(parent, SWT.BORDER); - textField.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); - textField.setEnabled(enabled); - if (text != null) { - textField.setText(text); - } - if (modifyListener != null) { - textField.addModifyListener(modifyListener); - } - return textField; - } - - /** - * Create a combobox with a label. - * - * @param parent - * the parent of the combobox. - * @param enabled - * if the combobox is enabled. - * @param elements - * the elements of the combobox - * @param listener - * the listener of the combobox (can be null) - * @return the combobox created. - */ - public static Combo createCombobox(final Composite parent, - final boolean enabled, final List<String> elements, - final String label, final SelectionListener listener) { - final Composite composite = new Composite(parent, SWT.NONE); - final GridLayout gridLayout = new GridLayout(2, false); - gridLayout.marginWidth = 0; - composite.setLayout(gridLayout); - final Label comboboxLabel = new Label(composite, SWT.NONE); - comboboxLabel.setText(label); - final GridData gridData = new GridData(SWT.FILL); - comboboxLabel.setLayoutData(gridData); - final Combo combobox = new Combo(composite, SWT.DROP_DOWN - | SWT.READ_ONLY); - combobox.setLayoutData(new GridData(SWT.FILL)); - combobox.setEnabled(enabled); - for (final String element : elements) { - combobox.add(element); - } - combobox.select(0); - if (listener != null) { - combobox.addSelectionListener(listener); - } - return combobox; - } - - /** - * Create and return a new text field. - * - * @param parent - * the text field parent. - * @param text - * the text to display on the text field. - * @param enabled - * set if the text field can be edit or not. - * @param selectListener - * the listener when the text field is edited (can be null). - * @return the new text field. - */ - public static Text createTextArea(final Composite parent, - final String text, final boolean enabled, - final ModifyListener modifyListener) { - final Text textArea = new Text(parent, SWT.MULTI | SWT.BORDER - | SWT.WRAP | SWT.V_SCROLL); - textArea.setLayoutData(new GridData(GridData.FILL_BOTH)); - textArea.setEnabled(enabled); - if (text != null) { - textArea.setText(text); - } - if (modifyListener != null) { - textArea.addModifyListener(modifyListener); - } - return textArea; - } - - /** - * @return the labelGridData - */ - public static GridData getLabelGridData() { - final GridData labelGridData = new GridData(SWT.FILL); - labelGridData.widthHint = WIDTH_HINT; - return labelGridData; - } - - /** - * Create and return a new checkbox. - * - * @param parent - * the checkbox parent. - * @param enabled - * set if the checkbox can be checked or not. - * @param selected - * set if the checkbox is initially selected or not. - * @param selectionListener - * the listener when the checkbox is selected (can be null). - * @return the new checkbox. - */ - public static Button createCheckbox(final Composite composite, - final boolean enabled, final boolean selected, - final SelectionListener selectionListener) { - final Button checkbox = new Button(composite, SWT.CHECK); - checkbox.setEnabled(enabled); - checkbox.setSelection(selected); - checkbox.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); - if (selectionListener != null) { - checkbox.addSelectionListener(selectionListener); - } - return checkbox; - } - - /** - * Create and return a new spinner. - * - * @param parent - * the parent of the spinner. - * @param maxValue - * the max value the spinner can reach. - * @param minValue - * the min value the spinner can reach. - * @param increment - * the increment of the spinner. - * @param changeable - * if the spinner is changeable or not. - * @param modifyListener - * the listener when the spinner is changed (can be null). - * @return the new spinner. - * - * @see Spinner - */ - public static Spinner createSpinner(final Composite parent, - final int maxValue, final int minValue, final int increment, - final boolean changeable, final ModifyListener modifyListener) { - final Spinner spinner = new Spinner(parent, SWT.BORDER); - spinner.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); - spinner.setMaximum(maxValue); - spinner.setMinimum(minValue); - spinner.setIncrement(increment); - spinner.setEnabled(changeable); - if (modifyListener != null) { - spinner.addModifyListener(modifyListener); - } - return spinner; - } - -}
diff --git a/org.eclipse.modisco.facet.util.ui/src/org/eclipse/modisco/facet/util/ui/internal/Activator.java b/org.eclipse.modisco.facet.util.ui/src/org/eclipse/modisco/facet/util/ui/internal/Activator.java new file mode 100644 index 0000000..2581ae4 --- /dev/null +++ b/org.eclipse.modisco.facet.util.ui/src/org/eclipse/modisco/facet/util/ui/internal/Activator.java
@@ -0,0 +1,52 @@ +/** + * Copyright (c) 2012 Mia-Software. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Alban Ménager (Soft-Maint) - Bug 387470 - [EFacet][Custom] Editors + */ +package org.eclipse.modisco.facet.util.ui.internal; + +import org.eclipse.core.runtime.Plugin; +import org.osgi.framework.BundleContext; + +@SuppressWarnings("PMD.UseSingleton") +// @SuppressWarnings("PMD.UseSingleton") We cannot conforms to this rule because +// this class is an Eclipse plug-in activator which will be instantiated by the +// Eclipse framework. +public class Activator extends Plugin { + + private static Activator plugin; + + @Override + @SuppressWarnings("PMD.SignatureDeclareThrowsException") + // @SuppressWarnings("PMD.SignatureDeclareThrowsException") We have to use + // this signature because this is an override of an Eclipse framework's + // method. + public void start(final BundleContext bundleContext) throws Exception { + super.start(bundleContext); + Activator.plugin = this; + } + + @Override + @SuppressWarnings({ "PMD.SignatureDeclareThrowsException", + "PMD.NullAssignment" }) + // @SuppressWarnings("PMD.SignatureDeclareThrowsException") We have to use + // this signature because this is an override of an Eclipse framework's + // method. + // @SuppressWarnings("PMD.NullAssignment") + // No choice to right it in another way : this is an Eclipse pattern. + public void stop(final BundleContext bundleContext) throws Exception { + Activator.plugin = null; + super.stop(bundleContext); + } + + public static Plugin getDefault() { + return Activator.plugin; + } + +}
diff --git a/org.eclipse.modisco.facet.util.ui/src/org/eclipse/modisco/facet/util/ui/internal/Messages.java b/org.eclipse.modisco.facet.util.ui/src/org/eclipse/modisco/facet/util/ui/internal/Messages.java new file mode 100644 index 0000000..36b4c2f --- /dev/null +++ b/org.eclipse.modisco.facet.util.ui/src/org/eclipse/modisco/facet/util/ui/internal/Messages.java
@@ -0,0 +1,37 @@ +/******************************************************************************* + * Copyright (c) 2011 Mia-Software. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Nicolas Bros (Mia-Software) - Bug 366367 - To be able to change the "CanBePresentedInTheTable" query + * Alban Ménager (Soft-Maint) - Bug 387470 - [EFacet][Custom] Editors + * Thomas Cicognani (Soft-Maint) - Bug 406565 - Ok Dialog + *******************************************************************************/ +package org.eclipse.modisco.facet.util.ui.internal; + +import org.eclipse.osgi.util.NLS; + +public final class Messages extends NLS { + private static final String BUNDLE_NAME = "org.eclipse.emf.facet.util.ui.internal.messages"; //$NON-NLS-1$ + public static String FilteredElementSelectionControl_type_filter_text; + public static String QuestionDialog_yes; + public static String QuestionDialog_no; + public static String OK; + + public static String item_todo; + public static String Type; + public static String Select; + public static String New; + + public static String Select_Facet; + static { + // initialize resource bundle + NLS.initializeMessages(Messages.BUNDLE_NAME, Messages.class); + } + + private Messages() { + } +}
diff --git a/org.eclipse.modisco.facet.util.ui/src/org/eclipse/modisco/facet/util/ui/internal/dialog/OkDialog.java b/org.eclipse.modisco.facet.util.ui/src/org/eclipse/modisco/facet/util/ui/internal/dialog/OkDialog.java new file mode 100644 index 0000000..c31ebc7 --- /dev/null +++ b/org.eclipse.modisco.facet.util.ui/src/org/eclipse/modisco/facet/util/ui/internal/dialog/OkDialog.java
@@ -0,0 +1,170 @@ +/** + * Copyright (c) Soft-Maint. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Thomas Cicognani (Soft-Maint) - Bug 406565 - Ok Dialog + * Khira Boukhiar (Sodifrance) - Bug 526361 - Focus on the "Ok" button + */ +package org.eclipse.modisco.facet.util.ui.internal.dialog; + +import java.util.ArrayList; +import java.util.List; + +import org.eclipse.modisco.facet.util.ui.internal.Messages; +import org.eclipse.modisco.facet.util.ui.internal.exported.dialog.IDialogCallback; +import org.eclipse.modisco.facet.util.ui.internal.exported.dialog.IOkDialog; +import org.eclipse.swt.SWT; +import org.eclipse.swt.events.SelectionAdapter; +import org.eclipse.swt.events.SelectionEvent; +import org.eclipse.swt.graphics.Point; +import org.eclipse.swt.graphics.Rectangle; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.widgets.Button; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Display; +import org.eclipse.swt.widgets.Label; +import org.eclipse.swt.widgets.Shell; +import org.eclipse.swt.widgets.Text; + +public class OkDialog implements IOkDialog { + private static final int SHELL_WIDTH = 450; + private static final int SHELL_HEIGHT = 170; + private static final int BUTTON_WIDTH_HINT = 80; + private static final int MARGIN_LEFT = 5; + private static final int MARGIN_TOP = 8; + private static final int VERTICAL_SPACING = 10; + private static final int HORIZONT_SPACING = 15; + private static final int BUTTONS_COMP_COL = 3; + + private final List<Runnable> listeners = new ArrayList<Runnable>(); + + private final Shell parentShell; + private final String title; + private final String message; + private final IDialogCallback<Void> callback; + private Shell shell; + private final int kind; + + public OkDialog(final Shell parentShell, final int kind, + final String title, final String message, + final IDialogCallback<Void> iDialogCallback) { + this.parentShell = parentShell; + this.title = title; + this.message = message; + this.callback = iDialogCallback; + this.kind = kind; + createContents(); + } + + private void createContents() { + this.shell = new Shell(this.parentShell, SWT.BORDER | SWT.RESIZE + | SWT.TITLE | SWT.APPLICATION_MODAL); + this.shell.setSize(OkDialog.SHELL_WIDTH, OkDialog.SHELL_HEIGHT); + this.shell.setText(this.title); + final GridLayout shellLayout = new GridLayout(2, false); + + // constants to make checkstyle happy + shellLayout.marginLeft = OkDialog.MARGIN_LEFT; + shellLayout.marginTop = OkDialog.MARGIN_TOP; + shellLayout.verticalSpacing = OkDialog.VERTICAL_SPACING; + shellLayout.horizontalSpacing = OkDialog.HORIZONT_SPACING; + + this.shell.setLayout(shellLayout); + + final Label image = new Label(this.shell, SWT.NONE); + image.setLayoutData(new GridData(SWT.LEFT, SWT.TOP, false, false, 1, 1)); + image.setImage(Display.getDefault().getSystemImage(this.kind)); + + final Text labelMessage = new Text(this.shell, SWT.WRAP | SWT.H_SCROLL + | SWT.V_SCROLL | SWT.READ_ONLY); + labelMessage.setText(this.message); + labelMessage + .setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true)); + + final Composite buttonsComposite = new Composite(this.shell, SWT.NONE); + buttonsComposite.setLayout(new GridLayout(OkDialog.BUTTONS_COMP_COL, + false)); + buttonsComposite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, + false, 2, 1)); + + final Composite paddingComposite = new Composite(buttonsComposite, + SWT.NONE); + final GridData paddCompGridData = new GridData(SWT.FILL, SWT.CENTER, + true, false, 1, 1); + paddCompGridData.heightHint = 0; + paddingComposite.setLayoutData(paddCompGridData); + + final Button btnOk = new Button(buttonsComposite, SWT.NONE); + final GridData button1GridData = new GridData(SWT.LEFT, SWT.BOTTOM, + false, false, 1, 1); + button1GridData.widthHint = OkDialog.BUTTON_WIDTH_HINT; + btnOk.setLayoutData(button1GridData); + btnOk.setText(Messages.OK); + btnOk.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(final SelectionEvent event) { + commit(); + } + }); + btnOk.setFocus(); + } + + public void open() { + this.shell.layout(); + // center the shell on its parent (if not parent shell then it will not + // be centered) + if (this.parentShell != null) { + final Rectangle parentShellBounds = this.parentShell.getBounds(); + final Point shellSize = this.shell.getSize(); + this.shell.setLocation(parentShellBounds.x + + (parentShellBounds.width - shellSize.x) / 2, + parentShellBounds.y + + (parentShellBounds.height - shellSize.y) / 2); + } + this.shell.open(); + } + + public final void commit() { + if (this.shell.isDisposed()) { + throw new UnsupportedOperationException("Dialog is disposed"); //$NON-NLS-1$ + } + this.shell.dispose(); + notifyListeners(); + } + + private void notifyListeners() { + if (this.callback != null) { + this.callback.committed(null); + } + for (final Runnable listener : this.listeners) { + listener.run(); + } + } + + public void addCloseListener(final Runnable paramRunnable) { + this.listeners.add(paramRunnable); + } + + public Shell getShell() { + return this.shell; + } + + public boolean isInformation() { + return this.kind == SWT.ICON_INFORMATION; + } + + public boolean isWarning() { + return this.kind == SWT.ICON_WARNING; + } + + public boolean isError() { + return this.kind == SWT.ICON_ERROR; + } + +}
diff --git a/org.eclipse.modisco.facet.util.ui/src/org/eclipse/modisco/facet/util/ui/internal/dialog/OkDialogFactory.java b/org.eclipse.modisco.facet.util.ui/src/org/eclipse/modisco/facet/util/ui/internal/dialog/OkDialogFactory.java new file mode 100644 index 0000000..fd15ab0 --- /dev/null +++ b/org.eclipse.modisco.facet.util.ui/src/org/eclipse/modisco/facet/util/ui/internal/dialog/OkDialogFactory.java
@@ -0,0 +1,104 @@ +/** + * Copyright (c) Soft-Maint. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Thomas Cicognani (Soft-Maint) - Bug 406565 - Ok Dialog + * Thomas Cicognani (Soft-Maint) - Bug 430545 - OKDialog may throws InvalidThreadAccess + */ +package org.eclipse.modisco.facet.util.ui.internal.dialog; + +import org.eclipse.modisco.facet.util.ui.internal.exported.dialog.IDialogCallback; +import org.eclipse.modisco.facet.util.ui.internal.exported.dialog.IOkDialog; +import org.eclipse.modisco.facet.util.ui.internal.exported.dialog.IOkDialogFactory; +import org.eclipse.modisco.facet.util.ui.internal.sync.generated.SynchronizedOkDialog; +import org.eclipse.swt.SWT; +import org.eclipse.swt.widgets.Display; +import org.eclipse.swt.widgets.Shell; + +public class OkDialogFactory implements IOkDialogFactory { + + private final IDialogCallback<Void> noDialogCallback = new IDialogCallback<Void>() { + public void committed(final Void paramT) { + // Nothing to do + } + }; + + public IOkDialog openDialog(final Shell parentShell, final int kind, + final String title, final String message, + final IDialogCallback<Void> iDialogCallback) { + final OkDialog okDialog = new OkDialog(parentShell, kind, title, + message, iDialogCallback); + Display.getDefault().asyncExec(new Runnable() { + public void run() { + okDialog.open(); + } + }); + return new SynchronizedOkDialog(okDialog, Display.getDefault()); + } + + public IOkDialog openDialog(final Shell parentShell, final int kind, + final String title, final String message) { + return openDialog(parentShell, kind, title, message, + this.noDialogCallback); + } + + public IOkDialog openInformationDialog(final Shell parentShell, + final String title, final String message, + final IDialogCallback<Void> iDialogCallback) { + return openDialog(parentShell, SWT.ICON_INFORMATION, title, message, + iDialogCallback); + } + + public IOkDialog openInformationDialog(final Shell parentShell, + final String title, final String message) { + return openInformationDialog(parentShell, title, message, + this.noDialogCallback); + } + + public IOkDialog openWarningDialog(final Shell parentShell, + final String title, final String message, + final IDialogCallback<Void> iDialogCallback) { + return openDialog(parentShell, SWT.ICON_WARNING, title, message, + iDialogCallback); + } + + public IOkDialog openWarningDialog(final Shell parentShell, + final String title, final String message) { + return openWarningDialog(parentShell, title, message, + this.noDialogCallback); + } + + public IOkDialog openErrorDialog(final Shell parentShell, + final String title, final String message, + final IDialogCallback<Void> iDialogCallback) { + return openDialog(parentShell, SWT.ICON_ERROR, title, message, + iDialogCallback); + } + + public IOkDialog openErrorDialog(final Shell parentShell, + final String title, final String message) { + return openErrorDialog(parentShell, title, message, + this.noDialogCallback); + } + + public IOkDialog openErrorDialog(final Shell parentShell, + final Exception exception, final String message) { + final StringBuffer strBuffer = new StringBuffer(); + strBuffer.append(message); + strBuffer.append("\n\n"); //$NON-NLS-1$ + strBuffer.append(exception.getMessage()); + strBuffer.append("\n\n"); //$NON-NLS-1$ + for (StackTraceElement stkElt : exception.getStackTrace()) { + strBuffer.append(stkElt.toString()); + strBuffer.append('\n'); + } + return openErrorDialog(parentShell, exception.getClass().getName(), + strBuffer.toString(), this.noDialogCallback); + } + +}
diff --git a/org.eclipse.modisco.facet.util.ui/src/org/eclipse/modisco/facet/util/ui/internal/dialog/QuestionDialog.java b/org.eclipse.modisco.facet.util.ui/src/org/eclipse/modisco/facet/util/ui/internal/dialog/QuestionDialog.java new file mode 100644 index 0000000..6810190 --- /dev/null +++ b/org.eclipse.modisco.facet.util.ui/src/org/eclipse/modisco/facet/util/ui/internal/dialog/QuestionDialog.java
@@ -0,0 +1,184 @@ +/******************************************************************************* + * Copyright (c) 2011 CEA LIST. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Nicolas Bros (Mia-Software) - Bug 366367 - To be able to change the "CanBePresentedInTheTable" query + * Gregoire Dupe (Mia-Software) - Bug 373248 - Clean PMD errors + * Gregoire Dupe (Mia-Software) - Bug 374903 - [Table] ITableWidget.setLoadedFacetSets + *******************************************************************************/ +package org.eclipse.modisco.facet.util.ui.internal.dialog; + +import java.util.ArrayList; +import java.util.List; + +import org.eclipse.modisco.facet.util.ui.internal.Messages; +import org.eclipse.modisco.facet.util.ui.internal.exported.dialog.IDialogCallback; +import org.eclipse.modisco.facet.util.ui.internal.exported.dialog.IQuestionDialog; +import org.eclipse.swt.SWT; +import org.eclipse.swt.events.SelectionAdapter; +import org.eclipse.swt.events.SelectionEvent; +import org.eclipse.swt.graphics.Point; +import org.eclipse.swt.graphics.Rectangle; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.widgets.Button; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Display; +import org.eclipse.swt.widgets.Label; +import org.eclipse.swt.widgets.Shell; + +/** + * A yes/no dialog, that replicates the JFace MessageDialog#openQuestion, but is designed to be easily testable with JUnit + * + * @since 0.2 + */ +public class QuestionDialog implements IQuestionDialog { + + private static final int SHELL_WIDTH = 450; + private static final int SHELL_HEIGHT = 170; + + private final Shell parentShell; + private final List<Runnable> listeners = new ArrayList<Runnable>(); + private Boolean result = null; + private Shell shell; + private Button btnYes; + private Button btnNo; + private final String title; + private final String message; + private IDialogCallback<Boolean> callback; + + public QuestionDialog(final Shell parent, final String title, + final String message, final IDialogCallback<Boolean> callback) { + this.parentShell = parent; + this.title = title; + this.message = message; + this.callback = callback; + createContents(); + } + + /** + * Open the dialog. + * + * @return the result + */ + public final void open() { + this.shell.layout(); + // center the shell on its parent (if not parent shell then it will not be centered) + if (this.parentShell != null) { + final Rectangle parentShellBounds = this.parentShell.getBounds(); + final Point shellSize = this.shell.getSize(); + this.shell.setLocation( + parentShellBounds.x + (parentShellBounds.width - shellSize.x) / 2, + parentShellBounds.y + (parentShellBounds.height - shellSize.y) / 2); + } + this.shell.open(); + } + + /** Create the contents of the dialog. */ + private void createContents() { + final int buttonWidthHint = 80; + this.shell = new Shell(this.parentShell, SWT.BORDER | SWT.RESIZE | SWT.TITLE + | SWT.APPLICATION_MODAL); + this.shell.setSize(QuestionDialog.SHELL_WIDTH, + QuestionDialog.SHELL_HEIGHT); + this.shell.setText(this.title); + final GridLayout shellLayout = new GridLayout(2, false); + + // constants to make checkstyle happy + final int marginLeft = 5; + final int marginTop = 8; + final int verticalSpacing = 10; + final int horizontalSpacing = 15; + shellLayout.marginLeft = marginLeft; + shellLayout.marginTop = marginTop; + shellLayout.verticalSpacing = verticalSpacing; + shellLayout.horizontalSpacing = horizontalSpacing; + + this.shell.setLayout(shellLayout); + + final Label image = new Label(this.shell, SWT.NONE); + image.setLayoutData(new GridData(SWT.LEFT, SWT.TOP, false, false, 1, 1)); + image.setImage(Display.getDefault().getSystemImage(SWT.ICON_QUESTION)); + + final Label labelMessage = new Label(this.shell, SWT.WRAP); + labelMessage.setText(this.message); + labelMessage.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true)); + + final Composite buttonsComposite = new Composite(this.shell, SWT.NONE); + final int buttonsCompositeColumns = 3; + buttonsComposite.setLayout(new GridLayout(buttonsCompositeColumns, false)); + buttonsComposite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false, 2, 1)); + + final Composite paddingComposite = new Composite(buttonsComposite, SWT.NONE); + final GridData paddingCompositeGridData = new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1); + paddingCompositeGridData.heightHint = 0; + paddingComposite.setLayoutData(paddingCompositeGridData); + + this.btnYes = new Button(buttonsComposite, SWT.NONE); + final GridData button1GridData = new GridData(SWT.LEFT, SWT.BOTTOM, false, false, 1, 1); + button1GridData.widthHint = buttonWidthHint; + this.btnYes.setLayoutData(button1GridData); + this.btnYes.setText(Messages.QuestionDialog_yes); + this.btnYes.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(final SelectionEvent e) { + pressYes(); + } + }); + + this.btnNo = new Button(buttonsComposite, SWT.NONE); + final GridData button2GridData = new GridData(SWT.LEFT, SWT.BOTTOM, false, false, 1, 1); + button2GridData.widthHint = buttonWidthHint; + this.btnNo.setLayoutData(button2GridData); + this.btnNo.setText(Messages.QuestionDialog_no); + this.btnNo.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(final SelectionEvent e) { + pressNo(); + } + }); + } + + public final void pressYes() { + if (this.shell.isDisposed()) { + throw new UnsupportedOperationException("Dialog is disposed"); //$NON-NLS-1$ + } + this.result = Boolean.TRUE; + this.shell.dispose(); + notifyListeners(); + } + + public final void pressNo() { + if (this.shell.isDisposed()) { + throw new UnsupportedOperationException("Dialog is disposed"); //$NON-NLS-1$ + } + this.result = Boolean.FALSE; + this.shell.dispose(); + notifyListeners(); + } + + private synchronized void notifyListeners() { + if (this.callback != null) { + this.callback.committed(getResult()); + } + for (final Runnable listener : new ArrayList<Runnable>(this.listeners)) { + listener.run(); + } + } + + public synchronized void addCloseListener(final Runnable runnable) { + this.listeners.add(runnable); + } + + public final Boolean getResult() { + return this.result; + } + + public final Shell getShell() { + return this.shell; + } +}
diff --git a/org.eclipse.modisco.facet.util.ui/src/org/eclipse/modisco/facet/util/ui/internal/dialog/QuestionDialogFactory.java b/org.eclipse.modisco.facet.util.ui/src/org/eclipse/modisco/facet/util/ui/internal/dialog/QuestionDialogFactory.java new file mode 100644 index 0000000..6d74e7d --- /dev/null +++ b/org.eclipse.modisco.facet.util.ui/src/org/eclipse/modisco/facet/util/ui/internal/dialog/QuestionDialogFactory.java
@@ -0,0 +1,37 @@ +/******************************************************************************* + * Copyright (c) 2012, 2016 CEA LIST, and Mia-Software. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Nicolas Bros (Mia-Software) - Bug 366367 - To be able to change the "CanBePresentedInTheTable" query + * Gregoire Dupe (Mia-Software) - Bug 374903 - [Table] ITableWidget.setLoadedFacetSets + * Thomas Cicognani (Mia-Software) - Bug 500437 - IQuestionDialogFactory not synchronized + *******************************************************************************/ +package org.eclipse.modisco.facet.util.ui.internal.dialog; + +import org.eclipse.modisco.facet.util.ui.internal.exported.dialog.IDialogCallback; +import org.eclipse.modisco.facet.util.ui.internal.exported.dialog.IQuestionDialog; +import org.eclipse.modisco.facet.util.ui.internal.exported.dialog.IQuestionDialogFactory; +import org.eclipse.modisco.facet.util.ui.internal.sync.generated.SynchronizedQuestionDialog; +import org.eclipse.swt.widgets.Display; +import org.eclipse.swt.widgets.Shell; + +public class QuestionDialogFactory implements IQuestionDialogFactory { + + public IQuestionDialog createQuestionDialog(final Shell parent, final String title, final String message) { + final QuestionDialog questionDialog = new QuestionDialog(parent, title, message, null); + return new SynchronizedQuestionDialog(questionDialog, Display.getDefault()); + } + + public IQuestionDialog createQuestionDialog(final Shell parent, + final String title, final String message, + final IDialogCallback<Boolean> callback) { + final QuestionDialog questionDialog = new QuestionDialog(parent, title, message, callback); + return new SynchronizedQuestionDialog(questionDialog, Display.getDefault()); + } + +} +
diff --git a/org.eclipse.modisco.facet.util.ui/src/org/eclipse/modisco/facet/util/ui/internal/exported/PropertyElement.java b/org.eclipse.modisco.facet.util.ui/src/org/eclipse/modisco/facet/util/ui/internal/exported/PropertyElement.java new file mode 100644 index 0000000..0af7ac1 --- /dev/null +++ b/org.eclipse.modisco.facet.util.ui/src/org/eclipse/modisco/facet/util/ui/internal/exported/PropertyElement.java
@@ -0,0 +1,111 @@ +/** + * Copyright (c) 2012 Mia-Software. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Alban Ménager (Soft-Maint) - Bug 387470 - [EFacet][Custom] Editors + * Grégoire Dupé (Mia-Software) - Bug 387470 - [EFacet][Custom] Editors + */ +package org.eclipse.modisco.facet.util.ui.internal.exported; + +/** + * Generic class representing all the properties like: + * <ol> + * <li>facetName</li> + * <li>upperBound</li> + * <li>unique</li> + * <li>...</li> + * </ol> + * + * @since 1.0 + */ +public class PropertyElement { + + private final String name; + private final Class<?> type; + private boolean changeable; + private Object value; + + /** + * Constructor + * + * @param name + * the name of the property. + * @param type + * the type of the property. + * @param changeable + * if the property can be changed (edited) or not. + */ + public PropertyElement(final String name, final Class<?> type, + final boolean changeable) { + this(name, type, changeable, null); + } + + /** + * Constructor + * + * @param name + * the name of the property. + * @param type + * the type of the property. + * @param changeable + * if the property can be changed (edited) or not. + * @param value + * the initial value of the property. + */ + public PropertyElement(final String name, final Class<?> type, + final boolean changeable, final Object value) { + super(); + this.name = name; + this.type = type; + this.changeable = changeable; + this.value = value; + } + + /** + * @return the name + */ + public String getName() { + return this.name; + } + + /** + * @return the changeable + */ + public boolean isChangeable() { + return this.changeable; + } + + /** + * @return the type + */ + public Class<?> getType() { + return this.type; + } + + /** + * @return the value + */ + public Object getValue() { + return this.value; + } + + /** + * set the value. + */ + public void setValue(final Object value) { + this.value = value; + } + + /** + * @param changeable + * the changeable to set + */ + public void setChangeable(final boolean changeable) { + this.changeable = changeable; + } +}
diff --git a/org.eclipse.modisco.facet.util.ui/src/org/eclipse/modisco/facet/util/ui/internal/exported/PropertyElement2.java b/org.eclipse.modisco.facet.util.ui/src/org/eclipse/modisco/facet/util/ui/internal/exported/PropertyElement2.java new file mode 100644 index 0000000..04a98ca --- /dev/null +++ b/org.eclipse.modisco.facet.util.ui/src/org/eclipse/modisco/facet/util/ui/internal/exported/PropertyElement2.java
@@ -0,0 +1,55 @@ +/** + * Copyright (c) 2012 Mia-Software. + * + * All rights reserved. + * + * Contributors: + * Alban Ménager (Soft-Maint) - Bug 387470 - [EFacet][Custom] Editors + * Grégoire Dupé (Mia-Software) - Integration into ITM-Factory + * Grégoire Dupé (Mia-Software) - Bug 387470 - [EFacet][Custom] Editors + */ +package org.eclipse.modisco.facet.util.ui.internal.exported; + + + +/** + * @since 0.3 + */ +public class PropertyElement2<T extends Object> extends PropertyElement { + + private final boolean canBeNull; + + public PropertyElement2(final boolean changeable) { + super("", Object.class, changeable); //$NON-NLS-1$ + this.canBeNull = false; + } + + public PropertyElement2(final boolean changeable, final T value) { + super("", Object.class, changeable, value); //$NON-NLS-1$ + this.canBeNull = false; + } + + public PropertyElement2(final boolean changeable, final boolean canBeNull) { + super("", Object.class, changeable); //$NON-NLS-1$ + this.canBeNull = canBeNull; + } + + public T getValue2() { + @SuppressWarnings("unchecked") + // @SuppressWarnings("unchecked") This cast is safe because the value + // has to be a instance of T. + // PropertyElement a refactoring of PropertyElement is expected. + final T result = (T) this.getValue(); + return result; // NOPMD by gdupe on 19/10/12 16:59 + // NOPMD to isolate @SuppressWarnings("unchecked") + } + + public void setValue2(final T value) { + this.setValue(value); + } + + public boolean isCanBeNull() { + return this.canBeNull; + } + +}
diff --git a/org.eclipse.modisco.facet.util.ui/src/org/eclipse/modisco/facet/util/ui/internal/exported/WidgetProperties.java b/org.eclipse.modisco.facet.util.ui/src/org/eclipse/modisco/facet/util/ui/internal/exported/WidgetProperties.java new file mode 100644 index 0000000..5089a09 --- /dev/null +++ b/org.eclipse.modisco.facet.util.ui/src/org/eclipse/modisco/facet/util/ui/internal/exported/WidgetProperties.java
@@ -0,0 +1,67 @@ +/** + * Copyright (c) 2012 Mia-Software. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Alban Ménager (Soft-Maint) - Bug 387470 - [EFacet][Custom] Editors + * Grégoire Dupé (Mia-Software) - Bug 387470 - [EFacet][Custom] Editors + */ +package org.eclipse.modisco.facet.util.ui.internal.exported; + +import java.util.HashMap; +import java.util.Map; + +import org.eclipse.emf.ecore.ETypedElement; + +/** + * This class contain all the possible properties for the facets creations. + * + * @since 0.3 + */ +public class WidgetProperties<T extends Object> { + + // TODO This class must not be exposed. + + private final Map<T, PropertyElement> properties; + + public WidgetProperties() { + this.properties = new HashMap<T, PropertyElement>(); + } + + /** + * Add a new property in the map. + * + * @param element + * the key, the {@link ETypedElement} of the property. + * @param property + * the property. + */ + public void addProperty(final T element, + final PropertyElement property) { + getProperties().put(element, property); + } + + /** + * Get the list of properties. + * + * @return a map of the properties. + */ + private Map<T, PropertyElement> getProperties() { + return this.properties; + } + + /** + * Return the {@link PropertyElement} for the given element. + * + * @param element + * the element. + * @return the property. + */ + public PropertyElement getProperty(final T element) { + return getProperties().get(element); + } +}
diff --git a/org.eclipse.modisco.facet.util.ui/src/org/eclipse/modisco/facet/util/ui/internal/exported/composite/IFilteredElementSelectionComposite.java b/org.eclipse.modisco.facet.util.ui/src/org/eclipse/modisco/facet/util/ui/internal/exported/composite/IFilteredElementSelectionComposite.java new file mode 100644 index 0000000..ab21ccf --- /dev/null +++ b/org.eclipse.modisco.facet.util.ui/src/org/eclipse/modisco/facet/util/ui/internal/exported/composite/IFilteredElementSelectionComposite.java
@@ -0,0 +1,34 @@ +/** + * Copyright (c) 2012 Mia-Software. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Alban Ménager (Soft-Maint) - Bug 387470 - [EFacet][Custom] Editors + */ +package org.eclipse.modisco.facet.util.ui.internal.exported.composite; + +import org.eclipse.swt.widgets.Text; +import org.eclipse.ui.dialogs.FilteredList; + +/** + * @since 0.3 + * @noextend This interface is not intended to be extended by clients. + * @noimplement This interface is not intended to be implemented by clients. + */ +public interface IFilteredElementSelectionComposite { + + void setElements(final Object[] elements); + + Object getFirstSelectedElement(); + + Object[] getSelectedElements(); + + FilteredList getFilteredList(); + + Text getFilterText(); + +} \ No newline at end of file
diff --git a/org.eclipse.modisco.facet.util.ui/src/org/eclipse/modisco/facet/util/ui/internal/exported/dialog/IDialog.java b/org.eclipse.modisco.facet.util.ui/src/org/eclipse/modisco/facet/util/ui/internal/exported/dialog/IDialog.java new file mode 100644 index 0000000..5f8c859 --- /dev/null +++ b/org.eclipse.modisco.facet.util.ui/src/org/eclipse/modisco/facet/util/ui/internal/exported/dialog/IDialog.java
@@ -0,0 +1,51 @@ +/** + * Copyright (c) 2012 Mia-Software. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Alban Ménager (Soft-Maint) - Bug 387470 - [EFacet][Custom] Editors + * Grégoire Dupé (Mia-Software) - Bug 387470 - [EFacet][Custom] Editors + */ +package org.eclipse.modisco.facet.util.ui.internal.exported.dialog; + +import org.eclipse.modisco.facet.util.ui.internal.exported.util.dialog.AbstractDialog; + +/** + * @see AbstractDialog + * @since 0.3 + * @noextend This interface is not intended to be extended by clients. + * @noimplement This interface is not intended to be implemented by clients. + */ +public interface IDialog<W extends Object> { + + /** + * Press the "Ok" button. + */ + void commit(); + + /** + * Press the "Cancel" button. + */ + void cancel(); + + /** + * Open the dialog. This method is used for to open the dialog into the + * thread UI. So, this method has no to be called into the constructor. + * + * @return the result of the dialog (OK or CANCEL). + */ + int open(); + + /** + * Return if the dialog is valid or not. + * + * @return true if all the necessaries properties are set. + */ + boolean isDialogValid(); + + W getWidget(); +} \ No newline at end of file
diff --git a/org.eclipse.modisco.facet.util.ui/src/org/eclipse/modisco/facet/util/ui/internal/exported/dialog/IDialogCallback.java b/org.eclipse.modisco.facet.util.ui/src/org/eclipse/modisco/facet/util/ui/internal/exported/dialog/IDialogCallback.java new file mode 100644 index 0000000..f523943 --- /dev/null +++ b/org.eclipse.modisco.facet.util.ui/src/org/eclipse/modisco/facet/util/ui/internal/exported/dialog/IDialogCallback.java
@@ -0,0 +1,28 @@ +/******************************************************************************* + * Copyright (c) 2012 CEA LIST. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Gregoire Dupe (Mia-Software) - Initial API + * Nicolas Bros (Mia-Software) - Bug 372865 - FacetSet selection dialog + *******************************************************************************/ +package org.eclipse.modisco.facet.util.ui.internal.exported.dialog; + +/** + * A callback used to return a dialog's result asynchronously. + * + * @param <T> + * the type of the result + */ +public interface IDialogCallback<T> { + /** + * The user committed their selection in the dialog. + * + * @param result + * the result + */ + void committed(T result); +}
diff --git a/org.eclipse.modisco.facet.util.ui/src/org/eclipse/modisco/facet/util/ui/internal/exported/dialog/IDialogCallbackWithPreCommit.java b/org.eclipse.modisco.facet.util.ui/src/org/eclipse/modisco/facet/util/ui/internal/exported/dialog/IDialogCallbackWithPreCommit.java new file mode 100644 index 0000000..6a21af5 --- /dev/null +++ b/org.eclipse.modisco.facet.util.ui/src/org/eclipse/modisco/facet/util/ui/internal/exported/dialog/IDialogCallbackWithPreCommit.java
@@ -0,0 +1,59 @@ +/******************************************************************************* + * Copyright (c) 2012 CEA LIST. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Gregoire Dupe (Mia-Software) - Initial API + * Nicolas Bros (Mia-Software) - Bug 372865 - FacetSet selection dialog + *******************************************************************************/ +package org.eclipse.modisco.facet.util.ui.internal.exported.dialog; + +/** + * A callback used to return a dialog's result asynchronously. This interface makes it possible to open a second + * "pre-commit" dialog when the user commits their selection in the first dialog. This second dialog is given the + * opportunity to open before the first dialog closes. This can be useful to ask the user for confirmation for example. + * <p> + * The second dialog should either: + * <ul> + * <li>call {@link IDialogCallback#committed(Object) committed} on the callback passed to + * {@link IDialogCallbackWithPreCommit#openPrecommitDialog(Object, IDialogCallback) openPrecommitDialog} with the + * definitive result + * <li>do nothing if the pre-commit dialog was canceled + * </ul> + * + * @param <T1> + * the type of the result for the first dialog + * @param <T2> + * the type of the result for the pre-commit dialog + * @param <D> + * the type of the pre-commit dialog + */ +public interface IDialogCallbackWithPreCommit<T1, T2, D> { + /** + * The user confirmed their choice in the pre-commit dialog. + * + * @param result + * the result of the first dialog + * @param precommitResult + * the result of the pre-commit dialog + */ + void committed(T1 result, T2 precommitResult); + + /** + * The user committed their selection in the first dialog. This method is called to let you open a second + * "pre-commit" dialog, that can prompt the user for confirmation. + * + * @param result + * the result from the first dialog + * @param precommitCallback + * you must call {@link IDialogCallback#committed(Object) committed} on this callback if the user + * confirms their choice in the second (pre-commit) dialog, and pass the result of the pre-commit dialog. + * Or do nothing if the user chose to cancel. If you return <code>null</code> from this method, you + * mustn't call {@link IDialogCallback#committed(Object)} or the commit will be done twice + * @return the pre-commit dialog (for unit tests), or <code>null</code> if no pre-commit callback is needed + */ + D openPrecommitDialog(T1 result, IDialogCallback<T2> precommitCallback); +}
diff --git a/org.eclipse.modisco.facet.util.ui/src/org/eclipse/modisco/facet/util/ui/internal/exported/dialog/IDialogWithoutResultCallback.java b/org.eclipse.modisco.facet.util.ui/src/org/eclipse/modisco/facet/util/ui/internal/exported/dialog/IDialogWithoutResultCallback.java new file mode 100644 index 0000000..b18be51 --- /dev/null +++ b/org.eclipse.modisco.facet.util.ui/src/org/eclipse/modisco/facet/util/ui/internal/exported/dialog/IDialogWithoutResultCallback.java
@@ -0,0 +1,33 @@ +/** + * Copyright (c) 2012 Mia-Software. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Alban Ménager (Soft-Maint) - Bug 387470 - [EFacet][Custom] Editors + */ +package org.eclipse.modisco.facet.util.ui.internal.exported.dialog; + + +/** + * A callback used to return a dialog's result asynchronously. + * + * @since 0.3 + * @noextend This interface is not intended to be extended by clients. + * @noimplement This interface is not intended to be implemented by clients. + */ +public interface IDialogWithoutResultCallback { + + /** + * The user commit his action. + */ + void commited(); + + /** + * The user cancel his action. + */ + void canceled(); +}
diff --git a/org.eclipse.modisco.facet.util.ui/src/org/eclipse/modisco/facet/util/ui/internal/exported/dialog/IOkDialog.java b/org.eclipse.modisco.facet.util.ui/src/org/eclipse/modisco/facet/util/ui/internal/exported/dialog/IOkDialog.java new file mode 100644 index 0000000..e6d636d --- /dev/null +++ b/org.eclipse.modisco.facet.util.ui/src/org/eclipse/modisco/facet/util/ui/internal/exported/dialog/IOkDialog.java
@@ -0,0 +1,32 @@ +/** + * Copyright (c) Soft-Maint. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Thomas Cicognani (Soft-Maint) - Bug 406565 - Ok Dialog + */ +package org.eclipse.modisco.facet.util.ui.internal.exported.dialog; + + +/** + * + * @author tcicognani + * @noextend This interface is not intended to be extended by clients. + * @noimplement This interface is not intended to be implemented by clients. + * @since 0.4 + */ +public interface IOkDialog { + + void commit(); + + boolean isInformation(); + + boolean isWarning(); + + boolean isError(); + +}
diff --git a/org.eclipse.modisco.facet.util.ui/src/org/eclipse/modisco/facet/util/ui/internal/exported/dialog/IOkDialogFactory.java b/org.eclipse.modisco.facet.util.ui/src/org/eclipse/modisco/facet/util/ui/internal/exported/dialog/IOkDialogFactory.java new file mode 100644 index 0000000..87ed4d3 --- /dev/null +++ b/org.eclipse.modisco.facet.util.ui/src/org/eclipse/modisco/facet/util/ui/internal/exported/dialog/IOkDialogFactory.java
@@ -0,0 +1,56 @@ +/** + * Copyright (c) Soft-Maint. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Thomas Cicognani (Soft-Maint) - Bug 406565 - Ok Dialog + * Thomas Cicognani (Soft-Maint) - Bug 430545 - OKDialog may throws InvalidThreadAccess + */ +package org.eclipse.modisco.facet.util.ui.internal.exported.dialog; + +import org.eclipse.modisco.facet.util.ui.internal.dialog.OkDialogFactory; +import org.eclipse.modisco.facet.util.ui.internal.sync.generated.SynchronizedOkDialogFactory; +import org.eclipse.swt.widgets.Display; +import org.eclipse.swt.widgets.Shell; + +/** + * + * @author tcicognani + * + * @noextend This interface is not intended to be extended by clients. + * @noimplement This interface is not intended to be implemented by clients. + * @since 0.4 + */ +public interface IOkDialogFactory { + IOkDialogFactory DEFAULT = new SynchronizedOkDialogFactory( + new OkDialogFactory(), Display.getDefault()); + + IOkDialog openDialog(Shell parentShell, int kind, String title, + String message, IDialogCallback<Void> iDialogCallback); + + IOkDialog openDialog(Shell parentShell, int kind, String title, + String message); + + IOkDialog openInformationDialog(Shell parentShell, String title, + String message, IDialogCallback<Void> iDialogCallback); + + IOkDialog openInformationDialog(Shell parentShell, String title, + String message); + + IOkDialog openWarningDialog(Shell parentShell, String title, + String message, IDialogCallback<Void> iDialogCallback); + + IOkDialog openWarningDialog(Shell parentShell, String title, String message); + + IOkDialog openErrorDialog(Shell parentShell, String title, String message, + IDialogCallback<Void> iDialogCallback); + + IOkDialog openErrorDialog(Shell parentShell, String title, String message); + + IOkDialog openErrorDialog(Shell parentShell, Exception exception, + String message); +}
diff --git a/org.eclipse.modisco.facet.util.ui/src/org/eclipse/modisco/facet/util/ui/internal/exported/dialog/IQuestionDialog.java b/org.eclipse.modisco.facet.util.ui/src/org/eclipse/modisco/facet/util/ui/internal/exported/dialog/IQuestionDialog.java new file mode 100644 index 0000000..c528108 --- /dev/null +++ b/org.eclipse.modisco.facet.util.ui/src/org/eclipse/modisco/facet/util/ui/internal/exported/dialog/IQuestionDialog.java
@@ -0,0 +1,43 @@ +/******************************************************************************* + * Copyright (c) 2012 CEA LIST. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Nicolas Bros (Mia-Software) - Bug 366367 - To be able to change the "CanBePresentedInTheTable" query + *******************************************************************************/ +package org.eclipse.modisco.facet.util.ui.internal.exported.dialog; + +import org.eclipse.swt.widgets.Shell; + +/** A simple dialog with a title, a message, and "yes" and "no" buttons */ +public interface IQuestionDialog { + + /** Opens the dialog */ + void open(); + + /** Programmatically emulate a press on the "Yes" button */ + void pressYes(); + + /** Programmatically emulate a press on the "No" button */ + void pressNo(); + + /** Add a listener that will be modified when the dialog closes */ + void addCloseListener(final Runnable runnable); + + /** + * Get the user's answer + * + * @return <ul> + * <li><code>true</code> if the user clicked "Yes" + * <li><code>false</code> if the user clicked "No" + * <li><code>null</code> if the user closed the dialog without clicking either on "Yes" or "No" + * </ul> + */ + Boolean getResult(); + + /** @return the dialog's shell */ + Shell getShell(); +}
diff --git a/org.eclipse.modisco.facet.util.ui/src/org/eclipse/modisco/facet/util/ui/internal/exported/dialog/IQuestionDialogFactory.java b/org.eclipse.modisco.facet.util.ui/src/org/eclipse/modisco/facet/util/ui/internal/exported/dialog/IQuestionDialogFactory.java new file mode 100644 index 0000000..6758d68 --- /dev/null +++ b/org.eclipse.modisco.facet.util.ui/src/org/eclipse/modisco/facet/util/ui/internal/exported/dialog/IQuestionDialogFactory.java
@@ -0,0 +1,53 @@ +/******************************************************************************* + * Copyright (c) 2012, 2016 CEA LIST, and Mia-Software. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Nicolas Bros (Mia-Software) - Bug 366367 - To be able to change the "CanBePresentedInTheTable" query + * Gregoire Dupe (Mia-Software) - Bug 374903 - [Table] ITableWidget.setLoadedFacetSets + * Thomas Cicognani (Mia-Software) - Bug 500437 - IQuestionDialogFactory not synchronized + *******************************************************************************/ +package org.eclipse.modisco.facet.util.ui.internal.exported.dialog; + +import org.eclipse.modisco.facet.util.ui.internal.dialog.QuestionDialogFactory; +import org.eclipse.modisco.facet.util.ui.internal.sync.generated.SynchronizedQuestionDialogFactory; +import org.eclipse.swt.widgets.Display; +import org.eclipse.swt.widgets.Shell; + +/** A factory to instantiate {@link IQuestionDialog} */ +public interface IQuestionDialogFactory { + IQuestionDialogFactory INSTANCE = new SynchronizedQuestionDialogFactory(new QuestionDialogFactory(), + Display.getDefault()); + + /** + * Instantiates a question dialog (without opening it) + * + * @param parent + * the parent shell for the new dialog + * @param title + * the text that appears in the title of the dialog + * @param message + * the text that appears in the message area of the dialog + * @return the dialog, ready to be {@link IQuestionDialog#open() opened} + */ + @Deprecated + IQuestionDialog createQuestionDialog(Shell parent, String title, String message); + + /** + * Instantiates a question dialog (without opening it) + * + * @param parent + * the parent shell for the new dialog + * @param title + * the text that appears in the title of the dialog + * @param message + * the text that appears in the message area of the dialog + * @return the dialog, ready to be {@link IQuestionDialog#open() opened} + * @since 0.2 + */ + IQuestionDialog createQuestionDialog(Shell parent, String title, + String message, IDialogCallback<Boolean> callback); +}
diff --git a/org.eclipse.modisco.facet.util.ui/src/org/eclipse/modisco/facet/util/ui/internal/exported/dialog/IWithResultDialogCallback.java b/org.eclipse.modisco.facet.util.ui/src/org/eclipse/modisco/facet/util/ui/internal/exported/dialog/IWithResultDialogCallback.java new file mode 100644 index 0000000..d216e2c --- /dev/null +++ b/org.eclipse.modisco.facet.util.ui/src/org/eclipse/modisco/facet/util/ui/internal/exported/dialog/IWithResultDialogCallback.java
@@ -0,0 +1,34 @@ +/** + * Copyright (c) 2012 Mia-Software. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Alban Ménager (Soft-Maint) - Bug 387470 - [EFacet][Custom] Editors + * Grégoire Dupé (Mia-Software) - Bug 387470 - [EFacet][Custom] Editors + * Grégoire Dupé (Mia-Software) - Bug 406570 - Handlers to Save and SaveAs EMF resources + */ +package org.eclipse.modisco.facet.util.ui.internal.exported.dialog; + + +/** + * A callback used to return a dialog's result asynchronously. + * + * @since 0.3 + * @noextend This interface is not intended to be extended by clients. + */ +public interface IWithResultDialogCallback<T> { + + /** + * The user commit his action. + */ + void commited(T result); + + /** + * The user cancel his action. + */ + void canceled(T result); +}
diff --git a/org.eclipse.modisco.facet.util.ui/src/org/eclipse/modisco/facet/util/ui/internal/exported/displaysync/AbstractExceptionFreeRunnable.java b/org.eclipse.modisco.facet.util.ui/src/org/eclipse/modisco/facet/util/ui/internal/exported/displaysync/AbstractExceptionFreeRunnable.java new file mode 100644 index 0000000..c9097c9 --- /dev/null +++ b/org.eclipse.modisco.facet.util.ui/src/org/eclipse/modisco/facet/util/ui/internal/exported/displaysync/AbstractExceptionFreeRunnable.java
@@ -0,0 +1,20 @@ +/******************************************************************************* + * Copyright (c) 2011 Mia-Software. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Gr�goire Dup� (Mia-Software) - Bug 365808 - [Unit Test Failure][0.2/4.2][0.2/3.8] org.eclipse.emf.facet.widgets.nattable.tests.NatTableAPITests + * Gr�goire Dup� (Mia-Software) - Bug 367153 - synchronization utilities + *******************************************************************************/ +package org.eclipse.modisco.facet.util.ui.internal.exported.displaysync; + +public abstract class AbstractExceptionFreeRunnable<T> implements IRunnable<T, Exception> { + public abstract T safeRun(); + + public T run() throws Exception { + return this.safeRun(); + } +}
diff --git a/org.eclipse.modisco.facet.util.ui/src/org/eclipse/modisco/facet/util/ui/internal/exported/displaysync/AbstractVoidExceptionFreeRunnable.java b/org.eclipse.modisco.facet.util.ui/src/org/eclipse/modisco/facet/util/ui/internal/exported/displaysync/AbstractVoidExceptionFreeRunnable.java new file mode 100644 index 0000000..a04508e --- /dev/null +++ b/org.eclipse.modisco.facet.util.ui/src/org/eclipse/modisco/facet/util/ui/internal/exported/displaysync/AbstractVoidExceptionFreeRunnable.java
@@ -0,0 +1,22 @@ +/******************************************************************************* + * Copyright (c) 2011 Mia-Software. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Gr�goire Dup� (Mia-Software) - Bug 365808 - [Unit Test Failure][0.2/4.2][0.2/3.8] org.eclipse.emf.facet.widgets.nattable.tests.NatTableAPITests + * Gr�goire Dup� (Mia-Software) - Bug 367153 - synchronization utilities + *******************************************************************************/ +package org.eclipse.modisco.facet.util.ui.internal.exported.displaysync; + +public abstract class AbstractVoidExceptionFreeRunnable implements + IRunnable<Object, Exception> { + public abstract void voidSafeRun(); + + public Object run() throws Exception { + voidSafeRun(); + return null; + } +}
diff --git a/org.eclipse.modisco.facet.util.ui/src/org/eclipse/modisco/facet/util/ui/internal/exported/displaysync/AbstractVoidRunnable.java b/org.eclipse.modisco.facet.util.ui/src/org/eclipse/modisco/facet/util/ui/internal/exported/displaysync/AbstractVoidRunnable.java new file mode 100644 index 0000000..c2471b3 --- /dev/null +++ b/org.eclipse.modisco.facet.util.ui/src/org/eclipse/modisco/facet/util/ui/internal/exported/displaysync/AbstractVoidRunnable.java
@@ -0,0 +1,22 @@ +/******************************************************************************* + * Copyright (c) 2011 Mia-Software. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Gr�goire Dup� (Mia-Software) - Bug 365808 - [Unit Test Failure][0.2/4.2][0.2/3.8] org.eclipse.emf.facet.widgets.nattable.tests.NatTableAPITests + * Gr�goire Dup� (Mia-Software) - Bug 367153 - synchronization utilities + *******************************************************************************/ +package org.eclipse.modisco.facet.util.ui.internal.exported.displaysync; + +public abstract class AbstractVoidRunnable<E extends Exception> implements + IRunnable<Object, E> { + public abstract void voidRun() throws E; + + public Object run() throws E { + this.voidRun(); + return null; + } +}
diff --git a/org.eclipse.modisco.facet.util.ui/src/org/eclipse/modisco/facet/util/ui/internal/exported/displaysync/DisplaySyncRuntimeException.java b/org.eclipse.modisco.facet.util.ui/src/org/eclipse/modisco/facet/util/ui/internal/exported/displaysync/DisplaySyncRuntimeException.java new file mode 100644 index 0000000..27a0d40 --- /dev/null +++ b/org.eclipse.modisco.facet.util.ui/src/org/eclipse/modisco/facet/util/ui/internal/exported/displaysync/DisplaySyncRuntimeException.java
@@ -0,0 +1,34 @@ +/******************************************************************************* + * Copyright (c) 2011 Mia-Software. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Gr�goire Dup� (Mia-Software) - Bug 365808 - [Unit Test Failure][0.2/4.2][0.2/3.8] org.eclipse.emf.facet.widgets.nattable.tests.NatTableAPITests + * Gr�goire Dup� (Mia-Software) - Bug 367153 - synchronization utilities + *******************************************************************************/ +package org.eclipse.modisco.facet.util.ui.internal.exported.displaysync; + +class DisplaySyncRuntimeException extends RuntimeException { + + private static final long serialVersionUID = -4424355632936609905L; + + public DisplaySyncRuntimeException() { + super(); + } + + public DisplaySyncRuntimeException(final String message) { + super(message); + } + + public DisplaySyncRuntimeException(final Throwable cause) { + super(cause); + } + + public DisplaySyncRuntimeException(final String message, final Throwable cause) { + super(message, cause); + } + +}
diff --git a/org.eclipse.modisco.facet.util.ui/src/org/eclipse/modisco/facet/util/ui/internal/exported/displaysync/IRunnable.java b/org.eclipse.modisco.facet.util.ui/src/org/eclipse/modisco/facet/util/ui/internal/exported/displaysync/IRunnable.java new file mode 100644 index 0000000..07dba85 --- /dev/null +++ b/org.eclipse.modisco.facet.util.ui/src/org/eclipse/modisco/facet/util/ui/internal/exported/displaysync/IRunnable.java
@@ -0,0 +1,16 @@ +/******************************************************************************* + * Copyright (c) 2011 Mia-Software. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Gr�goire Dup� (Mia-Software) - Bug 365808 - [Unit Test Failure][0.2/4.2][0.2/3.8] org.eclipse.emf.facet.widgets.nattable.tests.NatTableAPITests + * Gr�goire Dup� (Mia-Software) - Bug 367153 - synchronization utilities + *******************************************************************************/ +package org.eclipse.modisco.facet.util.ui.internal.exported.displaysync; + +public interface IRunnable<T extends Object, E extends Exception> { + T run() throws E; +}
diff --git a/org.eclipse.modisco.facet.util.ui/src/org/eclipse/modisco/facet/util/ui/internal/exported/displaysync/SynchronizedComposite.java b/org.eclipse.modisco.facet.util.ui/src/org/eclipse/modisco/facet/util/ui/internal/exported/displaysync/SynchronizedComposite.java new file mode 100644 index 0000000..70e9b53 --- /dev/null +++ b/org.eclipse.modisco.facet.util.ui/src/org/eclipse/modisco/facet/util/ui/internal/exported/displaysync/SynchronizedComposite.java
@@ -0,0 +1,38 @@ +/******************************************************************************* + * Copyright (c) 2011-2012 Mia-Software. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Grégoire Dupé (Mia-Software) - Bug 365808 - [Unit Test Failure][0.2/4.2][0.2/3.8] org.eclipse.emf.facet.widgets.nattable.tests.NatTableAPITests + * Grégoire Dupé (Mia-Software) - Bug 367153 - synchronization utilities + * Nicolas Bros (Mia-Software) - Bug 370442 - rewrite the Facet loading dialog for v0.2 + * Gregoire Dupe (Mia-Software) - Bug 369987 - [Restructuring][Table] Switch to the new customization and facet framework + *******************************************************************************/ +package org.eclipse.modisco.facet.util.ui.internal.exported.displaysync; + +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Display; + +/** + * <ul> + * <li>syncExecWithResult (has return type, throws exception) + * <li>safeSyncExec (has return type, no exception) + * <li>voidSyncExec (no return type, throws exception) + * <li>voidExceptionFreeRunnable (no return type, no exception) + * </ul> + */ +public class SynchronizedComposite<C extends Composite> extends SynchronizedObject<C> { + + public SynchronizedComposite(final C composite) { + super(composite, composite.getDisplay()); + } + + @Deprecated + protected C getSynchronizedComposite() { + return getSynchronizedObject(); + } + +}
diff --git a/org.eclipse.modisco.facet.util.ui/src/org/eclipse/modisco/facet/util/ui/internal/exported/displaysync/SynchronizedObject.java b/org.eclipse.modisco.facet.util.ui/src/org/eclipse/modisco/facet/util/ui/internal/exported/displaysync/SynchronizedObject.java new file mode 100644 index 0000000..cbd56c4 --- /dev/null +++ b/org.eclipse.modisco.facet.util.ui/src/org/eclipse/modisco/facet/util/ui/internal/exported/displaysync/SynchronizedObject.java
@@ -0,0 +1,115 @@ +/******************************************************************************* + * Copyright (c) 2011 Mia-Software. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Grégoire Dupé (Mia-Software) - Bug 365808 - [Unit Test Failure][0.2/4.2][0.2/3.8] org.eclipse.emf.facet.widgets.nattable.tests.NatTableAPITests + * Grégoire Dupé (Mia-Software) - Bug 367153 - synchronization utilities + * Gregoire Dupe (Mia-Software) - Bug 369987 - [Restructuring][Table] Switch to the new customization and facet framework + * Grégoire Dupé (Mia-Software) - Bug 387470 - [EFacet][Custom] Editors + *******************************************************************************/ +package org.eclipse.modisco.facet.util.ui.internal.exported.displaysync; + +import org.eclipse.swt.widgets.Display; + +/** + * <ul> + * <li>syncExecWithResult (has return type, throws exception) + * <li>safeSyncExec (has return type, no exception) + * <li>voidSyncExec (no return type, throws exception) + * <li>voidExceptionFreeRunnable (no return type, no exception) + * </ul> + */ +public class SynchronizedObject<O extends Object> { + + private final O object; + private final Thread widgetThread; + private final Display display; + + public SynchronizedObject(final O object, final Display display) { + this.object = object; + this.display = display; + this.widgetThread = this.display.getThread(); + } + + protected final <T, E extends Exception> T syncExecWithResult( + final IRunnable<T, E> runnable) throws E { + T result; + if (this.widgetThread == Thread.currentThread()) { + result = runnable.run(); + } else { + final ExceptionHandler exceptionHandler = new ExceptionHandler(); + final Object[] resultHandler = new Object[1]; + this.display.syncExec(new java.lang.Runnable() { + public void run() { + try { + resultHandler[0] = runnable.run(); + } catch (final Exception e) { + exceptionHandler.setException(e); + } + + } + }); + if (exceptionHandler.getException() != null) { + @SuppressWarnings("unchecked") + // @SuppressWarnings("unchecked") This cast is safe because + // "exceptionHandler" contains an exception thrown by "runnable" + // and + // "runnable" throws by definition a instance of E + final E castException = (E) exceptionHandler.getException(); + throw castException; + } + @SuppressWarnings("unchecked") + // @SuppressWarnings("unchecked") This cast is safe because + // "resultHandler" contains a value returned by "runnable" and + // "runnable" returns by definition a instance of T + final T tmpResult = (T) resultHandler[0]; + result = tmpResult; + } + return result; + } + + protected class ExceptionHandler { + + private Exception exception; + + public Exception getException() { + return this.exception; + } + + public void setException(final Exception exception) { + this.exception = exception; + } + } + + protected final <E extends Exception> void voidSyncExec( + final AbstractVoidRunnable<E> runnable) throws E { + this.syncExecWithResult(runnable); + } + + protected final <T> T safeSyncExec( + final AbstractExceptionFreeRunnable<T> runnable) { + try { + return this.syncExecWithResult(runnable); + } catch (final Exception e) { + throw new DisplaySyncRuntimeException(e); + } + } + + protected final void voidExceptionFreeRunnable( + final AbstractVoidExceptionFreeRunnable runnable) { + try { + this.syncExecWithResult(runnable); + } catch (final Exception e) { + throw new DisplaySyncRuntimeException(e); + } + } + + public O getSynchronizedObject() { + return this.object; + } + +}
diff --git a/org.eclipse.modisco.facet.util.ui/src/org/eclipse/modisco/facet/util/ui/internal/exported/handler/HandlerUtils.java b/org.eclipse.modisco.facet.util.ui/src/org/eclipse/modisco/facet/util/ui/internal/exported/handler/HandlerUtils.java new file mode 100644 index 0000000..a3eb083 --- /dev/null +++ b/org.eclipse.modisco.facet.util.ui/src/org/eclipse/modisco/facet/util/ui/internal/exported/handler/HandlerUtils.java
@@ -0,0 +1,153 @@ +/** + * Copyright (c) 2011, 2015 Mia-Software, and Soft-Maint. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Alban Ménager (Soft-Maint) - Bug 387470 - [EFacet][Custom] Editors + * Grégoire Dupé (Soft-Maint) - Bug 387470 - [EFacet][Custom] Editors + * Grégoire Dupé (Mia-Software) - Bug 423181 - Unchecked cast in HandlerUtils.getStructuredSelection() + * Thomas Cicognani (Soft-Maint) - Bug 438994 - Optimization of selection in TableWidget + * Jonathan Pepin (Soft-Maint) - Bug 479754 - NullPointer on HandlerUtils.getStructuredSelection() on close Eclipse + */ +package org.eclipse.modisco.facet.util.ui.internal.exported.handler; + +import org.eclipse.jface.viewers.ISelection; +import org.eclipse.jface.viewers.IStructuredSelection; +import org.eclipse.modisco.facet.util.core.DebugUtils; +import org.eclipse.modisco.facet.util.ui.internal.Activator; +import org.eclipse.swt.widgets.Display; +import org.eclipse.swt.widgets.Shell; +import org.eclipse.ui.IWorkbench; +import org.eclipse.ui.IWorkbenchPage; +import org.eclipse.ui.IWorkbenchPart; +import org.eclipse.ui.IWorkbenchPartSite; +import org.eclipse.ui.IWorkbenchWindow; +import org.eclipse.ui.PlatformUI; + +/** + * Util class for Handlers. + * + * @since 0.3 + */ +public final class HandlerUtils { + + private static final boolean DEBUG = DebugUtils.getDebugStatus(Activator.getDefault()); + + private HandlerUtils() { + // Hidden constructor. + } + + /** + * @since 1.0 + */ + public static IWorkbenchWindow getWorkbenchWindow() { + final IWorkbenchWindow[] result = new IWorkbenchWindow[1]; + final Runnable runnable = new Runnable() { + public void run() { + final IWorkbench workbench = PlatformUI.getWorkbench(); + DebugUtils.debug(HandlerUtils.DEBUG, + "PlatformUI.getWorkbench()==" + workbench); //$NON-NLS-1$ + if (workbench != null) { + final IWorkbenchWindow[] workbenchWindows = workbench + .getWorkbenchWindows(); + DebugUtils + .debug(HandlerUtils.DEBUG, + "PlatformUI.getWorkbench().getWorkbenchWindows().length==" //$NON-NLS-1$ + + workbenchWindows.length); + if ((workbenchWindows.length > 0) + && (workbenchWindows[0].getSelectionService() != null)) { + result[0] = workbenchWindows[0]; + } + } + } + }; + if (Thread.currentThread() == Display.getDefault().getThread()) { + runnable.run(); + } else { + Display.getDefault().syncExec(runnable); + } + return result[0]; + } + + /** + * Return the tree selection of the user's selection. + * + * @return the current tree selection. + */ + public static IStructuredSelection getStructuredSelection() { + IStructuredSelection result = null; + final IWorkbenchWindow workbenchWindow = getWorkbenchWindow(); + if (workbenchWindow != null) { + final ISelection selection = workbenchWindow.getSelectionService() + .getSelection(); + if (selection instanceof IStructuredSelection) { + result = (IStructuredSelection) selection; + } + } + return result; + } + + /** + * Return the current selection. + * + * @return the current selection. + */ + public static Object getSelection() { + Object result = null; + // on a facet model, the selection is obviously a TreeSelection + final IStructuredSelection structSelection = getStructuredSelection(); + if (structSelection != null) { + result = structSelection.getFirstElement(); + } + return result; + } + + /** + * Return the active workbench window. + * + * @return the active workbench window. + */ + public static Shell getWorkbenchWindowShell() { + final IWorkbenchWindow iWorkbenchWindow = PlatformUI.getWorkbench() + .getWorkbenchWindows()[0]; + final IWorkbenchPage iWorkbenchPage = iWorkbenchWindow.getPages()[0]; + final IWorkbenchPart activePart = iWorkbenchPage.getActivePart(); + final IWorkbenchPartSite site = activePart.getSite(); + + return site.getShell(); + } + + /** + * @return The active page + * @since 1.0 + */ + public static IWorkbenchPage getActivePage() { + IWorkbenchPage activePage = null; + final IWorkbench workbench = PlatformUI.getWorkbench(); + if (workbench != null) { + final IWorkbenchWindow window = workbench + .getActiveWorkbenchWindow(); + if (window != null) { + activePage = window.getActivePage(); + } + } + return activePage; + } + + /** + * @return The active part + * @since 1.0 + */ + public static IWorkbenchPart getActivePart() { + IWorkbenchPart activePart = null; + final IWorkbenchPage activePage = getActivePage(); + if (activePage != null) { + activePart = activePage.getActivePart(); + } + return activePart; + } +}
diff --git a/org.eclipse.modisco.facet.util.ui/src/org/eclipse/modisco/facet/util/ui/internal/exported/tree/menu/ITreeMenu.java b/org.eclipse.modisco.facet.util.ui/src/org/eclipse/modisco/facet/util/ui/internal/exported/tree/menu/ITreeMenu.java new file mode 100644 index 0000000..3e39dce --- /dev/null +++ b/org.eclipse.modisco.facet.util.ui/src/org/eclipse/modisco/facet/util/ui/internal/exported/tree/menu/ITreeMenu.java
@@ -0,0 +1,44 @@ +/** + * Copyright (c) 2012 Mia-Software. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Alban Ménager (Soft-Maint) - Bug 387470 - [EFacet][Custom] Editors + */ +package org.eclipse.modisco.facet.util.ui.internal.exported.tree.menu; + +import java.util.List; + +import org.eclipse.modisco.facet.util.ui.internal.exported.util.tree.item.AbstractTreeItem; +import org.eclipse.modisco.facet.util.ui.internal.exported.util.tree.menu.AbstractTreeMenuItem; +import org.eclipse.modisco.facet.util.ui.internal.exported.util.tree.menu.ExtendedTreeMenu; + +/** + * @see ExtendedTreeMenu + * @since 0.3 + * @noextend This interface is not intended to be extended by clients. + * @noimplement This interface is not intended to be implemented by clients. + */ +public interface ITreeMenu<T extends Object> { + + /** + * Select a menu item in the tree menu. + * + * @param menuItemType + * @return an instance of T. + */ + T selectMenuItem(Class<? extends AbstractTreeMenuItem<T>> menuItemType); + + /** + * Select all the items of the tree with the name <code>treeItemName</code> + * + * @param treeItemName + * the name of the item to select. + * @return the list of all the tree item with the name in parameter. + */ + List<AbstractTreeItem<T>> getTreeItems(String treeItemName); +} \ No newline at end of file
diff --git a/org.eclipse.modisco.facet.util.ui/src/org/eclipse/modisco/facet/util/ui/internal/exported/util/composite/FilteredElementSelectionComposite.java b/org.eclipse.modisco.facet.util.ui/src/org/eclipse/modisco/facet/util/ui/internal/exported/util/composite/FilteredElementSelectionComposite.java new file mode 100644 index 0000000..db19899 --- /dev/null +++ b/org.eclipse.modisco.facet.util.ui/src/org/eclipse/modisco/facet/util/ui/internal/exported/util/composite/FilteredElementSelectionComposite.java
@@ -0,0 +1,174 @@ +/******************************************************************************* + * Copyright (c) 2010, 2011, 2012 Mia-Software. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Nicolas Bros (Mia-Software) - initial API and implementation + * Alban Ménager (Soft-Maint) - Bug 387470 - [EFacet][Custom] Editors + *******************************************************************************/ +package org.eclipse.modisco.facet.util.ui.internal.exported.util.composite; + +import org.eclipse.jface.viewers.LabelProvider; +import org.eclipse.modisco.facet.util.ui.internal.Messages; +import org.eclipse.modisco.facet.util.ui.internal.exported.composite.IFilteredElementSelectionComposite; +import org.eclipse.swt.SWT; +import org.eclipse.swt.events.KeyEvent; +import org.eclipse.swt.events.KeyListener; +import org.eclipse.swt.events.ModifyEvent; +import org.eclipse.swt.events.ModifyListener; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Text; +import org.eclipse.ui.dialogs.FilteredList; + +/** + * A control for selecting an element from a list of elements, that can be + * filtered using the associated text field. + * + * @since 0.3 + */ +public class FilteredElementSelectionComposite extends Composite implements + IFilteredElementSelectionComposite { + + private final Text filterText; + private final FilteredList fFilteredList; + private String matchPrefix; + + public FilteredElementSelectionComposite(final Composite parent, + final boolean matchAnywhere, final boolean multiSelection) { + super(parent, SWT.BORDER); + setLayout(new GridLayout()); + + this.filterText = createFilterText(this); + this.fFilteredList = createFilteredList(this, multiSelection); + + this.filterText.addModifyListener(new ModifyListener() { + public void modifyText(final ModifyEvent event) { + getfFilteredList().setFilter( + getMatchPrefix(matchAnywhere) + + getFilterText().getText()); + } + }); + + this.filterText.addKeyListener(new KeyListener() { + public void keyPressed(final KeyEvent event) { + if (event.keyCode == SWT.ARROW_DOWN) { + getfFilteredList().setFocus(); + } + } + + public void keyReleased(final KeyEvent event) { + // nothing + } + }); + } + + protected String getMatchPrefix(final boolean matchAnywhere) { + if (matchAnywhere) { + this.matchPrefix = "*"; //$NON-NLS-1$ + } else { + this.matchPrefix = ""; //$NON-NLS-1$ + } + return this.matchPrefix; + } + + /* + * (non-Javadoc) + * + * @see org.eclipse.emf.facet.util.ui.internal.exported.util.composite. + * IFilteredElementSelectionComposite#setElements(java.lang.Object[]) + */ + public void setElements(final Object[] elements) { + this.fFilteredList.setElements(elements); + } + + protected static FilteredList createFilteredList(final Composite parent, + final boolean multiSelection) { + int multi; + if (multiSelection) { + multi = SWT.MULTI; + } else { + multi = SWT.SINGLE; + } + final FilteredList filteredList = new FilteredList(parent, SWT.BORDER + | SWT.V_SCROLL | SWT.H_SCROLL | multi, new LabelProvider(), + true, false, true); + final GridData data = new GridData(); + data.grabExcessVerticalSpace = true; + data.grabExcessHorizontalSpace = true; + data.horizontalAlignment = GridData.FILL; + data.verticalAlignment = GridData.FILL; + filteredList.setLayoutData(data); + filteredList.setFilter(""); //$NON-NLS-1$ + return filteredList; + } + + protected static Text createFilterText(final Composite parent) { + final Text text = new Text(parent, SWT.BORDER); + text.setMessage(Messages.FilteredElementSelectionControl_type_filter_text); + final GridData data = new GridData(); + data.grabExcessVerticalSpace = false; + data.grabExcessHorizontalSpace = true; + data.horizontalAlignment = GridData.FILL; + data.verticalAlignment = GridData.BEGINNING; + text.setLayoutData(data); + return text; + } + + /* + * (non-Javadoc) + * + * @see org.eclipse.emf.facet.util.ui.internal.exported.util.composite. + * IFilteredElementSelectionComposite#getFirstSelectedElement() + */ + public Object getFirstSelectedElement() { + Object result = null; + final Object[] selection = this.fFilteredList.getSelection(); + if (selection.length > 0) { + result = selection[0]; + } + return result; + } + + /* + * (non-Javadoc) + * + * @see org.eclipse.emf.facet.util.ui.internal.exported.util.composite. + * IFilteredElementSelectionComposite#getSelectedElements() + */ + public Object[] getSelectedElements() { + Object[] result = null; + if (this.fFilteredList.getSelection().length > 0) { + result = this.fFilteredList.getSelection(); + } + return result; + } + + /* + * (non-Javadoc) + * + * @see org.eclipse.emf.facet.util.ui.internal.exported.util.composite. + * IFilteredElementSelectionComposite#getFilteredList() + */ + public FilteredList getFilteredList() { + return this.fFilteredList; + } + + /* + * (non-Javadoc) + * + * @see org.eclipse.emf.facet.util.ui.internal.exported.util.composite. + * IFilteredElementSelectionComposite#getFilterText() + */ + public Text getFilterText() { + return this.filterText; + } + + protected FilteredList getfFilteredList() { + return this.fFilteredList; + } +}
diff --git a/org.eclipse.modisco.facet.util.ui/src/org/eclipse/modisco/facet/util/ui/internal/exported/util/composite/SynchronizedFilteredElementSelectionComposite.java b/org.eclipse.modisco.facet.util.ui/src/org/eclipse/modisco/facet/util/ui/internal/exported/util/composite/SynchronizedFilteredElementSelectionComposite.java new file mode 100644 index 0000000..05db026 --- /dev/null +++ b/org.eclipse.modisco.facet.util.ui/src/org/eclipse/modisco/facet/util/ui/internal/exported/util/composite/SynchronizedFilteredElementSelectionComposite.java
@@ -0,0 +1,89 @@ +/** + * Copyright (c) 2012 Mia-Software. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Alban Ménager (Soft-Maint) - Bug 387470 - [EFacet][Custom] Editors + */ +package org.eclipse.modisco.facet.util.ui.internal.exported.util.composite; + +import org.eclipse.modisco.facet.util.ui.internal.exported.composite.IFilteredElementSelectionComposite; +import org.eclipse.modisco.facet.util.ui.internal.exported.displaysync.AbstractExceptionFreeRunnable; +import org.eclipse.modisco.facet.util.ui.internal.exported.displaysync.AbstractVoidExceptionFreeRunnable; +import org.eclipse.modisco.facet.util.ui.internal.exported.displaysync.SynchronizedObject; +import org.eclipse.swt.widgets.Display; +import org.eclipse.swt.widgets.Text; +import org.eclipse.ui.dialogs.FilteredList; + +/** + * @since 0.3 + */ +public class SynchronizedFilteredElementSelectionComposite<T extends IFilteredElementSelectionComposite> + extends SynchronizedObject<T> implements + IFilteredElementSelectionComposite { + + /** + * @param object + * @param display + */ + public SynchronizedFilteredElementSelectionComposite(final T object, + final Display display) { + super(object, display); + } + + public void setElements(final Object[] elements) { + this.voidExceptionFreeRunnable(new AbstractVoidExceptionFreeRunnable() { + @Override + public void voidSafeRun() { + SynchronizedFilteredElementSelectionComposite.this + .getSynchronizedObject().setElements(elements); + } + }); + } + + public Object getFirstSelectedElement() { + return this.safeSyncExec(new AbstractExceptionFreeRunnable<Object>() { + @Override + public Object safeRun() { + return SynchronizedFilteredElementSelectionComposite.this + .getSynchronizedObject().getFirstSelectedElement(); + } + }); + } + + public Object[] getSelectedElements() { + return this.safeSyncExec(new AbstractExceptionFreeRunnable<Object[]>() { + @Override + public Object[] safeRun() { + return SynchronizedFilteredElementSelectionComposite.this + .getSynchronizedObject().getSelectedElements(); + } + }); + } + + public FilteredList getFilteredList() { + return this + .safeSyncExec(new AbstractExceptionFreeRunnable<FilteredList>() { + @Override + public FilteredList safeRun() { + return SynchronizedFilteredElementSelectionComposite.this + .getSynchronizedObject().getFilteredList(); + } + }); + } + + public Text getFilterText() { + return this.safeSyncExec(new AbstractExceptionFreeRunnable<Text>() { + @Override + public Text safeRun() { + return SynchronizedFilteredElementSelectionComposite.this + .getSynchronizedObject().getFilterText(); + } + }); + } + +}
diff --git a/org.eclipse.modisco.facet.util.ui/src/org/eclipse/modisco/facet/util/ui/internal/exported/util/dialog/AbstractDialog.java b/org.eclipse.modisco.facet.util.ui/src/org/eclipse/modisco/facet/util/ui/internal/exported/util/dialog/AbstractDialog.java new file mode 100644 index 0000000..254fe52 --- /dev/null +++ b/org.eclipse.modisco.facet.util.ui/src/org/eclipse/modisco/facet/util/ui/internal/exported/util/dialog/AbstractDialog.java
@@ -0,0 +1,169 @@ +/** + * Copyright (c) 2012 Mia-Software. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Alban Ménager (Soft-Maint) - Bug 387470 - [EFacet][Custom] Editors + * Grégoire Dupé (Mia-Software) - Bug 387470 - [EFacet][Custom] Editors + */ +package org.eclipse.modisco.facet.util.ui.internal.exported.util.dialog; + +import org.eclipse.core.commands.Command; +import org.eclipse.jface.dialogs.TitleAreaDialog; +import org.eclipse.modisco.facet.util.ui.internal.exported.WidgetProperties; +import org.eclipse.modisco.facet.util.ui.internal.exported.dialog.IDialog; +import org.eclipse.modisco.facet.util.ui.internal.exported.util.widget.command.ICommandWidget; +import org.eclipse.swt.graphics.Rectangle; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Control; +import org.eclipse.swt.widgets.Display; +import org.eclipse.swt.widgets.Monitor; +import org.eclipse.swt.widgets.Shell; + +/** + * Abstract class representing a dialog. Some methods are implemented to avoid + * unnecessary duplication code. + * + * @param <CB> + * The type of the callback. + * @param <P> + * The type of the key of the {@link WidgetProperties} + * @since 0.3 + */ +public abstract class AbstractDialog<CB extends Object, W extends ICommandWidget> + extends TitleAreaDialog implements IDialog<W> { + + // Attributes. + private W widget; + private Composite dialogComposite; + private CB callback; + + /** + * Constructor. + * + * @param callback + * the callback + * @param properties + * the properties that the widget needs + */ + protected AbstractDialog(final CB callback) { + this(); + this.callback = callback; + } + + /** + * Constructor. + */ + protected AbstractDialog() { + super(createDisplayedShell()); + } + + private static Shell createDisplayedShell() { + final Display display = Display.getDefault(); + final Shell shell = new Shell(display); + final Monitor primary = display.getPrimaryMonitor(); + final Rectangle bounds = primary.getBounds(); + final Rectangle rect = shell.getBounds(); + final int xLocation = bounds.x + ((bounds.width - rect.width) / 2); + final int yLocation = bounds.y + ((bounds.height - rect.height) / 2); + shell.setLocation(xLocation, yLocation); + return shell; + } + + /** + * Execute the widget {@link Command}. + */ + protected abstract void execute(); + + /** + * Check if all the required attributes are setted ({@link #isDialogValid()} + * and call the method {@link #execute()} to get and execute the widget + * command. If the dialog is not valid, this method display the errors with + * the method {@link #setErrorMessage(String)}. + */ + @Override + protected void okPressed() { + if (isDialogValid()) { + getWidget().onDialogValidation(); + execute(); + super.okPressed(); + } else { + setErrorMessage(getWidget().getError()); + } + } + + /** + * Set the title and the message dialog. Create the associated widget and + * all sub widgets of this widget. + */ + @Override + protected Control createDialogArea(final Composite parent) { + setTitle(getDialogTitle()); + setMessage(getDialogMessage()); + // Composite is a subtype of Control. + this.dialogComposite = (Composite) super.createDialogArea(parent); + this.widget = createWidget(); + this.widget.createWidgetContent(); + return this.widget.adapt(Control.class); + } + + public Composite getDialogComposite() { + return this.dialogComposite; + } + + /** + * Create the associated widget to the dialog. + * + * @return an instance of the widget. + */ + protected abstract W createWidget(); + + /** + * Return the message at the top of the dialog. + * + * @return the message. + */ + protected abstract String getDialogMessage(); + + /** + * Return the title of the dialog. + * + * @return the title. + */ + protected abstract String getDialogTitle(); + + + public boolean isDialogValid() { + boolean result = true; + final String error = getWidget().getError(); + if (error != null) { + result = false; + } + + return result; + } + + public W getWidget() { + return this.widget; + } + + public void commit() { + okPressed(); + } + + public void cancel() { + cancelPressed(); + } + + /** + * @return the callback + */ + public CB getCallback() { + return this.callback; + } + +}
diff --git a/org.eclipse.modisco.facet.util.ui/src/org/eclipse/modisco/facet/util/ui/internal/exported/util/dialog/AbstractDialogWithCallback.java b/org.eclipse.modisco.facet.util.ui/src/org/eclipse/modisco/facet/util/ui/internal/exported/util/dialog/AbstractDialogWithCallback.java new file mode 100644 index 0000000..e9c027f --- /dev/null +++ b/org.eclipse.modisco.facet.util.ui/src/org/eclipse/modisco/facet/util/ui/internal/exported/util/dialog/AbstractDialogWithCallback.java
@@ -0,0 +1,58 @@ +/** + * Copyright (c) 2012 Mia-Software. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Alban Ménager (Soft-Maint) - Bug 387470 - [EFacet][Custom] Editors + * Grégoire Dupé (Mia-Software) - Bug 387470 - [EFacet][Custom] Editors + */ +package org.eclipse.modisco.facet.util.ui.internal.exported.util.dialog; + +import org.eclipse.modisco.facet.util.ui.internal.exported.dialog.IDialogWithoutResultCallback; +import org.eclipse.modisco.facet.util.ui.internal.exported.dialog.IWithResultDialogCallback; +import org.eclipse.modisco.facet.util.ui.internal.exported.util.widget.command.ICommandWidget; + +/** + * Abstract dialog with an {@link IDialogWithoutResultCallback} in parameter. + * + * @since 0.3 + */ +public abstract class AbstractDialogWithCallback<T extends Object, W extends ICommandWidget> + extends AbstractDialog<IWithResultDialogCallback<T>, W> { + + /** + * Constructor. + * + * @param editingDomain + * the current editing domain + * @param properties + * the properties that the widget needs + */ + protected AbstractDialogWithCallback( + final IWithResultDialogCallback<T> callback) { + super(callback); + } + + @Override + protected void okPressed() { + if (isDialogValid() && (getCallback() != null)) { + getCallback().commited(getResult()); + } + super.okPressed(); + } + + protected abstract T getResult(); + + @Override + protected void cancelPressed() { + if (getCallback() != null) { + getCallback().canceled(getResult()); + } + super.cancelPressed(); + } + +}
diff --git a/org.eclipse.modisco.facet.util.ui/src/org/eclipse/modisco/facet/util/ui/internal/exported/util/dialog/AbstractMainDialog.java b/org.eclipse.modisco.facet.util.ui/src/org/eclipse/modisco/facet/util/ui/internal/exported/util/dialog/AbstractMainDialog.java new file mode 100644 index 0000000..0590488 --- /dev/null +++ b/org.eclipse.modisco.facet.util.ui/src/org/eclipse/modisco/facet/util/ui/internal/exported/util/dialog/AbstractMainDialog.java
@@ -0,0 +1,62 @@ +/** + * Copyright (c) 2012 Mia-Software. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Alban Ménager (Soft-Maint) - Bug 387470 - [EFacet][Custom] Editors + * Grégoire Dupé (Mia-Software) - Bug 387470 - [EFacet][Custom] Editors + */ +package org.eclipse.modisco.facet.util.ui.internal.exported.util.dialog; + +import org.eclipse.modisco.facet.util.ui.internal.exported.WidgetProperties; +import org.eclipse.modisco.facet.util.ui.internal.exported.util.widget.AbstractWidget; +import org.eclipse.modisco.facet.util.ui.internal.exported.util.widget.command.AbstractCommandWidget; +import org.eclipse.modisco.facet.util.ui.internal.exported.util.widget.command.ICommandWidget; + +/** + * This abstract class will create a dialog. All the action's dialog must + * extends this class. It provides a simple way to create a standard dialog for + * this ui.</p> + * + * A single {@link AbstractCommandWidget} is created by the dialog wich will + * contain all the subwidgets {@link AbstractWidget}. + * + * The dialog have to create all the properties {@link WidgetProperties} that + * the widgets {@link AbstractCommandWidget} will need. + * + * @see AbstractCommandWidget + * @see AbstractWidget + * @see AbstractAddElementDialog + * @since 0.3 + */ +public abstract class AbstractMainDialog<W extends ICommandWidget> + extends AbstractDialog<Object, W> { + + private final Object selection; + + /** + * Constructor. + * + * @param callback + * the callback. + * @param editedElement + * the selection in the model (ecore file). + */ + protected AbstractMainDialog(final Object editedElement) { + super(); + this.selection = editedElement; + } + + /** + * @return the selection in the model. + */ + protected Object getSelection() { + return this.selection; + } + + +}
diff --git a/org.eclipse.modisco.facet.util.ui/src/org/eclipse/modisco/facet/util/ui/internal/exported/util/dialog/SynchronizedAbstractDialog.java b/org.eclipse.modisco.facet.util.ui/src/org/eclipse/modisco/facet/util/ui/internal/exported/util/dialog/SynchronizedAbstractDialog.java new file mode 100644 index 0000000..e1fb451 --- /dev/null +++ b/org.eclipse.modisco.facet.util.ui/src/org/eclipse/modisco/facet/util/ui/internal/exported/util/dialog/SynchronizedAbstractDialog.java
@@ -0,0 +1,94 @@ +/** + * Copyright (c) 2012 Mia-Software. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Alban Ménager (Soft-Maint) - Bug 387470 - [EFacet][Custom] Editors + * Grégoire Dupé (Mia-Software) - Bug 387470 - [EFacet][Custom] Editors + */ +package org.eclipse.modisco.facet.util.ui.internal.exported.util.dialog; + +import org.eclipse.modisco.facet.util.ui.internal.exported.dialog.IDialog; +import org.eclipse.modisco.facet.util.ui.internal.exported.displaysync.AbstractExceptionFreeRunnable; +import org.eclipse.modisco.facet.util.ui.internal.exported.displaysync.AbstractVoidExceptionFreeRunnable; +import org.eclipse.modisco.facet.util.ui.internal.exported.displaysync.SynchronizedObject; +import org.eclipse.swt.widgets.Display; + +/** + * Synchronized class for safe run. + * + * @see AbstractDialog + * @since 0.3 + * + */ +public class SynchronizedAbstractDialog<W extends Object> extends + SynchronizedObject<IDialog<W>> implements IDialog<W> { + + /** + * Constructor. + * + * @param object + * the to synchronized. + * @param display + * the display. + */ + public SynchronizedAbstractDialog(final IDialog<W> object, + final Display display) { + super(object, display); + } + + public void commit() { + this.voidExceptionFreeRunnable(new AbstractVoidExceptionFreeRunnable() { + @Override + public void voidSafeRun() { + SynchronizedAbstractDialog.this.getSynchronizedObject() + .commit(); + } + }); + } + + public void cancel() { + this.voidExceptionFreeRunnable(new AbstractVoidExceptionFreeRunnable() { + @Override + public void voidSafeRun() { + SynchronizedAbstractDialog.this.getSynchronizedObject() + .cancel(); + } + }); + } + + public int open() { + return this.safeSyncExec(new AbstractExceptionFreeRunnable<Integer>() { + @Override + public Integer safeRun() { + return Integer.valueOf(SynchronizedAbstractDialog.this + .getSynchronizedObject().open()); + } + }).intValue(); + } + + public boolean isDialogValid() { + return this.safeSyncExec(new AbstractExceptionFreeRunnable<Boolean>() { + @Override + public Boolean safeRun() { + return Boolean.valueOf(SynchronizedAbstractDialog.this + .getSynchronizedObject().isDialogValid()); + } + }).booleanValue(); + } + + public W getWidget() { + return this.safeSyncExec(new AbstractExceptionFreeRunnable<W>() { + @Override + public W safeRun() { + return SynchronizedAbstractDialog.this.getSynchronizedObject() + .getWidget(); + } + }); + } + +}
diff --git a/org.eclipse.modisco.facet.util.ui/src/org/eclipse/modisco/facet/util/ui/internal/exported/util/handler/AbstractSelectionExpectedTypeHandler.java b/org.eclipse.modisco.facet.util.ui/src/org/eclipse/modisco/facet/util/ui/internal/exported/util/handler/AbstractSelectionExpectedTypeHandler.java new file mode 100644 index 0000000..c5fb641 --- /dev/null +++ b/org.eclipse.modisco.facet.util.ui/src/org/eclipse/modisco/facet/util/ui/internal/exported/util/handler/AbstractSelectionExpectedTypeHandler.java
@@ -0,0 +1,51 @@ +/** + * Copyright (c) 2012 Mia-Software. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Alban Ménager (Soft-Maint) - Bug 387470 - [EFacet][Custom] Editors + * Grégoire Dupé (Soft-Maint) - Bug 387470 - [EFacet][Custom] Editors + */ +package org.eclipse.modisco.facet.util.ui.internal.exported.util.handler; + +import org.eclipse.core.commands.AbstractHandler; +import org.eclipse.modisco.facet.util.ui.internal.exported.handler.HandlerUtils; + +/** + * Abstract handler. All handlers must extends this class. + * + * @see IFunctionDialogFactory + * + * @see CreateFacetInFacetSetHandler + * @see CreateFacetSetInFacetSetHandler + * @see AddAttributeInFacetHandler + * @see AddOperationInFacetHandler + * @see AddReferenceInFacetHandler + * @see AddParameterInOperationHandler + * @since 0.3 + */ +public abstract class AbstractSelectionExpectedTypeHandler extends AbstractHandler { + + @Override + public boolean isEnabled() { + boolean result = false; + if ((HandlerUtils.getStructuredSelection() != null && HandlerUtils + .getStructuredSelection().size() == 1) + && getSelectionExpectedType().isInstance( + HandlerUtils.getSelection())) { + result = true; + } + return result; + } + + /** + * Return the expected type of the selection. + * + * @return the type expected. + */ + protected abstract Class<?> getSelectionExpectedType(); +}
diff --git a/org.eclipse.modisco.facet.util.ui/src/org/eclipse/modisco/facet/util/ui/internal/exported/util/tree/ExtendedTree.java b/org.eclipse.modisco.facet.util.ui/src/org/eclipse/modisco/facet/util/ui/internal/exported/util/tree/ExtendedTree.java new file mode 100644 index 0000000..c2610be --- /dev/null +++ b/org.eclipse.modisco.facet.util.ui/src/org/eclipse/modisco/facet/util/ui/internal/exported/util/tree/ExtendedTree.java
@@ -0,0 +1,174 @@ +/** + * Copyright (c) 2012 Mia-Software. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Alban Ménager (Soft-Maint) - Bug 387470 - [EFacet][Custom] Editors + */ +package org.eclipse.modisco.facet.util.ui.internal.exported.util.tree; + +import java.util.List; +import java.util.Map; + +import org.eclipse.modisco.facet.util.ui.internal.exported.dialog.IDialog; +import org.eclipse.modisco.facet.util.ui.internal.exported.util.tree.item.AbstractTreeItem; +import org.eclipse.modisco.facet.util.ui.internal.exported.util.tree.menu.AbstractTreeMenu; +import org.eclipse.modisco.facet.util.ui.internal.exported.util.tree.menu.ExtendedTreeMenu; +import org.eclipse.swt.SWT; +import org.eclipse.swt.events.KeyEvent; +import org.eclipse.swt.events.KeyListener; +import org.eclipse.swt.events.MouseEvent; +import org.eclipse.swt.events.MouseListener; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Listener; +import org.eclipse.swt.widgets.Tree; + +/** + * This class provides the creation of a {@link Tree} but with extended + * elements.</p> + * + * This tree creates its menu {@link ExtendedTreeMenu} and had the list of all the items + * of the tree accessible with the method {@link #getTreeItems()}. + * + * </p> Only one element of the tree can be selected at the same time. + * + * @since 0.3 + */ +public class ExtendedTree { + + private static final int TREE_HEIGHT = 250; + private final Tree tree; + private final ExtendedTreeMenu<IDialog> treeMenu; + private Listener listener; + + /** + * Constructor. + * + * Create a new instance of a {@link Tree} and create the {@link ExtendedTreeMenu} + * with the <code>menuItems</code> in parameter. + * + * @param parent + * the parent of the TreeExtended. + * @param menuItems + * the items of the menu. + * + * @see ExtendedTreeMenu + * @see AbstractTreeMenu + */ + public ExtendedTree(final Composite parent, + final List<AbstractTreeMenu<IDialog>> menuItems) { + + // SWT.SINGLE -> a unique selection on the tree possible + this.tree = new Tree(parent, SWT.SINGLE | SWT.NONE); + final GridData gridData = new GridData(GridData.FILL_HORIZONTAL); + gridData.heightHint = TREE_HEIGHT; + this.tree.setLayoutData(gridData); + this.tree.addMouseListener(new MouseListener() { + + public void mouseUp(final MouseEvent mouseEvent) { + // Nothing. + } + + public void mouseDown(final MouseEvent mouseEvent) { + // Nothing. + } + + public void mouseDoubleClick(final MouseEvent mouseEvent) { + onMouseDoubleClick(); + } + }); + this.tree.addKeyListener(new KeyListener() { + + public void keyReleased(final KeyEvent event) { + // Nothing. + } + + public void keyPressed(final KeyEvent event) { + onKeyPressed(event); + } + }); + this.treeMenu = new ExtendedTreeMenu<IDialog>(parent, this, menuItems); + this.getTreeMenu().createMenu(); + this.tree.setMenu(this.getTreeMenu().getMenu()); + } + + /** + * This method is called when a key is pressed on the tree. + */ + protected void onKeyPressed(final KeyEvent event) { + if (event.keyCode == SWT.DEL) { + this.getTreeMenu().removeCurrentItemSelected(); + } + } + + /** + * When the mouse does a double click on an element of the tree. + */ + protected void onMouseDoubleClick() { + if (getTree().getSelection().length > 0) { + // new Tree(parent, SWT.SINGLE | SWT.NONE) -> the tree can only had + // one selection at the same time. + this.getTreeMenu().onMouseSelection(); + } + } + + /** + * @return the {@link Tree} created by this class. + */ + public Tree getTree() { + return this.tree; + } + + /** + * Add a {@link ModificationListener} to the list of listeners of the tree. + * + * @param listener + */ + public void setListener(final Listener listener) { + this.listener = listener; + } + + /** + * When a modification appends, this method has to be called and the method + * {@link #notifyChanged()} is called for the listener of this Tree. + */ + public void fireChanged() { + this.listener.handleEvent(null); + } + + /** + * @return a map of properties to pass to the {@link AbstractTreeItem}. Each + * items add to override the method + * {@link AbstractTreeItem#getExtraProperties(Map)} to get this + * properties. + */ + public void putExtraPropertiesToItems(final Map<String, Object> properties) { + this.getTreeMenu().putExtraProperties(properties); + } + + /** + * Return the first {@link AbstractTreeItem} of the tree. + * + * @return the first item of the tree. + */ + public AbstractTreeItem<IDialog> getFirstTreeItem() { + AbstractTreeItem<IDialog> result = null; + if (this.tree.getItemCount() > 0) { + result = this.getTreeMenu().getTreeItemExtended(this.tree.getItem(0)); + } + return result; + } + + /** + * @return the treeMenu of this tree. + */ + public ExtendedTreeMenu<IDialog> getTreeMenu() { + return this.treeMenu; + } + +}
diff --git a/org.eclipse.modisco.facet.util.ui/src/org/eclipse/modisco/facet/util/ui/internal/exported/util/tree/item/AbstractTreeItem.java b/org.eclipse.modisco.facet.util.ui/src/org/eclipse/modisco/facet/util/ui/internal/exported/util/tree/item/AbstractTreeItem.java new file mode 100644 index 0000000..4123818 --- /dev/null +++ b/org.eclipse.modisco.facet.util.ui/src/org/eclipse/modisco/facet/util/ui/internal/exported/util/tree/item/AbstractTreeItem.java
@@ -0,0 +1,210 @@ +/** + * Copyright (c) 2012 Mia-Software. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Alban Ménager (Soft-Maint) - Bug 387470 - [EFacet][Custom] Editors + */ +package org.eclipse.modisco.facet.util.ui.internal.exported.util.tree.item; + +import java.util.Map; + +import org.eclipse.modisco.facet.util.ui.internal.Messages; +import org.eclipse.modisco.facet.util.ui.internal.exported.dialog.IDialog; +import org.eclipse.modisco.facet.util.ui.internal.exported.util.tree.ExtendedTree; +import org.eclipse.modisco.facet.util.ui.internal.exported.util.tree.menu.AbstractTreeMenuItem; +import org.eclipse.swt.SWT; +import org.eclipse.swt.widgets.Tree; +import org.eclipse.swt.widgets.TreeItem; + +/** + * This abstract class represent an item of the tree. All the item types of the + * tree must extend this abstract class. + * + * @since 0.3 + */ +public abstract class AbstractTreeItem<T extends Object> { + + private AbstractTreeMenuItem<T> menuItem; + private TreeItem treeItem; + private Map<String, Object> extraProperties; + + /** + * Create a new item {@link TreeItem} into the parent. + * + * @param parent + * the parent of the item to create. + */ + public TreeItem createItem(final AbstractTreeMenuItem<T> itemMenu, + final Tree parent) { + this.menuItem = itemMenu; + final TreeItem item = new TreeItem(parent, SWT.NONE); + initialize(item); + return item; + } + + /** + * Create a new item {@link TreeItem} into the parent. + * + * @param parent + * the parent of the item to create. + */ + public TreeItem createItem(final AbstractTreeMenuItem<T> itemMenu, + final TreeItem parent) { + this.menuItem = itemMenu; + final TreeItem item = new TreeItem(parent, SWT.NONE); + // Open the parent of the item on the tree. + parent.setExpanded(true); + initialize(item); + return item; + } + + /** + * Initialize the tree item with the text and call the method + * {@link #onItemCreation()} if the user wants an extra action. + */ + private void initialize(final TreeItem item) { + item.setChecked(true); + if ((getItemText() == null) || "".equals(getItemText())) { //$NON-NLS-1$ + item.setText(getDefaultItemText()); + } else { + item.setText(getItemText()); + } + fireChanged(); + this.setTreeItem(item); + } + + /** + * Return the default message when the item is created. + * + * @return the default message. + */ + public static String getDefaultItemText() { + return Messages.item_todo; + } + + /** + * Return the text to display for the item. This text can be null or an + * empty string (the value of the string will be {@link Messages#item_todo} + * ). The item text can be setted later with {@link #setItemText(String)}. + * + * @return the text of the item in the tree. + */ + public abstract String getItemText(); + + /** + * Called when this object will be instantiate. + */ + public abstract T onItemCreation(); + + /** + * This method is called when the item of the tree is selected. + */ + public abstract IDialog onItemMouseSelection(); + + /** + * Return the value of this item. + * + * @return the value. + */ + public abstract Object returnValue(); + + /** + * Delete the item and all his children of the tree. + */ + public void removeItem() { + for (final TreeItem item : getChildren()) { + findTreeItemExtended(item).removeItem(); + } + this.getTreeItem().dispose(); + fireChanged(); + } + + /** + * Return the children of this item in the tree. + * + * @return the list of the children. + */ + public TreeItem[] getChildren() { + return this.getTreeItem().getItems(); + } + + /** + * Return the parent of this item on the tree. + * + * @return the parent of the item or null if the item is root. + */ + public AbstractTreeItem<T> getParent() { + return findTreeItemExtended(getTreeItem().getParentItem()); + } + + /** + * Edit the text of the item into the tree. + * + * @param newText + * the new text. + */ + public void setTreeItemText(final String newText) { + this.getTreeItem().setText(newText); + } + + /** + * When a modification append, this method has to be called and the method + * {@link #notifyChanged()} is called for the listener of this Tree. + */ + protected void fireChanged() { + this.getMenuItem().fireChanged(); + } + + /** + * @return the treeItem + */ + public TreeItem getTreeItem() { + return this.treeItem; + } + + /** + * @param treeItem + * the treeItem to set + */ + private void setTreeItem(final TreeItem treeItem) { + this.treeItem = treeItem; + } + + /** + * @return the menuItem + */ + public AbstractTreeMenuItem<T> getMenuItem() { + return this.menuItem; + } + + /** + * @param item + * @return + */ + public AbstractTreeItem<T> findTreeItemExtended(final TreeItem item) { + return getMenuItem().findTreeItemExtended(item); + } + + /** + * This method gets the <code>properties</code> passed by the + * {@link #treeExtended} via the method + * {@link ExtendedTree#putExtraPropertiesToItems(Map)}. + * + * @return the extraProperties + */ + public Map<String, Object> getExtraProperties() { + return this.extraProperties; + } + + /** + * @param extraProperties the extraProperties to set + */ + public void setExtraProperties(final Map<String, Object> extraProperties) { + this.extraProperties = extraProperties; + } +}
diff --git a/org.eclipse.modisco.facet.util.ui/src/org/eclipse/modisco/facet/util/ui/internal/exported/util/tree/menu/AbstractTreeMenu.java b/org.eclipse.modisco.facet.util.ui/src/org/eclipse/modisco/facet/util/ui/internal/exported/util/tree/menu/AbstractTreeMenu.java new file mode 100644 index 0000000..7dff369 --- /dev/null +++ b/org.eclipse.modisco.facet.util.ui/src/org/eclipse/modisco/facet/util/ui/internal/exported/util/tree/menu/AbstractTreeMenu.java
@@ -0,0 +1,205 @@ +/** + * Copyright (c) 2012 Mia-Software. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Alban Ménager (Soft-Maint) - Bug 387470 - [EFacet][Custom] Editors + */ +package org.eclipse.modisco.facet.util.ui.internal.exported.util.tree.menu; + +import java.util.Map; + +import org.eclipse.modisco.facet.util.ui.internal.exported.util.tree.item.AbstractTreeItem; +import org.eclipse.swt.SWT; +import org.eclipse.swt.events.SelectionEvent; +import org.eclipse.swt.events.SelectionListener; +import org.eclipse.swt.widgets.Menu; +import org.eclipse.swt.widgets.MenuItem; +import org.eclipse.swt.widgets.Tree; +import org.eclipse.swt.widgets.TreeItem; + +/** + * Abstract class providing the creation of any item into the menu. + * + * @see AbstractTreeMenuItem + * @see AbstractTreeSubMenu + * @since 0.3 + */ +public abstract class AbstractTreeMenu<T extends Object> { + + private ExtendedTreeMenu<T> treeMenu; + private MenuItem menuItem; + private boolean menuItemCreated; + private Map<String, Object> properties; + + /** + * Refresh the the menu according to the actual context. + */ + public void refresh(final ExtendedTreeMenu<T> menu) { + this.treeMenu = menu; + refreshMenu(this.treeMenu.getMenu()); + } + + /** + * Refresh the the menu according to the actual context. + */ + public void refresh(final ExtendedTreeMenu<T> menuTree, final Menu menu) { + this.treeMenu = menuTree; + refreshMenu(menu); + } + + /** + * Refresh the the menu according to the actual context. + */ + private void refreshMenu(final Menu menu) { + if (isEnabled()) { + if (this.isMenuItemCreated()) { + deleteMenuItem(); + } + this.setMenuItemCreated(true); + this.menuItem = createMenuItem(menu); + } else { + deleteMenuItem(); + this.setMenuItemCreated(false); + } + } + + /** + * Return if the menu item has to be enabled or not (by checking if the + * associated AbstractTreeItem is enabled or not). + * + * @return if the menu item has to be enabled or not. + */ + public boolean isEnabled(final ExtendedTreeMenu<T> menuTree) { + this.treeMenu = menuTree; + return isEnabled(); + } + + /** + * Return if the menu item has to be enabled or not (by checking if the + * associated AbstractTreeItem is enabled or not). + * + * @return if the menu item has to be enabled or not. + */ + public abstract boolean isEnabled(); + + /** + * Create the concrete item. Has to be overrided by the classes extending + * this abstract class. + * + * @param parent + * the parent of the item. + * @return the item created. + */ + protected MenuItem createMenuItem(final Menu parent) { + final MenuItem item = new MenuItem(parent, SWT.NONE); + item.setText(getMenuName()); + item.addSelectionListener(new SelectionListener() { + + public void widgetSelected(final SelectionEvent selectionEvent) { + onMenuItemSelection(); + } + + public void widgetDefaultSelected( + final SelectionEvent selectionEvent) { + // Nothing. + } + }); + return item; + } + + /** + * @return the menu item name. + */ + public abstract String getMenuName(); + + /** + * This method is called when the menu item is selected. + * + * @return can return an instance of T. + */ + public abstract T onMenuItemSelection(); + + /** + * Delete the item of the menu. + */ + public void deleteMenuItem() { + if (this.isMenuItemCreated() && (this.menuItem != null) + && !this.menuItem.isDisposed()) { + if (this.menuItem.getMenu() != null) { + this.menuItem.getMenu().dispose(); + } + this.menuItem.dispose(); + } + } + + /** + * @return the treeMenu of the tree. + */ + public ExtendedTreeMenu<T> getTreeMenu() { + return this.treeMenu; + } + + /** + * Set the properties to pass to the new items. + * + * @param extraProperties + * the properties to pass. + * + */ + public void setExtraProperties(final Map<String, Object> extraProperties) { + this.properties = extraProperties; + } + + /** + * @return the {@link Tree}. + */ + public Tree getTree() { + return this.treeMenu.getTree(); + } + + /** + * @return the properties. + */ + public Map<String, Object> getProperties() { + return this.properties; + } + + /** + * @return true if the menu for this concrete item is created or not. + */ + public boolean isMenuItemCreated() { + return this.menuItemCreated; + } + + /** + * @param menuItemCreated + * the menuItemCreated to set. + */ + public void setMenuItemCreated(final boolean menuItemCreated) { + this.menuItemCreated = menuItemCreated; + } + + /** + * Return the {@link AbstractTreeItem} according to the {@link TreeItem}. + * + * @param treeItem + * the treeItem related. + * @return the {@link AbstractTreeItem} related to the <code>treeItem</code> + * . + */ + public abstract AbstractTreeItem<T> getTreeItemExtended( + final TreeItem treeItem); + + /** + * Remove the item in parameter of the tree. + * + * @param item + * the item to remove. + */ + public abstract boolean removeItem(final TreeItem item); +}
diff --git a/org.eclipse.modisco.facet.util.ui/src/org/eclipse/modisco/facet/util/ui/internal/exported/util/tree/menu/AbstractTreeMenuItem.java b/org.eclipse.modisco.facet.util.ui/src/org/eclipse/modisco/facet/util/ui/internal/exported/util/tree/menu/AbstractTreeMenuItem.java new file mode 100644 index 0000000..227d63a --- /dev/null +++ b/org.eclipse.modisco.facet.util.ui/src/org/eclipse/modisco/facet/util/ui/internal/exported/util/tree/menu/AbstractTreeMenuItem.java
@@ -0,0 +1,213 @@ +/** + * Copyright (c) 2012 Mia-Software. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Alban Ménager (Soft-Maint) - Bug 387470 - [EFacet][Custom] Editors + */ +package org.eclipse.modisco.facet.util.ui.internal.exported.util.tree.menu; + +import java.util.LinkedList; +import java.util.List; + +import org.eclipse.modisco.facet.util.core.Logger; +import org.eclipse.modisco.facet.util.ui.internal.Activator; +import org.eclipse.modisco.facet.util.ui.internal.exported.util.tree.item.AbstractTreeItem; +import org.eclipse.swt.widgets.Tree; +import org.eclipse.swt.widgets.TreeItem; + +/** + * Abstract class for the tree menu item. Each Menu Item had an handler which + * provide the methods: <li>{@link #isEnabled()} : return if the menu item has + * to be displayed.</li> <li>{@link #onMenuItemSelection()} : this method will + * be execute when the item is selected.</li> <li> + * {@link #getAssociatedTreeItemClass()} : links this class with an + * {@link AbstractTreeItem}. This item will be instantiate when the user select + * this element on the tree menu.</li> + * + * @see AbstractTreeItem + * @see AbstractTreeMenu + * @since 0.3 + */ +public abstract class AbstractTreeMenuItem<T extends Object> extends + AbstractTreeMenu<T> { + + private final List<AbstractTreeItem<T>> items; + + /** + * Constructor. + */ + public AbstractTreeMenuItem() { + super(); + this.items = new LinkedList<AbstractTreeItem<T>>(); + } + + /** + * This method creates the associated item and set the extra properties to + * it. + */ + @Override + public T onMenuItemSelection() { + AbstractTreeItem<T> item = null; + if (getCurrentItemSelected() == null) { + item = createItem(getTree()); + } else { + item = createItem(getCurrentItemSelected()); + } + this.getItems().add(item); + item.setExtraProperties(getProperties()); + fireChanged(); + return item.onItemCreation(); + } + + /** + * Create a new item {@link TreeItem} into the parent. + * + * @param parent + * the parent of the item to create. + */ + public AbstractTreeItem<T> createItem(final Tree parent) { + return createTreeItem(parent); + } + + /** + * Create a new item {@link TreeItem} into the parent. + * + * @param parent + * the parent of the item to create. + */ + public AbstractTreeItem<T> createItem(final TreeItem parent) { + return createTreeItem(parent); + } + + /** + * Create a new item {@link TreeItem} into the parent. + * + * @param parent + * the parent of the item to create. + */ + protected AbstractTreeItem<T> createTreeItem(final Object parent) { + AbstractTreeItem<T> newTreeItem = null; + try { + newTreeItem = getAssociatedTreeItemClass().newInstance(); + if (parent instanceof Tree) { + newTreeItem.createItem(this, (Tree) parent); + } else if (parent instanceof TreeItem) { + newTreeItem.createItem(this, (TreeItem) parent); + } + } catch (final SecurityException e) { + Logger.logError(e, Activator.getDefault()); + } catch (final IllegalArgumentException e) { + Logger.logError(e, Activator.getDefault()); + } catch (final InstantiationException e) { + Logger.logError(e, Activator.getDefault()); + } catch (final IllegalAccessException e) { + Logger.logError(e, Activator.getDefault()); + } + + return newTreeItem; + } + + /** + * Find the treeItem searching into the all tree. + * + * @param treeItem + * the treeItem to find. + * @return the corresponding {@link AbstractTreeItem}. Null if not. + */ + public AbstractTreeItem<T> findTreeItemExtended(final TreeItem treeItem) { + return this.getTreeMenu().getTreeItemExtended(treeItem); + } + + /** + * This method only find the item into the corresponding element of this + * menu item. To find an element searching it into the all tree, use the + * method {@link #findTreeItemExtended(TreeItem)}. + */ + @Override + public AbstractTreeItem<T> getTreeItemExtended(final TreeItem item) { + AbstractTreeItem<T> result = null; + for (final AbstractTreeItem<T> itemExtended : this.getItems()) { + if (itemExtended.getTreeItem().equals(item)) { + result = itemExtended; + break; + } + } + return result; + } + + @Override + public boolean removeItem(final TreeItem item) { + boolean removed = false; + final AbstractTreeItem<T> itemExtended = findTreeItemExtended(item); + if (itemExtended != null) { + this.getItems().remove(itemExtended); + itemExtended.removeItem(); + removed = true; + fireChanged(); + } + return removed; + } + + /** + * @return get the current selection of the tree. + */ + public TreeItem getCurrentItemSelected() { + return getTreeMenu().getCurrentItemSelected(); + } + + /** + * Remove the last item created. + */ + protected void removeLastItem() { + // The list created is a LinkedList<AbstractTreeItem> + ((LinkedList<AbstractTreeItem<T>>) this.getItems()).getLast() + .removeItem(); + fireChanged(); + } + + /** + * Set a new text to the last item created. + * + * @param newText + * the new text to set. + */ + protected void setLastItemText(final String newText) { + // The list created is a LinkedList<AbstractTreeItem> + ((LinkedList<AbstractTreeItem<T>>) this.getItems()).getLast() + .setTreeItemText(newText); + fireChanged(); + } + + /** + * When a modification append, this method has to be called and the method + * {@link #notifyChanged()} is called for the listener of this Tree. + */ + public void fireChanged() { + final ExtendedTreeMenu<T> treeMenu = getTreeMenu(); + if (treeMenu != null) { + treeMenu.fireChanged(); + } + } + + /** + * Return the class associated with this menu item. When this menu item will + * be selected, a new instance of this associated {@link AbstractTreeItem} + * will be created. + * + * @return the associated class. + */ + public abstract Class<? extends AbstractTreeItem<T>> getAssociatedTreeItemClass(); + + + /** + * @return the items created by this menu item. + */ + public List<AbstractTreeItem<T>> getItems() { + return this.items; + } +}
diff --git a/org.eclipse.modisco.facet.util.ui/src/org/eclipse/modisco/facet/util/ui/internal/exported/util/tree/menu/AbstractTreeSubMenu.java b/org.eclipse.modisco.facet.util.ui/src/org/eclipse/modisco/facet/util/ui/internal/exported/util/tree/menu/AbstractTreeSubMenu.java new file mode 100644 index 0000000..e927b0a --- /dev/null +++ b/org.eclipse.modisco.facet.util.ui/src/org/eclipse/modisco/facet/util/ui/internal/exported/util/tree/menu/AbstractTreeSubMenu.java
@@ -0,0 +1,128 @@ +/** + * Copyright (c) 2012 Mia-Software. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Alban Ménager (Soft-Maint) - Bug 387470 - [EFacet][Custom] Editors + */ +package org.eclipse.modisco.facet.util.ui.internal.exported.util.tree.menu; + +import java.util.LinkedList; +import java.util.List; + +import org.eclipse.modisco.facet.util.ui.internal.exported.util.tree.item.AbstractTreeItem; +import org.eclipse.swt.SWT; +import org.eclipse.swt.widgets.Menu; +import org.eclipse.swt.widgets.MenuItem; +import org.eclipse.swt.widgets.TreeItem; + +/** + * Class for the creation of a sub-menu in the menu. The sub-menu is not + * selectable and own a list of sub-items (declared by the contributor with the + * extension point). + * + * @since 0.3 + */ +public abstract class AbstractTreeSubMenu<T extends Object> extends + AbstractTreeMenu<T> { + + private final List<AbstractTreeMenu<T>> items; + + /** + * Constructor. + */ + public AbstractTreeSubMenu() { + super(); + this.items = new LinkedList<AbstractTreeMenu<T>>(); + } + + /** + * Add an item to the list of the sub-menu items. + * + * @param item + * the item to add. + */ + public void addItem(final AbstractTreeMenu<T> item) { + this.getItems().add(item); + } + + /** + * Creation of the sub-menu and all his children. + */ + @Override + protected MenuItem createMenuItem(final Menu parent) { + MenuItem menuItem = null; + for (final AbstractTreeMenu<T> item : this.getItems()) { + if (item.isEnabled(getTreeMenu())) { + if (menuItem == null) { + menuItem = createConcreteMenu(parent); + } + item.setExtraProperties(getProperties()); + item.refresh(getTreeMenu(), menuItem.getMenu()); + } + } + return menuItem; + } + + /** + * Create the concrete sub menu into the tree menu. + * + * @param parent + * the menu parent of this sub menu. + * @return the new item into the menu. + */ + protected MenuItem createConcreteMenu(final Menu parent) { + final MenuItem menuItem = new MenuItem(parent, SWT.CASCADE); + menuItem.setText(getMenuName()); + menuItem.setMenu(new Menu(parent)); + return menuItem; + } + + @Override + public boolean isEnabled() { + boolean result = false; + for (final AbstractTreeMenu<T> item : this.getItems()) { + if (item.isEnabled(getTreeMenu())) { + result = true; + } + } + return result; + } + + @Override + public AbstractTreeItem<T> getTreeItemExtended(final TreeItem treeItem) { + AbstractTreeItem<T> result = null; + for (final AbstractTreeMenu<T> menuItem : this.getItems()) { + final AbstractTreeItem<T> itemExtended = menuItem + .getTreeItemExtended(treeItem); + if (itemExtended != null) { + result = itemExtended; + break; + } + } + return result; + } + + @Override + public boolean removeItem(final TreeItem item) { + boolean removed = false; + for (final AbstractTreeMenu<T> menuItem : this.getItems()) { + removed = menuItem.removeItem(item); + if (removed) { + break; + } + } + return removed; + } + + /** + * @return the items + */ + public List<AbstractTreeMenu<T>> getItems() { + return this.items; + } +}
diff --git a/org.eclipse.modisco.facet.util.ui/src/org/eclipse/modisco/facet/util/ui/internal/exported/util/tree/menu/ExtendedTreeMenu.java b/org.eclipse.modisco.facet.util.ui/src/org/eclipse/modisco/facet/util/ui/internal/exported/util/tree/menu/ExtendedTreeMenu.java new file mode 100644 index 0000000..14bf821 --- /dev/null +++ b/org.eclipse.modisco.facet.util.ui/src/org/eclipse/modisco/facet/util/ui/internal/exported/util/tree/menu/ExtendedTreeMenu.java
@@ -0,0 +1,341 @@ +/** + * Copyright (c) 2012 Mia-Software. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Alban Ménager (Soft-Maint) - Bug 387470 - [EFacet][Custom] Editors + */ +package org.eclipse.modisco.facet.util.ui.internal.exported.util.tree.menu; + +import java.util.LinkedList; +import java.util.List; +import java.util.Map; + +import org.eclipse.modisco.facet.util.ui.internal.exported.tree.menu.ITreeMenu; +import org.eclipse.modisco.facet.util.ui.internal.exported.util.tree.ExtendedTree; +import org.eclipse.modisco.facet.util.ui.internal.exported.util.tree.item.AbstractTreeItem; +import org.eclipse.swt.events.MenuEvent; +import org.eclipse.swt.events.MenuListener; +import org.eclipse.swt.widgets.Control; +import org.eclipse.swt.widgets.Menu; +import org.eclipse.swt.widgets.Tree; +import org.eclipse.swt.widgets.TreeItem; + +/** + * This class provide the creation of the menu {@link Menu} of the tree ( + * {@link #createMenu(Control, ExtendedTree)}. The menu add a list of + * {@link AbstractTreeItem} and for each an {@link AbstractTreeItem} which will + * be instantiate when the menu item is selected. + * + * @since 0.3 + */ +public class ExtendedTreeMenu<IDialog> implements ITreeMenu<IDialog> { + + private final Control parent; + private final ExtendedTree treeExtended; + private final List<AbstractTreeMenu<IDialog>> menuItems; + private Menu menu; + + /** + * Constructor. + * + * @param parent + * the parent of the menu. + * @param treeExtended + * the tree to which the menu will be linked. + * @param menuItems + */ + public ExtendedTreeMenu(final Control parent, final ExtendedTree treeExtended, + final List<AbstractTreeMenu<IDialog>> menuItems) { + this.parent = parent; + this.treeExtended = treeExtended; + this.menuItems = menuItems; + } + + /** + * This method creates the tree menu, add put the listener into the menu. + * + * @param parent + * the parent of the menu. + * @param treeExtended + * the associated {@link ExtendedTree} of the menu. + */ + public void createMenu() { + this.menu = new Menu(this.parent); + this.menu.addMenuListener(new MenuListener() { + + public void menuShown(final MenuEvent menuEvent) { + onMenuShown(); + } + + public void menuHidden(final MenuEvent menuEvent) { + // Nothing. + } + }); + } + + /** + * This method is called when the menu is displayed. It calls all the + * {@link AbstractTreeMenu#refresh(TreeMenu)} method of each element of the + * menu. + */ + public void onMenuShown() { + for (final AbstractTreeMenu<IDialog> menuItem : this.getMenuItems()) { + menuItem.refresh(this); + } + } + + /** + * Return the list of all the items of this menu. + * + * @return the list of the {@link AbstractTreeMenu} of this menu. + */ + public List<AbstractTreeMenu<IDialog>> getTreeMenuItems() { + return this.getMenuItems(); + } + + /** + * Return the {@link Menu} of this TreeMenu. + * + * @return the menu. + */ + public Menu getMenu() { + return this.menu; + } + + /** + * Put this <code>properties</code> to each items created. + * + * @param properties + * the list of properties to pass. + */ + public void putExtraProperties(final Map<String, Object> properties) { + for (final AbstractTreeMenu<IDialog> menuItem : this.getMenuItems()) { + menuItem.setExtraProperties(properties); + } + } + + /** + * @return the current {@link TreeItem} selected on the tree. + */ + public TreeItem getCurrentItemSelected() { + TreeItem result = null; + final TreeItem[] items = this.treeExtended.getTree().getSelection(); + if (items.length > 0) { + result = this.treeExtended.getTree().getSelection()[0]; + } + return result; + } + + /** + * @return the {@link AbstractTreeItem} selected on the tree. Can be null. + */ + public AbstractTreeItem<IDialog> getTreeItemExtended(final TreeItem treeItem) { + AbstractTreeItem<IDialog> result = null; + for (final AbstractTreeMenu<IDialog> menuItem : this.getMenuItems()) { + final AbstractTreeItem<IDialog> itemExtended = menuItem + .getTreeItemExtended(treeItem); + if (itemExtended != null) { + result = itemExtended; + break; + } + } + return result; + } + + /** + * @return the {@link AbstractTreeMenu} selected on the tree. Can be null. + */ + public AbstractTreeMenu<IDialog> getTreeMenu(final TreeItem treeItem) { + AbstractTreeMenu<IDialog> result = null; + + for (final AbstractTreeMenu<IDialog> menuItem : this.getMenuItems()) { + final AbstractTreeItem<IDialog> itemExtended = menuItem + .getTreeItemExtended(treeItem); + if (itemExtended != null) { + result = menuItem; + break; + } + } + return result; + } + + /** + * Remove the current item selected of the tree. + */ + public void removeCurrentItemSelected() { + final AbstractTreeMenu<IDialog> treeMenu = getTreeMenu(getCurrentItemSelected()); + if (treeMenu != null) { + treeMenu.removeItem(getCurrentItemSelected()); + } + } + + /** + * @return the {@link Tree}. + */ + public Tree getTree() { + return this.treeExtended.getTree(); + } + + /** + * This method call the method + * {@link AbstractTreeItem#onItemMouseSelection()} of the current selection. + */ + public void onMouseSelection() { + final AbstractTreeItem<IDialog> treeMenu = getTreeItemExtended(getCurrentItemSelected()); + if (treeMenu != null) { + treeMenu.onItemMouseSelection(); + fireChanged(); + } + } + + /** + * When a modification append, this method has to be called and the method + * {@link #notifyChanged()} is called for the listener of this Tree. + */ + public void fireChanged() { + this.treeExtended.fireChanged(); + } + + /** + * @return the all the items of the menu. + */ + private List<AbstractTreeMenu<IDialog>> getMenuItems() { + return this.menuItems; + } + + /** + * Select the item into the menu (if the item exist). + * + * @return can return a {@link IDialog}. Can be null. + */ + public IDialog selectMenuItem( + final Class<? extends AbstractTreeMenuItem<IDialog>> menuItemType) { + IDialog result = null; + final AbstractTreeMenu<IDialog> treeMenu = findMenuItem(menuItemType); + if (treeMenu != null) { + result = treeMenu.onMenuItemSelection(); + } + return result; + } + + /** + * Return (if exist) the {@link AbstractTreeMenu} with the name + * <code>menuItemName</code> into the items of the tree menu. + * + * @param menuItemType + * the name of the element to find. + * @return the item menu with the name in parameter (can be null). + */ + private AbstractTreeMenuItem<IDialog> findMenuItem( + final Class<? extends AbstractTreeMenuItem<IDialog>> menuItemType) { + AbstractTreeMenuItem<IDialog> result = null; + for (final AbstractTreeMenuItem<IDialog> item : getAllTreeMenuItems()) { + if (item.getClass().isInstance(menuItemType)) { + result = item; + } + } + return result; + } + + private List<AbstractTreeMenuItem<IDialog>> getAllTreeMenuItems() { + final List<AbstractTreeMenuItem<IDialog>> result = new LinkedList<AbstractTreeMenuItem<IDialog>>(); + for (final AbstractTreeMenu<IDialog> menuItem : getMenuItems()) { + if (menuItem instanceof AbstractTreeSubMenu) { + result.addAll(getAllTreeMenuItems((AbstractTreeSubMenu<IDialog>) menuItem)); + } else { + result.add((AbstractTreeMenuItem<IDialog>) menuItem); + } + } + return result; + } + + private List<AbstractTreeMenuItem<IDialog>> getAllTreeMenuItems( + final AbstractTreeSubMenu<IDialog> subMenu) { + final List<AbstractTreeMenuItem<IDialog>> result = new LinkedList<AbstractTreeMenuItem<IDialog>>(); + for (final AbstractTreeMenu<IDialog> menuItem : subMenu.getItems()) { + if (menuItem instanceof AbstractTreeSubMenu) { + result.addAll(getAllTreeMenuItems((AbstractTreeSubMenu<IDialog>) menuItem)); + } else { + result.add((AbstractTreeMenuItem<IDialog>) menuItem); + } + } + return result; + } + + /** + * @return the treeMenuItem into the menu with is an instance of the type in + * parameter. + */ + public AbstractTreeMenu<IDialog> getTreeMenuItem(final Class<?> treeMenuType) { + AbstractTreeMenu<IDialog> result = null; + final List<AbstractTreeMenu<IDialog>> treeMenuItems = getTreeMenuItems(); + for (final AbstractTreeMenu<IDialog> item : treeMenuItems) { + result = getTreeMenuItem(item, treeMenuType); + if (result != null) { + break; + } + } + return result; + } + + private AbstractTreeMenu<IDialog> getTreeMenuItem( + final AbstractTreeSubMenu<IDialog> item, + final Class<?> treeMenuType) { + AbstractTreeMenu<IDialog> result = null; + for (final AbstractTreeMenu<IDialog> subItem : item.getItems()) { + result = getTreeMenuItem(subItem, treeMenuType); + if (result != null) { + break; + } + } + return result; + } + + private AbstractTreeMenu<IDialog> getTreeMenuItem( + final AbstractTreeMenu<IDialog> item, + final Class<?> treeMenuType) { + AbstractTreeMenu<IDialog> result = null; + if (treeMenuType.isInstance(item)) { + result = item; + } else if (item instanceof AbstractTreeSubMenu) { + result = getTreeMenuItem((AbstractTreeSubMenu<IDialog>) item, + treeMenuType); + } + return result; + } + + /** + * get all the items of the tree with the name <code>treeItemName</code> + * + * @param treeItemName + * the name of the item to select. + * @return the list of all the tree item with the name in parameter. + */ + public List<AbstractTreeItem<IDialog>> getTreeItems( + final String treeItemName) { + final List<AbstractTreeItem<IDialog>> result = new LinkedList<AbstractTreeItem<IDialog>>(); + for (final AbstractTreeMenuItem<IDialog> menuItem : getAllTreeMenuItems()) { + for (final AbstractTreeItem<IDialog> treeItem : menuItem.getItems()) { + if (treeItemName.equals(treeItem.getItemText())) { + result.add(treeItem); + } + } + } + return result; + } + + /** + * Select a item into the tree. + * + * @param treeItem + * the {@link AbstractTreeItem} to select + */ + public void selectTreeItem(final AbstractTreeItem<IDialog> treeItem) { + this.treeExtended.getTree().setSelection(treeItem.getTreeItem()); + } +}
diff --git a/org.eclipse.modisco.facet.util.ui/src/org/eclipse/modisco/facet/util/ui/internal/exported/util/widget/AbstractWidget.java b/org.eclipse.modisco.facet.util.ui/src/org/eclipse/modisco/facet/util/ui/internal/exported/util/widget/AbstractWidget.java new file mode 100644 index 0000000..d1961b9 --- /dev/null +++ b/org.eclipse.modisco.facet.util.ui/src/org/eclipse/modisco/facet/util/ui/internal/exported/util/widget/AbstractWidget.java
@@ -0,0 +1,155 @@ +/** + * Copyright (c) 2012 Mia-Software. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Alban Ménager (Soft-Maint) - Bug 387470 - [EFacet][Custom] Editors + * Grégoire Dupé (Mia-Software) - Bug 387470 - [EFacet][Custom] Editors + */ +package org.eclipse.modisco.facet.util.ui.internal.exported.util.widget; + +import java.util.LinkedList; +import java.util.List; + +import org.eclipse.modisco.facet.util.ui.internal.exported.util.widget.command.AbstractCommandWidget; +import org.eclipse.modisco.facet.util.ui.internal.exported.util.widget.command.AbstractGetOrCreateFilteredElementCommandWidget; +import org.eclipse.modisco.facet.util.ui.internal.exported.util.widget.component.properties.AbstractGetPropertyWidget; +import org.eclipse.modisco.facet.util.ui.internal.exported.util.widget.component.properties.bounds.AbstractGetBoundsWidget; +import org.eclipse.modisco.facet.util.ui.internal.exported.widget.IAbstractWidget; +import org.eclipse.modisco.facet.util.ui.internal.widget.metaclass.FilteredElementSelectionWidget; +import org.eclipse.swt.SWT; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.widgets.Composite; + +/** + * An abstract class providing the creation of a specific action widget.</p> + * + * The listener provided by the {@link #getWidgetListener()} is applied on the + * widget and called when the mouse move into the dialog. + * + * @see AbstractCommandWidget + * @see AbstractGetOrCreateFilteredElementCommandWidget + * @see FilteredElementSelectionWidget + * @see SelectSubTypingTypeWidget + * @see AbstractGetBoundsWidget + * @see AbstractGetPropertyWidget + * @see GetQueryWidgetComposite + * @see SelectQueryTypeWidget + * @since 0.3 + */ +public abstract class AbstractWidget extends Composite implements IAbstractWidget { + + protected static final int VERTICAL_SPACING = 2; + protected static final int WIDTH_HINT = 110; + private final Composite widgetParent; + private final List<IAbstractWidget> subWidgets; + private final List<IAbstractWidget> listeners; + + /** + * The constructor. + * + * @param parent + * the parent of the widget. + * @param editingDomain + * the editing domain. + */ + public AbstractWidget(final Composite parent) { + super(parent, SWT.NONE); + this.widgetParent = parent; + this.subWidgets = new LinkedList<IAbstractWidget>(); + this.setLayout(new GridLayout()); + this.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); + this.listeners = new LinkedList<IAbstractWidget>(); + } + + /** + * Add the widget to the list of sub widgets. + * + * @param widget + * the widget to add. + */ + protected void addSubWidget(final IAbstractWidget widget) { + this.subWidgets.add(widget); + } + + /** + * This method add all the sub widgets of this widget. + * <p/> + * Use the method {@link #addSubWidget(AbstractCommandWidget)} + */ + protected abstract void addSubWidgets(); + + /** + * @return the widget parent. + */ + protected Composite getWidgetParent() { + return this.widgetParent; + } + + /** + * Return the string containing the error for this widget. + * + * @return null if there is no error. The string containing the error if + * there is an error. + */ + public abstract String getError(); + + /** + * Create the content of the widget (call {@link #addSubWidgets()}) and + * sub-widgets. + */ + public void createWidgetContent() { + addSubWidgets(); + for (final IAbstractWidget widget : this.subWidgets) { + widget.createWidgetContent(); + widget.addListener(this); + } + } + + /** + * Add the abstractWidget in parameter to the list of listeners of the + * widget. + * + * @param abstractWidget + * the abstractWidget to listen. + */ + public void addListener(final AbstractWidget abstractWidget) { + // This method is public because PMD doesn't want it to be private... + // This is due to the fact that this method is used on the method + // 'createWidgetContent' but it is called on the same object type but + // not on the same instance. So, programatly, put the method private is + // correct because the object type is the same that the owner but not on + // the same instance. + this.listeners.add(abstractWidget); + } + + /** + * When a modification append, this method is called and the method + * {@link #notifyChanged()} is called for each listeners of this widget. + */ + protected void fireChanged() { + for (final IAbstractWidget listener : this.listeners) { + listener.notifyChanged(); + } + } + + /** + * When a change in a sub-widget append, this method is execute. If no + * action has to be done when a modification append, this method has to be + * void. + */ + public abstract void notifyChanged(); + + /** + * @return the subWidgets + */ + public List<IAbstractWidget> getSubWidgets() { + return this.subWidgets; + } + +}
diff --git a/org.eclipse.modisco.facet.util.ui/src/org/eclipse/modisco/facet/util/ui/internal/exported/util/widget/command/AbstractCommandWidget.java b/org.eclipse.modisco.facet.util.ui/src/org/eclipse/modisco/facet/util/ui/internal/exported/util/widget/command/AbstractCommandWidget.java new file mode 100644 index 0000000..5e44749 --- /dev/null +++ b/org.eclipse.modisco.facet.util.ui/src/org/eclipse/modisco/facet/util/ui/internal/exported/util/widget/command/AbstractCommandWidget.java
@@ -0,0 +1,86 @@ +/** + * Copyright (c) 2012 Mia-Software. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Alban Ménager (Soft-Maint) - Bug 387470 - [EFacet][Custom] Editors + * Grégoire Dupé (Mia-Software) - Bug 387470 - [EFacet][Custom] Editors + */ +package org.eclipse.modisco.facet.util.ui.internal.exported.util.widget.command; + +import org.eclipse.core.commands.Command; +import org.eclipse.modisco.facet.util.ui.internal.exported.WidgetProperties; +import org.eclipse.modisco.facet.util.ui.internal.exported.util.dialog.AbstractDialog; +import org.eclipse.modisco.facet.util.ui.internal.exported.util.dialog.AbstractMainDialog; +import org.eclipse.modisco.facet.util.ui.internal.exported.util.widget.AbstractWidget; +import org.eclipse.modisco.facet.util.ui.internal.exported.widget.IAbstractWidget; +import org.eclipse.swt.widgets.Composite; + +/** + * This abstract class provides all the necessary methods for the creation of a + * widget. The widget must return a {@link Command} (with the method + * {@link #getCommand()}) that will be executed when the "ok" button of the + * dialog will be pressed.</p> + * + * The widget have to get all the necessary properties for the creation of the + * element (with the command). To get all the properties, the widget have to add + * all the subwidgets he needs for the edition of the command. Each subwidget + * {@link AbstractWidget} will edit a specific property of the + * {@link WidgetProperties}. + * + * @since 0.3 + */ +public abstract class AbstractCommandWidget extends AbstractWidget implements ICommandWidget { + + /** + * Constructor. Initialize the {@link IFacetCommandFactory} for the creation + * of the command. + * + * @param parent + * the parent {@link AbstractDialog} of this widget. + * @param editingDomain + * the current editing domain. + * @param properties + * The {@link WidgetProperties} provided by the + * {@link AbstractMainDialog} that the widget had to edit. + */ + public AbstractCommandWidget(final Composite parent) { + super(parent); + } + + /* (non-Javadoc) + * @see org.eclipse.emf.facet.util.ui.internal.exported.util.widget.command.ICommandWidget#getCommand() + */ + public abstract Object getCommand(); + + @Override + public String getError() { + String result = null; + for (final IAbstractWidget widgets : this.getSubWidgets()) { + final String error = widgets.getError(); + if (error != null) { + result = error; + break; + } + } + return result; + } + + + public abstract void onDialogValidation(); + + public <A> A adapt(final Class<A> adapterType) { + A result = null; + if (adapterType.isInstance(this)) { + @SuppressWarnings("unchecked") + final A adapted = (A) this; + result = adapted; + } + return result; + } + +}
diff --git a/org.eclipse.modisco.facet.util.ui/src/org/eclipse/modisco/facet/util/ui/internal/exported/util/widget/command/AbstractGetOrCreateFilteredElementCommandWidget.java b/org.eclipse.modisco.facet.util.ui/src/org/eclipse/modisco/facet/util/ui/internal/exported/util/widget/command/AbstractGetOrCreateFilteredElementCommandWidget.java new file mode 100644 index 0000000..6ceae25 --- /dev/null +++ b/org.eclipse.modisco.facet.util.ui/src/org/eclipse/modisco/facet/util/ui/internal/exported/util/widget/command/AbstractGetOrCreateFilteredElementCommandWidget.java
@@ -0,0 +1,147 @@ +/** + * Copyright (c) 2012 Mia-Software. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Alban Ménager (Soft-Maint) - Bug 387470 - [EFacet][Custom] Editors + * Grégoire Dupé (Mia-Software) - Bug 387470 - [EFacet][Custom] Editors + */ +package org.eclipse.modisco.facet.util.ui.internal.exported.util.widget.command; + +import java.util.Map; + +import org.eclipse.modisco.facet.util.ui.internal.exported.dialog.IDialog; +import org.eclipse.modisco.facet.util.ui.internal.exported.util.dialog.AbstractDialog; +import org.eclipse.modisco.facet.util.ui.internal.exported.util.dialog.SynchronizedAbstractDialog; +import org.eclipse.modisco.facet.util.ui.internal.exported.util.widget.component.CreateElementWidget; +import org.eclipse.modisco.facet.util.ui.internal.widget.metaclass.FilteredElementSelectionWidget; +import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.widgets.Composite; + +/** + * This abstract class allows the user to select or create an element (the + * concretes classes extending this abstract class will specify the type for + * this elements).</p> + * + * The widget contains two composite: + * <nl> + * <li> {@link FilteredElementSelectionWidget} : display a filtered list with the + * elements returned by {@link #getElements()}</li> + * <li> {@link CreateElementWidget} : create a "new..." button, and display the + * dialog returned by {@link #createDialog()} when clicked</li> + * </nl> + * + * @see GetOrCreateFacetSetWidget + * @see GetOrCreateFacetWidget + * @see GetOrCreateOperationWidget + * @see FilteredElementSelectionWidget + * @see CreateElementWidget + * @since 0.3 + */ +public abstract class AbstractGetOrCreateFilteredElementCommandWidget<T extends Object, W extends Object> + extends AbstractCommandWidget implements IGetOrCreateFilteredElementCommmandWidget<T, W> { + + private static final int COLUMNS_NUMBER = 2; + private FilteredElementSelectionWidget elementSelection; + private CreateElementWidget<W> createElementW; + + /** + * Constructor. Initialize a new layout containing {@value #COLUMN_NUMBER} + * columns. + * + * @param parent + * the parent of this widget. + * @param editingDomain + * the current editing domain. + * @param properties + * the properties. + */ + protected AbstractGetOrCreateFilteredElementCommandWidget( + final Composite parent) { + super(parent); + this.setLayout(new GridLayout(COLUMNS_NUMBER, false)); + } + + @Override + protected void addSubWidgets() { + final Object[] array = getElements().keySet().toArray(); + this.elementSelection = new FilteredElementSelectionWidget(this, array); + addSubWidget(this.elementSelection); + final IDialog<W> dialog = createDialog(); + if (dialog != null) { + this.createElementW = new CreateElementWidget<W>(this, dialog); + addSubWidget(this.createElementW); + } + } + + /** + * This method must return the all the elements that the user can choose + * (with the name to display has the key to the map). The method + * {@link #getSuperFacetSet(Object)} can be useful. + * + * @return a map of the elements to display. + */ + protected abstract Map<String, T> getElements(); + + /** + * @return the dialog that the "New..." button of this widget will open. + * Null if you want no "New..." button. + * + * @see AbstractDialog + */ + protected abstract IDialog<W> createDialog(); + + /** + * Update the filtered list. The list will be updated with the elements + * returned by {@link #getElements()}. + */ + public void updateFilteredList() { + this.elementSelection.setElements(getElements().keySet().toArray()); + } + + /* (non-Javadoc) + * @see org.eclipse.emf.facet.util.ui.internal.exported.util.widget.command.IGetOrCreateFilteredElementCommmandWidget#getElementSelected() + */ + public T getElementSelected() { + T result = null; + final Object selectedElement = this.elementSelection + .getFirstSelectedElement(); + if (selectedElement != null) { + final String elementName = selectedElement.toString(); + result = getElements().get(elementName); + } + return result; + } + + /* (non-Javadoc) + * @see org.eclipse.emf.facet.util.ui.internal.exported.util.widget.command.IGetOrCreateFilteredElementCommmandWidget#selectElement(T) + */ + public void selectElement(final T element) { + Object[] selectionsParam = new Object[1]; + for (String key : getElements().keySet()) { + if (getElements().get(key) == element) { + selectionsParam[0] = key; + this.elementSelection.getFilteredList().setSelection( + selectionsParam); + break; + } + } + } + + public void selectElementByName(final String name) { + final T element = this.getElements().get(name); + selectElement(element); + } + + /* (non-Javadoc) + * @see org.eclipse.emf.facet.util.ui.internal.exported.util.widget.command.IGetOrCreateFilteredElementCommmandWidget#pressNewButton() + */ + public IDialog<W> pressNewButton() { + return new SynchronizedAbstractDialog<W>( + this.createElementW.pressNewButton(), this.getDisplay()); + } +}
diff --git a/org.eclipse.modisco.facet.util.ui/src/org/eclipse/modisco/facet/util/ui/internal/exported/util/widget/command/ICommandWidget.java b/org.eclipse.modisco.facet.util.ui/src/org/eclipse/modisco/facet/util/ui/internal/exported/util/widget/command/ICommandWidget.java new file mode 100644 index 0000000..cdb9664 --- /dev/null +++ b/org.eclipse.modisco.facet.util.ui/src/org/eclipse/modisco/facet/util/ui/internal/exported/util/widget/command/ICommandWidget.java
@@ -0,0 +1,40 @@ +/** + * Copyright (c) 2012 Mia-Software. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Grégoire Dupé (Mia-Software) - Bug 387470 - [EFacet][Custom] Editors + */ +package org.eclipse.modisco.facet.util.ui.internal.exported.util.widget.command; + +import org.eclipse.core.commands.Command; +import org.eclipse.modisco.facet.util.ui.internal.exported.widget.IAbstractWidget; + +/** + * @since 0.3 + */ +public interface ICommandWidget extends IAbstractWidget { + + /** + * Return the command for the widget specific action. The factory can be + * used for the creation of the {@link Command}. + * + * @see IFacetCommandFactory + * + * @return the command. + */ + Object getCommand(); + + /** + * This method is execute when the "OK" button of the {@link #parent} is + * pressed. + */ + void onDialogValidation(); + + <A> A adapt(Class<A> adapterType); + +} \ No newline at end of file
diff --git a/org.eclipse.modisco.facet.util.ui/src/org/eclipse/modisco/facet/util/ui/internal/exported/util/widget/command/IGetOrCreateFilteredElementCommmandWidget.java b/org.eclipse.modisco.facet.util.ui/src/org/eclipse/modisco/facet/util/ui/internal/exported/util/widget/command/IGetOrCreateFilteredElementCommmandWidget.java new file mode 100644 index 0000000..b4725dc --- /dev/null +++ b/org.eclipse.modisco.facet.util.ui/src/org/eclipse/modisco/facet/util/ui/internal/exported/util/widget/command/IGetOrCreateFilteredElementCommmandWidget.java
@@ -0,0 +1,33 @@ +/** + * Copyright (c) 2012 Mia-Software. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Grégoire Dupé (Mia-Software) - Bug 387470 - [EFacet][Custom] Editors + */ +package org.eclipse.modisco.facet.util.ui.internal.exported.util.widget.command; + +import org.eclipse.modisco.facet.util.ui.internal.exported.dialog.IDialog; + +/** + * @since 0.3 + */ +public interface IGetOrCreateFilteredElementCommmandWidget<T extends Object, W extends Object> + extends ICommandWidget { + + /** + * @return the selected element in the filtredList. + */ + T getElementSelected(); + + void selectElement(T element); + + void selectElementByName(String name); + + IDialog<W> pressNewButton(); + +} \ No newline at end of file
diff --git a/org.eclipse.modisco.facet.util.ui/src/org/eclipse/modisco/facet/util/ui/internal/exported/util/widget/component/CreateElementWidget.java b/org.eclipse.modisco.facet.util.ui/src/org/eclipse/modisco/facet/util/ui/internal/exported/util/widget/component/CreateElementWidget.java new file mode 100644 index 0000000..e2297fe --- /dev/null +++ b/org.eclipse.modisco.facet.util.ui/src/org/eclipse/modisco/facet/util/ui/internal/exported/util/widget/component/CreateElementWidget.java
@@ -0,0 +1,132 @@ +/** + * Copyright (c) 2012 Mia-Software. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Alban Ménager (Soft-Maint) - Bug 387470 - [EFacet][Custom] Editors + * Grégoire Dupé (Mia-Software) - Bug 387470 - [EFacet][Custom] Editors + */ +package org.eclipse.modisco.facet.util.ui.internal.exported.util.widget.component; + +import org.eclipse.jface.viewers.CellEditor.LayoutData; +import org.eclipse.jface.window.Window; +import org.eclipse.modisco.facet.util.ui.internal.Messages; +import org.eclipse.modisco.facet.util.ui.internal.exported.dialog.IDialog; +import org.eclipse.modisco.facet.util.ui.internal.exported.util.widget.AbstractWidget; +import org.eclipse.modisco.facet.util.ui.internal.exported.util.widget.command.AbstractGetOrCreateFilteredElementCommandWidget; +import org.eclipse.swt.SWT; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.widgets.Button; +import org.eclipse.swt.widgets.Display; +import org.eclipse.swt.widgets.Event; +import org.eclipse.swt.widgets.Listener; + +/** + * WidgetComposite for the creation of the "New..." button. This widget will + * open the dialog passed in the constructor. + * + * @since 0.3 + */ +public class CreateElementWidget<W extends Object> extends AbstractWidget { + + private final IDialog<W> dialog; + private final AbstractGetOrCreateFilteredElementCommandWidget<?, ?> typedParent; + + /** + * Constructor. Initialize the {@link LayoutData} with the + * {@link AbstractWidget} attribute 'fillGridData'. + * + * @param parent + * the parent of this composite. + * @param editingDomain + * the current editing domain. + * @param dialog + * the dialog displayed when the "new.." is pressed. + */ + public CreateElementWidget( + final AbstractGetOrCreateFilteredElementCommandWidget<?, ?> parent, + final IDialog<W> dialog) { + super(parent); + // Set the new button at the TOP. + setLayoutData(new GridData(SWT.CENTER, SWT.BEGINNING, true, false)); + this.typedParent = parent; + this.dialog = dialog; + } + + /** + * @return the dialog + */ + public IDialog<W> getDialog() { + return this.dialog; + } + + @Override + protected void addSubWidgets() { + createButton(); + } + + /** + * Creation of the 'new...' button. When pressed, the {@link #dialog} will + * be displayed. + */ + private void createButton() { + final Button button = new Button(this, SWT.NONE); + button.setText(Messages.New); + button.addListener(SWT.Selection, new Listener() { + + public void handleEvent(final Event event) { + onWidgetSelected(); + } + + }); + } + + public IDialog<W> onWidgetSelected() { + final IDialog<W> newDialog = getDialog(); + Display.getDefault().asyncExec(new Runnable() { + public void run() { + final int result = newDialog.open(); + if (result == Window.OK) { + onCommited(); + } else { + onCanceled(); + } + } + }); + return newDialog; + } + + /** + * Action to do when the dialog opened with the button "..." is closed with + * the "Ok" button. + */ + protected void onCommited() { + this.typedParent.updateFilteredList(); + } + + /** + * Action to do when the dialog opened with the button "..." is closed with + * the "Cancel" button. + */ + protected void onCanceled() { + // Nothing + } + + @Override + public String getError() { + return null; + } + + @Override + public void notifyChanged() { + // No action has to be done if a change appends. + } + + public IDialog<W> pressNewButton() { + return onWidgetSelected(); + } +}
diff --git a/org.eclipse.modisco.facet.util.ui/src/org/eclipse/modisco/facet/util/ui/internal/exported/util/widget/component/getorcreate/AbstractGetOrCreateElementWidget.java b/org.eclipse.modisco.facet.util.ui/src/org/eclipse/modisco/facet/util/ui/internal/exported/util/widget/component/getorcreate/AbstractGetOrCreateElementWidget.java new file mode 100644 index 0000000..357a998 --- /dev/null +++ b/org.eclipse.modisco.facet.util.ui/src/org/eclipse/modisco/facet/util/ui/internal/exported/util/widget/component/getorcreate/AbstractGetOrCreateElementWidget.java
@@ -0,0 +1,168 @@ +/** + * Copyright (c) 2012 Mia-Software. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Alban Ménager (Soft-Maint) - Bug 387470 - [EFacet][Custom] Editors + * Grégoire Dupé (Mia-Software) - Bug 387470 - [EFacet][Custom] Editors + */ +package org.eclipse.modisco.facet.util.ui.internal.exported.util.widget.component.getorcreate; + +import org.eclipse.modisco.facet.util.ui.internal.exported.PropertyElement2; +import org.eclipse.modisco.facet.util.ui.internal.exported.util.widget.AbstractWidget; +import org.eclipse.modisco.facet.util.ui.internal.exported.util.widget.component.properties.name.AbstractGetElementNameWidget; +import org.eclipse.modisco.facet.util.ui.internal.exported.widget.getorcreate.IAbstractGetOrCreateElementWidget; +import org.eclipse.modisco.facet.util.ui.utils.UIUtils; +import org.eclipse.swt.events.ModifyEvent; +import org.eclipse.swt.events.ModifyListener; +import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Text; + +/** + * Abstract class for the creation of a composite that allows the selection or + * creation of an element. Classes implementing this class must overrides + * {@link #getSubWidgets()} method. This class prepare the composite for + * {@link #COLUMN_NUMBER} subComposites and provide the method + * {@link #createTextField(boolean)} for the creation of a textField area. + * + * @see AbstractGetOrCreateElementWithButtonWidget + * @see AbstractGetElementNameWidget + * @since 0.3 + */ +public abstract class AbstractGetOrCreateElementWidget<T extends Object> + extends AbstractWidget + implements IAbstractGetOrCreateElementWidget { + + /** + * The number of columns of this composite. + */ + public static final int COLUMN_NUMBER = 3; + private PropertyElement2<T> propertyElement; + private Text text; + + /** + * Constructor. Initialize the composite with a layout of + * {@value #COLUMN_NUMBER} columns. + * + * @param parent + * the parent containing this composite. + * @param style + * the style of the composite. + * @param editingDomain + * the current editing domain. + * @param propertyElement + * the property element that this composite will edit. + */ + protected AbstractGetOrCreateElementWidget(final Composite parent, + final PropertyElement2<T> propertyElement) { + super(parent); + this.propertyElement = propertyElement; + this.setLayout(new GridLayout(COLUMN_NUMBER, false)); + } + + /** + * @return the property element. + */ + public final PropertyElement2<T> getPropertyElement() { + return this.propertyElement; + } + + public Text getTextField() { + return this.text; + } + + /** + * Create the text field in the composite.</p> If the property + * {@link #propertyElement} has a value, the field is not editable. + * + * @param enabled + * set if the field must be editable or not. + */ + protected void createTextField(final boolean enabled) { + ModifyListener modifyListener = null; + if (enabled) { + modifyListener = new ModifyListener() { + + public void modifyText(final ModifyEvent event) { + onTextModfified(); + } + }; + } + String initialText = ""; //$NON-NLS-1$ + if ((this.propertyElement.getValue() != null) + && (getTextFieldInitialText() != null)) { + initialText = getTextFieldInitialText(); + } + this.text = UIUtils.createTextField(this, initialText, enabled, + modifyListener); + fireChanged(); + } + + protected void onTextModfified() { + this.propertyElement.setValue(this.text.getText().toString()); + onFieldEdited(); + } + + /** + * Execute an action when the text field is edited. If not override, nothing + * appends. Can be override if needed. + */ + protected void onFieldEdited() { + fireChanged(); + } + + /** + * @return the initial text of the textField of this composite. Null or void + * if no text has to be displayed. + */ + protected String getTextFieldInitialText() { + String result = ""; //$NON-NLS-1$ + final Object value = this.getPropertyElement().getValue(); + if (value != null) { + result = value.toString(); + } + return result; + } + + @Override + public String getError() { + String error = null; + final Object value = this.propertyElement.getValue(); + if (value == null && !this.propertyElement.isCanBeNull()) { + error = getErrorMessage(); + } + return error; + } + + /** + * @return the error message if the {@link #propertyElement} is not edited. + * Return 'null' if no error can be returned. + */ + protected abstract String getErrorMessage(); + + /** + * @param propertyElement + * the propertyElement to set + */ + public void setPropertyElement(final PropertyElement2<T> propertyElement) { + this.propertyElement = propertyElement; + } + + public T getElement() { + return getPropertyElement().getValue2(); + } + + public String getText() { + return this.text.getText(); + } + + public void setText(final String text) { + this.text.setText(text); + } + +}
diff --git a/org.eclipse.modisco.facet.util.ui/src/org/eclipse/modisco/facet/util/ui/internal/exported/util/widget/component/getorcreate/AbstractGetOrCreateElementWithButtonWidget.java b/org.eclipse.modisco.facet.util.ui/src/org/eclipse/modisco/facet/util/ui/internal/exported/util/widget/component/getorcreate/AbstractGetOrCreateElementWithButtonWidget.java new file mode 100644 index 0000000..6d71797 --- /dev/null +++ b/org.eclipse.modisco.facet.util.ui/src/org/eclipse/modisco/facet/util/ui/internal/exported/util/widget/component/getorcreate/AbstractGetOrCreateElementWithButtonWidget.java
@@ -0,0 +1,120 @@ +/** + * Copyright (c) 2012 Mia-Software. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Alban Ménager (Soft-Maint) - Bug 387470 - [EFacet][Custom] Editors + * Grégoire Dupé (Mia-Software) - Bug 387470 - [EFacet][Custom] Editors + */ +package org.eclipse.modisco.facet.util.ui.internal.exported.util.widget.component.getorcreate; + +import org.eclipse.modisco.facet.util.ui.internal.exported.PropertyElement2; +import org.eclipse.modisco.facet.util.ui.internal.exported.widget.getorcreate.IAbstractGetOrCreateElementWithButtonWidget; +import org.eclipse.modisco.facet.util.ui.utils.UIUtils; +import org.eclipse.swt.events.SelectionEvent; +import org.eclipse.swt.events.SelectionListener; +import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.widgets.Button; +import org.eclipse.swt.widgets.Composite; + +/** + * Provide all the necessary for the creation of a composite that have: </p> + * + * Label : [ textField ][...] </p> + * + * The button will execute {@link #openDialog()} method when pressed. </p> + * + * The {@link #getLabel()} method have to be override and provide the label of + * the 'Label'. + * + * @see GetOrCreateFacetSetWidget + * @see GetOrCreateFacetWidget + * @see GetOrCreateOperationWidget + * @since 0.3 + */ +public abstract class AbstractGetOrCreateElementWithButtonWidget<T extends Object, D extends Object> + extends AbstractGetOrCreateElementWidget<T> implements + IAbstractGetOrCreateElementWithButtonWidget<D> { + + private Button button; + private boolean buttonEnabled; + + /** + * Constructor. + * + * @param parent + * the parent of this composite. + * @param editingDomain + * the current editing domain. + * @param propertyElement + * the property element that be edited with this composite. + */ + protected AbstractGetOrCreateElementWithButtonWidget( + final Composite parent, + final PropertyElement2<T> propertyElement) { + super(parent, propertyElement); + this.setPropertyElement(propertyElement); + this.setLayout(new GridLayout(COLUMN_NUMBER, false)); + this.buttonEnabled = propertyElement.isChangeable(); + } + + @Override + protected void addSubWidgets() { + if ((getLabel() != null) && !"".equals(getLabel())) { //$NON-NLS-1$ + UIUtils.createLabel(this, getLabel()); + } + createTextField(false); + createButton(); + } + + public void setButtonEnabled(final boolean buttonEnabled) { + this.buttonEnabled = buttonEnabled; + this.button.setEnabled(this.buttonEnabled); + } + + /** + * Create a button [...]. When pressed, the {@link #openDialog()} method is + * called. + */ + private void createButton() { + final SelectionListener selectionListener = new SelectionListener() { + + public void widgetSelected(final SelectionEvent selectionEvent) { + onButtonPressed(); + } + + public void widgetDefaultSelected( + final SelectionEvent selectionEvent) { + // Nothing. + } + }; + this.button = UIUtils.createButton(this, "...", this.buttonEnabled, //$NON-NLS-1$ + selectionListener); + } + + /** + * The method will be called when the button "..." is pressed. + */ + public abstract D onButtonPressed(); + + /** + * @return the label for this composite. If no label has to be displayed, + * null or void must be returned. + */ + protected abstract String getLabel(); + + /** + * @return the button + */ + public Button getButton() { + return this.button; + } + + public D pressButton() { + return onButtonPressed(); + } +}
diff --git a/org.eclipse.modisco.facet.util.ui/src/org/eclipse/modisco/facet/util/ui/internal/exported/util/widget/component/getorcreate/AbstractGetOrCreateElementWithDialogButtonWidget.java b/org.eclipse.modisco.facet.util.ui/src/org/eclipse/modisco/facet/util/ui/internal/exported/util/widget/component/getorcreate/AbstractGetOrCreateElementWithDialogButtonWidget.java new file mode 100644 index 0000000..9c119bb --- /dev/null +++ b/org.eclipse.modisco.facet.util.ui/src/org/eclipse/modisco/facet/util/ui/internal/exported/util/widget/component/getorcreate/AbstractGetOrCreateElementWithDialogButtonWidget.java
@@ -0,0 +1,89 @@ +/** + * Copyright (c) 2012 Mia-Software. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Alban Ménager (Soft-Maint) - Bug 387470 - [EFacet][Custom] Editors + * Grégoire Dupé (Mia-Software) - Bug 387470 - [EFacet][Custom] Editors + */ +package org.eclipse.modisco.facet.util.ui.internal.exported.util.widget.component.getorcreate; + +import org.eclipse.emf.ecore.ENamedElement; +import org.eclipse.modisco.facet.util.ui.internal.exported.PropertyElement2; +import org.eclipse.modisco.facet.util.ui.internal.exported.dialog.IDialog; +import org.eclipse.modisco.facet.util.ui.internal.exported.dialog.IWithResultDialogCallback; +import org.eclipse.modisco.facet.util.ui.internal.exported.util.dialog.SynchronizedAbstractDialog; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Display; +import org.eclipse.swt.widgets.Text; + +/** + * Has the same goal than {@link AbstractGetOrCreateElementWithButtonWidget} but + * especially for dialogs. + * + * @since 0.3 + */ +public abstract class AbstractGetOrCreateElementWithDialogButtonWidget<T extends ENamedElement, W extends Object> + extends AbstractGetOrCreateElementWithButtonWidget<T, IDialog<W>> { + + protected AbstractGetOrCreateElementWithDialogButtonWidget( + final Composite parent, + final PropertyElement2<T> propertyElement) { + super(parent, propertyElement); + } + + @Override + public IDialog<W> onButtonPressed() { + final IWithResultDialogCallback<T> callback = new IWithResultDialogCallback<T>() { + public void commited(final T result) { + onCommited(result); + } + public void canceled(final T result) { + onCanceled(); + } + }; + final IDialog<W> dialog = getCreationDialog(callback); + Display.getDefault().asyncExec(new Runnable() { + public void run() { + dialog.open(); + } + }); + return createSynchronizedDialog(dialog); + } + + protected final void onCommited(final T result) { + this.getPropertyElement().setValue2(result); + final String name = result.getName(); + final Text textField = this.getTextField(); + textField.setText(name); + } + + /** + * Action to do when the dialog opened with the button "..." is closed with + * the "Cancel" button. + */ + protected abstract void onCanceled(); + + /** + * Create and return the dialog that will be display when the [...] button + * is pressed. + * + * @return the dialog. + */ + protected abstract IDialog<W> getCreationDialog( + final IWithResultDialogCallback<T> callback); + + /** + * Create the synchronized dialog for the selection of the type. + * + * @return the dialog. + */ + private IDialog<W> createSynchronizedDialog(final IDialog<W> dialog) { + return new SynchronizedAbstractDialog<W>(dialog, this.getDisplay()); + } + +}
diff --git a/org.eclipse.modisco.facet.util.ui/src/org/eclipse/modisco/facet/util/ui/internal/exported/util/widget/component/getorcreate/AbstractGetOrCreateElementWithWizardButtonWidget.java b/org.eclipse.modisco.facet.util.ui/src/org/eclipse/modisco/facet/util/ui/internal/exported/util/widget/component/getorcreate/AbstractGetOrCreateElementWithWizardButtonWidget.java new file mode 100644 index 0000000..475e16d --- /dev/null +++ b/org.eclipse.modisco.facet.util.ui/src/org/eclipse/modisco/facet/util/ui/internal/exported/util/widget/component/getorcreate/AbstractGetOrCreateElementWithWizardButtonWidget.java
@@ -0,0 +1,85 @@ +/** + * Copyright (c) 2012 Mia-Software. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Alban Ménager (Soft-Maint) - Bug 387470 - [EFacet][Custom] Editors + * Grégoire Dupé (Mia-Software) - Bug 387470 - [EFacet][Custom] Editors + */ +package org.eclipse.modisco.facet.util.ui.internal.exported.util.widget.component.getorcreate; + +import org.eclipse.jface.window.Window; +import org.eclipse.modisco.facet.util.ui.internal.exported.PropertyElement2; +import org.eclipse.modisco.facet.util.ui.internal.exported.wizard.IExtendedWizard; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Display; + +/** + * Has the same goal than {@link AbstractGetOrCreateElementWithButtonWidget} but + * especially for dialogs. + * + * @since 0.3 + */ +public abstract class AbstractGetOrCreateElementWithWizardButtonWidget<T extends Object, W extends IExtendedWizard> + extends AbstractGetOrCreateElementWithButtonWidget<T, W> { + + /** + * @since 1.0 + */ + protected AbstractGetOrCreateElementWithWizardButtonWidget( + final Composite parent, + final PropertyElement2<T> propertyElement) { + super(parent, propertyElement); + } + + @Override + public W onButtonPressed() { + final W wizard = createIWizard(); + Display.getDefault().asyncExec(new Runnable() { + public void run() { + final int openResult = wizard.open(); + // TODO The wizard closing events must be cached by the use of + // call back pattern. The use of this pattern must be done in + // the subclass of this class, like in + // org.eclipse.emf.facet.util.ui.internal.exported.util.widget.component.getorcreate.AbstractGetOrCreateElementWithWizardButtonWidget<ETypedElement> + // The following if statement and the methods 'onWizardCommited' + // 'onWizardCanceled' must be removed (replaced by the use of + // call backs) + if (openResult == Window.OK) { + onWizardCommited(wizard); + } else { + onWizardCanceled(); + } + } + }); + return createSynchronizedWizard(wizard); + } + + /** + * Create the wizard for the selection of the type. + * + * @return the wizard. + */ + protected abstract W createIWizard(); + + /** + * Action to do when the dialog opened with the button "..." is closed with + * the "Ok" button. + * + * @param selectETypeDialog + */ + protected abstract void onWizardCommited(W wizard); + + /** + * Action to do when the dialog opened with the button "..." is closed with + * the "Cancel" button. + */ + protected abstract void onWizardCanceled(); + + protected abstract W createSynchronizedWizard(final W wizard); + +}
diff --git a/org.eclipse.modisco.facet.util.ui/src/org/eclipse/modisco/facet/util/ui/internal/exported/util/widget/component/properties/AbstractGetPropertyWidget.java b/org.eclipse.modisco.facet.util.ui/src/org/eclipse/modisco/facet/util/ui/internal/exported/util/widget/component/properties/AbstractGetPropertyWidget.java new file mode 100644 index 0000000..d26c12d --- /dev/null +++ b/org.eclipse.modisco.facet.util.ui/src/org/eclipse/modisco/facet/util/ui/internal/exported/util/widget/component/properties/AbstractGetPropertyWidget.java
@@ -0,0 +1,159 @@ +/** + * Copyright (c) 2012 Mia-Software. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Alban Ménager (Soft-Maint) - Bug 387470 - [EFacet][Custom] Editors + */ +package org.eclipse.modisco.facet.util.ui.internal.exported.util.widget.component.properties; + +import org.eclipse.modisco.facet.util.ui.internal.exported.PropertyElement; +import org.eclipse.modisco.facet.util.ui.internal.exported.util.widget.AbstractWidget; +import org.eclipse.modisco.facet.util.ui.utils.UIUtils; +import org.eclipse.swt.SWT; +import org.eclipse.swt.events.SelectionEvent; +import org.eclipse.swt.events.SelectionListener; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.widgets.Button; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Label; + +/** + * This Abstract class provides all the elements to create:</p> + * + * Label : [x]</p> + * + * The label is set by {@link #getLabel()}. The checkbox is initialized with the + * {@link PropertyElement} attributes + * <nl> + * <li>{@link PropertyElement#getValue()} (the value of the property must be a + * boolean)</li> + * <li>{@link PropertyElement#isChangeable()}</li> + * </nl> + * + * The {@link #getError()} method return 'null' because no error can be returned + * (the value of the checkbox is 'true' or 'false'). + * + * @see GetChangeableWidget + * @see GetOrderedWidget + * @see GetDerivedWidget + * @see GetTransientWidget + * @see GetUniqueWidget + * @see GetVolatileWidget + * @since 0.3 + */ +public abstract class AbstractGetPropertyWidget extends AbstractWidget { + + private static final int COLUMN_NUMBER = 2; + private static final int WIDTH_HINT_DEF = 65; + private int labelWidthHint; + private final PropertyElement propertyElement; + private Button propertyButton; + + /** + * Constructor. Initialize the composite with a layout of + * {@value #COLUMN_NUMBER} columns and the layoutData with the + * 'fillGridData' attribute of {@link AbstractWidget}. + * + * @param parent + * the parent containing this composite. + * @param style + * the style of the composite. + * @param editingDomain + * the current editing domain. + * @param propertyElement + * the property element that this composite will edit. + * + * @see AbstractWidget + */ + protected AbstractGetPropertyWidget(final Composite parent, + final PropertyElement propertyElement) { + super(parent); + this.propertyElement = propertyElement; + this.labelWidthHint = WIDTH_HINT_DEF; + this.setLayout(new GridLayout(COLUMN_NUMBER, false)); + this.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); + } + + @Override + protected void addSubWidgets() { + if ((getLabel() != null) && !"".equals(getLabel())) { //$NON-NLS-1$ + final Label label = UIUtils.createLabel(this, getLabel()); + final GridData layoutData = new GridData(SWT.FILL); + layoutData.widthHint = this.labelWidthHint; + label.setLayoutData(layoutData); + label.setEnabled(this.propertyElement.isChangeable()); + } + createCheckbox(); + } + + public void setPropertyEnabled(final boolean enabled) { + this.propertyButton.setSelection(enabled); + } + + /** + * Create a checkbox initialized with the {@link PropertyElement} attributes + * <nl> + * <li>Default value : {@link PropertyElement#getValue()} (the value of the + * property must be a boolean)</li> + * <li>Enabled : {@link PropertyElement#isChangeable()}</li> + * </nl> + */ + private void createCheckbox() { + if (this.propertyElement.getValue() == null) { + this.propertyElement.setValue(Boolean.TRUE); + } + SelectionListener selectionListener = null; + if (this.propertyElement.isChangeable()) { + selectionListener = new SelectionListener() { + + public void widgetSelected(final SelectionEvent event) { + onSelection((Button) event.getSource()); + } + + public void widgetDefaultSelected(final SelectionEvent event) { + // Nothing. + } + }; + } + this.propertyButton = UIUtils.createCheckbox(this, + this.propertyElement.isChangeable(), + ((Boolean) this.propertyElement.getValue()).booleanValue(), + selectionListener); + } + + /** + * @param source + */ + protected void onSelection(final Button source) { + this.propertyElement.setValue(Boolean.valueOf(source.getSelection())); + } + + /** + * @return the label of the label field. If no label has to be displayed, + * null or void must be returned. + */ + protected abstract String getLabel(); + + /** + * Method to change the distance between the label and the checkbox. + * + * @param lABEL_WIDTH_HINT + * the lABEL_WIDTH_HINT to set + */ + public void setLabelWidthHint(final int labelWidthHint) { + this.labelWidthHint = labelWidthHint; + } + + /** + * @return the value of the property. + */ + public boolean isSelected() { + return this.propertyButton.getSelection(); + } +}
diff --git a/org.eclipse.modisco.facet.util.ui/src/org/eclipse/modisco/facet/util/ui/internal/exported/util/widget/component/properties/bounds/AbstractGetBoundsWidget.java b/org.eclipse.modisco.facet.util.ui/src/org/eclipse/modisco/facet/util/ui/internal/exported/util/widget/component/properties/bounds/AbstractGetBoundsWidget.java new file mode 100644 index 0000000..f2da398 --- /dev/null +++ b/org.eclipse.modisco.facet.util.ui/src/org/eclipse/modisco/facet/util/ui/internal/exported/util/widget/component/properties/bounds/AbstractGetBoundsWidget.java
@@ -0,0 +1,127 @@ +/** + * Copyright (c) 2012 Mia-Software. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Alban Ménager (Soft-Maint) - Bug 387470 - [EFacet][Custom] Editors + * Grégoire Dupé (Mia-Software) - Bug 387470 - [EFacet][Custom] Editors + */ +package org.eclipse.modisco.facet.util.ui.internal.exported.util.widget.component.properties.bounds; + +import org.eclipse.modisco.facet.util.ui.internal.exported.PropertyElement; +import org.eclipse.modisco.facet.util.ui.internal.exported.PropertyElement2; +import org.eclipse.modisco.facet.util.ui.internal.exported.util.widget.AbstractWidget; +import org.eclipse.modisco.facet.util.ui.utils.UIUtils; +import org.eclipse.swt.events.ModifyEvent; +import org.eclipse.swt.events.ModifyListener; +import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Spinner; + +/** + * This abstract class provide a simple way to create a composite for the + * edition of bounds. The {@link Spinner} composite is used for the edition of + * number.</p> + * + * No error is return because the default value is 0. + * + * @see Spinner + * @see GetUpperBoundWidget + * @see GetLowerBoundWidget + * @since 0.3 + */ +public abstract class AbstractGetBoundsWidget extends AbstractWidget { + + private static final int COLUMN_NUMBER = 3; + private static final int MAX_VALUE = Integer.MAX_VALUE; + private static final int MIN_VALUE = Integer.MIN_VALUE; + private static final int INCREMENT = 1; + + private final PropertyElement2<Integer> propertyElement; + private Spinner spinner; + + /** + * Constructor. Initialize the composite with a layout of + * {@value #COLUMN_NUMBER} columns. + * + * @param parent + * the parent containing this composite. + * @param style + * the style of the composite. + * @param editingDomain + * the current editing domain. + * @param propertyElement + * the property element that this composite will edit. + */ + protected AbstractGetBoundsWidget(final Composite parent, + final PropertyElement2<Integer> propertyElement) { + super(parent); + this.propertyElement = propertyElement; + this.setLayout(new GridLayout(COLUMN_NUMBER, false)); + } + + /** + * @return the propertyElement + */ + public PropertyElement getPropertyElement() { + return this.propertyElement; + } + + @Override + protected void addSubWidgets() { + if ((getLabel() != null) && !"".equals(getLabel())) { //$NON-NLS-1$ + UIUtils.createLabel(this, getLabel()); + } + createSpinner(); + } + + /** + * Creation of a spinner. + */ + private void createSpinner() { + // SPINNER + final ModifyListener modifyListener = new ModifyListener() { + public void modifyText(final ModifyEvent event) { + textModified(); + } + }; + this.spinner = UIUtils.createSpinner(this, MAX_VALUE, MIN_VALUE, + INCREMENT, this.propertyElement.isChangeable(), modifyListener); + final Integer value = this.propertyElement.getValue2(); + if (value != null) { + setBoundValue(value.intValue()); + } + } + + /** + * Method called when the text is modified. + */ + protected void textModified() { + getPropertyElement().setValue(Integer.valueOf(this.spinner.getText())); + } + + /** + * @return the label. If no label has to be displayed, null or void must be + * returned. + */ + protected abstract String getLabel(); + + /** + * Set the bound value. + * + * @param value + * the value to set. + */ + public void setBoundValue(final int value) { + this.spinner.setSelection(value); + } + + public int getBoundValue() { + final String text = this.spinner.getText(); + return Integer.parseInt(text); + } +}
diff --git a/org.eclipse.modisco.facet.util.ui/src/org/eclipse/modisco/facet/util/ui/internal/exported/util/widget/component/properties/name/AbstractGetElementNameWidget.java b/org.eclipse.modisco.facet.util.ui/src/org/eclipse/modisco/facet/util/ui/internal/exported/util/widget/component/properties/name/AbstractGetElementNameWidget.java new file mode 100644 index 0000000..ce74e99 --- /dev/null +++ b/org.eclipse.modisco.facet.util.ui/src/org/eclipse/modisco/facet/util/ui/internal/exported/util/widget/component/properties/name/AbstractGetElementNameWidget.java
@@ -0,0 +1,86 @@ +/** + * Copyright (c) 2012 Mia-Software. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Alban Ménager (Soft-Maint) - Bug 387470 - [EFacet][Custom] Editors + * Grégoire Dupé (Mia-Software) - Bug 387470 - [EFacet][Custom] Editors + */ +package org.eclipse.modisco.facet.util.ui.internal.exported.util.widget.component.properties.name; + +import org.eclipse.modisco.facet.util.ui.internal.exported.PropertyElement; +import org.eclipse.modisco.facet.util.ui.internal.exported.PropertyElement2; +import org.eclipse.modisco.facet.util.ui.internal.exported.util.widget.component.getorcreate.AbstractGetOrCreateElementWidget; +import org.eclipse.modisco.facet.util.ui.utils.UIUtils; +import org.eclipse.swt.widgets.Composite; + +/** + * This abstract class provide the creation of:</p> + * + * Label : [ TextFiled ]</p> + * + * Where the label is getted by {@link #getLabel()}. The TextField will set the + * value of the {@link PropertyElement} when edited. If the field is not setted, + * an error will be displayed at the top of the dialog when the 'ok' button is + * pressed. + * + * @see GetAttributeNameWidget + * @see GetFacetNameWidget + * @see GetFacetSetNameWidget + * @see GetOperationNameWidget + * @see GetReferenceNameWidget + * @see GetQueryNameWidget + * @since 0.3 + */ +public abstract class AbstractGetElementNameWidget extends + AbstractGetOrCreateElementWidget<String> { + + /** + * Constructor. + * + * @param parent + * the parent of this composite. + * @param editingDomain + * the current editing domain. + * @param propertyElement + * the property element that be edited with this composite. + */ + protected AbstractGetElementNameWidget(final Composite parent, + final PropertyElement2<String> propertyElement) { + super(parent, propertyElement); + } + + @Override + protected void addSubWidgets() { + if ((getLabel() != null) && !"".equals(getLabel())) { //$NON-NLS-1$ + UIUtils.createLabel(this, getLabel()); + } + createTextField(this.getPropertyElement().isChangeable()); + } + + /** + * @return the label for this composite. If no label has to be displayed, + * null or empty string must be returned. + */ + protected abstract String getLabel(); + + @Override + public String getError() { + String result = null; + final String elementName = this.getPropertyElement().getValue2(); + if ((elementName == null) || "".equals(elementName)) { //$NON-NLS-1$ + result = getErrorMessage(); + } + return result; + } + + /** + * @return the error message. + */ + @Override + protected abstract String getErrorMessage(); +}
diff --git a/org.eclipse.modisco.facet.util.ui/src/org/eclipse/modisco/facet/util/ui/internal/exported/util/widget/component/properties/name/AbstractPrintElementWidget.java b/org.eclipse.modisco.facet.util.ui/src/org/eclipse/modisco/facet/util/ui/internal/exported/util/widget/component/properties/name/AbstractPrintElementWidget.java new file mode 100644 index 0000000..6d06f25 --- /dev/null +++ b/org.eclipse.modisco.facet.util.ui/src/org/eclipse/modisco/facet/util/ui/internal/exported/util/widget/component/properties/name/AbstractPrintElementWidget.java
@@ -0,0 +1,60 @@ +/** + * Copyright (c) 2012 Mia-Software. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Alban Ménager (Soft-Maint) - Bug 387470 - [EFacet][Custom] Editors + * Grégoire Dupé (Mia-Software) - Bug 387470 - [EFacet][Custom] Editors + */ +package org.eclipse.modisco.facet.util.ui.internal.exported.util.widget.component.properties.name; + +import org.eclipse.modisco.facet.util.ui.internal.exported.PropertyElement2; +import org.eclipse.modisco.facet.util.ui.internal.exported.util.widget.component.getorcreate.AbstractGetOrCreateElementWidget; +import org.eclipse.modisco.facet.util.ui.utils.UIUtils; +import org.eclipse.swt.widgets.Composite; + +/** + * This abstract class provide the creation of:</p> + * + * Label : [//TextFiled//]</p> + * + * Where the label is getted by {@link #getLabel()}. The textField is disabled + * an initializated with the value of the {@link #getTextFieldInitialText()}. + * + * @since 0.3 + */ +public abstract class AbstractPrintElementWidget<T extends Object> extends + AbstractGetOrCreateElementWidget<T> { + + /** + * Constructor. + * + * @param parent + * the parent of this composite. + * @param editingDomain + * the current editing domain. + * @since 1.0 + */ + protected AbstractPrintElementWidget(final Composite parent, + final PropertyElement2<T> propertyElement) { + super(parent, propertyElement); + } + + @Override + protected void addSubWidgets() { + if ((getLabel() != null) && !"".equals(getLabel())) { //$NON-NLS-1$ + UIUtils.createLabel(this, getLabel()); + } + createTextField(false); + } + + /** + * @return the label for this composite. If no label has to be displayed, + * null or void must be returned. + */ + protected abstract String getLabel(); +}
diff --git a/org.eclipse.modisco.facet.util.ui/src/org/eclipse/modisco/facet/util/ui/internal/exported/util/widget/query/AbstractQueryWidget.java b/org.eclipse.modisco.facet.util.ui/src/org/eclipse/modisco/facet/util/ui/internal/exported/util/widget/query/AbstractQueryWidget.java new file mode 100644 index 0000000..28108c5 --- /dev/null +++ b/org.eclipse.modisco.facet.util.ui/src/org/eclipse/modisco/facet/util/ui/internal/exported/util/widget/query/AbstractQueryWidget.java
@@ -0,0 +1,40 @@ +/** + * Copyright (c) 2012 Mia-Software. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Alban Ménager (Soft-Maint) - Bug 387470 - [EFacet][Custom] Editors + * Grégoire Dupé (Mia-Software) - Bug 387470 - [EFacet][Custom] Editors + */ +package org.eclipse.modisco.facet.util.ui.internal.exported.util.widget.query; + +import org.eclipse.modisco.facet.util.ui.internal.exported.util.widget.command.AbstractCommandWidget; +import org.eclipse.swt.widgets.Composite; + +/** + * This abstract class must be used by the plug-ins extending this plug-in. It + * provides a simple way to create the widget for the edition of the query. + * + * @since 0.3 + */ +public abstract class AbstractQueryWidget<P extends Object> extends + AbstractCommandWidget { + + /** + * Constructor. + * + * @param parent + * the parent of this widget. + * @param editingDomain + * the current editing domain. + * @param properties + * the properties. + */ + protected AbstractQueryWidget(final Composite parent) { + super(parent); + } +}
diff --git a/org.eclipse.modisco.facet.util.ui/src/org/eclipse/modisco/facet/util/ui/internal/exported/util/wizard/SynchronizedWizard.java b/org.eclipse.modisco.facet.util.ui/src/org/eclipse/modisco/facet/util/ui/internal/exported/util/wizard/SynchronizedWizard.java new file mode 100644 index 0000000..65055a6 --- /dev/null +++ b/org.eclipse.modisco.facet.util.ui/src/org/eclipse/modisco/facet/util/ui/internal/exported/util/wizard/SynchronizedWizard.java
@@ -0,0 +1,314 @@ +/** + * Copyright (c) 2012 Mia-Software. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Alban Ménager (Soft-Maint) - Bug 387470 - [EFacet][Custom] Editors + */ +package org.eclipse.modisco.facet.util.ui.internal.exported.util.wizard; + +import org.eclipse.jface.dialogs.IDialogSettings; +import org.eclipse.jface.wizard.IWizardContainer; +import org.eclipse.jface.wizard.IWizardPage; +import org.eclipse.modisco.facet.util.ui.internal.exported.displaysync.AbstractExceptionFreeRunnable; +import org.eclipse.modisco.facet.util.ui.internal.exported.displaysync.AbstractVoidExceptionFreeRunnable; +import org.eclipse.modisco.facet.util.ui.internal.exported.displaysync.SynchronizedObject; +import org.eclipse.modisco.facet.util.ui.internal.exported.wizard.IExtendedWizard; +import org.eclipse.swt.graphics.Image; +import org.eclipse.swt.graphics.RGB; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Display; + +/** + * Synchronized class for safe run. + * + * @see WizardFactoryImpl + * @since 0.3 + */ +public class SynchronizedWizard<T extends IExtendedWizard> extends + SynchronizedObject<T> implements IExtendedWizard { + + /** + * Constructor. + * + * @param object + * the to synchronized. + * @param display + * the display. + */ + public SynchronizedWizard(final T object, final Display display) { + super(object, display); + } + + public int open() { + return this.safeSyncExec(new AbstractExceptionFreeRunnable<Integer>() { + @Override + public Integer safeRun() { + return Integer.valueOf(SynchronizedWizard.this + .getSynchronizedObject().open()); + } + }).intValue(); + } + + public IWizardPage getCurrentPage() { + return this + .safeSyncExec(new AbstractExceptionFreeRunnable<IWizardPage>() { + @Override + public IWizardPage safeRun() { + return SynchronizedWizard.this.getSynchronizedObject() + .getCurrentPage(); + } + }); + } + + public IWizardPage next() { + return this + .safeSyncExec(new AbstractExceptionFreeRunnable<IWizardPage>() { + @Override + public IWizardPage safeRun() { + return SynchronizedWizard.this.getSynchronizedObject() + .next(); + } + }); + } + + public IWizardPage previous() { + return this + .safeSyncExec(new AbstractExceptionFreeRunnable<IWizardPage>() { + @Override + public IWizardPage safeRun() { + return SynchronizedWizard.this.getSynchronizedObject() + .previous(); + } + }); + } + + public boolean finish() { + return this.safeSyncExec(new AbstractExceptionFreeRunnable<Boolean>() { + @Override + public Boolean safeRun() { + return Boolean.valueOf(SynchronizedWizard.this + .getSynchronizedObject().finish()); + } + }).booleanValue(); + } + + public void addPages() { + this.voidExceptionFreeRunnable(new AbstractVoidExceptionFreeRunnable() { + @Override + public void voidSafeRun() { + SynchronizedWizard.this.getSynchronizedObject().addPages(); + } + }); + } + + public boolean canFinish() { + return this.safeSyncExec(new AbstractExceptionFreeRunnable<Boolean>() { + @Override + public Boolean safeRun() { + return Boolean.valueOf(SynchronizedWizard.this + .getSynchronizedObject().canFinish()); + } + }).booleanValue(); + } + + public void createPageControls(final Composite pageContainer) { + this.voidExceptionFreeRunnable(new AbstractVoidExceptionFreeRunnable() { + @Override + public void voidSafeRun() { + SynchronizedWizard.this.getSynchronizedObject() + .createPageControls(pageContainer); + } + }); + } + + public void dispose() { + this.voidExceptionFreeRunnable(new AbstractVoidExceptionFreeRunnable() { + @Override + public void voidSafeRun() { + SynchronizedWizard.this.getSynchronizedObject().dispose(); + } + }); + } + + public IWizardContainer getContainer() { + return this + .safeSyncExec(new AbstractExceptionFreeRunnable<IWizardContainer>() { + @Override + public IWizardContainer safeRun() { + return SynchronizedWizard.this.getSynchronizedObject() + .getContainer(); + } + }); + } + + public Image getDefaultPageImage() { + return this.safeSyncExec(new AbstractExceptionFreeRunnable<Image>() { + @Override + public Image safeRun() { + return SynchronizedWizard.this.getSynchronizedObject() + .getDefaultPageImage(); + } + }); + } + + public IDialogSettings getDialogSettings() { + return this + .safeSyncExec(new AbstractExceptionFreeRunnable<IDialogSettings>() { + @Override + public IDialogSettings safeRun() { + return SynchronizedWizard.this.getSynchronizedObject() + .getDialogSettings(); + } + }); + } + + public IWizardPage getNextPage(final IWizardPage page) { + return this + .safeSyncExec(new AbstractExceptionFreeRunnable<IWizardPage>() { + @Override + public IWizardPage safeRun() { + return SynchronizedWizard.this.getSynchronizedObject() + .getNextPage(page); + } + }); + } + + public IWizardPage getPage(final String pageName) { + return this + .safeSyncExec(new AbstractExceptionFreeRunnable<IWizardPage>() { + @Override + public IWizardPage safeRun() { + return SynchronizedWizard.this.getSynchronizedObject() + .getPage(pageName); + } + }); + } + + public int getPageCount() { + return this.safeSyncExec(new AbstractExceptionFreeRunnable<Integer>() { + @Override + public Integer safeRun() { + return Integer.valueOf(SynchronizedWizard.this + .getSynchronizedObject().getPageCount()); + } + }).intValue(); + } + + public IWizardPage[] getPages() { + return this + .safeSyncExec(new AbstractExceptionFreeRunnable<IWizardPage[]>() { + @Override + public IWizardPage[] safeRun() { + return SynchronizedWizard.this.getSynchronizedObject() + .getPages(); + } + }); + } + + public IWizardPage getPreviousPage(final IWizardPage page) { + return this + .safeSyncExec(new AbstractExceptionFreeRunnable<IWizardPage>() { + @Override + public IWizardPage safeRun() { + return SynchronizedWizard.this.getSynchronizedObject() + .getPreviousPage(page); + } + }); + } + + public IWizardPage getStartingPage() { + return this + .safeSyncExec(new AbstractExceptionFreeRunnable<IWizardPage>() { + @Override + public IWizardPage safeRun() { + return SynchronizedWizard.this.getSynchronizedObject() + .getStartingPage(); + } + }); + } + + public RGB getTitleBarColor() { + return this.safeSyncExec(new AbstractExceptionFreeRunnable<RGB>() { + @Override + public RGB safeRun() { + return SynchronizedWizard.this.getSynchronizedObject() + .getTitleBarColor(); + } + }); + } + + public String getWindowTitle() { + return this.safeSyncExec(new AbstractExceptionFreeRunnable<String>() { + @Override + public String safeRun() { + return SynchronizedWizard.this.getSynchronizedObject() + .getWindowTitle(); + } + }); + } + + public boolean isHelpAvailable() { + return this.safeSyncExec(new AbstractExceptionFreeRunnable<Boolean>() { + @Override + public Boolean safeRun() { + return Boolean.valueOf(SynchronizedWizard.this + .getSynchronizedObject().isHelpAvailable()); + } + }).booleanValue(); + } + + public boolean needsPreviousAndNextButtons() { + return this.safeSyncExec(new AbstractExceptionFreeRunnable<Boolean>() { + @Override + public Boolean safeRun() { + return Boolean.valueOf(SynchronizedWizard.this + .getSynchronizedObject().needsPreviousAndNextButtons()); + } + }).booleanValue(); + } + + public boolean needsProgressMonitor() { + return this.safeSyncExec(new AbstractExceptionFreeRunnable<Boolean>() { + @Override + public Boolean safeRun() { + return Boolean.valueOf(SynchronizedWizard.this + .getSynchronizedObject().needsProgressMonitor()); + } + }).booleanValue(); + } + + public boolean performCancel() { + return this.safeSyncExec(new AbstractExceptionFreeRunnable<Boolean>() { + @Override + public Boolean safeRun() { + return Boolean.valueOf(SynchronizedWizard.this + .getSynchronizedObject().performCancel()); + } + }).booleanValue(); + } + + public boolean performFinish() { + return this.safeSyncExec(new AbstractExceptionFreeRunnable<Boolean>() { + @Override + public Boolean safeRun() { + return Boolean.valueOf(SynchronizedWizard.this + .getSynchronizedObject().performFinish()); + } + }).booleanValue(); + } + + public void setContainer(final IWizardContainer wizardContainer) { + this.voidExceptionFreeRunnable(new AbstractVoidExceptionFreeRunnable() { + @Override + public void voidSafeRun() { + SynchronizedWizard.this.getSynchronizedObject().setContainer( + wizardContainer); + } + }); + } +}
diff --git a/org.eclipse.modisco.facet.util.ui/src/org/eclipse/modisco/facet/util/ui/internal/exported/widget/IAbstractWidget.java b/org.eclipse.modisco.facet.util.ui/src/org/eclipse/modisco/facet/util/ui/internal/exported/widget/IAbstractWidget.java new file mode 100644 index 0000000..f0816d6 --- /dev/null +++ b/org.eclipse.modisco.facet.util.ui/src/org/eclipse/modisco/facet/util/ui/internal/exported/widget/IAbstractWidget.java
@@ -0,0 +1,56 @@ +/** + * Copyright (c) 2012 Mia-Software. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Alban Ménager (Soft-Maint) - Bug 387470 - [EFacet][Custom] Editors + * Grégoire Dupé (Mia-Software) - Bug 387470 - [EFacet][Custom] Editors + */ +package org.eclipse.modisco.facet.util.ui.internal.exported.widget; + +import org.eclipse.modisco.facet.util.ui.internal.exported.util.widget.AbstractWidget; + +/** + * + * @see AbstractWidget + * @since 0.3 + * @noextend This interface is not intended to be extended by clients. + * @noimplement This interface is not intended to be implemented by clients. + */ +public interface IAbstractWidget { + + /** + * Add the abstractWidget in parameter to the list of listeners of the + * widget. + * + * @param abstractWidget + * the abstractWidget to listen. + */ + void addListener(final AbstractWidget abstractWidget); + + /** + * When a change in a sub-widget append, this method is execute. If no + * action has to be done when a modification append, this method has to be + * void. + */ + void notifyChanged(); + + /** + * Create the content of the widget (call {@link #addSubWidgets()}) and + * sub-widgets. + */ + void createWidgetContent(); + + /** + * Return the string containing the error for this widget. + * + * @return null if there is no error. The string containing the error if + * there is an error. + */ + String getError(); + +} \ No newline at end of file
diff --git a/org.eclipse.modisco.facet.util.ui/src/org/eclipse/modisco/facet/util/ui/internal/exported/widget/getorcreate/IAbstractGetOrCreateElementWidget.java b/org.eclipse.modisco.facet.util.ui/src/org/eclipse/modisco/facet/util/ui/internal/exported/widget/getorcreate/IAbstractGetOrCreateElementWidget.java new file mode 100644 index 0000000..5b3c618 --- /dev/null +++ b/org.eclipse.modisco.facet.util.ui/src/org/eclipse/modisco/facet/util/ui/internal/exported/widget/getorcreate/IAbstractGetOrCreateElementWidget.java
@@ -0,0 +1,43 @@ +/** + * Copyright (c) 2012 Mia-Software. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Alban Ménager (Soft-Maint) - Bug 387470 - [EFacet][Custom] Editors + * Grégoire Dupé (Mia-Software) - Bug 387470 - [EFacet][Custom] Editors + */ +package org.eclipse.modisco.facet.util.ui.internal.exported.widget.getorcreate; + +import org.eclipse.modisco.facet.util.ui.internal.exported.util.widget.component.getorcreate.AbstractGetOrCreateElementWidget; +import org.eclipse.modisco.facet.util.ui.internal.exported.widget.IAbstractWidget; + + +/** + * Interface. + * + * + * @see AbstractGetOrCreateElementWidget + * @since 0.3 + * @noextend This interface is not intended to be extended by clients. + * @noimplement This interface is not intended to be implemented by clients. + */ +public interface IAbstractGetOrCreateElementWidget extends IAbstractWidget { + + /** + * @return the text field. + */ + String getText(); + + /** + * Set the text field. + * + * @param text + * the new text. + */ + void setText(String text); + +} \ No newline at end of file
diff --git a/org.eclipse.modisco.facet.util.ui/src/org/eclipse/modisco/facet/util/ui/internal/exported/widget/getorcreate/IAbstractGetOrCreateElementWithButtonWidget.java b/org.eclipse.modisco.facet.util.ui/src/org/eclipse/modisco/facet/util/ui/internal/exported/widget/getorcreate/IAbstractGetOrCreateElementWithButtonWidget.java new file mode 100644 index 0000000..959ce71 --- /dev/null +++ b/org.eclipse.modisco.facet.util.ui/src/org/eclipse/modisco/facet/util/ui/internal/exported/widget/getorcreate/IAbstractGetOrCreateElementWithButtonWidget.java
@@ -0,0 +1,41 @@ +/** + * Copyright (c) 2012 Mia-Software. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Alban Ménager (Soft-Maint) - Bug 387470 - [EFacet][Custom] Editors + * Grégoire Dupé (Mia-Software) - Bug 387470 - [EFacet][Custom] Editors + */ +package org.eclipse.modisco.facet.util.ui.internal.exported.widget.getorcreate; + +import org.eclipse.modisco.facet.util.ui.internal.exported.util.widget.component.getorcreate.AbstractGetOrCreateElementWithButtonWidget; + +/** + * @see AbstractGetOrCreateElementWithButtonWidget + * @since 0.3 + * @noextend This interface is not intended to be extended by clients. + * @noimplement This interface is not intended to be implemented by clients. + */ +public interface IAbstractGetOrCreateElementWithButtonWidget<D> + extends + IAbstractGetOrCreateElementWidget { + + /** + * @param buttonEnabled + * the buttonEnabled to set + */ + void setButtonEnabled(final boolean buttonEnabled); + + /** + * Press the button. + * + * @return the potential object return when the button is pressed. Can be + * null. + */ + D pressButton(); + +} \ No newline at end of file
diff --git a/org.eclipse.modisco.facet.util.ui/src/org/eclipse/modisco/facet/util/ui/internal/exported/wizard/IExtendedWizard.java b/org.eclipse.modisco.facet.util.ui/src/org/eclipse/modisco/facet/util/ui/internal/exported/wizard/IExtendedWizard.java new file mode 100644 index 0000000..243cac5 --- /dev/null +++ b/org.eclipse.modisco.facet.util.ui/src/org/eclipse/modisco/facet/util/ui/internal/exported/wizard/IExtendedWizard.java
@@ -0,0 +1,56 @@ +/** + * Copyright (c) 2012 Mia-Software. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Alban Ménager (Soft-Maint) - Bug 387470 - [EFacet][Custom] Editors + */ +package org.eclipse.modisco.facet.util.ui.internal.exported.wizard; + +import org.eclipse.jface.wizard.IWizard; +import org.eclipse.jface.wizard.IWizardPage; + +/** + * Interface for the facets wizards. + * + * @since 0.3 + */ +public interface IExtendedWizard extends IWizard { + + /** + * @return the current page of the wizard. + */ + IWizardPage getCurrentPage(); + + /** + * Simulate the action of pressing the next button. + * + * @return the next page. + */ + IWizardPage next(); + + /** + * Simulate the action of pressing the previous button. + * + * @return the previous page. + */ + IWizardPage previous(); + + /** + * Simulate the action of pressing the finish button. + * + * @return true if the wizard finish correctly. + */ + boolean finish(); + + /** + * Open the wizard. + * + * @return the return code when the wizard closes. + */ + int open(); +}
diff --git a/org.eclipse.modisco.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/messages.properties b/org.eclipse.modisco.facet.util.ui/src/org/eclipse/modisco/facet/util/ui/internal/messages.properties similarity index 100% rename from org.eclipse.modisco.facet.util.ui/src/org/eclipse/emf/facet/util/ui/internal/messages.properties rename to org.eclipse.modisco.facet.util.ui/src/org/eclipse/modisco/facet/util/ui/internal/messages.properties
diff --git a/org.eclipse.modisco.facet.util.ui/src/org/eclipse/modisco/facet/util/ui/internal/sync/generated/SynchronizedAbstractGetOrCreateElementWidget.java b/org.eclipse.modisco.facet.util.ui/src/org/eclipse/modisco/facet/util/ui/internal/sync/generated/SynchronizedAbstractGetOrCreateElementWidget.java new file mode 100644 index 0000000..77230e5 --- /dev/null +++ b/org.eclipse.modisco.facet.util.ui/src/org/eclipse/modisco/facet/util/ui/internal/sync/generated/SynchronizedAbstractGetOrCreateElementWidget.java
@@ -0,0 +1,92 @@ +/** + * Copyright (c) 2012 Mia-Software. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Grégoire Dupé (Mia-Software) - Bug 387470 - [EFacet][Custom] Editors + */ +package org.eclipse.modisco.facet.util.ui.internal.sync.generated; + +import org.eclipse.modisco.facet.util.ui.internal.exported.displaysync.AbstractExceptionFreeRunnable; +import org.eclipse.modisco.facet.util.ui.internal.exported.displaysync.AbstractVoidExceptionFreeRunnable; +import org.eclipse.modisco.facet.util.ui.internal.exported.displaysync.SynchronizedObject; +import org.eclipse.swt.widgets.Display; + +public class SynchronizedAbstractGetOrCreateElementWidget + extends + SynchronizedObject<org.eclipse.modisco.facet.util.ui.internal.exported.widget.getorcreate.IAbstractGetOrCreateElementWidget> + implements + org.eclipse.modisco.facet.util.ui.internal.exported.widget.getorcreate.IAbstractGetOrCreateElementWidget { + + public SynchronizedAbstractGetOrCreateElementWidget( + final org.eclipse.modisco.facet.util.ui.internal.exported.widget.getorcreate.IAbstractGetOrCreateElementWidget object, + final Display display) { + super(object, display); + } + + public final void addListener( + final org.eclipse.modisco.facet.util.ui.internal.exported.util.widget.AbstractWidget parm0) { + voidExceptionFreeRunnable(new AbstractVoidExceptionFreeRunnable() { + @Override + public void voidSafeRun() { + SynchronizedAbstractGetOrCreateElementWidget.this + .getSynchronizedObject().addListener(parm0); + } + }); + } + + public final void createWidgetContent() { + voidExceptionFreeRunnable(new AbstractVoidExceptionFreeRunnable() { + @Override + public void voidSafeRun() { + SynchronizedAbstractGetOrCreateElementWidget.this + .getSynchronizedObject().createWidgetContent(); + } + }); + } + + public final java.lang.String getError() { + return safeSyncExec(new AbstractExceptionFreeRunnable<java.lang.String>() { + @Override + public java.lang.String safeRun() { + return SynchronizedAbstractGetOrCreateElementWidget.this + .getSynchronizedObject().getError(); + } + }); + } + + public final void notifyChanged() { + voidExceptionFreeRunnable(new AbstractVoidExceptionFreeRunnable() { + @Override + public void voidSafeRun() { + SynchronizedAbstractGetOrCreateElementWidget.this + .getSynchronizedObject().notifyChanged(); + } + }); + } + + public final java.lang.String getText() { + return safeSyncExec(new AbstractExceptionFreeRunnable<java.lang.String>() { + @Override + public java.lang.String safeRun() { + return SynchronizedAbstractGetOrCreateElementWidget.this + .getSynchronizedObject().getText(); + } + }); + } + + public final void setText(final java.lang.String parm0) { + voidExceptionFreeRunnable(new AbstractVoidExceptionFreeRunnable() { + @Override + public void voidSafeRun() { + SynchronizedAbstractGetOrCreateElementWidget.this + .getSynchronizedObject().setText(parm0); + } + }); + } + +}
diff --git a/org.eclipse.modisco.facet.util.ui/src/org/eclipse/modisco/facet/util/ui/internal/sync/generated/SynchronizedAbstractGetOrCreateElementWithButtonWidget.java b/org.eclipse.modisco.facet.util.ui/src/org/eclipse/modisco/facet/util/ui/internal/sync/generated/SynchronizedAbstractGetOrCreateElementWithButtonWidget.java new file mode 100644 index 0000000..5c42dd7 --- /dev/null +++ b/org.eclipse.modisco.facet.util.ui/src/org/eclipse/modisco/facet/util/ui/internal/sync/generated/SynchronizedAbstractGetOrCreateElementWithButtonWidget.java
@@ -0,0 +1,112 @@ +/** + * Copyright (c) 2012 Mia-Software. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Grégoire Dupé (Mia-Software) - Bug 387470 - [EFacet][Custom] Editors + */ +package org.eclipse.modisco.facet.util.ui.internal.sync.generated; + +import org.eclipse.modisco.facet.util.ui.internal.exported.displaysync.AbstractExceptionFreeRunnable; +import org.eclipse.modisco.facet.util.ui.internal.exported.displaysync.AbstractVoidExceptionFreeRunnable; +import org.eclipse.modisco.facet.util.ui.internal.exported.displaysync.SynchronizedObject; +import org.eclipse.swt.widgets.Display; + +public class SynchronizedAbstractGetOrCreateElementWithButtonWidget<D extends java.lang.Object> + extends + SynchronizedObject<org.eclipse.modisco.facet.util.ui.internal.exported.widget.getorcreate.IAbstractGetOrCreateElementWithButtonWidget<D>> + implements + org.eclipse.modisco.facet.util.ui.internal.exported.widget.getorcreate.IAbstractGetOrCreateElementWithButtonWidget<D> { + + public SynchronizedAbstractGetOrCreateElementWithButtonWidget( + final org.eclipse.modisco.facet.util.ui.internal.exported.widget.getorcreate.IAbstractGetOrCreateElementWithButtonWidget<D> object, + final Display display) { + super(object, display); + } + + public final void addListener( + final org.eclipse.modisco.facet.util.ui.internal.exported.util.widget.AbstractWidget parm0) { + voidExceptionFreeRunnable(new AbstractVoidExceptionFreeRunnable() { + @Override + public void voidSafeRun() { + SynchronizedAbstractGetOrCreateElementWithButtonWidget.this + .getSynchronizedObject().addListener(parm0); + } + }); + } + + public final void createWidgetContent() { + voidExceptionFreeRunnable(new AbstractVoidExceptionFreeRunnable() { + @Override + public void voidSafeRun() { + SynchronizedAbstractGetOrCreateElementWithButtonWidget.this + .getSynchronizedObject().createWidgetContent(); + } + }); + } + + public final java.lang.String getError() { + return safeSyncExec(new AbstractExceptionFreeRunnable<java.lang.String>() { + @Override + public java.lang.String safeRun() { + return SynchronizedAbstractGetOrCreateElementWithButtonWidget.this + .getSynchronizedObject().getError(); + } + }); + } + + public final void notifyChanged() { + voidExceptionFreeRunnable(new AbstractVoidExceptionFreeRunnable() { + @Override + public void voidSafeRun() { + SynchronizedAbstractGetOrCreateElementWithButtonWidget.this + .getSynchronizedObject().notifyChanged(); + } + }); + } + + public final java.lang.String getText() { + return safeSyncExec(new AbstractExceptionFreeRunnable<java.lang.String>() { + @Override + public java.lang.String safeRun() { + return SynchronizedAbstractGetOrCreateElementWithButtonWidget.this + .getSynchronizedObject().getText(); + } + }); + } + + public final void setText(final java.lang.String parm0) { + voidExceptionFreeRunnable(new AbstractVoidExceptionFreeRunnable() { + @Override + public void voidSafeRun() { + SynchronizedAbstractGetOrCreateElementWithButtonWidget.this + .getSynchronizedObject().setText(parm0); + } + }); + } + + public final D pressButton() { + return safeSyncExec(new AbstractExceptionFreeRunnable<D>() { + @Override + public D safeRun() { + return SynchronizedAbstractGetOrCreateElementWithButtonWidget.this + .getSynchronizedObject().pressButton(); + } + }); + } + + public final void setButtonEnabled(final boolean parm0) { + voidExceptionFreeRunnable(new AbstractVoidExceptionFreeRunnable() { + @Override + public void voidSafeRun() { + SynchronizedAbstractGetOrCreateElementWithButtonWidget.this + .getSynchronizedObject().setButtonEnabled(parm0); + } + }); + } + +}
diff --git a/org.eclipse.modisco.facet.util.ui/src/org/eclipse/modisco/facet/util/ui/internal/sync/generated/SynchronizedGetOrCreateFilteredElementCommmandWidget.java b/org.eclipse.modisco.facet.util.ui/src/org/eclipse/modisco/facet/util/ui/internal/sync/generated/SynchronizedGetOrCreateFilteredElementCommmandWidget.java new file mode 100644 index 0000000..74095c1 --- /dev/null +++ b/org.eclipse.modisco.facet.util.ui/src/org/eclipse/modisco/facet/util/ui/internal/sync/generated/SynchronizedGetOrCreateFilteredElementCommmandWidget.java
@@ -0,0 +1,142 @@ +/** + * Copyright (c) 2012 Mia-Software. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Grégoire Dupé (Mia-Software) - Bug 387470 - [EFacet][Custom] Editors + */ +package org.eclipse.modisco.facet.util.ui.internal.sync.generated; + +import org.eclipse.modisco.facet.util.ui.internal.exported.displaysync.AbstractExceptionFreeRunnable; +import org.eclipse.modisco.facet.util.ui.internal.exported.displaysync.AbstractVoidExceptionFreeRunnable; +import org.eclipse.modisco.facet.util.ui.internal.exported.displaysync.SynchronizedObject; +import org.eclipse.swt.widgets.Display; + +public class SynchronizedGetOrCreateFilteredElementCommmandWidget<T extends java.lang.Object, W extends java.lang.Object> + extends + SynchronizedObject<org.eclipse.modisco.facet.util.ui.internal.exported.util.widget.command.IGetOrCreateFilteredElementCommmandWidget<T, W>> + implements + org.eclipse.modisco.facet.util.ui.internal.exported.util.widget.command.IGetOrCreateFilteredElementCommmandWidget<T, W> { + + public SynchronizedGetOrCreateFilteredElementCommmandWidget( + final org.eclipse.modisco.facet.util.ui.internal.exported.util.widget.command.IGetOrCreateFilteredElementCommmandWidget<T, W> object, + final Display display) { + super(object, display); + } + + public final void addListener( + final org.eclipse.modisco.facet.util.ui.internal.exported.util.widget.AbstractWidget parm0) { + voidExceptionFreeRunnable(new AbstractVoidExceptionFreeRunnable() { + @Override + public void voidSafeRun() { + SynchronizedGetOrCreateFilteredElementCommmandWidget.this + .getSynchronizedObject().addListener(parm0); + } + }); + } + + public final void createWidgetContent() { + voidExceptionFreeRunnable(new AbstractVoidExceptionFreeRunnable() { + @Override + public void voidSafeRun() { + SynchronizedGetOrCreateFilteredElementCommmandWidget.this + .getSynchronizedObject().createWidgetContent(); + } + }); + } + + public final java.lang.String getError() { + return safeSyncExec(new AbstractExceptionFreeRunnable<java.lang.String>() { + @Override + public java.lang.String safeRun() { + return SynchronizedGetOrCreateFilteredElementCommmandWidget.this + .getSynchronizedObject().getError(); + } + }); + } + + public final void notifyChanged() { + voidExceptionFreeRunnable(new AbstractVoidExceptionFreeRunnable() { + @Override + public void voidSafeRun() { + SynchronizedGetOrCreateFilteredElementCommmandWidget.this + .getSynchronizedObject().notifyChanged(); + } + }); + } + + public final <A> A adapt(final java.lang.Class<A> parm0) { + return safeSyncExec(new AbstractExceptionFreeRunnable<A>() { + @Override + public A safeRun() { + return SynchronizedGetOrCreateFilteredElementCommmandWidget.this + .getSynchronizedObject().adapt(parm0); + } + }); + } + + public final java.lang.Object getCommand() { + return safeSyncExec(new AbstractExceptionFreeRunnable<java.lang.Object>() { + @Override + public java.lang.Object safeRun() { + return SynchronizedGetOrCreateFilteredElementCommmandWidget.this + .getSynchronizedObject().getCommand(); + } + }); + } + + public final void onDialogValidation() { + voidExceptionFreeRunnable(new AbstractVoidExceptionFreeRunnable() { + @Override + public void voidSafeRun() { + SynchronizedGetOrCreateFilteredElementCommmandWidget.this + .getSynchronizedObject().onDialogValidation(); + } + }); + } + + public final T getElementSelected() { + return safeSyncExec(new AbstractExceptionFreeRunnable<T>() { + @Override + public T safeRun() { + return SynchronizedGetOrCreateFilteredElementCommmandWidget.this + .getSynchronizedObject().getElementSelected(); + } + }); + } + + public final org.eclipse.modisco.facet.util.ui.internal.exported.dialog.IDialog<W> pressNewButton() { + return safeSyncExec(new AbstractExceptionFreeRunnable<org.eclipse.modisco.facet.util.ui.internal.exported.dialog.IDialog<W>>() { + @Override + public org.eclipse.modisco.facet.util.ui.internal.exported.dialog.IDialog<W> safeRun() { + return SynchronizedGetOrCreateFilteredElementCommmandWidget.this + .getSynchronizedObject().pressNewButton(); + } + }); + } + + public final void selectElement(final T parm0) { + voidExceptionFreeRunnable(new AbstractVoidExceptionFreeRunnable() { + @Override + public void voidSafeRun() { + SynchronizedGetOrCreateFilteredElementCommmandWidget.this + .getSynchronizedObject().selectElement(parm0); + } + }); + } + + public final void selectElementByName(final java.lang.String parm0) { + voidExceptionFreeRunnable(new AbstractVoidExceptionFreeRunnable() { + @Override + public void voidSafeRun() { + SynchronizedGetOrCreateFilteredElementCommmandWidget.this + .getSynchronizedObject().selectElementByName(parm0); + } + }); + } + +}
diff --git a/org.eclipse.modisco.facet.util.ui/src/org/eclipse/modisco/facet/util/ui/internal/sync/generated/SynchronizedOkDialog.java b/org.eclipse.modisco.facet.util.ui/src/org/eclipse/modisco/facet/util/ui/internal/sync/generated/SynchronizedOkDialog.java new file mode 100644 index 0000000..6626b2a --- /dev/null +++ b/org.eclipse.modisco.facet.util.ui/src/org/eclipse/modisco/facet/util/ui/internal/sync/generated/SynchronizedOkDialog.java
@@ -0,0 +1,64 @@ +/** + * Copyright (c) Soft-Maint. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Thomas Cicognani (Soft-Maint) - Bug 406565 - Ok Dialog + */ + +package org.eclipse.modisco.facet.util.ui.internal.sync.generated; + +import org.eclipse.modisco.facet.util.ui.internal.exported.dialog.IOkDialog; +import org.eclipse.modisco.facet.util.ui.internal.exported.displaysync.AbstractExceptionFreeRunnable; +import org.eclipse.modisco.facet.util.ui.internal.exported.displaysync.AbstractVoidExceptionFreeRunnable; +import org.eclipse.modisco.facet.util.ui.internal.exported.displaysync.SynchronizedObject; +import org.eclipse.swt.widgets.Display; + +@SuppressWarnings("PMD.ExcessivePublicCount") +public class SynchronizedOkDialog extends SynchronizedObject<IOkDialog> + implements IOkDialog { + + public SynchronizedOkDialog(final IOkDialog object, final Display display) { + super(object, display); + } + public final void commit() { + voidExceptionFreeRunnable(new AbstractVoidExceptionFreeRunnable() { + @Override + public void voidSafeRun() { + SynchronizedOkDialog.this.getSynchronizedObject().commit(); + } + }); + } + + public final boolean isError() { + return safeSyncExec(new AbstractExceptionFreeRunnable<Boolean>() { + @Override + public Boolean safeRun() { + return Boolean.valueOf(SynchronizedOkDialog.this.getSynchronizedObject().isError()); + } + }).booleanValue(); + } + + public final boolean isInformation() { + return safeSyncExec(new AbstractExceptionFreeRunnable<Boolean>() { + @Override + public Boolean safeRun() { + return Boolean.valueOf(SynchronizedOkDialog.this.getSynchronizedObject().isInformation()); + } + }).booleanValue(); + } + + public final boolean isWarning() { + return safeSyncExec(new AbstractExceptionFreeRunnable<Boolean>() { + @Override + public Boolean safeRun() { + return Boolean.valueOf(SynchronizedOkDialog.this.getSynchronizedObject().isWarning()); + } + }).booleanValue(); + } + +}
diff --git a/org.eclipse.modisco.facet.util.ui/src/org/eclipse/modisco/facet/util/ui/internal/sync/generated/SynchronizedOkDialogFactory.java b/org.eclipse.modisco.facet.util.ui/src/org/eclipse/modisco/facet/util/ui/internal/sync/generated/SynchronizedOkDialogFactory.java new file mode 100644 index 0000000..279584c --- /dev/null +++ b/org.eclipse.modisco.facet.util.ui/src/org/eclipse/modisco/facet/util/ui/internal/sync/generated/SynchronizedOkDialogFactory.java
@@ -0,0 +1,106 @@ +/** + * Copyright (c) Soft-Maint. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Thomas Cicognani (Soft-Maint) - Bug 430545 - OKDialog may throws InvalidThreadAccess + */ + +package org.eclipse.modisco.facet.util.ui.internal.sync.generated; + +import org.eclipse.modisco.facet.util.ui.internal.exported.displaysync.AbstractExceptionFreeRunnable; +import org.eclipse.modisco.facet.util.ui.internal.exported.displaysync.SynchronizedObject; +import org.eclipse.swt.widgets.Display; + +@SuppressWarnings("PMD.ExcessivePublicCount") +public class SynchronizedOkDialogFactory extends SynchronizedObject<org.eclipse.modisco.facet.util.ui.internal.exported.dialog.IOkDialogFactory> implements org.eclipse.modisco.facet.util.ui.internal.exported.dialog.IOkDialogFactory { + + public SynchronizedOkDialogFactory(final org.eclipse.modisco.facet.util.ui.internal.exported.dialog.IOkDialogFactory object, final Display display) { + super(object, display); + } + public final org.eclipse.modisco.facet.util.ui.internal.exported.dialog.IOkDialog openDialog(final org.eclipse.swt.widgets.Shell parm0, final int parm1, final java.lang.String parm2, final java.lang.String parm3, final org.eclipse.modisco.facet.util.ui.internal.exported.dialog.IDialogCallback<java.lang.Void> parm4) { + return safeSyncExec(new AbstractExceptionFreeRunnable<org.eclipse.modisco.facet.util.ui.internal.exported.dialog.IOkDialog>() { + @Override + public org.eclipse.modisco.facet.util.ui.internal.exported.dialog.IOkDialog safeRun() { + return SynchronizedOkDialogFactory.this.getSynchronizedObject().openDialog(parm0, parm1, parm2, parm3, parm4); + } + }); + } + + public final org.eclipse.modisco.facet.util.ui.internal.exported.dialog.IOkDialog openDialog(final org.eclipse.swt.widgets.Shell parm0, final int parm1, final java.lang.String parm2, final java.lang.String parm3) { + return safeSyncExec(new AbstractExceptionFreeRunnable<org.eclipse.modisco.facet.util.ui.internal.exported.dialog.IOkDialog>() { + @Override + public org.eclipse.modisco.facet.util.ui.internal.exported.dialog.IOkDialog safeRun() { + return SynchronizedOkDialogFactory.this.getSynchronizedObject().openDialog(parm0, parm1, parm2, parm3); + } + }); + } + + public final org.eclipse.modisco.facet.util.ui.internal.exported.dialog.IOkDialog openErrorDialog(final org.eclipse.swt.widgets.Shell parm0, final java.lang.String parm1, final java.lang.String parm2, final org.eclipse.modisco.facet.util.ui.internal.exported.dialog.IDialogCallback<java.lang.Void> parm3) { + return safeSyncExec(new AbstractExceptionFreeRunnable<org.eclipse.modisco.facet.util.ui.internal.exported.dialog.IOkDialog>() { + @Override + public org.eclipse.modisco.facet.util.ui.internal.exported.dialog.IOkDialog safeRun() { + return SynchronizedOkDialogFactory.this.getSynchronizedObject().openErrorDialog(parm0, parm1, parm2, parm3); + } + }); + } + + public final org.eclipse.modisco.facet.util.ui.internal.exported.dialog.IOkDialog openErrorDialog(final org.eclipse.swt.widgets.Shell parm0, final java.lang.String parm1, final java.lang.String parm2) { + return safeSyncExec(new AbstractExceptionFreeRunnable<org.eclipse.modisco.facet.util.ui.internal.exported.dialog.IOkDialog>() { + @Override + public org.eclipse.modisco.facet.util.ui.internal.exported.dialog.IOkDialog safeRun() { + return SynchronizedOkDialogFactory.this.getSynchronizedObject().openErrorDialog(parm0, parm1, parm2); + } + }); + } + + public final org.eclipse.modisco.facet.util.ui.internal.exported.dialog.IOkDialog openErrorDialog(final org.eclipse.swt.widgets.Shell parm0, final java.lang.Exception parm1, final java.lang.String parm2) { + return safeSyncExec(new AbstractExceptionFreeRunnable<org.eclipse.modisco.facet.util.ui.internal.exported.dialog.IOkDialog>() { + @Override + public org.eclipse.modisco.facet.util.ui.internal.exported.dialog.IOkDialog safeRun() { + return SynchronizedOkDialogFactory.this.getSynchronizedObject().openErrorDialog(parm0, parm1, parm2); + } + }); + } + + public final org.eclipse.modisco.facet.util.ui.internal.exported.dialog.IOkDialog openInformationDialog(final org.eclipse.swt.widgets.Shell parm0, final java.lang.String parm1, final java.lang.String parm2, final org.eclipse.modisco.facet.util.ui.internal.exported.dialog.IDialogCallback<java.lang.Void> parm3) { + return safeSyncExec(new AbstractExceptionFreeRunnable<org.eclipse.modisco.facet.util.ui.internal.exported.dialog.IOkDialog>() { + @Override + public org.eclipse.modisco.facet.util.ui.internal.exported.dialog.IOkDialog safeRun() { + return SynchronizedOkDialogFactory.this.getSynchronizedObject().openInformationDialog(parm0, parm1, parm2, parm3); + } + }); + } + + public final org.eclipse.modisco.facet.util.ui.internal.exported.dialog.IOkDialog openInformationDialog(final org.eclipse.swt.widgets.Shell parm0, final java.lang.String parm1, final java.lang.String parm2) { + return safeSyncExec(new AbstractExceptionFreeRunnable<org.eclipse.modisco.facet.util.ui.internal.exported.dialog.IOkDialog>() { + @Override + public org.eclipse.modisco.facet.util.ui.internal.exported.dialog.IOkDialog safeRun() { + return SynchronizedOkDialogFactory.this.getSynchronizedObject().openInformationDialog(parm0, parm1, parm2); + } + }); + } + + public final org.eclipse.modisco.facet.util.ui.internal.exported.dialog.IOkDialog openWarningDialog(final org.eclipse.swt.widgets.Shell parm0, final java.lang.String parm1, final java.lang.String parm2, final org.eclipse.modisco.facet.util.ui.internal.exported.dialog.IDialogCallback<java.lang.Void> parm3) { + return safeSyncExec(new AbstractExceptionFreeRunnable<org.eclipse.modisco.facet.util.ui.internal.exported.dialog.IOkDialog>() { + @Override + public org.eclipse.modisco.facet.util.ui.internal.exported.dialog.IOkDialog safeRun() { + return SynchronizedOkDialogFactory.this.getSynchronizedObject().openWarningDialog(parm0, parm1, parm2, parm3); + } + }); + } + + public final org.eclipse.modisco.facet.util.ui.internal.exported.dialog.IOkDialog openWarningDialog(final org.eclipse.swt.widgets.Shell parm0, final java.lang.String parm1, final java.lang.String parm2) { + return safeSyncExec(new AbstractExceptionFreeRunnable<org.eclipse.modisco.facet.util.ui.internal.exported.dialog.IOkDialog>() { + @Override + public org.eclipse.modisco.facet.util.ui.internal.exported.dialog.IOkDialog safeRun() { + return SynchronizedOkDialogFactory.this.getSynchronizedObject().openWarningDialog(parm0, parm1, parm2); + } + }); + } + +}
diff --git a/org.eclipse.modisco.facet.util.ui/src/org/eclipse/modisco/facet/util/ui/internal/sync/generated/SynchronizedQuestionDialog.java b/org.eclipse.modisco.facet.util.ui/src/org/eclipse/modisco/facet/util/ui/internal/sync/generated/SynchronizedQuestionDialog.java new file mode 100644 index 0000000..9711c5c --- /dev/null +++ b/org.eclipse.modisco.facet.util.ui/src/org/eclipse/modisco/facet/util/ui/internal/sync/generated/SynchronizedQuestionDialog.java
@@ -0,0 +1,78 @@ +/******************************************************************************* + * Copyright (c) 2016 Mia-Software. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Thomas Cicognani (Mia-Software) - Bug 500437 - IQuestionDialogFactory not synchronized + *******************************************************************************/ +package org.eclipse.modisco.facet.util.ui.internal.sync.generated; + +import org.eclipse.modisco.facet.util.ui.internal.exported.displaysync.AbstractExceptionFreeRunnable; +import org.eclipse.modisco.facet.util.ui.internal.exported.displaysync.AbstractVoidExceptionFreeRunnable; +import org.eclipse.modisco.facet.util.ui.internal.exported.displaysync.SynchronizedObject; +import org.eclipse.swt.widgets.Display; + +@SuppressWarnings("PMD.ExcessivePublicCount") +public class SynchronizedQuestionDialog extends SynchronizedObject<org.eclipse.modisco.facet.util.ui.internal.exported.dialog.IQuestionDialog> implements org.eclipse.modisco.facet.util.ui.internal.exported.dialog.IQuestionDialog { + + public SynchronizedQuestionDialog(final org.eclipse.modisco.facet.util.ui.internal.exported.dialog.IQuestionDialog object, final Display display) { + super(object, display); + } + public final void addCloseListener(final java.lang.Runnable parm0) { + voidExceptionFreeRunnable(new AbstractVoidExceptionFreeRunnable() { + @Override + public void voidSafeRun() { + SynchronizedQuestionDialog.this.getSynchronizedObject().addCloseListener(parm0); + } + }); + } + + public final java.lang.Boolean getResult() { + return safeSyncExec(new AbstractExceptionFreeRunnable<java.lang.Boolean>() { + @Override + public java.lang.Boolean safeRun() { + return SynchronizedQuestionDialog.this.getSynchronizedObject().getResult(); + } + }); + } + + public final org.eclipse.swt.widgets.Shell getShell() { + return safeSyncExec(new AbstractExceptionFreeRunnable<org.eclipse.swt.widgets.Shell>() { + @Override + public org.eclipse.swt.widgets.Shell safeRun() { + return SynchronizedQuestionDialog.this.getSynchronizedObject().getShell(); + } + }); + } + + public final void open() { + voidExceptionFreeRunnable(new AbstractVoidExceptionFreeRunnable() { + @Override + public void voidSafeRun() { + SynchronizedQuestionDialog.this.getSynchronizedObject().open(); + } + }); + } + + public final void pressNo() { + voidExceptionFreeRunnable(new AbstractVoidExceptionFreeRunnable() { + @Override + public void voidSafeRun() { + SynchronizedQuestionDialog.this.getSynchronizedObject().pressNo(); + } + }); + } + + public final void pressYes() { + voidExceptionFreeRunnable(new AbstractVoidExceptionFreeRunnable() { + @Override + public void voidSafeRun() { + SynchronizedQuestionDialog.this.getSynchronizedObject().pressYes(); + } + }); + } + +}
diff --git a/org.eclipse.modisco.facet.util.ui/src/org/eclipse/modisco/facet/util/ui/internal/sync/generated/SynchronizedQuestionDialogFactory.java b/org.eclipse.modisco.facet.util.ui/src/org/eclipse/modisco/facet/util/ui/internal/sync/generated/SynchronizedQuestionDialogFactory.java new file mode 100644 index 0000000..002cba5 --- /dev/null +++ b/org.eclipse.modisco.facet.util.ui/src/org/eclipse/modisco/facet/util/ui/internal/sync/generated/SynchronizedQuestionDialogFactory.java
@@ -0,0 +1,41 @@ +/******************************************************************************* + * Copyright (c) 2016 Mia-Software. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Thomas Cicognani (Mia-Software) - Bug 500437 - IQuestionDialogFactory not synchronized + *******************************************************************************/ +package org.eclipse.modisco.facet.util.ui.internal.sync.generated; + +import org.eclipse.modisco.facet.util.ui.internal.exported.displaysync.AbstractExceptionFreeRunnable; +import org.eclipse.modisco.facet.util.ui.internal.exported.displaysync.SynchronizedObject; +import org.eclipse.swt.widgets.Display; + +@SuppressWarnings("PMD.ExcessivePublicCount") +public class SynchronizedQuestionDialogFactory extends SynchronizedObject<org.eclipse.modisco.facet.util.ui.internal.exported.dialog.IQuestionDialogFactory> implements org.eclipse.modisco.facet.util.ui.internal.exported.dialog.IQuestionDialogFactory { + + public SynchronizedQuestionDialogFactory(final org.eclipse.modisco.facet.util.ui.internal.exported.dialog.IQuestionDialogFactory object, final Display display) { + super(object, display); + } + public final org.eclipse.modisco.facet.util.ui.internal.exported.dialog.IQuestionDialog createQuestionDialog(final org.eclipse.swt.widgets.Shell parm0, final java.lang.String parm1, final java.lang.String parm2) { + return safeSyncExec(new AbstractExceptionFreeRunnable<org.eclipse.modisco.facet.util.ui.internal.exported.dialog.IQuestionDialog>() { + @Override + public org.eclipse.modisco.facet.util.ui.internal.exported.dialog.IQuestionDialog safeRun() { + return SynchronizedQuestionDialogFactory.this.getSynchronizedObject().createQuestionDialog(parm0, parm1, parm2); + } + }); + } + + public final org.eclipse.modisco.facet.util.ui.internal.exported.dialog.IQuestionDialog createQuestionDialog(final org.eclipse.swt.widgets.Shell parm0, final java.lang.String parm1, final java.lang.String parm2, final org.eclipse.modisco.facet.util.ui.internal.exported.dialog.IDialogCallback<java.lang.Boolean> parm3) { + return safeSyncExec(new AbstractExceptionFreeRunnable<org.eclipse.modisco.facet.util.ui.internal.exported.dialog.IQuestionDialog>() { + @Override + public org.eclipse.modisco.facet.util.ui.internal.exported.dialog.IQuestionDialog safeRun() { + return SynchronizedQuestionDialogFactory.this.getSynchronizedObject().createQuestionDialog(parm0, parm1, parm2, parm3); + } + }); + } + +}
diff --git a/org.eclipse.modisco.facet.util.ui/src/org/eclipse/modisco/facet/util/ui/internal/widget/metaclass/FilteredElementSelectionWidget.java b/org.eclipse.modisco.facet.util.ui/src/org/eclipse/modisco/facet/util/ui/internal/widget/metaclass/FilteredElementSelectionWidget.java new file mode 100644 index 0000000..9bcc927 --- /dev/null +++ b/org.eclipse.modisco.facet.util.ui/src/org/eclipse/modisco/facet/util/ui/internal/widget/metaclass/FilteredElementSelectionWidget.java
@@ -0,0 +1,150 @@ +/** + * Copyright (c) 2012 Mia-Software. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Alban Ménager (Soft-Maint) - Bug 387470 - [EFacet][Custom] Editors + */ +package org.eclipse.modisco.facet.util.ui.internal.widget.metaclass; + +import org.eclipse.jface.viewers.LabelProvider; +import org.eclipse.modisco.facet.util.ui.internal.Messages; +import org.eclipse.modisco.facet.util.ui.internal.exported.util.widget.AbstractWidget; +import org.eclipse.swt.SWT; +import org.eclipse.swt.events.KeyEvent; +import org.eclipse.swt.events.KeyListener; +import org.eclipse.swt.events.ModifyEvent; +import org.eclipse.swt.events.ModifyListener; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Text; +import org.eclipse.ui.dialogs.FilteredList; + +/** + * A control for selecting an element from a list of elements, that can be + * filtered using the associated text field. + */ +public class FilteredElementSelectionWidget extends + AbstractWidget { + + private static final String MATCH_PREFIX = "*"; //$NON-NLS-1$ + private static final int FILTER_WIDTH_HINT = 350; + + private Text filterText; + private FilteredList fFilteredList; + private final Object[] elements; + private static final boolean MULTISELECTION = false; + + public FilteredElementSelectionWidget(final Composite parent, + final Object[] elements) { + super(parent); + this.elements = elements.clone(); + final GridData gridData = new GridData(SWT.FILL); + gridData.widthHint = FILTER_WIDTH_HINT; + setLayoutData(gridData); + } + + public void setElements(final Object[] elements) { + this.fFilteredList.setElements(elements); + } + + private void createFilteredList(final Composite parent) { + int multi; + if (MULTISELECTION) { + multi = SWT.MULTI; + } else { + multi = SWT.SINGLE; + } + this.fFilteredList = new FilteredList(parent, SWT.BORDER | SWT.V_SCROLL + | SWT.H_SCROLL | multi, new LabelProvider(), true, false, true); + + final GridData data = new GridData(); + data.grabExcessVerticalSpace = true; + data.grabExcessHorizontalSpace = true; + data.horizontalAlignment = GridData.FILL; + data.verticalAlignment = GridData.FILL; + this.fFilteredList.setLayoutData(data); + this.fFilteredList.setFilter(""); //$NON-NLS-1$ + this.fFilteredList.setElements(this.elements); + } + + private void createFilterText(final Composite parent) { + this.filterText = new Text(parent, SWT.BORDER); + this.filterText + .setMessage(Messages.FilteredElementSelectionControl_type_filter_text); + final GridData data = new GridData(); + data.grabExcessVerticalSpace = false; + data.grabExcessHorizontalSpace = true; + data.horizontalAlignment = GridData.FILL; + data.verticalAlignment = GridData.BEGINNING; + this.filterText.setLayoutData(data); + this.filterText.addModifyListener(new ModifyListener() { + public void modifyText(final ModifyEvent event) { + getfFilteredList().setFilter( + MATCH_PREFIX + getFilterText().getText()); + } + }); + this.filterText.addKeyListener(new KeyListener() { + + public void keyPressed(final KeyEvent event) { + if (event.keyCode == SWT.ARROW_DOWN) { + getfFilteredList().setFocus(); + } + } + + public void keyReleased(final KeyEvent event) { + // nothing + } + }); + } + + public Object getFirstSelectedElement() { + Object result = null; + final Object[] selection = this.fFilteredList.getSelection(); + if (selection.length > 0) { + result = selection[0]; + } + return result; + } + + public Object[] getSelectedElements() { + Object[] result = null; + final Object[] selection = this.fFilteredList.getSelection(); + if (selection.length != 0) { + result = selection; + } + return result; + } + + public FilteredList getFilteredList() { + return this.fFilteredList; + } + + public Text getFilterText() { + return this.filterText; + } + + protected FilteredList getfFilteredList() { + return this.fFilteredList; + } + + @Override + protected void addSubWidgets() { + createFilterText(this); + createFilteredList(this); + } + + @Override + public String getError() { + return null; + } + + @Override + public void notifyChanged() { + // No action has to be done if a change appends. + } +}
diff --git a/org.eclipse.modisco.facet.util.ui/src/org/eclipse/modisco/facet/util/ui/utils/UIUtils.java b/org.eclipse.modisco.facet.util.ui/src/org/eclipse/modisco/facet/util/ui/utils/UIUtils.java new file mode 100644 index 0000000..57178bb --- /dev/null +++ b/org.eclipse.modisco.facet.util.ui/src/org/eclipse/modisco/facet/util/ui/utils/UIUtils.java
@@ -0,0 +1,248 @@ +/** + * Copyright (c) 2012 Mia-Software. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Alban Ménager (Soft-Maint) - Bug 387470 - [EFacet][Custom] Editors + */ +package org.eclipse.modisco.facet.util.ui.utils; + +import java.util.List; + +import org.eclipse.swt.SWT; +import org.eclipse.swt.events.ModifyListener; +import org.eclipse.swt.events.SelectionListener; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.widgets.Button; +import org.eclipse.swt.widgets.Combo; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Label; +import org.eclipse.swt.widgets.Spinner; +import org.eclipse.swt.widgets.Text; + +/** + * This util class provides methods for the creation of basics ui components + * like buttons or text field. + * + * @since 0.3 + */ +public final class UIUtils { + + private static final int WIDTH_HINT = 110; + + private UIUtils() { + // Private constructor. + } + + /** + * Create the label (with the given labelName) in the given composite. The + * layoutData of the label is {@link #getLabelGridData()}. + * + * @param parent + * the composite parent. + * @param labelName + * the label name. + */ + public static Label createLabel(final Composite parent, + final String labelName) { + final Label label = new Label(parent, SWT.NONE); + label.setText(labelName); + label.setLayoutData(getLabelGridData()); + return label; + } + + /** + * Create and return a new button. + * + * @param parent + * the button parent. + * @param text + * the text to display on the button. + * @param enabled + * set if the button can be pressed or not. + * @param selectionListener + * the listener when the button is pressed (can be null). + * @return the new button. + */ + public static Button createButton(final Composite parent, + final String text, final boolean enabled, + final SelectionListener selectionListener) { + final Button button = new Button(parent, SWT.NONE); + button.setText(text); + button.setEnabled(enabled); + if (selectionListener != null) { + button.addSelectionListener(selectionListener); + } + return button; + } + + /** + * Create and return a new text field. + * + * @param parent + * the text field parent. + * @param text + * the text to display on the text field. + * @param enabled + * set if the text field can be edit or not. + * @param selectListener + * the listener when the text field is edited (can be null). + * @return the new text field. + */ + public static Text createTextField(final Composite parent, + final String text, final boolean enabled, + final ModifyListener modifyListener) { + final Text textField = new Text(parent, SWT.BORDER); + textField.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); + textField.setEnabled(enabled); + if (text != null) { + textField.setText(text); + } + if (modifyListener != null) { + textField.addModifyListener(modifyListener); + } + return textField; + } + + /** + * Create a combobox with a label. + * + * @param parent + * the parent of the combobox. + * @param enabled + * if the combobox is enabled. + * @param elements + * the elements of the combobox + * @param listener + * the listener of the combobox (can be null) + * @return the combobox created. + */ + public static Combo createCombobox(final Composite parent, + final boolean enabled, final List<String> elements, + final String label, final SelectionListener listener) { + final Composite composite = new Composite(parent, SWT.NONE); + final GridLayout gridLayout = new GridLayout(2, false); + gridLayout.marginWidth = 0; + composite.setLayout(gridLayout); + final Label comboboxLabel = new Label(composite, SWT.NONE); + comboboxLabel.setText(label); + final GridData gridData = new GridData(SWT.FILL); + comboboxLabel.setLayoutData(gridData); + final Combo combobox = new Combo(composite, SWT.DROP_DOWN + | SWT.READ_ONLY); + combobox.setLayoutData(new GridData(SWT.FILL)); + combobox.setEnabled(enabled); + for (final String element : elements) { + combobox.add(element); + } + combobox.select(0); + if (listener != null) { + combobox.addSelectionListener(listener); + } + return combobox; + } + + /** + * Create and return a new text field. + * + * @param parent + * the text field parent. + * @param text + * the text to display on the text field. + * @param enabled + * set if the text field can be edit or not. + * @param selectListener + * the listener when the text field is edited (can be null). + * @return the new text field. + */ + public static Text createTextArea(final Composite parent, + final String text, final boolean enabled, + final ModifyListener modifyListener) { + final Text textArea = new Text(parent, SWT.MULTI | SWT.BORDER + | SWT.WRAP | SWT.V_SCROLL); + textArea.setLayoutData(new GridData(GridData.FILL_BOTH)); + textArea.setEnabled(enabled); + if (text != null) { + textArea.setText(text); + } + if (modifyListener != null) { + textArea.addModifyListener(modifyListener); + } + return textArea; + } + + /** + * @return the labelGridData + */ + public static GridData getLabelGridData() { + final GridData labelGridData = new GridData(SWT.FILL); + labelGridData.widthHint = WIDTH_HINT; + return labelGridData; + } + + /** + * Create and return a new checkbox. + * + * @param parent + * the checkbox parent. + * @param enabled + * set if the checkbox can be checked or not. + * @param selected + * set if the checkbox is initially selected or not. + * @param selectionListener + * the listener when the checkbox is selected (can be null). + * @return the new checkbox. + */ + public static Button createCheckbox(final Composite composite, + final boolean enabled, final boolean selected, + final SelectionListener selectionListener) { + final Button checkbox = new Button(composite, SWT.CHECK); + checkbox.setEnabled(enabled); + checkbox.setSelection(selected); + checkbox.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); + if (selectionListener != null) { + checkbox.addSelectionListener(selectionListener); + } + return checkbox; + } + + /** + * Create and return a new spinner. + * + * @param parent + * the parent of the spinner. + * @param maxValue + * the max value the spinner can reach. + * @param minValue + * the min value the spinner can reach. + * @param increment + * the increment of the spinner. + * @param changeable + * if the spinner is changeable or not. + * @param modifyListener + * the listener when the spinner is changed (can be null). + * @return the new spinner. + * + * @see Spinner + */ + public static Spinner createSpinner(final Composite parent, + final int maxValue, final int minValue, final int increment, + final boolean changeable, final ModifyListener modifyListener) { + final Spinner spinner = new Spinner(parent, SWT.BORDER); + spinner.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); + spinner.setMaximum(maxValue); + spinner.setMinimum(minValue); + spinner.setIncrement(increment); + spinner.setEnabled(changeable); + if (modifyListener != null) { + spinner.addModifyListener(modifyListener); + } + return spinner; + } + +}
diff --git a/org.eclipse.modisco.facet.widgets.celleditors.ecore/META-INF/MANIFEST.MF b/org.eclipse.modisco.facet.widgets.celleditors.ecore/META-INF/MANIFEST.MF index d019e21..dd1a512 100644 --- a/org.eclipse.modisco.facet.widgets.celleditors.ecore/META-INF/MANIFEST.MF +++ b/org.eclipse.modisco.facet.widgets.celleditors.ecore/META-INF/MANIFEST.MF
@@ -3,7 +3,7 @@ Bundle-Name: %Bundle-Name Bundle-SymbolicName: org.eclipse.emf.facet.widgets.celleditors.ecore;singleton:=true Bundle-Version: 1.3.0.qualifier -Bundle-Activator: org.eclipse.emf.facet.widgets.celleditors.ecore.Activator +Bundle-Activator: org.eclipse.modisco.facet.widgets.celleditors.ecore.Activator Bundle-Vendor: %Bundle-Vendor Require-Bundle: org.eclipse.ui, org.eclipse.core.runtime, @@ -13,5 +13,5 @@ org.eclipse.emf.facet.util.core;bundle-version="0.1.0" Bundle-RequiredExecutionEnvironment: JavaSE-1.8 Bundle-ActivationPolicy: lazy -Export-Package: org.eclipse.emf.facet.widgets.celleditors.ecore.composite +Export-Package: org.eclipse.modisco.facet.widgets.celleditors.ecore.composite Automatic-Module-Name: org.eclipse.emf.facet.widgets.celleditors.ecore
diff --git a/org.eclipse.modisco.facet.widgets.celleditors.ecore/src/org/eclipse/emf/facet/widgets/celleditors/ecore/Activator.java b/org.eclipse.modisco.facet.widgets.celleditors.ecore/src/org/eclipse/emf/facet/widgets/celleditors/ecore/Activator.java deleted file mode 100644 index 1251d24..0000000 --- a/org.eclipse.modisco.facet.widgets.celleditors.ecore/src/org/eclipse/emf/facet/widgets/celleditors/ecore/Activator.java +++ /dev/null
@@ -1,68 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2010 CEA LIST. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Nicolas Bros (Mia-Software) - initial API and implementation - *****************************************************************************/ -package org.eclipse.emf.facet.widgets.celleditors.ecore; - -import org.eclipse.ui.plugin.AbstractUIPlugin; -import org.osgi.framework.BundleContext; - -/** - * The activator class controls the plug-in life cycle - */ -public class Activator extends AbstractUIPlugin { - // The plug-in ID - public static final String PLUGIN_ID = "org.eclipse.emf.facet.widgets.celleditors"; //$NON-NLS-1$ - - // The shared instance - private static Activator plugin; - - /** - * The constructor - */ - public Activator() { - } - - /* - * (non-Javadoc) - * - * @see - * org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext - * ) - */ - @Override - public void start(final BundleContext context) throws Exception { - super.start(context); - Activator.plugin = this; - } - - /* - * (non-Javadoc) - * - * @see - * org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext - * ) - */ - @Override - public void stop(final BundleContext context) throws Exception { - Activator.plugin = null; - super.stop(context); - } - - /** - * Returns the shared instance - * - * @return the shared instance - */ - public static Activator getDefault() { - return Activator.plugin; - } - -}
diff --git a/org.eclipse.modisco.facet.widgets.celleditors.ecore/src/org/eclipse/emf/facet/widgets/celleditors/ecore/EBigDecimalCellEditor.java b/org.eclipse.modisco.facet.widgets.celleditors.ecore/src/org/eclipse/emf/facet/widgets/celleditors/ecore/EBigDecimalCellEditor.java deleted file mode 100644 index 0811c91..0000000 --- a/org.eclipse.modisco.facet.widgets.celleditors.ecore/src/org/eclipse/emf/facet/widgets/celleditors/ecore/EBigDecimalCellEditor.java +++ /dev/null
@@ -1,54 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2010 CEA LIST. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Nicolas Guyomar (Mia-Software) - initial API and implementation - * Nicolas Bros (Mia-Software) - Bug 334539 - [celleditors] change listener - *****************************************************************************/ -package org.eclipse.emf.facet.widgets.celleditors.ecore; - -import java.math.BigDecimal; - -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.EStructuralFeature; -import org.eclipse.emf.facet.util.core.Logger; -import org.eclipse.emf.facet.widgets.celleditors.IListener; -import org.eclipse.emf.facet.widgets.celleditors.IModelCellEditHandler; -import org.eclipse.emf.facet.widgets.celleditors.IModelCellEditor; -import org.eclipse.emf.facet.widgets.celleditors.ecore.composite.BigDecimalComposite; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Control; - -/** A cell editor for BigDecimal */ -public class EBigDecimalCellEditor implements IModelCellEditor { - - private BigDecimalComposite composite = null; - - public Control activateCell(final Composite parent, final Object originalValue, - final IModelCellEditHandler editHandler, final EStructuralFeature feature, - final EObject source) { - this.composite = new BigDecimalComposite(parent); - if (originalValue != null) { - if (originalValue instanceof BigDecimal) { - this.composite.setValue((BigDecimal) originalValue); - } else { - Logger.logError("An instance of BigDecimal was expected", Activator.getDefault()); //$NON-NLS-1$ - } - } - this.composite.addCommitListener(new IListener() { - public void handleEvent() { - editHandler.commit(); - } - }); - return this.composite; - } - - public Object getValue() { - return this.composite.getValue(); - } -} \ No newline at end of file
diff --git a/org.eclipse.modisco.facet.widgets.celleditors.ecore/src/org/eclipse/emf/facet/widgets/celleditors/ecore/EBigIntegerCellEditor.java b/org.eclipse.modisco.facet.widgets.celleditors.ecore/src/org/eclipse/emf/facet/widgets/celleditors/ecore/EBigIntegerCellEditor.java deleted file mode 100644 index cf2b19e..0000000 --- a/org.eclipse.modisco.facet.widgets.celleditors.ecore/src/org/eclipse/emf/facet/widgets/celleditors/ecore/EBigIntegerCellEditor.java +++ /dev/null
@@ -1,55 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2010 CEA LIST. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Nicolas Guyomar (Mia-Software) - initial API and implementation - * Nicolas Bros (Mia-Software) - Bug 334539 - [celleditors] change listener - *****************************************************************************/ -package org.eclipse.emf.facet.widgets.celleditors.ecore; - -import java.math.BigInteger; - -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.EStructuralFeature; -import org.eclipse.emf.facet.util.core.Logger; -import org.eclipse.emf.facet.widgets.celleditors.IListener; -import org.eclipse.emf.facet.widgets.celleditors.IModelCellEditHandler; -import org.eclipse.emf.facet.widgets.celleditors.IModelCellEditor; -import org.eclipse.emf.facet.widgets.celleditors.ecore.composite.BigIntegerComposite; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Control; - -/** A cell editor for BigInteger */ -public class EBigIntegerCellEditor implements IModelCellEditor { - - private BigIntegerComposite composite = null; - - public Control activateCell(final Composite parent, final Object originalValue, - final IModelCellEditHandler editHandler, final EStructuralFeature feature, - final EObject source) { - this.composite = new BigIntegerComposite(parent); - if (originalValue != null) { - if (originalValue instanceof BigInteger) { - this.composite.setValue((BigInteger) originalValue); - } else { - Logger.logError("An instance of BigInteger was expected", //$NON-NLS-1$ - Activator.getDefault()); - } - } - this.composite.addCommitListener(new IListener() { - public void handleEvent() { - editHandler.commit(); - } - }); - return this.composite; - } - - public Object getValue() { - return this.composite.getValue(); - } -} \ No newline at end of file
diff --git a/org.eclipse.modisco.facet.widgets.celleditors.ecore/src/org/eclipse/emf/facet/widgets/celleditors/ecore/EBooleanCellEditor.java b/org.eclipse.modisco.facet.widgets.celleditors.ecore/src/org/eclipse/emf/facet/widgets/celleditors/ecore/EBooleanCellEditor.java deleted file mode 100644 index 4238b62..0000000 --- a/org.eclipse.modisco.facet.widgets.celleditors.ecore/src/org/eclipse/emf/facet/widgets/celleditors/ecore/EBooleanCellEditor.java +++ /dev/null
@@ -1,54 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2010 CEA LIST. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Nicolas Guyomar (Mia-Software) - initial API and implementation - * Nicolas Bros (Mia-Software) - Bug 334539 - [celleditors] change listener - *****************************************************************************/ -package org.eclipse.emf.facet.widgets.celleditors.ecore; - -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.EStructuralFeature; -import org.eclipse.emf.facet.util.core.Logger; -import org.eclipse.emf.facet.widgets.celleditors.IListener; -import org.eclipse.emf.facet.widgets.celleditors.IModelCellEditHandler; -import org.eclipse.emf.facet.widgets.celleditors.IModelCellEditor; -import org.eclipse.emf.facet.widgets.celleditors.ecore.composite.BooleanComposite; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Control; - -/** A cell editor for Boolean */ -public class EBooleanCellEditor implements IModelCellEditor { - - private BooleanComposite composite = null; - - public Control activateCell(final Composite parent, final Object originalValue, - final IModelCellEditHandler editHandler, final EStructuralFeature feature, - final EObject source) { - this.composite = new BooleanComposite(parent); - if (originalValue != null) { - if (originalValue instanceof Boolean) { - this.composite.setValue((Boolean) originalValue); - } else { - Logger.logError("An instance of Boolean was expected", //$NON-NLS-1$ - Activator.getDefault()); - } - } - this.composite.addCommitListener(new IListener() { - public void handleEvent() { - editHandler.commit(); - } - }); - return this.composite; - } - - public Object getValue() { - return this.composite.getValue(); - } - -}
diff --git a/org.eclipse.modisco.facet.widgets.celleditors.ecore/src/org/eclipse/emf/facet/widgets/celleditors/ecore/EByteCellEditor.java b/org.eclipse.modisco.facet.widgets.celleditors.ecore/src/org/eclipse/emf/facet/widgets/celleditors/ecore/EByteCellEditor.java deleted file mode 100644 index 7fdee4c..0000000 --- a/org.eclipse.modisco.facet.widgets.celleditors.ecore/src/org/eclipse/emf/facet/widgets/celleditors/ecore/EByteCellEditor.java +++ /dev/null
@@ -1,53 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2010 CEA LIST. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Nicolas Guyomar (Mia-Software) - initial API and implementation - * Nicolas Bros (Mia-Software) - Bug 334539 - [celleditors] change listener - *****************************************************************************/ -package org.eclipse.emf.facet.widgets.celleditors.ecore; - -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.EStructuralFeature; -import org.eclipse.emf.facet.util.core.Logger; -import org.eclipse.emf.facet.widgets.celleditors.IListener; -import org.eclipse.emf.facet.widgets.celleditors.IModelCellEditHandler; -import org.eclipse.emf.facet.widgets.celleditors.IModelCellEditor; -import org.eclipse.emf.facet.widgets.celleditors.ecore.composite.ByteComposite; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Control; - -/** A cell editor for Byte */ -public class EByteCellEditor implements IModelCellEditor { - - private ByteComposite composite = null; - - public Control activateCell(final Composite parent, final Object originalValue, - final IModelCellEditHandler editHandler, final EStructuralFeature feature, - final EObject source) { - this.composite = new ByteComposite(parent); - if (originalValue != null) { - if (originalValue instanceof Byte) { - this.composite.setValue((Byte) originalValue); - } else { - Logger.logError("An instance of Byte was expected", //$NON-NLS-1$ - Activator.getDefault()); - } - } - this.composite.addCommitListener(new IListener() { - public void handleEvent() { - editHandler.commit(); - } - }); - return this.composite; - } - - public Object getValue() { - return this.composite.getValue(); - } -} \ No newline at end of file
diff --git a/org.eclipse.modisco.facet.widgets.celleditors.ecore/src/org/eclipse/emf/facet/widgets/celleditors/ecore/ECharCellEditor.java b/org.eclipse.modisco.facet.widgets.celleditors.ecore/src/org/eclipse/emf/facet/widgets/celleditors/ecore/ECharCellEditor.java deleted file mode 100644 index 71d30a0..0000000 --- a/org.eclipse.modisco.facet.widgets.celleditors.ecore/src/org/eclipse/emf/facet/widgets/celleditors/ecore/ECharCellEditor.java +++ /dev/null
@@ -1,54 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2010 CEA LIST. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Nicolas Guyomar (Mia-Software) - initial API and implementation - * Nicolas Bros (Mia-Software) - Bug 334539 - [celleditors] change listener - *****************************************************************************/ -package org.eclipse.emf.facet.widgets.celleditors.ecore; - -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.EStructuralFeature; -import org.eclipse.emf.facet.util.core.Logger; -import org.eclipse.emf.facet.widgets.celleditors.IListener; -import org.eclipse.emf.facet.widgets.celleditors.IModelCellEditHandler; -import org.eclipse.emf.facet.widgets.celleditors.IModelCellEditor; -import org.eclipse.emf.facet.widgets.celleditors.ecore.composite.CharComposite; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Control; - -/** A cell editor for Character */ -public class ECharCellEditor implements IModelCellEditor { - - private CharComposite composite = null; - - public Control activateCell(final Composite parent, final Object originalValue, - final IModelCellEditHandler editHandler, final EStructuralFeature feature, - final EObject source) { - this.composite = new CharComposite(parent); - if (originalValue != null) { - if (originalValue instanceof Character) { - this.composite.setValue((Character) originalValue); - } else { - Logger.logError("An instance of Character was expected", //$NON-NLS-1$ - Activator.getDefault()); - } - } - this.composite.addCommitListener(new IListener() { - public void handleEvent() { - editHandler.commit(); - } - }); - return this.composite; - } - - public Object getValue() { - return this.composite.getValue(); - } - -} \ No newline at end of file
diff --git a/org.eclipse.modisco.facet.widgets.celleditors.ecore/src/org/eclipse/emf/facet/widgets/celleditors/ecore/EDoubleCellEditor.java b/org.eclipse.modisco.facet.widgets.celleditors.ecore/src/org/eclipse/emf/facet/widgets/celleditors/ecore/EDoubleCellEditor.java deleted file mode 100644 index 2d22b91..0000000 --- a/org.eclipse.modisco.facet.widgets.celleditors.ecore/src/org/eclipse/emf/facet/widgets/celleditors/ecore/EDoubleCellEditor.java +++ /dev/null
@@ -1,54 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2010 CEA LIST. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Nicolas Guyomar (Mia-Software) - initial API and implementation - * Nicolas Bros (Mia-Software) - Bug 334539 - [celleditors] change listener - *****************************************************************************/ -package org.eclipse.emf.facet.widgets.celleditors.ecore; - -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.EStructuralFeature; -import org.eclipse.emf.facet.util.core.Logger; -import org.eclipse.emf.facet.widgets.celleditors.IListener; -import org.eclipse.emf.facet.widgets.celleditors.IModelCellEditHandler; -import org.eclipse.emf.facet.widgets.celleditors.IModelCellEditor; -import org.eclipse.emf.facet.widgets.celleditors.ecore.composite.DoubleComposite; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Control; - -/** A cell editor for Double */ -public class EDoubleCellEditor implements IModelCellEditor { - - private DoubleComposite composite = null; - - public Control activateCell(final Composite parent, final Object originalValue, - final IModelCellEditHandler editHandler, final EStructuralFeature feature, - final EObject source) { - this.composite = new DoubleComposite(parent); - if (originalValue != null) { - if (originalValue instanceof Double) { - this.composite.setValue((Double) originalValue); - } else { - Logger.logError("An instance of Double was expected", //$NON-NLS-1$ - Activator.getDefault()); - } - } - this.composite.addCommitListener(new IListener() { - public void handleEvent() { - editHandler.commit(); - } - }); - return this.composite; - } - - public Object getValue() { - return this.composite.getValue(); - } - -} \ No newline at end of file
diff --git a/org.eclipse.modisco.facet.widgets.celleditors.ecore/src/org/eclipse/emf/facet/widgets/celleditors/ecore/EFloatCellEditor.java b/org.eclipse.modisco.facet.widgets.celleditors.ecore/src/org/eclipse/emf/facet/widgets/celleditors/ecore/EFloatCellEditor.java deleted file mode 100644 index f910ef5..0000000 --- a/org.eclipse.modisco.facet.widgets.celleditors.ecore/src/org/eclipse/emf/facet/widgets/celleditors/ecore/EFloatCellEditor.java +++ /dev/null
@@ -1,54 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2010 CEA LIST. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Nicolas Guyomar (Mia-Software) - initial API and implementation - * Nicolas Bros (Mia-Software) - Bug 334539 - [celleditors] change listener - *****************************************************************************/ -package org.eclipse.emf.facet.widgets.celleditors.ecore; - -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.EStructuralFeature; -import org.eclipse.emf.facet.util.core.Logger; -import org.eclipse.emf.facet.widgets.celleditors.IListener; -import org.eclipse.emf.facet.widgets.celleditors.IModelCellEditHandler; -import org.eclipse.emf.facet.widgets.celleditors.IModelCellEditor; -import org.eclipse.emf.facet.widgets.celleditors.ecore.composite.FloatComposite; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Control; - -/** A cell editor for Float */ -public class EFloatCellEditor implements IModelCellEditor { - - private FloatComposite composite = null; - - public Control activateCell(final Composite parent, final Object originalValue, - final IModelCellEditHandler editHandler, final EStructuralFeature feature, - final EObject source) { - this.composite = new FloatComposite(parent); - if (originalValue != null) { - if (originalValue instanceof Float) { - this.composite.setValue((Float) originalValue); - } else { - Logger.logError("An instance of Float was expected", //$NON-NLS-1$ - Activator.getDefault()); - } - } - this.composite.addCommitListener(new IListener() { - public void handleEvent() { - editHandler.commit(); - } - }); - return this.composite; - } - - public Object getValue() { - return this.composite.getValue(); - } - -}
diff --git a/org.eclipse.modisco.facet.widgets.celleditors.ecore/src/org/eclipse/emf/facet/widgets/celleditors/ecore/EIntCellEditor.java b/org.eclipse.modisco.facet.widgets.celleditors.ecore/src/org/eclipse/emf/facet/widgets/celleditors/ecore/EIntCellEditor.java deleted file mode 100644 index 3f5a1b2..0000000 --- a/org.eclipse.modisco.facet.widgets.celleditors.ecore/src/org/eclipse/emf/facet/widgets/celleditors/ecore/EIntCellEditor.java +++ /dev/null
@@ -1,52 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2010 CEA LIST. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Nicolas Guyomar (Mia-Software) - initial API and implementation - * Nicolas Bros (Mia-Software) - Bug 334539 - [celleditors] change listener - *****************************************************************************/ -package org.eclipse.emf.facet.widgets.celleditors.ecore; - -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.EStructuralFeature; -import org.eclipse.emf.facet.util.core.Logger; -import org.eclipse.emf.facet.widgets.celleditors.IListener; -import org.eclipse.emf.facet.widgets.celleditors.IModelCellEditHandler; -import org.eclipse.emf.facet.widgets.celleditors.IModelCellEditor; -import org.eclipse.emf.facet.widgets.celleditors.ecore.composite.IntComposite; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Control; - -/** A cell editor for Integer */ -public class EIntCellEditor implements IModelCellEditor { - - private IntComposite composite = null; - - public Control activateCell(final Composite parent, final Object originalValue, - final IModelCellEditHandler editHandler, final EStructuralFeature feature, - final EObject source) { - this.composite = new IntComposite(parent); - if (originalValue != null) { - if (originalValue instanceof Integer) { - this.composite.setValue((Integer) originalValue); - } else { - Logger.logError("An instance of Integer was expected", Activator.getDefault()); //$NON-NLS-1$ - } - } - this.composite.addCommitListener(new IListener() { - public void handleEvent() { - editHandler.commit(); - } - }); - return this.composite; - } - - public Object getValue() { - return this.composite.getValue(); - } -} \ No newline at end of file
diff --git a/org.eclipse.modisco.facet.widgets.celleditors.ecore/src/org/eclipse/emf/facet/widgets/celleditors/ecore/ELongCellEditor.java b/org.eclipse.modisco.facet.widgets.celleditors.ecore/src/org/eclipse/emf/facet/widgets/celleditors/ecore/ELongCellEditor.java deleted file mode 100644 index c4ae183..0000000 --- a/org.eclipse.modisco.facet.widgets.celleditors.ecore/src/org/eclipse/emf/facet/widgets/celleditors/ecore/ELongCellEditor.java +++ /dev/null
@@ -1,54 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2010 CEA LIST. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Nicolas Guyomar (Mia-Software) - initial API and implementation - * Nicolas Bros (Mia-Software) - Bug 334539 - [celleditors] change listener - *****************************************************************************/ -package org.eclipse.emf.facet.widgets.celleditors.ecore; - -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.EStructuralFeature; -import org.eclipse.emf.facet.util.core.Logger; -import org.eclipse.emf.facet.widgets.celleditors.IListener; -import org.eclipse.emf.facet.widgets.celleditors.IModelCellEditHandler; -import org.eclipse.emf.facet.widgets.celleditors.IModelCellEditor; -import org.eclipse.emf.facet.widgets.celleditors.ecore.composite.LongComposite; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Control; - -/** A cell editor for Long */ -public class ELongCellEditor implements IModelCellEditor { - - private LongComposite composite = null; - - public Control activateCell(final Composite parent, final Object originalValue, - final IModelCellEditHandler editHandler, final EStructuralFeature feature, - final EObject source) { - this.composite = new LongComposite(parent); - if (originalValue != null) { - if (originalValue instanceof Long) { - this.composite.setValue((Long) originalValue); - } else { - Logger.logError("An instance of Long was expected", //$NON-NLS-1$ - Activator.getDefault()); - } - } - this.composite.addCommitListener(new IListener() { - public void handleEvent() { - editHandler.commit(); - } - }); - return this.composite; - } - - public Object getValue() { - return this.composite.getValue(); - } - -}
diff --git a/org.eclipse.modisco.facet.widgets.celleditors.ecore/src/org/eclipse/emf/facet/widgets/celleditors/ecore/EShortCellEditor.java b/org.eclipse.modisco.facet.widgets.celleditors.ecore/src/org/eclipse/emf/facet/widgets/celleditors/ecore/EShortCellEditor.java deleted file mode 100644 index 4e8b005..0000000 --- a/org.eclipse.modisco.facet.widgets.celleditors.ecore/src/org/eclipse/emf/facet/widgets/celleditors/ecore/EShortCellEditor.java +++ /dev/null
@@ -1,52 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2010 CEA LIST. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Nicolas Guyomar (Mia-Software) - initial API and implementation - * Nicolas Bros (Mia-Software) - Bug 334539 - [celleditors] change listener - *****************************************************************************/ -package org.eclipse.emf.facet.widgets.celleditors.ecore; - -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.EStructuralFeature; -import org.eclipse.emf.facet.util.core.Logger; -import org.eclipse.emf.facet.widgets.celleditors.IListener; -import org.eclipse.emf.facet.widgets.celleditors.IModelCellEditHandler; -import org.eclipse.emf.facet.widgets.celleditors.IModelCellEditor; -import org.eclipse.emf.facet.widgets.celleditors.ecore.composite.ShortComposite; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Control; - -/** A cell editor for Short */ -public class EShortCellEditor implements IModelCellEditor { - - private ShortComposite composite = null; - - public Control activateCell(final Composite parent, final Object originalValue, - final IModelCellEditHandler editHandler, final EStructuralFeature feature, - final EObject source) { - this.composite = new ShortComposite(parent); - if (originalValue != null) { - if (originalValue instanceof Short) { - this.composite.setValue((Short) originalValue); - } else { - Logger.logError("An instance of Short was expected", Activator.getDefault()); //$NON-NLS-1$ - } - } - this.composite.addCommitListener(new IListener() { - public void handleEvent() { - editHandler.commit(); - } - }); - return this.composite; - } - - public Object getValue() { - return this.composite.getValue(); - } -}
diff --git a/org.eclipse.modisco.facet.widgets.celleditors.ecore/src/org/eclipse/emf/facet/widgets/celleditors/ecore/EStringMultiCellEditor.java b/org.eclipse.modisco.facet.widgets.celleditors.ecore/src/org/eclipse/emf/facet/widgets/celleditors/ecore/EStringMultiCellEditor.java deleted file mode 100644 index 426f497..0000000 --- a/org.eclipse.modisco.facet.widgets.celleditors.ecore/src/org/eclipse/emf/facet/widgets/celleditors/ecore/EStringMultiCellEditor.java +++ /dev/null
@@ -1,45 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2010 CEA LIST. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Nicolas Guyomar (Mia-Software) - initial API and implementation - * Nicolas Bros (Mia-Software) - Bug 334539 - [celleditors] change listener - *****************************************************************************/ -package org.eclipse.emf.facet.widgets.celleditors.ecore; - -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.EStructuralFeature; -import org.eclipse.emf.facet.widgets.celleditors.IListener; -import org.eclipse.emf.facet.widgets.celleditors.IModelCellEditHandler; -import org.eclipse.emf.facet.widgets.celleditors.IModelCellEditor; -import org.eclipse.emf.facet.widgets.celleditors.ecore.composite.StringMultiComposite; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Control; - -/** A cell editor for multiple line Strings */ -public class EStringMultiCellEditor implements IModelCellEditor { - - private StringMultiComposite<String> composite = null; - - public Control activateCell(final Composite parent, final Object originalValue, - final IModelCellEditHandler editHandler, final EStructuralFeature feature, - final EObject source) { - this.composite = new StringMultiComposite<String>(parent, originalValue); - - this.composite.addCommitListener(new IListener() { - public void handleEvent() { - editHandler.commit(); - } - }); - return this.composite; - } - - public Object getValue() { - return this.composite.getValue(); - } -} \ No newline at end of file
diff --git a/org.eclipse.modisco.facet.widgets.celleditors.ecore/src/org/eclipse/emf/facet/widgets/celleditors/ecore/Messages.java b/org.eclipse.modisco.facet.widgets.celleditors.ecore/src/org/eclipse/emf/facet/widgets/celleditors/ecore/Messages.java deleted file mode 100644 index 5bb7990..0000000 --- a/org.eclipse.modisco.facet.widgets.celleditors.ecore/src/org/eclipse/emf/facet/widgets/celleditors/ecore/Messages.java +++ /dev/null
@@ -1,26 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2010 CEA LIST. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Nicolas Bros (Mia-Software) - initial API and implementation - *****************************************************************************/ -package org.eclipse.emf.facet.widgets.celleditors.ecore; - -import org.eclipse.osgi.util.NLS; - -public class Messages extends NLS { - private static final String BUNDLE_NAME = "org.eclipse.emf.facet.widgets.celleditors.ecore.messages"; //$NON-NLS-1$ - public static String MultiLineDialog_enterAValue; - static { - // initialize resource bundle - NLS.initializeMessages(Messages.BUNDLE_NAME, Messages.class); - } - - private Messages() { - } -}
diff --git a/org.eclipse.modisco.facet.widgets.celleditors.ecore/src/org/eclipse/emf/facet/widgets/celleditors/ecore/composite/BigDecimalComposite.java b/org.eclipse.modisco.facet.widgets.celleditors.ecore/src/org/eclipse/emf/facet/widgets/celleditors/ecore/composite/BigDecimalComposite.java deleted file mode 100644 index c4f7744..0000000 --- a/org.eclipse.modisco.facet.widgets.celleditors.ecore/src/org/eclipse/emf/facet/widgets/celleditors/ecore/composite/BigDecimalComposite.java +++ /dev/null
@@ -1,87 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2010 CEA LIST. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Nicolas Guyomar (Mia-Software) - initial API and implementation - * Nicolas Guyomar (Mia-Software) - Bug 334546 - [celleditors] no border on Text field - *****************************************************************************/ -package org.eclipse.emf.facet.widgets.celleditors.ecore.composite; - -import java.math.BigDecimal; - -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.Status; -import org.eclipse.emf.facet.widgets.celleditors.ecore.Activator; -import org.eclipse.swt.SWT; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Event; -import org.eclipse.swt.widgets.Listener; - -public class BigDecimalComposite extends StringComposite<BigDecimal> { - - public BigDecimalComposite(final Composite parent) { - this(parent, SWT.NONE); - } - - public BigDecimalComposite(final Composite parent, final int style) { - super(parent, style); - getTextField().addListener(SWT.Verify, new Listener() { - public void handleEvent(final Event event) { - String input = event.text; - for (int i = 0; i < input.length(); i++) { - char ch = input.charAt(i); - if (ch == '.') { - if (BigDecimalComposite.this.getTextField().getText().indexOf('.') != -1) { - event.doit = false; - return; - } - } else { - if (!('0' <= ch && ch <= '9')) { - event.doit = false; - return; - } - } - } - - } - }); - } - - @Override - public IConverter<BigDecimal> initConverter() { - return new IConverter<BigDecimal>() { - public BigDecimal toObject(final String string) { - if (string != null && string.length() > 0) { - try { - return new BigDecimal(string); - } catch (Exception e) { - return null; - } - } - return null; - } - - public String toString(final BigDecimal object) { - return object.toString(); - } - }; - } - - @Override - public IStatus validate(final String string) { - try { - // The instantiation of the BigDecimal is only used to validate this string - @SuppressWarnings("unused") - BigDecimal bigDecimal = new BigDecimal(string); - } catch (Exception e) { - return new Status(IStatus.ERROR, Activator.PLUGIN_ID, ""); //$NON-NLS-1$ - } - return new Status(IStatus.OK, Activator.PLUGIN_ID, ""); //$NON-NLS-1$ - } - -}
diff --git a/org.eclipse.modisco.facet.widgets.celleditors.ecore/src/org/eclipse/emf/facet/widgets/celleditors/ecore/composite/BigDecimalCompositeFactory.java b/org.eclipse.modisco.facet.widgets.celleditors.ecore/src/org/eclipse/emf/facet/widgets/celleditors/ecore/composite/BigDecimalCompositeFactory.java deleted file mode 100644 index 1ab1cb6..0000000 --- a/org.eclipse.modisco.facet.widgets.celleditors.ecore/src/org/eclipse/emf/facet/widgets/celleditors/ecore/composite/BigDecimalCompositeFactory.java +++ /dev/null
@@ -1,31 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2011 Mia-Software. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Fabien Giquel (Mia-Software) - initial API and implementation - * Nicolas Guyomar (Mia-Software) - Bug 334546 - [celleditors] no border on Text field - * Nicolas Bros (Mia-Software) - Bug 338437 - compositeEditors extension point cannot be used to register user types - *******************************************************************************/ -package org.eclipse.emf.facet.widgets.celleditors.ecore.composite; - -import java.math.BigDecimal; - -import org.eclipse.emf.facet.widgets.celleditors.AbstractCellEditorComposite; -import org.eclipse.emf.facet.widgets.celleditors.ICompositeEditorFactory; -import org.eclipse.swt.widgets.Composite; - -public class BigDecimalCompositeFactory implements ICompositeEditorFactory<BigDecimal> { - - public AbstractCellEditorComposite<BigDecimal> createCompositeEditor(final Composite parent, final int style) { - return new BigDecimalComposite(parent, style); - } - - public Class<BigDecimal> getHandledType() { - return BigDecimal.class; - } - -}
diff --git a/org.eclipse.modisco.facet.widgets.celleditors.ecore/src/org/eclipse/emf/facet/widgets/celleditors/ecore/composite/BigIntegerComposite.java b/org.eclipse.modisco.facet.widgets.celleditors.ecore/src/org/eclipse/emf/facet/widgets/celleditors/ecore/composite/BigIntegerComposite.java deleted file mode 100644 index 7b1a94e..0000000 --- a/org.eclipse.modisco.facet.widgets.celleditors.ecore/src/org/eclipse/emf/facet/widgets/celleditors/ecore/composite/BigIntegerComposite.java +++ /dev/null
@@ -1,82 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2010 CEA LIST. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Nicolas Guyomar (Mia-Software) - initial API and implementation - * Nicolas Guyomar (Mia-Software) - Bug 334546 - [celleditors] no border on Text field - *****************************************************************************/ -package org.eclipse.emf.facet.widgets.celleditors.ecore.composite; - -import java.math.BigInteger; - -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.Status; -import org.eclipse.emf.facet.widgets.celleditors.ecore.Activator; -import org.eclipse.swt.SWT; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Event; -import org.eclipse.swt.widgets.Listener; - -public class BigIntegerComposite extends StringComposite<BigInteger> { - - public BigIntegerComposite(final Composite parent) { - this(parent, SWT.NONE); - } - - public BigIntegerComposite(final Composite parent, final int style) { - super(parent, style); - getTextField().addListener(SWT.Verify, new Listener() { - - public void handleEvent(final Event event) { - - String input = event.text; - for (int i = 0; i < input.length(); i++) { - char ch = input.charAt(i); - if (!('0' <= ch && ch <= '9')) { - event.doit = false; - return; - } - } - } - }); - } - - @Override - public IConverter<BigInteger> initConverter() { - return new IConverter<BigInteger>() { - - public BigInteger toObject(final String string) { - if (string != null && string.length() > 0) { - try { - return new BigInteger(string); - } catch (Exception e) { - return null; - } - } - return null; - } - - public String toString(final BigInteger object) { - return object.toString(); - } - }; - } - - @Override - @SuppressWarnings("unused") - // The instantiation of the BigInteger is only used to validate this string - public IStatus validate(final String string) { - try { - new BigInteger(string); - } catch (Exception e) { - return new Status(IStatus.ERROR, Activator.PLUGIN_ID, ""); //$NON-NLS-1$ - } - return new Status(IStatus.OK, Activator.PLUGIN_ID, ""); //$NON-NLS-1$ - } - -}
diff --git a/org.eclipse.modisco.facet.widgets.celleditors.ecore/src/org/eclipse/emf/facet/widgets/celleditors/ecore/composite/BigIntegerCompositeFactory.java b/org.eclipse.modisco.facet.widgets.celleditors.ecore/src/org/eclipse/emf/facet/widgets/celleditors/ecore/composite/BigIntegerCompositeFactory.java deleted file mode 100644 index adeaafe..0000000 --- a/org.eclipse.modisco.facet.widgets.celleditors.ecore/src/org/eclipse/emf/facet/widgets/celleditors/ecore/composite/BigIntegerCompositeFactory.java +++ /dev/null
@@ -1,31 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2011 Mia-Software. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Fabien Giquel (Mia-Software) - initial API and implementation - * Nicolas Guyomar (Mia-Software) - Bug 334546 - [celleditors] no border on Text field - * Nicolas Bros (Mia-Software) - Bug 338437 - compositeEditors extension point cannot be used to register user types - *******************************************************************************/ -package org.eclipse.emf.facet.widgets.celleditors.ecore.composite; - -import java.math.BigInteger; - -import org.eclipse.emf.facet.widgets.celleditors.AbstractCellEditorComposite; -import org.eclipse.emf.facet.widgets.celleditors.ICompositeEditorFactory; -import org.eclipse.swt.widgets.Composite; - -public class BigIntegerCompositeFactory implements ICompositeEditorFactory<BigInteger> { - - public AbstractCellEditorComposite<BigInteger> createCompositeEditor(final Composite parent, final int style) { - return new BigIntegerComposite(parent, style); - } - - public Class<BigInteger> getHandledType() { - return BigInteger.class; - } - -}
diff --git a/org.eclipse.modisco.facet.widgets.celleditors.ecore/src/org/eclipse/emf/facet/widgets/celleditors/ecore/composite/BooleanComposite.java b/org.eclipse.modisco.facet.widgets.celleditors.ecore/src/org/eclipse/emf/facet/widgets/celleditors/ecore/composite/BooleanComposite.java deleted file mode 100644 index 3ac6ad0..0000000 --- a/org.eclipse.modisco.facet.widgets.celleditors.ecore/src/org/eclipse/emf/facet/widgets/celleditors/ecore/composite/BooleanComposite.java +++ /dev/null
@@ -1,148 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2010 CEA LIST. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Nicolas Guyomar (Mia-Software) - initial API and implementation - * Nicolas Guyomar (Mia-Software) - Bug 334546 - [celleditors] no border on Text field - * Nicolas Bros (Mia-Software) - Bug 334539 - [celleditors] change listener - *****************************************************************************/ -package org.eclipse.emf.facet.widgets.celleditors.ecore.composite; - -import org.eclipse.emf.facet.widgets.celleditors.AbstractCellEditorComposite; -import org.eclipse.swt.SWT; -import org.eclipse.swt.events.DisposeEvent; -import org.eclipse.swt.events.DisposeListener; -import org.eclipse.swt.events.KeyAdapter; -import org.eclipse.swt.events.KeyEvent; -import org.eclipse.swt.events.SelectionAdapter; -import org.eclipse.swt.events.SelectionEvent; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.layout.GridLayout; -import org.eclipse.swt.widgets.Combo; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Control; -import org.eclipse.swt.widgets.Display; -import org.eclipse.swt.widgets.Event; -import org.eclipse.swt.widgets.Listener; - -public class BooleanComposite extends AbstractCellEditorComposite<Boolean> { - - private Combo combo = null; - private boolean enableSelectionListener = true; - private Control parentControl = null; - - public BooleanComposite(final Composite parent) { - this(parent, SWT.NONE); - } - - public BooleanComposite(final Composite parent, final int style) { - super(parent, style); - this.parentControl = parent; - GridLayout gd = new GridLayout(1, false); - gd.marginHeight = 0; - gd.marginWidth = 0; - gd.horizontalSpacing = 0; - setLayout(gd); - - this.combo = new Combo(this, SWT.READ_ONLY); - this.combo.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true)); - this.combo.setItems(new String[] { "true", "false" }); //$NON-NLS-1$ //$NON-NLS-2$ - this.combo.addKeyListener(new KeyAdapter() { - @Override - public void keyPressed(final KeyEvent event) { - - if ((event.keyCode == SWT.CR && event.stateMask == 0)) { - // Enter key pressed - commit(); - } else if (event.keyCode == SWT.ESC && event.stateMask == 0 - || (event.keyCode == SWT.KEYPAD_CR && event.stateMask == 0)) { - // Escape key pressed - close(); - } - BooleanComposite.this.setEnableSelectionListener(false); - } - }); - - this.combo.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(final SelectionEvent e) { - if (BooleanComposite.this.getEnableSelectionListener()) { - fireChanged(); - commit(); - super.widgetSelected(e); - } - BooleanComposite.this.setEnableSelectionListener(true); - } - }); - - // commit the cell editor when the mouse is clicked - // anywhere outside the text field - final Listener clickListener = new Listener() { - public void handleEvent(final Event event) { - if (event.widget instanceof Control) { - Control control = (Control) event.widget; - if (control.getShell() == BooleanComposite.this.getParentControl().getShell()) { - if (event.widget != BooleanComposite.this.getCombo()) { - commit(); - } - } - } - } - }; - Display.getDefault().addFilter(SWT.MouseDown, clickListener); - - // this listener is only here to remove - // the other listener from the Display - getCombo().addDisposeListener(new DisposeListener() { - public void widgetDisposed(final DisposeEvent e) { - Display.getDefault().removeFilter(SWT.MouseDown, clickListener); - } - }); - - this.combo.forceFocus(); - } - - protected void commit() { - fireCommit(); - } - - public Boolean getValue() { - if (this.combo.getSelectionIndex() == 0) { - return Boolean.TRUE; - } - return Boolean.FALSE; - - } - - public void setValue(final Boolean value) { - if (value != null) { - if (value.booleanValue()) { - this.combo.select(0); - } else { - this.combo.select(1); - } - } - } - - protected Combo getCombo() { - return this.combo; - } - - protected boolean getEnableSelectionListener() { - return this.enableSelectionListener; - } - - protected void setEnableSelectionListener(final boolean value) { - this.enableSelectionListener = value; - } - - protected Control getParentControl() { - return this.parentControl; - } - -}
diff --git a/org.eclipse.modisco.facet.widgets.celleditors.ecore/src/org/eclipse/emf/facet/widgets/celleditors/ecore/composite/BooleanCompositeFactory.java b/org.eclipse.modisco.facet.widgets.celleditors.ecore/src/org/eclipse/emf/facet/widgets/celleditors/ecore/composite/BooleanCompositeFactory.java deleted file mode 100644 index 8eef8cf..0000000 --- a/org.eclipse.modisco.facet.widgets.celleditors.ecore/src/org/eclipse/emf/facet/widgets/celleditors/ecore/composite/BooleanCompositeFactory.java +++ /dev/null
@@ -1,29 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2011 Mia-Software. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Fabien Giquel (Mia-Software) - initial API and implementation - * Nicolas Guyomar (Mia-Software) - Bug 334546 - [celleditors] no border on Text field - * Nicolas Bros (Mia-Software) - Bug 338437 - compositeEditors extension point cannot be used to register user types - *******************************************************************************/ -package org.eclipse.emf.facet.widgets.celleditors.ecore.composite; - -import org.eclipse.emf.facet.widgets.celleditors.AbstractCellEditorComposite; -import org.eclipse.emf.facet.widgets.celleditors.ICompositeEditorFactory; -import org.eclipse.swt.widgets.Composite; - -public class BooleanCompositeFactory implements ICompositeEditorFactory<Boolean> { - - public AbstractCellEditorComposite<Boolean> createCompositeEditor(final Composite parent, final int style) { - return new BooleanComposite(parent, style); - } - - public Class<Boolean> getHandledType() { - return Boolean.class; - } - -}
diff --git a/org.eclipse.modisco.facet.widgets.celleditors.ecore/src/org/eclipse/emf/facet/widgets/celleditors/ecore/composite/ByteComposite.java b/org.eclipse.modisco.facet.widgets.celleditors.ecore/src/org/eclipse/emf/facet/widgets/celleditors/ecore/composite/ByteComposite.java deleted file mode 100644 index fff4e48..0000000 --- a/org.eclipse.modisco.facet.widgets.celleditors.ecore/src/org/eclipse/emf/facet/widgets/celleditors/ecore/composite/ByteComposite.java +++ /dev/null
@@ -1,113 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2010 CEA LIST. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Nicolas Guyomar (Mia-Software) - initial API and implementation - * Nicolas Guyomar (Mia-Software) - Bug 334546 - [celleditors] no border on Text field - *****************************************************************************/ -package org.eclipse.emf.facet.widgets.celleditors.ecore.composite; - -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.Status; -import org.eclipse.emf.facet.widgets.celleditors.IValidator; -import org.eclipse.emf.facet.widgets.celleditors.ecore.Activator; -import org.eclipse.swt.SWT; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Event; -import org.eclipse.swt.widgets.Listener; - -public class ByteComposite extends StringComposite<Byte> { - - public ByteComposite(final Composite parent) { - this(parent, SWT.NONE); - } - - public ByteComposite(final Composite parent, final int style) { - super(parent, style); - - getTextField().addListener(SWT.Verify, new Listener() { - - public void handleEvent(final Event event) { - - String input = event.text; - for (int i = 0; i < input.length(); i++) { - char ch = input.charAt(i); - if (ch != '-') { - if (!('0' <= ch && ch <= '9')) { - event.doit = false; - return; - } - } else { - if (ByteComposite.this.getTextField().getText().indexOf('-') != -1) { - event.doit = false; - return; - } - // If the '-' caracter is not type at the beginning of - // the String - if (event.start != 0) { - event.doit = false; - return; - } - } - } - } - - }); - } - - @Override - public IValidator getValidator() { - return new IValidator() { - public IStatus validate(final Object object) { - if (getValue() != null) { - if (Byte.MIN_VALUE <= getValue().byteValue() - && getValue().byteValue() <= Byte.MAX_VALUE) { - return Status.OK_STATUS; - } - } - return new Status(IStatus.ERROR, Activator.PLUGIN_ID, ""); //$NON-NLS-1$ - } - }; - } - - @Override - public IConverter<Byte> initConverter() { - return new IConverter<Byte>() { - - public Byte toObject(final String string) { - if (string != null && string.length() > 0) { - try { - return new Byte(string); - } catch (Exception e) { - e.printStackTrace(); - return null; - } - - } - return null; - } - - public String toString(final Byte object) { - return object.toString(); - } - }; - } - - @Override - public IStatus validate(final String string) { - try { - if (string.length() > 0) { - Byte.parseByte(string); - } - } catch (Exception e) { - return new Status(IStatus.ERROR, Activator.PLUGIN_ID, ""); //$NON-NLS-1$ - } - return new Status(IStatus.OK, Activator.PLUGIN_ID, ""); //$NON-NLS-1$ - } - -}
diff --git a/org.eclipse.modisco.facet.widgets.celleditors.ecore/src/org/eclipse/emf/facet/widgets/celleditors/ecore/composite/ByteCompositeFactory.java b/org.eclipse.modisco.facet.widgets.celleditors.ecore/src/org/eclipse/emf/facet/widgets/celleditors/ecore/composite/ByteCompositeFactory.java deleted file mode 100644 index ea2de04..0000000 --- a/org.eclipse.modisco.facet.widgets.celleditors.ecore/src/org/eclipse/emf/facet/widgets/celleditors/ecore/composite/ByteCompositeFactory.java +++ /dev/null
@@ -1,29 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2011 Mia-Software. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Fabien Giquel (Mia-Software) - initial API and implementation - * Nicolas Guyomar (Mia-Software) - Bug 334546 - [celleditors] no border on Text field - * Nicolas Bros (Mia-Software) - Bug 338437 - compositeEditors extension point cannot be used to register user types - *******************************************************************************/ -package org.eclipse.emf.facet.widgets.celleditors.ecore.composite; - -import org.eclipse.emf.facet.widgets.celleditors.AbstractCellEditorComposite; -import org.eclipse.emf.facet.widgets.celleditors.ICompositeEditorFactory; -import org.eclipse.swt.widgets.Composite; - -public class ByteCompositeFactory implements ICompositeEditorFactory<Byte> { - - public AbstractCellEditorComposite<Byte> createCompositeEditor(final Composite parent, final int style) { - return new ByteComposite(parent, style); - } - - public Class<Byte> getHandledType() { - return Byte.class; - } - -}
diff --git a/org.eclipse.modisco.facet.widgets.celleditors.ecore/src/org/eclipse/emf/facet/widgets/celleditors/ecore/composite/CharComposite.java b/org.eclipse.modisco.facet.widgets.celleditors.ecore/src/org/eclipse/emf/facet/widgets/celleditors/ecore/composite/CharComposite.java deleted file mode 100644 index 87689fd..0000000 --- a/org.eclipse.modisco.facet.widgets.celleditors.ecore/src/org/eclipse/emf/facet/widgets/celleditors/ecore/composite/CharComposite.java +++ /dev/null
@@ -1,76 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2010 CEA LIST. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Nicolas Guyomar (Mia-Software) - initial API and implementation - * Nicolas Guyomar (Mia-Software) - Bug 334546 - [celleditors] no border on Text field - * Nicolas Bros (Mia-Software) - Bug 343655 - CharComposite : magic numbers - *****************************************************************************/ -package org.eclipse.emf.facet.widgets.celleditors.ecore.composite; - -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.Status; -import org.eclipse.emf.facet.widgets.celleditors.ecore.Activator; -import org.eclipse.swt.SWT; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Event; -import org.eclipse.swt.widgets.Listener; - -public class CharComposite extends StringComposite<Character> { - - public CharComposite(final Composite parent) { - this(parent, SWT.NONE); - } - - public CharComposite(final Composite parent, final int style) { - super(parent, style); - getTextField().addListener(SWT.Verify, new Listener() { - - public void handleEvent(final Event event) { - if (event.keyCode != SWT.BS && event.keyCode != SWT.DEL) { - if (CharComposite.this.getTextField().getSelectionCount() < 1) { - if (CharComposite.this.getTextField().getText().length() >= 1) { - event.doit = false; - return; - } - } - } - } - }); - } - - @Override - public IConverter<Character> initConverter() { - return new IConverter<Character>() { - - public Character toObject(final String string) { - if (string != null && string.length() > 0) { - try { - return new Character(string.charAt(0)); - } catch (Exception e) { - return null; - } - } - return null; - } - - public String toString(final Character object) { - return object.toString(); - } - }; - } - - @Override - public IStatus validate(final String string) { - if (string.length() == 1) { - return new Status(IStatus.OK, Activator.PLUGIN_ID, ""); //$NON-NLS-1$ - } - return new Status(IStatus.ERROR, Activator.PLUGIN_ID, ""); //$NON-NLS-1$ - - } -}
diff --git a/org.eclipse.modisco.facet.widgets.celleditors.ecore/src/org/eclipse/emf/facet/widgets/celleditors/ecore/composite/CharCompositeFactory.java b/org.eclipse.modisco.facet.widgets.celleditors.ecore/src/org/eclipse/emf/facet/widgets/celleditors/ecore/composite/CharCompositeFactory.java deleted file mode 100644 index 1f45b5c..0000000 --- a/org.eclipse.modisco.facet.widgets.celleditors.ecore/src/org/eclipse/emf/facet/widgets/celleditors/ecore/composite/CharCompositeFactory.java +++ /dev/null
@@ -1,29 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2011 Mia-Software. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Fabien Giquel (Mia-Software) - initial API and implementation - * Nicolas Guyomar (Mia-Software) - Bug 334546 - [celleditors] no border on Text field - * Nicolas Bros (Mia-Software) - Bug 338437 - compositeEditors extension point cannot be used to register user types - *******************************************************************************/ -package org.eclipse.emf.facet.widgets.celleditors.ecore.composite; - -import org.eclipse.emf.facet.widgets.celleditors.AbstractCellEditorComposite; -import org.eclipse.emf.facet.widgets.celleditors.ICompositeEditorFactory; -import org.eclipse.swt.widgets.Composite; - -public class CharCompositeFactory implements ICompositeEditorFactory<Character> { - - public AbstractCellEditorComposite<Character> createCompositeEditor(final Composite parent, final int style) { - return new CharComposite(parent, style); - } - - public Class<Character> getHandledType() { - return Character.class; - } - -}
diff --git a/org.eclipse.modisco.facet.widgets.celleditors.ecore/src/org/eclipse/emf/facet/widgets/celleditors/ecore/composite/DoubleComposite.java b/org.eclipse.modisco.facet.widgets.celleditors.ecore/src/org/eclipse/emf/facet/widgets/celleditors/ecore/composite/DoubleComposite.java deleted file mode 100644 index 16a3090..0000000 --- a/org.eclipse.modisco.facet.widgets.celleditors.ecore/src/org/eclipse/emf/facet/widgets/celleditors/ecore/composite/DoubleComposite.java +++ /dev/null
@@ -1,107 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2010 CEA LIST. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Nicolas Guyomar (Mia-Software) - initial API and implementation - * Nicolas Guyomar (Mia-Software) - Bug 334546 - [celleditors] no border on Text field - *****************************************************************************/ -package org.eclipse.emf.facet.widgets.celleditors.ecore.composite; - -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.Status; -import org.eclipse.emf.facet.widgets.celleditors.IValidator; -import org.eclipse.emf.facet.widgets.celleditors.ecore.Activator; -import org.eclipse.swt.SWT; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Event; -import org.eclipse.swt.widgets.Listener; - -public class DoubleComposite extends StringComposite<Double> { - - public DoubleComposite(final Composite parent) { - this(parent, SWT.NONE); - } - - public DoubleComposite(final Composite parent, final int style) { - super(parent, style); - - getTextField().addListener(SWT.Verify, new Listener() { - - public void handleEvent(final Event event) { - - String input = event.text; - for (int i = 0; i < input.length(); i++) { - char ch = input.charAt(i); - if (ch != '-') { - if (ch == '.') { - if (DoubleComposite.this.getTextField().getText().indexOf('.') != -1) { - event.doit = false; - return; - } - } else { - if (!('0' <= ch && ch <= '9')) { - event.doit = false; - return; - } - } - } - } - } - - }); - } - - @Override - public IValidator getValidator() { - return new IValidator() { - public IStatus validate(final Object object) { - if (getValue() != null) { - if (Double.MIN_VALUE <= getValue().doubleValue() - && getValue().doubleValue() <= Double.MAX_VALUE) { - return Status.OK_STATUS; - } - } - return new Status(IStatus.ERROR, Activator.PLUGIN_ID, ""); //$NON-NLS-1$ - } - }; - } - - @Override - public IConverter<Double> initConverter() { - return new IConverter<Double>() { - - public Double toObject(final String string) { - if (string != null && string.length() > 0) { - try { - return new Double(string); - } catch (Exception e) { - return null; - } - } - return null; - } - - public String toString(final Double object) { - return object.toString(); - } - }; - } - - @Override - public IStatus validate(final String string) { - try { - if (string.length() > 0) { - Double.parseDouble(string); - } - } catch (Exception e) { - return new Status(IStatus.ERROR, Activator.PLUGIN_ID, ""); //$NON-NLS-1$ - } - return new Status(IStatus.OK, Activator.PLUGIN_ID, ""); //$NON-NLS-1$ - } - -}
diff --git a/org.eclipse.modisco.facet.widgets.celleditors.ecore/src/org/eclipse/emf/facet/widgets/celleditors/ecore/composite/DoubleCompositeFactory.java b/org.eclipse.modisco.facet.widgets.celleditors.ecore/src/org/eclipse/emf/facet/widgets/celleditors/ecore/composite/DoubleCompositeFactory.java deleted file mode 100644 index 51b4f59..0000000 --- a/org.eclipse.modisco.facet.widgets.celleditors.ecore/src/org/eclipse/emf/facet/widgets/celleditors/ecore/composite/DoubleCompositeFactory.java +++ /dev/null
@@ -1,27 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2011 Mia-Software. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Fabien Giquel (Mia-Software) - initial API and implementation - * Nicolas Guyomar (Mia-Software) - Bug 334546 - [celleditors] no border on Text field - * Nicolas Bros (Mia-Software) - Bug 338437 - compositeEditors extension point cannot be used to register user types - *******************************************************************************/ -package org.eclipse.emf.facet.widgets.celleditors.ecore.composite; - -import org.eclipse.emf.facet.widgets.celleditors.AbstractCellEditorComposite; -import org.eclipse.emf.facet.widgets.celleditors.ICompositeEditorFactory; -import org.eclipse.swt.widgets.Composite; - -public class DoubleCompositeFactory implements ICompositeEditorFactory<Double> { - public AbstractCellEditorComposite<Double> createCompositeEditor(final Composite parent, final int style) { - return new DoubleComposite(parent, style); - } - - public Class<Double> getHandledType() { - return Double.class; - } -}
diff --git a/org.eclipse.modisco.facet.widgets.celleditors.ecore/src/org/eclipse/emf/facet/widgets/celleditors/ecore/composite/FloatComposite.java b/org.eclipse.modisco.facet.widgets.celleditors.ecore/src/org/eclipse/emf/facet/widgets/celleditors/ecore/composite/FloatComposite.java deleted file mode 100644 index d6f9d43..0000000 --- a/org.eclipse.modisco.facet.widgets.celleditors.ecore/src/org/eclipse/emf/facet/widgets/celleditors/ecore/composite/FloatComposite.java +++ /dev/null
@@ -1,117 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2010 CEA LIST. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Nicolas Guyomar (Mia-Software) - initial API and implementation - * Nicolas Guyomar (Mia-Software) - Bug 334546 - [celleditors] no border on Text field - *****************************************************************************/ -package org.eclipse.emf.facet.widgets.celleditors.ecore.composite; - -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.Status; -import org.eclipse.emf.facet.widgets.celleditors.IValidator; -import org.eclipse.emf.facet.widgets.celleditors.ecore.Activator; -import org.eclipse.swt.SWT; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Event; -import org.eclipse.swt.widgets.Listener; - -public class FloatComposite extends StringComposite<Float> { - - public FloatComposite(final Composite parent) { - this(parent, SWT.NONE); - } - - public FloatComposite(final Composite parent, final int style) { - super(parent, style); - - getTextField().addListener(SWT.Verify, new Listener() { - - public void handleEvent(final Event event) { - - String input = event.text; - for (int i = 0; i < input.length(); i++) { - char ch = input.charAt(i); - if (ch != '-') { - if (ch == '.') { - if (FloatComposite.this.getTextField().getText().indexOf('.') != -1) { - event.doit = false; - return; - } - } else { - if (!('0' <= ch && ch <= '9')) { - event.doit = false; - return; - } - } - } else { - if (FloatComposite.this.getTextField().getText().indexOf('-') != -1) { - event.doit = false; - return; - } - // If the '-' caracter is not type at the beginning of - // the String - if (event.start != 0) { - event.doit = false; - return; - } - } - } - } - - }); - } - - @Override - public IValidator getValidator() { - return new IValidator() { - public IStatus validate(final Object object) { - if (getValue() != null) { - if (Float.MIN_VALUE <= getValue().floatValue() - && getValue().floatValue() <= Float.MAX_VALUE) { - return Status.OK_STATUS; - } - } - return new Status(IStatus.ERROR, Activator.PLUGIN_ID, ""); //$NON-NLS-1$ - } - }; - } - - @Override - public IConverter<Float> initConverter() { - return new IConverter<Float>() { - - public Float toObject(final String string) { - if (string != null && string.length() > 0) { - try { - return new Float(string); - } catch (Exception e) { - return null; - } - } - return null; - } - - public String toString(final Float object) { - return object.toString(); - } - }; - } - - @Override - public IStatus validate(final String string) { - try { - if (string.length() > 0) { - Float.parseFloat(string); - } - } catch (Exception e) { - return new Status(IStatus.ERROR, Activator.PLUGIN_ID, ""); //$NON-NLS-1$ - } - return new Status(IStatus.OK, Activator.PLUGIN_ID, ""); //$NON-NLS-1$ - } -}
diff --git a/org.eclipse.modisco.facet.widgets.celleditors.ecore/src/org/eclipse/emf/facet/widgets/celleditors/ecore/composite/FloatCompositeFactory.java b/org.eclipse.modisco.facet.widgets.celleditors.ecore/src/org/eclipse/emf/facet/widgets/celleditors/ecore/composite/FloatCompositeFactory.java deleted file mode 100644 index 534bd4d..0000000 --- a/org.eclipse.modisco.facet.widgets.celleditors.ecore/src/org/eclipse/emf/facet/widgets/celleditors/ecore/composite/FloatCompositeFactory.java +++ /dev/null
@@ -1,29 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2011 Mia-Software. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Fabien Giquel (Mia-Software) - initial API and implementation - * Nicolas Guyomar (Mia-Software) - Bug 334546 - [celleditors] no border on Text field - * Nicolas Bros (Mia-Software) - Bug 338437 - compositeEditors extension point cannot be used to register user types - *******************************************************************************/ -package org.eclipse.emf.facet.widgets.celleditors.ecore.composite; - -import org.eclipse.emf.facet.widgets.celleditors.AbstractCellEditorComposite; -import org.eclipse.emf.facet.widgets.celleditors.ICompositeEditorFactory; -import org.eclipse.swt.widgets.Composite; - -public class FloatCompositeFactory implements ICompositeEditorFactory<Float> { - - public AbstractCellEditorComposite<Float> createCompositeEditor(final Composite parent, final int style) { - return new FloatComposite(parent, style); - } - - public Class<Float> getHandledType() { - return Float.class; - } - -}
diff --git a/org.eclipse.modisco.facet.widgets.celleditors.ecore/src/org/eclipse/emf/facet/widgets/celleditors/ecore/composite/IntComposite.java b/org.eclipse.modisco.facet.widgets.celleditors.ecore/src/org/eclipse/emf/facet/widgets/celleditors/ecore/composite/IntComposite.java deleted file mode 100644 index 529add5..0000000 --- a/org.eclipse.modisco.facet.widgets.celleditors.ecore/src/org/eclipse/emf/facet/widgets/celleditors/ecore/composite/IntComposite.java +++ /dev/null
@@ -1,110 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2010 CEA LIST. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Nicolas Guyomar (Mia-Software) - initial API and implementation - * Nicolas Guyomar (Mia-Software) - Bug 334546 - [celleditors] no border on Text field - *****************************************************************************/ -package org.eclipse.emf.facet.widgets.celleditors.ecore.composite; - -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.Status; -import org.eclipse.emf.facet.widgets.celleditors.IValidator; -import org.eclipse.emf.facet.widgets.celleditors.ecore.Activator; -import org.eclipse.swt.SWT; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Event; -import org.eclipse.swt.widgets.Listener; - -public class IntComposite extends StringComposite<Integer> { - - public IntComposite(final Composite parent) { - this(parent, SWT.NONE); - } - - public IntComposite(final Composite parent, final int style) { - super(parent, style); - getTextField().addListener(SWT.Verify, new Listener() { - - public void handleEvent(final Event event) { - - String input = event.text; - for (int i = 0; i < input.length(); i++) { - char ch = input.charAt(i); - if (ch != '-') { - if (!('0' <= ch && ch <= '9')) { - event.doit = false; - return; - } - } else { - if (IntComposite.this.getTextField().getText().indexOf('-') != -1) { - event.doit = false; - return; - } - // If the '-' caracter is not type at the beginning of - // the String - if (event.start != 0) { - event.doit = false; - return; - } - } - } - } - - }); - } - - @Override - public IValidator getValidator() { - return new IValidator() { - public IStatus validate(final Object object) { - if (getValue() != null) { - if (Integer.MIN_VALUE <= getValue().intValue() - && getValue().intValue() <= Integer.MAX_VALUE) { - return Status.OK_STATUS; - } - } - return new Status(IStatus.ERROR, Activator.PLUGIN_ID, ""); //$NON-NLS-1$ - } - }; - } - - @Override - public IConverter<Integer> initConverter() { - return new IConverter<Integer>() { - - public Integer toObject(final String string) { - if (string != null && string.length() > 0) { - try { - return new Integer(string); - } catch (Exception e) { - return null; - } - - } - return null; - } - - public String toString(final Integer object) { - return object.toString(); - } - }; - } - - @Override - public IStatus validate(final String string) { - try { - if (string.length() > 0) { - Integer.parseInt(string); - } - } catch (Exception e) { - return new Status(IStatus.ERROR, Activator.PLUGIN_ID, ""); //$NON-NLS-1$ - } - return new Status(IStatus.OK, Activator.PLUGIN_ID, ""); //$NON-NLS-1$ - } -}
diff --git a/org.eclipse.modisco.facet.widgets.celleditors.ecore/src/org/eclipse/emf/facet/widgets/celleditors/ecore/composite/IntCompositeFactory.java b/org.eclipse.modisco.facet.widgets.celleditors.ecore/src/org/eclipse/emf/facet/widgets/celleditors/ecore/composite/IntCompositeFactory.java deleted file mode 100644 index 261718e..0000000 --- a/org.eclipse.modisco.facet.widgets.celleditors.ecore/src/org/eclipse/emf/facet/widgets/celleditors/ecore/composite/IntCompositeFactory.java +++ /dev/null
@@ -1,29 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2011 Mia-Software. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Fabien Giquel (Mia-Software) - initial API and implementation - * Nicolas Guyomar (Mia-Software) - Bug 334546 - [celleditors] no border on Text field - * Nicolas Bros (Mia-Software) - Bug 338437 - compositeEditors extension point cannot be used to register user types - *******************************************************************************/ -package org.eclipse.emf.facet.widgets.celleditors.ecore.composite; - -import org.eclipse.emf.facet.widgets.celleditors.AbstractCellEditorComposite; -import org.eclipse.emf.facet.widgets.celleditors.ICompositeEditorFactory; -import org.eclipse.swt.widgets.Composite; - -public class IntCompositeFactory implements ICompositeEditorFactory<Integer> { - - public AbstractCellEditorComposite<Integer> createCompositeEditor(final Composite parent, final int style) { - return new IntComposite(parent, style); - } - - public Class<Integer> getHandledType() { - return Integer.class; - } - -}
diff --git a/org.eclipse.modisco.facet.widgets.celleditors.ecore/src/org/eclipse/emf/facet/widgets/celleditors/ecore/composite/LongComposite.java b/org.eclipse.modisco.facet.widgets.celleditors.ecore/src/org/eclipse/emf/facet/widgets/celleditors/ecore/composite/LongComposite.java deleted file mode 100644 index 1c30c83..0000000 --- a/org.eclipse.modisco.facet.widgets.celleditors.ecore/src/org/eclipse/emf/facet/widgets/celleditors/ecore/composite/LongComposite.java +++ /dev/null
@@ -1,110 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2010 CEA LIST. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Nicolas Guyomar (Mia-Software) - initial API and implementation - * Nicolas Guyomar (Mia-Software) - Bug 334546 - [celleditors] no border on Text field - *****************************************************************************/ -package org.eclipse.emf.facet.widgets.celleditors.ecore.composite; - -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.Status; -import org.eclipse.emf.facet.widgets.celleditors.IValidator; -import org.eclipse.emf.facet.widgets.celleditors.ecore.Activator; -import org.eclipse.swt.SWT; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Event; -import org.eclipse.swt.widgets.Listener; - -public class LongComposite extends StringComposite<Long> { - - public LongComposite(final Composite parent) { - this(parent, SWT.NONE); - } - - public LongComposite(final Composite parent, final int style) { - super(parent, style); - getTextField().addListener(SWT.Verify, new Listener() { - - public void handleEvent(final Event event) { - - String input = event.text; - for (int i = 0; i < input.length(); i++) { - char ch = input.charAt(i); - if (ch != '-') { - if (!('0' <= ch && ch <= '9')) { - event.doit = false; - return; - } - } else { - if (LongComposite.this.getTextField().getText().indexOf('-') != -1) { - event.doit = false; - return; - } - // If the '-' caracter is not type at the beginning of - // the String - if (event.start != 0) { - event.doit = false; - return; - } - } - } - } - - }); - } - - @Override - public IValidator getValidator() { - return new IValidator() { - public IStatus validate(final Object object) { - if (getValue() != null) { - if (Long.MIN_VALUE <= getValue().longValue() - && getValue().longValue() <= Long.MAX_VALUE) { - return Status.OK_STATUS; - } - } - return new Status(IStatus.ERROR, Activator.PLUGIN_ID, ""); //$NON-NLS-1$ - } - }; - } - - @Override - public IConverter<Long> initConverter() { - return new IConverter<Long>() { - - public Long toObject(final String string) { - if (string != null && string.length() > 0) { - try { - return new Long(string); - } catch (Exception e) { - return null; - } - } - return null; - } - - public String toString(final Long object) { - return object.toString(); - } - }; - } - - @Override - public IStatus validate(final String string) { - try { - if (string.length() > 0) { - Long.parseLong(string); - } - } catch (Exception e) { - return new Status(IStatus.ERROR, Activator.PLUGIN_ID, ""); //$NON-NLS-1$ - } - return new Status(IStatus.OK, Activator.PLUGIN_ID, ""); //$NON-NLS-1$ - } - -}
diff --git a/org.eclipse.modisco.facet.widgets.celleditors.ecore/src/org/eclipse/emf/facet/widgets/celleditors/ecore/composite/LongCompositeFactory.java b/org.eclipse.modisco.facet.widgets.celleditors.ecore/src/org/eclipse/emf/facet/widgets/celleditors/ecore/composite/LongCompositeFactory.java deleted file mode 100644 index ecd202c..0000000 --- a/org.eclipse.modisco.facet.widgets.celleditors.ecore/src/org/eclipse/emf/facet/widgets/celleditors/ecore/composite/LongCompositeFactory.java +++ /dev/null
@@ -1,30 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2011 Mia-Software. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Fabien Giquel (Mia-Software) - initial API and implementation - * Nicolas Guyomar (Mia-Software) - Bug 334546 - [celleditors] no border on Text field - * Nicolas Bros (Mia-Software) - Bug 338437 - compositeEditors extension point cannot be used to register user types - *******************************************************************************/ -package org.eclipse.emf.facet.widgets.celleditors.ecore.composite; - -import org.eclipse.emf.facet.widgets.celleditors.AbstractCellEditorComposite; -import org.eclipse.emf.facet.widgets.celleditors.ICompositeEditorFactory; -import org.eclipse.swt.widgets.Composite; - -public class LongCompositeFactory implements ICompositeEditorFactory<Long> { - - public AbstractCellEditorComposite<Long> createCompositeEditor(final Composite parent, - final int style) { - return new LongComposite(parent, style); - } - - public Class<Long> getHandledType() { - return Long.class; - } - -}
diff --git a/org.eclipse.modisco.facet.widgets.celleditors.ecore/src/org/eclipse/emf/facet/widgets/celleditors/ecore/composite/ShortComposite.java b/org.eclipse.modisco.facet.widgets.celleditors.ecore/src/org/eclipse/emf/facet/widgets/celleditors/ecore/composite/ShortComposite.java deleted file mode 100644 index 13f8798..0000000 --- a/org.eclipse.modisco.facet.widgets.celleditors.ecore/src/org/eclipse/emf/facet/widgets/celleditors/ecore/composite/ShortComposite.java +++ /dev/null
@@ -1,110 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2010 CEA LIST. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Nicolas Guyomar (Mia-Software) - initial API and implementation - * Nicolas Guyomar (Mia-Software) - Bug 334546 - [celleditors] no border on Text field - *****************************************************************************/ -package org.eclipse.emf.facet.widgets.celleditors.ecore.composite; - -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.Status; -import org.eclipse.emf.facet.widgets.celleditors.IValidator; -import org.eclipse.emf.facet.widgets.celleditors.ecore.Activator; -import org.eclipse.swt.SWT; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Event; -import org.eclipse.swt.widgets.Listener; - -public class ShortComposite extends StringComposite<Short> { - - public ShortComposite(final Composite parent, final int style) { - super(parent, style); - getTextField().addListener(SWT.Verify, new Listener() { - - public void handleEvent(final Event event) { - - String input = event.text; - for (int i = 0; i < input.length(); i++) { - char ch = input.charAt(i); - if (ch != '-') { - if (!('0' <= ch && ch <= '9')) { - event.doit = false; - return; - } - } else { - if (ShortComposite.this.getTextField().getText().indexOf('-') != -1) { - event.doit = false; - return; - } - // If the '-' caracter is not type at the beginning of - // the String - if (event.start != 0) { - event.doit = false; - return; - } - } - } - } - - }); - } - - public ShortComposite(final Composite parent) { - this(parent, SWT.NONE); - } - - @Override - public IValidator getValidator() { - return new IValidator() { - public IStatus validate(final Object object) { - if (getValue() != null) { - if (Short.MIN_VALUE <= getValue().shortValue() - && getValue().shortValue() <= Short.MAX_VALUE) { - return Status.OK_STATUS; - } - } - return new Status(IStatus.ERROR, Activator.PLUGIN_ID, ""); //$NON-NLS-1$ - } - }; - } - - @Override - public IConverter<Short> initConverter() { - return new IConverter<Short>() { - - public Short toObject(final String string) { - if (string != null && string.length() > 0) { - try { - return new Short(string); - } catch (Exception e) { - return null; - } - } - return null; - } - - public String toString(final Short object) { - return object.toString(); - } - }; - } - - @Override - public IStatus validate(final String string) { - try { - if (string.length() > 0) { - Short.parseShort(string); - } - } catch (Exception e) { - return new Status(IStatus.ERROR, Activator.PLUGIN_ID, ""); //$NON-NLS-1$ - } - return new Status(IStatus.OK, Activator.PLUGIN_ID, ""); //$NON-NLS-1$ - } - -}
diff --git a/org.eclipse.modisco.facet.widgets.celleditors.ecore/src/org/eclipse/emf/facet/widgets/celleditors/ecore/composite/ShortCompositeFactory.java b/org.eclipse.modisco.facet.widgets.celleditors.ecore/src/org/eclipse/emf/facet/widgets/celleditors/ecore/composite/ShortCompositeFactory.java deleted file mode 100644 index ed83592..0000000 --- a/org.eclipse.modisco.facet.widgets.celleditors.ecore/src/org/eclipse/emf/facet/widgets/celleditors/ecore/composite/ShortCompositeFactory.java +++ /dev/null
@@ -1,29 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2011 Mia-Software. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Fabien Giquel (Mia-Software) - initial API and implementation - * Nicolas Guyomar (Mia-Software) - Bug 334546 - [celleditors] no border on Text field - * Nicolas Bros (Mia-Software) - Bug 338437 - compositeEditors extension point cannot be used to register user types - *******************************************************************************/ -package org.eclipse.emf.facet.widgets.celleditors.ecore.composite; - -import org.eclipse.emf.facet.widgets.celleditors.AbstractCellEditorComposite; -import org.eclipse.emf.facet.widgets.celleditors.ICompositeEditorFactory; -import org.eclipse.swt.widgets.Composite; - -public class ShortCompositeFactory implements ICompositeEditorFactory<Short> { - - public AbstractCellEditorComposite<Short> createCompositeEditor(final Composite parent, final int style) { - return new ShortComposite(parent, style); - } - - public Class<Short> getHandledType() { - return Short.class; - } - -}
diff --git a/org.eclipse.modisco.facet.widgets.celleditors.ecore/src/org/eclipse/emf/facet/widgets/celleditors/ecore/composite/StringComposite.java b/org.eclipse.modisco.facet.widgets.celleditors.ecore/src/org/eclipse/emf/facet/widgets/celleditors/ecore/composite/StringComposite.java deleted file mode 100644 index 2c766f4..0000000 --- a/org.eclipse.modisco.facet.widgets.celleditors.ecore/src/org/eclipse/emf/facet/widgets/celleditors/ecore/composite/StringComposite.java +++ /dev/null
@@ -1,180 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2010 CEA LIST. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Nicolas Guyomar (Mia-Software) - initial API and implementation - * Nicolas Guyomar (Mia-Software) - Bug 334546 - [celleditors] no border on Text field - * Nicolas Bros (Mia-Software) - Bug 334539 - [celleditors] change listener - * Nicolas Guyomar (Mia-Software) - Bug 349574 - EMF Facet Ecore String composite textField cannot be disabled - *****************************************************************************/ -package org.eclipse.emf.facet.widgets.celleditors.ecore.composite; - -import org.eclipse.core.runtime.IStatus; -import org.eclipse.emf.facet.widgets.celleditors.AbstractCellEditorComposite; -import org.eclipse.swt.SWT; -import org.eclipse.swt.events.DisposeEvent; -import org.eclipse.swt.events.DisposeListener; -import org.eclipse.swt.events.KeyAdapter; -import org.eclipse.swt.events.KeyEvent; -import org.eclipse.swt.events.ModifyEvent; -import org.eclipse.swt.events.ModifyListener; -import org.eclipse.swt.graphics.Color; -import org.eclipse.swt.layout.FillLayout; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Control; -import org.eclipse.swt.widgets.Display; -import org.eclipse.swt.widgets.Event; -import org.eclipse.swt.widgets.Listener; -import org.eclipse.swt.widgets.Text; - -public abstract class StringComposite<T> extends AbstractCellEditorComposite<T> { - - /** the control that is used to edit the contents of the cell */ - private Text textField = null; - - private final Composite parentControl; - - /** the original value of the cell **/ - private IConverter<T> converter; - - protected static final Color RED = new Color(Display.getCurrent(), 255, 192, 192); - protected static final Color WHITE = Display.getCurrent().getSystemColor( - SWT.COLOR_LIST_BACKGROUND); - - public StringComposite(final Composite parent, final int style) { - super(parent); - setLayout(new FillLayout()); - this.parentControl = parent; - this.textField = new Text(this, style); - - this.textField.addKeyListener(new KeyAdapter() { - @Override - public void keyPressed(final KeyEvent event) { - // Enter key pressed - if ((event.keyCode == SWT.CR && event.stateMask == 0) - || (event.keyCode == SWT.KEYPAD_CR && event.stateMask == 0)) { - if (StringComposite.this.getTextField().getEditable()) { - StringComposite.this.commit(); - } - } else if (event.keyCode == SWT.ESC && event.stateMask == 0) { - // Escape key pressed - close(); - } - } - - @Override - public void keyReleased(final KeyEvent e) { - if (!StringComposite.this.validate(StringComposite.this.getTextField().getText()) - .isOK()) { - StringComposite.this.getTextField().setBackground(StringComposite.RED); - } else { - - StringComposite.this.getTextField().setBackground(StringComposite.WHITE); - } - super.keyReleased(e); - } - - }); - final Listener clickListener = new Listener() { - /* - * (non-Javadoc) - * - * @see org.eclipse.swt.widgets.Listener#handleEvent(org.eclipse.swt. widgets.Event) - */ - public void handleEvent(final Event event) { - if (event.widget instanceof Control) { - Control control = (Control) event.widget; - if (control.getShell() == StringComposite.this.getParentControl().getShell()) { - if (event.widget != StringComposite.this.getTextField()) { - StringComposite.this.commit(); - } - } - } - } - }; - Display.getDefault().addFilter(SWT.MouseDown, clickListener); - // this listener is only here to remove - // the other listener from the Display - addDisposeListener(new DisposeListener() { - public void widgetDisposed(final DisposeEvent e) { - Display.getDefault().removeFilter(SWT.MouseDown, clickListener); - } - }); - - this.textField.addModifyListener(new ModifyListener() { - public void modifyText(final ModifyEvent e) { - fireChanged(); - } - }); - - this.textField.forceFocus(); - } - - public StringComposite(final Composite parent) { - this(parent, SWT.NONE); - } - - protected void commit() { - if (getValidator().validate(getValue()).isOK()) { - fireCommit(); - } - } - - @Override - public void setEnabled(final boolean enabled) { - this.textField.setEnabled(enabled); - super.setEnabled(enabled); - } - - public boolean getEditable() { - return this.textField.getEditable(); - } - - public void setValue(final T value) { - if (value == null) { - this.textField.setText(""); //$NON-NLS-1$ - } else { - String strValue = getConverter().toString(value); - this.textField.setText(strValue); - this.textField.setSelection(0, strValue.length()); - } - } - - public String getText() { - return this.textField.getText(); - } - - protected Text getTextField() { - return this.textField; - } - - protected Composite getParentControl() { - return this.parentControl; - } - - public T getValue() { - return this.getConverter().toObject(this.getText()); - } - - private IConverter<T> getConverter() { - if (this.converter == null) { - this.converter = this.initConverter(); - } - return this.converter; - } - - public abstract IConverter<T> initConverter(); - - public interface IConverter<T> { - public T toObject(String string); - - public String toString(T object); - } - - public abstract IStatus validate(String string); -}
diff --git a/org.eclipse.modisco.facet.widgets.celleditors.ecore/src/org/eclipse/emf/facet/widgets/celleditors/ecore/composite/StringMultiComposite.java b/org.eclipse.modisco.facet.widgets.celleditors.ecore/src/org/eclipse/emf/facet/widgets/celleditors/ecore/composite/StringMultiComposite.java deleted file mode 100644 index 8f7d1ad..0000000 --- a/org.eclipse.modisco.facet.widgets.celleditors.ecore/src/org/eclipse/emf/facet/widgets/celleditors/ecore/composite/StringMultiComposite.java +++ /dev/null
@@ -1,203 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2010 CEA LIST. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Nicolas Guyomar (Mia-Software) - initial API and implementation - * Nicolas Guyomar (Mia-Software) - Bug 334546 - [celleditors] no border on Text field - * Nicolas Bros (Mia-Software) - Bug 334539 - [celleditors] change listener - *****************************************************************************/ -package org.eclipse.emf.facet.widgets.celleditors.ecore.composite; - -import org.eclipse.emf.facet.util.core.Logger; -import org.eclipse.emf.facet.widgets.celleditors.AbstractCellEditorComposite; -import org.eclipse.emf.facet.widgets.celleditors.ecore.Activator; -import org.eclipse.emf.facet.widgets.celleditors.ecore.ui.MultiLineDialog; -import org.eclipse.swt.SWT; -import org.eclipse.swt.events.DisposeEvent; -import org.eclipse.swt.events.DisposeListener; -import org.eclipse.swt.events.KeyAdapter; -import org.eclipse.swt.events.KeyEvent; -import org.eclipse.swt.events.ModifyEvent; -import org.eclipse.swt.events.ModifyListener; -import org.eclipse.swt.events.SelectionAdapter; -import org.eclipse.swt.events.SelectionEvent; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.layout.GridLayout; -import org.eclipse.swt.widgets.Button; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Control; -import org.eclipse.swt.widgets.Display; -import org.eclipse.swt.widgets.Event; -import org.eclipse.swt.widgets.Listener; -import org.eclipse.swt.widgets.Text; - -/** A cell editor for Strings */ -public class StringMultiComposite<T> extends AbstractCellEditorComposite<String> { - - /** the control that is used to edit the contents of the cell */ - private final Button button; - private Text text = null; - - private final Composite parentControl; - - /** the original value of the cell */ - private String originalFieldValue; - - public StringMultiComposite(final Composite parent, final Object originalValue, final int style) { - super(parent); - this.parentControl = parent; - - GridLayout gd = new GridLayout(2, false); - gd.marginHeight = 0; - gd.marginWidth = 0; - gd.horizontalSpacing = 0; - setLayout(gd); - - this.text = new Text(this, style); - this.text.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false)); - this.button = new Button(this, SWT.PUSH); - this.button.setText("..."); //$NON-NLS-1$ - GridData data = new GridData(SWT.FILL, SWT.FILL, false, true); - this.button.setLayoutData(data); - - if (originalValue != null) { - if (originalValue instanceof String) { - this.setValue((String) originalValue); - this.text.setSelection(0, ((String) originalValue).length()); - } else { - Logger.logError("An instance of String was expected", Activator.getDefault()); //$NON-NLS-1$ - } - } - - this.button.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(final SelectionEvent e) { - MultiLineDialog dialog = new MultiLineDialog(StringMultiComposite.this - .getParentControl().getShell(), StringMultiComposite.this.getValue()) { - - @Override - protected void okPressed() { - StringMultiComposite.this.originalFieldValue = getTextArea().getText(); - StringMultiComposite.this.getText().setText(getTextArea().getText()); - StringMultiComposite.this.commit(); - super.okPressed(); - } - }; - dialog.open(); - } - }); - - // commit the cell editor when the mouse is clicked - // anywhere outside the text field - final Listener clickListener = new Listener() { - public void handleEvent(final Event event) { - if (event.widget instanceof Control) { - Control control = (Control) event.widget; - if (control.getShell() == StringMultiComposite.this.getParentControl() - .getShell()) { - if (event.widget != StringMultiComposite.this.getButton()) { - if (event.widget != StringMultiComposite.this.getText()) { - if (StringMultiComposite.this.getText().getEditable()) { - StringMultiComposite.this.commit(); - } else { - StringMultiComposite.this.close(); - } - } - } - } - } - } - }; - Display.getDefault().addFilter(SWT.MouseDown, clickListener); - - // this listener is only here to remove - // the other listener from the Display - this.text.addDisposeListener(new DisposeListener() { - public void widgetDisposed(final DisposeEvent e) { - Display.getDefault().removeFilter(SWT.MouseDown, clickListener); - } - }); - - this.text.addKeyListener(new KeyAdapter() { - @Override - public void keyPressed(final KeyEvent event) { - // Enter key pressed - if ((event.keyCode == SWT.CR && event.stateMask == 0) - || (event.keyCode == SWT.KEYPAD_CR && event.stateMask == 0)) { - if (StringMultiComposite.this.getText().getEditable()) { - StringMultiComposite.this.commit(); - } - } else if (event.keyCode == SWT.ESC && event.stateMask == 0) { - // Escape key pressed - close(); - } - } - }); - - this.text.addModifyListener(new ModifyListener() { - public void modifyText(final ModifyEvent e) { - fireChanged(); - } - }); - - this.text.forceFocus(); - } - - public StringMultiComposite(final Composite parent, final int style) { - this(parent, null, style); - } - - public StringMultiComposite(final Composite parent, final Object originalValue) { - this(parent, originalValue, SWT.NONE); - } - - protected void commit() { - fireCommit(); - } - - public void setValue(final String value) { - this.originalFieldValue = value; - if (value == null) { - this.text.setText(""); //$NON-NLS-1$ - } else { - // If the text contains a newline then edition is not possible, the user - // has to use the Dialog Editor - if (value.indexOf('\n') != -1) { - String truncatedValue = value.substring(0, value.indexOf('\n') - 1).concat("..."); //$NON-NLS-1$ - this.text.setText(truncatedValue); - this.text.setEditable(false); - } else { - this.text.setText(value); - this.text.setSelection(0, value.length()); - } - } - } - - public String getValue() { - if (this.text.getEditable()) { - return this.text.getText(); - } - return getOriginalFieldValue(); - } - - public Button getButton() { - return this.button; - } - - public Composite getParentControl() { - return this.parentControl; - } - - public String getOriginalFieldValue() { - return this.originalFieldValue; - } - - protected Text getText() { - return this.text; - } -}
diff --git a/org.eclipse.modisco.facet.widgets.celleditors.ecore/src/org/eclipse/emf/facet/widgets/celleditors/ecore/composite/StringMultiCompositeFactory.java b/org.eclipse.modisco.facet.widgets.celleditors.ecore/src/org/eclipse/emf/facet/widgets/celleditors/ecore/composite/StringMultiCompositeFactory.java deleted file mode 100644 index c8890e0..0000000 --- a/org.eclipse.modisco.facet.widgets.celleditors.ecore/src/org/eclipse/emf/facet/widgets/celleditors/ecore/composite/StringMultiCompositeFactory.java +++ /dev/null
@@ -1,29 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2011 Mia-Software. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Fabien Giquel (Mia-Software) - initial API and implementation - * Nicolas Guyomar (Mia-Software) - Bug 334546 - [celleditors] no border on Text field - * Nicolas Bros (Mia-Software) - Bug 338437 - compositeEditors extension point cannot be used to register user types - *******************************************************************************/ -package org.eclipse.emf.facet.widgets.celleditors.ecore.composite; - -import org.eclipse.emf.facet.widgets.celleditors.AbstractCellEditorComposite; -import org.eclipse.emf.facet.widgets.celleditors.ICompositeEditorFactory; -import org.eclipse.swt.widgets.Composite; - -public class StringMultiCompositeFactory implements ICompositeEditorFactory<String> { - - public AbstractCellEditorComposite<String> createCompositeEditor(final Composite parent, final int style) { - return new StringMultiComposite<String>(parent, style); - } - - public Class<String> getHandledType() { - return String.class; - } - -}
diff --git a/org.eclipse.modisco.facet.widgets.celleditors.ecore/src/org/eclipse/emf/facet/widgets/celleditors/ecore/ui/MultiLineDialog.java b/org.eclipse.modisco.facet.widgets.celleditors.ecore/src/org/eclipse/emf/facet/widgets/celleditors/ecore/ui/MultiLineDialog.java deleted file mode 100644 index 94bedf0..0000000 --- a/org.eclipse.modisco.facet.widgets.celleditors.ecore/src/org/eclipse/emf/facet/widgets/celleditors/ecore/ui/MultiLineDialog.java +++ /dev/null
@@ -1,108 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2010 CEA LIST. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Nicolas Guyomar (Mia-Software) - initial API and implementation - *****************************************************************************/ -package org.eclipse.emf.facet.widgets.celleditors.ecore.ui; - -import org.eclipse.emf.facet.widgets.celleditors.ecore.Activator; -import org.eclipse.emf.facet.widgets.celleditors.ecore.Messages; -import org.eclipse.jface.dialogs.Dialog; -import org.eclipse.jface.dialogs.IDialogConstants; -import org.eclipse.jface.dialogs.IDialogSettings; -import org.eclipse.swt.SWT; -import org.eclipse.swt.events.KeyAdapter; -import org.eclipse.swt.events.KeyEvent; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.layout.GridLayout; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Control; -import org.eclipse.swt.widgets.Shell; -import org.eclipse.swt.widgets.Text; - -public class MultiLineDialog extends Dialog { - - private static final int DIALOG_WIDTH = 300; - private static final int DIALOG_HEIGHT = 200; - private String originalValue; - private Text textArea; - - public MultiLineDialog(final Shell parent, final Object originalValue) { - super(parent); - if (originalValue instanceof String) { - this.originalValue = (String) originalValue; - } - - } - - @Override - protected Control createDialogArea(final Composite parent) { - // create a composite with standard margins and spacing - Composite composite = new Composite(parent, SWT.NONE); - GridLayout layout = new GridLayout(); - layout.marginHeight = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN); - layout.marginWidth = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN); - layout.verticalSpacing = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING); - layout.horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING); - composite.setLayout(layout); - composite.setLayoutData(new GridData(GridData.FILL_BOTH)); - - this.textArea = new Text(composite, SWT.MULTI | SWT.V_SCROLL | SWT.H_SCROLL | SWT.BORDER); - if (this.originalValue != null) { - this.textArea.setText(this.originalValue); - } - this.textArea.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true)); - this.textArea.addKeyListener(new KeyAdapter() { - @Override - public void keyPressed(final KeyEvent e) { - if (e.keyCode == SWT.CR && e.stateMask == SWT.CTRL) { - okPressed(); - } - super.keyPressed(e); - } - }); - - applyDialogFont(composite); - return composite; - } - - @Override - protected void okPressed() { - super.okPressed(); - } - - @Override - protected boolean isResizable() { - return true; - } - - @Override - protected void configureShell(final Shell newShell) { - super.configureShell(newShell); - newShell.setText(Messages.MultiLineDialog_enterAValue); - } - - protected Text getTextArea() { - return this.textArea; - } - - @Override - protected IDialogSettings getDialogBoundsSettings() { - final String sectionName = this.getClass().getName() + ".settings"; //$NON-NLS-1$ - IDialogSettings settings = Activator.getDefault().getDialogSettings(); - IDialogSettings section = settings.getSection(sectionName); - if (section == null) { - section = settings.addNewSection(sectionName); - // cf Dialog#DIALOG_WIDTH - section.put("DIALOG_WIDTH", MultiLineDialog.DIALOG_WIDTH); //$NON-NLS-1$ - section.put("DIALOG_HEIGHT", MultiLineDialog.DIALOG_HEIGHT); //$NON-NLS-1$ - } - return section; - } -}
diff --git a/org.eclipse.modisco.facet.widgets.celleditors.ecore/src/org/eclipse/modisco/facet/widgets/celleditors/ecore/Activator.java b/org.eclipse.modisco.facet.widgets.celleditors.ecore/src/org/eclipse/modisco/facet/widgets/celleditors/ecore/Activator.java new file mode 100644 index 0000000..304fd6e --- /dev/null +++ b/org.eclipse.modisco.facet.widgets.celleditors.ecore/src/org/eclipse/modisco/facet/widgets/celleditors/ecore/Activator.java
@@ -0,0 +1,68 @@ +/***************************************************************************** + * Copyright (c) 2010 CEA LIST. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Nicolas Bros (Mia-Software) - initial API and implementation + *****************************************************************************/ +package org.eclipse.modisco.facet.widgets.celleditors.ecore; + +import org.eclipse.ui.plugin.AbstractUIPlugin; +import org.osgi.framework.BundleContext; + +/** + * The activator class controls the plug-in life cycle + */ +public class Activator extends AbstractUIPlugin { + // The plug-in ID + public static final String PLUGIN_ID = "org.eclipse.emf.facet.widgets.celleditors"; //$NON-NLS-1$ + + // The shared instance + private static Activator plugin; + + /** + * The constructor + */ + public Activator() { + } + + /* + * (non-Javadoc) + * + * @see + * org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext + * ) + */ + @Override + public void start(final BundleContext context) throws Exception { + super.start(context); + Activator.plugin = this; + } + + /* + * (non-Javadoc) + * + * @see + * org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext + * ) + */ + @Override + public void stop(final BundleContext context) throws Exception { + Activator.plugin = null; + super.stop(context); + } + + /** + * Returns the shared instance + * + * @return the shared instance + */ + public static Activator getDefault() { + return Activator.plugin; + } + +}
diff --git a/org.eclipse.modisco.facet.widgets.celleditors.ecore/src/org/eclipse/modisco/facet/widgets/celleditors/ecore/EBigDecimalCellEditor.java b/org.eclipse.modisco.facet.widgets.celleditors.ecore/src/org/eclipse/modisco/facet/widgets/celleditors/ecore/EBigDecimalCellEditor.java new file mode 100644 index 0000000..a49041e --- /dev/null +++ b/org.eclipse.modisco.facet.widgets.celleditors.ecore/src/org/eclipse/modisco/facet/widgets/celleditors/ecore/EBigDecimalCellEditor.java
@@ -0,0 +1,54 @@ +/***************************************************************************** + * Copyright (c) 2010 CEA LIST. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Nicolas Guyomar (Mia-Software) - initial API and implementation + * Nicolas Bros (Mia-Software) - Bug 334539 - [celleditors] change listener + *****************************************************************************/ +package org.eclipse.modisco.facet.widgets.celleditors.ecore; + +import java.math.BigDecimal; + +import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.ecore.EStructuralFeature; +import org.eclipse.modisco.facet.util.core.Logger; +import org.eclipse.modisco.facet.widgets.celleditors.IListener; +import org.eclipse.modisco.facet.widgets.celleditors.IModelCellEditHandler; +import org.eclipse.modisco.facet.widgets.celleditors.IModelCellEditor; +import org.eclipse.modisco.facet.widgets.celleditors.ecore.composite.BigDecimalComposite; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Control; + +/** A cell editor for BigDecimal */ +public class EBigDecimalCellEditor implements IModelCellEditor { + + private BigDecimalComposite composite = null; + + public Control activateCell(final Composite parent, final Object originalValue, + final IModelCellEditHandler editHandler, final EStructuralFeature feature, + final EObject source) { + this.composite = new BigDecimalComposite(parent); + if (originalValue != null) { + if (originalValue instanceof BigDecimal) { + this.composite.setValue((BigDecimal) originalValue); + } else { + Logger.logError("An instance of BigDecimal was expected", Activator.getDefault()); //$NON-NLS-1$ + } + } + this.composite.addCommitListener(new IListener() { + public void handleEvent() { + editHandler.commit(); + } + }); + return this.composite; + } + + public Object getValue() { + return this.composite.getValue(); + } +} \ No newline at end of file
diff --git a/org.eclipse.modisco.facet.widgets.celleditors.ecore/src/org/eclipse/modisco/facet/widgets/celleditors/ecore/EBigIntegerCellEditor.java b/org.eclipse.modisco.facet.widgets.celleditors.ecore/src/org/eclipse/modisco/facet/widgets/celleditors/ecore/EBigIntegerCellEditor.java new file mode 100644 index 0000000..9de6ea6 --- /dev/null +++ b/org.eclipse.modisco.facet.widgets.celleditors.ecore/src/org/eclipse/modisco/facet/widgets/celleditors/ecore/EBigIntegerCellEditor.java
@@ -0,0 +1,55 @@ +/***************************************************************************** + * Copyright (c) 2010 CEA LIST. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Nicolas Guyomar (Mia-Software) - initial API and implementation + * Nicolas Bros (Mia-Software) - Bug 334539 - [celleditors] change listener + *****************************************************************************/ +package org.eclipse.modisco.facet.widgets.celleditors.ecore; + +import java.math.BigInteger; + +import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.ecore.EStructuralFeature; +import org.eclipse.modisco.facet.util.core.Logger; +import org.eclipse.modisco.facet.widgets.celleditors.IListener; +import org.eclipse.modisco.facet.widgets.celleditors.IModelCellEditHandler; +import org.eclipse.modisco.facet.widgets.celleditors.IModelCellEditor; +import org.eclipse.modisco.facet.widgets.celleditors.ecore.composite.BigIntegerComposite; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Control; + +/** A cell editor for BigInteger */ +public class EBigIntegerCellEditor implements IModelCellEditor { + + private BigIntegerComposite composite = null; + + public Control activateCell(final Composite parent, final Object originalValue, + final IModelCellEditHandler editHandler, final EStructuralFeature feature, + final EObject source) { + this.composite = new BigIntegerComposite(parent); + if (originalValue != null) { + if (originalValue instanceof BigInteger) { + this.composite.setValue((BigInteger) originalValue); + } else { + Logger.logError("An instance of BigInteger was expected", //$NON-NLS-1$ + Activator.getDefault()); + } + } + this.composite.addCommitListener(new IListener() { + public void handleEvent() { + editHandler.commit(); + } + }); + return this.composite; + } + + public Object getValue() { + return this.composite.getValue(); + } +} \ No newline at end of file
diff --git a/org.eclipse.modisco.facet.widgets.celleditors.ecore/src/org/eclipse/modisco/facet/widgets/celleditors/ecore/EBooleanCellEditor.java b/org.eclipse.modisco.facet.widgets.celleditors.ecore/src/org/eclipse/modisco/facet/widgets/celleditors/ecore/EBooleanCellEditor.java new file mode 100644 index 0000000..21d8966 --- /dev/null +++ b/org.eclipse.modisco.facet.widgets.celleditors.ecore/src/org/eclipse/modisco/facet/widgets/celleditors/ecore/EBooleanCellEditor.java
@@ -0,0 +1,54 @@ +/***************************************************************************** + * Copyright (c) 2010 CEA LIST. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Nicolas Guyomar (Mia-Software) - initial API and implementation + * Nicolas Bros (Mia-Software) - Bug 334539 - [celleditors] change listener + *****************************************************************************/ +package org.eclipse.modisco.facet.widgets.celleditors.ecore; + +import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.ecore.EStructuralFeature; +import org.eclipse.modisco.facet.util.core.Logger; +import org.eclipse.modisco.facet.widgets.celleditors.IListener; +import org.eclipse.modisco.facet.widgets.celleditors.IModelCellEditHandler; +import org.eclipse.modisco.facet.widgets.celleditors.IModelCellEditor; +import org.eclipse.modisco.facet.widgets.celleditors.ecore.composite.BooleanComposite; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Control; + +/** A cell editor for Boolean */ +public class EBooleanCellEditor implements IModelCellEditor { + + private BooleanComposite composite = null; + + public Control activateCell(final Composite parent, final Object originalValue, + final IModelCellEditHandler editHandler, final EStructuralFeature feature, + final EObject source) { + this.composite = new BooleanComposite(parent); + if (originalValue != null) { + if (originalValue instanceof Boolean) { + this.composite.setValue((Boolean) originalValue); + } else { + Logger.logError("An instance of Boolean was expected", //$NON-NLS-1$ + Activator.getDefault()); + } + } + this.composite.addCommitListener(new IListener() { + public void handleEvent() { + editHandler.commit(); + } + }); + return this.composite; + } + + public Object getValue() { + return this.composite.getValue(); + } + +}
diff --git a/org.eclipse.modisco.facet.widgets.celleditors.ecore/src/org/eclipse/modisco/facet/widgets/celleditors/ecore/EByteCellEditor.java b/org.eclipse.modisco.facet.widgets.celleditors.ecore/src/org/eclipse/modisco/facet/widgets/celleditors/ecore/EByteCellEditor.java new file mode 100644 index 0000000..8830340 --- /dev/null +++ b/org.eclipse.modisco.facet.widgets.celleditors.ecore/src/org/eclipse/modisco/facet/widgets/celleditors/ecore/EByteCellEditor.java
@@ -0,0 +1,53 @@ +/***************************************************************************** + * Copyright (c) 2010 CEA LIST. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Nicolas Guyomar (Mia-Software) - initial API and implementation + * Nicolas Bros (Mia-Software) - Bug 334539 - [celleditors] change listener + *****************************************************************************/ +package org.eclipse.modisco.facet.widgets.celleditors.ecore; + +import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.ecore.EStructuralFeature; +import org.eclipse.modisco.facet.util.core.Logger; +import org.eclipse.modisco.facet.widgets.celleditors.IListener; +import org.eclipse.modisco.facet.widgets.celleditors.IModelCellEditHandler; +import org.eclipse.modisco.facet.widgets.celleditors.IModelCellEditor; +import org.eclipse.modisco.facet.widgets.celleditors.ecore.composite.ByteComposite; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Control; + +/** A cell editor for Byte */ +public class EByteCellEditor implements IModelCellEditor { + + private ByteComposite composite = null; + + public Control activateCell(final Composite parent, final Object originalValue, + final IModelCellEditHandler editHandler, final EStructuralFeature feature, + final EObject source) { + this.composite = new ByteComposite(parent); + if (originalValue != null) { + if (originalValue instanceof Byte) { + this.composite.setValue((Byte) originalValue); + } else { + Logger.logError("An instance of Byte was expected", //$NON-NLS-1$ + Activator.getDefault()); + } + } + this.composite.addCommitListener(new IListener() { + public void handleEvent() { + editHandler.commit(); + } + }); + return this.composite; + } + + public Object getValue() { + return this.composite.getValue(); + } +} \ No newline at end of file
diff --git a/org.eclipse.modisco.facet.widgets.celleditors.ecore/src/org/eclipse/modisco/facet/widgets/celleditors/ecore/ECharCellEditor.java b/org.eclipse.modisco.facet.widgets.celleditors.ecore/src/org/eclipse/modisco/facet/widgets/celleditors/ecore/ECharCellEditor.java new file mode 100644 index 0000000..68221f5 --- /dev/null +++ b/org.eclipse.modisco.facet.widgets.celleditors.ecore/src/org/eclipse/modisco/facet/widgets/celleditors/ecore/ECharCellEditor.java
@@ -0,0 +1,54 @@ +/***************************************************************************** + * Copyright (c) 2010 CEA LIST. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Nicolas Guyomar (Mia-Software) - initial API and implementation + * Nicolas Bros (Mia-Software) - Bug 334539 - [celleditors] change listener + *****************************************************************************/ +package org.eclipse.modisco.facet.widgets.celleditors.ecore; + +import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.ecore.EStructuralFeature; +import org.eclipse.modisco.facet.util.core.Logger; +import org.eclipse.modisco.facet.widgets.celleditors.IListener; +import org.eclipse.modisco.facet.widgets.celleditors.IModelCellEditHandler; +import org.eclipse.modisco.facet.widgets.celleditors.IModelCellEditor; +import org.eclipse.modisco.facet.widgets.celleditors.ecore.composite.CharComposite; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Control; + +/** A cell editor for Character */ +public class ECharCellEditor implements IModelCellEditor { + + private CharComposite composite = null; + + public Control activateCell(final Composite parent, final Object originalValue, + final IModelCellEditHandler editHandler, final EStructuralFeature feature, + final EObject source) { + this.composite = new CharComposite(parent); + if (originalValue != null) { + if (originalValue instanceof Character) { + this.composite.setValue((Character) originalValue); + } else { + Logger.logError("An instance of Character was expected", //$NON-NLS-1$ + Activator.getDefault()); + } + } + this.composite.addCommitListener(new IListener() { + public void handleEvent() { + editHandler.commit(); + } + }); + return this.composite; + } + + public Object getValue() { + return this.composite.getValue(); + } + +} \ No newline at end of file
diff --git a/org.eclipse.modisco.facet.widgets.celleditors.ecore/src/org/eclipse/modisco/facet/widgets/celleditors/ecore/EDoubleCellEditor.java b/org.eclipse.modisco.facet.widgets.celleditors.ecore/src/org/eclipse/modisco/facet/widgets/celleditors/ecore/EDoubleCellEditor.java new file mode 100644 index 0000000..4d7ce65 --- /dev/null +++ b/org.eclipse.modisco.facet.widgets.celleditors.ecore/src/org/eclipse/modisco/facet/widgets/celleditors/ecore/EDoubleCellEditor.java
@@ -0,0 +1,54 @@ +/***************************************************************************** + * Copyright (c) 2010 CEA LIST. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Nicolas Guyomar (Mia-Software) - initial API and implementation + * Nicolas Bros (Mia-Software) - Bug 334539 - [celleditors] change listener + *****************************************************************************/ +package org.eclipse.modisco.facet.widgets.celleditors.ecore; + +import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.ecore.EStructuralFeature; +import org.eclipse.modisco.facet.util.core.Logger; +import org.eclipse.modisco.facet.widgets.celleditors.IListener; +import org.eclipse.modisco.facet.widgets.celleditors.IModelCellEditHandler; +import org.eclipse.modisco.facet.widgets.celleditors.IModelCellEditor; +import org.eclipse.modisco.facet.widgets.celleditors.ecore.composite.DoubleComposite; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Control; + +/** A cell editor for Double */ +public class EDoubleCellEditor implements IModelCellEditor { + + private DoubleComposite composite = null; + + public Control activateCell(final Composite parent, final Object originalValue, + final IModelCellEditHandler editHandler, final EStructuralFeature feature, + final EObject source) { + this.composite = new DoubleComposite(parent); + if (originalValue != null) { + if (originalValue instanceof Double) { + this.composite.setValue((Double) originalValue); + } else { + Logger.logError("An instance of Double was expected", //$NON-NLS-1$ + Activator.getDefault()); + } + } + this.composite.addCommitListener(new IListener() { + public void handleEvent() { + editHandler.commit(); + } + }); + return this.composite; + } + + public Object getValue() { + return this.composite.getValue(); + } + +} \ No newline at end of file
diff --git a/org.eclipse.modisco.facet.widgets.celleditors.ecore/src/org/eclipse/modisco/facet/widgets/celleditors/ecore/EFloatCellEditor.java b/org.eclipse.modisco.facet.widgets.celleditors.ecore/src/org/eclipse/modisco/facet/widgets/celleditors/ecore/EFloatCellEditor.java new file mode 100644 index 0000000..25ee1c4 --- /dev/null +++ b/org.eclipse.modisco.facet.widgets.celleditors.ecore/src/org/eclipse/modisco/facet/widgets/celleditors/ecore/EFloatCellEditor.java
@@ -0,0 +1,54 @@ +/***************************************************************************** + * Copyright (c) 2010 CEA LIST. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Nicolas Guyomar (Mia-Software) - initial API and implementation + * Nicolas Bros (Mia-Software) - Bug 334539 - [celleditors] change listener + *****************************************************************************/ +package org.eclipse.modisco.facet.widgets.celleditors.ecore; + +import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.ecore.EStructuralFeature; +import org.eclipse.modisco.facet.util.core.Logger; +import org.eclipse.modisco.facet.widgets.celleditors.IListener; +import org.eclipse.modisco.facet.widgets.celleditors.IModelCellEditHandler; +import org.eclipse.modisco.facet.widgets.celleditors.IModelCellEditor; +import org.eclipse.modisco.facet.widgets.celleditors.ecore.composite.FloatComposite; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Control; + +/** A cell editor for Float */ +public class EFloatCellEditor implements IModelCellEditor { + + private FloatComposite composite = null; + + public Control activateCell(final Composite parent, final Object originalValue, + final IModelCellEditHandler editHandler, final EStructuralFeature feature, + final EObject source) { + this.composite = new FloatComposite(parent); + if (originalValue != null) { + if (originalValue instanceof Float) { + this.composite.setValue((Float) originalValue); + } else { + Logger.logError("An instance of Float was expected", //$NON-NLS-1$ + Activator.getDefault()); + } + } + this.composite.addCommitListener(new IListener() { + public void handleEvent() { + editHandler.commit(); + } + }); + return this.composite; + } + + public Object getValue() { + return this.composite.getValue(); + } + +}
diff --git a/org.eclipse.modisco.facet.widgets.celleditors.ecore/src/org/eclipse/modisco/facet/widgets/celleditors/ecore/EIntCellEditor.java b/org.eclipse.modisco.facet.widgets.celleditors.ecore/src/org/eclipse/modisco/facet/widgets/celleditors/ecore/EIntCellEditor.java new file mode 100644 index 0000000..077079b --- /dev/null +++ b/org.eclipse.modisco.facet.widgets.celleditors.ecore/src/org/eclipse/modisco/facet/widgets/celleditors/ecore/EIntCellEditor.java
@@ -0,0 +1,52 @@ +/***************************************************************************** + * Copyright (c) 2010 CEA LIST. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Nicolas Guyomar (Mia-Software) - initial API and implementation + * Nicolas Bros (Mia-Software) - Bug 334539 - [celleditors] change listener + *****************************************************************************/ +package org.eclipse.modisco.facet.widgets.celleditors.ecore; + +import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.ecore.EStructuralFeature; +import org.eclipse.modisco.facet.util.core.Logger; +import org.eclipse.modisco.facet.widgets.celleditors.IListener; +import org.eclipse.modisco.facet.widgets.celleditors.IModelCellEditHandler; +import org.eclipse.modisco.facet.widgets.celleditors.IModelCellEditor; +import org.eclipse.modisco.facet.widgets.celleditors.ecore.composite.IntComposite; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Control; + +/** A cell editor for Integer */ +public class EIntCellEditor implements IModelCellEditor { + + private IntComposite composite = null; + + public Control activateCell(final Composite parent, final Object originalValue, + final IModelCellEditHandler editHandler, final EStructuralFeature feature, + final EObject source) { + this.composite = new IntComposite(parent); + if (originalValue != null) { + if (originalValue instanceof Integer) { + this.composite.setValue((Integer) originalValue); + } else { + Logger.logError("An instance of Integer was expected", Activator.getDefault()); //$NON-NLS-1$ + } + } + this.composite.addCommitListener(new IListener() { + public void handleEvent() { + editHandler.commit(); + } + }); + return this.composite; + } + + public Object getValue() { + return this.composite.getValue(); + } +} \ No newline at end of file
diff --git a/org.eclipse.modisco.facet.widgets.celleditors.ecore/src/org/eclipse/modisco/facet/widgets/celleditors/ecore/ELongCellEditor.java b/org.eclipse.modisco.facet.widgets.celleditors.ecore/src/org/eclipse/modisco/facet/widgets/celleditors/ecore/ELongCellEditor.java new file mode 100644 index 0000000..7e811c1 --- /dev/null +++ b/org.eclipse.modisco.facet.widgets.celleditors.ecore/src/org/eclipse/modisco/facet/widgets/celleditors/ecore/ELongCellEditor.java
@@ -0,0 +1,54 @@ +/***************************************************************************** + * Copyright (c) 2010 CEA LIST. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Nicolas Guyomar (Mia-Software) - initial API and implementation + * Nicolas Bros (Mia-Software) - Bug 334539 - [celleditors] change listener + *****************************************************************************/ +package org.eclipse.modisco.facet.widgets.celleditors.ecore; + +import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.ecore.EStructuralFeature; +import org.eclipse.modisco.facet.util.core.Logger; +import org.eclipse.modisco.facet.widgets.celleditors.IListener; +import org.eclipse.modisco.facet.widgets.celleditors.IModelCellEditHandler; +import org.eclipse.modisco.facet.widgets.celleditors.IModelCellEditor; +import org.eclipse.modisco.facet.widgets.celleditors.ecore.composite.LongComposite; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Control; + +/** A cell editor for Long */ +public class ELongCellEditor implements IModelCellEditor { + + private LongComposite composite = null; + + public Control activateCell(final Composite parent, final Object originalValue, + final IModelCellEditHandler editHandler, final EStructuralFeature feature, + final EObject source) { + this.composite = new LongComposite(parent); + if (originalValue != null) { + if (originalValue instanceof Long) { + this.composite.setValue((Long) originalValue); + } else { + Logger.logError("An instance of Long was expected", //$NON-NLS-1$ + Activator.getDefault()); + } + } + this.composite.addCommitListener(new IListener() { + public void handleEvent() { + editHandler.commit(); + } + }); + return this.composite; + } + + public Object getValue() { + return this.composite.getValue(); + } + +}
diff --git a/org.eclipse.modisco.facet.widgets.celleditors.ecore/src/org/eclipse/modisco/facet/widgets/celleditors/ecore/EShortCellEditor.java b/org.eclipse.modisco.facet.widgets.celleditors.ecore/src/org/eclipse/modisco/facet/widgets/celleditors/ecore/EShortCellEditor.java new file mode 100644 index 0000000..04b4b7f --- /dev/null +++ b/org.eclipse.modisco.facet.widgets.celleditors.ecore/src/org/eclipse/modisco/facet/widgets/celleditors/ecore/EShortCellEditor.java
@@ -0,0 +1,52 @@ +/***************************************************************************** + * Copyright (c) 2010 CEA LIST. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Nicolas Guyomar (Mia-Software) - initial API and implementation + * Nicolas Bros (Mia-Software) - Bug 334539 - [celleditors] change listener + *****************************************************************************/ +package org.eclipse.modisco.facet.widgets.celleditors.ecore; + +import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.ecore.EStructuralFeature; +import org.eclipse.modisco.facet.util.core.Logger; +import org.eclipse.modisco.facet.widgets.celleditors.IListener; +import org.eclipse.modisco.facet.widgets.celleditors.IModelCellEditHandler; +import org.eclipse.modisco.facet.widgets.celleditors.IModelCellEditor; +import org.eclipse.modisco.facet.widgets.celleditors.ecore.composite.ShortComposite; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Control; + +/** A cell editor for Short */ +public class EShortCellEditor implements IModelCellEditor { + + private ShortComposite composite = null; + + public Control activateCell(final Composite parent, final Object originalValue, + final IModelCellEditHandler editHandler, final EStructuralFeature feature, + final EObject source) { + this.composite = new ShortComposite(parent); + if (originalValue != null) { + if (originalValue instanceof Short) { + this.composite.setValue((Short) originalValue); + } else { + Logger.logError("An instance of Short was expected", Activator.getDefault()); //$NON-NLS-1$ + } + } + this.composite.addCommitListener(new IListener() { + public void handleEvent() { + editHandler.commit(); + } + }); + return this.composite; + } + + public Object getValue() { + return this.composite.getValue(); + } +}
diff --git a/org.eclipse.modisco.facet.widgets.celleditors.ecore/src/org/eclipse/modisco/facet/widgets/celleditors/ecore/EStringMultiCellEditor.java b/org.eclipse.modisco.facet.widgets.celleditors.ecore/src/org/eclipse/modisco/facet/widgets/celleditors/ecore/EStringMultiCellEditor.java new file mode 100644 index 0000000..46f53e2 --- /dev/null +++ b/org.eclipse.modisco.facet.widgets.celleditors.ecore/src/org/eclipse/modisco/facet/widgets/celleditors/ecore/EStringMultiCellEditor.java
@@ -0,0 +1,45 @@ +/***************************************************************************** + * Copyright (c) 2010 CEA LIST. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Nicolas Guyomar (Mia-Software) - initial API and implementation + * Nicolas Bros (Mia-Software) - Bug 334539 - [celleditors] change listener + *****************************************************************************/ +package org.eclipse.modisco.facet.widgets.celleditors.ecore; + +import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.ecore.EStructuralFeature; +import org.eclipse.modisco.facet.widgets.celleditors.IListener; +import org.eclipse.modisco.facet.widgets.celleditors.IModelCellEditHandler; +import org.eclipse.modisco.facet.widgets.celleditors.IModelCellEditor; +import org.eclipse.modisco.facet.widgets.celleditors.ecore.composite.StringMultiComposite; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Control; + +/** A cell editor for multiple line Strings */ +public class EStringMultiCellEditor implements IModelCellEditor { + + private StringMultiComposite<String> composite = null; + + public Control activateCell(final Composite parent, final Object originalValue, + final IModelCellEditHandler editHandler, final EStructuralFeature feature, + final EObject source) { + this.composite = new StringMultiComposite<String>(parent, originalValue); + + this.composite.addCommitListener(new IListener() { + public void handleEvent() { + editHandler.commit(); + } + }); + return this.composite; + } + + public Object getValue() { + return this.composite.getValue(); + } +} \ No newline at end of file
diff --git a/org.eclipse.modisco.facet.widgets.celleditors.ecore/src/org/eclipse/modisco/facet/widgets/celleditors/ecore/Messages.java b/org.eclipse.modisco.facet.widgets.celleditors.ecore/src/org/eclipse/modisco/facet/widgets/celleditors/ecore/Messages.java new file mode 100644 index 0000000..a975e2d --- /dev/null +++ b/org.eclipse.modisco.facet.widgets.celleditors.ecore/src/org/eclipse/modisco/facet/widgets/celleditors/ecore/Messages.java
@@ -0,0 +1,26 @@ +/***************************************************************************** + * Copyright (c) 2010 CEA LIST. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Nicolas Bros (Mia-Software) - initial API and implementation + *****************************************************************************/ +package org.eclipse.modisco.facet.widgets.celleditors.ecore; + +import org.eclipse.osgi.util.NLS; + +public class Messages extends NLS { + private static final String BUNDLE_NAME = "org.eclipse.emf.facet.widgets.celleditors.ecore.messages"; //$NON-NLS-1$ + public static String MultiLineDialog_enterAValue; + static { + // initialize resource bundle + NLS.initializeMessages(Messages.BUNDLE_NAME, Messages.class); + } + + private Messages() { + } +}
diff --git a/org.eclipse.modisco.facet.widgets.celleditors.ecore/src/org/eclipse/modisco/facet/widgets/celleditors/ecore/composite/BigDecimalComposite.java b/org.eclipse.modisco.facet.widgets.celleditors.ecore/src/org/eclipse/modisco/facet/widgets/celleditors/ecore/composite/BigDecimalComposite.java new file mode 100644 index 0000000..1902488 --- /dev/null +++ b/org.eclipse.modisco.facet.widgets.celleditors.ecore/src/org/eclipse/modisco/facet/widgets/celleditors/ecore/composite/BigDecimalComposite.java
@@ -0,0 +1,87 @@ +/***************************************************************************** + * Copyright (c) 2010 CEA LIST. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Nicolas Guyomar (Mia-Software) - initial API and implementation + * Nicolas Guyomar (Mia-Software) - Bug 334546 - [celleditors] no border on Text field + *****************************************************************************/ +package org.eclipse.modisco.facet.widgets.celleditors.ecore.composite; + +import java.math.BigDecimal; + +import org.eclipse.core.runtime.IStatus; +import org.eclipse.core.runtime.Status; +import org.eclipse.modisco.facet.widgets.celleditors.ecore.Activator; +import org.eclipse.swt.SWT; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Event; +import org.eclipse.swt.widgets.Listener; + +public class BigDecimalComposite extends StringComposite<BigDecimal> { + + public BigDecimalComposite(final Composite parent) { + this(parent, SWT.NONE); + } + + public BigDecimalComposite(final Composite parent, final int style) { + super(parent, style); + getTextField().addListener(SWT.Verify, new Listener() { + public void handleEvent(final Event event) { + String input = event.text; + for (int i = 0; i < input.length(); i++) { + char ch = input.charAt(i); + if (ch == '.') { + if (BigDecimalComposite.this.getTextField().getText().indexOf('.') != -1) { + event.doit = false; + return; + } + } else { + if (!('0' <= ch && ch <= '9')) { + event.doit = false; + return; + } + } + } + + } + }); + } + + @Override + public IConverter<BigDecimal> initConverter() { + return new IConverter<BigDecimal>() { + public BigDecimal toObject(final String string) { + if (string != null && string.length() > 0) { + try { + return new BigDecimal(string); + } catch (Exception e) { + return null; + } + } + return null; + } + + public String toString(final BigDecimal object) { + return object.toString(); + } + }; + } + + @Override + public IStatus validate(final String string) { + try { + // The instantiation of the BigDecimal is only used to validate this string + @SuppressWarnings("unused") + BigDecimal bigDecimal = new BigDecimal(string); + } catch (Exception e) { + return new Status(IStatus.ERROR, Activator.PLUGIN_ID, ""); //$NON-NLS-1$ + } + return new Status(IStatus.OK, Activator.PLUGIN_ID, ""); //$NON-NLS-1$ + } + +}
diff --git a/org.eclipse.modisco.facet.widgets.celleditors.ecore/src/org/eclipse/modisco/facet/widgets/celleditors/ecore/composite/BigDecimalCompositeFactory.java b/org.eclipse.modisco.facet.widgets.celleditors.ecore/src/org/eclipse/modisco/facet/widgets/celleditors/ecore/composite/BigDecimalCompositeFactory.java new file mode 100644 index 0000000..cba8ff6 --- /dev/null +++ b/org.eclipse.modisco.facet.widgets.celleditors.ecore/src/org/eclipse/modisco/facet/widgets/celleditors/ecore/composite/BigDecimalCompositeFactory.java
@@ -0,0 +1,31 @@ +/******************************************************************************* + * Copyright (c) 2011 Mia-Software. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Fabien Giquel (Mia-Software) - initial API and implementation + * Nicolas Guyomar (Mia-Software) - Bug 334546 - [celleditors] no border on Text field + * Nicolas Bros (Mia-Software) - Bug 338437 - compositeEditors extension point cannot be used to register user types + *******************************************************************************/ +package org.eclipse.modisco.facet.widgets.celleditors.ecore.composite; + +import java.math.BigDecimal; + +import org.eclipse.modisco.facet.widgets.celleditors.AbstractCellEditorComposite; +import org.eclipse.modisco.facet.widgets.celleditors.ICompositeEditorFactory; +import org.eclipse.swt.widgets.Composite; + +public class BigDecimalCompositeFactory implements ICompositeEditorFactory<BigDecimal> { + + public AbstractCellEditorComposite<BigDecimal> createCompositeEditor(final Composite parent, final int style) { + return new BigDecimalComposite(parent, style); + } + + public Class<BigDecimal> getHandledType() { + return BigDecimal.class; + } + +}
diff --git a/org.eclipse.modisco.facet.widgets.celleditors.ecore/src/org/eclipse/modisco/facet/widgets/celleditors/ecore/composite/BigIntegerComposite.java b/org.eclipse.modisco.facet.widgets.celleditors.ecore/src/org/eclipse/modisco/facet/widgets/celleditors/ecore/composite/BigIntegerComposite.java new file mode 100644 index 0000000..cd1586c --- /dev/null +++ b/org.eclipse.modisco.facet.widgets.celleditors.ecore/src/org/eclipse/modisco/facet/widgets/celleditors/ecore/composite/BigIntegerComposite.java
@@ -0,0 +1,82 @@ +/***************************************************************************** + * Copyright (c) 2010 CEA LIST. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Nicolas Guyomar (Mia-Software) - initial API and implementation + * Nicolas Guyomar (Mia-Software) - Bug 334546 - [celleditors] no border on Text field + *****************************************************************************/ +package org.eclipse.modisco.facet.widgets.celleditors.ecore.composite; + +import java.math.BigInteger; + +import org.eclipse.core.runtime.IStatus; +import org.eclipse.core.runtime.Status; +import org.eclipse.modisco.facet.widgets.celleditors.ecore.Activator; +import org.eclipse.swt.SWT; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Event; +import org.eclipse.swt.widgets.Listener; + +public class BigIntegerComposite extends StringComposite<BigInteger> { + + public BigIntegerComposite(final Composite parent) { + this(parent, SWT.NONE); + } + + public BigIntegerComposite(final Composite parent, final int style) { + super(parent, style); + getTextField().addListener(SWT.Verify, new Listener() { + + public void handleEvent(final Event event) { + + String input = event.text; + for (int i = 0; i < input.length(); i++) { + char ch = input.charAt(i); + if (!('0' <= ch && ch <= '9')) { + event.doit = false; + return; + } + } + } + }); + } + + @Override + public IConverter<BigInteger> initConverter() { + return new IConverter<BigInteger>() { + + public BigInteger toObject(final String string) { + if (string != null && string.length() > 0) { + try { + return new BigInteger(string); + } catch (Exception e) { + return null; + } + } + return null; + } + + public String toString(final BigInteger object) { + return object.toString(); + } + }; + } + + @Override + @SuppressWarnings("unused") + // The instantiation of the BigInteger is only used to validate this string + public IStatus validate(final String string) { + try { + new BigInteger(string); + } catch (Exception e) { + return new Status(IStatus.ERROR, Activator.PLUGIN_ID, ""); //$NON-NLS-1$ + } + return new Status(IStatus.OK, Activator.PLUGIN_ID, ""); //$NON-NLS-1$ + } + +}
diff --git a/org.eclipse.modisco.facet.widgets.celleditors.ecore/src/org/eclipse/modisco/facet/widgets/celleditors/ecore/composite/BigIntegerCompositeFactory.java b/org.eclipse.modisco.facet.widgets.celleditors.ecore/src/org/eclipse/modisco/facet/widgets/celleditors/ecore/composite/BigIntegerCompositeFactory.java new file mode 100644 index 0000000..749e40e --- /dev/null +++ b/org.eclipse.modisco.facet.widgets.celleditors.ecore/src/org/eclipse/modisco/facet/widgets/celleditors/ecore/composite/BigIntegerCompositeFactory.java
@@ -0,0 +1,31 @@ +/******************************************************************************* + * Copyright (c) 2011 Mia-Software. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Fabien Giquel (Mia-Software) - initial API and implementation + * Nicolas Guyomar (Mia-Software) - Bug 334546 - [celleditors] no border on Text field + * Nicolas Bros (Mia-Software) - Bug 338437 - compositeEditors extension point cannot be used to register user types + *******************************************************************************/ +package org.eclipse.modisco.facet.widgets.celleditors.ecore.composite; + +import java.math.BigInteger; + +import org.eclipse.modisco.facet.widgets.celleditors.AbstractCellEditorComposite; +import org.eclipse.modisco.facet.widgets.celleditors.ICompositeEditorFactory; +import org.eclipse.swt.widgets.Composite; + +public class BigIntegerCompositeFactory implements ICompositeEditorFactory<BigInteger> { + + public AbstractCellEditorComposite<BigInteger> createCompositeEditor(final Composite parent, final int style) { + return new BigIntegerComposite(parent, style); + } + + public Class<BigInteger> getHandledType() { + return BigInteger.class; + } + +}
diff --git a/org.eclipse.modisco.facet.widgets.celleditors.ecore/src/org/eclipse/modisco/facet/widgets/celleditors/ecore/composite/BooleanComposite.java b/org.eclipse.modisco.facet.widgets.celleditors.ecore/src/org/eclipse/modisco/facet/widgets/celleditors/ecore/composite/BooleanComposite.java new file mode 100644 index 0000000..adb4b49 --- /dev/null +++ b/org.eclipse.modisco.facet.widgets.celleditors.ecore/src/org/eclipse/modisco/facet/widgets/celleditors/ecore/composite/BooleanComposite.java
@@ -0,0 +1,148 @@ +/***************************************************************************** + * Copyright (c) 2010 CEA LIST. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Nicolas Guyomar (Mia-Software) - initial API and implementation + * Nicolas Guyomar (Mia-Software) - Bug 334546 - [celleditors] no border on Text field + * Nicolas Bros (Mia-Software) - Bug 334539 - [celleditors] change listener + *****************************************************************************/ +package org.eclipse.modisco.facet.widgets.celleditors.ecore.composite; + +import org.eclipse.modisco.facet.widgets.celleditors.AbstractCellEditorComposite; +import org.eclipse.swt.SWT; +import org.eclipse.swt.events.DisposeEvent; +import org.eclipse.swt.events.DisposeListener; +import org.eclipse.swt.events.KeyAdapter; +import org.eclipse.swt.events.KeyEvent; +import org.eclipse.swt.events.SelectionAdapter; +import org.eclipse.swt.events.SelectionEvent; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.widgets.Combo; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Control; +import org.eclipse.swt.widgets.Display; +import org.eclipse.swt.widgets.Event; +import org.eclipse.swt.widgets.Listener; + +public class BooleanComposite extends AbstractCellEditorComposite<Boolean> { + + private Combo combo = null; + private boolean enableSelectionListener = true; + private Control parentControl = null; + + public BooleanComposite(final Composite parent) { + this(parent, SWT.NONE); + } + + public BooleanComposite(final Composite parent, final int style) { + super(parent, style); + this.parentControl = parent; + GridLayout gd = new GridLayout(1, false); + gd.marginHeight = 0; + gd.marginWidth = 0; + gd.horizontalSpacing = 0; + setLayout(gd); + + this.combo = new Combo(this, SWT.READ_ONLY); + this.combo.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true)); + this.combo.setItems(new String[] { "true", "false" }); //$NON-NLS-1$ //$NON-NLS-2$ + this.combo.addKeyListener(new KeyAdapter() { + @Override + public void keyPressed(final KeyEvent event) { + + if ((event.keyCode == SWT.CR && event.stateMask == 0)) { + // Enter key pressed + commit(); + } else if (event.keyCode == SWT.ESC && event.stateMask == 0 + || (event.keyCode == SWT.KEYPAD_CR && event.stateMask == 0)) { + // Escape key pressed + close(); + } + BooleanComposite.this.setEnableSelectionListener(false); + } + }); + + this.combo.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(final SelectionEvent e) { + if (BooleanComposite.this.getEnableSelectionListener()) { + fireChanged(); + commit(); + super.widgetSelected(e); + } + BooleanComposite.this.setEnableSelectionListener(true); + } + }); + + // commit the cell editor when the mouse is clicked + // anywhere outside the text field + final Listener clickListener = new Listener() { + public void handleEvent(final Event event) { + if (event.widget instanceof Control) { + Control control = (Control) event.widget; + if (control.getShell() == BooleanComposite.this.getParentControl().getShell()) { + if (event.widget != BooleanComposite.this.getCombo()) { + commit(); + } + } + } + } + }; + Display.getDefault().addFilter(SWT.MouseDown, clickListener); + + // this listener is only here to remove + // the other listener from the Display + getCombo().addDisposeListener(new DisposeListener() { + public void widgetDisposed(final DisposeEvent e) { + Display.getDefault().removeFilter(SWT.MouseDown, clickListener); + } + }); + + this.combo.forceFocus(); + } + + protected void commit() { + fireCommit(); + } + + public Boolean getValue() { + if (this.combo.getSelectionIndex() == 0) { + return Boolean.TRUE; + } + return Boolean.FALSE; + + } + + public void setValue(final Boolean value) { + if (value != null) { + if (value.booleanValue()) { + this.combo.select(0); + } else { + this.combo.select(1); + } + } + } + + protected Combo getCombo() { + return this.combo; + } + + protected boolean getEnableSelectionListener() { + return this.enableSelectionListener; + } + + protected void setEnableSelectionListener(final boolean value) { + this.enableSelectionListener = value; + } + + protected Control getParentControl() { + return this.parentControl; + } + +}
diff --git a/org.eclipse.modisco.facet.widgets.celleditors.ecore/src/org/eclipse/modisco/facet/widgets/celleditors/ecore/composite/BooleanCompositeFactory.java b/org.eclipse.modisco.facet.widgets.celleditors.ecore/src/org/eclipse/modisco/facet/widgets/celleditors/ecore/composite/BooleanCompositeFactory.java new file mode 100644 index 0000000..41841c8 --- /dev/null +++ b/org.eclipse.modisco.facet.widgets.celleditors.ecore/src/org/eclipse/modisco/facet/widgets/celleditors/ecore/composite/BooleanCompositeFactory.java
@@ -0,0 +1,29 @@ +/******************************************************************************* + * Copyright (c) 2011 Mia-Software. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Fabien Giquel (Mia-Software) - initial API and implementation + * Nicolas Guyomar (Mia-Software) - Bug 334546 - [celleditors] no border on Text field + * Nicolas Bros (Mia-Software) - Bug 338437 - compositeEditors extension point cannot be used to register user types + *******************************************************************************/ +package org.eclipse.modisco.facet.widgets.celleditors.ecore.composite; + +import org.eclipse.modisco.facet.widgets.celleditors.AbstractCellEditorComposite; +import org.eclipse.modisco.facet.widgets.celleditors.ICompositeEditorFactory; +import org.eclipse.swt.widgets.Composite; + +public class BooleanCompositeFactory implements ICompositeEditorFactory<Boolean> { + + public AbstractCellEditorComposite<Boolean> createCompositeEditor(final Composite parent, final int style) { + return new BooleanComposite(parent, style); + } + + public Class<Boolean> getHandledType() { + return Boolean.class; + } + +}
diff --git a/org.eclipse.modisco.facet.widgets.celleditors.ecore/src/org/eclipse/modisco/facet/widgets/celleditors/ecore/composite/ByteComposite.java b/org.eclipse.modisco.facet.widgets.celleditors.ecore/src/org/eclipse/modisco/facet/widgets/celleditors/ecore/composite/ByteComposite.java new file mode 100644 index 0000000..1b0e267 --- /dev/null +++ b/org.eclipse.modisco.facet.widgets.celleditors.ecore/src/org/eclipse/modisco/facet/widgets/celleditors/ecore/composite/ByteComposite.java
@@ -0,0 +1,113 @@ +/***************************************************************************** + * Copyright (c) 2010 CEA LIST. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Nicolas Guyomar (Mia-Software) - initial API and implementation + * Nicolas Guyomar (Mia-Software) - Bug 334546 - [celleditors] no border on Text field + *****************************************************************************/ +package org.eclipse.modisco.facet.widgets.celleditors.ecore.composite; + +import org.eclipse.core.runtime.IStatus; +import org.eclipse.core.runtime.Status; +import org.eclipse.modisco.facet.widgets.celleditors.IValidator; +import org.eclipse.modisco.facet.widgets.celleditors.ecore.Activator; +import org.eclipse.swt.SWT; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Event; +import org.eclipse.swt.widgets.Listener; + +public class ByteComposite extends StringComposite<Byte> { + + public ByteComposite(final Composite parent) { + this(parent, SWT.NONE); + } + + public ByteComposite(final Composite parent, final int style) { + super(parent, style); + + getTextField().addListener(SWT.Verify, new Listener() { + + public void handleEvent(final Event event) { + + String input = event.text; + for (int i = 0; i < input.length(); i++) { + char ch = input.charAt(i); + if (ch != '-') { + if (!('0' <= ch && ch <= '9')) { + event.doit = false; + return; + } + } else { + if (ByteComposite.this.getTextField().getText().indexOf('-') != -1) { + event.doit = false; + return; + } + // If the '-' caracter is not type at the beginning of + // the String + if (event.start != 0) { + event.doit = false; + return; + } + } + } + } + + }); + } + + @Override + public IValidator getValidator() { + return new IValidator() { + public IStatus validate(final Object object) { + if (getValue() != null) { + if (Byte.MIN_VALUE <= getValue().byteValue() + && getValue().byteValue() <= Byte.MAX_VALUE) { + return Status.OK_STATUS; + } + } + return new Status(IStatus.ERROR, Activator.PLUGIN_ID, ""); //$NON-NLS-1$ + } + }; + } + + @Override + public IConverter<Byte> initConverter() { + return new IConverter<Byte>() { + + public Byte toObject(final String string) { + if (string != null && string.length() > 0) { + try { + return new Byte(string); + } catch (Exception e) { + e.printStackTrace(); + return null; + } + + } + return null; + } + + public String toString(final Byte object) { + return object.toString(); + } + }; + } + + @Override + public IStatus validate(final String string) { + try { + if (string.length() > 0) { + Byte.parseByte(string); + } + } catch (Exception e) { + return new Status(IStatus.ERROR, Activator.PLUGIN_ID, ""); //$NON-NLS-1$ + } + return new Status(IStatus.OK, Activator.PLUGIN_ID, ""); //$NON-NLS-1$ + } + +}
diff --git a/org.eclipse.modisco.facet.widgets.celleditors.ecore/src/org/eclipse/modisco/facet/widgets/celleditors/ecore/composite/ByteCompositeFactory.java b/org.eclipse.modisco.facet.widgets.celleditors.ecore/src/org/eclipse/modisco/facet/widgets/celleditors/ecore/composite/ByteCompositeFactory.java new file mode 100644 index 0000000..68d5c5e --- /dev/null +++ b/org.eclipse.modisco.facet.widgets.celleditors.ecore/src/org/eclipse/modisco/facet/widgets/celleditors/ecore/composite/ByteCompositeFactory.java
@@ -0,0 +1,29 @@ +/******************************************************************************* + * Copyright (c) 2011 Mia-Software. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Fabien Giquel (Mia-Software) - initial API and implementation + * Nicolas Guyomar (Mia-Software) - Bug 334546 - [celleditors] no border on Text field + * Nicolas Bros (Mia-Software) - Bug 338437 - compositeEditors extension point cannot be used to register user types + *******************************************************************************/ +package org.eclipse.modisco.facet.widgets.celleditors.ecore.composite; + +import org.eclipse.modisco.facet.widgets.celleditors.AbstractCellEditorComposite; +import org.eclipse.modisco.facet.widgets.celleditors.ICompositeEditorFactory; +import org.eclipse.swt.widgets.Composite; + +public class ByteCompositeFactory implements ICompositeEditorFactory<Byte> { + + public AbstractCellEditorComposite<Byte> createCompositeEditor(final Composite parent, final int style) { + return new ByteComposite(parent, style); + } + + public Class<Byte> getHandledType() { + return Byte.class; + } + +}
diff --git a/org.eclipse.modisco.facet.widgets.celleditors.ecore/src/org/eclipse/modisco/facet/widgets/celleditors/ecore/composite/CharComposite.java b/org.eclipse.modisco.facet.widgets.celleditors.ecore/src/org/eclipse/modisco/facet/widgets/celleditors/ecore/composite/CharComposite.java new file mode 100644 index 0000000..aac4ea9 --- /dev/null +++ b/org.eclipse.modisco.facet.widgets.celleditors.ecore/src/org/eclipse/modisco/facet/widgets/celleditors/ecore/composite/CharComposite.java
@@ -0,0 +1,76 @@ +/***************************************************************************** + * Copyright (c) 2010 CEA LIST. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Nicolas Guyomar (Mia-Software) - initial API and implementation + * Nicolas Guyomar (Mia-Software) - Bug 334546 - [celleditors] no border on Text field + * Nicolas Bros (Mia-Software) - Bug 343655 - CharComposite : magic numbers + *****************************************************************************/ +package org.eclipse.modisco.facet.widgets.celleditors.ecore.composite; + +import org.eclipse.core.runtime.IStatus; +import org.eclipse.core.runtime.Status; +import org.eclipse.modisco.facet.widgets.celleditors.ecore.Activator; +import org.eclipse.swt.SWT; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Event; +import org.eclipse.swt.widgets.Listener; + +public class CharComposite extends StringComposite<Character> { + + public CharComposite(final Composite parent) { + this(parent, SWT.NONE); + } + + public CharComposite(final Composite parent, final int style) { + super(parent, style); + getTextField().addListener(SWT.Verify, new Listener() { + + public void handleEvent(final Event event) { + if (event.keyCode != SWT.BS && event.keyCode != SWT.DEL) { + if (CharComposite.this.getTextField().getSelectionCount() < 1) { + if (CharComposite.this.getTextField().getText().length() >= 1) { + event.doit = false; + return; + } + } + } + } + }); + } + + @Override + public IConverter<Character> initConverter() { + return new IConverter<Character>() { + + public Character toObject(final String string) { + if (string != null && string.length() > 0) { + try { + return new Character(string.charAt(0)); + } catch (Exception e) { + return null; + } + } + return null; + } + + public String toString(final Character object) { + return object.toString(); + } + }; + } + + @Override + public IStatus validate(final String string) { + if (string.length() == 1) { + return new Status(IStatus.OK, Activator.PLUGIN_ID, ""); //$NON-NLS-1$ + } + return new Status(IStatus.ERROR, Activator.PLUGIN_ID, ""); //$NON-NLS-1$ + + } +}
diff --git a/org.eclipse.modisco.facet.widgets.celleditors.ecore/src/org/eclipse/modisco/facet/widgets/celleditors/ecore/composite/CharCompositeFactory.java b/org.eclipse.modisco.facet.widgets.celleditors.ecore/src/org/eclipse/modisco/facet/widgets/celleditors/ecore/composite/CharCompositeFactory.java new file mode 100644 index 0000000..9eae439 --- /dev/null +++ b/org.eclipse.modisco.facet.widgets.celleditors.ecore/src/org/eclipse/modisco/facet/widgets/celleditors/ecore/composite/CharCompositeFactory.java
@@ -0,0 +1,29 @@ +/******************************************************************************* + * Copyright (c) 2011 Mia-Software. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Fabien Giquel (Mia-Software) - initial API and implementation + * Nicolas Guyomar (Mia-Software) - Bug 334546 - [celleditors] no border on Text field + * Nicolas Bros (Mia-Software) - Bug 338437 - compositeEditors extension point cannot be used to register user types + *******************************************************************************/ +package org.eclipse.modisco.facet.widgets.celleditors.ecore.composite; + +import org.eclipse.modisco.facet.widgets.celleditors.AbstractCellEditorComposite; +import org.eclipse.modisco.facet.widgets.celleditors.ICompositeEditorFactory; +import org.eclipse.swt.widgets.Composite; + +public class CharCompositeFactory implements ICompositeEditorFactory<Character> { + + public AbstractCellEditorComposite<Character> createCompositeEditor(final Composite parent, final int style) { + return new CharComposite(parent, style); + } + + public Class<Character> getHandledType() { + return Character.class; + } + +}
diff --git a/org.eclipse.modisco.facet.widgets.celleditors.ecore/src/org/eclipse/modisco/facet/widgets/celleditors/ecore/composite/DoubleComposite.java b/org.eclipse.modisco.facet.widgets.celleditors.ecore/src/org/eclipse/modisco/facet/widgets/celleditors/ecore/composite/DoubleComposite.java new file mode 100644 index 0000000..4726156 --- /dev/null +++ b/org.eclipse.modisco.facet.widgets.celleditors.ecore/src/org/eclipse/modisco/facet/widgets/celleditors/ecore/composite/DoubleComposite.java
@@ -0,0 +1,107 @@ +/***************************************************************************** + * Copyright (c) 2010 CEA LIST. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Nicolas Guyomar (Mia-Software) - initial API and implementation + * Nicolas Guyomar (Mia-Software) - Bug 334546 - [celleditors] no border on Text field + *****************************************************************************/ +package org.eclipse.modisco.facet.widgets.celleditors.ecore.composite; + +import org.eclipse.core.runtime.IStatus; +import org.eclipse.core.runtime.Status; +import org.eclipse.modisco.facet.widgets.celleditors.IValidator; +import org.eclipse.modisco.facet.widgets.celleditors.ecore.Activator; +import org.eclipse.swt.SWT; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Event; +import org.eclipse.swt.widgets.Listener; + +public class DoubleComposite extends StringComposite<Double> { + + public DoubleComposite(final Composite parent) { + this(parent, SWT.NONE); + } + + public DoubleComposite(final Composite parent, final int style) { + super(parent, style); + + getTextField().addListener(SWT.Verify, new Listener() { + + public void handleEvent(final Event event) { + + String input = event.text; + for (int i = 0; i < input.length(); i++) { + char ch = input.charAt(i); + if (ch != '-') { + if (ch == '.') { + if (DoubleComposite.this.getTextField().getText().indexOf('.') != -1) { + event.doit = false; + return; + } + } else { + if (!('0' <= ch && ch <= '9')) { + event.doit = false; + return; + } + } + } + } + } + + }); + } + + @Override + public IValidator getValidator() { + return new IValidator() { + public IStatus validate(final Object object) { + if (getValue() != null) { + if (Double.MIN_VALUE <= getValue().doubleValue() + && getValue().doubleValue() <= Double.MAX_VALUE) { + return Status.OK_STATUS; + } + } + return new Status(IStatus.ERROR, Activator.PLUGIN_ID, ""); //$NON-NLS-1$ + } + }; + } + + @Override + public IConverter<Double> initConverter() { + return new IConverter<Double>() { + + public Double toObject(final String string) { + if (string != null && string.length() > 0) { + try { + return new Double(string); + } catch (Exception e) { + return null; + } + } + return null; + } + + public String toString(final Double object) { + return object.toString(); + } + }; + } + + @Override + public IStatus validate(final String string) { + try { + if (string.length() > 0) { + Double.parseDouble(string); + } + } catch (Exception e) { + return new Status(IStatus.ERROR, Activator.PLUGIN_ID, ""); //$NON-NLS-1$ + } + return new Status(IStatus.OK, Activator.PLUGIN_ID, ""); //$NON-NLS-1$ + } + +}
diff --git a/org.eclipse.modisco.facet.widgets.celleditors.ecore/src/org/eclipse/modisco/facet/widgets/celleditors/ecore/composite/DoubleCompositeFactory.java b/org.eclipse.modisco.facet.widgets.celleditors.ecore/src/org/eclipse/modisco/facet/widgets/celleditors/ecore/composite/DoubleCompositeFactory.java new file mode 100644 index 0000000..0127e9f --- /dev/null +++ b/org.eclipse.modisco.facet.widgets.celleditors.ecore/src/org/eclipse/modisco/facet/widgets/celleditors/ecore/composite/DoubleCompositeFactory.java
@@ -0,0 +1,27 @@ +/******************************************************************************* + * Copyright (c) 2011 Mia-Software. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Fabien Giquel (Mia-Software) - initial API and implementation + * Nicolas Guyomar (Mia-Software) - Bug 334546 - [celleditors] no border on Text field + * Nicolas Bros (Mia-Software) - Bug 338437 - compositeEditors extension point cannot be used to register user types + *******************************************************************************/ +package org.eclipse.modisco.facet.widgets.celleditors.ecore.composite; + +import org.eclipse.modisco.facet.widgets.celleditors.AbstractCellEditorComposite; +import org.eclipse.modisco.facet.widgets.celleditors.ICompositeEditorFactory; +import org.eclipse.swt.widgets.Composite; + +public class DoubleCompositeFactory implements ICompositeEditorFactory<Double> { + public AbstractCellEditorComposite<Double> createCompositeEditor(final Composite parent, final int style) { + return new DoubleComposite(parent, style); + } + + public Class<Double> getHandledType() { + return Double.class; + } +}
diff --git a/org.eclipse.modisco.facet.widgets.celleditors.ecore/src/org/eclipse/modisco/facet/widgets/celleditors/ecore/composite/FloatComposite.java b/org.eclipse.modisco.facet.widgets.celleditors.ecore/src/org/eclipse/modisco/facet/widgets/celleditors/ecore/composite/FloatComposite.java new file mode 100644 index 0000000..3c357a0 --- /dev/null +++ b/org.eclipse.modisco.facet.widgets.celleditors.ecore/src/org/eclipse/modisco/facet/widgets/celleditors/ecore/composite/FloatComposite.java
@@ -0,0 +1,117 @@ +/***************************************************************************** + * Copyright (c) 2010 CEA LIST. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Nicolas Guyomar (Mia-Software) - initial API and implementation + * Nicolas Guyomar (Mia-Software) - Bug 334546 - [celleditors] no border on Text field + *****************************************************************************/ +package org.eclipse.modisco.facet.widgets.celleditors.ecore.composite; + +import org.eclipse.core.runtime.IStatus; +import org.eclipse.core.runtime.Status; +import org.eclipse.modisco.facet.widgets.celleditors.IValidator; +import org.eclipse.modisco.facet.widgets.celleditors.ecore.Activator; +import org.eclipse.swt.SWT; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Event; +import org.eclipse.swt.widgets.Listener; + +public class FloatComposite extends StringComposite<Float> { + + public FloatComposite(final Composite parent) { + this(parent, SWT.NONE); + } + + public FloatComposite(final Composite parent, final int style) { + super(parent, style); + + getTextField().addListener(SWT.Verify, new Listener() { + + public void handleEvent(final Event event) { + + String input = event.text; + for (int i = 0; i < input.length(); i++) { + char ch = input.charAt(i); + if (ch != '-') { + if (ch == '.') { + if (FloatComposite.this.getTextField().getText().indexOf('.') != -1) { + event.doit = false; + return; + } + } else { + if (!('0' <= ch && ch <= '9')) { + event.doit = false; + return; + } + } + } else { + if (FloatComposite.this.getTextField().getText().indexOf('-') != -1) { + event.doit = false; + return; + } + // If the '-' caracter is not type at the beginning of + // the String + if (event.start != 0) { + event.doit = false; + return; + } + } + } + } + + }); + } + + @Override + public IValidator getValidator() { + return new IValidator() { + public IStatus validate(final Object object) { + if (getValue() != null) { + if (Float.MIN_VALUE <= getValue().floatValue() + && getValue().floatValue() <= Float.MAX_VALUE) { + return Status.OK_STATUS; + } + } + return new Status(IStatus.ERROR, Activator.PLUGIN_ID, ""); //$NON-NLS-1$ + } + }; + } + + @Override + public IConverter<Float> initConverter() { + return new IConverter<Float>() { + + public Float toObject(final String string) { + if (string != null && string.length() > 0) { + try { + return new Float(string); + } catch (Exception e) { + return null; + } + } + return null; + } + + public String toString(final Float object) { + return object.toString(); + } + }; + } + + @Override + public IStatus validate(final String string) { + try { + if (string.length() > 0) { + Float.parseFloat(string); + } + } catch (Exception e) { + return new Status(IStatus.ERROR, Activator.PLUGIN_ID, ""); //$NON-NLS-1$ + } + return new Status(IStatus.OK, Activator.PLUGIN_ID, ""); //$NON-NLS-1$ + } +}
diff --git a/org.eclipse.modisco.facet.widgets.celleditors.ecore/src/org/eclipse/modisco/facet/widgets/celleditors/ecore/composite/FloatCompositeFactory.java b/org.eclipse.modisco.facet.widgets.celleditors.ecore/src/org/eclipse/modisco/facet/widgets/celleditors/ecore/composite/FloatCompositeFactory.java new file mode 100644 index 0000000..8e6f0e9 --- /dev/null +++ b/org.eclipse.modisco.facet.widgets.celleditors.ecore/src/org/eclipse/modisco/facet/widgets/celleditors/ecore/composite/FloatCompositeFactory.java
@@ -0,0 +1,29 @@ +/******************************************************************************* + * Copyright (c) 2011 Mia-Software. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Fabien Giquel (Mia-Software) - initial API and implementation + * Nicolas Guyomar (Mia-Software) - Bug 334546 - [celleditors] no border on Text field + * Nicolas Bros (Mia-Software) - Bug 338437 - compositeEditors extension point cannot be used to register user types + *******************************************************************************/ +package org.eclipse.modisco.facet.widgets.celleditors.ecore.composite; + +import org.eclipse.modisco.facet.widgets.celleditors.AbstractCellEditorComposite; +import org.eclipse.modisco.facet.widgets.celleditors.ICompositeEditorFactory; +import org.eclipse.swt.widgets.Composite; + +public class FloatCompositeFactory implements ICompositeEditorFactory<Float> { + + public AbstractCellEditorComposite<Float> createCompositeEditor(final Composite parent, final int style) { + return new FloatComposite(parent, style); + } + + public Class<Float> getHandledType() { + return Float.class; + } + +}
diff --git a/org.eclipse.modisco.facet.widgets.celleditors.ecore/src/org/eclipse/modisco/facet/widgets/celleditors/ecore/composite/IntComposite.java b/org.eclipse.modisco.facet.widgets.celleditors.ecore/src/org/eclipse/modisco/facet/widgets/celleditors/ecore/composite/IntComposite.java new file mode 100644 index 0000000..e370ce5 --- /dev/null +++ b/org.eclipse.modisco.facet.widgets.celleditors.ecore/src/org/eclipse/modisco/facet/widgets/celleditors/ecore/composite/IntComposite.java
@@ -0,0 +1,110 @@ +/***************************************************************************** + * Copyright (c) 2010 CEA LIST. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Nicolas Guyomar (Mia-Software) - initial API and implementation + * Nicolas Guyomar (Mia-Software) - Bug 334546 - [celleditors] no border on Text field + *****************************************************************************/ +package org.eclipse.modisco.facet.widgets.celleditors.ecore.composite; + +import org.eclipse.core.runtime.IStatus; +import org.eclipse.core.runtime.Status; +import org.eclipse.modisco.facet.widgets.celleditors.IValidator; +import org.eclipse.modisco.facet.widgets.celleditors.ecore.Activator; +import org.eclipse.swt.SWT; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Event; +import org.eclipse.swt.widgets.Listener; + +public class IntComposite extends StringComposite<Integer> { + + public IntComposite(final Composite parent) { + this(parent, SWT.NONE); + } + + public IntComposite(final Composite parent, final int style) { + super(parent, style); + getTextField().addListener(SWT.Verify, new Listener() { + + public void handleEvent(final Event event) { + + String input = event.text; + for (int i = 0; i < input.length(); i++) { + char ch = input.charAt(i); + if (ch != '-') { + if (!('0' <= ch && ch <= '9')) { + event.doit = false; + return; + } + } else { + if (IntComposite.this.getTextField().getText().indexOf('-') != -1) { + event.doit = false; + return; + } + // If the '-' caracter is not type at the beginning of + // the String + if (event.start != 0) { + event.doit = false; + return; + } + } + } + } + + }); + } + + @Override + public IValidator getValidator() { + return new IValidator() { + public IStatus validate(final Object object) { + if (getValue() != null) { + if (Integer.MIN_VALUE <= getValue().intValue() + && getValue().intValue() <= Integer.MAX_VALUE) { + return Status.OK_STATUS; + } + } + return new Status(IStatus.ERROR, Activator.PLUGIN_ID, ""); //$NON-NLS-1$ + } + }; + } + + @Override + public IConverter<Integer> initConverter() { + return new IConverter<Integer>() { + + public Integer toObject(final String string) { + if (string != null && string.length() > 0) { + try { + return new Integer(string); + } catch (Exception e) { + return null; + } + + } + return null; + } + + public String toString(final Integer object) { + return object.toString(); + } + }; + } + + @Override + public IStatus validate(final String string) { + try { + if (string.length() > 0) { + Integer.parseInt(string); + } + } catch (Exception e) { + return new Status(IStatus.ERROR, Activator.PLUGIN_ID, ""); //$NON-NLS-1$ + } + return new Status(IStatus.OK, Activator.PLUGIN_ID, ""); //$NON-NLS-1$ + } +}
diff --git a/org.eclipse.modisco.facet.widgets.celleditors.ecore/src/org/eclipse/modisco/facet/widgets/celleditors/ecore/composite/IntCompositeFactory.java b/org.eclipse.modisco.facet.widgets.celleditors.ecore/src/org/eclipse/modisco/facet/widgets/celleditors/ecore/composite/IntCompositeFactory.java new file mode 100644 index 0000000..e23686f --- /dev/null +++ b/org.eclipse.modisco.facet.widgets.celleditors.ecore/src/org/eclipse/modisco/facet/widgets/celleditors/ecore/composite/IntCompositeFactory.java
@@ -0,0 +1,29 @@ +/******************************************************************************* + * Copyright (c) 2011 Mia-Software. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Fabien Giquel (Mia-Software) - initial API and implementation + * Nicolas Guyomar (Mia-Software) - Bug 334546 - [celleditors] no border on Text field + * Nicolas Bros (Mia-Software) - Bug 338437 - compositeEditors extension point cannot be used to register user types + *******************************************************************************/ +package org.eclipse.modisco.facet.widgets.celleditors.ecore.composite; + +import org.eclipse.modisco.facet.widgets.celleditors.AbstractCellEditorComposite; +import org.eclipse.modisco.facet.widgets.celleditors.ICompositeEditorFactory; +import org.eclipse.swt.widgets.Composite; + +public class IntCompositeFactory implements ICompositeEditorFactory<Integer> { + + public AbstractCellEditorComposite<Integer> createCompositeEditor(final Composite parent, final int style) { + return new IntComposite(parent, style); + } + + public Class<Integer> getHandledType() { + return Integer.class; + } + +}
diff --git a/org.eclipse.modisco.facet.widgets.celleditors.ecore/src/org/eclipse/modisco/facet/widgets/celleditors/ecore/composite/LongComposite.java b/org.eclipse.modisco.facet.widgets.celleditors.ecore/src/org/eclipse/modisco/facet/widgets/celleditors/ecore/composite/LongComposite.java new file mode 100644 index 0000000..55865f5 --- /dev/null +++ b/org.eclipse.modisco.facet.widgets.celleditors.ecore/src/org/eclipse/modisco/facet/widgets/celleditors/ecore/composite/LongComposite.java
@@ -0,0 +1,110 @@ +/***************************************************************************** + * Copyright (c) 2010 CEA LIST. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Nicolas Guyomar (Mia-Software) - initial API and implementation + * Nicolas Guyomar (Mia-Software) - Bug 334546 - [celleditors] no border on Text field + *****************************************************************************/ +package org.eclipse.modisco.facet.widgets.celleditors.ecore.composite; + +import org.eclipse.core.runtime.IStatus; +import org.eclipse.core.runtime.Status; +import org.eclipse.modisco.facet.widgets.celleditors.IValidator; +import org.eclipse.modisco.facet.widgets.celleditors.ecore.Activator; +import org.eclipse.swt.SWT; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Event; +import org.eclipse.swt.widgets.Listener; + +public class LongComposite extends StringComposite<Long> { + + public LongComposite(final Composite parent) { + this(parent, SWT.NONE); + } + + public LongComposite(final Composite parent, final int style) { + super(parent, style); + getTextField().addListener(SWT.Verify, new Listener() { + + public void handleEvent(final Event event) { + + String input = event.text; + for (int i = 0; i < input.length(); i++) { + char ch = input.charAt(i); + if (ch != '-') { + if (!('0' <= ch && ch <= '9')) { + event.doit = false; + return; + } + } else { + if (LongComposite.this.getTextField().getText().indexOf('-') != -1) { + event.doit = false; + return; + } + // If the '-' caracter is not type at the beginning of + // the String + if (event.start != 0) { + event.doit = false; + return; + } + } + } + } + + }); + } + + @Override + public IValidator getValidator() { + return new IValidator() { + public IStatus validate(final Object object) { + if (getValue() != null) { + if (Long.MIN_VALUE <= getValue().longValue() + && getValue().longValue() <= Long.MAX_VALUE) { + return Status.OK_STATUS; + } + } + return new Status(IStatus.ERROR, Activator.PLUGIN_ID, ""); //$NON-NLS-1$ + } + }; + } + + @Override + public IConverter<Long> initConverter() { + return new IConverter<Long>() { + + public Long toObject(final String string) { + if (string != null && string.length() > 0) { + try { + return new Long(string); + } catch (Exception e) { + return null; + } + } + return null; + } + + public String toString(final Long object) { + return object.toString(); + } + }; + } + + @Override + public IStatus validate(final String string) { + try { + if (string.length() > 0) { + Long.parseLong(string); + } + } catch (Exception e) { + return new Status(IStatus.ERROR, Activator.PLUGIN_ID, ""); //$NON-NLS-1$ + } + return new Status(IStatus.OK, Activator.PLUGIN_ID, ""); //$NON-NLS-1$ + } + +}
diff --git a/org.eclipse.modisco.facet.widgets.celleditors.ecore/src/org/eclipse/modisco/facet/widgets/celleditors/ecore/composite/LongCompositeFactory.java b/org.eclipse.modisco.facet.widgets.celleditors.ecore/src/org/eclipse/modisco/facet/widgets/celleditors/ecore/composite/LongCompositeFactory.java new file mode 100644 index 0000000..8407e85 --- /dev/null +++ b/org.eclipse.modisco.facet.widgets.celleditors.ecore/src/org/eclipse/modisco/facet/widgets/celleditors/ecore/composite/LongCompositeFactory.java
@@ -0,0 +1,30 @@ +/******************************************************************************* + * Copyright (c) 2011 Mia-Software. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Fabien Giquel (Mia-Software) - initial API and implementation + * Nicolas Guyomar (Mia-Software) - Bug 334546 - [celleditors] no border on Text field + * Nicolas Bros (Mia-Software) - Bug 338437 - compositeEditors extension point cannot be used to register user types + *******************************************************************************/ +package org.eclipse.modisco.facet.widgets.celleditors.ecore.composite; + +import org.eclipse.modisco.facet.widgets.celleditors.AbstractCellEditorComposite; +import org.eclipse.modisco.facet.widgets.celleditors.ICompositeEditorFactory; +import org.eclipse.swt.widgets.Composite; + +public class LongCompositeFactory implements ICompositeEditorFactory<Long> { + + public AbstractCellEditorComposite<Long> createCompositeEditor(final Composite parent, + final int style) { + return new LongComposite(parent, style); + } + + public Class<Long> getHandledType() { + return Long.class; + } + +}
diff --git a/org.eclipse.modisco.facet.widgets.celleditors.ecore/src/org/eclipse/modisco/facet/widgets/celleditors/ecore/composite/ShortComposite.java b/org.eclipse.modisco.facet.widgets.celleditors.ecore/src/org/eclipse/modisco/facet/widgets/celleditors/ecore/composite/ShortComposite.java new file mode 100644 index 0000000..c0eed84 --- /dev/null +++ b/org.eclipse.modisco.facet.widgets.celleditors.ecore/src/org/eclipse/modisco/facet/widgets/celleditors/ecore/composite/ShortComposite.java
@@ -0,0 +1,110 @@ +/***************************************************************************** + * Copyright (c) 2010 CEA LIST. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Nicolas Guyomar (Mia-Software) - initial API and implementation + * Nicolas Guyomar (Mia-Software) - Bug 334546 - [celleditors] no border on Text field + *****************************************************************************/ +package org.eclipse.modisco.facet.widgets.celleditors.ecore.composite; + +import org.eclipse.core.runtime.IStatus; +import org.eclipse.core.runtime.Status; +import org.eclipse.modisco.facet.widgets.celleditors.IValidator; +import org.eclipse.modisco.facet.widgets.celleditors.ecore.Activator; +import org.eclipse.swt.SWT; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Event; +import org.eclipse.swt.widgets.Listener; + +public class ShortComposite extends StringComposite<Short> { + + public ShortComposite(final Composite parent, final int style) { + super(parent, style); + getTextField().addListener(SWT.Verify, new Listener() { + + public void handleEvent(final Event event) { + + String input = event.text; + for (int i = 0; i < input.length(); i++) { + char ch = input.charAt(i); + if (ch != '-') { + if (!('0' <= ch && ch <= '9')) { + event.doit = false; + return; + } + } else { + if (ShortComposite.this.getTextField().getText().indexOf('-') != -1) { + event.doit = false; + return; + } + // If the '-' caracter is not type at the beginning of + // the String + if (event.start != 0) { + event.doit = false; + return; + } + } + } + } + + }); + } + + public ShortComposite(final Composite parent) { + this(parent, SWT.NONE); + } + + @Override + public IValidator getValidator() { + return new IValidator() { + public IStatus validate(final Object object) { + if (getValue() != null) { + if (Short.MIN_VALUE <= getValue().shortValue() + && getValue().shortValue() <= Short.MAX_VALUE) { + return Status.OK_STATUS; + } + } + return new Status(IStatus.ERROR, Activator.PLUGIN_ID, ""); //$NON-NLS-1$ + } + }; + } + + @Override + public IConverter<Short> initConverter() { + return new IConverter<Short>() { + + public Short toObject(final String string) { + if (string != null && string.length() > 0) { + try { + return new Short(string); + } catch (Exception e) { + return null; + } + } + return null; + } + + public String toString(final Short object) { + return object.toString(); + } + }; + } + + @Override + public IStatus validate(final String string) { + try { + if (string.length() > 0) { + Short.parseShort(string); + } + } catch (Exception e) { + return new Status(IStatus.ERROR, Activator.PLUGIN_ID, ""); //$NON-NLS-1$ + } + return new Status(IStatus.OK, Activator.PLUGIN_ID, ""); //$NON-NLS-1$ + } + +}
diff --git a/org.eclipse.modisco.facet.widgets.celleditors.ecore/src/org/eclipse/modisco/facet/widgets/celleditors/ecore/composite/ShortCompositeFactory.java b/org.eclipse.modisco.facet.widgets.celleditors.ecore/src/org/eclipse/modisco/facet/widgets/celleditors/ecore/composite/ShortCompositeFactory.java new file mode 100644 index 0000000..c39ebd1 --- /dev/null +++ b/org.eclipse.modisco.facet.widgets.celleditors.ecore/src/org/eclipse/modisco/facet/widgets/celleditors/ecore/composite/ShortCompositeFactory.java
@@ -0,0 +1,29 @@ +/******************************************************************************* + * Copyright (c) 2011 Mia-Software. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Fabien Giquel (Mia-Software) - initial API and implementation + * Nicolas Guyomar (Mia-Software) - Bug 334546 - [celleditors] no border on Text field + * Nicolas Bros (Mia-Software) - Bug 338437 - compositeEditors extension point cannot be used to register user types + *******************************************************************************/ +package org.eclipse.modisco.facet.widgets.celleditors.ecore.composite; + +import org.eclipse.modisco.facet.widgets.celleditors.AbstractCellEditorComposite; +import org.eclipse.modisco.facet.widgets.celleditors.ICompositeEditorFactory; +import org.eclipse.swt.widgets.Composite; + +public class ShortCompositeFactory implements ICompositeEditorFactory<Short> { + + public AbstractCellEditorComposite<Short> createCompositeEditor(final Composite parent, final int style) { + return new ShortComposite(parent, style); + } + + public Class<Short> getHandledType() { + return Short.class; + } + +}
diff --git a/org.eclipse.modisco.facet.widgets.celleditors.ecore/src/org/eclipse/modisco/facet/widgets/celleditors/ecore/composite/StringComposite.java b/org.eclipse.modisco.facet.widgets.celleditors.ecore/src/org/eclipse/modisco/facet/widgets/celleditors/ecore/composite/StringComposite.java new file mode 100644 index 0000000..6c1b569 --- /dev/null +++ b/org.eclipse.modisco.facet.widgets.celleditors.ecore/src/org/eclipse/modisco/facet/widgets/celleditors/ecore/composite/StringComposite.java
@@ -0,0 +1,180 @@ +/***************************************************************************** + * Copyright (c) 2010 CEA LIST. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Nicolas Guyomar (Mia-Software) - initial API and implementation + * Nicolas Guyomar (Mia-Software) - Bug 334546 - [celleditors] no border on Text field + * Nicolas Bros (Mia-Software) - Bug 334539 - [celleditors] change listener + * Nicolas Guyomar (Mia-Software) - Bug 349574 - EMF Facet Ecore String composite textField cannot be disabled + *****************************************************************************/ +package org.eclipse.modisco.facet.widgets.celleditors.ecore.composite; + +import org.eclipse.core.runtime.IStatus; +import org.eclipse.modisco.facet.widgets.celleditors.AbstractCellEditorComposite; +import org.eclipse.swt.SWT; +import org.eclipse.swt.events.DisposeEvent; +import org.eclipse.swt.events.DisposeListener; +import org.eclipse.swt.events.KeyAdapter; +import org.eclipse.swt.events.KeyEvent; +import org.eclipse.swt.events.ModifyEvent; +import org.eclipse.swt.events.ModifyListener; +import org.eclipse.swt.graphics.Color; +import org.eclipse.swt.layout.FillLayout; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Control; +import org.eclipse.swt.widgets.Display; +import org.eclipse.swt.widgets.Event; +import org.eclipse.swt.widgets.Listener; +import org.eclipse.swt.widgets.Text; + +public abstract class StringComposite<T> extends AbstractCellEditorComposite<T> { + + /** the control that is used to edit the contents of the cell */ + private Text textField = null; + + private final Composite parentControl; + + /** the original value of the cell **/ + private IConverter<T> converter; + + protected static final Color RED = new Color(Display.getCurrent(), 255, 192, 192); + protected static final Color WHITE = Display.getCurrent().getSystemColor( + SWT.COLOR_LIST_BACKGROUND); + + public StringComposite(final Composite parent, final int style) { + super(parent); + setLayout(new FillLayout()); + this.parentControl = parent; + this.textField = new Text(this, style); + + this.textField.addKeyListener(new KeyAdapter() { + @Override + public void keyPressed(final KeyEvent event) { + // Enter key pressed + if ((event.keyCode == SWT.CR && event.stateMask == 0) + || (event.keyCode == SWT.KEYPAD_CR && event.stateMask == 0)) { + if (StringComposite.this.getTextField().getEditable()) { + StringComposite.this.commit(); + } + } else if (event.keyCode == SWT.ESC && event.stateMask == 0) { + // Escape key pressed + close(); + } + } + + @Override + public void keyReleased(final KeyEvent e) { + if (!StringComposite.this.validate(StringComposite.this.getTextField().getText()) + .isOK()) { + StringComposite.this.getTextField().setBackground(StringComposite.RED); + } else { + + StringComposite.this.getTextField().setBackground(StringComposite.WHITE); + } + super.keyReleased(e); + } + + }); + final Listener clickListener = new Listener() { + /* + * (non-Javadoc) + * + * @see org.eclipse.swt.widgets.Listener#handleEvent(org.eclipse.swt. widgets.Event) + */ + public void handleEvent(final Event event) { + if (event.widget instanceof Control) { + Control control = (Control) event.widget; + if (control.getShell() == StringComposite.this.getParentControl().getShell()) { + if (event.widget != StringComposite.this.getTextField()) { + StringComposite.this.commit(); + } + } + } + } + }; + Display.getDefault().addFilter(SWT.MouseDown, clickListener); + // this listener is only here to remove + // the other listener from the Display + addDisposeListener(new DisposeListener() { + public void widgetDisposed(final DisposeEvent e) { + Display.getDefault().removeFilter(SWT.MouseDown, clickListener); + } + }); + + this.textField.addModifyListener(new ModifyListener() { + public void modifyText(final ModifyEvent e) { + fireChanged(); + } + }); + + this.textField.forceFocus(); + } + + public StringComposite(final Composite parent) { + this(parent, SWT.NONE); + } + + protected void commit() { + if (getValidator().validate(getValue()).isOK()) { + fireCommit(); + } + } + + @Override + public void setEnabled(final boolean enabled) { + this.textField.setEnabled(enabled); + super.setEnabled(enabled); + } + + public boolean getEditable() { + return this.textField.getEditable(); + } + + public void setValue(final T value) { + if (value == null) { + this.textField.setText(""); //$NON-NLS-1$ + } else { + String strValue = getConverter().toString(value); + this.textField.setText(strValue); + this.textField.setSelection(0, strValue.length()); + } + } + + public String getText() { + return this.textField.getText(); + } + + protected Text getTextField() { + return this.textField; + } + + protected Composite getParentControl() { + return this.parentControl; + } + + public T getValue() { + return this.getConverter().toObject(this.getText()); + } + + private IConverter<T> getConverter() { + if (this.converter == null) { + this.converter = this.initConverter(); + } + return this.converter; + } + + public abstract IConverter<T> initConverter(); + + public interface IConverter<T> { + public T toObject(String string); + + public String toString(T object); + } + + public abstract IStatus validate(String string); +}
diff --git a/org.eclipse.modisco.facet.widgets.celleditors.ecore/src/org/eclipse/modisco/facet/widgets/celleditors/ecore/composite/StringMultiComposite.java b/org.eclipse.modisco.facet.widgets.celleditors.ecore/src/org/eclipse/modisco/facet/widgets/celleditors/ecore/composite/StringMultiComposite.java new file mode 100644 index 0000000..4458cc0 --- /dev/null +++ b/org.eclipse.modisco.facet.widgets.celleditors.ecore/src/org/eclipse/modisco/facet/widgets/celleditors/ecore/composite/StringMultiComposite.java
@@ -0,0 +1,203 @@ +/***************************************************************************** + * Copyright (c) 2010 CEA LIST. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Nicolas Guyomar (Mia-Software) - initial API and implementation + * Nicolas Guyomar (Mia-Software) - Bug 334546 - [celleditors] no border on Text field + * Nicolas Bros (Mia-Software) - Bug 334539 - [celleditors] change listener + *****************************************************************************/ +package org.eclipse.modisco.facet.widgets.celleditors.ecore.composite; + +import org.eclipse.modisco.facet.util.core.Logger; +import org.eclipse.modisco.facet.widgets.celleditors.AbstractCellEditorComposite; +import org.eclipse.modisco.facet.widgets.celleditors.ecore.Activator; +import org.eclipse.modisco.facet.widgets.celleditors.ecore.ui.MultiLineDialog; +import org.eclipse.swt.SWT; +import org.eclipse.swt.events.DisposeEvent; +import org.eclipse.swt.events.DisposeListener; +import org.eclipse.swt.events.KeyAdapter; +import org.eclipse.swt.events.KeyEvent; +import org.eclipse.swt.events.ModifyEvent; +import org.eclipse.swt.events.ModifyListener; +import org.eclipse.swt.events.SelectionAdapter; +import org.eclipse.swt.events.SelectionEvent; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.widgets.Button; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Control; +import org.eclipse.swt.widgets.Display; +import org.eclipse.swt.widgets.Event; +import org.eclipse.swt.widgets.Listener; +import org.eclipse.swt.widgets.Text; + +/** A cell editor for Strings */ +public class StringMultiComposite<T> extends AbstractCellEditorComposite<String> { + + /** the control that is used to edit the contents of the cell */ + private final Button button; + private Text text = null; + + private final Composite parentControl; + + /** the original value of the cell */ + private String originalFieldValue; + + public StringMultiComposite(final Composite parent, final Object originalValue, final int style) { + super(parent); + this.parentControl = parent; + + GridLayout gd = new GridLayout(2, false); + gd.marginHeight = 0; + gd.marginWidth = 0; + gd.horizontalSpacing = 0; + setLayout(gd); + + this.text = new Text(this, style); + this.text.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false)); + this.button = new Button(this, SWT.PUSH); + this.button.setText("..."); //$NON-NLS-1$ + GridData data = new GridData(SWT.FILL, SWT.FILL, false, true); + this.button.setLayoutData(data); + + if (originalValue != null) { + if (originalValue instanceof String) { + this.setValue((String) originalValue); + this.text.setSelection(0, ((String) originalValue).length()); + } else { + Logger.logError("An instance of String was expected", Activator.getDefault()); //$NON-NLS-1$ + } + } + + this.button.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(final SelectionEvent e) { + MultiLineDialog dialog = new MultiLineDialog(StringMultiComposite.this + .getParentControl().getShell(), StringMultiComposite.this.getValue()) { + + @Override + protected void okPressed() { + StringMultiComposite.this.originalFieldValue = getTextArea().getText(); + StringMultiComposite.this.getText().setText(getTextArea().getText()); + StringMultiComposite.this.commit(); + super.okPressed(); + } + }; + dialog.open(); + } + }); + + // commit the cell editor when the mouse is clicked + // anywhere outside the text field + final Listener clickListener = new Listener() { + public void handleEvent(final Event event) { + if (event.widget instanceof Control) { + Control control = (Control) event.widget; + if (control.getShell() == StringMultiComposite.this.getParentControl() + .getShell()) { + if (event.widget != StringMultiComposite.this.getButton()) { + if (event.widget != StringMultiComposite.this.getText()) { + if (StringMultiComposite.this.getText().getEditable()) { + StringMultiComposite.this.commit(); + } else { + StringMultiComposite.this.close(); + } + } + } + } + } + } + }; + Display.getDefault().addFilter(SWT.MouseDown, clickListener); + + // this listener is only here to remove + // the other listener from the Display + this.text.addDisposeListener(new DisposeListener() { + public void widgetDisposed(final DisposeEvent e) { + Display.getDefault().removeFilter(SWT.MouseDown, clickListener); + } + }); + + this.text.addKeyListener(new KeyAdapter() { + @Override + public void keyPressed(final KeyEvent event) { + // Enter key pressed + if ((event.keyCode == SWT.CR && event.stateMask == 0) + || (event.keyCode == SWT.KEYPAD_CR && event.stateMask == 0)) { + if (StringMultiComposite.this.getText().getEditable()) { + StringMultiComposite.this.commit(); + } + } else if (event.keyCode == SWT.ESC && event.stateMask == 0) { + // Escape key pressed + close(); + } + } + }); + + this.text.addModifyListener(new ModifyListener() { + public void modifyText(final ModifyEvent e) { + fireChanged(); + } + }); + + this.text.forceFocus(); + } + + public StringMultiComposite(final Composite parent, final int style) { + this(parent, null, style); + } + + public StringMultiComposite(final Composite parent, final Object originalValue) { + this(parent, originalValue, SWT.NONE); + } + + protected void commit() { + fireCommit(); + } + + public void setValue(final String value) { + this.originalFieldValue = value; + if (value == null) { + this.text.setText(""); //$NON-NLS-1$ + } else { + // If the text contains a newline then edition is not possible, the user + // has to use the Dialog Editor + if (value.indexOf('\n') != -1) { + String truncatedValue = value.substring(0, value.indexOf('\n') - 1).concat("..."); //$NON-NLS-1$ + this.text.setText(truncatedValue); + this.text.setEditable(false); + } else { + this.text.setText(value); + this.text.setSelection(0, value.length()); + } + } + } + + public String getValue() { + if (this.text.getEditable()) { + return this.text.getText(); + } + return getOriginalFieldValue(); + } + + public Button getButton() { + return this.button; + } + + public Composite getParentControl() { + return this.parentControl; + } + + public String getOriginalFieldValue() { + return this.originalFieldValue; + } + + protected Text getText() { + return this.text; + } +}
diff --git a/org.eclipse.modisco.facet.widgets.celleditors.ecore/src/org/eclipse/modisco/facet/widgets/celleditors/ecore/composite/StringMultiCompositeFactory.java b/org.eclipse.modisco.facet.widgets.celleditors.ecore/src/org/eclipse/modisco/facet/widgets/celleditors/ecore/composite/StringMultiCompositeFactory.java new file mode 100644 index 0000000..f150d8f --- /dev/null +++ b/org.eclipse.modisco.facet.widgets.celleditors.ecore/src/org/eclipse/modisco/facet/widgets/celleditors/ecore/composite/StringMultiCompositeFactory.java
@@ -0,0 +1,29 @@ +/******************************************************************************* + * Copyright (c) 2011 Mia-Software. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Fabien Giquel (Mia-Software) - initial API and implementation + * Nicolas Guyomar (Mia-Software) - Bug 334546 - [celleditors] no border on Text field + * Nicolas Bros (Mia-Software) - Bug 338437 - compositeEditors extension point cannot be used to register user types + *******************************************************************************/ +package org.eclipse.modisco.facet.widgets.celleditors.ecore.composite; + +import org.eclipse.modisco.facet.widgets.celleditors.AbstractCellEditorComposite; +import org.eclipse.modisco.facet.widgets.celleditors.ICompositeEditorFactory; +import org.eclipse.swt.widgets.Composite; + +public class StringMultiCompositeFactory implements ICompositeEditorFactory<String> { + + public AbstractCellEditorComposite<String> createCompositeEditor(final Composite parent, final int style) { + return new StringMultiComposite<String>(parent, style); + } + + public Class<String> getHandledType() { + return String.class; + } + +}
diff --git a/org.eclipse.modisco.facet.widgets.celleditors.ecore/src/org/eclipse/emf/facet/widgets/celleditors/ecore/messages.properties b/org.eclipse.modisco.facet.widgets.celleditors.ecore/src/org/eclipse/modisco/facet/widgets/celleditors/ecore/messages.properties similarity index 100% rename from org.eclipse.modisco.facet.widgets.celleditors.ecore/src/org/eclipse/emf/facet/widgets/celleditors/ecore/messages.properties rename to org.eclipse.modisco.facet.widgets.celleditors.ecore/src/org/eclipse/modisco/facet/widgets/celleditors/ecore/messages.properties
diff --git a/org.eclipse.modisco.facet.widgets.celleditors.ecore/src/org/eclipse/modisco/facet/widgets/celleditors/ecore/ui/MultiLineDialog.java b/org.eclipse.modisco.facet.widgets.celleditors.ecore/src/org/eclipse/modisco/facet/widgets/celleditors/ecore/ui/MultiLineDialog.java new file mode 100644 index 0000000..9d59f5b --- /dev/null +++ b/org.eclipse.modisco.facet.widgets.celleditors.ecore/src/org/eclipse/modisco/facet/widgets/celleditors/ecore/ui/MultiLineDialog.java
@@ -0,0 +1,108 @@ +/***************************************************************************** + * Copyright (c) 2010 CEA LIST. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Nicolas Guyomar (Mia-Software) - initial API and implementation + *****************************************************************************/ +package org.eclipse.modisco.facet.widgets.celleditors.ecore.ui; + +import org.eclipse.jface.dialogs.Dialog; +import org.eclipse.jface.dialogs.IDialogConstants; +import org.eclipse.jface.dialogs.IDialogSettings; +import org.eclipse.modisco.facet.widgets.celleditors.ecore.Activator; +import org.eclipse.modisco.facet.widgets.celleditors.ecore.Messages; +import org.eclipse.swt.SWT; +import org.eclipse.swt.events.KeyAdapter; +import org.eclipse.swt.events.KeyEvent; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Control; +import org.eclipse.swt.widgets.Shell; +import org.eclipse.swt.widgets.Text; + +public class MultiLineDialog extends Dialog { + + private static final int DIALOG_WIDTH = 300; + private static final int DIALOG_HEIGHT = 200; + private String originalValue; + private Text textArea; + + public MultiLineDialog(final Shell parent, final Object originalValue) { + super(parent); + if (originalValue instanceof String) { + this.originalValue = (String) originalValue; + } + + } + + @Override + protected Control createDialogArea(final Composite parent) { + // create a composite with standard margins and spacing + Composite composite = new Composite(parent, SWT.NONE); + GridLayout layout = new GridLayout(); + layout.marginHeight = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN); + layout.marginWidth = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN); + layout.verticalSpacing = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING); + layout.horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING); + composite.setLayout(layout); + composite.setLayoutData(new GridData(GridData.FILL_BOTH)); + + this.textArea = new Text(composite, SWT.MULTI | SWT.V_SCROLL | SWT.H_SCROLL | SWT.BORDER); + if (this.originalValue != null) { + this.textArea.setText(this.originalValue); + } + this.textArea.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true)); + this.textArea.addKeyListener(new KeyAdapter() { + @Override + public void keyPressed(final KeyEvent e) { + if (e.keyCode == SWT.CR && e.stateMask == SWT.CTRL) { + okPressed(); + } + super.keyPressed(e); + } + }); + + applyDialogFont(composite); + return composite; + } + + @Override + protected void okPressed() { + super.okPressed(); + } + + @Override + protected boolean isResizable() { + return true; + } + + @Override + protected void configureShell(final Shell newShell) { + super.configureShell(newShell); + newShell.setText(Messages.MultiLineDialog_enterAValue); + } + + protected Text getTextArea() { + return this.textArea; + } + + @Override + protected IDialogSettings getDialogBoundsSettings() { + final String sectionName = this.getClass().getName() + ".settings"; //$NON-NLS-1$ + IDialogSettings settings = Activator.getDefault().getDialogSettings(); + IDialogSettings section = settings.getSection(sectionName); + if (section == null) { + section = settings.addNewSection(sectionName); + // cf Dialog#DIALOG_WIDTH + section.put("DIALOG_WIDTH", MultiLineDialog.DIALOG_WIDTH); //$NON-NLS-1$ + section.put("DIALOG_HEIGHT", MultiLineDialog.DIALOG_HEIGHT); //$NON-NLS-1$ + } + return section; + } +}
diff --git a/org.eclipse.modisco.facet.widgets.celleditors/META-INF/MANIFEST.MF b/org.eclipse.modisco.facet.widgets.celleditors/META-INF/MANIFEST.MF index 4392d76..37ea189 100644 --- a/org.eclipse.modisco.facet.widgets.celleditors/META-INF/MANIFEST.MF +++ b/org.eclipse.modisco.facet.widgets.celleditors/META-INF/MANIFEST.MF
@@ -22,16 +22,16 @@ org.eclipse.emf.facet.util.emf.ui;bundle-version="0.2.0", org.eclipse.emf.facet.util.swt;bundle-version="0.4.0" Bundle-ActivationPolicy: lazy -Export-Package: org.eclipse.emf.facet.widgets.celleditors, - org.eclipse.emf.facet.widgets.celleditors.core.composite.registry, - org.eclipse.emf.facet.widgets.celleditors.internal;x-friends:="org.eclipse.emf.facet.widgets.nattable", - org.eclipse.emf.facet.widgets.celleditors.internal.composite.registries;x-internal:=true, - org.eclipse.emf.facet.widgets.celleditors.internal.core;x-friends:="org.eclipse.emf.facet.widgets.nattable", - org.eclipse.emf.facet.widgets.celleditors.internal.core.composite;x-internal:=true, - org.eclipse.emf.facet.widgets.celleditors.internal.core.composite.factories;x-internal:=true, - org.eclipse.emf.facet.widgets.celleditors.internal.ui;x-internal:=true, - org.eclipse.emf.facet.widgets.celleditors.modelCellEditor, - org.eclipse.emf.facet.widgets.celleditors.modelCellEditor.impl;x-internal:=true, - org.eclipse.emf.facet.widgets.celleditors.modelCellEditor.util;x-friends:="org.eclipse.emf.facet.widgets.celleditors.edit" -Bundle-Activator: org.eclipse.emf.facet.widgets.celleditors.internal.Activator +Export-Package: org.eclipse.modisco.facet.widgets.celleditors, + org.eclipse.modisco.facet.widgets.celleditors.core.composite.registry, + org.eclipse.modisco.facet.widgets.celleditors.internal;x-friends:="org.eclipse.emf.facet.widgets.nattable", + org.eclipse.modisco.facet.widgets.celleditors.internal.composite.registries;x-internal:=true, + org.eclipse.modisco.facet.widgets.celleditors.internal.core;x-friends:="org.eclipse.emf.facet.widgets.nattable", + org.eclipse.modisco.facet.widgets.celleditors.internal.core.composite;x-internal:=true, + org.eclipse.modisco.facet.widgets.celleditors.internal.core.composite.factories;x-internal:=true, + org.eclipse.modisco.facet.widgets.celleditors.internal.ui;x-internal:=true, + org.eclipse.modisco.facet.widgets.celleditors.modelCellEditor, + org.eclipse.modisco.facet.widgets.celleditors.modelCellEditor.impl;x-internal:=true, + org.eclipse.modisco.facet.widgets.celleditors.modelCellEditor.util;x-friends:="org.eclipse.emf.facet.widgets.celleditors.edit" +Bundle-Activator: org.eclipse.modisco.facet.widgets.celleditors.internal.Activator Automatic-Module-Name: org.eclipse.emf.facet.widgets.celleditors
diff --git a/org.eclipse.modisco.facet.widgets.celleditors/plugin.xml b/org.eclipse.modisco.facet.widgets.celleditors/plugin.xml index 24f0bfc..ef93dd4 100644 --- a/org.eclipse.modisco.facet.widgets.celleditors/plugin.xml +++ b/org.eclipse.modisco.facet.widgets.celleditors/plugin.xml
@@ -23,7 +23,7 @@ <extension point="org.eclipse.emf.ecore.generated_package"> <package uri="http://www.eclipse.org/EMF_Facet/ModelCellEditor/0.1.0/modelCellEditor" - class="org.eclipse.emf.facet.widgets.celleditors.modelCellEditor.ModelCellEditorPackage" + class="org.eclipse.modisco.facet.widgets.celleditors.modelCellEditor.ModelCellEditorPackage" genModel="model/celleditors.genmodel"/> </extension>
diff --git a/org.eclipse.modisco.facet.widgets.celleditors/src/org/eclipse/emf/facet/widgets/celleditors/AbstractCellEditorComposite.java b/org.eclipse.modisco.facet.widgets.celleditors/src/org/eclipse/emf/facet/widgets/celleditors/AbstractCellEditorComposite.java deleted file mode 100644 index aa5cb9e..0000000 --- a/org.eclipse.modisco.facet.widgets.celleditors/src/org/eclipse/emf/facet/widgets/celleditors/AbstractCellEditorComposite.java +++ /dev/null
@@ -1,113 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2010 CEA LIST. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Nicolas Guyomar (Mia-Software) - initial API and implementation - * Nicolas Guyomar (Mia-Software) - Bug 334546 - [celleditors] no border on Text field - * Gregoire Dupe (Mia-Software) - Bug 339998 - public methods of AbstractCellEditorComposite have to be protected - * Nicolas Bros (Mia-Software) - Bug 334539 - [celleditors] change listener - *****************************************************************************/ -package org.eclipse.emf.facet.widgets.celleditors; - -import java.util.ArrayList; -import java.util.List; - -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.Status; -import org.eclipse.swt.SWT; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Event; -import org.eclipse.swt.widgets.Listener; - -public abstract class AbstractCellEditorComposite<T> extends Composite implements IWidget2<T> { - - private final List<IListener> commitListeners; - private final List<IListener> changeListeners; - @Deprecated - private final List<Listener> compatibilityCommitListeners; - private final IValidator defaultValidator = new IValidator() { - public IStatus validate(final Object object) { - return Status.OK_STATUS; - } - }; - - public AbstractCellEditorComposite(final Composite parent) { - this(parent, SWT.NONE); - } - - @SuppressWarnings("deprecation") /* backwards-compatibility */ - public AbstractCellEditorComposite(final Composite parent, final int style) { - super(parent, style); - this.compatibilityCommitListeners = new ArrayList<Listener>(); - this.commitListeners = new ArrayList<IListener>(); - this.changeListeners = new ArrayList<IListener>(); - } - - public void addCommitListener(final IListener listener) { - synchronized (this.commitListeners) { - if (!this.commitListeners.contains(listener)) { - this.commitListeners.add(listener); - } - } - } - - public void removeCommitListener(final IListener listener) { - synchronized (this.commitListeners) { - this.commitListeners.remove(listener); - } - } - - @SuppressWarnings("deprecation") /* backwards-compatibility */ - protected final void fireCommit() { - synchronized (this.compatibilityCommitListeners) { - for (Listener commitListener : new ArrayList<Listener>( - this.compatibilityCommitListeners)) { - commitListener.handleEvent(new Event()); - } - } - synchronized (this.commitListeners) { - for (IListener commitListener : new ArrayList<IListener>(this.commitListeners)) { - commitListener.handleEvent(); - } - } - } - - public void addChangeListener(final IListener listener) { - synchronized (this.changeListeners) { - if (!this.changeListeners.contains(listener)) { - this.changeListeners.add(listener); - } - } - } - - public void removeChangeListener(final IListener listener) { - synchronized (this.changeListeners) { - this.changeListeners.remove(listener); - } - } - - protected final void fireChanged() { - synchronized (this.changeListeners) { - for (IListener changeListener : new ArrayList<IListener>(this.changeListeners)) { - changeListener.handleEvent(); - } - } - } - - public IValidator getValidator() { - // always valid by default - return this.defaultValidator; - } - - protected final void close() { - if (!isDisposed()) { - getParent().forceFocus(); - dispose(); - } - } -}
diff --git a/org.eclipse.modisco.facet.widgets.celleditors/src/org/eclipse/emf/facet/widgets/celleditors/CellEditorsUtils.java b/org.eclipse.modisco.facet.widgets.celleditors/src/org/eclipse/emf/facet/widgets/celleditors/CellEditorsUtils.java deleted file mode 100644 index a2f230d..0000000 --- a/org.eclipse.modisco.facet.widgets.celleditors/src/org/eclipse/emf/facet/widgets/celleditors/CellEditorsUtils.java +++ /dev/null
@@ -1,65 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2011 CEA LIST. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Vincent Lorenzo (CEA-LIST) - Bug 351931 - Use local cell editor in table - * Gregoire Dupe (Mia-Software) - Bug 351931 - Use local cell editor in table - */ - package org.eclipse.emf.facet.widgets.celleditors; - -import java.util.Iterator; -import java.util.List; - -import org.eclipse.emf.common.util.URI; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.resource.Resource; -import org.eclipse.emf.ecore.resource.ResourceSet; -import org.eclipse.emf.facet.widgets.celleditors.modelCellEditor.AbstractModelCellEditor; -import org.eclipse.emf.facet.widgets.celleditors.modelCellEditor.ModelCellEditorDeclarations; - -/** - * @since 0.1.1 - * @author gdupe - * - */ -public final class CellEditorsUtils { - - private static final String FILE_EXTENSION = "modelcelleditors"; //$NON-NLS-1$ - - private CellEditorsUtils() { - // This is an utility class which must not be instantiated - } - - /** - * This method allows to find the bundle name for an editor - * - * @param editor - * an editor - * @return the bundle name for this editor - */ - public static String getBundleNameFor(final AbstractModelCellEditor editor, final ResourceSet resourceSet) { - for (Resource ressource : resourceSet.getResources()) { - if (CellEditorsUtils.FILE_EXTENSION.equals(ressource.getURI().fileExtension())) { - Iterator<EObject> allContents = ressource.getContents().iterator(); - while (allContents.hasNext()) { - EObject currentContent = allContents.next(); - if (currentContent instanceof ModelCellEditorDeclarations) { - if (((ModelCellEditorDeclarations) currentContent).getModelCellEditors() - .contains(editor)) { - URI uri = ressource.getURI(); - if (uri.isPlatformPlugin()) { - List<String> list = uri.segmentsList(); - return list.get(1); - } - } - } - } - } - } - - return null; - } -}
diff --git a/org.eclipse.modisco.facet.widgets.celleditors/src/org/eclipse/emf/facet/widgets/celleditors/ICellEditorsRegistry.java b/org.eclipse.modisco.facet.widgets.celleditors/src/org/eclipse/emf/facet/widgets/celleditors/ICellEditorsRegistry.java deleted file mode 100644 index 7feec2e..0000000 --- a/org.eclipse.modisco.facet.widgets.celleditors/src/org/eclipse/emf/facet/widgets/celleditors/ICellEditorsRegistry.java +++ /dev/null
@@ -1,84 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2011 Mia-Software. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Nicolas Guyomar (Mia-Software) - Bug 339554 - org.eclipse.emf.facet.widgets.celleditors API cleaning - * Nicolas Bros (Mia-Software) - Bug 339855 - ModelCellEditor class should not be exposed - *******************************************************************************/ -package org.eclipse.emf.facet.widgets.celleditors; - -import java.util.List; - -import org.eclipse.emf.ecore.EClassifier; -import org.eclipse.emf.facet.widgets.celleditors.internal.CellEditorsRegistry; -import org.eclipse.emf.facet.widgets.celleditors.modelCellEditor.AbstractModelCellEditor; - -/** - * Registry for the "celleditors" extension point - * @noextend This interface is not intended to be extended by clients. - * @noimplement This interface is not intended to be implemented by clients. - */ -public interface ICellEditorsRegistry { - - static ICellEditorsRegistry INSTANCE = new CellEditorsRegistry(); - - List<IModelCellEditorContainer<? extends AbstractModelCellEditor>> getAllCellEditors(); - - /** - * Returns a cell editor to edit a single value of the given type, or <code>null</code> if none - * was found. Custom cell editors override the default ones (from - * "org.eclipse.emf.facet.widgets.celleditors"). - * - * @param type - * the type for which to get a cell editor - * @return the cell editor or <code>null</code> if none was found for the given type - */ - IModelCellEditor getCellEditorFor(EClassifier type); - - /** - * Returns a cell editor to edit a list of values of the given type, or <code>null</code> if - * none was found. Custom cell editors override the default ones (from - * "org.eclipse.emf.facet.widgets.celleditors"). - * - * @param type - * the type for which to get a cell editor - * @return the cell editor or <code>null</code> if none was found for the given type - */ - INaryFeatureCellEditor getNaryCellEditorFor(EClassifier type); - - /** - * Returns a cell editor to edit a single value of the given type, or <code>null</code> if none - * was found. Custom cell editors override the default ones (from - * "org.eclipse.emf.facet.widgets.celleditors"). - * - * @param type - * the type for which to get a cell editor - * @param preferredCellEditors - * the cell editors that should be chosen in case of conflicts (several cell editors - * defined for the same type) - * @return the cell editor or <code>null</code> if none was found for the given type - */ - IModelCellEditor getCellEditorFor(EClassifier type, - List<AbstractModelCellEditor> preferredCellEditors); - - /** - * Returns a cell editor to edit a list of values of the given type, or <code>null</code> if - * none was found. Custom cell editors override the default ones (from - * "org.eclipse.emf.facet.widgets.celleditors"). - * - * @param type - * the type for which to get a cell editor - * @param preferredCellEditors - * the cell editors that should be chosen in case of conflicts (several cell editors - * defined for the same type) - * @return the cell editor or <code>null</code> if none was found for the given type - */ - INaryFeatureCellEditor getNaryCellEditorFor(EClassifier type, - List<AbstractModelCellEditor> preferredCellEditors); - -} \ No newline at end of file
diff --git a/org.eclipse.modisco.facet.widgets.celleditors/src/org/eclipse/emf/facet/widgets/celleditors/ICommandFactoriesRegistry.java b/org.eclipse.modisco.facet.widgets.celleditors/src/org/eclipse/emf/facet/widgets/celleditors/ICommandFactoriesRegistry.java deleted file mode 100644 index 6011852..0000000 --- a/org.eclipse.modisco.facet.widgets.celleditors/src/org/eclipse/emf/facet/widgets/celleditors/ICommandFactoriesRegistry.java +++ /dev/null
@@ -1,42 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2011 Mia-Software. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Nicolas Guyomar (Mia-Software) - Bug 339554 - org.eclipse.emf.facet.widgets.celleditors API cleaning - *******************************************************************************/ -package org.eclipse.emf.facet.widgets.celleditors; - -import java.util.List; - -import org.eclipse.emf.common.command.Command; -import org.eclipse.emf.edit.domain.EditingDomain; -import org.eclipse.emf.facet.widgets.celleditors.internal.CommandFactoriesRegistry; - -/** - * Registry for the "commandFactories" extension point. It is used to create EMF {@link Command}s - * compatible with a given {@link EditingDomain}. - * <p> - * For example, a <code>TransactionalEditingDomain</code> doesn't work with the usual EMF commands, - * and the model must be manipulated with {@link Command}s that use transactions. - * @noimplement This interface is not intended to be implemented by clients. - * @noextend This interface is not intended to be extended by clients. - */ -public interface ICommandFactoriesRegistry { - - /** the singleton {@link ICommandFactoriesRegistry} */ - static ICommandFactoriesRegistry INSTANCE = new CommandFactoriesRegistry(); - - /** @return the list of registered command factories */ - List<ICommandFactory> getCommandFactories(); - - /** - * @return a command factory compatible with the given {@link EditingDomain}, or - * <code>null</code> if none is found - */ - ICommandFactory getCommandFactoryFor(final EditingDomain editingDomain); -} \ No newline at end of file
diff --git a/org.eclipse.modisco.facet.widgets.celleditors/src/org/eclipse/emf/facet/widgets/celleditors/ICommandFactory.java b/org.eclipse.modisco.facet.widgets.celleditors/src/org/eclipse/emf/facet/widgets/celleditors/ICommandFactory.java deleted file mode 100644 index 2cde827..0000000 --- a/org.eclipse.modisco.facet.widgets.celleditors/src/org/eclipse/emf/facet/widgets/celleditors/ICommandFactory.java +++ /dev/null
@@ -1,30 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 CEA LIST. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Nicolas Bros (Mia-Software) - initial API and implementation - * Gregoire Dupe (Mia-Software) - Bug 369987 - [Restructuring][Table] Switch to the new customization and facet framework - *******************************************************************************/ -package org.eclipse.emf.facet.widgets.celleditors; - -import org.eclipse.emf.common.command.Command; -import org.eclipse.emf.edit.domain.EditingDomain; - -/** - * Creates {@link Command}s for a specific {@link EditingDomain}. - * <p> - * See also {@link ICommandFactoriesRegistry} - */ -public interface ICommandFactory extends - org.eclipse.emf.facet.util.emf.core.internal.exported.ICommandFactory { - - // The content of this interface ha been moved to - // org.eclipse.emf.facet.util.emf.core.internal.exported.ICommandFactory to - // solve a cyclic - // dependency issue (with the plug-in org.eclipse.emf.facet.custom.ui) -}
diff --git a/org.eclipse.modisco.facet.widgets.celleditors/src/org/eclipse/emf/facet/widgets/celleditors/ICompositeEditorFactory.java b/org.eclipse.modisco.facet.widgets.celleditors/src/org/eclipse/emf/facet/widgets/celleditors/ICompositeEditorFactory.java deleted file mode 100644 index 10abebb..0000000 --- a/org.eclipse.modisco.facet.widgets.celleditors/src/org/eclipse/emf/facet/widgets/celleditors/ICompositeEditorFactory.java +++ /dev/null
@@ -1,48 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2011 Mia-Software. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Fabien Giquel (Mia-Software) - initial API and implementation - * Nicolas Guyomar (Mia-Software) - Bug 334546 - [celleditors] no border on Text field - * Nicolas Bros (Mia-Software) - Bug 338437 - compositeEditors extension point cannot be used to register user types - *******************************************************************************/ -package org.eclipse.emf.facet.widgets.celleditors; - -import org.eclipse.swt.SWT; -import org.eclipse.swt.widgets.Composite; - -/** - * The factory interface for creating some control - * {@link AbstractCellEditorComposite} dedicated to the edition of one java - * type. The developer should register some factories using the dedicated - * extension point "compositeEditors" - * - * @param <T> - * the java type managed by this composite editor factory. - */ -public interface ICompositeEditorFactory<T> { - - /** - * @return the type handled by the composite editors created by this factory. This method is - * required because of type erasure with Java generics. - */ - Class<T> getHandledType(); - - /** - * Create a cell editor composite for a value of type <T>, as a subclass of - * {@link AbstractCellEditorComposite}, which is a SWT {@link Composite} suited for use as an - * in-place editor for values of type <T>. - * - * @param parent - * the SWT parent of the new composite - * @param style - * SWT style bits ({@link SWT#BORDER}, etc.) - * @return the new cell editor composite - */ - AbstractCellEditorComposite<T> createCompositeEditor(Composite parent, int style); - -}
diff --git a/org.eclipse.modisco.facet.widgets.celleditors/src/org/eclipse/emf/facet/widgets/celleditors/IListener.java b/org.eclipse.modisco.facet.widgets.celleditors/src/org/eclipse/emf/facet/widgets/celleditors/IListener.java deleted file mode 100644 index ac9f27b..0000000 --- a/org.eclipse.modisco.facet.widgets.celleditors/src/org/eclipse/emf/facet/widgets/celleditors/IListener.java +++ /dev/null
@@ -1,16 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2011 Mia-Software. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Nicolas Bros (Mia-Software) - Bug 334539 - [celleditors] change listener - *******************************************************************************/ -package org.eclipse.emf.facet.widgets.celleditors; - -public interface IListener { - /** Sent when an event that the receiver has registered for occurs. */ - void handleEvent(); -}
diff --git a/org.eclipse.modisco.facet.widgets.celleditors/src/org/eclipse/emf/facet/widgets/celleditors/IModelCellEditHandler.java b/org.eclipse.modisco.facet.widgets.celleditors/src/org/eclipse/emf/facet/widgets/celleditors/IModelCellEditHandler.java deleted file mode 100644 index f859bf5..0000000 --- a/org.eclipse.modisco.facet.widgets.celleditors/src/org/eclipse/emf/facet/widgets/celleditors/IModelCellEditHandler.java +++ /dev/null
@@ -1,21 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 CEA LIST. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Nicolas Bros (Mia-Software) - initial API and implementation - *******************************************************************************/ -package org.eclipse.emf.facet.widgets.celleditors; - -public interface IModelCellEditHandler { - /** - * Commit the value currently in the cell editor. This will get the value - * through {@link IModelCellEditor#getValue()} and set it on the model - * element under the cell. - */ - void commit(); -}
diff --git a/org.eclipse.modisco.facet.widgets.celleditors/src/org/eclipse/emf/facet/widgets/celleditors/IModelCellEditor.java b/org.eclipse.modisco.facet.widgets.celleditors/src/org/eclipse/emf/facet/widgets/celleditors/IModelCellEditor.java deleted file mode 100644 index 58b8099..0000000 --- a/org.eclipse.modisco.facet.widgets.celleditors/src/org/eclipse/emf/facet/widgets/celleditors/IModelCellEditor.java +++ /dev/null
@@ -1,51 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 CEA LIST. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Nicolas Bros (Mia-Software) - initial API and implementation - *******************************************************************************/ -package org.eclipse.emf.facet.widgets.celleditors; - -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.EStructuralFeature; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Control; - -public interface IModelCellEditor { - - /** - * Initialize a cell for edition. This method must create a control inside - * the given parent to let the user edit the value. - * - * @param parent - * the SWT control that must contain the cell editor - * @param originalValue - * the original value of the cell being edited (that should be - * displayed in the control initially) - * @param editHandler - * call {@link IModelCellEditHandler#commit()} when the user - * "commits" the value (for example by hitting enter in a text - * cell editor) - * @param feature - * the model feature for which the value is edited - * @param source - * the object containing the attribute or reference - * - * @return the SWT {@link Control} to be used for capturing the new cell - * value - */ - Control activateCell(Composite parent, Object originalValue, IModelCellEditHandler editHandler, - EStructuralFeature feature, EObject source); - - /** - * @return the value currently in the control. This is the value that will - * be set on the model element when - * {@link IModelCellEditHandler#commit()} is called. - */ - Object getValue(); -}
diff --git a/org.eclipse.modisco.facet.widgets.celleditors/src/org/eclipse/emf/facet/widgets/celleditors/IModelCellEditorContainer.java b/org.eclipse.modisco.facet.widgets.celleditors/src/org/eclipse/emf/facet/widgets/celleditors/IModelCellEditorContainer.java deleted file mode 100644 index f811084..0000000 --- a/org.eclipse.modisco.facet.widgets.celleditors/src/org/eclipse/emf/facet/widgets/celleditors/IModelCellEditorContainer.java +++ /dev/null
@@ -1,25 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2011 Mia-Software. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Nicolas Guyomar (Mia-Software) - Bug 339554 - org.eclipse.emf.facet.widgets.celleditors API cleaning - *******************************************************************************/ -package org.eclipse.emf.facet.widgets.celleditors; - -import org.eclipse.emf.facet.widgets.celleditors.modelCellEditor.AbstractModelCellEditor; - -public interface IModelCellEditorContainer<T extends AbstractModelCellEditor> { - - public String getBundleName(); - - public void setBundleName(String bundleName); - - public AbstractModelCellEditor getModelCellEditor(); - - public void setModelCellEditor(AbstractModelCellEditor modelCellEditor); -}
diff --git a/org.eclipse.modisco.facet.widgets.celleditors/src/org/eclipse/emf/facet/widgets/celleditors/IModelCellEditorValidator.java b/org.eclipse.modisco.facet.widgets.celleditors/src/org/eclipse/emf/facet/widgets/celleditors/IModelCellEditorValidator.java deleted file mode 100644 index 94fc4b5..0000000 --- a/org.eclipse.modisco.facet.widgets.celleditors/src/org/eclipse/emf/facet/widgets/celleditors/IModelCellEditorValidator.java +++ /dev/null
@@ -1,18 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 CEA LIST. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Nicolas Bros (Mia-Software) - initial API and implementation - *******************************************************************************/ -package org.eclipse.emf.facet.widgets.celleditors; - -/** Allows validating a cell editor's value before it is committed */ -public interface IModelCellEditorValidator { - /** @return whether the given value is valid for this cell editor */ - boolean isValid(Object newValue); -}
diff --git a/org.eclipse.modisco.facet.widgets.celleditors/src/org/eclipse/emf/facet/widgets/celleditors/INaryEAttributeCellEditor.java b/org.eclipse.modisco.facet.widgets.celleditors/src/org/eclipse/emf/facet/widgets/celleditors/INaryEAttributeCellEditor.java deleted file mode 100644 index 15d6ca3..0000000 --- a/org.eclipse.modisco.facet.widgets.celleditors/src/org/eclipse/emf/facet/widgets/celleditors/INaryEAttributeCellEditor.java +++ /dev/null
@@ -1,47 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2011 CEA LIST. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Nicolas Guyomar (Mia-Software) - Bug 342451 - To be able to edit derived facet attributes and derived facet references in a table - *******************************************************************************/ -package org.eclipse.emf.facet.widgets.celleditors; - -import java.util.List; - -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.EStructuralFeature; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Control; - -public interface INaryEAttributeCellEditor<T extends Object> { - - /** - * Initialize a cell for edition of a n-ary feature. This method must create - * a control inside the given parent to let the user edit the value. - * - * @param parent - * the SWT control that must contain the cell editor - * @param values - * the actual values of the reference - * @param feature - * the feature - * @param eObject - * the {@link EObject} being currently edited. - * @param editHandler - * @return the SWT {@link Control} to be used for capturing the new cell - * value - */ - Control activateCell(Composite parent, List<T> values, IModelCellEditHandler editHandler, EObject eObject, EStructuralFeature feature); - - /** - * @return the value currently in the control. This is the value that will - * be set on the model element when - * {@link IModelCellEditHandler#commit()} is called. - */ - List<T> getValue(); -}
diff --git a/org.eclipse.modisco.facet.widgets.celleditors/src/org/eclipse/emf/facet/widgets/celleditors/INaryEReferenceCellEditor.java b/org.eclipse.modisco.facet.widgets.celleditors/src/org/eclipse/emf/facet/widgets/celleditors/INaryEReferenceCellEditor.java deleted file mode 100644 index 3aa014a..0000000 --- a/org.eclipse.modisco.facet.widgets.celleditors/src/org/eclipse/emf/facet/widgets/celleditors/INaryEReferenceCellEditor.java +++ /dev/null
@@ -1,62 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2011 CEA LIST. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Nicolas Guyomar (Mia-Software) - Bug 342451 - To be able to edit derived facet attributes and derived facet references in a table - *******************************************************************************/ -package org.eclipse.emf.facet.widgets.celleditors; - -import java.util.List; - -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.EStructuralFeature; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Control; - -public interface INaryEReferenceCellEditor<T extends EObject> { - - /** - * Initialize a cell for edition of a n-ary feature. This method must create - * a control inside the given parent to let the user edit the value. - * - * @param parent - * the SWT control that must contain the cell editor - * @param values - * the actual values of the reference - * @param availableValues - * the available value for the reference - * @param feature - * the feature - * @param eObject - * the {@link EObject} being currently edited. - * @param editHandler - * @return the SWT {@link Control} to be used for capturing the new cell - * value - */ - Control activateCell(Composite parent, List<T> values, List<T> availableValues, IModelCellEditHandler editHandler, EObject eObject, EStructuralFeature feature); - - /* - * Both lists are given here because in some case, we cannot calculate the the available - * element, for instance when editing FacetReference, we need to have the FacetContext deal with - * it. - * - * The EStructuralFeature is given here so that in the dialog we can know whether it is a - * containment one, which has an impact on the edition. It is also needed to instantiate new - * element, because we need to know its eType. - * - * The EObject is only here for dialog customization for instance. Do not modify it in the - * dialog, the dialog has to return the new values. - */ - - /** - * @return the value currently in the control. This is the value that will - * be set on the model element when - * {@link IModelCellEditHandler#commit()} is called. - */ - List<T> getValue(); -}
diff --git a/org.eclipse.modisco.facet.widgets.celleditors/src/org/eclipse/emf/facet/widgets/celleditors/INaryFeatureCellEditor.java b/org.eclipse.modisco.facet.widgets.celleditors/src/org/eclipse/emf/facet/widgets/celleditors/INaryFeatureCellEditor.java deleted file mode 100644 index df38972..0000000 --- a/org.eclipse.modisco.facet.widgets.celleditors/src/org/eclipse/emf/facet/widgets/celleditors/INaryFeatureCellEditor.java +++ /dev/null
@@ -1,41 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 CEA LIST. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Nicolas Bros (Mia-Software) - initial API and implementation - *******************************************************************************/ -package org.eclipse.emf.facet.widgets.celleditors; - -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.EStructuralFeature; -import org.eclipse.emf.edit.domain.EditingDomain; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Control; - -public interface INaryFeatureCellEditor { - - /** - * Initialize a cell for edition of a n-ary feature. This method must create - * a control inside the given parent to let the user edit the value. - * - * @param parent - * the SWT control that must contain the cell editor - * @param feature - * the model feature for which the value is edited - * @param source - * the object containing the attribute or reference - * @param editingDomain - * the source {@link EObject} must be edited only through this - * {@link EditingDomain} - * - * @return the SWT {@link Control} to be used for capturing the new cell - * value - */ - Control activateCell(Composite parent, EStructuralFeature feature, EObject source, - EditingDomain editingDomain); -}
diff --git a/org.eclipse.modisco.facet.widgets.celleditors/src/org/eclipse/emf/facet/widgets/celleditors/IValidator.java b/org.eclipse.modisco.facet.widgets.celleditors/src/org/eclipse/emf/facet/widgets/celleditors/IValidator.java deleted file mode 100644 index 2df5e4e..0000000 --- a/org.eclipse.modisco.facet.widgets.celleditors/src/org/eclipse/emf/facet/widgets/celleditors/IValidator.java +++ /dev/null
@@ -1,25 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2010 CEA LIST. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Gregoire Dupe (Mia-Software) - initial API and implementation - *****************************************************************************/ -package org.eclipse.emf.facet.widgets.celleditors; - -import org.eclipse.core.runtime.IStatus; - -/** Used to validate the value of a cell editor. */ -public interface IValidator { - /** - * Validates the given value for the cell editor. - * - * @return an {@link IStatus} with a status of {@link IStatus#OK} if the given value is valid, - * or with a status of {@link IStatus#ERROR} otherwise. - */ - IStatus validate(Object value); -}
diff --git a/org.eclipse.modisco.facet.widgets.celleditors/src/org/eclipse/emf/facet/widgets/celleditors/IWidget2.java b/org.eclipse.modisco.facet.widgets.celleditors/src/org/eclipse/emf/facet/widgets/celleditors/IWidget2.java deleted file mode 100644 index 0a0a3b7..0000000 --- a/org.eclipse.modisco.facet.widgets.celleditors/src/org/eclipse/emf/facet/widgets/celleditors/IWidget2.java +++ /dev/null
@@ -1,43 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2010 CEA LIST. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Nicolas Guyomar (Mia-Software) - initial API and implementation - * Nicolas Bros (Mia-Software) - * Nicolas Bros (Mia-Software) - Bug 334539 - [celleditors] change listener - *****************************************************************************/ -package org.eclipse.emf.facet.widgets.celleditors; - -import org.eclipse.swt.widgets.Composite; - -/** Implemented by {@link Composite}s that are encapsulated in {@link IModelCellEditor cell editors} */ -public interface IWidget2<T extends Object> { - /** @return the validator used to determine whether an entered value is accepted */ - IValidator getValidator(); - - /** - * Add a listener that is notified when the value in the widget is "committed". That is, when - * the user hits Enter or clicks outside the widget. - */ - void addCommitListener(IListener listener); - - /** Remove an existing commit listener */ - void removeCommitListener(IListener listener); - - /** Add a listener for changes to the value */ - void addChangeListener(IListener listener); - - /** Remove an existing change listener */ - void removeChangeListener(IListener listener); - - /** Set the given value in the widget */ - void setValue(final T value); - - /** Get the value from the widget */ - T getValue(); -}
diff --git a/org.eclipse.modisco.facet.widgets.celleditors/src/org/eclipse/emf/facet/widgets/celleditors/core/composite/registry/ICompositeEditorFactoriesRegistry.java b/org.eclipse.modisco.facet.widgets.celleditors/src/org/eclipse/emf/facet/widgets/celleditors/core/composite/registry/ICompositeEditorFactoriesRegistry.java deleted file mode 100644 index bdfa976..0000000 --- a/org.eclipse.modisco.facet.widgets.celleditors/src/org/eclipse/emf/facet/widgets/celleditors/core/composite/registry/ICompositeEditorFactoriesRegistry.java +++ /dev/null
@@ -1,36 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2011 Mia-Software. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Nicolas Guyomar (Mia-Software) - Bug 339554 - org.eclipse.emf.facet.widgets.celleditors API cleaning - *******************************************************************************/ -package org.eclipse.emf.facet.widgets.celleditors.core.composite.registry; - -import org.eclipse.emf.facet.widgets.celleditors.ICompositeEditorFactory; -import org.eclipse.emf.facet.widgets.celleditors.internal.composite.registries.CompositeEditorFactoriesRegistry; - -/** - * Registry for the "compositeEditorFactories" extension point - * @noimplement This interface is not intended to be implemented by clients. - * @noextend This interface is not intended to be extended by clients. - * @since 1.0 - */ -public interface ICompositeEditorFactoriesRegistry { - - /** the singleton {@link ICompositeEditorFactoriesRegistry} */ - ICompositeEditorFactoriesRegistry INSTANCE = new CompositeEditorFactoriesRegistry(); - - /** Whether there is a {@link CompositeEditorFactory} for the given type */ - boolean hasCompositeEditorFactory(final Class<?> type); - - /** - * @return the {@link CompositeEditorFactory} for the given type, or <code>null</code> if none is - * registered - */ - <T> ICompositeEditorFactory<T> getCompositeEditorFactory(final Class<T> type); - -}
diff --git a/org.eclipse.modisco.facet.widgets.celleditors/src/org/eclipse/emf/facet/widgets/celleditors/internal/Activator.java b/org.eclipse.modisco.facet.widgets.celleditors/src/org/eclipse/emf/facet/widgets/celleditors/internal/Activator.java deleted file mode 100644 index 1b205bc..0000000 --- a/org.eclipse.modisco.facet.widgets.celleditors/src/org/eclipse/emf/facet/widgets/celleditors/internal/Activator.java +++ /dev/null
@@ -1,69 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2010 CEA LIST. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Nicolas Guyomar (Mia-Software) - initial API and implementation - * Nicolas Bros (Mia-Software) - Bug 339664 - org.eclipse.emf.facet.widgets.celleditors API cleaning - *****************************************************************************/ -package org.eclipse.emf.facet.widgets.celleditors.internal; - -import org.eclipse.ui.plugin.AbstractUIPlugin; -import org.osgi.framework.BundleContext; - -/** - * The activator class controls the plug-in life cycle - */ -public class Activator extends AbstractUIPlugin { - // The plug-in ID - public static final String PLUGIN_ID = "org.eclipse.emf.facet.widgets.celleditors"; //$NON-NLS-1$ - - // The shared instance - private static Activator plugin; - - /** - * The constructor - */ - public Activator() { - } - - /* - * (non-Javadoc) - * - * @see - * org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext - * ) - */ - @Override - public void start(final BundleContext context) throws Exception { - super.start(context); - Activator.plugin = this; - } - - /* - * (non-Javadoc) - * - * @see - * org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext - * ) - */ - @Override - public void stop(final BundleContext context) throws Exception { - Activator.plugin = null; - super.stop(context); - } - - /** - * Returns the shared instance - * - * @return the shared instance - */ - public static Activator getDefault() { - return Activator.plugin; - } - -}
diff --git a/org.eclipse.modisco.facet.widgets.celleditors/src/org/eclipse/emf/facet/widgets/celleditors/internal/CellEditorsRegistry.java b/org.eclipse.modisco.facet.widgets.celleditors/src/org/eclipse/emf/facet/widgets/celleditors/internal/CellEditorsRegistry.java deleted file mode 100644 index be29546..0000000 --- a/org.eclipse.modisco.facet.widgets.celleditors/src/org/eclipse/emf/facet/widgets/celleditors/internal/CellEditorsRegistry.java +++ /dev/null
@@ -1,342 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 CEA LIST. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Nicolas Bros (Mia-Software) - initial API and implementation - * Nicolas Bros (Mia-Software) - Bug 338437 - compositeEditors extension point cannot be used to register user types - * Nicolas Guyomar (Mia-Software) - Bug 339554 - org.eclipse.emf.facet.widgets.celleditors API cleaning - * Nicolas Bros (Mia-Software) - Bug 339855 - ModelCellEditor class should not be exposed - * Gregoire Dupe (Mia-Software) - Bug 369987 - [Restructuring][Table] Switch to the new customization and facet framework - *******************************************************************************/ -package org.eclipse.emf.facet.widgets.celleditors.internal; - -import java.util.ArrayList; -import java.util.List; - -import org.eclipse.core.runtime.IConfigurationElement; -import org.eclipse.emf.common.util.EList; -import org.eclipse.emf.common.util.URI; -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.ecore.EClassifier; -import org.eclipse.emf.ecore.EDataType; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.EcorePackage; -import org.eclipse.emf.ecore.resource.Resource; -import org.eclipse.emf.ecore.resource.ResourceSet; -import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl; -import org.eclipse.emf.ecore.util.EcoreUtil; -import org.eclipse.emf.facet.util.core.Logger; -import org.eclipse.emf.facet.util.core.internal.exported.AbstractRegistry; -import org.eclipse.emf.facet.widgets.celleditors.ICellEditorsRegistry; -import org.eclipse.emf.facet.widgets.celleditors.IModelCellEditor; -import org.eclipse.emf.facet.widgets.celleditors.IModelCellEditorContainer; -import org.eclipse.emf.facet.widgets.celleditors.INaryFeatureCellEditor; -import org.eclipse.emf.facet.widgets.celleditors.modelCellEditor.AbstractModelCellEditor; -import org.eclipse.emf.facet.widgets.celleditors.modelCellEditor.BasicCellEditor; -import org.eclipse.emf.facet.widgets.celleditors.modelCellEditor.ModelCellEditorDeclarations; -import org.eclipse.emf.facet.widgets.celleditors.modelCellEditor.NaryFeatureCellEditor; -import org.eclipse.emf.facet.widgets.celleditors.modelCellEditor.UnaryReferenceCellEditor; - -/** Registry for the "loadingDepth" extension point */ -public class CellEditorsRegistry extends AbstractRegistry implements ICellEditorsRegistry { - - private static final String EXTENSION_POINT_NAMESPACE = "org.eclipse.emf.facet.widgets.celleditors"; //$NON-NLS-1$ - private static final String EXTENSION_POINT_NAME = "celleditors"; //$NON-NLS-1$ - - private static final String CELL_EDITORS_MODEL_ELEMENT = "cellEditorsModel"; //$NON-NLS-1$ - private static final String PATH_ATTRIBUTE = "path"; //$NON-NLS-1$ - - /** A list of basic cell editors */ - private final List<ModelCellEditorContainer<BasicCellEditor>> basicCellEditors = new ArrayList<ModelCellEditorContainer<BasicCellEditor>>(); - /** A list of unary reference cell editors */ - private final List<ModelCellEditorContainer<UnaryReferenceCellEditor>> unaryReferenceCellEditors = new ArrayList<ModelCellEditorContainer<UnaryReferenceCellEditor>>(); - /** A list of n-ary reference cell editors */ - private final List<ModelCellEditorContainer<NaryFeatureCellEditor>> naryFeatureCellEditors = new ArrayList<ModelCellEditorContainer<NaryFeatureCellEditor>>(); - - public CellEditorsRegistry() { - initialize(); - } - - public List<IModelCellEditorContainer<? extends AbstractModelCellEditor>> getAllCellEditors() { - List<IModelCellEditorContainer<? extends AbstractModelCellEditor>> allCellEditors = new ArrayList<IModelCellEditorContainer<? extends AbstractModelCellEditor>>(); - for (ModelCellEditorContainer<BasicCellEditor> basicCellEditor : this.basicCellEditors) { - allCellEditors.add(basicCellEditor); - } - for (ModelCellEditorContainer<UnaryReferenceCellEditor> unaryReferenceCellEditor : this.unaryReferenceCellEditors) { - allCellEditors.add(unaryReferenceCellEditor); - } - for (ModelCellEditorContainer<NaryFeatureCellEditor> naryReferenceCellEditor : this.naryFeatureCellEditors) { - allCellEditors.add(naryReferenceCellEditor); - } - return allCellEditors; - } - - /** - * Returns a cell editor wrapper for the given type, or <code>null</code> if none was found. - * Custom cell editors override the default ones (from - * "org.eclipse.emf.facet.widgets.celleditors"). - * - * @param type - * the type for which to get a cell editor wrapper - * @param many - * whether to get a cell editor to edit a single value or a list of values - * @return the cell editor wrapper or <code>null</code> if none was found for the given type - */ - public ModelCellEditor getCellEditorWrapperFor(final EClassifier type, final boolean many) { - return getCellEditorWrapperFor(type, many, null); - } - - /** - * Returns a cell editor to edit a single value of the given type, or <code>null</code> if none - * was found. Custom cell editors override the default ones (from - * "org.eclipse.emf.facet.widgets.celleditors"). - * - * @param type - * the type for which to get a cell editor - * @return the cell editor or <code>null</code> if none was found for the given type - */ - public IModelCellEditor getCellEditorFor(final EClassifier type) { - ModelCellEditor cellEditorWrapper = getCellEditorWrapperFor(type, false); - if (cellEditorWrapper != null) { - return (IModelCellEditor) cellEditorWrapper.getCellEditorImplementation(); - } - return null; - } - - /** - * Returns a cell editor wrapper to edit a list of values of the given type, or - * <code>null</code> if none was found. Custom cell editors override the default ones (from - * "org.eclipse.emf.facet.widgets.celleditors"). - * - * @param type - * the type for which to get a cell editor - * @return the cell editor wrapper or <code>null</code> if none was found for the given type - */ - public INaryFeatureCellEditor getNaryCellEditorFor(final EClassifier type) { - ModelCellEditor cellEditorWrapper = getCellEditorWrapperFor(type, true); - if (cellEditorWrapper != null) { - return (INaryFeatureCellEditor) cellEditorWrapper.getCellEditorImplementation(); - } - return null; - } - - public IModelCellEditor getCellEditorFor(final EClassifier type, - final List<AbstractModelCellEditor> preferredCellEditors) { - ModelCellEditor cellEditorWrapper = getCellEditorWrapperFor(type, false, - preferredCellEditors); - if (cellEditorWrapper != null) { - return (IModelCellEditor) cellEditorWrapper.getCellEditorImplementation(); - } - return null; - } - - public INaryFeatureCellEditor getNaryCellEditorFor(final EClassifier type, - final List<AbstractModelCellEditor> preferredCellEditors) { - ModelCellEditor cellEditorWrapper = getCellEditorWrapperFor(type, true, - preferredCellEditors); - if (cellEditorWrapper != null) { - return (INaryFeatureCellEditor) cellEditorWrapper.getCellEditorImplementation(); - } - return null; - } - - /** - * Returns a cell editor for the given type, or <code>null</code> if none was found. Custom cell - * editors override the default ones (from "org.eclipse.emf.facet.widgets.celleditors"). - * - * @param type - * the type for which to get a cell editor - * @param many - * whether to get a cell editor to edit a single value or a list of values - * @param preferredCellEditors - * the cell editors that should be chosen in case of conflicts (several cell editors - * defined for the same type) - * @return the cell editor or <code>null</code> if none was found for the given type - */ - public ModelCellEditor getCellEditorWrapperFor(final EClassifier type, final boolean many, - final List<AbstractModelCellEditor> preferredCellEditors) { - - List<IModelCellEditorContainer<? extends AbstractModelCellEditor>> allCellEditorContainers = getAllCellEditors(); - - List<ModelCellEditor> cellEditors = new ArrayList<ModelCellEditor>(); - - for (IModelCellEditorContainer<? extends AbstractModelCellEditor> modelCellEditorContainer : allCellEditorContainers) { - AbstractModelCellEditor modelCellEditor = modelCellEditorContainer.getModelCellEditor(); - if (isCellEditorForType(modelCellEditor, type, many)) { - cellEditors.add(new ModelCellEditor(modelCellEditorContainer.getBundleName(), - modelCellEditorContainer.getModelCellEditor())); - } - } - - ModelCellEditor selectedCellEditor = null; - - if (preferredCellEditors != null) { - for (AbstractModelCellEditor preferredCellEditor : preferredCellEditors) { - if (isCellEditorForType(preferredCellEditor, type, many)) { - if (selectedCellEditor != null) { - throw new IllegalArgumentException( - "Several preferred cell editors are defined for type: " //$NON-NLS-1$ - + EcoreUtil.getURI(type)); - } - selectedCellEditor = new ModelCellEditor("", preferredCellEditor); //$NON-NLS-1$ - } - } - } - - if (selectedCellEditor == null) { - if (cellEditors.size() == 1) { - selectedCellEditor = cellEditors.get(0); - } else if (cellEditors.size() > 1) { - boolean skippedDefault = false; - for (ModelCellEditor cellEditor : cellEditors) { - // lower priority for - // org.eclipse.emf.facet.widgets.celleditors.* - if (cellEditor.getBundleName().startsWith( - "org.eclipse.emf.facet.widgets.celleditors")) { //$NON-NLS-1$ - if (skippedDefault) { - Logger.logError( - "Several default cell editors are defined in EMF Facet for type: " //$NON-NLS-1$ - + EcoreUtil.getURI(type), Activator.getDefault()); - selectedCellEditor = cellEditor; - break; - } - skippedDefault = true; - continue; - } - if (selectedCellEditor != null) { - Logger.logWarning("Several cell editors are defined for type: " //$NON-NLS-1$ - + EcoreUtil.getURI(type), Activator.getDefault()); - break; - } - selectedCellEditor = cellEditor; - } - } - } - - return selectedCellEditor; - } - - public static boolean isCellEditorForType(final AbstractModelCellEditor modelCellEditor, - final EClassifier type, final boolean many) { - if (many != (modelCellEditor instanceof NaryFeatureCellEditor)) { - return false; - } - return isSuperType(modelCellEditor.getCellType(), type); - } - - private static boolean isSuperType(final EClassifier superType, final EClassifier subType) { - if (superType == subType) { - return true; - } - - if (superType instanceof EClass && subType instanceof EClass) { - // special case because isSuperTypeOf doesn't handle it - if (superType == EcorePackage.eINSTANCE.getEObject()) { - return true; - } - - EClass superTypeEClass = (EClass) superType; - EClass subTypeEClass = (EClass) subType; - return superTypeEClass.isSuperTypeOf(subTypeEClass); - } - - if (superType == EcorePackage.eINSTANCE.getEDataType() && subType instanceof EDataType) { - // cf Bug 331539 - cell editor registered for type "EDataType" - return true; - } - - return false; - } - - public List<ModelCellEditorContainer<BasicCellEditor>> getBasicCellEditors() { - return this.basicCellEditors; - } - - public List<ModelCellEditorContainer<UnaryReferenceCellEditor>> getUnaryReferenceCellEditors() { - return this.unaryReferenceCellEditors; - } - - public List<ModelCellEditorContainer<NaryFeatureCellEditor>> getNaryFeatureCellEditors() { - return this.naryFeatureCellEditors; - } - - @Override - protected String getExtensionPointName() { - return CellEditorsRegistry.EXTENSION_POINT_NAME; - } - - @Override - protected String getExtensionPointNamespace() { - return CellEditorsRegistry.EXTENSION_POINT_NAMESPACE; - } - - @Override - protected void handleRootElement(final IConfigurationElement configurationElement) { - final String name = configurationElement.getName(); - if (name.equalsIgnoreCase(CellEditorsRegistry.CELL_EDITORS_MODEL_ELEMENT)) { - readModelElement(configurationElement); - } else { - logUnknownElement(configurationElement); - } - } - - /** Read a 'cellEditorsModel' element */ - private void readModelElement(final IConfigurationElement configurationElement) { - final String path = configurationElement.getAttribute(CellEditorsRegistry.PATH_ATTRIBUTE); - String bundleName = configurationElement.getContributor().getName(); - URI uri = URI.createURI("platform:/plugin/" //$NON-NLS-1$ - + configurationElement.getContributor().getName() + "/" + path); //$NON-NLS-1$ - ResourceSet resourceSet = new ResourceSetImpl(); - Resource resource = resourceSet.getResource(uri, true); - if (resource != null) { - EList<EObject> contents = resource.getContents(); - if (contents.size() == 1) { - EObject eObject = contents.get(0); - if (eObject instanceof ModelCellEditorDeclarations) { - ModelCellEditorDeclarations modelCellEditors = (ModelCellEditorDeclarations) eObject; - EList<AbstractModelCellEditor> allCellEditors = modelCellEditors - .getModelCellEditors(); - for (AbstractModelCellEditor modelCellEditor : allCellEditors) { - if (modelCellEditor instanceof BasicCellEditor) { - BasicCellEditor basicCellEditor = (BasicCellEditor) modelCellEditor; - ModelCellEditorContainer<BasicCellEditor> modelCellEditorContainer = new ModelCellEditorContainer<BasicCellEditor>(); - modelCellEditorContainer.setBundleName(bundleName); - modelCellEditorContainer.setModelCellEditor(basicCellEditor); - this.basicCellEditors.add(modelCellEditorContainer); - } else if (modelCellEditor instanceof UnaryReferenceCellEditor) { - UnaryReferenceCellEditor unaryReferenceCellEditor = (UnaryReferenceCellEditor) modelCellEditor; - ModelCellEditorContainer<UnaryReferenceCellEditor> modelCellEditorContainer = new ModelCellEditorContainer<UnaryReferenceCellEditor>(); - modelCellEditorContainer.setBundleName(bundleName); - modelCellEditorContainer.setModelCellEditor(unaryReferenceCellEditor); - this.unaryReferenceCellEditors.add(modelCellEditorContainer); - } else if (modelCellEditor instanceof NaryFeatureCellEditor) { - NaryFeatureCellEditor naryFeatureCellEditor = (NaryFeatureCellEditor) modelCellEditor; - ModelCellEditorContainer<NaryFeatureCellEditor> modelCellEditorContainer = new ModelCellEditorContainer<NaryFeatureCellEditor>(); - modelCellEditorContainer.setBundleName(bundleName); - modelCellEditorContainer.setModelCellEditor(naryFeatureCellEditor); - this.naryFeatureCellEditors.add(modelCellEditorContainer); - } else { - Logger.logError("Not handled: " //$NON-NLS-1$ - + modelCellEditor.getClass().getSimpleName(), - Activator.getDefault()); - } - } - } else { - Logger.logError("Root element must be of type " //$NON-NLS-1$ - + ModelCellEditorDeclarations.class.getSimpleName() + ": " + uri, //$NON-NLS-1$ - Activator.getDefault()); - } - } else { - Logger.logError("Resource should have one and only one root: " + uri, //$NON-NLS-1$ - Activator.getDefault()); - } - } else { - Logger.logError("Error reading resource: " + uri, Activator.getDefault()); //$NON-NLS-1$ - } - } -} \ No newline at end of file
diff --git a/org.eclipse.modisco.facet.widgets.celleditors/src/org/eclipse/emf/facet/widgets/celleditors/internal/CommandFactoriesRegistry.java b/org.eclipse.modisco.facet.widgets.celleditors/src/org/eclipse/emf/facet/widgets/celleditors/internal/CommandFactoriesRegistry.java deleted file mode 100644 index 5ca49eb..0000000 --- a/org.eclipse.modisco.facet.widgets.celleditors/src/org/eclipse/emf/facet/widgets/celleditors/internal/CommandFactoriesRegistry.java +++ /dev/null
@@ -1,100 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 CEA LIST. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Nicolas Bros (Mia-Software) - initial API and implementation - * Nicolas Guyomar (Mia-Software) - Bug 339554 - org.eclipse.emf.facet.widgets.celleditors API cleaning - * Gregoire Dupe (Mia-Software) - Bug 369987 - [Restructuring][Table] Switch to the new customization and facet framework - *******************************************************************************/ -package org.eclipse.emf.facet.widgets.celleditors.internal; - -import java.util.ArrayList; -import java.util.List; - -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IConfigurationElement; -import org.eclipse.emf.edit.domain.EditingDomain; -import org.eclipse.emf.facet.util.core.Logger; -import org.eclipse.emf.facet.util.core.internal.exported.AbstractRegistry; -import org.eclipse.emf.facet.widgets.celleditors.ICommandFactoriesRegistry; -import org.eclipse.emf.facet.widgets.celleditors.ICommandFactory; - -/** Registry for the "loadingDepth" extension point */ -public class CommandFactoriesRegistry extends AbstractRegistry implements ICommandFactoriesRegistry { - - private static final String EXTENSION_POINT_NAMESPACE = "org.eclipse.emf.facet.widgets.celleditors"; //$NON-NLS-1$ - private static final String EXTENSION_POINT_NAME = "commandFactories"; //$NON-NLS-1$ - - private static final String COMMAND_FACTORY_ELEMENT = "commandFactory"; //$NON-NLS-1$ - private static final String CLASS_ATTRIBUTE = "class"; //$NON-NLS-1$ - - - private final List<ICommandFactory> commandFactories = new ArrayList<ICommandFactory>(); - private final ICommandFactory defaultCommandFactory = new DefaultCommandFactory(); - - public CommandFactoriesRegistry() { - initialize(); - } - - public List<ICommandFactory> getCommandFactories() { - return this.commandFactories; - } - - public ICommandFactory getCommandFactoryFor(final EditingDomain editingDomain) { - for (ICommandFactory commandFactory : this.commandFactories) { - if (commandFactory.handles(editingDomain)) { - return commandFactory; - } - } - return this.defaultCommandFactory; - } - - @Override - protected String getExtensionPointName() { - return CommandFactoriesRegistry.EXTENSION_POINT_NAME; - } - - @Override - protected String getExtensionPointNamespace() { - return CommandFactoriesRegistry.EXTENSION_POINT_NAMESPACE; - } - - @Override - protected void handleRootElement(final IConfigurationElement configurationElement) { - final String name = configurationElement.getName(); - if (name.equalsIgnoreCase(CommandFactoriesRegistry.COMMAND_FACTORY_ELEMENT)) { - readModelElement(configurationElement); - } else { - logUnknownElement(configurationElement); - } - } - - /** Read a 'cellEditorsModel' element */ - private void readModelElement(final IConfigurationElement configurationElement) { - Object object; - try { - object = configurationElement - .createExecutableExtension(CommandFactoriesRegistry.CLASS_ATTRIBUTE); - } catch (CoreException e) { - Logger.logError(e, Activator.getDefault()); - return; - } - if (object == null) { - logMissingAttribute(configurationElement, CommandFactoriesRegistry.CLASS_ATTRIBUTE); - return; - } - - if (object instanceof ICommandFactory) { - ICommandFactory commandFactory = (ICommandFactory) object; - this.commandFactories.add(commandFactory); - } else { - logError(configurationElement, - "class must implement " + ICommandFactory.class.getSimpleName()); //$NON-NLS-1$ - } - } -} \ No newline at end of file
diff --git a/org.eclipse.modisco.facet.widgets.celleditors/src/org/eclipse/emf/facet/widgets/celleditors/internal/DefaultCommandFactory.java b/org.eclipse.modisco.facet.widgets.celleditors/src/org/eclipse/emf/facet/widgets/celleditors/internal/DefaultCommandFactory.java deleted file mode 100644 index a1b435c..0000000 --- a/org.eclipse.modisco.facet.widgets.celleditors/src/org/eclipse/emf/facet/widgets/celleditors/internal/DefaultCommandFactory.java +++ /dev/null
@@ -1,62 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 CEA LIST. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Nicolas Bros (Mia-Software) - initial API and implementation - * Nicolas Guyomar (Mia-Software) - Bug 339554 - org.eclipse.emf.facet.widgets.celleditors API cleaning - *******************************************************************************/ -package org.eclipse.emf.facet.widgets.celleditors.internal; - -import org.eclipse.emf.common.command.Command; -import org.eclipse.emf.edit.command.AddCommand; -import org.eclipse.emf.edit.command.DeleteCommand; -import org.eclipse.emf.edit.command.MoveCommand; -import org.eclipse.emf.edit.command.RemoveCommand; -import org.eclipse.emf.edit.command.SetCommand; -import org.eclipse.emf.edit.domain.EditingDomain; -import org.eclipse.emf.facet.widgets.celleditors.ICommandFactory; - -/** - * This is the command factory that is used when no other command factory is - * specified through the "commandFactories" extension point. - */ -public class DefaultCommandFactory implements ICommandFactory { - - public boolean handles(final EditingDomain editingDomain) { - return true; - } - - public Command createSetCommand(final EditingDomain domain, final Object owner, - final Object feature, final Object value) { - return SetCommand.create(domain, owner, feature, value); - } - - public Command createSetCommand(final EditingDomain domain, final Object owner, - final Object feature, final Object value, final int index) { - return SetCommand.create(domain, owner, feature, value, index); - } - - public Command createMoveCommand(final EditingDomain domain, final Object owner, - final Object feature, final Object value, final int index) { - return MoveCommand.create(domain, owner, feature, value, index); - } - - public Command createAddCommand(final EditingDomain domain, final Object owner, - final Object feature, final Object value) { - return AddCommand.create(domain, owner, feature, value); - } - - public Command createRemoveCommand(final EditingDomain domain, final Object owner, - final Object feature, final Object value) { - return RemoveCommand.create(domain, owner, feature, value); - } - - public Command createDeleteCommand(final EditingDomain domain, final Object object) { - return DeleteCommand.create(domain, object); - } -}
diff --git a/org.eclipse.modisco.facet.widgets.celleditors/src/org/eclipse/emf/facet/widgets/celleditors/internal/Messages.java b/org.eclipse.modisco.facet.widgets.celleditors/src/org/eclipse/emf/facet/widgets/celleditors/internal/Messages.java deleted file mode 100644 index 7a01c35..0000000 --- a/org.eclipse.modisco.facet.widgets.celleditors/src/org/eclipse/emf/facet/widgets/celleditors/internal/Messages.java +++ /dev/null
@@ -1,53 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2010 CEA LIST. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Nicolas Bros (Mia-Software) - initial API and implementation - * Nicolas Bros (Mia-Software) - Bug 339664 - org.eclipse.emf.facet.widgets.celleditors API cleaning - *****************************************************************************/ -package org.eclipse.emf.facet.widgets.celleditors.internal; - -import org.eclipse.osgi.util.NLS; - -public final class Messages extends NLS { - private static final String BUNDLE_NAME = "org.eclipse.emf.facet.widgets.celleditors.internal.messages"; //$NON-NLS-1$ - public static String CoreIFileComposite_mustSelectFile; - public static String CoreIFileComposite_selectFile; - public static String NaryAttributeEditingDialog_add; - public static String NaryAttributeEditingDialog_delete; - public static String NaryAttributeEditingDialog_enterNewValuePlaceholder; - public static String NaryReferenceEditingDialog_add; - public static String NaryReferenceEditingDialog_addAll; - public static String NaryReferenceEditingDialog_addAllTooltip; - public static String NaryReferenceEditingDialog_addTooltip; - public static String NaryReferenceEditingDialog_availableValues; - public static String NaryReferenceEditingDialog_deleteElements; - public static String NaryReferenceEditingDialog_deleteElementsLong; - public static String NaryReferenceEditingDialog_down; - public static String NaryReferenceEditingDialog_moveWarning; - public static String NaryReferenceEditingDialog_moveElement; - public static String NaryReferenceEditingDialog_newInstance; - public static String NaryReferenceEditingDialog_remove; - public static String NaryReferenceEditingDialog_removeAll; - public static String NaryReferenceEditingDialog_removeAllTooltip; - public static String NaryReferenceEditingDialog_removeTooltip; - public static String NaryReferenceEditingDialog_shellTitle; - public static String NaryReferenceEditingDialog_typeFilterText; - public static String NaryReferenceEditingDialog_up; - public static String NaryReferenceEditingDialog_values; - public static String UnaryReferenceCellEditorComposite_0; - public static String UnaryReferenceCellEditorComposite_1; - public static String UnaryReferenceCellEditorComposite_2; - static { - // initialize resource bundle - NLS.initializeMessages(Messages.BUNDLE_NAME, Messages.class); - } - - private Messages() { - } -}
diff --git a/org.eclipse.modisco.facet.widgets.celleditors/src/org/eclipse/emf/facet/widgets/celleditors/internal/ModelCellEditor.java b/org.eclipse.modisco.facet.widgets.celleditors/src/org/eclipse/emf/facet/widgets/celleditors/internal/ModelCellEditor.java deleted file mode 100644 index 4cd0706..0000000 --- a/org.eclipse.modisco.facet.widgets.celleditors/src/org/eclipse/emf/facet/widgets/celleditors/internal/ModelCellEditor.java +++ /dev/null
@@ -1,81 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 CEA LIST. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Nicolas Bros (Mia-Software) - initial API and implementation - * Nicolas Bros (Mia-Software) - Bug 339855 - ModelCellEditor class should not be exposed - *******************************************************************************/ -package org.eclipse.emf.facet.widgets.celleditors.internal; - -import org.eclipse.core.runtime.Platform; -import org.eclipse.emf.facet.util.core.Logger; -import org.eclipse.emf.facet.widgets.celleditors.modelCellEditor.AbstractModelCellEditor; - -public class ModelCellEditor { - private final String bundleName; - private final AbstractModelCellEditor modelCellEditor; - - public ModelCellEditor(final String bundleName, final AbstractModelCellEditor modelCellEditor) { - this.bundleName = bundleName; - this.modelCellEditor = modelCellEditor; - } - - public String getBundleName() { - return this.bundleName; - } - - public String getCellID() { - return this.modelCellEditor.getCellId(); - } - - public AbstractModelCellEditor getModelCellEditor() { - return this.modelCellEditor; - } - - public Object getCellEditorImplementation() { - String className = this.modelCellEditor.getModelCellEditorImpl(); - - Class<?> classInstance = null; - try { - classInstance = Platform.getBundle(this.bundleName).loadClass(className); - } catch (Exception e) { - Logger.logError("Could not find class: " + className, //$NON-NLS-1$ - Activator.getDefault()); - return null; - } - - Object instance = null; - try { - instance = classInstance.newInstance(); - } catch (Exception e) { - Logger.logError("Could not instantiate class: " + className, //$NON-NLS-1$ - Activator.getDefault()); - return null; - } - return instance; - } - - @Override - public boolean equals(final Object obj) { - if (obj instanceof ModelCellEditor) { - ModelCellEditor other = (ModelCellEditor) obj; - return other.getCellID().equals(getCellID()); - } - return false; - } - - @Override - public int hashCode() { - return getCellID().hashCode(); - } - - @Override - public String toString() { - return getBundleName() + "#" + getCellID(); //$NON-NLS-1$ - } -} \ No newline at end of file
diff --git a/org.eclipse.modisco.facet.widgets.celleditors/src/org/eclipse/emf/facet/widgets/celleditors/internal/ModelCellEditorContainer.java b/org.eclipse.modisco.facet.widgets.celleditors/src/org/eclipse/emf/facet/widgets/celleditors/internal/ModelCellEditorContainer.java deleted file mode 100644 index f9483a9..0000000 --- a/org.eclipse.modisco.facet.widgets.celleditors/src/org/eclipse/emf/facet/widgets/celleditors/internal/ModelCellEditorContainer.java +++ /dev/null
@@ -1,39 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2011 Mia-Software. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Nicolas Guyomar (Mia-Software) - Bug 339554 - org.eclipse.emf.facet.widgets.celleditors API cleaning - *******************************************************************************/ -package org.eclipse.emf.facet.widgets.celleditors.internal; - -import org.eclipse.emf.facet.widgets.celleditors.IModelCellEditorContainer; -import org.eclipse.emf.facet.widgets.celleditors.modelCellEditor.AbstractModelCellEditor; - -public class ModelCellEditorContainer<T extends AbstractModelCellEditor> implements - IModelCellEditorContainer<AbstractModelCellEditor> { - - private AbstractModelCellEditor modelCellEditor; - private String bundleName; - - public String getBundleName() { - return this.bundleName; - } - - public AbstractModelCellEditor getModelCellEditor() { - return this.modelCellEditor; - } - - public void setBundleName(final String bundleName) { - this.bundleName = bundleName; - } - - public void setModelCellEditor(final AbstractModelCellEditor modelCellEditor) { - this.modelCellEditor = modelCellEditor; - - } -} \ No newline at end of file
diff --git a/org.eclipse.modisco.facet.widgets.celleditors/src/org/eclipse/emf/facet/widgets/celleditors/internal/composite/registries/CompositeEditorFactoriesRegistry.java b/org.eclipse.modisco.facet.widgets.celleditors/src/org/eclipse/emf/facet/widgets/celleditors/internal/composite/registries/CompositeEditorFactoriesRegistry.java deleted file mode 100644 index 18b4ba0..0000000 --- a/org.eclipse.modisco.facet.widgets.celleditors/src/org/eclipse/emf/facet/widgets/celleditors/internal/composite/registries/CompositeEditorFactoriesRegistry.java +++ /dev/null
@@ -1,121 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2011 Mia-Software. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Fabien Giquel (Mia-Software) - initial API and implementation - * Nicolas Bros (Mia-Software) - Bug 338437 - compositeEditors extension point cannot be used to register user types - * Nicolas Guyomar (Mia-Software) - Bug 338826 - CompositeEditorFactoriesRegistry.getCompositeEditorFactory() should be parameterized - * Nicolas Guyomar (Mia-Software) - Bug 339554 - org.eclipse.emf.facet.widgets.celleditors API cleaning - * Nicolas Bros (Mia-Software) - Bug 341369 - CompositeEditorFactoriesRegistry : inverted type comparison - * Gregoire Dupe (Mia-Software) - Bug 369987 - [Restructuring][Table] Switch to the new customization and facet framework - *******************************************************************************/ -package org.eclipse.emf.facet.widgets.celleditors.internal.composite.registries; - -import java.util.ArrayList; -import java.util.List; - -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IConfigurationElement; -import org.eclipse.emf.facet.util.core.Logger; -import org.eclipse.emf.facet.util.core.internal.exported.AbstractRegistry; -import org.eclipse.emf.facet.widgets.celleditors.ICompositeEditorFactory; -import org.eclipse.emf.facet.widgets.celleditors.internal.Activator; - -/** - * Registry for composite editors extension point - */ -public class CompositeEditorFactoriesRegistry extends AbstractRegistry - implements org.eclipse.emf.facet.widgets.celleditors.core.composite.registry.ICompositeEditorFactoriesRegistry { - - private static final String CLASS_ATTRIBUTE = "class"; //$NON-NLS-1$ - - private static final String EXTENSION_POINT_NAMESPACE = "org.eclipse.emf.facet.widgets.celleditors"; //$NON-NLS-1$ - private static final String EXTENSION_POINT_NAME = "compositeEditorFactories"; //$NON-NLS-1$ - private final List<ICompositeEditorFactory<?>> compositeFactories; - - public CompositeEditorFactoriesRegistry() { - this.compositeFactories = new ArrayList<ICompositeEditorFactory<?>>(); - initialize(); - } - - public boolean hasCompositeEditorFactory(final Class<?> type) { - return getCompositeEditorFactory(type) != null; - } - - public <T> ICompositeEditorFactory<T> getCompositeEditorFactory(final Class<T> type) { - if (this.compositeFactories == null) { - initialize(); - } - - final Class<?> objectType; - if (type == byte.class) { - objectType = Byte.class; - } else if (type == short.class) { - objectType = Short.class; - } else if (type == int.class) { - objectType = Integer.class; - } else if (type == long.class) { - objectType = Long.class; - } else if (type == float.class) { - objectType = Float.class; - } else if (type == double.class) { - objectType = Double.class; - } else if (type == boolean.class) { - objectType = Boolean.class; - } else if (type == char.class) { - objectType = Character.class; - } else { - objectType = type; - } - - // choose the factory with the most "precise" type (lowest in the inheritance hierarchy) - Class<?> mostPreciseType = null; - ICompositeEditorFactory<T> mostPreciseFactory = null; - for (ICompositeEditorFactory<?> factory : this.compositeFactories) { - Class<?> handledType = factory.getHandledType(); - if (handledType != null && handledType.isAssignableFrom(objectType)) { - if (mostPreciseType == null || mostPreciseType.isAssignableFrom(handledType)) { - mostPreciseType = handledType; - mostPreciseFactory = castMostPreciseFactory(factory); - } - } - } - return mostPreciseFactory; - } - - // Only here to isolate the suppress warning - @SuppressWarnings("unchecked") - private <T> ICompositeEditorFactory<T> castMostPreciseFactory(final ICompositeEditorFactory<?> factory) { - ICompositeEditorFactory<T> mostPreciseFactory; - mostPreciseFactory = (ICompositeEditorFactory<T>) factory; - return mostPreciseFactory; - } - - @Override - protected String getExtensionPointNamespace() { - return CompositeEditorFactoriesRegistry.EXTENSION_POINT_NAMESPACE; - } - - @Override - protected String getExtensionPointName() { - return CompositeEditorFactoriesRegistry.EXTENSION_POINT_NAME; - } - - @Override - protected void handleRootElement(final IConfigurationElement configurationElement) { - ICompositeEditorFactory<?> factory; - try { - factory = (ICompositeEditorFactory<?>) configurationElement - .createExecutableExtension(CompositeEditorFactoriesRegistry.CLASS_ATTRIBUTE); - this.compositeFactories.add(factory); - } catch (CoreException e) { - Logger.logError( - e, - "A problem occured when instantiating a composite editor factory", Activator.getDefault()); //$NON-NLS-1$ - } - } -}
diff --git a/org.eclipse.modisco.facet.widgets.celleditors/src/org/eclipse/emf/facet/widgets/celleditors/internal/core/EEnumCellEditor.java b/org.eclipse.modisco.facet.widgets.celleditors/src/org/eclipse/emf/facet/widgets/celleditors/internal/core/EEnumCellEditor.java deleted file mode 100644 index 4a93f96..0000000 --- a/org.eclipse.modisco.facet.widgets.celleditors/src/org/eclipse/emf/facet/widgets/celleditors/internal/core/EEnumCellEditor.java +++ /dev/null
@@ -1,62 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2010 CEA LIST. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Gregoire Dupe (Mia-Software) - initial API and implementation - * Nicolas Bros (Mia-Software) - Bug 339664 - org.eclipse.emf.facet.widgets.celleditors API cleaning - * Nicolas Bros (Mia-Software) - Bug 334539 - [celleditors] change listener - * Gregoire Dupe (Mia-Software) - Bug 344563 - NPE with Enum Editor - *****************************************************************************/ -package org.eclipse.emf.facet.widgets.celleditors.internal.core; - -import org.eclipse.emf.common.util.Enumerator; -import org.eclipse.emf.ecore.EEnum; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.EStructuralFeature; -import org.eclipse.emf.facet.widgets.celleditors.IListener; -import org.eclipse.emf.facet.widgets.celleditors.IModelCellEditHandler; -import org.eclipse.emf.facet.widgets.celleditors.IModelCellEditor; -import org.eclipse.emf.facet.widgets.celleditors.internal.core.composite.EnumeratorComposite; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Control; - -/** - * This is a enum value editor - * - * @author Gregoire Dupe (Mia-Software) - * - */ -public class EEnumCellEditor implements IModelCellEditor { - - private EnumeratorComposite<Enumerator> composite = null; - - public Control activateCell(final Composite parent, final Object originalValue, - final IModelCellEditHandler editHandler, final EStructuralFeature feature, - final EObject source) { - if (!(feature.getEType() instanceof EEnum)) { - throw new IllegalArgumentException("EEnum feature type"); //$NON-NLS-1$ - } - this.composite = new EnumeratorComposite<Enumerator>(parent); - this.composite.setEEnum((EEnum) feature.getEType()); - - this.composite.setValue((Enumerator) originalValue); - - this.composite.addCommitListener(new IListener() { - public void handleEvent() { - editHandler.commit(); - } - }); - - return this.composite; - } - - public Object getValue() { - return this.composite.getValue(); - } - -}
diff --git a/org.eclipse.modisco.facet.widgets.celleditors/src/org/eclipse/emf/facet/widgets/celleditors/internal/core/NaryAttributeCellEditor.java b/org.eclipse.modisco.facet.widgets.celleditors/src/org/eclipse/emf/facet/widgets/celleditors/internal/core/NaryAttributeCellEditor.java deleted file mode 100644 index b8e7f08..0000000 --- a/org.eclipse.modisco.facet.widgets.celleditors/src/org/eclipse/emf/facet/widgets/celleditors/internal/core/NaryAttributeCellEditor.java +++ /dev/null
@@ -1,54 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010, 2011 CEA LIST. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Nicolas Bros (Mia-Software) - initial API and implementation - * Nicolas Bros (Mia-Software) - Bug 339664 - org.eclipse.emf.facet.widgets.celleditors API cleaning - * Nicolas Guyomar (Mia-Software) - Bug 342451 - To be able to edit derived facet attributes and derived facet references in a table - *******************************************************************************/ -package org.eclipse.emf.facet.widgets.celleditors.internal.core; - -import java.util.List; - -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.EStructuralFeature; -import org.eclipse.emf.facet.widgets.celleditors.IModelCellEditHandler; -import org.eclipse.emf.facet.widgets.celleditors.INaryEAttributeCellEditor; -import org.eclipse.emf.facet.widgets.celleditors.internal.ui.NaryAttributeEditingDialog; -import org.eclipse.swt.SWT; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Control; - -public class NaryAttributeCellEditor<T extends Object> implements INaryEAttributeCellEditor<T> { - - private NaryAttributeEditingDialog<T> naryAttributeEditingDialog; - - public Control activateCell(final Composite parent, final List<T> values, - final IModelCellEditHandler editHandler, final EObject eObject, - final EStructuralFeature feature) { - final Composite placeholderComposite = new Composite(parent, SWT.NONE); - this.naryAttributeEditingDialog = new NaryAttributeEditingDialog<T>(parent.getShell(), - values, editHandler, eObject, feature) { - @Override - public boolean close() { - placeholderComposite.dispose(); - return super.close(); - } - }; - this.naryAttributeEditingDialog.open(); - - return placeholderComposite; - } - - public List<T> getValue() { - if (this.naryAttributeEditingDialog != null) { - return this.naryAttributeEditingDialog.getValue(); - } - return null; - } -}
diff --git a/org.eclipse.modisco.facet.widgets.celleditors/src/org/eclipse/emf/facet/widgets/celleditors/internal/core/NaryReferenceCellEditor.java b/org.eclipse.modisco.facet.widgets.celleditors/src/org/eclipse/emf/facet/widgets/celleditors/internal/core/NaryReferenceCellEditor.java deleted file mode 100644 index 6c273d5..0000000 --- a/org.eclipse.modisco.facet.widgets.celleditors/src/org/eclipse/emf/facet/widgets/celleditors/internal/core/NaryReferenceCellEditor.java +++ /dev/null
@@ -1,55 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010, 2011 CEA LIST. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Nicolas Bros (Mia-Software) - initial API and implementation - * Nicolas Bros (Mia-Software) - Bug 339664 - org.eclipse.emf.facet.widgets.celleditors API cleaning - * Nicolas Guyomar (Mia-Software) - Bug 342451 - To be able to edit derived facet attributes and derived facet references in a table - *******************************************************************************/ -package org.eclipse.emf.facet.widgets.celleditors.internal.core; - -import java.util.List; - -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.EStructuralFeature; -import org.eclipse.emf.facet.widgets.celleditors.IModelCellEditHandler; -import org.eclipse.emf.facet.widgets.celleditors.INaryEReferenceCellEditor; -import org.eclipse.emf.facet.widgets.celleditors.internal.ui.NaryReferenceEditingDialog; -import org.eclipse.swt.SWT; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Control; - -public class NaryReferenceCellEditor<T extends EObject> implements INaryEReferenceCellEditor<T> { - - private NaryReferenceEditingDialog<T> naryReferenceEditingDialog; - - public Control activateCell(final Composite parent, final List<T> values, - final List<T> availableValues, final IModelCellEditHandler editHandler, - final EObject eObject, final EStructuralFeature feature) { - final Composite placeholderComposite = new Composite(parent, SWT.NONE); - this.naryReferenceEditingDialog = new NaryReferenceEditingDialog<T>(parent.getShell(), - values, availableValues, editHandler, eObject, feature) { - @Override - public boolean close() { - placeholderComposite.dispose(); - return super.close(); - } - }; - this.naryReferenceEditingDialog.open(); - - return placeholderComposite; - } - - public List<T> getValue() { - if (this.naryReferenceEditingDialog != null) { - return this.naryReferenceEditingDialog.getValue(); - } - return null; - } - -}
diff --git a/org.eclipse.modisco.facet.widgets.celleditors/src/org/eclipse/emf/facet/widgets/celleditors/internal/core/UnaryReferenceCellEditor.java b/org.eclipse.modisco.facet.widgets.celleditors/src/org/eclipse/emf/facet/widgets/celleditors/internal/core/UnaryReferenceCellEditor.java deleted file mode 100644 index fbf1ac3..0000000 --- a/org.eclipse.modisco.facet.widgets.celleditors/src/org/eclipse/emf/facet/widgets/celleditors/internal/core/UnaryReferenceCellEditor.java +++ /dev/null
@@ -1,53 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2010 CEA LIST. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Nicolas Bros (Mia-Software) - initial API and implementation - * Nicolas Bros (Mia-Software) - Bug 339664 - org.eclipse.emf.facet.widgets.celleditors API cleaning - * Nicolas Bros (Mia-Software) - Bug 334539 - [celleditors] change listener - * Gregoire Dupe (Mia-Software) - Bug 369987 - [Restructuring][Table] Switch to the new customization and facet framework - *****************************************************************************/ -package org.eclipse.emf.facet.widgets.celleditors.internal.core; - -import java.util.List; - -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.EStructuralFeature; -import org.eclipse.emf.facet.util.emf.core.ModelUtils; -import org.eclipse.emf.facet.widgets.celleditors.IListener; -import org.eclipse.emf.facet.widgets.celleditors.IModelCellEditHandler; -import org.eclipse.emf.facet.widgets.celleditors.IModelCellEditor; -import org.eclipse.emf.facet.widgets.celleditors.internal.core.composite.UnaryReferenceCellEditorComposite; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Control; - -/** A cell editor for unary references */ -public class UnaryReferenceCellEditor implements IModelCellEditor { - - private UnaryReferenceCellEditorComposite cellEditorComposite; - - public Control activateCell(final Composite parent, final Object originalValue, - final IModelCellEditHandler editHandler, final EStructuralFeature feature, - final EObject source) { - - List<EObject> list = ModelUtils.computeAssignableElements(feature, source); - - this.cellEditorComposite = new UnaryReferenceCellEditorComposite(parent, list); - this.cellEditorComposite.addCommitListener(new IListener() { - public void handleEvent() { - editHandler.commit(); - } - }); - - return this.cellEditorComposite; - } - - public Object getValue() { - return this.cellEditorComposite.getValue(); - } -}
diff --git a/org.eclipse.modisco.facet.widgets.celleditors/src/org/eclipse/emf/facet/widgets/celleditors/internal/core/composite/AbstractIResourceComposite.java b/org.eclipse.modisco.facet.widgets.celleditors/src/org/eclipse/emf/facet/widgets/celleditors/internal/core/composite/AbstractIResourceComposite.java deleted file mode 100644 index c18a795..0000000 --- a/org.eclipse.modisco.facet.widgets.celleditors/src/org/eclipse/emf/facet/widgets/celleditors/internal/core/composite/AbstractIResourceComposite.java +++ /dev/null
@@ -1,149 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2011 Mia-Software. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Nicolas Bros (Mia-Software) - initial API and implementation - * Nicolas Guyomar (Mia-Software) - Bug 334546 - [celleditors] no border on Text field - * Nicolas Bros (Mia-Software) - Bug 339664 - org.eclipse.emf.facet.widgets.celleditors API cleaning - * Nicolas Bros (Mia-Software) - Bug 334539 - [celleditors] change listener - *******************************************************************************/ -package org.eclipse.emf.facet.widgets.celleditors.internal.core.composite; - -import org.eclipse.core.resources.IResource; -import org.eclipse.emf.facet.widgets.celleditors.AbstractCellEditorComposite; -import org.eclipse.swt.SWT; -import org.eclipse.swt.events.DisposeEvent; -import org.eclipse.swt.events.DisposeListener; -import org.eclipse.swt.events.KeyAdapter; -import org.eclipse.swt.events.KeyEvent; -import org.eclipse.swt.events.ModifyEvent; -import org.eclipse.swt.events.ModifyListener; -import org.eclipse.swt.events.SelectionAdapter; -import org.eclipse.swt.events.SelectionEvent; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.layout.GridLayout; -import org.eclipse.swt.widgets.Button; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Control; -import org.eclipse.swt.widgets.Display; -import org.eclipse.swt.widgets.Event; -import org.eclipse.swt.widgets.Listener; -import org.eclipse.swt.widgets.Text; - -public abstract class AbstractIResourceComposite<T extends IResource> extends - AbstractCellEditorComposite<T> { - - /** the control that is used to edit the contents of the cell */ - private final Button button; - private Text text = null; - - private final Composite parentControl; - - public AbstractIResourceComposite(final Composite parent) { - this(parent, SWT.NONE); - } - - public AbstractIResourceComposite(final Composite parent, final int style) { - super(parent); - this.parentControl = parent; - - GridLayout gd = new GridLayout(2, false); - gd.marginHeight = 0; - gd.marginWidth = 0; - gd.horizontalSpacing = 0; - setLayout(gd); - - this.text = new Text(this, style); - this.text.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false)); - this.button = new Button(this, SWT.PUSH); - this.button.setText("..."); //$NON-NLS-1$ - GridData data = new GridData(SWT.FILL, SWT.FILL, false, true); - this.button.setLayoutData(data); - - this.button.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(final SelectionEvent e) { - browseResource(); - } - }); - - // commit the cell editor when the mouse is clicked - // anywhere outside the text field - final Listener clickListener = new Listener() { - public void handleEvent(final Event event) { - if (event.widget instanceof Control) { - Control control = (Control) event.widget; - if (control.getShell() == getParentControl().getShell()) { - if (event.widget != getButton() && event.widget != getText()) { - fireCommit(); - } - } - } - } - }; - Display.getDefault().addFilter(SWT.MouseDown, clickListener); - - // this listener is only here to remove - // the other listener from the Display - this.text.addDisposeListener(new DisposeListener() { - public void widgetDisposed(final DisposeEvent e) { - Display.getDefault().removeFilter(SWT.MouseDown, clickListener); - } - }); - - this.text.addKeyListener(new KeyAdapter() { - @Override - public void keyPressed(final KeyEvent event) { - // Enter key pressed - if ((event.keyCode == SWT.CR && event.stateMask == 0) - || (event.keyCode == SWT.KEYPAD_CR && event.stateMask == 0)) { - fireCommit(); - } else if (event.keyCode == SWT.ESC && event.stateMask == 0) { - // Escape key pressed - close(); - } - } - }); - - this.text.addModifyListener(new ModifyListener() { - public void modifyText(final ModifyEvent e) { - fireChanged(); - } - }); - - this.text.forceFocus(); - } - - protected Button getButton() { - return this.button; - } - - protected Text getText() { - return this.text; - } - - protected void commit() { - fireCommit(); - } - - protected Composite getParentControl() { - return this.parentControl; - } - - public void setValue(final IResource value) { - if (value != null) { - this.text.setText(value.getFullPath().toString()); - } else { - this.text.setText(""); //$NON-NLS-1$ - } - } - - public abstract T getValue(); - - protected abstract void browseResource(); - -}
diff --git a/org.eclipse.modisco.facet.widgets.celleditors/src/org/eclipse/emf/facet/widgets/celleditors/internal/core/composite/CoreIFileComposite.java b/org.eclipse.modisco.facet.widgets.celleditors/src/org/eclipse/emf/facet/widgets/celleditors/internal/core/composite/CoreIFileComposite.java deleted file mode 100644 index ae2502c..0000000 --- a/org.eclipse.modisco.facet.widgets.celleditors/src/org/eclipse/emf/facet/widgets/celleditors/internal/core/composite/CoreIFileComposite.java +++ /dev/null
@@ -1,75 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2011 Mia-Software. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Nicolas Bros (Mia-Software) - initial API and implementation - * Nicolas Guyomar (Mia-Software) - Bug 334546 - [celleditors] no border on Text field - * Nicolas Bros (Mia-Software) - Bug 338437 - compositeEditors extension point cannot be used to register user types - * Nicolas Bros (Mia-Software) - Bug 339664 - org.eclipse.emf.facet.widgets.celleditors API cleaning - *******************************************************************************/ -package org.eclipse.emf.facet.widgets.celleditors.internal.core.composite; - -import org.eclipse.core.resources.IFile; -import org.eclipse.core.resources.IResource; -import org.eclipse.core.resources.ResourcesPlugin; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.Status; -import org.eclipse.emf.facet.widgets.celleditors.internal.Activator; -import org.eclipse.emf.facet.widgets.celleditors.internal.Messages; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.ui.dialogs.ElementTreeSelectionDialog; -import org.eclipse.ui.dialogs.ISelectionStatusValidator; -import org.eclipse.ui.model.WorkbenchContentProvider; -import org.eclipse.ui.model.WorkbenchLabelProvider; - -public class CoreIFileComposite extends AbstractIResourceComposite<IFile> { - - public CoreIFileComposite(final Composite parent) { - super(parent); - } - - public CoreIFileComposite(final Composite parent, final int style) { - super(parent, style); - } - - @Override - public IFile getValue() { - IResource member = ResourcesPlugin.getWorkspace().getRoot().findMember(getText().getText()); - if (member instanceof IFile) { - IFile file = (IFile) member; - return file; - } - return null; - } - - @Override - protected final void browseResource() { - ElementTreeSelectionDialog elementTreeSelectionDialog = new ElementTreeSelectionDialog( - getShell(), new WorkbenchLabelProvider(), new WorkbenchContentProvider()); - elementTreeSelectionDialog.setInput(ResourcesPlugin.getWorkspace().getRoot()); - elementTreeSelectionDialog.setMessage(Messages.CoreIFileComposite_selectFile); - elementTreeSelectionDialog.setAllowMultiple(false); - elementTreeSelectionDialog.setDoubleClickSelects(true); - elementTreeSelectionDialog.setValidator(new ISelectionStatusValidator() { - public IStatus validate(final Object[] selection) { - if (selection.length != 1 || !(selection[0] instanceof IFile)) { - return new Status(IStatus.ERROR, Activator.PLUGIN_ID, Messages.CoreIFileComposite_mustSelectFile); - } - return Status.OK_STATUS; - } - }); - elementTreeSelectionDialog.open(); - Object result = elementTreeSelectionDialog.getFirstResult(); - - if (result != null && result instanceof IFile) { - IFile selectedFile = (IFile) result; - setValue(selectedFile); - fireCommit(); - } - } - -}
diff --git a/org.eclipse.modisco.facet.widgets.celleditors/src/org/eclipse/emf/facet/widgets/celleditors/internal/core/composite/CoreIProjectComposite.java b/org.eclipse.modisco.facet.widgets.celleditors/src/org/eclipse/emf/facet/widgets/celleditors/internal/core/composite/CoreIProjectComposite.java deleted file mode 100644 index ad65526..0000000 --- a/org.eclipse.modisco.facet.widgets.celleditors/src/org/eclipse/emf/facet/widgets/celleditors/internal/core/composite/CoreIProjectComposite.java +++ /dev/null
@@ -1,77 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2011 Mia-Software. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Nicolas Bros (Mia-Software) - Bug 342548 - [Java Discovery] Illegal parameter initializer for ELEMENTS_TO_ANALYZE - *******************************************************************************/ -package org.eclipse.emf.facet.widgets.celleditors.internal.core.composite; - -import org.eclipse.core.resources.IProject; -import org.eclipse.core.resources.IResource; -import org.eclipse.core.resources.IWorkspace; -import org.eclipse.core.resources.ResourcesPlugin; -import org.eclipse.jface.window.Window; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.ui.dialogs.ListDialog; -import org.eclipse.ui.model.WorkbenchContentProvider; -import org.eclipse.ui.model.WorkbenchLabelProvider; - -public class CoreIProjectComposite extends AbstractIResourceComposite<IProject> { - - public CoreIProjectComposite(final Composite parent) { - super(parent); - } - - public CoreIProjectComposite(final Composite parent, final int style) { - super(parent, style); - } - - @Override - public IProject getValue() { - IResource member = ResourcesPlugin.getWorkspace().getRoot().findMember(getText().getText()); - if (member instanceof IProject) { - return (IProject) member; - } - return null; - } - - @Override - protected final void browseResource() { - - WorkbenchContentProvider projectsContentProvider = new WorkbenchContentProvider() { - @Override - public Object[] getChildren(final Object element) { - if (!(element instanceof IWorkspace)) { - return new Object[0]; - } - IProject[] projects = ((IWorkspace) element).getRoot().getProjects(); - if (projects == null) { - return new Object[0]; - } - return projects; - } - }; - - ListDialog dialog = new ListDialog(getShell()); - dialog.setContentProvider(projectsContentProvider); - dialog.setLabelProvider(new WorkbenchLabelProvider()); - dialog.setInput(ResourcesPlugin.getWorkspace()); - // TODO: externalize string - dialog.setMessage("Please select a project"); //$NON-NLS-1$ - // TODO: externalize string - dialog.setTitle("Select Project"); //$NON-NLS-1$ - int code = dialog.open(); - if (code == Window.OK) { - Object[] result = dialog.getResult(); - if (result.length == 1) { - IProject selectedProject = (IProject) result[0]; - setValue(selectedProject); - fireCommit(); - } - } - } -}
diff --git a/org.eclipse.modisco.facet.widgets.celleditors/src/org/eclipse/emf/facet/widgets/celleditors/internal/core/composite/CoreIResourceComposite.java b/org.eclipse.modisco.facet.widgets.celleditors/src/org/eclipse/emf/facet/widgets/celleditors/internal/core/composite/CoreIResourceComposite.java deleted file mode 100644 index 0af9a73..0000000 --- a/org.eclipse.modisco.facet.widgets.celleditors/src/org/eclipse/emf/facet/widgets/celleditors/internal/core/composite/CoreIResourceComposite.java +++ /dev/null
@@ -1,55 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2011 Mia-Software. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Nicolas Bros (Mia-Software) - initial API and implementation - * Nicolas Guyomar (Mia-Software) - Bug 334546 - [celleditors] no border on Text field - * Nicolas Bros (Mia-Software) - Bug 339664 - org.eclipse.emf.facet.widgets.celleditors API cleaning - *******************************************************************************/ -package org.eclipse.emf.facet.widgets.celleditors.internal.core.composite; - -import org.eclipse.core.resources.IResource; -import org.eclipse.core.resources.ResourcesPlugin; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.ui.dialogs.ElementTreeSelectionDialog; -import org.eclipse.ui.model.WorkbenchContentProvider; -import org.eclipse.ui.model.WorkbenchLabelProvider; - -public class CoreIResourceComposite extends AbstractIResourceComposite<IResource> { - - public CoreIResourceComposite(final Composite parent) { - super(parent); - } - - public CoreIResourceComposite(final Composite parent, final int style) { - super(parent, style); - } - - @Override - public IResource getValue() { - return ResourcesPlugin.getWorkspace().getRoot().findMember(getText().getText()); - } - - @Override - protected final void browseResource() { - ElementTreeSelectionDialog elementTreeSelectionDialog = new ElementTreeSelectionDialog( - getShell(), new WorkbenchLabelProvider(), new WorkbenchContentProvider()); - elementTreeSelectionDialog.setInput(ResourcesPlugin.getWorkspace().getRoot()); - elementTreeSelectionDialog.setMessage("Select a resource"); //$NON-NLS-1$ - elementTreeSelectionDialog.setAllowMultiple(false); - elementTreeSelectionDialog.setDoubleClickSelects(true); - elementTreeSelectionDialog.open(); - Object result = elementTreeSelectionDialog.getFirstResult(); - - if (result != null && result instanceof IResource) { - IResource selectedResource = (IResource) result; - setValue(selectedResource); - fireCommit(); - } - } - -}
diff --git a/org.eclipse.modisco.facet.widgets.celleditors/src/org/eclipse/emf/facet/widgets/celleditors/internal/core/composite/EnumComposite.java b/org.eclipse.modisco.facet.widgets.celleditors/src/org/eclipse/emf/facet/widgets/celleditors/internal/core/composite/EnumComposite.java deleted file mode 100644 index c8fb20a..0000000 --- a/org.eclipse.modisco.facet.widgets.celleditors/src/org/eclipse/emf/facet/widgets/celleditors/internal/core/composite/EnumComposite.java +++ /dev/null
@@ -1,133 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2010 CEA LIST. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Gregoire Dupe (Mia-Software) - initial API and implementation - * Nicolas Bros (Mia-Software) - Bug 339664 - org.eclipse.emf.facet.widgets.celleditors API cleaning - * Nicolas Bros (Mia-Software) - Bug 334539 - [celleditors] change listener - * Gregoire Dupe (Mia-Software) - Bug 344563 - NPE with Enum Editor - * Nicolas Guyomar (Mia-Software) - Bug 344563 - NPE with Enum Editor - *****************************************************************************/ -package org.eclipse.emf.facet.widgets.celleditors.internal.core.composite; - -import org.eclipse.emf.facet.util.core.Logger; -import org.eclipse.emf.facet.widgets.celleditors.AbstractCellEditorComposite; -import org.eclipse.emf.facet.widgets.celleditors.internal.Activator; -import org.eclipse.swt.SWT; -import org.eclipse.swt.events.DisposeEvent; -import org.eclipse.swt.events.DisposeListener; -import org.eclipse.swt.events.KeyAdapter; -import org.eclipse.swt.events.KeyEvent; -import org.eclipse.swt.events.SelectionAdapter; -import org.eclipse.swt.events.SelectionEvent; -import org.eclipse.swt.layout.FillLayout; -import org.eclipse.swt.widgets.Combo; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Control; -import org.eclipse.swt.widgets.Display; -import org.eclipse.swt.widgets.Event; -import org.eclipse.swt.widgets.Listener; - -public abstract class EnumComposite<T> extends AbstractCellEditorComposite<T> { - - /** the control that is used to edit the contents of the cell */ - private Combo combo = null; - - private final Composite parentControl; - - private T lastValue; - - public EnumComposite(final Composite parent) { - super(parent); - setLayout(new FillLayout()); - this.parentControl = parent; - this.combo = new Combo(this, SWT.NONE); - final Listener clickListener = new Listener() { - public void handleEvent(final Event event) { - if (event.widget instanceof Control) { - Control control = (Control) event.widget; - if (control.getShell() == EnumComposite.this.getParentControl().getShell()) { - if (event.widget != EnumComposite.this.getCombo()) { - EnumComposite.this.commit(); - } - } - } - } - }; - - this.combo.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(final SelectionEvent e) { - fireChanged(); - } - }); - - this.combo.addKeyListener(new KeyAdapter() { - @Override - public void keyPressed(final KeyEvent event) { - // Enter key pressed - if ((event.keyCode == SWT.CR && event.stateMask == 0) - || (event.keyCode == SWT.KEYPAD_CR && event.stateMask == 0)) { - commit(); - } else if (event.keyCode == SWT.ESC && event.stateMask == 0) { - // Escape key pressed - close(); - } - } - }); - - Display.getDefault().addFilter(SWT.MouseDown, clickListener); - // this listener is only here to remove - // the other listener from the Display - addDisposeListener(new DisposeListener() { - public void widgetDisposed(final DisposeEvent e) { - Display.getDefault().removeFilter(SWT.MouseDown, clickListener); - } - }); - - this.combo.forceFocus(); - } - - protected void commit() { - fireCommit(); - } - - public void setValue(final T value) { - this.lastValue = value; - if (value == null) { - this.combo.setText(""); //$NON-NLS-1$ - } else { - String strValue = getEnumString(value); - this.combo.setText(strValue); - } - } - - public T getValue() { - try { - this.lastValue = this.getEnumValue(this.combo.getText()); - } catch (Exception e) { - Logger.logError(e, Activator.getDefault()); - } - return this.lastValue; - } - - protected abstract T getEnumValue(String text); - - protected abstract String getEnumString(T value); - - protected abstract String[] getEnumStrings(); - - public Combo getCombo() { - return this.combo; - } - - protected Composite getParentControl() { - return this.parentControl; - } - -}
diff --git a/org.eclipse.modisco.facet.widgets.celleditors/src/org/eclipse/emf/facet/widgets/celleditors/internal/core/composite/EnumeratorComposite.java b/org.eclipse.modisco.facet.widgets.celleditors/src/org/eclipse/emf/facet/widgets/celleditors/internal/core/composite/EnumeratorComposite.java deleted file mode 100644 index 6e34da6..0000000 --- a/org.eclipse.modisco.facet.widgets.celleditors/src/org/eclipse/emf/facet/widgets/celleditors/internal/core/composite/EnumeratorComposite.java +++ /dev/null
@@ -1,67 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2010 CEA LIST. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Gregoire Dupe (Mia-Software) - initial API and implementation - * Nicolas Bros (Mia-Software) - Bug 339664 - org.eclipse.emf.facet.widgets.celleditors API cleaning - * Gregoire Dupe (Mia-Software) - Bug 344563 - NPE with Enum Editor - *****************************************************************************/ -package org.eclipse.emf.facet.widgets.celleditors.internal.core.composite; - -import java.util.ArrayList; -import java.util.List; - -import org.eclipse.emf.common.util.Enumerator; -import org.eclipse.emf.ecore.EEnum; -import org.eclipse.emf.ecore.EEnumLiteral; -import org.eclipse.swt.widgets.Composite; - -public class EnumeratorComposite<T extends Enumerator> extends EnumComposite<T> { - - public EnumeratorComposite(final Composite parent) { - super(parent); - - } - - private EEnum eenum = null; - - public void setEEnum(final EEnum eenum2) { - this.eenum = eenum2; - getCombo().setItems(getEnumStrings()); - } - - @SuppressWarnings("unchecked") - @Override - protected T getEnumValue(final String text) { - if (this.eenum.getEEnumLiteralByLiteral(text) == null) { - throw new RuntimeException("Invalid enumeration literal"); //$NON-NLS-1$ - } - Object result = this.eenum.getEPackage().getEFactoryInstance() - .createFromString(this.eenum, this.eenum.getEEnumLiteralByLiteral(text).getName()); - if (result instanceof Enumerator) { - return (T) result; - } - return null; - } - - @Override - public String getEnumString(final T value) { - return value.getLiteral(); - } - - @Override - protected String[] getEnumStrings() { - List<String> result = new ArrayList<String>(); - if (this.eenum != null) { - for (EEnumLiteral eeNumLiteral : this.eenum.getELiterals()) { - result.add(eeNumLiteral.getLiteral()); - } - } - return result.toArray(new String[] {}); - } -}
diff --git a/org.eclipse.modisco.facet.widgets.celleditors/src/org/eclipse/emf/facet/widgets/celleditors/internal/core/composite/UnaryReferenceCellEditorComposite.java b/org.eclipse.modisco.facet.widgets.celleditors/src/org/eclipse/emf/facet/widgets/celleditors/internal/core/composite/UnaryReferenceCellEditorComposite.java deleted file mode 100644 index 8a904f8..0000000 --- a/org.eclipse.modisco.facet.widgets.celleditors/src/org/eclipse/emf/facet/widgets/celleditors/internal/core/composite/UnaryReferenceCellEditorComposite.java +++ /dev/null
@@ -1,251 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2010 CEA LIST. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Nicolas Bros (Mia-Software) - initial API and implementation - * Nicolas Guyomar (Mia-Software) - initial API and implementation - * Nicolas Bros (Mia-Software) - Bug 339664 - org.eclipse.emf.facet.widgets.celleditors API cleaning - * Nicolas Bros (Mia-Software) - Bug 334539 - [celleditors] change listener - * Grégoire Dupé (Mia-Software) - Bug 424122 - [Table] Images, fonts and colors are not shared between the instances of table - *****************************************************************************/ -package org.eclipse.emf.facet.widgets.celleditors.internal.core.composite; - -import java.util.Collection; -import java.util.List; -import java.util.Map; -import java.util.Map.Entry; -import java.util.Set; -import java.util.TreeMap; - -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.facet.util.swt.fontprovider.IFontProvider; -import org.eclipse.emf.facet.util.swt.fontprovider.IFontProviderFactory; -import org.eclipse.emf.facet.widgets.celleditors.AbstractCellEditorComposite; -import org.eclipse.emf.facet.widgets.celleditors.internal.Messages; -import org.eclipse.emf.facet.widgets.internal.CustomizableLabelProvider; -import org.eclipse.jface.dialogs.MessageDialog; -import org.eclipse.jface.fieldassist.ComboContentAdapter; -import org.eclipse.jface.fieldassist.ContentProposalAdapter; -import org.eclipse.jface.fieldassist.SimpleContentProposalProvider; -import org.eclipse.swt.SWT; -import org.eclipse.swt.events.DisposeEvent; -import org.eclipse.swt.events.DisposeListener; -import org.eclipse.swt.events.KeyAdapter; -import org.eclipse.swt.events.KeyEvent; -import org.eclipse.swt.events.ModifyEvent; -import org.eclipse.swt.events.ModifyListener; -import org.eclipse.swt.events.SelectionAdapter; -import org.eclipse.swt.events.SelectionEvent; -import org.eclipse.swt.graphics.Font; -import org.eclipse.swt.graphics.FontData; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.layout.GridLayout; -import org.eclipse.swt.widgets.Button; -import org.eclipse.swt.widgets.Combo; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Control; -import org.eclipse.swt.widgets.Display; -import org.eclipse.swt.widgets.Event; -import org.eclipse.swt.widgets.Listener; -import org.eclipse.ui.dialogs.ElementListSelectionDialog; - -/** A cell editor for unary references */ -public class UnaryReferenceCellEditorComposite extends AbstractCellEditorComposite<EObject> { - - private static final int GRID_DATA_HEIGHT = 50; - private final Button button; - private final Combo combo; - private final Control parentControl; - private final Map<String, EObject> fElements = new TreeMap<String, EObject>(); - - /** - * @param parent - * the parent composite - * @param eObjects - * the possible choices - */ - public UnaryReferenceCellEditorComposite(final Composite parent, final List<EObject> eObjects) { - super(parent); - this.parentControl = parent; - - CustomizableLabelProvider customizableLabelProvider = new CustomizableLabelProvider(); - for (EObject eObject : eObjects) { - String label = customizableLabelProvider.getText(eObject); - // find a unique label - if (this.fElements.get(label) != null) { - int suffix = 2; - while (this.fElements.get(label + " (" + suffix + ")") != null) { //$NON-NLS-1$ //$NON-NLS-2$ - suffix++; - } - this.fElements.put(label + " (" + suffix + ")", eObject); //$NON-NLS-1$//$NON-NLS-2$ - } else { - this.fElements.put(label, eObject); - } - } - - GridLayout compositeLayout = new GridLayout(2, false); - compositeLayout.marginHeight = 0; - compositeLayout.marginWidth = 0; - compositeLayout.horizontalSpacing = 0; - setLayout(compositeLayout); - - this.combo = new Combo(this, SWT.DROP_DOWN); - // reduce the font so that the Combo fits in the cell - FontData[] fontData = Display.getDefault().getSystemFont().getFontData(); - fontData[0].setHeight(fontData[0].getHeight() - 2); - final IFontProvider fontProvider = IFontProviderFactory.DEFAULT - .getOrCreateIFontProvider(Display.getDefault()); - final Font font = fontProvider.getFont(fontData[0]); - this.combo.setFont(font); - for (String label : this.fElements.keySet()) { - this.combo.add(label); - } - GridData comboGridData = new GridData(SWT.FILL, SWT.FILL, true, true); - this.combo.setLayoutData(comboGridData); - addCompletionHandler(this.combo, this.fElements.keySet()); - - this.combo.addKeyListener(new KeyAdapter() { - @Override - public void keyPressed(final KeyEvent event) { - // Enter key pressed - if ((event.keyCode == SWT.CR && event.stateMask == 0) - || (event.keyCode == SWT.KEYPAD_CR && event.stateMask == 0)) { - if (isValid()) { - commit(); - } else { - MessageDialog.openWarning(parent.getShell(), - Messages.UnaryReferenceCellEditorComposite_0, - Messages.UnaryReferenceCellEditorComposite_1); - } - } else if (event.keyCode == SWT.ESC && event.stateMask == 0) { - // Escape key pressed - close(); - } - } - }); - - this.button = new Button(this, SWT.PUSH); - this.button.setText("..."); //$NON-NLS-1$ - GridData buttonGridData = new GridData(SWT.FILL, SWT.FILL, false, true); - buttonGridData.heightHint = UnaryReferenceCellEditorComposite.GRID_DATA_HEIGHT; - this.button.setLayoutData(buttonGridData); - this.button.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(final SelectionEvent e) { - ElementListSelectionDialog dialog = new ElementListSelectionDialog( - UnaryReferenceCellEditorComposite.this.getParentControl().getShell(), - new CustomizableLabelProvider()) { - @Override - protected void okPressed() { - Object[] selectedElements = getSelectedElements(); - String selectedElementLabel = null; - if (selectedElements.length > 0) { - Set<Entry<String, EObject>> entrySet = UnaryReferenceCellEditorComposite.this - .getfElements().entrySet(); - for (Entry<String, EObject> entry : entrySet) { - if (entry.getValue() == selectedElements[0]) { - selectedElementLabel = entry.getKey(); - break; - } - } - } - UnaryReferenceCellEditorComposite.this.getCombo().setText( - selectedElementLabel); - commit(); - super.okPressed(); - } - }; - dialog.setTitle(Messages.UnaryReferenceCellEditorComposite_2); - dialog.setElements(eObjects.toArray()); - dialog.open(); - } - }); - - // commit the cell editor when the mouse is clicked - // anywhere outside the text field - final Listener clickListener = new Listener() { - public void handleEvent(final Event event) { - if (event.widget instanceof Control) { - Control control = (Control) event.widget; - if (control.getShell() == UnaryReferenceCellEditorComposite.this - .getParentControl().getShell() - && event.widget != UnaryReferenceCellEditorComposite.this.getButton() - && event.widget != UnaryReferenceCellEditorComposite.this.getCombo()) { - if (isValid()) { - commit(); - } - } - } - - } - }; - Display.getDefault().addFilter(SWT.MouseDown, clickListener); - - // this listener is only here to remove - // the other listener from the Display - addDisposeListener(new DisposeListener() { - public void widgetDisposed(final DisposeEvent e) { - Display.getDefault().removeFilter(SWT.MouseDown, clickListener); - } - }); - - this.combo.addModifyListener(new ModifyListener() { - public void modifyText(final ModifyEvent e) { - fireChanged(); - } - }); - - this.combo.forceFocus(); - } - - protected boolean isValid() { - return this.fElements.get(this.combo.getText()) != null; - } - - private static void addCompletionHandler(final Combo comboBox, final Collection<String> completions) { - String[] completionsArray = completions.toArray(new String[completions.size()]); - SimpleContentProposalProvider contentProposalProvider = new SimpleContentProposalProvider( - completionsArray); - contentProposalProvider.setFiltering(true); - ContentProposalAdapter adapter = new ContentProposalAdapter(comboBox, - new ComboContentAdapter(), contentProposalProvider, null, null); - // adapter.setFilterStyle(ContentProposalAdapter.FILTER_CHARACTER); - adapter.setProposalAcceptanceStyle(ContentProposalAdapter.PROPOSAL_REPLACE); - - } - - public EObject getValue() { - EObject eObject = this.fElements.get(this.combo.getText()); - return eObject; - } - - protected void commit() { - fireCommit(); - } - - public void setValue(final EObject value) { - // - } - - protected Button getButton() { - return this.button; - } - - protected Combo getCombo() { - return this.combo; - } - - protected Control getParentControl() { - return this.parentControl; - } - - protected Map<String, EObject> getfElements() { - return this.fElements; - } - -}
diff --git a/org.eclipse.modisco.facet.widgets.celleditors/src/org/eclipse/emf/facet/widgets/celleditors/internal/core/composite/factories/CoreIFileCompositeFactory.java b/org.eclipse.modisco.facet.widgets.celleditors/src/org/eclipse/emf/facet/widgets/celleditors/internal/core/composite/factories/CoreIFileCompositeFactory.java deleted file mode 100644 index b3668a1..0000000 --- a/org.eclipse.modisco.facet.widgets.celleditors/src/org/eclipse/emf/facet/widgets/celleditors/internal/core/composite/factories/CoreIFileCompositeFactory.java +++ /dev/null
@@ -1,30 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2011 Mia-Software. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Nicolas Bros (Mia-Software) - initial API and implementation - * Nicolas Guyomar (Mia-Software) - Bug 334546 - [celleditors] no border on Text field - * Nicolas Bros (Mia-Software) - Bug 338437 - compositeEditors extension point cannot be used to register user types - *******************************************************************************/ -package org.eclipse.emf.facet.widgets.celleditors.internal.core.composite.factories; - -import org.eclipse.core.resources.IFile; -import org.eclipse.emf.facet.widgets.celleditors.AbstractCellEditorComposite; -import org.eclipse.emf.facet.widgets.celleditors.ICompositeEditorFactory; -import org.eclipse.emf.facet.widgets.celleditors.internal.core.composite.CoreIFileComposite; -import org.eclipse.swt.widgets.Composite; - -public class CoreIFileCompositeFactory implements ICompositeEditorFactory<IFile> { - - public Class<IFile> getHandledType() { - return IFile.class; - } - - public AbstractCellEditorComposite<IFile> createCompositeEditor(final Composite parent, final int style) { - return new CoreIFileComposite(parent, style); - } -} \ No newline at end of file
diff --git a/org.eclipse.modisco.facet.widgets.celleditors/src/org/eclipse/emf/facet/widgets/celleditors/internal/core/composite/factories/CoreIProjectCompositeFactory.java b/org.eclipse.modisco.facet.widgets.celleditors/src/org/eclipse/emf/facet/widgets/celleditors/internal/core/composite/factories/CoreIProjectCompositeFactory.java deleted file mode 100644 index 2ca88a1..0000000 --- a/org.eclipse.modisco.facet.widgets.celleditors/src/org/eclipse/emf/facet/widgets/celleditors/internal/core/composite/factories/CoreIProjectCompositeFactory.java +++ /dev/null
@@ -1,28 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2011 Mia-Software. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Nicolas Bros (Mia-Software) - Bug 342548 - [Java Discovery] Illegal parameter initializer for ELEMENTS_TO_ANALYZE - *******************************************************************************/ -package org.eclipse.emf.facet.widgets.celleditors.internal.core.composite.factories; - -import org.eclipse.core.resources.IProject; -import org.eclipse.emf.facet.widgets.celleditors.AbstractCellEditorComposite; -import org.eclipse.emf.facet.widgets.celleditors.ICompositeEditorFactory; -import org.eclipse.emf.facet.widgets.celleditors.internal.core.composite.CoreIProjectComposite; -import org.eclipse.swt.widgets.Composite; - -public class CoreIProjectCompositeFactory implements ICompositeEditorFactory<IProject> { - - public Class<IProject> getHandledType() { - return IProject.class; - } - - public AbstractCellEditorComposite<IProject> createCompositeEditor(final Composite parent, final int style) { - return new CoreIProjectComposite(parent, style); - } -} \ No newline at end of file
diff --git a/org.eclipse.modisco.facet.widgets.celleditors/src/org/eclipse/emf/facet/widgets/celleditors/internal/core/composite/factories/CoreIResourceCompositeFactory.java b/org.eclipse.modisco.facet.widgets.celleditors/src/org/eclipse/emf/facet/widgets/celleditors/internal/core/composite/factories/CoreIResourceCompositeFactory.java deleted file mode 100644 index 8880dae..0000000 --- a/org.eclipse.modisco.facet.widgets.celleditors/src/org/eclipse/emf/facet/widgets/celleditors/internal/core/composite/factories/CoreIResourceCompositeFactory.java +++ /dev/null
@@ -1,30 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2011 Mia-Software. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Nicolas Bros (Mia-Software) - initial API and implementation - * Nicolas Guyomar (Mia-Software) - Bug 334546 - [celleditors] no border on Text field - * Nicolas Bros (Mia-Software) - Bug 338437 - compositeEditors extension point cannot be used to register user types - *******************************************************************************/ -package org.eclipse.emf.facet.widgets.celleditors.internal.core.composite.factories; - -import org.eclipse.core.resources.IResource; -import org.eclipse.emf.facet.widgets.celleditors.AbstractCellEditorComposite; -import org.eclipse.emf.facet.widgets.celleditors.ICompositeEditorFactory; -import org.eclipse.emf.facet.widgets.celleditors.internal.core.composite.CoreIResourceComposite; -import org.eclipse.swt.widgets.Composite; - -public class CoreIResourceCompositeFactory implements ICompositeEditorFactory<IResource> { - public Class<IResource> getHandledType() { - return IResource.class; - } - - public AbstractCellEditorComposite<IResource> createCompositeEditor(final Composite parent, - final int style) { - return new CoreIResourceComposite(parent, style); - } -} \ No newline at end of file
diff --git a/org.eclipse.modisco.facet.widgets.celleditors/src/org/eclipse/emf/facet/widgets/celleditors/internal/ui/AbstractNaryEditingDialog.java b/org.eclipse.modisco.facet.widgets.celleditors/src/org/eclipse/emf/facet/widgets/celleditors/internal/ui/AbstractNaryEditingDialog.java deleted file mode 100644 index 59d3d61..0000000 --- a/org.eclipse.modisco.facet.widgets.celleditors/src/org/eclipse/emf/facet/widgets/celleditors/internal/ui/AbstractNaryEditingDialog.java +++ /dev/null
@@ -1,139 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2011 CEA LIST. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Nicolas Guyomar (Mia-Software) - Bug 342451 - To be able to edit derived facet attributes and derived facet references in a table - *******************************************************************************/ -package org.eclipse.emf.facet.widgets.celleditors.internal.ui; - -import java.util.ArrayList; -import java.util.List; - -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.EStructuralFeature; -import org.eclipse.emf.facet.widgets.celleditors.IModelCellEditHandler; -import org.eclipse.jface.dialogs.Dialog; -import org.eclipse.jface.viewers.ISelection; -import org.eclipse.jface.viewers.IStructuredContentProvider; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.jface.viewers.StructuredSelection; -import org.eclipse.jface.viewers.Viewer; -import org.eclipse.swt.widgets.Shell; - -public abstract class AbstractNaryEditingDialog<T extends Object> extends Dialog { - - public static final int AVAILABLE_VALUES_TREE_WIDTH = 200; - public static final int AVAILABLE_VALUES_TREE_HEIGHT = 250; - - private final List<T> values; - private final IModelCellEditHandler editHandler; - private final EObject eObject; - private final EStructuralFeature feature; - - protected AbstractNaryEditingDialog(final Shell shell, final List<T> values, - final IModelCellEditHandler editHandler, final EObject eObject, - final EStructuralFeature feature) { - super(shell); - this.values = new ArrayList<T>(values); - this.feature = feature; - this.editHandler = editHandler; - this.eObject = eObject; - } - - public class AssignedValuesContentProvider implements IStructuredContentProvider { - public Object[] getElements(final Object inputElement) { - if (inputElement instanceof FeatureValuesInput) { - FeatureValuesInput valuesInput = (FeatureValuesInput) inputElement; - EObject source = valuesInput.getSource(); - List<?> list = (List<?>) source.eGet(valuesInput.getFeature()); - if (list == null) { - return new Object[0]; - } - return list.toArray(); - } else if (inputElement instanceof List<?>) { - return ((List<?>) inputElement).toArray(); - } - throw new IllegalArgumentException(FeatureValuesInput.class.getSimpleName() - + " expected"); //$NON-NLS-1$ - } - - public void dispose() { - // - } - - public void inputChanged(final Viewer viewer, final Object oldInput, final Object newInput) { - // - } - } - - public List<T> getValue() { - return this.values; - } - - @SuppressWarnings("unchecked") // type erasure on generic - public void upButtonClicked() { - final IStructuredSelection selection = (IStructuredSelection) getSelection(); - - int minIndex = 0; - for (Object element : selection.toList()) { - final int index = this.values.indexOf(element); - T object = this.values.set(Math.max(index - 1, minIndex++), (T) element); - this.values.set(index, object); - } - refresh(); - } - - @SuppressWarnings("unchecked") // type erasure on generic - public void downButtonClicked() { - final IStructuredSelection selection = (StructuredSelection) getSelection(); - - List<?> selectionList = selection.toList(); - boolean canMove = !selectionList.contains(this.values.get(this.values.size() - 1)); - for (int i = this.values.size() - 2; i >= 0; i--) { - final Object selectedObject = this.values.get(i); - if (selectionList.contains(selectedObject)) { - if (canMove) { - T object = this.values.set(i + 1, (T) selectedObject); - this.values.set(i, object); - } - } else { - canMove = true; - } - - } - - refresh(); - } - - public abstract ISelection getSelection(); - - public abstract void refresh(); - - @Override - protected void okPressed() { - super.okPressed(); - this.editHandler.commit(); - } - - protected List<T> getValues() { - return this.values; - } - - protected IModelCellEditHandler getEditHandler() { - return this.editHandler; - } - - protected EObject geteObject() { - return this.eObject; - } - - protected EStructuralFeature getFeature() { - return this.feature; - } - -}
diff --git a/org.eclipse.modisco.facet.widgets.celleditors/src/org/eclipse/emf/facet/widgets/celleditors/internal/ui/AssignableValuesContentProvider.java b/org.eclipse.modisco.facet.widgets.celleditors/src/org/eclipse/emf/facet/widgets/celleditors/internal/ui/AssignableValuesContentProvider.java deleted file mode 100644 index 4800e13..0000000 --- a/org.eclipse.modisco.facet.widgets.celleditors/src/org/eclipse/emf/facet/widgets/celleditors/internal/ui/AssignableValuesContentProvider.java +++ /dev/null
@@ -1,82 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010, 2011 CEA LIST. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Nicolas Bros (Mia-Software) - initial API and implementation - * Nicolas Guyomar (Mia-Software) - Bug 342451 - To be able to edit derived facet attributes and derived facet references in a table - *******************************************************************************/ -package org.eclipse.emf.facet.widgets.celleditors.internal.ui; - -import java.util.ArrayList; -import java.util.List; - -import org.eclipse.emf.common.notify.Notifier; -import org.eclipse.emf.common.util.TreeIterator; -import org.eclipse.emf.ecore.EClassifier; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.EStructuralFeature; -import org.eclipse.emf.ecore.resource.Resource; -import org.eclipse.emf.ecore.resource.ResourceSet; -import org.eclipse.jface.viewers.ITreeContentProvider; -import org.eclipse.jface.viewers.Viewer; - -public class AssignableValuesContentProvider implements ITreeContentProvider { - public Object[] getElements(final Object inputElement) { - if (inputElement instanceof FeatureValuesInput) { - FeatureValuesInput assignableValuesInput = (FeatureValuesInput) inputElement; - EStructuralFeature feature = assignableValuesInput.getFeature(); - EClassifier eType = feature.getEType(); - EObject source = assignableValuesInput.getSource(); - List<?> featureValues = (List<?>) source.eGet(feature); - - // build a list of EObjects assignable to the EReference - List<EObject> list = new ArrayList<EObject>(); - Resource eResource = source.eResource(); - if (eResource == null) { - return new Object[0]; - } - ResourceSet resourceSet = eResource.getResourceSet(); - TreeIterator<Notifier> allContents = resourceSet.getAllContents(); - while (allContents.hasNext()) { - Notifier notifier = allContents.next(); - if (notifier instanceof EObject) { - EObject eObject = (EObject) notifier; - if (eType.isInstance(eObject) - && (!feature.isUnique() || !(featureValues != null && featureValues - .contains(eObject)))) { - list.add(eObject); - } - } - } - return list.toArray(); - } else if (inputElement instanceof List<?>) { - return ((List<?>) inputElement).toArray(); - } - throw new IllegalArgumentException(FeatureValuesInput.class.getSimpleName() + " expected"); //$NON-NLS-1$ - } - - public void dispose() { - // - } - - public void inputChanged(final Viewer viewer, final Object oldInput, final Object newInput) { - // - } - - public Object[] getChildren(final Object parentElement) { - return null; - } - - public Object getParent(final Object element) { - return null; - } - - public boolean hasChildren(final Object element) { - return false; - } -} \ No newline at end of file
diff --git a/org.eclipse.modisco.facet.widgets.celleditors/src/org/eclipse/emf/facet/widgets/celleditors/internal/ui/EditingUtils.java b/org.eclipse.modisco.facet.widgets.celleditors/src/org/eclipse/emf/facet/widgets/celleditors/internal/ui/EditingUtils.java deleted file mode 100644 index c808082..0000000 --- a/org.eclipse.modisco.facet.widgets.celleditors/src/org/eclipse/emf/facet/widgets/celleditors/internal/ui/EditingUtils.java +++ /dev/null
@@ -1,84 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 CEA LIST. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Nicolas Bros (Mia-Software) - initial API and implementation - *******************************************************************************/ -package org.eclipse.emf.facet.widgets.celleditors.internal.ui; - -import java.util.Collection; -import java.util.List; - -import org.eclipse.emf.common.command.Command; -import org.eclipse.emf.common.command.CompoundCommand; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.EStructuralFeature; -import org.eclipse.emf.edit.domain.EditingDomain; -import org.eclipse.emf.facet.widgets.celleditors.ICommandFactory; - -public final class EditingUtils { - private EditingUtils() { - // - } - - public static void moveElementsUp(final EObject eObject, final EStructuralFeature feature, - final Collection<Object> elements, final ICommandFactory commandFactory, - final EditingDomain editingDomain) { - CompoundCommand compoundCommand = new CompoundCommand(); - - List<?> list = (List<?>) eObject.eGet(feature); - - int minIndex = 0; - for (Object element : elements) { - final int index = list.indexOf(element); - - Command moveCommand = commandFactory.createMoveCommand(editingDomain, eObject, feature, - element, Math.max(index - 1, minIndex++)); - compoundCommand.append(moveCommand); - } - editingDomain.getCommandStack().execute(compoundCommand); - // int[] selectionIndices; - // Arrays.sort(selectionIndices); - // CompoundCommand compoundCommand = new CompoundCommand(); - // int minIndex = 0; - // for(int index : selectionIndices) { - // Command moveCommand = MoveCommand.create(editingDomain, - // eObject,feature, index, Math.max(index - 1, - // minIndex++)); - // compoundCommand.append(moveCommand); - // } - // editingDomain.getCommandStack().execute(compoundCommand); - } - - public static void moveElementsDown(final EObject eObject, final EStructuralFeature feature, - final Collection<Object> elements, final ICommandFactory commandFactory, - final EditingDomain editingDomain) { - Object value = eObject.eGet(feature); - List<?> list = (List<?>) value; - - CompoundCommand compoundCommand = new CompoundCommand(); - - // prevent the last two elements from swapping - boolean canMove = !elements.contains(list.get(list.size() - 1)); - for (int i = list.size() - 2; i >= 0; i--) { - final Object selectedObject = list.get(i); - if (elements.contains(selectedObject)) { - if (canMove) { - Command moveCommand = commandFactory.createMoveCommand(editingDomain, eObject, - feature, selectedObject, i + 1); - compoundCommand.append(moveCommand); - } - } else { - canMove = true; - } - - } - editingDomain.getCommandStack().execute(compoundCommand); - } - -}
diff --git a/org.eclipse.modisco.facet.widgets.celleditors/src/org/eclipse/emf/facet/widgets/celleditors/internal/ui/FeatureValuesInput.java b/org.eclipse.modisco.facet.widgets.celleditors/src/org/eclipse/emf/facet/widgets/celleditors/internal/ui/FeatureValuesInput.java deleted file mode 100644 index a5cafce..0000000 --- a/org.eclipse.modisco.facet.widgets.celleditors/src/org/eclipse/emf/facet/widgets/celleditors/internal/ui/FeatureValuesInput.java +++ /dev/null
@@ -1,33 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 CEA LIST. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Nicolas Bros (Mia-Software) - initial API and implementation - *******************************************************************************/ -package org.eclipse.emf.facet.widgets.celleditors.internal.ui; - -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.EStructuralFeature; - -public class FeatureValuesInput { - private final EStructuralFeature feature; - private final EObject source; - - public FeatureValuesInput(final EStructuralFeature feature, final EObject source) { - this.feature = feature; - this.source = source; - } - - public EStructuralFeature getFeature() { - return this.feature; - } - - public EObject getSource() { - return this.source; - } -} \ No newline at end of file
diff --git a/org.eclipse.modisco.facet.widgets.celleditors/src/org/eclipse/emf/facet/widgets/celleditors/internal/ui/ModelCellsEditingSupport.java b/org.eclipse.modisco.facet.widgets.celleditors/src/org/eclipse/emf/facet/widgets/celleditors/internal/ui/ModelCellsEditingSupport.java deleted file mode 100644 index 96e787a..0000000 --- a/org.eclipse.modisco.facet.widgets.celleditors/src/org/eclipse/emf/facet/widgets/celleditors/internal/ui/ModelCellsEditingSupport.java +++ /dev/null
@@ -1,130 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010, 2011 CEA LIST. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Nicolas Bros (Mia-Software) - initial API and implementation - * Nicolas Guyomar (Mia-Software) - Bug 339554 - org.eclipse.emf.facet.widgets.celleditors API cleaning - * Nicolas Bros (Mia-Software) - Bug 339855 - ModelCellEditor class should not be exposed - * Nicolas Guyomar (Mia-Software) - Bug 342451 - To be able to edit derived facet attributes and derived facet references in a table - *******************************************************************************/ -package org.eclipse.emf.facet.widgets.celleditors.internal.ui; - -import java.util.List; - -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.EStructuralFeature; -import org.eclipse.emf.facet.widgets.celleditors.ICellEditorsRegistry; -import org.eclipse.emf.facet.widgets.celleditors.IModelCellEditHandler; -import org.eclipse.emf.facet.widgets.celleditors.IModelCellEditor; -import org.eclipse.jface.viewers.CellEditor; -import org.eclipse.jface.viewers.ColumnViewer; -import org.eclipse.jface.viewers.EditingSupport; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Control; - -public class ModelCellsEditingSupport<T> extends EditingSupport { - - private final EStructuralFeature feature; - private final IModelCellEditor cellEditor; - private final EObject eObject; - private final ColumnViewer columnViewer; - private final Object newValuePlaceholder; - private List<T> values; - - public ModelCellsEditingSupport(final ColumnViewer columnViewer, - final EStructuralFeature feature, final EObject eObject, - final Object newValuePlaceholder, final List<T> values) { - super(columnViewer); - this.columnViewer = columnViewer; - this.feature = feature; - this.eObject = eObject; - this.values = values; - this.newValuePlaceholder = newValuePlaceholder; - this.cellEditor = ICellEditorsRegistry.INSTANCE.getCellEditorFor(this.feature.getEType()); - if (this.cellEditor == null) { - throw new IllegalStateException( - "no cell editor found for " + this.feature.getEType().getName()); //$NON-NLS-1$ - } - } - - @Override - protected CellEditor getCellEditor(final Object element) { - return new CellEditor((Composite) this.columnViewer.getControl()) { - - private Control control; - - @Override - protected void doSetValue(final Object value) { - // - } - - @Override - protected void doSetFocus() { - this.control.setFocus(); - } - - @Override - protected Object doGetValue() { - return null; - } - - @Override - protected Control createControl(final Composite parent) { - IModelCellEditHandler editHandler = new IModelCellEditHandler() { - public void commit() { - @SuppressWarnings("unchecked") - //unchecked: The cellEditor.getValue() type cannot be checked. - T value = (T) ModelCellsEditingSupport.this.cellEditor.getValue(); - int index = ModelCellsEditingSupport.this.values.indexOf(element); - if (index != -1 - || element == ModelCellsEditingSupport.this.newValuePlaceholder) { - ModelCellsEditingSupport.this.values.set(index, value); - } - close(); - ModelCellsEditingSupport.this.columnViewer.refresh(); - } - - }; - - Object originalValue = null; - if (element != ModelCellsEditingSupport.this.newValuePlaceholder) { - originalValue = element; - } - - this.control = ModelCellsEditingSupport.this.cellEditor.activateCell(parent, - originalValue, editHandler, ModelCellsEditingSupport.this.feature, - ModelCellsEditingSupport.this.eObject); - return this.control; - } - - public void close() { - deactivate(); - Control parentControl = ModelCellsEditingSupport.this.columnViewer.getControl(); - if (parentControl != null && !parentControl.isDisposed()) { - parentControl.forceFocus(); - } - dispose(); - } - }; - } - - @Override - protected boolean canEdit(final Object element) { - return true; - } - - @Override - protected Object getValue(final Object element) { - return element; - } - - @Override - protected void setValue(final Object element, final Object value) { - // TODO Auto-generated method stub - } -}
diff --git a/org.eclipse.modisco.facet.widgets.celleditors/src/org/eclipse/emf/facet/widgets/celleditors/internal/ui/NaryAttributeEditingDialog.java b/org.eclipse.modisco.facet.widgets.celleditors/src/org/eclipse/emf/facet/widgets/celleditors/internal/ui/NaryAttributeEditingDialog.java deleted file mode 100644 index 61e2a0d..0000000 --- a/org.eclipse.modisco.facet.widgets.celleditors/src/org/eclipse/emf/facet/widgets/celleditors/internal/ui/NaryAttributeEditingDialog.java +++ /dev/null
@@ -1,373 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010, 2011 CEA LIST. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Nicolas Bros (Mia-Software) - initial API and implementation - * Nicolas Guyomar (Mia-Software) - Bug 339554 - org.eclipse.emf.facet.widgets.celleditors API cleaning - * Nicolas Guyomar (Mia-Software) - Bug 342451 - To be able to edit derived facet attributes and derived facet references in a table - *******************************************************************************/ -package org.eclipse.emf.facet.widgets.celleditors.internal.ui; - -import java.util.Iterator; -import java.util.List; - -import org.eclipse.emf.ecore.EAttribute; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.EStructuralFeature; -import org.eclipse.emf.facet.widgets.celleditors.IModelCellEditHandler; -import org.eclipse.emf.facet.widgets.celleditors.internal.Messages; -import org.eclipse.emf.facet.widgets.internal.CustomizableLabelProvider; -import org.eclipse.jface.dialogs.IDialogConstants; -import org.eclipse.jface.viewers.ColumnLabelProvider; -import org.eclipse.jface.viewers.IOpenListener; -import org.eclipse.jface.viewers.ISelection; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.jface.viewers.LabelProvider; -import org.eclipse.jface.viewers.OpenEvent; -import org.eclipse.jface.viewers.TableViewer; -import org.eclipse.jface.viewers.TableViewerColumn; -import org.eclipse.osgi.util.NLS; -import org.eclipse.swt.SWT; -import org.eclipse.swt.events.ControlEvent; -import org.eclipse.swt.events.ControlListener; -import org.eclipse.swt.events.KeyAdapter; -import org.eclipse.swt.events.KeyEvent; -import org.eclipse.swt.events.SelectionAdapter; -import org.eclipse.swt.events.SelectionEvent; -import org.eclipse.swt.graphics.Color; -import org.eclipse.swt.graphics.Image; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.layout.GridLayout; -import org.eclipse.swt.widgets.Button; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Control; -import org.eclipse.swt.widgets.Display; -import org.eclipse.swt.widgets.Event; -import org.eclipse.swt.widgets.Label; -import org.eclipse.swt.widgets.Listener; -import org.eclipse.swt.widgets.Shell; -import org.eclipse.swt.widgets.Table; -import org.eclipse.swt.widgets.TableColumn; - -/** A dialog to edit a multiplicity-many {@link EAttribute} */ -public class NaryAttributeEditingDialog<T extends Object> extends AbstractNaryEditingDialog<T> { - - private static final int NUM_COLUMNS = 2; - private TableViewer featureValuesTableViewer; - - private final Object newValuePlaceholder = new Object(); - - private Button addButton; - private Button removeButton; - private Button upButton; - private Button downButton; - - private final ColumnLabelProvider labelProvider = new ColumnLabelProvider() { - private final LabelProvider delegateLabelProvider = new CustomizableLabelProvider(); - - @Override - public Image getImage(final Object element) { - return this.delegateLabelProvider.getImage(element); - } - - @Override - public String getText(final Object element) { - if (element == NaryAttributeEditingDialog.this.newValuePlaceholder) { - return Messages.NaryAttributeEditingDialog_enterNewValuePlaceholder; - } - return this.delegateLabelProvider.getText(element); - } - - @Override - public Color getForeground(final Object element) { - if (element == NaryAttributeEditingDialog.this.newValuePlaceholder) { - return Display.getDefault().getSystemColor(SWT.COLOR_DARK_GRAY); - } - return null; - } - }; - - /** - * @param parent - * the parent {@link Shell} - * @param values - * the current values - * @param editHandler - * the edit handler to perform the commit. - * @param feature - * the feature to edit - * @param eObject - * the eObject being currently edited. Should not be modified in this dialog. - */ - public NaryAttributeEditingDialog(final Shell shell, final List<T> values, - final IModelCellEditHandler editHandler, final EObject eObject, final EStructuralFeature feature) { - super(shell, values, editHandler, eObject, feature); - } - - - @Override - protected void configureShell(final Shell shell) { - super.configureShell(shell); - shell.setText(NLS.bind(Messages.NaryReferenceEditingDialog_shellTitle, - getFeature().getName(), geteObject().eClass().getName())); - // prevent Escape or Enter from closing the dialog - // when a cell editor is active - shell.addListener(SWT.Traverse, new Listener() { - public void handleEvent(final Event e) { - if ((e.detail == SWT.TRAVERSE_ESCAPE || e.detail == SWT.TRAVERSE_RETURN) - && NaryAttributeEditingDialog.this.featureValuesTableViewer - .isCellEditorActive()) { - e.doit = false; - NaryAttributeEditingDialog.this.featureValuesTableViewer.cancelEditing(); - } - } - }); - } - - @Override - protected Control createDialogArea(final Composite parent) { - final Composite contents = (Composite) super.createDialogArea(parent); - - final GridLayout contentsGridLayout = (GridLayout) contents.getLayout(); - contentsGridLayout.numColumns = NaryAttributeEditingDialog.NUM_COLUMNS; - - final GridData contentsGridData = (GridData) contents.getLayoutData(); - contentsGridData.horizontalAlignment = SWT.FILL; - contentsGridData.verticalAlignment = SWT.FILL; - - createValuesPane(contents); - createButtonsPane(contents); - - this.featureValuesTableViewer.addOpenListener(new IOpenListener() { - public void open(final OpenEvent event) { - editSelectedElement(); - } - }); - - this.upButton.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(final SelectionEvent event) { - upButtonClicked(); - } - }); - - this.downButton.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(final SelectionEvent event) { - downButtonClicked(); - } - }); - - this.addButton.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(final SelectionEvent event) { - addButtonClicked(); - } - }); - - this.removeButton.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(final SelectionEvent event) { - removeButtonClicked(); - } - }); - - return contents; - } - - @SuppressWarnings("unchecked") // type erasure on generic - private void addButtonClicked() { - getValues().add(0, (T) NaryAttributeEditingDialog.this.newValuePlaceholder); - refresh(); - this.featureValuesTableViewer.editElement(this.newValuePlaceholder, 0); - } - - @SuppressWarnings("unchecked") // type erasure on generic - private void removeButtonClicked() { - final IStructuredSelection selection = (IStructuredSelection) this.featureValuesTableViewer - .getSelection(); - - for (final Iterator<T> it = selection.iterator(); it.hasNext();) { - final Object element = it.next(); - - if (getValues().contains(element)) { - getValues().remove(element); - } - } - refresh(); - } - - private void spacer(final Composite parent) { - @SuppressWarnings("unused") - Label label = new Label(parent, SWT.NONE); - } - - private void createButtonsPane(final Composite contents) { - final Composite buttonsComposite = new Composite(contents, SWT.NONE); - final GridData buttonsCompositeGridData = new GridData(); - buttonsCompositeGridData.verticalAlignment = SWT.FILL; - buttonsCompositeGridData.horizontalAlignment = SWT.FILL; - buttonsComposite.setLayoutData(buttonsCompositeGridData); - buttonsComposite.setLayout(new GridLayout()); - - // spacer - spacer(buttonsComposite); - - this.addButton = new Button(buttonsComposite, SWT.PUSH); - this.addButton.setText(Messages.NaryAttributeEditingDialog_add); - final GridData addButtonGridData = new GridData(); - addButtonGridData.verticalAlignment = SWT.FILL; - addButtonGridData.horizontalAlignment = SWT.FILL; - this.addButton.setLayoutData(addButtonGridData); - - this.removeButton = new Button(buttonsComposite, SWT.PUSH); - this.removeButton.setText(Messages.NaryAttributeEditingDialog_delete); - final GridData removeButtonGridData = new GridData(); - removeButtonGridData.verticalAlignment = SWT.FILL; - removeButtonGridData.horizontalAlignment = SWT.FILL; - this.removeButton.setLayoutData(removeButtonGridData); - - spacer(buttonsComposite); - - this.upButton = new Button(buttonsComposite, SWT.PUSH); - this.upButton.setText(Messages.NaryReferenceEditingDialog_up); - final GridData upButtonGridData = new GridData(); - upButtonGridData.verticalAlignment = SWT.FILL; - upButtonGridData.horizontalAlignment = SWT.FILL; - this.upButton.setLayoutData(upButtonGridData); - - this.downButton = new Button(buttonsComposite, SWT.PUSH); - this.downButton.setText(Messages.NaryReferenceEditingDialog_down); - final GridData downButtonGridData = new GridData(); - downButtonGridData.verticalAlignment = SWT.FILL; - downButtonGridData.horizontalAlignment = SWT.FILL; - this.downButton.setLayoutData(downButtonGridData); - } - - private void createValuesPane(final Composite contents) { - final Composite featureComposite = new Composite(contents, SWT.NONE); - final GridData featureCompositeData = new GridData(SWT.FILL, SWT.FILL, true, true); - featureCompositeData.horizontalAlignment = SWT.END; - featureComposite.setLayoutData(featureCompositeData); - - final GridLayout featureCompositeLayout = new GridLayout(); - featureCompositeData.horizontalAlignment = SWT.FILL; - featureCompositeLayout.marginHeight = 0; - featureCompositeLayout.marginWidth = 0; - featureCompositeLayout.numColumns = 1; - featureComposite.setLayout(featureCompositeLayout); - - final Label featureLabel = new Label(featureComposite, SWT.NONE); - featureLabel.setText(Messages.NaryReferenceEditingDialog_values); - final GridData valuesLabelGridData = new GridData(); - valuesLabelGridData.horizontalSpan = 2; - valuesLabelGridData.horizontalAlignment = SWT.FILL; - valuesLabelGridData.verticalAlignment = SWT.FILL; - featureLabel.setLayoutData(valuesLabelGridData); - - final Table table = new Table(featureComposite, SWT.MULTI | SWT.BORDER | SWT.FULL_SELECTION); - final GridData tableGridData = new GridData(); - tableGridData.widthHint = AbstractNaryEditingDialog.AVAILABLE_VALUES_TREE_WIDTH; - tableGridData.heightHint = AbstractNaryEditingDialog.AVAILABLE_VALUES_TREE_HEIGHT; - tableGridData.verticalAlignment = SWT.FILL; - tableGridData.horizontalAlignment = SWT.FILL; - tableGridData.grabExcessHorizontalSpace = true; - tableGridData.grabExcessVerticalSpace = true; - table.setLayoutData(tableGridData); - final TableColumn tableColumn = new TableColumn(table, SWT.CENTER); - - // full-width column - table.addControlListener(new ControlListener() { - public void controlResized(final ControlEvent e) { - tableColumn.setWidth(table.getClientArea().width); - } - - public void controlMoved(final ControlEvent e) { - // - } - }); - - this.featureValuesTableViewer = new TableViewer(table); - this.featureValuesTableViewer.setContentProvider(new AssignedValuesContentProvider()); - // this.fFeatureValuesTableViewer.setLabelProvider(this.labelProvider); - this.featureValuesTableViewer - .setInput(getValues()); - - final TableViewerColumn tableViewerColumn = new TableViewerColumn( - this.featureValuesTableViewer, tableColumn); - tableViewerColumn.setLabelProvider(this.labelProvider); - - tableViewerColumn.setEditingSupport(new ModelCellsEditingSupport<T>( - this.featureValuesTableViewer, getFeature(), geteObject(), - this.newValuePlaceholder, getValues())); - - // keyboard accessibility - table.addKeyListener(new KeyAdapter() { - @Override - public void keyPressed(final KeyEvent e) { - if (e.keyCode == SWT.F2) { - editSelectedElement(); - } - if (e.keyCode == SWT.DEL) { - if (NaryAttributeEditingDialog.this.removeButton.isEnabled()) { - NaryAttributeEditingDialog.this.removeButton.notifyListeners( - SWT.Selection, null); - } - } - if (e.keyCode == SWT.ARROW_UP - && ((e.stateMask & SWT.COMMAND) != 0 || (e.stateMask & SWT.CONTROL) != 0)) { - if (NaryAttributeEditingDialog.this.upButton.isEnabled()) { - NaryAttributeEditingDialog.this.upButton.notifyListeners(SWT.Selection, - null); - } - } - if (e.keyCode == SWT.ARROW_DOWN - && ((e.stateMask & SWT.COMMAND) != 0 || (e.stateMask & SWT.CONTROL) != 0)) { - if (NaryAttributeEditingDialog.this.downButton.isEnabled()) { - NaryAttributeEditingDialog.this.downButton.notifyListeners(SWT.Selection, - null); - } - } - } - }); - - } - - private void editSelectedElement() { - ISelection selection = NaryAttributeEditingDialog.this.featureValuesTableViewer - .getSelection(); - if (selection instanceof IStructuredSelection) { - IStructuredSelection structuredSelection = (IStructuredSelection) selection; - if (structuredSelection.getFirstElement() != null) { - NaryAttributeEditingDialog.this.featureValuesTableViewer.editElement( - structuredSelection.getFirstElement(), 0); - } - } - } - - @Override - public void refresh() { - this.featureValuesTableViewer.refresh(); - } - - @Override - protected boolean isResizable() { - return true; - } - - @Override - protected void createButtonsForButtonBar(final Composite parent) { - createButton(parent, IDialogConstants.OK_ID, IDialogConstants.OK_LABEL, true); - } - - - @Override - public ISelection getSelection() { - return this.featureValuesTableViewer.getSelection(); - } -}
diff --git a/org.eclipse.modisco.facet.widgets.celleditors/src/org/eclipse/emf/facet/widgets/celleditors/internal/ui/NaryReferenceEditingDialog.java b/org.eclipse.modisco.facet.widgets.celleditors/src/org/eclipse/emf/facet/widgets/celleditors/internal/ui/NaryReferenceEditingDialog.java deleted file mode 100644 index cef3a01..0000000 --- a/org.eclipse.modisco.facet.widgets.celleditors/src/org/eclipse/emf/facet/widgets/celleditors/internal/ui/NaryReferenceEditingDialog.java +++ /dev/null
@@ -1,489 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010, 2011 CEA LIST. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Nicolas Bros (Mia-Software) - initial API and implementation - * Nicolas Guyomar (Mia-Software) - Bug 339554 - org.eclipse.emf.facet.widgets.celleditors API cleaning - * Nicolas Guyomar (Mia-Software) - Bug 342451 - To be able to edit derived facet attributes and derived facet references in a table - * Gregoire Dupe (Mia-Software) - Bug 369987 - [Restructuring][Table] Switch to the new customization and facet framework - *******************************************************************************/ -package org.eclipse.emf.facet.widgets.celleditors.internal.ui; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; - -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.ecore.EClassifier; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.EReference; -import org.eclipse.emf.ecore.EStructuralFeature; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.FacetReference; -import org.eclipse.emf.facet.util.emf.ui.internal.dialogs.CreateInstanceDialog; -import org.eclipse.emf.facet.widgets.celleditors.IModelCellEditHandler; -import org.eclipse.emf.facet.widgets.celleditors.internal.Messages; -import org.eclipse.emf.facet.widgets.internal.CustomizableLabelProvider; -import org.eclipse.jface.dialogs.IDialogConstants; -import org.eclipse.jface.dialogs.MessageDialog; -import org.eclipse.jface.viewers.IOpenListener; -import org.eclipse.jface.viewers.ISelection; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.jface.viewers.ListViewer; -import org.eclipse.jface.viewers.OpenEvent; -import org.eclipse.jface.viewers.TreeViewer; -import org.eclipse.osgi.util.NLS; -import org.eclipse.swt.SWT; -import org.eclipse.swt.events.ModifyEvent; -import org.eclipse.swt.events.ModifyListener; -import org.eclipse.swt.events.SelectionAdapter; -import org.eclipse.swt.events.SelectionEvent; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.layout.GridLayout; -import org.eclipse.swt.widgets.Button; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Control; -import org.eclipse.swt.widgets.Label; -import org.eclipse.swt.widgets.Shell; -import org.eclipse.swt.widgets.Text; -import org.eclipse.swt.widgets.Tree; -import org.eclipse.ui.dialogs.PatternFilter; - -/** A dialog to edit a multiplicity-many {@link EReference} */ -public class NaryReferenceEditingDialog<T extends EObject> extends AbstractNaryEditingDialog<T> { - - - private Button addButton; - private Button removeButton; - private Button addAllButton; - private Button removeAllButton; - private Button upButton; - private Button downButton; - - private static final int NUM_COLUMNS = 4; - // this is a *tree* viewer because PatternFilter only supports Trees - private TreeViewer availableValuesTreeViewer; - private ListViewer featureValuesListViewer; - private Button createInstanceButton; - - private AssignableValuesContentProvider assignableValuesContentProvider; - private final List<T> availableValues; - - - /** - * - * @param parent - * the parent {@link Shell} - * @param values - * the list of current values. - * @param feature - * the feature to edit - * @param eObject - * the eObject being currently edited. Should not be modified in this dialog. - * @param editHandler - * The editHandler which has to be called when the edition is completed - */ - public NaryReferenceEditingDialog(final Shell shell, final List<T> values, - final List<T> availableValues, final IModelCellEditHandler editHandler, - final EObject eObject, final EStructuralFeature feature) { - super(shell, values, editHandler, eObject, feature); - this.availableValues = new ArrayList<T>(availableValues); - } - - @Override - protected void configureShell(final Shell shell) { - super.configureShell(shell); - shell.setText(NLS.bind(Messages.NaryReferenceEditingDialog_shellTitle, - getFeature().getName(), geteObject().eClass().getName())); - } - - @Override - protected Control createDialogArea(final Composite parent) { - final Composite contents = (Composite) super.createDialogArea(parent); - - final GridLayout contentsGridLayout = (GridLayout) contents.getLayout(); - contentsGridLayout.numColumns = NaryReferenceEditingDialog.NUM_COLUMNS; - - final GridData contentsGridData = (GridData) contents.getLayoutData(); - contentsGridData.horizontalAlignment = SWT.FILL; - contentsGridData.verticalAlignment = SWT.FILL; - - createLeftPane(contents); - createMiddleButtonsPane(contents); - createRightPane(contents); - createRightButtonsPane(contents); - - this.availableValuesTreeViewer.addOpenListener(new IOpenListener() { - public void open(final OpenEvent event) { - if (NaryReferenceEditingDialog.this.addButton.isEnabled()) { - NaryReferenceEditingDialog.this.addButton.notifyListeners(SWT.Selection, null); - } - } - }); - - this.featureValuesListViewer.addOpenListener(new IOpenListener() { - public void open(final OpenEvent event) { - if (NaryReferenceEditingDialog.this.removeButton.isEnabled()) { - NaryReferenceEditingDialog.this.removeButton.notifyListeners(SWT.Selection, - null); - } - } - }); - - this.upButton.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(final SelectionEvent event) { - upButtonClicked(); - } - }); - - this.downButton.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(final SelectionEvent event) { - downButtonClicked(); - } - }); - - this.addButton.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(final SelectionEvent event) { - addButtonClicked(); - } - }); - - this.addAllButton.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(final SelectionEvent event) { - addAllButtonClicked(); - } - }); - - this.removeButton.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(final SelectionEvent event) { - removeButtonClicked(); - } - }); - - this.removeAllButton.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(final SelectionEvent event) { - removeAllButtonClicked(); - } - }); - - if (this.createInstanceButton != null) { - this.createInstanceButton.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(final SelectionEvent event) { - createInstanceButtonClicked(); - } - }); - } - - return contents; - } - - private void addButtonClicked() { - final IStructuredSelection selection = (IStructuredSelection) this.availableValuesTreeViewer - .getSelection(); - if (selection.isEmpty() || !confirmMove()) { - return; - } - Iterator<T> it = getTCastedStructuredSelectionIterator(selection); - while (it.hasNext()) { - T element = it.next(); - if (!(getValues() != null && getValues().contains(element))) { - getValues().add(element); - this.availableValues.remove(element); - } - } - refresh(); - this.featureValuesListViewer.setSelection(selection); - } - - @SuppressWarnings({ "unchecked", "static-method" }) - //unchecked: the selection in not type parameterized, then we cannot get a cleaned cast iterator - //static-method: this method cannot be static to be able to use the T type. - private Iterator<T> getTCastedStructuredSelectionIterator(final IStructuredSelection selection) { - return selection.iterator(); - } - - private void addAllButtonClicked() { - if (this.availableValues.isEmpty() || !confirmMove()) { - return; - } - getValues().addAll(this.availableValues); - this.availableValues.removeAll(getValues()); - refresh(); - } - - private void removeButtonClicked() { - final IStructuredSelection selection = (IStructuredSelection) this.featureValuesListViewer - .getSelection(); - if (selection.isEmpty() || !confirmRemove()) { - return; - } - - Iterator<T> it = this.getTCastedStructuredSelectionIterator(selection); - while (it.hasNext()) { - T element = it.next(); - if (getValues().contains(element)) { - this.availableValues.add(element); - getValues().remove(element); - } - } - refresh(); - } - - private void removeAllButtonClicked() { - if (getValues().isEmpty() || !confirmRemove()) { - return; - } - this.availableValues.addAll(getValues()); - getValues().removeAll(getValues()); - refresh(); - } - - private boolean confirmRemove() { - if (getFeature() instanceof EReference) { - EReference eReference = (EReference) getFeature(); - if (eReference.isContainment()) { - return MessageDialog.openConfirm(getShell(), - Messages.NaryReferenceEditingDialog_deleteElements, - Messages.NaryReferenceEditingDialog_deleteElementsLong); - } - } - return true; - } - - private boolean confirmMove() { - if (getFeature() instanceof EReference || getFeature() instanceof FacetReference) { - EReference reference = (EReference) getFeature(); - if (reference.isContainment()) { - String fullMessage = Messages.NaryReferenceEditingDialog_moveWarning; - return MessageDialog.openConfirm(getShell(), - Messages.NaryReferenceEditingDialog_moveElement, fullMessage); - } - } - return true; - } - - @SuppressWarnings("unchecked") // type erasure on generic - private void createInstanceButtonClicked() { - EClassifier eType = getFeature().getEType(); - if (eType instanceof EClass) { - EClass eClass = (EClass) eType; - EObject newInstance = CreateInstanceDialog.open(getShell(), eClass, - new CustomizableLabelProvider()); - if (newInstance != null) { - getValues().add((T) newInstance); - refresh(); - } - } - } - - private void createLeftPane(final Composite contents) { - final Composite choiceComposite = new Composite(contents, SWT.NONE); - final GridData data = new GridData(SWT.FILL, SWT.FILL, true, true); - data.horizontalAlignment = SWT.END; - choiceComposite.setLayoutData(data); - - final GridLayout layout = new GridLayout(); - data.horizontalAlignment = SWT.FILL; - layout.marginHeight = 0; - layout.marginWidth = 0; - layout.numColumns = 1; - choiceComposite.setLayout(layout); - - final Label choiceLabel = new Label(choiceComposite, SWT.NONE); - choiceLabel.setText(Messages.NaryReferenceEditingDialog_availableValues); - - final GridData choiceLabelGridData = new GridData(); - choiceLabelGridData.verticalAlignment = SWT.FILL; - choiceLabelGridData.horizontalAlignment = SWT.FILL; - choiceLabel.setLayoutData(choiceLabelGridData); - - final Text patternText = createFilterText(choiceComposite); - - final Tree availableValuesTree = new Tree(choiceComposite, SWT.MULTI | SWT.BORDER); - final GridData availableValuesGridData = new GridData(); - availableValuesGridData.widthHint = AbstractNaryEditingDialog.AVAILABLE_VALUES_TREE_WIDTH; - availableValuesGridData.heightHint = AbstractNaryEditingDialog.AVAILABLE_VALUES_TREE_HEIGHT; - availableValuesGridData.horizontalAlignment = SWT.FILL; - availableValuesGridData.verticalAlignment = SWT.FILL; - availableValuesGridData.grabExcessHorizontalSpace = true; - availableValuesGridData.grabExcessVerticalSpace = true; - availableValuesTree.setLayoutData(availableValuesGridData); - - this.availableValuesTreeViewer = new TreeViewer(availableValuesTree); - this.assignableValuesContentProvider = new AssignableValuesContentProvider(); - this.availableValuesTreeViewer.setContentProvider(this.assignableValuesContentProvider); - this.availableValuesTreeViewer.setLabelProvider(new CustomizableLabelProvider()); - final PatternFilter filter = new PatternFilter(); - this.availableValuesTreeViewer.addFilter(filter); - - this.availableValuesTreeViewer.setInput(this.availableValues); - - patternText.addModifyListener(new ModifyListener() { - public void modifyText(final ModifyEvent e) { - filter.setPattern(patternText.getText()); - NaryReferenceEditingDialog.this.availableValuesTreeViewer.refresh(); - } - }); - } - - private void createMiddleButtonsPane(final Composite contents) { - final Composite buttonsComposite = new Composite(contents, SWT.NONE); - final GridData buttonsCompositeGridData = new GridData(); - buttonsCompositeGridData.verticalAlignment = SWT.CENTER; - buttonsCompositeGridData.horizontalAlignment = SWT.FILL; - buttonsComposite.setLayoutData(buttonsCompositeGridData); - buttonsComposite.setLayout(new GridLayout()); - - // new Label(buttonsComposite, SWT.NONE); - - this.addButton = new Button(buttonsComposite, SWT.PUSH); - this.addButton.setText(Messages.NaryReferenceEditingDialog_add); - this.addButton.setToolTipText(Messages.NaryReferenceEditingDialog_addTooltip); - final GridData addButtonGridData = new GridData(); - addButtonGridData.verticalAlignment = SWT.FILL; - addButtonGridData.horizontalAlignment = SWT.FILL; - this.addButton.setLayoutData(addButtonGridData); - - this.removeButton = new Button(buttonsComposite, SWT.PUSH); - this.removeButton.setText(Messages.NaryReferenceEditingDialog_remove); - this.removeButton.setToolTipText(Messages.NaryReferenceEditingDialog_removeTooltip); - final GridData removeButtonGridData = new GridData(); - removeButtonGridData.verticalAlignment = SWT.FILL; - removeButtonGridData.horizontalAlignment = SWT.FILL; - this.removeButton.setLayoutData(removeButtonGridData); - - spacer(buttonsComposite); - - this.addAllButton = new Button(buttonsComposite, SWT.PUSH); - this.addAllButton.setText(Messages.NaryReferenceEditingDialog_addAll); - this.addAllButton.setToolTipText(Messages.NaryReferenceEditingDialog_addAllTooltip); - - this.removeAllButton = new Button(buttonsComposite, SWT.PUSH); - this.removeAllButton.setText(Messages.NaryReferenceEditingDialog_removeAll); - this.removeAllButton.setToolTipText(Messages.NaryReferenceEditingDialog_removeAllTooltip); - } - - private void spacer(final Composite parent) { - @SuppressWarnings("unused") - Label label = new Label(parent, SWT.NONE); - } - - private void createRightButtonsPane(final Composite contents) { - final Composite buttonsComposite = new Composite(contents, SWT.NONE); - final GridData buttonsCompositeGridData = new GridData(); - buttonsCompositeGridData.verticalAlignment = SWT.FILL; - buttonsCompositeGridData.horizontalAlignment = SWT.FILL; - buttonsComposite.setLayoutData(buttonsCompositeGridData); - buttonsComposite.setLayout(new GridLayout()); - - // spacer - spacer(buttonsComposite); - - if (getFeature() instanceof EReference) { - EReference eReference = (EReference) getFeature(); - if (eReference.isContainment()) { - this.createInstanceButton = new Button(buttonsComposite, SWT.PUSH); - this.createInstanceButton.setText(Messages.NaryReferenceEditingDialog_newInstance); - final GridData createButtonGridData = new GridData(); - createButtonGridData.verticalAlignment = SWT.FILL; - createButtonGridData.horizontalAlignment = SWT.FILL; - this.createInstanceButton.setLayoutData(createButtonGridData); - spacer(buttonsComposite); - } - - } - - this.upButton = new Button(buttonsComposite, SWT.PUSH); - this.upButton.setText(Messages.NaryReferenceEditingDialog_up); - final GridData upButtonGridData = new GridData(); - upButtonGridData.verticalAlignment = SWT.FILL; - upButtonGridData.horizontalAlignment = SWT.FILL; - this.upButton.setLayoutData(upButtonGridData); - - this.downButton = new Button(buttonsComposite, SWT.PUSH); - this.downButton.setText(Messages.NaryReferenceEditingDialog_down); - final GridData downButtonGridData = new GridData(); - downButtonGridData.verticalAlignment = SWT.FILL; - downButtonGridData.horizontalAlignment = SWT.FILL; - this.downButton.setLayoutData(downButtonGridData); - } - - private void createRightPane(final Composite contents) { - final Composite featureComposite = new Composite(contents, SWT.NONE); - final GridData featureCompositeData = new GridData(SWT.FILL, SWT.FILL, true, true); - featureCompositeData.horizontalAlignment = SWT.END; - featureComposite.setLayoutData(featureCompositeData); - - final GridLayout featureCompositeLayout = new GridLayout(); - featureCompositeData.horizontalAlignment = SWT.FILL; - featureCompositeLayout.marginHeight = 0; - featureCompositeLayout.marginWidth = 0; - featureCompositeLayout.numColumns = 1; - featureComposite.setLayout(featureCompositeLayout); - - final Label featureLabel = new Label(featureComposite, SWT.NONE); - featureLabel.setText(Messages.NaryReferenceEditingDialog_values); - final GridData valuesLabelGridData = new GridData(); - valuesLabelGridData.horizontalSpan = 2; - valuesLabelGridData.horizontalAlignment = SWT.FILL; - valuesLabelGridData.verticalAlignment = SWT.FILL; - featureLabel.setLayoutData(valuesLabelGridData); - - final org.eclipse.swt.widgets.List availableValuesList = new org.eclipse.swt.widgets.List( - featureComposite, SWT.MULTI | SWT.BORDER | SWT.V_SCROLL); - final GridData availableValuesGridData = new GridData(); - availableValuesGridData.widthHint = AbstractNaryEditingDialog.AVAILABLE_VALUES_TREE_WIDTH; - availableValuesGridData.heightHint = AbstractNaryEditingDialog.AVAILABLE_VALUES_TREE_HEIGHT; - availableValuesGridData.verticalAlignment = SWT.FILL; - availableValuesGridData.horizontalAlignment = SWT.FILL; - availableValuesGridData.grabExcessHorizontalSpace = true; - availableValuesGridData.grabExcessVerticalSpace = true; - availableValuesList.setLayoutData(availableValuesGridData); - - this.featureValuesListViewer = new ListViewer(availableValuesList); - this.featureValuesListViewer.setContentProvider(new AssignedValuesContentProvider()); - this.featureValuesListViewer.setLabelProvider(new CustomizableLabelProvider()); - this.featureValuesListViewer - .setInput(getValues()); - } - - private Text createFilterText(final Composite contents) { - Text patternText = new Text(contents, SWT.BORDER | SWT.SEARCH); - patternText.setMessage(Messages.NaryReferenceEditingDialog_typeFilterText); - patternText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); - return patternText; - } - - @Override - public void refresh() { - this.availableValuesTreeViewer.refresh(); - this.featureValuesListViewer.refresh(); - } - - @Override - protected boolean isResizable() { - return true; - } - - @Override - protected void createButtonsForButtonBar(final Composite parent) { - createButton(parent, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL, false); - createButton(parent, IDialogConstants.OK_ID, IDialogConstants.OK_LABEL, true); - } - - @Override - public ISelection getSelection() { - return this.featureValuesListViewer.getSelection(); - } -}
diff --git a/org.eclipse.modisco.facet.widgets.celleditors/src/org/eclipse/emf/facet/widgets/celleditors/modelCellEditor/AbstractModelCellEditor.java b/org.eclipse.modisco.facet.widgets.celleditors/src/org/eclipse/emf/facet/widgets/celleditors/modelCellEditor/AbstractModelCellEditor.java deleted file mode 100644 index 3b043d5..0000000 --- a/org.eclipse.modisco.facet.widgets.celleditors/src/org/eclipse/emf/facet/widgets/celleditors/modelCellEditor/AbstractModelCellEditor.java +++ /dev/null
@@ -1,106 +0,0 @@ -/** - * Copyright (c) 2010 CEA LIST. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Nicolas Bros (Mia-Software) - initial API and implementation - */ -package org.eclipse.emf.facet.widgets.celleditors.modelCellEditor; - -import org.eclipse.emf.ecore.EClassifier; -import org.eclipse.emf.ecore.EObject; - -/** - * <!-- begin-user-doc --> A representation of the model object ' - * <em><b>Abstract Model Cell Editor</b></em>'. <!-- end-user-doc --> - * - * <p> - * The following features are supported: - * <ul> - * <li> - * {@link org.eclipse.emf.facet.widgets.celleditors.modelCellEditor.AbstractModelCellEditor#getCellType - * <em>Cell Type</em>}</li> - * <li> - * {@link org.eclipse.emf.facet.widgets.celleditors.modelCellEditor.AbstractModelCellEditor#getCellId - * <em>Cell Id</em>}</li> - * </ul> - * </p> - * - * @see org.eclipse.emf.facet.widgets.celleditors.modelCellEditor.ModelCellEditorPackage#getAbstractModelCellEditor() - * @model abstract="true" - * @generated - */ -public interface AbstractModelCellEditor extends EObject { - /** - * Returns the value of the '<em><b>Cell Type</b></em>' reference. <!-- - * begin-user-doc --> - * <p> - * If the meaning of the '<em>Cell Type</em>' reference isn't clear, there - * really should be more of a description here... - * </p> - * <!-- end-user-doc --> - * - * @return the value of the '<em>Cell Type</em>' reference. - * @see #setCellType(EClassifier) - * @see org.eclipse.emf.facet.widgets.celleditors.modelCellEditor.ModelCellEditorPackage#getAbstractModelCellEditor_CellType() - * @model required="true" - * @generated - */ - EClassifier getCellType(); - - /** - * Sets the value of the ' - * {@link org.eclipse.emf.facet.widgets.celleditors.modelCellEditor.AbstractModelCellEditor#getCellType - * <em>Cell Type</em>}' reference. <!-- begin-user-doc --> <!-- end-user-doc - * --> - * - * @param value - * the new value of the '<em>Cell Type</em>' reference. - * @see #getCellType() - * @generated - */ - void setCellType(EClassifier value); - - /** - * Returns the value of the '<em><b>Cell Id</b></em>' attribute. <!-- - * begin-user-doc --> - * <p> - * If the meaning of the '<em>Cell Id</em>' attribute isn't clear, there - * really should be more of a description here... - * </p> - * <!-- end-user-doc --> - * - * @return the value of the '<em>Cell Id</em>' attribute. - * @see #setCellId(String) - * @see org.eclipse.emf.facet.widgets.celleditors.modelCellEditor.ModelCellEditorPackage#getAbstractModelCellEditor_CellId() - * @model required="true" - * @generated - */ - String getCellId(); - - /** - * Sets the value of the ' - * {@link org.eclipse.emf.facet.widgets.celleditors.modelCellEditor.AbstractModelCellEditor#getCellId - * <em>Cell Id</em>}' attribute. <!-- begin-user-doc --> <!-- end-user-doc - * --> - * - * @param value - * the new value of the '<em>Cell Id</em>' attribute. - * @see #getCellId() - * @generated - */ - void setCellId(String value); - - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @model kind="operation" required="true" - * @generated - */ - String getModelCellEditorImpl(); - -} // AbstractModelCellEditor
diff --git a/org.eclipse.modisco.facet.widgets.celleditors/src/org/eclipse/emf/facet/widgets/celleditors/modelCellEditor/BasicCellEditor.java b/org.eclipse.modisco.facet.widgets.celleditors/src/org/eclipse/emf/facet/widgets/celleditors/modelCellEditor/BasicCellEditor.java deleted file mode 100644 index df1192d..0000000 --- a/org.eclipse.modisco.facet.widgets.celleditors/src/org/eclipse/emf/facet/widgets/celleditors/modelCellEditor/BasicCellEditor.java +++ /dev/null
@@ -1,63 +0,0 @@ -/** - * Copyright (c) 2010 CEA LIST. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Nicolas Bros (Mia-Software) - initial API and implementation - */ -package org.eclipse.emf.facet.widgets.celleditors.modelCellEditor; - -/** - * <!-- begin-user-doc --> A representation of the model object ' - * <em><b>Basic Cell Editor</b></em>'. <!-- end-user-doc --> - * - * <p> - * The following features are supported: - * <ul> - * <li> - * {@link org.eclipse.emf.facet.widgets.celleditors.modelCellEditor.BasicCellEditor#getBasicCellEditorImpl - * <em>Basic Cell Editor Impl</em>}</li> - * </ul> - * </p> - * - * @see org.eclipse.emf.facet.widgets.celleditors.modelCellEditor.ModelCellEditorPackage#getBasicCellEditor() - * @model - * @generated - */ -public interface BasicCellEditor extends AbstractModelCellEditor { - /** - * Returns the value of the '<em><b>Basic Cell Editor Impl</b></em>' - * attribute. <!-- begin-user-doc --> - * <p> - * If the meaning of the '<em>Basic Cell Editor Impl</em>' attribute isn't - * clear, there really should be more of a description here... - * </p> - * <!-- end-user-doc --> - * - * @return the value of the '<em>Basic Cell Editor Impl</em>' attribute. - * @see #setBasicCellEditorImpl(String) - * @see org.eclipse.emf.facet.widgets.celleditors.modelCellEditor.ModelCellEditorPackage#getBasicCellEditor_BasicCellEditorImpl() - * @model required="true" - * @generated - */ - String getBasicCellEditorImpl(); - - /** - * Sets the value of the ' - * {@link org.eclipse.emf.facet.widgets.celleditors.modelCellEditor.BasicCellEditor#getBasicCellEditorImpl - * <em>Basic Cell Editor Impl</em>}' attribute. <!-- begin-user-doc --> <!-- - * end-user-doc --> - * - * @param value - * the new value of the '<em>Basic Cell Editor Impl</em>' - * attribute. - * @see #getBasicCellEditorImpl() - * @generated - */ - void setBasicCellEditorImpl(String value); - -} // BasicCellEditor
diff --git a/org.eclipse.modisco.facet.widgets.celleditors/src/org/eclipse/emf/facet/widgets/celleditors/modelCellEditor/ModelCellEditorDeclarations.java b/org.eclipse.modisco.facet.widgets.celleditors/src/org/eclipse/emf/facet/widgets/celleditors/modelCellEditor/ModelCellEditorDeclarations.java deleted file mode 100644 index 20e0212..0000000 --- a/org.eclipse.modisco.facet.widgets.celleditors/src/org/eclipse/emf/facet/widgets/celleditors/modelCellEditor/ModelCellEditorDeclarations.java +++ /dev/null
@@ -1,54 +0,0 @@ -/** - * Copyright (c) 2010 CEA LIST. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Nicolas Bros (Mia-Software) - initial API and implementation - */ -package org.eclipse.emf.facet.widgets.celleditors.modelCellEditor; - -import org.eclipse.emf.common.util.EList; -import org.eclipse.emf.ecore.EObject; - -/** - * <!-- begin-user-doc --> A representation of the model object ' - * <em><b>Declarations</b></em>'. <!-- end-user-doc --> - * - * <p> - * The following features are supported: - * <ul> - * <li> - * {@link org.eclipse.emf.facet.widgets.celleditors.modelCellEditor.ModelCellEditorDeclarations#getModelCellEditors - * <em>Model Cell Editors</em>}</li> - * </ul> - * </p> - * - * @see org.eclipse.emf.facet.widgets.celleditors.modelCellEditor.ModelCellEditorPackage#getModelCellEditorDeclarations() - * @model - * @generated - */ -public interface ModelCellEditorDeclarations extends EObject { - /** - * Returns the value of the '<em><b>Model Cell Editors</b></em>' containment - * reference list. The list contents are of type - * {@link org.eclipse.emf.facet.widgets.celleditors.modelCellEditor.AbstractModelCellEditor} - * . <!-- begin-user-doc --> - * <p> - * If the meaning of the '<em>Model Cell Editors</em>' containment reference - * list isn't clear, there really should be more of a description here... - * </p> - * <!-- end-user-doc --> - * - * @return the value of the '<em>Model Cell Editors</em>' containment - * reference list. - * @see org.eclipse.emf.facet.widgets.celleditors.modelCellEditor.ModelCellEditorPackage#getModelCellEditorDeclarations_ModelCellEditors() - * @model containment="true" - * @generated - */ - EList<AbstractModelCellEditor> getModelCellEditors(); - -} // ModelCellEditorDeclarations
diff --git a/org.eclipse.modisco.facet.widgets.celleditors/src/org/eclipse/emf/facet/widgets/celleditors/modelCellEditor/ModelCellEditorFactory.java b/org.eclipse.modisco.facet.widgets.celleditors/src/org/eclipse/emf/facet/widgets/celleditors/modelCellEditor/ModelCellEditorFactory.java deleted file mode 100644 index 45ff00b..0000000 --- a/org.eclipse.modisco.facet.widgets.celleditors/src/org/eclipse/emf/facet/widgets/celleditors/modelCellEditor/ModelCellEditorFactory.java +++ /dev/null
@@ -1,78 +0,0 @@ -/** - * Copyright (c) 2010 CEA LIST. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Nicolas Bros (Mia-Software) - initial API and implementation - */ -package org.eclipse.emf.facet.widgets.celleditors.modelCellEditor; - -import org.eclipse.emf.ecore.EFactory; - -/** - * <!-- begin-user-doc --> The <b>Factory</b> for the model. It provides a - * create method for each non-abstract class of the model. <!-- end-user-doc --> - * - * @see org.eclipse.emf.facet.widgets.celleditors.modelCellEditor.ModelCellEditorPackage - * @generated - */ -public interface ModelCellEditorFactory extends EFactory { - /** - * The singleton instance of the factory. <!-- begin-user-doc --> <!-- - * end-user-doc --> - * - * @generated - */ - ModelCellEditorFactory eINSTANCE = org.eclipse.emf.facet.widgets.celleditors.modelCellEditor.impl.ModelCellEditorFactoryImpl - .init(); - - /** - * Returns a new object of class '<em>Declarations</em>'. <!-- - * begin-user-doc --> <!-- end-user-doc --> - * - * @return a new object of class '<em>Declarations</em>'. - * @generated - */ - ModelCellEditorDeclarations createModelCellEditorDeclarations(); - - /** - * Returns a new object of class '<em>Basic Cell Editor</em>'. <!-- - * begin-user-doc --> <!-- end-user-doc --> - * - * @return a new object of class '<em>Basic Cell Editor</em>'. - * @generated - */ - BasicCellEditor createBasicCellEditor(); - - /** - * Returns a new object of class '<em>Unary Reference Cell Editor</em>'. - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @return a new object of class '<em>Unary Reference Cell Editor</em>'. - * @generated - */ - UnaryReferenceCellEditor createUnaryReferenceCellEditor(); - - /** - * Returns a new object of class '<em>Nary Feature Cell Editor</em>'. <!-- - * begin-user-doc --> <!-- end-user-doc --> - * - * @return a new object of class '<em>Nary Feature Cell Editor</em>'. - * @generated - */ - NaryFeatureCellEditor createNaryFeatureCellEditor(); - - /** - * Returns the package supported by this factory. <!-- begin-user-doc --> - * <!-- end-user-doc --> - * - * @return the package supported by this factory. - * @generated - */ - ModelCellEditorPackage getModelCellEditorPackage(); - -} // ModelCellEditorFactory
diff --git a/org.eclipse.modisco.facet.widgets.celleditors/src/org/eclipse/emf/facet/widgets/celleditors/modelCellEditor/ModelCellEditorPackage.java b/org.eclipse.modisco.facet.widgets.celleditors/src/org/eclipse/emf/facet/widgets/celleditors/modelCellEditor/ModelCellEditorPackage.java deleted file mode 100644 index 521d02e..0000000 --- a/org.eclipse.modisco.facet.widgets.celleditors/src/org/eclipse/emf/facet/widgets/celleditors/modelCellEditor/ModelCellEditorPackage.java +++ /dev/null
@@ -1,567 +0,0 @@ -/** - * Copyright (c) 2010 CEA LIST. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Nicolas Bros (Mia-Software) - initial API and implementation - */ -package org.eclipse.emf.facet.widgets.celleditors.modelCellEditor; - -import org.eclipse.emf.ecore.EAttribute; -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.ecore.EPackage; -import org.eclipse.emf.ecore.EReference; - -/** - * <!-- begin-user-doc --> The <b>Package</b> for the model. It contains - * accessors for the meta objects to represent - * <ul> - * <li>each class,</li> - * <li>each feature of each class,</li> - * <li>each enum,</li> - * <li>and each data type</li> - * </ul> - * <!-- end-user-doc --> - * - * @see org.eclipse.emf.facet.widgets.celleditors.modelCellEditor.ModelCellEditorFactory - * @model kind="package" - * @generated - */ -public interface ModelCellEditorPackage extends EPackage { - /** - * The package name. <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - String eNAME = "modelCellEditor"; //$NON-NLS-1$ - - /** - * The package namespace URI. <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - String eNS_URI = "http://www.eclipse.org/EMF_Facet/ModelCellEditor/0.1.0/modelCellEditor"; //$NON-NLS-1$ - - /** - * The package namespace name. <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - String eNS_PREFIX = "modelCellEditor"; //$NON-NLS-1$ - - /** - * The singleton instance of the package. <!-- begin-user-doc --> <!-- - * end-user-doc --> - * - * @generated - */ - ModelCellEditorPackage eINSTANCE = org.eclipse.emf.facet.widgets.celleditors.modelCellEditor.impl.ModelCellEditorPackageImpl - .init(); - - /** - * The meta object id for the ' - * {@link org.eclipse.emf.facet.widgets.celleditors.modelCellEditor.impl.ModelCellEditorDeclarationsImpl - * <em>Declarations</em>}' class. <!-- begin-user-doc --> <!-- end-user-doc - * --> - * - * @see org.eclipse.emf.facet.widgets.celleditors.modelCellEditor.impl.ModelCellEditorDeclarationsImpl - * @see org.eclipse.emf.facet.widgets.celleditors.modelCellEditor.impl.ModelCellEditorPackageImpl#getModelCellEditorDeclarations() - * @generated - */ - int MODEL_CELL_EDITOR_DECLARATIONS = 0; - - /** - * The feature id for the '<em><b>Model Cell Editors</b></em>' containment - * reference list. <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - * @ordered - */ - int MODEL_CELL_EDITOR_DECLARATIONS__MODEL_CELL_EDITORS = 0; - - /** - * The number of structural features of the '<em>Declarations</em>' class. - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - * @ordered - */ - int MODEL_CELL_EDITOR_DECLARATIONS_FEATURE_COUNT = 1; - - /** - * The meta object id for the ' - * {@link org.eclipse.emf.facet.widgets.celleditors.modelCellEditor.impl.AbstractModelCellEditorImpl - * <em>Abstract Model Cell Editor</em>}' class. <!-- begin-user-doc --> <!-- - * end-user-doc --> - * - * @see org.eclipse.emf.facet.widgets.celleditors.modelCellEditor.impl.AbstractModelCellEditorImpl - * @see org.eclipse.emf.facet.widgets.celleditors.modelCellEditor.impl.ModelCellEditorPackageImpl#getAbstractModelCellEditor() - * @generated - */ - int ABSTRACT_MODEL_CELL_EDITOR = 1; - - /** - * The feature id for the '<em><b>Cell Type</b></em>' reference. <!-- - * begin-user-doc --> <!-- end-user-doc --> - * - * @generated - * @ordered - */ - int ABSTRACT_MODEL_CELL_EDITOR__CELL_TYPE = 0; - - /** - * The feature id for the '<em><b>Cell Id</b></em>' attribute. <!-- - * begin-user-doc --> <!-- end-user-doc --> - * - * @generated - * @ordered - */ - int ABSTRACT_MODEL_CELL_EDITOR__CELL_ID = 1; - - /** - * The number of structural features of the ' - * <em>Abstract Model Cell Editor</em>' class. <!-- begin-user-doc --> <!-- - * end-user-doc --> - * - * @generated - * @ordered - */ - int ABSTRACT_MODEL_CELL_EDITOR_FEATURE_COUNT = 2; - - /** - * The meta object id for the ' - * {@link org.eclipse.emf.facet.widgets.celleditors.modelCellEditor.impl.BasicCellEditorImpl - * <em>Basic Cell Editor</em>}' class. <!-- begin-user-doc --> <!-- - * end-user-doc --> - * - * @see org.eclipse.emf.facet.widgets.celleditors.modelCellEditor.impl.BasicCellEditorImpl - * @see org.eclipse.emf.facet.widgets.celleditors.modelCellEditor.impl.ModelCellEditorPackageImpl#getBasicCellEditor() - * @generated - */ - int BASIC_CELL_EDITOR = 2; - - /** - * The feature id for the '<em><b>Cell Type</b></em>' reference. <!-- - * begin-user-doc --> <!-- end-user-doc --> - * - * @generated - * @ordered - */ - int BASIC_CELL_EDITOR__CELL_TYPE = ModelCellEditorPackage.ABSTRACT_MODEL_CELL_EDITOR__CELL_TYPE; - - /** - * The feature id for the '<em><b>Cell Id</b></em>' attribute. <!-- - * begin-user-doc --> <!-- end-user-doc --> - * - * @generated - * @ordered - */ - int BASIC_CELL_EDITOR__CELL_ID = ModelCellEditorPackage.ABSTRACT_MODEL_CELL_EDITOR__CELL_ID; - - /** - * The feature id for the '<em><b>Basic Cell Editor Impl</b></em>' - * attribute. <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - * @ordered - */ - int BASIC_CELL_EDITOR__BASIC_CELL_EDITOR_IMPL = ModelCellEditorPackage.ABSTRACT_MODEL_CELL_EDITOR_FEATURE_COUNT + 0; - - /** - * The number of structural features of the '<em>Basic Cell Editor</em>' - * class. <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - * @ordered - */ - int BASIC_CELL_EDITOR_FEATURE_COUNT = ModelCellEditorPackage.ABSTRACT_MODEL_CELL_EDITOR_FEATURE_COUNT + 1; - - /** - * The meta object id for the ' - * {@link org.eclipse.emf.facet.widgets.celleditors.modelCellEditor.impl.UnaryReferenceCellEditorImpl - * <em>Unary Reference Cell Editor</em>}' class. <!-- begin-user-doc --> - * <!-- end-user-doc --> - * - * @see org.eclipse.emf.facet.widgets.celleditors.modelCellEditor.impl.UnaryReferenceCellEditorImpl - * @see org.eclipse.emf.facet.widgets.celleditors.modelCellEditor.impl.ModelCellEditorPackageImpl#getUnaryReferenceCellEditor() - * @generated - */ - int UNARY_REFERENCE_CELL_EDITOR = 3; - - /** - * The feature id for the '<em><b>Cell Type</b></em>' reference. <!-- - * begin-user-doc --> <!-- end-user-doc --> - * - * @generated - * @ordered - */ - int UNARY_REFERENCE_CELL_EDITOR__CELL_TYPE = ModelCellEditorPackage.ABSTRACT_MODEL_CELL_EDITOR__CELL_TYPE; - - /** - * The feature id for the '<em><b>Cell Id</b></em>' attribute. <!-- - * begin-user-doc --> <!-- end-user-doc --> - * - * @generated - * @ordered - */ - int UNARY_REFERENCE_CELL_EDITOR__CELL_ID = ModelCellEditorPackage.ABSTRACT_MODEL_CELL_EDITOR__CELL_ID; - - /** - * The feature id for the '<em><b>Unary Reference Cell Editor Impl</b></em>' - * attribute. <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - * @ordered - */ - int UNARY_REFERENCE_CELL_EDITOR__UNARY_REFERENCE_CELL_EDITOR_IMPL = ModelCellEditorPackage.ABSTRACT_MODEL_CELL_EDITOR_FEATURE_COUNT + 0; - - /** - * The number of structural features of the ' - * <em>Unary Reference Cell Editor</em>' class. <!-- begin-user-doc --> <!-- - * end-user-doc --> - * - * @generated - * @ordered - */ - int UNARY_REFERENCE_CELL_EDITOR_FEATURE_COUNT = ModelCellEditorPackage.ABSTRACT_MODEL_CELL_EDITOR_FEATURE_COUNT + 1; - - /** - * The meta object id for the ' - * {@link org.eclipse.emf.facet.widgets.celleditors.modelCellEditor.impl.NaryFeatureCellEditorImpl - * <em>Nary Feature Cell Editor</em>}' class. <!-- begin-user-doc --> <!-- - * end-user-doc --> - * - * @see org.eclipse.emf.facet.widgets.celleditors.modelCellEditor.impl.NaryFeatureCellEditorImpl - * @see org.eclipse.emf.facet.widgets.celleditors.modelCellEditor.impl.ModelCellEditorPackageImpl#getNaryFeatureCellEditor() - * @generated - */ - int NARY_FEATURE_CELL_EDITOR = 4; - - /** - * The feature id for the '<em><b>Cell Type</b></em>' reference. <!-- - * begin-user-doc --> <!-- end-user-doc --> - * - * @generated - * @ordered - */ - int NARY_FEATURE_CELL_EDITOR__CELL_TYPE = ModelCellEditorPackage.ABSTRACT_MODEL_CELL_EDITOR__CELL_TYPE; - - /** - * The feature id for the '<em><b>Cell Id</b></em>' attribute. <!-- - * begin-user-doc --> <!-- end-user-doc --> - * - * @generated - * @ordered - */ - int NARY_FEATURE_CELL_EDITOR__CELL_ID = ModelCellEditorPackage.ABSTRACT_MODEL_CELL_EDITOR__CELL_ID; - - /** - * The feature id for the '<em><b>Nary Feature Cell Editor Impl</b></em>' - * attribute. <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - * @ordered - */ - int NARY_FEATURE_CELL_EDITOR__NARY_FEATURE_CELL_EDITOR_IMPL = ModelCellEditorPackage.ABSTRACT_MODEL_CELL_EDITOR_FEATURE_COUNT + 0; - - /** - * The number of structural features of the ' - * <em>Nary Feature Cell Editor</em>' class. <!-- begin-user-doc --> <!-- - * end-user-doc --> - * - * @generated - * @ordered - */ - int NARY_FEATURE_CELL_EDITOR_FEATURE_COUNT = ModelCellEditorPackage.ABSTRACT_MODEL_CELL_EDITOR_FEATURE_COUNT + 1; - - /** - * Returns the meta object for class ' - * {@link org.eclipse.emf.facet.widgets.celleditors.modelCellEditor.ModelCellEditorDeclarations - * <em>Declarations</em>}'. <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @return the meta object for class '<em>Declarations</em>'. - * @see org.eclipse.emf.facet.widgets.celleditors.modelCellEditor.ModelCellEditorDeclarations - * @generated - */ - EClass getModelCellEditorDeclarations(); - - /** - * Returns the meta object for the containment reference list ' - * {@link org.eclipse.emf.facet.widgets.celleditors.modelCellEditor.ModelCellEditorDeclarations#getModelCellEditors - * <em>Model Cell Editors</em>}'. <!-- begin-user-doc --> <!-- end-user-doc - * --> - * - * @return the meta object for the containment reference list ' - * <em>Model Cell Editors</em>'. - * @see org.eclipse.emf.facet.widgets.celleditors.modelCellEditor.ModelCellEditorDeclarations#getModelCellEditors() - * @see #getModelCellEditorDeclarations() - * @generated - */ - EReference getModelCellEditorDeclarations_ModelCellEditors(); - - /** - * Returns the meta object for class ' - * {@link org.eclipse.emf.facet.widgets.celleditors.modelCellEditor.AbstractModelCellEditor - * <em>Abstract Model Cell Editor</em>}'. <!-- begin-user-doc --> <!-- - * end-user-doc --> - * - * @return the meta object for class '<em>Abstract Model Cell Editor</em>'. - * @see org.eclipse.emf.facet.widgets.celleditors.modelCellEditor.AbstractModelCellEditor - * @generated - */ - EClass getAbstractModelCellEditor(); - - /** - * Returns the meta object for the reference ' - * {@link org.eclipse.emf.facet.widgets.celleditors.modelCellEditor.AbstractModelCellEditor#getCellType - * <em>Cell Type</em>}'. <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @return the meta object for the reference '<em>Cell Type</em>'. - * @see org.eclipse.emf.facet.widgets.celleditors.modelCellEditor.AbstractModelCellEditor#getCellType() - * @see #getAbstractModelCellEditor() - * @generated - */ - EReference getAbstractModelCellEditor_CellType(); - - /** - * Returns the meta object for the attribute ' - * {@link org.eclipse.emf.facet.widgets.celleditors.modelCellEditor.AbstractModelCellEditor#getCellId - * <em>Cell Id</em>}'. <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @return the meta object for the attribute '<em>Cell Id</em>'. - * @see org.eclipse.emf.facet.widgets.celleditors.modelCellEditor.AbstractModelCellEditor#getCellId() - * @see #getAbstractModelCellEditor() - * @generated - */ - EAttribute getAbstractModelCellEditor_CellId(); - - /** - * Returns the meta object for class ' - * {@link org.eclipse.emf.facet.widgets.celleditors.modelCellEditor.BasicCellEditor - * <em>Basic Cell Editor</em>}'. <!-- begin-user-doc --> <!-- end-user-doc - * --> - * - * @return the meta object for class '<em>Basic Cell Editor</em>'. - * @see org.eclipse.emf.facet.widgets.celleditors.modelCellEditor.BasicCellEditor - * @generated - */ - EClass getBasicCellEditor(); - - /** - * Returns the meta object for the attribute ' - * {@link org.eclipse.emf.facet.widgets.celleditors.modelCellEditor.BasicCellEditor#getBasicCellEditorImpl - * <em>Basic Cell Editor Impl</em>}'. <!-- begin-user-doc --> <!-- - * end-user-doc --> - * - * @return the meta object for the attribute ' - * <em>Basic Cell Editor Impl</em>'. - * @see org.eclipse.emf.facet.widgets.celleditors.modelCellEditor.BasicCellEditor#getBasicCellEditorImpl() - * @see #getBasicCellEditor() - * @generated - */ - EAttribute getBasicCellEditor_BasicCellEditorImpl(); - - /** - * Returns the meta object for class ' - * {@link org.eclipse.emf.facet.widgets.celleditors.modelCellEditor.UnaryReferenceCellEditor - * <em>Unary Reference Cell Editor</em>}'. <!-- begin-user-doc --> <!-- - * end-user-doc --> - * - * @return the meta object for class '<em>Unary Reference Cell Editor</em>'. - * @see org.eclipse.emf.facet.widgets.celleditors.modelCellEditor.UnaryReferenceCellEditor - * @generated - */ - EClass getUnaryReferenceCellEditor(); - - /** - * Returns the meta object for the attribute ' - * {@link org.eclipse.emf.facet.widgets.celleditors.modelCellEditor.UnaryReferenceCellEditor#getUnaryReferenceCellEditorImpl - * <em>Unary Reference Cell Editor Impl</em>}'. <!-- begin-user-doc --> <!-- - * end-user-doc --> - * - * @return the meta object for the attribute ' - * <em>Unary Reference Cell Editor Impl</em>'. - * @see org.eclipse.emf.facet.widgets.celleditors.modelCellEditor.UnaryReferenceCellEditor#getUnaryReferenceCellEditorImpl() - * @see #getUnaryReferenceCellEditor() - * @generated - */ - EAttribute getUnaryReferenceCellEditor_UnaryReferenceCellEditorImpl(); - - /** - * Returns the meta object for class ' - * {@link org.eclipse.emf.facet.widgets.celleditors.modelCellEditor.NaryFeatureCellEditor - * <em>Nary Feature Cell Editor</em>}'. <!-- begin-user-doc --> <!-- - * end-user-doc --> - * - * @return the meta object for class '<em>Nary Feature Cell Editor</em>'. - * @see org.eclipse.emf.facet.widgets.celleditors.modelCellEditor.NaryFeatureCellEditor - * @generated - */ - EClass getNaryFeatureCellEditor(); - - /** - * Returns the meta object for the attribute ' - * {@link org.eclipse.emf.facet.widgets.celleditors.modelCellEditor.NaryFeatureCellEditor#getNaryFeatureCellEditorImpl - * <em>Nary Feature Cell Editor Impl</em>}'. <!-- begin-user-doc --> <!-- - * end-user-doc --> - * - * @return the meta object for the attribute ' - * <em>Nary Feature Cell Editor Impl</em>'. - * @see org.eclipse.emf.facet.widgets.celleditors.modelCellEditor.NaryFeatureCellEditor#getNaryFeatureCellEditorImpl() - * @see #getNaryFeatureCellEditor() - * @generated - */ - EAttribute getNaryFeatureCellEditor_NaryFeatureCellEditorImpl(); - - /** - * Returns the factory that creates the instances of the model. <!-- - * begin-user-doc --> <!-- end-user-doc --> - * - * @return the factory that creates the instances of the model. - * @generated - */ - ModelCellEditorFactory getModelCellEditorFactory(); - - /** - * <!-- begin-user-doc --> Defines literals for the meta objects that - * represent - * <ul> - * <li>each class,</li> - * <li>each feature of each class,</li> - * <li>each enum,</li> - * <li>and each data type</li> - * </ul> - * <!-- end-user-doc --> - * - * @generated - */ - interface Literals { - /** - * The meta object literal for the ' - * {@link org.eclipse.emf.facet.widgets.celleditors.modelCellEditor.impl.ModelCellEditorDeclarationsImpl - * <em>Declarations</em>}' class. <!-- begin-user-doc --> <!-- - * end-user-doc --> - * - * @see org.eclipse.emf.facet.widgets.celleditors.modelCellEditor.impl.ModelCellEditorDeclarationsImpl - * @see org.eclipse.emf.facet.widgets.celleditors.modelCellEditor.impl.ModelCellEditorPackageImpl#getModelCellEditorDeclarations() - * @generated - */ - EClass MODEL_CELL_EDITOR_DECLARATIONS = ModelCellEditorPackage.eINSTANCE - .getModelCellEditorDeclarations(); - - /** - * The meta object literal for the '<em><b>Model Cell Editors</b></em>' - * containment reference list feature. <!-- begin-user-doc --> <!-- - * end-user-doc --> - * - * @generated - */ - EReference MODEL_CELL_EDITOR_DECLARATIONS__MODEL_CELL_EDITORS = ModelCellEditorPackage.eINSTANCE - .getModelCellEditorDeclarations_ModelCellEditors(); - - /** - * The meta object literal for the ' - * {@link org.eclipse.emf.facet.widgets.celleditors.modelCellEditor.impl.AbstractModelCellEditorImpl - * <em>Abstract Model Cell Editor</em>}' class. <!-- begin-user-doc --> - * <!-- end-user-doc --> - * - * @see org.eclipse.emf.facet.widgets.celleditors.modelCellEditor.impl.AbstractModelCellEditorImpl - * @see org.eclipse.emf.facet.widgets.celleditors.modelCellEditor.impl.ModelCellEditorPackageImpl#getAbstractModelCellEditor() - * @generated - */ - EClass ABSTRACT_MODEL_CELL_EDITOR = ModelCellEditorPackage.eINSTANCE - .getAbstractModelCellEditor(); - - /** - * The meta object literal for the '<em><b>Cell Type</b></em>' reference - * feature. <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - EReference ABSTRACT_MODEL_CELL_EDITOR__CELL_TYPE = ModelCellEditorPackage.eINSTANCE - .getAbstractModelCellEditor_CellType(); - - /** - * The meta object literal for the '<em><b>Cell Id</b></em>' attribute - * feature. <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - EAttribute ABSTRACT_MODEL_CELL_EDITOR__CELL_ID = ModelCellEditorPackage.eINSTANCE - .getAbstractModelCellEditor_CellId(); - - /** - * The meta object literal for the ' - * {@link org.eclipse.emf.facet.widgets.celleditors.modelCellEditor.impl.BasicCellEditorImpl - * <em>Basic Cell Editor</em>}' class. <!-- begin-user-doc --> <!-- - * end-user-doc --> - * - * @see org.eclipse.emf.facet.widgets.celleditors.modelCellEditor.impl.BasicCellEditorImpl - * @see org.eclipse.emf.facet.widgets.celleditors.modelCellEditor.impl.ModelCellEditorPackageImpl#getBasicCellEditor() - * @generated - */ - EClass BASIC_CELL_EDITOR = ModelCellEditorPackage.eINSTANCE.getBasicCellEditor(); - - /** - * The meta object literal for the ' - * <em><b>Basic Cell Editor Impl</b></em>' attribute feature. <!-- - * begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - EAttribute BASIC_CELL_EDITOR__BASIC_CELL_EDITOR_IMPL = ModelCellEditorPackage.eINSTANCE - .getBasicCellEditor_BasicCellEditorImpl(); - - /** - * The meta object literal for the ' - * {@link org.eclipse.emf.facet.widgets.celleditors.modelCellEditor.impl.UnaryReferenceCellEditorImpl - * <em>Unary Reference Cell Editor</em>}' class. <!-- begin-user-doc --> - * <!-- end-user-doc --> - * - * @see org.eclipse.emf.facet.widgets.celleditors.modelCellEditor.impl.UnaryReferenceCellEditorImpl - * @see org.eclipse.emf.facet.widgets.celleditors.modelCellEditor.impl.ModelCellEditorPackageImpl#getUnaryReferenceCellEditor() - * @generated - */ - EClass UNARY_REFERENCE_CELL_EDITOR = ModelCellEditorPackage.eINSTANCE - .getUnaryReferenceCellEditor(); - - /** - * The meta object literal for the ' - * <em><b>Unary Reference Cell Editor Impl</b></em>' attribute feature. - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - EAttribute UNARY_REFERENCE_CELL_EDITOR__UNARY_REFERENCE_CELL_EDITOR_IMPL = ModelCellEditorPackage.eINSTANCE - .getUnaryReferenceCellEditor_UnaryReferenceCellEditorImpl(); - - /** - * The meta object literal for the ' - * {@link org.eclipse.emf.facet.widgets.celleditors.modelCellEditor.impl.NaryFeatureCellEditorImpl - * <em>Nary Feature Cell Editor</em>}' class. <!-- begin-user-doc --> - * <!-- end-user-doc --> - * - * @see org.eclipse.emf.facet.widgets.celleditors.modelCellEditor.impl.NaryFeatureCellEditorImpl - * @see org.eclipse.emf.facet.widgets.celleditors.modelCellEditor.impl.ModelCellEditorPackageImpl#getNaryFeatureCellEditor() - * @generated - */ - EClass NARY_FEATURE_CELL_EDITOR = ModelCellEditorPackage.eINSTANCE - .getNaryFeatureCellEditor(); - - /** - * The meta object literal for the ' - * <em><b>Nary Feature Cell Editor Impl</b></em>' attribute feature. - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - EAttribute NARY_FEATURE_CELL_EDITOR__NARY_FEATURE_CELL_EDITOR_IMPL = ModelCellEditorPackage.eINSTANCE - .getNaryFeatureCellEditor_NaryFeatureCellEditorImpl(); - - } - -} // ModelCellEditorPackage
diff --git a/org.eclipse.modisco.facet.widgets.celleditors/src/org/eclipse/emf/facet/widgets/celleditors/modelCellEditor/NaryFeatureCellEditor.java b/org.eclipse.modisco.facet.widgets.celleditors/src/org/eclipse/emf/facet/widgets/celleditors/modelCellEditor/NaryFeatureCellEditor.java deleted file mode 100644 index a8919ea..0000000 --- a/org.eclipse.modisco.facet.widgets.celleditors/src/org/eclipse/emf/facet/widgets/celleditors/modelCellEditor/NaryFeatureCellEditor.java +++ /dev/null
@@ -1,64 +0,0 @@ -/** - * Copyright (c) 2010 CEA LIST. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Nicolas Bros (Mia-Software) - initial API and implementation - */ -package org.eclipse.emf.facet.widgets.celleditors.modelCellEditor; - -/** - * <!-- begin-user-doc --> A representation of the model object ' - * <em><b>Nary Feature Cell Editor</b></em>'. <!-- end-user-doc --> - * - * <p> - * The following features are supported: - * <ul> - * <li> - * {@link org.eclipse.emf.facet.widgets.celleditors.modelCellEditor.NaryFeatureCellEditor#getNaryFeatureCellEditorImpl - * <em>Nary Feature Cell Editor Impl</em>}</li> - * </ul> - * </p> - * - * @see org.eclipse.emf.facet.widgets.celleditors.modelCellEditor.ModelCellEditorPackage#getNaryFeatureCellEditor() - * @model - * @generated - */ -public interface NaryFeatureCellEditor extends AbstractModelCellEditor { - /** - * Returns the value of the '<em><b>Nary Feature Cell Editor Impl</b></em>' - * attribute. <!-- begin-user-doc --> - * <p> - * If the meaning of the '<em>Nary Feature Cell Editor Impl</em>' attribute - * isn't clear, there really should be more of a description here... - * </p> - * <!-- end-user-doc --> - * - * @return the value of the '<em>Nary Feature Cell Editor Impl</em>' - * attribute. - * @see #setNaryFeatureCellEditorImpl(String) - * @see org.eclipse.emf.facet.widgets.celleditors.modelCellEditor.ModelCellEditorPackage#getNaryFeatureCellEditor_NaryFeatureCellEditorImpl() - * @model required="true" - * @generated - */ - String getNaryFeatureCellEditorImpl(); - - /** - * Sets the value of the ' - * {@link org.eclipse.emf.facet.widgets.celleditors.modelCellEditor.NaryFeatureCellEditor#getNaryFeatureCellEditorImpl - * <em>Nary Feature Cell Editor Impl</em>}' attribute. <!-- begin-user-doc - * --> <!-- end-user-doc --> - * - * @param value - * the new value of the '<em>Nary Feature Cell Editor Impl</em>' - * attribute. - * @see #getNaryFeatureCellEditorImpl() - * @generated - */ - void setNaryFeatureCellEditorImpl(String value); - -} // NaryFeatureCellEditor
diff --git a/org.eclipse.modisco.facet.widgets.celleditors/src/org/eclipse/emf/facet/widgets/celleditors/modelCellEditor/UnaryReferenceCellEditor.java b/org.eclipse.modisco.facet.widgets.celleditors/src/org/eclipse/emf/facet/widgets/celleditors/modelCellEditor/UnaryReferenceCellEditor.java deleted file mode 100644 index a2207e2..0000000 --- a/org.eclipse.modisco.facet.widgets.celleditors/src/org/eclipse/emf/facet/widgets/celleditors/modelCellEditor/UnaryReferenceCellEditor.java +++ /dev/null
@@ -1,66 +0,0 @@ -/** - * Copyright (c) 2010 CEA LIST. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Nicolas Bros (Mia-Software) - initial API and implementation - */ -package org.eclipse.emf.facet.widgets.celleditors.modelCellEditor; - -/** - * <!-- begin-user-doc --> A representation of the model object ' - * <em><b>Unary Reference Cell Editor</b></em>'. <!-- end-user-doc --> - * - * <p> - * The following features are supported: - * <ul> - * <li> - * {@link org.eclipse.emf.facet.widgets.celleditors.modelCellEditor.UnaryReferenceCellEditor#getUnaryReferenceCellEditorImpl - * <em>Unary Reference Cell Editor Impl</em>}</li> - * </ul> - * </p> - * - * @see org.eclipse.emf.facet.widgets.celleditors.modelCellEditor.ModelCellEditorPackage#getUnaryReferenceCellEditor() - * @model - * @generated - */ -public interface UnaryReferenceCellEditor extends AbstractModelCellEditor { - /** - * Returns the value of the ' - * <em><b>Unary Reference Cell Editor Impl</b></em>' attribute. <!-- - * begin-user-doc --> - * <p> - * If the meaning of the '<em>Unary Reference Cell Editor Impl</em>' - * attribute isn't clear, there really should be more of a description - * here... - * </p> - * <!-- end-user-doc --> - * - * @return the value of the '<em>Unary Reference Cell Editor Impl</em>' - * attribute. - * @see #setUnaryReferenceCellEditorImpl(String) - * @see org.eclipse.emf.facet.widgets.celleditors.modelCellEditor.ModelCellEditorPackage#getUnaryReferenceCellEditor_UnaryReferenceCellEditorImpl() - * @model required="true" - * @generated - */ - String getUnaryReferenceCellEditorImpl(); - - /** - * Sets the value of the ' - * {@link org.eclipse.emf.facet.widgets.celleditors.modelCellEditor.UnaryReferenceCellEditor#getUnaryReferenceCellEditorImpl - * <em>Unary Reference Cell Editor Impl</em>}' attribute. <!-- - * begin-user-doc --> <!-- end-user-doc --> - * - * @param value - * the new value of the ' - * <em>Unary Reference Cell Editor Impl</em>' attribute. - * @see #getUnaryReferenceCellEditorImpl() - * @generated - */ - void setUnaryReferenceCellEditorImpl(String value); - -} // UnaryReferenceCellEditor
diff --git a/org.eclipse.modisco.facet.widgets.celleditors/src/org/eclipse/emf/facet/widgets/celleditors/modelCellEditor/impl/AbstractModelCellEditorImpl.java b/org.eclipse.modisco.facet.widgets.celleditors/src/org/eclipse/emf/facet/widgets/celleditors/modelCellEditor/impl/AbstractModelCellEditorImpl.java deleted file mode 100644 index 0239831..0000000 --- a/org.eclipse.modisco.facet.widgets.celleditors/src/org/eclipse/emf/facet/widgets/celleditors/modelCellEditor/impl/AbstractModelCellEditorImpl.java +++ /dev/null
@@ -1,260 +0,0 @@ -/** - * Copyright (c) 2010 CEA LIST. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Nicolas Bros (Mia-Software) - initial API and implementation - */ -package org.eclipse.emf.facet.widgets.celleditors.modelCellEditor.impl; - -import org.eclipse.emf.common.notify.Notification; -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.ecore.EClassifier; -import org.eclipse.emf.ecore.InternalEObject; -import org.eclipse.emf.ecore.impl.ENotificationImpl; -import org.eclipse.emf.ecore.impl.EObjectImpl; -import org.eclipse.emf.facet.widgets.celleditors.modelCellEditor.AbstractModelCellEditor; -import org.eclipse.emf.facet.widgets.celleditors.modelCellEditor.ModelCellEditorPackage; - -/** - * <!-- begin-user-doc --> An implementation of the model object ' - * <em><b>Abstract Model Cell Editor</b></em>'. <!-- end-user-doc --> - * <p> - * The following features are implemented: - * <ul> - * <li> - * {@link org.eclipse.emf.facet.widgets.celleditors.modelCellEditor.impl.AbstractModelCellEditorImpl#getCellType - * <em>Cell Type</em>}</li> - * <li> - * {@link org.eclipse.emf.facet.widgets.celleditors.modelCellEditor.impl.AbstractModelCellEditorImpl#getCellId - * <em>Cell Id</em>}</li> - * </ul> - * </p> - * - * @generated - */ -public abstract class AbstractModelCellEditorImpl extends EObjectImpl implements - AbstractModelCellEditor { - /** - * The cached value of the '{@link #getCellType() <em>Cell Type</em>}' - * reference. <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @see #getCellType() - * @generated - * @ordered - */ - protected EClassifier cellType; - - /** - * The default value of the '{@link #getCellId() <em>Cell Id</em>}' - * attribute. <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @see #getCellId() - * @generated - * @ordered - */ - protected static final String CELL_ID_EDEFAULT = null; - - /** - * The cached value of the '{@link #getCellId() <em>Cell Id</em>}' - * attribute. <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @see #getCellId() - * @generated - * @ordered - */ - protected String cellId = AbstractModelCellEditorImpl.CELL_ID_EDEFAULT; - - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - protected AbstractModelCellEditorImpl() { - super(); - } - - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - @Override - protected EClass eStaticClass() { - return ModelCellEditorPackage.Literals.ABSTRACT_MODEL_CELL_EDITOR; - } - - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - public EClassifier getCellType() { - if (this.cellType != null && this.cellType.eIsProxy()) { - InternalEObject oldCellType = (InternalEObject) this.cellType; - this.cellType = (EClassifier) eResolveProxy(oldCellType); - if (this.cellType != oldCellType) { - if (eNotificationRequired()) { - eNotify(new ENotificationImpl(this, Notification.RESOLVE, - ModelCellEditorPackage.ABSTRACT_MODEL_CELL_EDITOR__CELL_TYPE, - oldCellType, this.cellType)); - } - } - } - return this.cellType; - } - - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - public EClassifier basicGetCellType() { - return this.cellType; - } - - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - public void setCellType(final EClassifier newCellType) { - EClassifier oldCellType = this.cellType; - this.cellType = newCellType; - if (eNotificationRequired()) { - eNotify(new ENotificationImpl(this, Notification.SET, - ModelCellEditorPackage.ABSTRACT_MODEL_CELL_EDITOR__CELL_TYPE, oldCellType, - this.cellType)); - } - } - - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - public String getCellId() { - return this.cellId; - } - - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - public void setCellId(final String newCellId) { - String oldCellId = this.cellId; - this.cellId = newCellId; - if (eNotificationRequired()) { - eNotify(new ENotificationImpl(this, Notification.SET, - ModelCellEditorPackage.ABSTRACT_MODEL_CELL_EDITOR__CELL_ID, oldCellId, - this.cellId)); - } - } - - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - public String getModelCellEditorImpl() { - // TODO: implement this method - // Ensure that you remove @generated or mark it @generated NOT - throw new UnsupportedOperationException(); - } - - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - @Override - public Object eGet(final int featureID, final boolean resolve, final boolean coreType) { - switch (featureID) { - case ModelCellEditorPackage.ABSTRACT_MODEL_CELL_EDITOR__CELL_TYPE: - if (resolve) { - return getCellType(); - } - return basicGetCellType(); - case ModelCellEditorPackage.ABSTRACT_MODEL_CELL_EDITOR__CELL_ID: - return getCellId(); - } - return super.eGet(featureID, resolve, coreType); - } - - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - @Override - public void eSet(final int featureID, final Object newValue) { - switch (featureID) { - case ModelCellEditorPackage.ABSTRACT_MODEL_CELL_EDITOR__CELL_TYPE: - setCellType((EClassifier) newValue); - return; - case ModelCellEditorPackage.ABSTRACT_MODEL_CELL_EDITOR__CELL_ID: - setCellId((String) newValue); - return; - } - super.eSet(featureID, newValue); - } - - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - @Override - public void eUnset(final int featureID) { - switch (featureID) { - case ModelCellEditorPackage.ABSTRACT_MODEL_CELL_EDITOR__CELL_TYPE: - setCellType((EClassifier) null); - return; - case ModelCellEditorPackage.ABSTRACT_MODEL_CELL_EDITOR__CELL_ID: - setCellId(AbstractModelCellEditorImpl.CELL_ID_EDEFAULT); - return; - } - super.eUnset(featureID); - } - - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - @Override - public boolean eIsSet(final int featureID) { - switch (featureID) { - case ModelCellEditorPackage.ABSTRACT_MODEL_CELL_EDITOR__CELL_TYPE: - return this.cellType != null; - case ModelCellEditorPackage.ABSTRACT_MODEL_CELL_EDITOR__CELL_ID: - return AbstractModelCellEditorImpl.CELL_ID_EDEFAULT == null ? this.cellId != null - : !AbstractModelCellEditorImpl.CELL_ID_EDEFAULT.equals(this.cellId); - } - return super.eIsSet(featureID); - } - - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - @Override - public String toString() { - if (eIsProxy()) { - return super.toString(); - } - - StringBuffer result = new StringBuffer(super.toString()); - result.append(" (cellId: "); //$NON-NLS-1$ - result.append(this.cellId); - result.append(')'); - return result.toString(); - } - -} // AbstractModelCellEditorImpl
diff --git a/org.eclipse.modisco.facet.widgets.celleditors/src/org/eclipse/emf/facet/widgets/celleditors/modelCellEditor/impl/BasicCellEditorImpl.java b/org.eclipse.modisco.facet.widgets.celleditors/src/org/eclipse/emf/facet/widgets/celleditors/modelCellEditor/impl/BasicCellEditorImpl.java deleted file mode 100644 index 9538c31..0000000 --- a/org.eclipse.modisco.facet.widgets.celleditors/src/org/eclipse/emf/facet/widgets/celleditors/modelCellEditor/impl/BasicCellEditorImpl.java +++ /dev/null
@@ -1,184 +0,0 @@ -/** - * Copyright (c) 2010 CEA LIST. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Nicolas Bros (Mia-Software) - initial API and implementation - */ -package org.eclipse.emf.facet.widgets.celleditors.modelCellEditor.impl; - -import org.eclipse.emf.common.notify.Notification; -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.ecore.impl.ENotificationImpl; -import org.eclipse.emf.facet.widgets.celleditors.modelCellEditor.BasicCellEditor; -import org.eclipse.emf.facet.widgets.celleditors.modelCellEditor.ModelCellEditorPackage; - -/** - * <!-- begin-user-doc --> An implementation of the model object ' - * <em><b>Basic Cell Editor</b></em>'. <!-- end-user-doc --> - * <p> - * The following features are implemented: - * <ul> - * <li> - * {@link org.eclipse.emf.facet.widgets.celleditors.modelCellEditor.impl.BasicCellEditorImpl#getBasicCellEditorImpl - * <em>Basic Cell Editor Impl</em>}</li> - * </ul> - * </p> - * - * @generated - */ -public class BasicCellEditorImpl extends AbstractModelCellEditorImpl implements BasicCellEditor { - /** - * The default value of the '{@link #getBasicCellEditorImpl() - * <em>Basic Cell Editor Impl</em>}' attribute. <!-- begin-user-doc --> <!-- - * end-user-doc --> - * - * @see #getBasicCellEditorImpl() - * @generated - * @ordered - */ - protected static final String BASIC_CELL_EDITOR_IMPL_EDEFAULT = null; - - /** - * The cached value of the '{@link #getBasicCellEditorImpl() - * <em>Basic Cell Editor Impl</em>}' attribute. <!-- begin-user-doc --> <!-- - * end-user-doc --> - * - * @see #getBasicCellEditorImpl() - * @generated - * @ordered - */ - protected String basicCellEditorImpl = BasicCellEditorImpl.BASIC_CELL_EDITOR_IMPL_EDEFAULT; - - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - protected BasicCellEditorImpl() { - super(); - } - - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - @Override - protected EClass eStaticClass() { - return ModelCellEditorPackage.Literals.BASIC_CELL_EDITOR; - } - - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - public String getBasicCellEditorImpl() { - return this.basicCellEditorImpl; - } - - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - public void setBasicCellEditorImpl(final String newBasicCellEditorImpl) { - String oldBasicCellEditorImpl = this.basicCellEditorImpl; - this.basicCellEditorImpl = newBasicCellEditorImpl; - if (eNotificationRequired()) { - eNotify(new ENotificationImpl(this, Notification.SET, - ModelCellEditorPackage.BASIC_CELL_EDITOR__BASIC_CELL_EDITOR_IMPL, - oldBasicCellEditorImpl, this.basicCellEditorImpl)); - } - } - - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - @Override - public Object eGet(final int featureID, final boolean resolve, final boolean coreType) { - switch (featureID) { - case ModelCellEditorPackage.BASIC_CELL_EDITOR__BASIC_CELL_EDITOR_IMPL: - return getBasicCellEditorImpl(); - } - return super.eGet(featureID, resolve, coreType); - } - - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - @Override - public void eSet(final int featureID, final Object newValue) { - switch (featureID) { - case ModelCellEditorPackage.BASIC_CELL_EDITOR__BASIC_CELL_EDITOR_IMPL: - setBasicCellEditorImpl((String) newValue); - return; - } - super.eSet(featureID, newValue); - } - - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - @Override - public void eUnset(final int featureID) { - switch (featureID) { - case ModelCellEditorPackage.BASIC_CELL_EDITOR__BASIC_CELL_EDITOR_IMPL: - setBasicCellEditorImpl(BasicCellEditorImpl.BASIC_CELL_EDITOR_IMPL_EDEFAULT); - return; - } - super.eUnset(featureID); - } - - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - @Override - public boolean eIsSet(final int featureID) { - switch (featureID) { - case ModelCellEditorPackage.BASIC_CELL_EDITOR__BASIC_CELL_EDITOR_IMPL: - return BasicCellEditorImpl.BASIC_CELL_EDITOR_IMPL_EDEFAULT == null ? this.basicCellEditorImpl != null - : !BasicCellEditorImpl.BASIC_CELL_EDITOR_IMPL_EDEFAULT - .equals(this.basicCellEditorImpl); - } - return super.eIsSet(featureID); - } - - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - @Override - public String toString() { - if (eIsProxy()) { - return super.toString(); - } - - StringBuffer result = new StringBuffer(super.toString()); - result.append(" (basicCellEditorImpl: "); //$NON-NLS-1$ - result.append(this.basicCellEditorImpl); - result.append(')'); - return result.toString(); - } - - /** @generated NOT */ - @Override - public String getModelCellEditorImpl() { - return getBasicCellEditorImpl(); - } - -} // BasicCellEditorImpl
diff --git a/org.eclipse.modisco.facet.widgets.celleditors/src/org/eclipse/emf/facet/widgets/celleditors/modelCellEditor/impl/ModelCellEditorDeclarationsImpl.java b/org.eclipse.modisco.facet.widgets.celleditors/src/org/eclipse/emf/facet/widgets/celleditors/modelCellEditor/impl/ModelCellEditorDeclarationsImpl.java deleted file mode 100644 index ba95b86..0000000 --- a/org.eclipse.modisco.facet.widgets.celleditors/src/org/eclipse/emf/facet/widgets/celleditors/modelCellEditor/impl/ModelCellEditorDeclarationsImpl.java +++ /dev/null
@@ -1,162 +0,0 @@ -/** - * Copyright (c) 2010 CEA LIST. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Nicolas Bros (Mia-Software) - initial API and implementation - */ -package org.eclipse.emf.facet.widgets.celleditors.modelCellEditor.impl; - -import java.util.Collection; - -import org.eclipse.emf.common.notify.NotificationChain; -import org.eclipse.emf.common.util.EList; -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.ecore.InternalEObject; -import org.eclipse.emf.ecore.impl.EObjectImpl; -import org.eclipse.emf.ecore.util.EObjectContainmentEList; -import org.eclipse.emf.ecore.util.InternalEList; -import org.eclipse.emf.facet.widgets.celleditors.modelCellEditor.AbstractModelCellEditor; -import org.eclipse.emf.facet.widgets.celleditors.modelCellEditor.ModelCellEditorDeclarations; -import org.eclipse.emf.facet.widgets.celleditors.modelCellEditor.ModelCellEditorPackage; - -/** - * <!-- begin-user-doc --> An implementation of the model object ' - * <em><b>Declarations</b></em>'. <!-- end-user-doc --> - * <p> - * The following features are implemented: - * <ul> - * <li> - * {@link org.eclipse.emf.facet.widgets.celleditors.modelCellEditor.impl.ModelCellEditorDeclarationsImpl#getModelCellEditors - * <em>Model Cell Editors</em>}</li> - * </ul> - * </p> - * - * @generated - */ -public class ModelCellEditorDeclarationsImpl extends EObjectImpl implements - ModelCellEditorDeclarations { - /** - * The cached value of the '{@link #getModelCellEditors() - * <em>Model Cell Editors</em>}' containment reference list. <!-- - * begin-user-doc --> <!-- end-user-doc --> - * - * @see #getModelCellEditors() - * @generated - * @ordered - */ - protected EList<AbstractModelCellEditor> modelCellEditors; - - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - protected ModelCellEditorDeclarationsImpl() { - super(); - } - - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - @Override - protected EClass eStaticClass() { - return ModelCellEditorPackage.Literals.MODEL_CELL_EDITOR_DECLARATIONS; - } - - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - public EList<AbstractModelCellEditor> getModelCellEditors() { - if (this.modelCellEditors == null) { - this.modelCellEditors = new EObjectContainmentEList<AbstractModelCellEditor>( - AbstractModelCellEditor.class, this, - ModelCellEditorPackage.MODEL_CELL_EDITOR_DECLARATIONS__MODEL_CELL_EDITORS); - } - return this.modelCellEditors; - } - - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - @Override - public NotificationChain eInverseRemove(final InternalEObject otherEnd, final int featureID, - final NotificationChain msgs) { - switch (featureID) { - case ModelCellEditorPackage.MODEL_CELL_EDITOR_DECLARATIONS__MODEL_CELL_EDITORS: - return ((InternalEList<?>) getModelCellEditors()).basicRemove(otherEnd, msgs); - } - return super.eInverseRemove(otherEnd, featureID, msgs); - } - - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - @Override - public Object eGet(final int featureID, final boolean resolve, final boolean coreType) { - switch (featureID) { - case ModelCellEditorPackage.MODEL_CELL_EDITOR_DECLARATIONS__MODEL_CELL_EDITORS: - return getModelCellEditors(); - } - return super.eGet(featureID, resolve, coreType); - } - - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - @SuppressWarnings("unchecked") - @Override - public void eSet(final int featureID, final Object newValue) { - switch (featureID) { - case ModelCellEditorPackage.MODEL_CELL_EDITOR_DECLARATIONS__MODEL_CELL_EDITORS: - getModelCellEditors().clear(); - getModelCellEditors().addAll((Collection<? extends AbstractModelCellEditor>) newValue); - return; - } - super.eSet(featureID, newValue); - } - - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - @Override - public void eUnset(final int featureID) { - switch (featureID) { - case ModelCellEditorPackage.MODEL_CELL_EDITOR_DECLARATIONS__MODEL_CELL_EDITORS: - getModelCellEditors().clear(); - return; - } - super.eUnset(featureID); - } - - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - @Override - public boolean eIsSet(final int featureID) { - switch (featureID) { - case ModelCellEditorPackage.MODEL_CELL_EDITOR_DECLARATIONS__MODEL_CELL_EDITORS: - return this.modelCellEditors != null && !this.modelCellEditors.isEmpty(); - } - return super.eIsSet(featureID); - } - -} // ModelCellEditorDeclarationsImpl
diff --git a/org.eclipse.modisco.facet.widgets.celleditors/src/org/eclipse/emf/facet/widgets/celleditors/modelCellEditor/impl/ModelCellEditorFactoryImpl.java b/org.eclipse.modisco.facet.widgets.celleditors/src/org/eclipse/emf/facet/widgets/celleditors/modelCellEditor/impl/ModelCellEditorFactoryImpl.java deleted file mode 100644 index c4e4ef8..0000000 --- a/org.eclipse.modisco.facet.widgets.celleditors/src/org/eclipse/emf/facet/widgets/celleditors/modelCellEditor/impl/ModelCellEditorFactoryImpl.java +++ /dev/null
@@ -1,144 +0,0 @@ -/** - * Copyright (c) 2010 CEA LIST. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Nicolas Bros (Mia-Software) - initial API and implementation - */ -package org.eclipse.emf.facet.widgets.celleditors.modelCellEditor.impl; - -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.EPackage; -import org.eclipse.emf.ecore.impl.EFactoryImpl; -import org.eclipse.emf.ecore.plugin.EcorePlugin; -import org.eclipse.emf.facet.widgets.celleditors.modelCellEditor.BasicCellEditor; -import org.eclipse.emf.facet.widgets.celleditors.modelCellEditor.ModelCellEditorDeclarations; -import org.eclipse.emf.facet.widgets.celleditors.modelCellEditor.ModelCellEditorFactory; -import org.eclipse.emf.facet.widgets.celleditors.modelCellEditor.ModelCellEditorPackage; -import org.eclipse.emf.facet.widgets.celleditors.modelCellEditor.NaryFeatureCellEditor; -import org.eclipse.emf.facet.widgets.celleditors.modelCellEditor.UnaryReferenceCellEditor; - -/** - * <!-- begin-user-doc --> An implementation of the model <b>Factory</b>. <!-- - * end-user-doc --> - * - * @generated - */ -public class ModelCellEditorFactoryImpl extends EFactoryImpl implements ModelCellEditorFactory { - /** - * Creates the default factory implementation. <!-- begin-user-doc --> <!-- - * end-user-doc --> - * - * @generated - */ - public static ModelCellEditorFactory init() { - try { - ModelCellEditorFactory theModelCellEditorFactory = (ModelCellEditorFactory) EPackage.Registry.INSTANCE - .getEFactory("http://www.eclipse.org/EMF_Facet/ModelCellEditor/0.1.0/modelCellEditor"); //$NON-NLS-1$ - if (theModelCellEditorFactory != null) { - return theModelCellEditorFactory; - } - } catch (Exception exception) { - EcorePlugin.INSTANCE.log(exception); - } - return new ModelCellEditorFactoryImpl(); - } - - /** - * Creates an instance of the factory. <!-- begin-user-doc --> <!-- - * end-user-doc --> - * - * @generated - */ - public ModelCellEditorFactoryImpl() { - super(); - } - - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - @Override - public EObject create(final EClass eClass) { - switch (eClass.getClassifierID()) { - case ModelCellEditorPackage.MODEL_CELL_EDITOR_DECLARATIONS: - return createModelCellEditorDeclarations(); - case ModelCellEditorPackage.BASIC_CELL_EDITOR: - return createBasicCellEditor(); - case ModelCellEditorPackage.UNARY_REFERENCE_CELL_EDITOR: - return createUnaryReferenceCellEditor(); - case ModelCellEditorPackage.NARY_FEATURE_CELL_EDITOR: - return createNaryFeatureCellEditor(); - default: - throw new IllegalArgumentException("The class '" + eClass.getName() //$NON-NLS-1$ - + "' is not a valid classifier"); //$NON-NLS-1$ - } - } - - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - public ModelCellEditorDeclarations createModelCellEditorDeclarations() { - ModelCellEditorDeclarationsImpl modelCellEditorDeclarations = new ModelCellEditorDeclarationsImpl(); - return modelCellEditorDeclarations; - } - - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - public BasicCellEditor createBasicCellEditor() { - BasicCellEditorImpl basicCellEditor = new BasicCellEditorImpl(); - return basicCellEditor; - } - - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - public UnaryReferenceCellEditor createUnaryReferenceCellEditor() { - UnaryReferenceCellEditorImpl unaryReferenceCellEditor = new UnaryReferenceCellEditorImpl(); - return unaryReferenceCellEditor; - } - - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - public NaryFeatureCellEditor createNaryFeatureCellEditor() { - NaryFeatureCellEditorImpl naryFeatureCellEditor = new NaryFeatureCellEditorImpl(); - return naryFeatureCellEditor; - } - - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - public ModelCellEditorPackage getModelCellEditorPackage() { - return (ModelCellEditorPackage) getEPackage(); - } - - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @deprecated - * @generated - */ - @Deprecated - public static ModelCellEditorPackage getPackage() { - return ModelCellEditorPackage.eINSTANCE; - } - -} // ModelCellEditorFactoryImpl
diff --git a/org.eclipse.modisco.facet.widgets.celleditors/src/org/eclipse/emf/facet/widgets/celleditors/modelCellEditor/impl/ModelCellEditorPackageImpl.java b/org.eclipse.modisco.facet.widgets.celleditors/src/org/eclipse/emf/facet/widgets/celleditors/modelCellEditor/impl/ModelCellEditorPackageImpl.java deleted file mode 100644 index a6d01fe..0000000 --- a/org.eclipse.modisco.facet.widgets.celleditors/src/org/eclipse/emf/facet/widgets/celleditors/modelCellEditor/impl/ModelCellEditorPackageImpl.java +++ /dev/null
@@ -1,397 +0,0 @@ -/** - * Copyright (c) 2010 CEA LIST. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Nicolas Bros (Mia-Software) - initial API and implementation - */ -package org.eclipse.emf.facet.widgets.celleditors.modelCellEditor.impl; - -import org.eclipse.emf.ecore.EAttribute; -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.ecore.EPackage; -import org.eclipse.emf.ecore.EReference; -import org.eclipse.emf.ecore.impl.EPackageImpl; -import org.eclipse.emf.facet.widgets.celleditors.modelCellEditor.AbstractModelCellEditor; -import org.eclipse.emf.facet.widgets.celleditors.modelCellEditor.BasicCellEditor; -import org.eclipse.emf.facet.widgets.celleditors.modelCellEditor.ModelCellEditorDeclarations; -import org.eclipse.emf.facet.widgets.celleditors.modelCellEditor.ModelCellEditorFactory; -import org.eclipse.emf.facet.widgets.celleditors.modelCellEditor.ModelCellEditorPackage; -import org.eclipse.emf.facet.widgets.celleditors.modelCellEditor.NaryFeatureCellEditor; -import org.eclipse.emf.facet.widgets.celleditors.modelCellEditor.UnaryReferenceCellEditor; - -/** - * <!-- begin-user-doc --> An implementation of the model <b>Package</b>. <!-- - * end-user-doc --> - * - * @generated - */ -public class ModelCellEditorPackageImpl extends EPackageImpl implements ModelCellEditorPackage { - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - private EClass modelCellEditorDeclarationsEClass = null; - - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - private EClass abstractModelCellEditorEClass = null; - - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - private EClass basicCellEditorEClass = null; - - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - private EClass unaryReferenceCellEditorEClass = null; - - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - private EClass naryFeatureCellEditorEClass = null; - - /** - * Creates an instance of the model <b>Package</b>, registered with - * {@link org.eclipse.emf.ecore.EPackage.Registry EPackage.Registry} by the - * package package URI value. - * <p> - * Note: the correct way to create the package is via the static factory - * method {@link #init init()}, which also performs initialization of the - * package, or returns the registered package, if one already exists. <!-- - * begin-user-doc --> <!-- end-user-doc --> - * - * @see org.eclipse.emf.ecore.EPackage.Registry - * @see org.eclipse.emf.facet.widgets.celleditors.modelCellEditor.ModelCellEditorPackage#eNS_URI - * @see #init() - * @generated - */ - private ModelCellEditorPackageImpl() { - super(ModelCellEditorPackage.eNS_URI, ModelCellEditorFactory.eINSTANCE); - } - - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - private static boolean isInited = false; - - /** - * Creates, registers, and initializes the <b>Package</b> for this model, - * and for any others upon which it depends. - * - * <p> - * This method is used to initialize - * {@link ModelCellEditorPackage#eINSTANCE} when that field is accessed. - * Clients should not invoke it directly. Instead, they should simply access - * that field to obtain the package. <!-- begin-user-doc --> <!-- - * end-user-doc --> - * - * @see #eNS_URI - * @see #createPackageContents() - * @see #initializePackageContents() - * @generated - */ - public static ModelCellEditorPackage init() { - if (ModelCellEditorPackageImpl.isInited) { - return (ModelCellEditorPackage) EPackage.Registry.INSTANCE - .getEPackage(ModelCellEditorPackage.eNS_URI); - } - - // Obtain or create and register package - ModelCellEditorPackageImpl theModelCellEditorPackage = (ModelCellEditorPackageImpl) (EPackage.Registry.INSTANCE - .get(ModelCellEditorPackage.eNS_URI) instanceof ModelCellEditorPackageImpl ? EPackage.Registry.INSTANCE - .get(ModelCellEditorPackage.eNS_URI) : new ModelCellEditorPackageImpl()); - - ModelCellEditorPackageImpl.isInited = true; - - // Create package meta-data objects - theModelCellEditorPackage.createPackageContents(); - - // Initialize created meta-data - theModelCellEditorPackage.initializePackageContents(); - - // Mark meta-data to indicate it can't be changed - theModelCellEditorPackage.freeze(); - - // Update the registry and return the package - EPackage.Registry.INSTANCE.put(ModelCellEditorPackage.eNS_URI, theModelCellEditorPackage); - return theModelCellEditorPackage; - } - - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - public EClass getModelCellEditorDeclarations() { - return this.modelCellEditorDeclarationsEClass; - } - - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - public EReference getModelCellEditorDeclarations_ModelCellEditors() { - return (EReference) this.modelCellEditorDeclarationsEClass.getEStructuralFeatures().get(0); - } - - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - public EClass getAbstractModelCellEditor() { - return this.abstractModelCellEditorEClass; - } - - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - public EReference getAbstractModelCellEditor_CellType() { - return (EReference) this.abstractModelCellEditorEClass.getEStructuralFeatures().get(0); - } - - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - public EAttribute getAbstractModelCellEditor_CellId() { - return (EAttribute) this.abstractModelCellEditorEClass.getEStructuralFeatures().get(1); - } - - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - public EClass getBasicCellEditor() { - return this.basicCellEditorEClass; - } - - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - public EAttribute getBasicCellEditor_BasicCellEditorImpl() { - return (EAttribute) this.basicCellEditorEClass.getEStructuralFeatures().get(0); - } - - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - public EClass getUnaryReferenceCellEditor() { - return this.unaryReferenceCellEditorEClass; - } - - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - public EAttribute getUnaryReferenceCellEditor_UnaryReferenceCellEditorImpl() { - return (EAttribute) this.unaryReferenceCellEditorEClass.getEStructuralFeatures().get(0); - } - - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - public EClass getNaryFeatureCellEditor() { - return this.naryFeatureCellEditorEClass; - } - - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - public EAttribute getNaryFeatureCellEditor_NaryFeatureCellEditorImpl() { - return (EAttribute) this.naryFeatureCellEditorEClass.getEStructuralFeatures().get(0); - } - - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - public ModelCellEditorFactory getModelCellEditorFactory() { - return (ModelCellEditorFactory) getEFactoryInstance(); - } - - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - private boolean isCreated = false; - - /** - * Creates the meta-model objects for the package. This method is guarded to - * have no affect on any invocation but its first. <!-- begin-user-doc --> - * <!-- end-user-doc --> - * - * @generated - */ - public void createPackageContents() { - if (this.isCreated) { - return; - } - this.isCreated = true; - - // Create classes and their features - this.modelCellEditorDeclarationsEClass = createEClass(ModelCellEditorPackage.MODEL_CELL_EDITOR_DECLARATIONS); - createEReference(this.modelCellEditorDeclarationsEClass, - ModelCellEditorPackage.MODEL_CELL_EDITOR_DECLARATIONS__MODEL_CELL_EDITORS); - - this.abstractModelCellEditorEClass = createEClass(ModelCellEditorPackage.ABSTRACT_MODEL_CELL_EDITOR); - createEReference(this.abstractModelCellEditorEClass, - ModelCellEditorPackage.ABSTRACT_MODEL_CELL_EDITOR__CELL_TYPE); - createEAttribute(this.abstractModelCellEditorEClass, - ModelCellEditorPackage.ABSTRACT_MODEL_CELL_EDITOR__CELL_ID); - - this.basicCellEditorEClass = createEClass(ModelCellEditorPackage.BASIC_CELL_EDITOR); - createEAttribute(this.basicCellEditorEClass, - ModelCellEditorPackage.BASIC_CELL_EDITOR__BASIC_CELL_EDITOR_IMPL); - - this.unaryReferenceCellEditorEClass = createEClass(ModelCellEditorPackage.UNARY_REFERENCE_CELL_EDITOR); - createEAttribute( - this.unaryReferenceCellEditorEClass, - ModelCellEditorPackage.UNARY_REFERENCE_CELL_EDITOR__UNARY_REFERENCE_CELL_EDITOR_IMPL); - - this.naryFeatureCellEditorEClass = createEClass(ModelCellEditorPackage.NARY_FEATURE_CELL_EDITOR); - createEAttribute(this.naryFeatureCellEditorEClass, - ModelCellEditorPackage.NARY_FEATURE_CELL_EDITOR__NARY_FEATURE_CELL_EDITOR_IMPL); - } - - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - private boolean isInitialized = false; - - /** - * Complete the initialization of the package and its meta-model. This - * method is guarded to have no affect on any invocation but its first. <!-- - * begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - public void initializePackageContents() { - if (this.isInitialized) { - return; - } - this.isInitialized = true; - - // Initialize package - setName(ModelCellEditorPackage.eNAME); - setNsPrefix(ModelCellEditorPackage.eNS_PREFIX); - setNsURI(ModelCellEditorPackage.eNS_URI); - - // Create type parameters - - // Set bounds for type parameters - - // Add supertypes to classes - this.basicCellEditorEClass.getESuperTypes().add(getAbstractModelCellEditor()); - this.unaryReferenceCellEditorEClass.getESuperTypes().add(getAbstractModelCellEditor()); - this.naryFeatureCellEditorEClass.getESuperTypes().add(getAbstractModelCellEditor()); - - // Initialize classes and features; add operations and parameters - initEClass( - this.modelCellEditorDeclarationsEClass, - ModelCellEditorDeclarations.class, - "ModelCellEditorDeclarations", !EPackageImpl.IS_ABSTRACT, !EPackageImpl.IS_INTERFACE, //$NON-NLS-1$ - EPackageImpl.IS_GENERATED_INSTANCE_CLASS); - initEReference(getModelCellEditorDeclarations_ModelCellEditors(), - getAbstractModelCellEditor(), null, "modelCellEditors", null, 0, -1, //$NON-NLS-1$ - ModelCellEditorDeclarations.class, !EPackageImpl.IS_TRANSIENT, - !EPackageImpl.IS_VOLATILE, EPackageImpl.IS_CHANGEABLE, EPackageImpl.IS_COMPOSITE, - !EPackageImpl.IS_RESOLVE_PROXIES, !EPackageImpl.IS_UNSETTABLE, - EPackageImpl.IS_UNIQUE, !EPackageImpl.IS_DERIVED, EPackageImpl.IS_ORDERED); - - initEClass( - this.abstractModelCellEditorEClass, - AbstractModelCellEditor.class, - "AbstractModelCellEditor", EPackageImpl.IS_ABSTRACT, !EPackageImpl.IS_INTERFACE, EPackageImpl.IS_GENERATED_INSTANCE_CLASS); //$NON-NLS-1$ - initEReference( - getAbstractModelCellEditor_CellType(), - this.ecorePackage.getEClassifier(), - null, - "cellType", null, 1, 1, AbstractModelCellEditor.class, !EPackageImpl.IS_TRANSIENT, !EPackageImpl.IS_VOLATILE, //$NON-NLS-1$ - EPackageImpl.IS_CHANGEABLE, !EPackageImpl.IS_COMPOSITE, - EPackageImpl.IS_RESOLVE_PROXIES, !EPackageImpl.IS_UNSETTABLE, - EPackageImpl.IS_UNIQUE, !EPackageImpl.IS_DERIVED, EPackageImpl.IS_ORDERED); - initEAttribute( - getAbstractModelCellEditor_CellId(), - this.ecorePackage.getEString(), - "cellId", //$NON-NLS-1$ - null, 1, 1, AbstractModelCellEditor.class, !EPackageImpl.IS_TRANSIENT, - !EPackageImpl.IS_VOLATILE, EPackageImpl.IS_CHANGEABLE, !EPackageImpl.IS_UNSETTABLE, - !EPackageImpl.IS_ID, EPackageImpl.IS_UNIQUE, !EPackageImpl.IS_DERIVED, - EPackageImpl.IS_ORDERED); - - addEOperation(this.abstractModelCellEditorEClass, this.ecorePackage.getEString(), - "getModelCellEditorImpl", 1, 1, EPackageImpl.IS_UNIQUE, EPackageImpl.IS_ORDERED); //$NON-NLS-1$ - - initEClass(this.basicCellEditorEClass, BasicCellEditor.class, - "BasicCellEditor", !EPackageImpl.IS_ABSTRACT, //$NON-NLS-1$ - !EPackageImpl.IS_INTERFACE, EPackageImpl.IS_GENERATED_INSTANCE_CLASS); - initEAttribute( - getBasicCellEditor_BasicCellEditorImpl(), - this.ecorePackage.getEString(), - "basicCellEditorImpl", null, 1, 1, BasicCellEditor.class, !EPackageImpl.IS_TRANSIENT, //$NON-NLS-1$ - !EPackageImpl.IS_VOLATILE, EPackageImpl.IS_CHANGEABLE, !EPackageImpl.IS_UNSETTABLE, - !EPackageImpl.IS_ID, EPackageImpl.IS_UNIQUE, !EPackageImpl.IS_DERIVED, - EPackageImpl.IS_ORDERED); - - initEClass(this.unaryReferenceCellEditorEClass, UnaryReferenceCellEditor.class, - "UnaryReferenceCellEditor", !EPackageImpl.IS_ABSTRACT, !EPackageImpl.IS_INTERFACE, //$NON-NLS-1$ - EPackageImpl.IS_GENERATED_INSTANCE_CLASS); - initEAttribute(getUnaryReferenceCellEditor_UnaryReferenceCellEditorImpl(), - this.ecorePackage.getEString(), "unaryReferenceCellEditorImpl", null, 1, 1, //$NON-NLS-1$ - UnaryReferenceCellEditor.class, !EPackageImpl.IS_TRANSIENT, - !EPackageImpl.IS_VOLATILE, EPackageImpl.IS_CHANGEABLE, !EPackageImpl.IS_UNSETTABLE, - !EPackageImpl.IS_ID, EPackageImpl.IS_UNIQUE, !EPackageImpl.IS_DERIVED, - EPackageImpl.IS_ORDERED); - - initEClass( - this.naryFeatureCellEditorEClass, - NaryFeatureCellEditor.class, - "NaryFeatureCellEditor", !EPackageImpl.IS_ABSTRACT, !EPackageImpl.IS_INTERFACE, EPackageImpl.IS_GENERATED_INSTANCE_CLASS); //$NON-NLS-1$ - initEAttribute(getNaryFeatureCellEditor_NaryFeatureCellEditorImpl(), - this.ecorePackage.getEString(), "naryFeatureCellEditorImpl", null, 1, 1, //$NON-NLS-1$ - NaryFeatureCellEditor.class, !EPackageImpl.IS_TRANSIENT, !EPackageImpl.IS_VOLATILE, - EPackageImpl.IS_CHANGEABLE, !EPackageImpl.IS_UNSETTABLE, !EPackageImpl.IS_ID, - EPackageImpl.IS_UNIQUE, !EPackageImpl.IS_DERIVED, EPackageImpl.IS_ORDERED); - - // Create resource - createResource(ModelCellEditorPackage.eNS_URI); - } - -} // ModelCellEditorPackageImpl
diff --git a/org.eclipse.modisco.facet.widgets.celleditors/src/org/eclipse/emf/facet/widgets/celleditors/modelCellEditor/impl/NaryFeatureCellEditorImpl.java b/org.eclipse.modisco.facet.widgets.celleditors/src/org/eclipse/emf/facet/widgets/celleditors/modelCellEditor/impl/NaryFeatureCellEditorImpl.java deleted file mode 100644 index 0355a6e..0000000 --- a/org.eclipse.modisco.facet.widgets.celleditors/src/org/eclipse/emf/facet/widgets/celleditors/modelCellEditor/impl/NaryFeatureCellEditorImpl.java +++ /dev/null
@@ -1,184 +0,0 @@ -/** - * Copyright (c) 2010 CEA LIST. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Nicolas Bros (Mia-Software) - initial API and implementation - */ -package org.eclipse.emf.facet.widgets.celleditors.modelCellEditor.impl; - -import org.eclipse.emf.common.notify.Notification; -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.ecore.impl.ENotificationImpl; -import org.eclipse.emf.facet.widgets.celleditors.modelCellEditor.ModelCellEditorPackage; -import org.eclipse.emf.facet.widgets.celleditors.modelCellEditor.NaryFeatureCellEditor; - -/** - * <!-- begin-user-doc --> An implementation of the model object ' - * <em><b>Nary Feature Cell Editor</b></em>'. <!-- end-user-doc --> - * <p> - * The following features are implemented: - * <ul> - * <li> - * {@link org.eclipse.emf.facet.widgets.celleditors.modelCellEditor.impl.NaryFeatureCellEditorImpl#getNaryFeatureCellEditorImpl - * <em>Nary Feature Cell Editor Impl</em>}</li> - * </ul> - * </p> - * - * @generated - */ -public class NaryFeatureCellEditorImpl extends AbstractModelCellEditorImpl implements - NaryFeatureCellEditor { - /** - * The default value of the '{@link #getNaryFeatureCellEditorImpl() - * <em>Nary Feature Cell Editor Impl</em>}' attribute. <!-- begin-user-doc - * --> <!-- end-user-doc --> - * - * @see #getNaryFeatureCellEditorImpl() - * @generated - * @ordered - */ - protected static final String NARY_FEATURE_CELL_EDITOR_IMPL_EDEFAULT = null; - - /** - * The cached value of the '{@link #getNaryFeatureCellEditorImpl() - * <em>Nary Feature Cell Editor Impl</em>}' attribute. <!-- begin-user-doc - * --> <!-- end-user-doc --> - * - * @see #getNaryFeatureCellEditorImpl() - * @generated - * @ordered - */ - protected String naryFeatureCellEditorImpl = NaryFeatureCellEditorImpl.NARY_FEATURE_CELL_EDITOR_IMPL_EDEFAULT; - - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - protected NaryFeatureCellEditorImpl() { - super(); - } - - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - @Override - protected EClass eStaticClass() { - return ModelCellEditorPackage.Literals.NARY_FEATURE_CELL_EDITOR; - } - - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - public String getNaryFeatureCellEditorImpl() { - return this.naryFeatureCellEditorImpl; - } - - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - public void setNaryFeatureCellEditorImpl(final String newNaryFeatureCellEditorImpl) { - String oldNaryFeatureCellEditorImpl = this.naryFeatureCellEditorImpl; - this.naryFeatureCellEditorImpl = newNaryFeatureCellEditorImpl; - if (eNotificationRequired()) { - eNotify(new ENotificationImpl(this, Notification.SET, - ModelCellEditorPackage.NARY_FEATURE_CELL_EDITOR__NARY_FEATURE_CELL_EDITOR_IMPL, - oldNaryFeatureCellEditorImpl, this.naryFeatureCellEditorImpl)); - } - } - - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - @Override - public Object eGet(final int featureID, final boolean resolve, final boolean coreType) { - switch (featureID) { - case ModelCellEditorPackage.NARY_FEATURE_CELL_EDITOR__NARY_FEATURE_CELL_EDITOR_IMPL: - return getNaryFeatureCellEditorImpl(); - } - return super.eGet(featureID, resolve, coreType); - } - - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - @Override - public void eSet(final int featureID, final Object newValue) { - switch (featureID) { - case ModelCellEditorPackage.NARY_FEATURE_CELL_EDITOR__NARY_FEATURE_CELL_EDITOR_IMPL: - setNaryFeatureCellEditorImpl((String) newValue); - return; - } - super.eSet(featureID, newValue); - } - - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - @Override - public void eUnset(final int featureID) { - switch (featureID) { - case ModelCellEditorPackage.NARY_FEATURE_CELL_EDITOR__NARY_FEATURE_CELL_EDITOR_IMPL: - setNaryFeatureCellEditorImpl(NaryFeatureCellEditorImpl.NARY_FEATURE_CELL_EDITOR_IMPL_EDEFAULT); - return; - } - super.eUnset(featureID); - } - - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - @Override - public boolean eIsSet(final int featureID) { - switch (featureID) { - case ModelCellEditorPackage.NARY_FEATURE_CELL_EDITOR__NARY_FEATURE_CELL_EDITOR_IMPL: - return NaryFeatureCellEditorImpl.NARY_FEATURE_CELL_EDITOR_IMPL_EDEFAULT == null ? this.naryFeatureCellEditorImpl != null - : !NaryFeatureCellEditorImpl.NARY_FEATURE_CELL_EDITOR_IMPL_EDEFAULT - .equals(this.naryFeatureCellEditorImpl); - } - return super.eIsSet(featureID); - } - - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - @Override - public String toString() { - if (eIsProxy()) { - return super.toString(); - } - - StringBuffer result = new StringBuffer(super.toString()); - result.append(" (naryFeatureCellEditorImpl: "); //$NON-NLS-1$ - result.append(this.naryFeatureCellEditorImpl); - result.append(')'); - return result.toString(); - } - - @Override - public String getModelCellEditorImpl() { - return getNaryFeatureCellEditorImpl(); - } - -} // NaryFeatureCellEditorImpl
diff --git a/org.eclipse.modisco.facet.widgets.celleditors/src/org/eclipse/emf/facet/widgets/celleditors/modelCellEditor/impl/UnaryReferenceCellEditorImpl.java b/org.eclipse.modisco.facet.widgets.celleditors/src/org/eclipse/emf/facet/widgets/celleditors/modelCellEditor/impl/UnaryReferenceCellEditorImpl.java deleted file mode 100644 index 7f0bdfc..0000000 --- a/org.eclipse.modisco.facet.widgets.celleditors/src/org/eclipse/emf/facet/widgets/celleditors/modelCellEditor/impl/UnaryReferenceCellEditorImpl.java +++ /dev/null
@@ -1,187 +0,0 @@ -/** - * Copyright (c) 2010 CEA LIST. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Nicolas Bros (Mia-Software) - initial API and implementation - */ -package org.eclipse.emf.facet.widgets.celleditors.modelCellEditor.impl; - -import org.eclipse.emf.common.notify.Notification; -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.ecore.impl.ENotificationImpl; -import org.eclipse.emf.facet.widgets.celleditors.modelCellEditor.ModelCellEditorPackage; -import org.eclipse.emf.facet.widgets.celleditors.modelCellEditor.UnaryReferenceCellEditor; - -/** - * <!-- begin-user-doc --> An implementation of the model object ' - * <em><b>Unary Reference Cell Editor</b></em>'. <!-- end-user-doc --> - * <p> - * The following features are implemented: - * <ul> - * <li> - * {@link org.eclipse.emf.facet.widgets.celleditors.modelCellEditor.impl.UnaryReferenceCellEditorImpl#getUnaryReferenceCellEditorImpl - * <em>Unary Reference Cell Editor Impl</em>}</li> - * </ul> - * </p> - * - * @generated - */ -public class UnaryReferenceCellEditorImpl extends AbstractModelCellEditorImpl implements - UnaryReferenceCellEditor { - /** - * The default value of the '{@link #getUnaryReferenceCellEditorImpl() - * <em>Unary Reference Cell Editor Impl</em>}' attribute. <!-- - * begin-user-doc --> <!-- end-user-doc --> - * - * @see #getUnaryReferenceCellEditorImpl() - * @generated - * @ordered - */ - protected static final String UNARY_REFERENCE_CELL_EDITOR_IMPL_EDEFAULT = null; - - /** - * The cached value of the '{@link #getUnaryReferenceCellEditorImpl() - * <em>Unary Reference Cell Editor Impl</em>}' attribute. <!-- - * begin-user-doc --> <!-- end-user-doc --> - * - * @see #getUnaryReferenceCellEditorImpl() - * @generated - * @ordered - */ - protected String unaryReferenceCellEditorImpl = UnaryReferenceCellEditorImpl.UNARY_REFERENCE_CELL_EDITOR_IMPL_EDEFAULT; - - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - protected UnaryReferenceCellEditorImpl() { - super(); - } - - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - @Override - protected EClass eStaticClass() { - return ModelCellEditorPackage.Literals.UNARY_REFERENCE_CELL_EDITOR; - } - - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - public String getUnaryReferenceCellEditorImpl() { - return this.unaryReferenceCellEditorImpl; - } - - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - public void setUnaryReferenceCellEditorImpl(final String newUnaryReferenceCellEditorImpl) { - String oldUnaryReferenceCellEditorImpl = this.unaryReferenceCellEditorImpl; - this.unaryReferenceCellEditorImpl = newUnaryReferenceCellEditorImpl; - if (eNotificationRequired()) { - eNotify(new ENotificationImpl( - this, - Notification.SET, - ModelCellEditorPackage.UNARY_REFERENCE_CELL_EDITOR__UNARY_REFERENCE_CELL_EDITOR_IMPL, - oldUnaryReferenceCellEditorImpl, this.unaryReferenceCellEditorImpl)); - } - } - - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - @Override - public Object eGet(final int featureID, final boolean resolve, final boolean coreType) { - switch (featureID) { - case ModelCellEditorPackage.UNARY_REFERENCE_CELL_EDITOR__UNARY_REFERENCE_CELL_EDITOR_IMPL: - return getUnaryReferenceCellEditorImpl(); - } - return super.eGet(featureID, resolve, coreType); - } - - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - @Override - public void eSet(final int featureID, final Object newValue) { - switch (featureID) { - case ModelCellEditorPackage.UNARY_REFERENCE_CELL_EDITOR__UNARY_REFERENCE_CELL_EDITOR_IMPL: - setUnaryReferenceCellEditorImpl((String) newValue); - return; - } - super.eSet(featureID, newValue); - } - - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - @Override - public void eUnset(final int featureID) { - switch (featureID) { - case ModelCellEditorPackage.UNARY_REFERENCE_CELL_EDITOR__UNARY_REFERENCE_CELL_EDITOR_IMPL: - setUnaryReferenceCellEditorImpl(UnaryReferenceCellEditorImpl.UNARY_REFERENCE_CELL_EDITOR_IMPL_EDEFAULT); - return; - } - super.eUnset(featureID); - } - - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - @Override - public boolean eIsSet(final int featureID) { - switch (featureID) { - case ModelCellEditorPackage.UNARY_REFERENCE_CELL_EDITOR__UNARY_REFERENCE_CELL_EDITOR_IMPL: - return UnaryReferenceCellEditorImpl.UNARY_REFERENCE_CELL_EDITOR_IMPL_EDEFAULT == null ? this.unaryReferenceCellEditorImpl != null - : !UnaryReferenceCellEditorImpl.UNARY_REFERENCE_CELL_EDITOR_IMPL_EDEFAULT - .equals(this.unaryReferenceCellEditorImpl); - } - return super.eIsSet(featureID); - } - - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - @Override - public String toString() { - if (eIsProxy()) { - return super.toString(); - } - - StringBuffer result = new StringBuffer(super.toString()); - result.append(" (unaryReferenceCellEditorImpl: "); //$NON-NLS-1$ - result.append(this.unaryReferenceCellEditorImpl); - result.append(')'); - return result.toString(); - } - - /** @generated NOT */ - @Override - public String getModelCellEditorImpl() { - return getUnaryReferenceCellEditorImpl(); - } - -} // UnaryReferenceCellEditorImpl
diff --git a/org.eclipse.modisco.facet.widgets.celleditors/src/org/eclipse/emf/facet/widgets/celleditors/modelCellEditor/util/ModelCellEditorAdapterFactory.java b/org.eclipse.modisco.facet.widgets.celleditors/src/org/eclipse/emf/facet/widgets/celleditors/modelCellEditor/util/ModelCellEditorAdapterFactory.java deleted file mode 100644 index 46b8c0c..0000000 --- a/org.eclipse.modisco.facet.widgets.celleditors/src/org/eclipse/emf/facet/widgets/celleditors/modelCellEditor/util/ModelCellEditorAdapterFactory.java +++ /dev/null
@@ -1,216 +0,0 @@ -/** - * Copyright (c) 2010 CEA LIST. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Nicolas Bros (Mia-Software) - initial API and implementation - */ -package org.eclipse.emf.facet.widgets.celleditors.modelCellEditor.util; - -import org.eclipse.emf.common.notify.Adapter; -import org.eclipse.emf.common.notify.Notifier; -import org.eclipse.emf.common.notify.impl.AdapterFactoryImpl; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.facet.widgets.celleditors.modelCellEditor.AbstractModelCellEditor; -import org.eclipse.emf.facet.widgets.celleditors.modelCellEditor.BasicCellEditor; -import org.eclipse.emf.facet.widgets.celleditors.modelCellEditor.ModelCellEditorDeclarations; -import org.eclipse.emf.facet.widgets.celleditors.modelCellEditor.ModelCellEditorPackage; -import org.eclipse.emf.facet.widgets.celleditors.modelCellEditor.NaryFeatureCellEditor; -import org.eclipse.emf.facet.widgets.celleditors.modelCellEditor.UnaryReferenceCellEditor; - -/** - * <!-- begin-user-doc --> The <b>Adapter Factory</b> for the model. It provides - * an adapter <code>createXXX</code> method for each class of the model. <!-- - * end-user-doc --> - * - * @see org.eclipse.emf.facet.widgets.celleditors.modelCellEditor.ModelCellEditorPackage - * @generated - */ -public class ModelCellEditorAdapterFactory extends AdapterFactoryImpl { - /** - * The cached model package. <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - protected static ModelCellEditorPackage modelPackage; - - /** - * Creates an instance of the adapter factory. <!-- begin-user-doc --> <!-- - * end-user-doc --> - * - * @generated - */ - public ModelCellEditorAdapterFactory() { - if (ModelCellEditorAdapterFactory.modelPackage == null) { - ModelCellEditorAdapterFactory.modelPackage = ModelCellEditorPackage.eINSTANCE; - } - } - - /** - * Returns whether this factory is applicable for the type of the object. - * <!-- begin-user-doc --> This implementation returns <code>true</code> if - * the object is either the model's package or is an instance object of the - * model. <!-- end-user-doc --> - * - * @return whether this factory is applicable for the type of the object. - * @generated - */ - @Override - public boolean isFactoryForType(final Object object) { - if (object == ModelCellEditorAdapterFactory.modelPackage) { - return true; - } - if (object instanceof EObject) { - return ((EObject) object).eClass().getEPackage() == ModelCellEditorAdapterFactory.modelPackage; - } - return false; - } - - /** - * The switch that delegates to the <code>createXXX</code> methods. <!-- - * begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - protected ModelCellEditorSwitch<Adapter> modelSwitch = new ModelCellEditorSwitch<Adapter>() { - @Override - public Adapter caseModelCellEditorDeclarations(final ModelCellEditorDeclarations object) { - return createModelCellEditorDeclarationsAdapter(); - } - - @Override - public Adapter caseAbstractModelCellEditor(final AbstractModelCellEditor object) { - return createAbstractModelCellEditorAdapter(); - } - - @Override - public Adapter caseBasicCellEditor(final BasicCellEditor object) { - return createBasicCellEditorAdapter(); - } - - @Override - public Adapter caseUnaryReferenceCellEditor(final UnaryReferenceCellEditor object) { - return createUnaryReferenceCellEditorAdapter(); - } - - @Override - public Adapter caseNaryFeatureCellEditor(final NaryFeatureCellEditor object) { - return createNaryFeatureCellEditorAdapter(); - } - - @Override - public Adapter defaultCase(final EObject object) { - return createEObjectAdapter(); - } - }; - - /** - * Creates an adapter for the <code>target</code>. <!-- begin-user-doc --> - * <!-- end-user-doc --> - * - * @param target - * the object to adapt. - * @return the adapter for the <code>target</code>. - * @generated - */ - @Override - public Adapter createAdapter(final Notifier target) { - return this.modelSwitch.doSwitch((EObject) target); - } - - /** - * Creates a new adapter for an object of class ' - * {@link org.eclipse.emf.facet.widgets.celleditors.modelCellEditor.ModelCellEditorDeclarations - * <em>Declarations</em>}'. <!-- begin-user-doc --> This default - * implementation returns null so that we can easily ignore cases; it's - * useful to ignore a case when inheritance will catch all the cases anyway. - * <!-- end-user-doc --> - * - * @return the new adapter. - * @see org.eclipse.emf.facet.widgets.celleditors.modelCellEditor.ModelCellEditorDeclarations - * @generated - */ - public Adapter createModelCellEditorDeclarationsAdapter() { - return null; - } - - /** - * Creates a new adapter for an object of class ' - * {@link org.eclipse.emf.facet.widgets.celleditors.modelCellEditor.AbstractModelCellEditor - * <em>Abstract Model Cell Editor</em>}'. <!-- begin-user-doc --> This - * default implementation returns null so that we can easily ignore cases; - * it's useful to ignore a case when inheritance will catch all the cases - * anyway. <!-- end-user-doc --> - * - * @return the new adapter. - * @see org.eclipse.emf.facet.widgets.celleditors.modelCellEditor.AbstractModelCellEditor - * @generated - */ - public Adapter createAbstractModelCellEditorAdapter() { - return null; - } - - /** - * Creates a new adapter for an object of class ' - * {@link org.eclipse.emf.facet.widgets.celleditors.modelCellEditor.BasicCellEditor - * <em>Basic Cell Editor</em>}'. <!-- begin-user-doc --> This default - * implementation returns null so that we can easily ignore cases; it's - * useful to ignore a case when inheritance will catch all the cases anyway. - * <!-- end-user-doc --> - * - * @return the new adapter. - * @see org.eclipse.emf.facet.widgets.celleditors.modelCellEditor.BasicCellEditor - * @generated - */ - public Adapter createBasicCellEditorAdapter() { - return null; - } - - /** - * Creates a new adapter for an object of class ' - * {@link org.eclipse.emf.facet.widgets.celleditors.modelCellEditor.UnaryReferenceCellEditor - * <em>Unary Reference Cell Editor</em>}'. <!-- begin-user-doc --> This - * default implementation returns null so that we can easily ignore cases; - * it's useful to ignore a case when inheritance will catch all the cases - * anyway. <!-- end-user-doc --> - * - * @return the new adapter. - * @see org.eclipse.emf.facet.widgets.celleditors.modelCellEditor.UnaryReferenceCellEditor - * @generated - */ - public Adapter createUnaryReferenceCellEditorAdapter() { - return null; - } - - /** - * Creates a new adapter for an object of class ' - * {@link org.eclipse.emf.facet.widgets.celleditors.modelCellEditor.NaryFeatureCellEditor - * <em>Nary Feature Cell Editor</em>}'. <!-- begin-user-doc --> This default - * implementation returns null so that we can easily ignore cases; it's - * useful to ignore a case when inheritance will catch all the cases anyway. - * <!-- end-user-doc --> - * - * @return the new adapter. - * @see org.eclipse.emf.facet.widgets.celleditors.modelCellEditor.NaryFeatureCellEditor - * @generated - */ - public Adapter createNaryFeatureCellEditorAdapter() { - return null; - } - - /** - * Creates a new adapter for the default case. <!-- begin-user-doc --> This - * default implementation returns null. <!-- end-user-doc --> - * - * @return the new adapter. - * @generated - */ - public Adapter createEObjectAdapter() { - return null; - } - -} // ModelCellEditorAdapterFactory
diff --git a/org.eclipse.modisco.facet.widgets.celleditors/src/org/eclipse/emf/facet/widgets/celleditors/modelCellEditor/util/ModelCellEditorSwitch.java b/org.eclipse.modisco.facet.widgets.celleditors/src/org/eclipse/emf/facet/widgets/celleditors/modelCellEditor/util/ModelCellEditorSwitch.java deleted file mode 100644 index d03d750..0000000 --- a/org.eclipse.modisco.facet.widgets.celleditors/src/org/eclipse/emf/facet/widgets/celleditors/modelCellEditor/util/ModelCellEditorSwitch.java +++ /dev/null
@@ -1,254 +0,0 @@ -/** - * Copyright (c) 2010 CEA LIST. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Nicolas Bros (Mia-Software) - initial API and implementation - */ -package org.eclipse.emf.facet.widgets.celleditors.modelCellEditor.util; - -import java.util.List; - -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.facet.widgets.celleditors.modelCellEditor.AbstractModelCellEditor; -import org.eclipse.emf.facet.widgets.celleditors.modelCellEditor.BasicCellEditor; -import org.eclipse.emf.facet.widgets.celleditors.modelCellEditor.ModelCellEditorDeclarations; -import org.eclipse.emf.facet.widgets.celleditors.modelCellEditor.ModelCellEditorPackage; -import org.eclipse.emf.facet.widgets.celleditors.modelCellEditor.NaryFeatureCellEditor; -import org.eclipse.emf.facet.widgets.celleditors.modelCellEditor.UnaryReferenceCellEditor; - -/** - * <!-- begin-user-doc --> The <b>Switch</b> for the model's inheritance - * hierarchy. It supports the call {@link #doSwitch(EObject) doSwitch(object)} - * to invoke the <code>caseXXX</code> method for each class of the model, - * starting with the actual class of the object and proceeding up the - * inheritance hierarchy until a non-null result is returned, which is the - * result of the switch. <!-- end-user-doc --> - * - * @see org.eclipse.emf.facet.widgets.celleditors.modelCellEditor.ModelCellEditorPackage - * @generated - */ -public class ModelCellEditorSwitch<T> { - /** - * The cached model package <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - protected static ModelCellEditorPackage modelPackage; - - /** - * Creates an instance of the switch. <!-- begin-user-doc --> <!-- - * end-user-doc --> - * - * @generated - */ - public ModelCellEditorSwitch() { - if (ModelCellEditorSwitch.modelPackage == null) { - ModelCellEditorSwitch.modelPackage = ModelCellEditorPackage.eINSTANCE; - } - } - - /** - * Calls <code>caseXXX</code> for each class of the model until one returns - * a non null result; it yields that result. <!-- begin-user-doc --> <!-- - * end-user-doc --> - * - * @return the first non-null result returned by a <code>caseXXX</code> - * call. - * @generated - */ - public T doSwitch(final EObject theEObject) { - return doSwitch(theEObject.eClass(), theEObject); - } - - /** - * Calls <code>caseXXX</code> for each class of the model until one returns - * a non null result; it yields that result. <!-- begin-user-doc --> <!-- - * end-user-doc --> - * - * @return the first non-null result returned by a <code>caseXXX</code> - * call. - * @generated - */ - protected T doSwitch(final EClass theEClass, final EObject theEObject) { - if (theEClass.eContainer() == ModelCellEditorSwitch.modelPackage) { - return doSwitch(theEClass.getClassifierID(), theEObject); - } - List<EClass> eSuperTypes = theEClass.getESuperTypes(); - return eSuperTypes.isEmpty() ? defaultCase(theEObject) : doSwitch(eSuperTypes.get(0), - theEObject); - } - - /** - * Calls <code>caseXXX</code> for each class of the model until one returns - * a non null result; it yields that result. <!-- begin-user-doc --> <!-- - * end-user-doc --> - * - * @return the first non-null result returned by a <code>caseXXX</code> - * call. - * @generated - */ - protected T doSwitch(final int classifierID, final EObject theEObject) { - switch (classifierID) { - case ModelCellEditorPackage.MODEL_CELL_EDITOR_DECLARATIONS: { - ModelCellEditorDeclarations modelCellEditorDeclarations = (ModelCellEditorDeclarations) theEObject; - T result = caseModelCellEditorDeclarations(modelCellEditorDeclarations); - if (result == null) { - result = defaultCase(theEObject); - } - return result; - } - case ModelCellEditorPackage.ABSTRACT_MODEL_CELL_EDITOR: { - AbstractModelCellEditor abstractModelCellEditor = (AbstractModelCellEditor) theEObject; - T result = caseAbstractModelCellEditor(abstractModelCellEditor); - if (result == null) { - result = defaultCase(theEObject); - } - return result; - } - case ModelCellEditorPackage.BASIC_CELL_EDITOR: { - BasicCellEditor basicCellEditor = (BasicCellEditor) theEObject; - T result = caseBasicCellEditor(basicCellEditor); - if (result == null) { - result = caseAbstractModelCellEditor(basicCellEditor); - } - if (result == null) { - result = defaultCase(theEObject); - } - return result; - } - case ModelCellEditorPackage.UNARY_REFERENCE_CELL_EDITOR: { - UnaryReferenceCellEditor unaryReferenceCellEditor = (UnaryReferenceCellEditor) theEObject; - T result = caseUnaryReferenceCellEditor(unaryReferenceCellEditor); - if (result == null) { - result = caseAbstractModelCellEditor(unaryReferenceCellEditor); - } - if (result == null) { - result = defaultCase(theEObject); - } - return result; - } - case ModelCellEditorPackage.NARY_FEATURE_CELL_EDITOR: { - NaryFeatureCellEditor naryFeatureCellEditor = (NaryFeatureCellEditor) theEObject; - T result = caseNaryFeatureCellEditor(naryFeatureCellEditor); - if (result == null) { - result = caseAbstractModelCellEditor(naryFeatureCellEditor); - } - if (result == null) { - result = defaultCase(theEObject); - } - return result; - } - default: - return defaultCase(theEObject); - } - } - - /** - * Returns the result of interpreting the object as an instance of ' - * <em>Declarations</em>'. <!-- begin-user-doc --> This implementation - * returns null; returning a non-null result will terminate the switch. <!-- - * end-user-doc --> - * - * @param object - * the target of the switch. - * @return the result of interpreting the object as an instance of ' - * <em>Declarations</em>'. - * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) - * @generated - */ - public T caseModelCellEditorDeclarations(final ModelCellEditorDeclarations object) { - return null; - } - - /** - * Returns the result of interpreting the object as an instance of ' - * <em>Abstract Model Cell Editor</em>'. <!-- begin-user-doc --> This - * implementation returns null; returning a non-null result will terminate - * the switch. <!-- end-user-doc --> - * - * @param object - * the target of the switch. - * @return the result of interpreting the object as an instance of ' - * <em>Abstract Model Cell Editor</em>'. - * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) - * @generated - */ - public T caseAbstractModelCellEditor(final AbstractModelCellEditor object) { - return null; - } - - /** - * Returns the result of interpreting the object as an instance of ' - * <em>Basic Cell Editor</em>'. <!-- begin-user-doc --> This implementation - * returns null; returning a non-null result will terminate the switch. <!-- - * end-user-doc --> - * - * @param object - * the target of the switch. - * @return the result of interpreting the object as an instance of ' - * <em>Basic Cell Editor</em>'. - * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) - * @generated - */ - public T caseBasicCellEditor(final BasicCellEditor object) { - return null; - } - - /** - * Returns the result of interpreting the object as an instance of ' - * <em>Unary Reference Cell Editor</em>'. <!-- begin-user-doc --> This - * implementation returns null; returning a non-null result will terminate - * the switch. <!-- end-user-doc --> - * - * @param object - * the target of the switch. - * @return the result of interpreting the object as an instance of ' - * <em>Unary Reference Cell Editor</em>'. - * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) - * @generated - */ - public T caseUnaryReferenceCellEditor(final UnaryReferenceCellEditor object) { - return null; - } - - /** - * Returns the result of interpreting the object as an instance of ' - * <em>Nary Feature Cell Editor</em>'. <!-- begin-user-doc --> This - * implementation returns null; returning a non-null result will terminate - * the switch. <!-- end-user-doc --> - * - * @param object - * the target of the switch. - * @return the result of interpreting the object as an instance of ' - * <em>Nary Feature Cell Editor</em>'. - * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) - * @generated - */ - public T caseNaryFeatureCellEditor(final NaryFeatureCellEditor object) { - return null; - } - - /** - * Returns the result of interpreting the object as an instance of ' - * <em>EObject</em>'. <!-- begin-user-doc --> This implementation returns - * null; returning a non-null result will terminate the switch, but this is - * the last case anyway. <!-- end-user-doc --> - * - * @param object - * the target of the switch. - * @return the result of interpreting the object as an instance of ' - * <em>EObject</em>'. - * @see #doSwitch(org.eclipse.emf.ecore.EObject) - * @generated - */ - public T defaultCase(final EObject object) { - return null; - } - -} // ModelCellEditorSwitch
diff --git a/org.eclipse.modisco.facet.widgets.celleditors/src/org/eclipse/modisco/facet/widgets/celleditors/AbstractCellEditorComposite.java b/org.eclipse.modisco.facet.widgets.celleditors/src/org/eclipse/modisco/facet/widgets/celleditors/AbstractCellEditorComposite.java new file mode 100644 index 0000000..f4b417b --- /dev/null +++ b/org.eclipse.modisco.facet.widgets.celleditors/src/org/eclipse/modisco/facet/widgets/celleditors/AbstractCellEditorComposite.java
@@ -0,0 +1,113 @@ +/***************************************************************************** + * Copyright (c) 2010 CEA LIST. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Nicolas Guyomar (Mia-Software) - initial API and implementation + * Nicolas Guyomar (Mia-Software) - Bug 334546 - [celleditors] no border on Text field + * Gregoire Dupe (Mia-Software) - Bug 339998 - public methods of AbstractCellEditorComposite have to be protected + * Nicolas Bros (Mia-Software) - Bug 334539 - [celleditors] change listener + *****************************************************************************/ +package org.eclipse.modisco.facet.widgets.celleditors; + +import java.util.ArrayList; +import java.util.List; + +import org.eclipse.core.runtime.IStatus; +import org.eclipse.core.runtime.Status; +import org.eclipse.swt.SWT; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Event; +import org.eclipse.swt.widgets.Listener; + +public abstract class AbstractCellEditorComposite<T> extends Composite implements IWidget2<T> { + + private final List<IListener> commitListeners; + private final List<IListener> changeListeners; + @Deprecated + private final List<Listener> compatibilityCommitListeners; + private final IValidator defaultValidator = new IValidator() { + public IStatus validate(final Object object) { + return Status.OK_STATUS; + } + }; + + public AbstractCellEditorComposite(final Composite parent) { + this(parent, SWT.NONE); + } + + @SuppressWarnings("deprecation") /* backwards-compatibility */ + public AbstractCellEditorComposite(final Composite parent, final int style) { + super(parent, style); + this.compatibilityCommitListeners = new ArrayList<Listener>(); + this.commitListeners = new ArrayList<IListener>(); + this.changeListeners = new ArrayList<IListener>(); + } + + public void addCommitListener(final IListener listener) { + synchronized (this.commitListeners) { + if (!this.commitListeners.contains(listener)) { + this.commitListeners.add(listener); + } + } + } + + public void removeCommitListener(final IListener listener) { + synchronized (this.commitListeners) { + this.commitListeners.remove(listener); + } + } + + @SuppressWarnings("deprecation") /* backwards-compatibility */ + protected final void fireCommit() { + synchronized (this.compatibilityCommitListeners) { + for (Listener commitListener : new ArrayList<Listener>( + this.compatibilityCommitListeners)) { + commitListener.handleEvent(new Event()); + } + } + synchronized (this.commitListeners) { + for (IListener commitListener : new ArrayList<IListener>(this.commitListeners)) { + commitListener.handleEvent(); + } + } + } + + public void addChangeListener(final IListener listener) { + synchronized (this.changeListeners) { + if (!this.changeListeners.contains(listener)) { + this.changeListeners.add(listener); + } + } + } + + public void removeChangeListener(final IListener listener) { + synchronized (this.changeListeners) { + this.changeListeners.remove(listener); + } + } + + protected final void fireChanged() { + synchronized (this.changeListeners) { + for (IListener changeListener : new ArrayList<IListener>(this.changeListeners)) { + changeListener.handleEvent(); + } + } + } + + public IValidator getValidator() { + // always valid by default + return this.defaultValidator; + } + + protected final void close() { + if (!isDisposed()) { + getParent().forceFocus(); + dispose(); + } + } +}
diff --git a/org.eclipse.modisco.facet.widgets.celleditors/src/org/eclipse/modisco/facet/widgets/celleditors/CellEditorsUtils.java b/org.eclipse.modisco.facet.widgets.celleditors/src/org/eclipse/modisco/facet/widgets/celleditors/CellEditorsUtils.java new file mode 100644 index 0000000..d4559d3 --- /dev/null +++ b/org.eclipse.modisco.facet.widgets.celleditors/src/org/eclipse/modisco/facet/widgets/celleditors/CellEditorsUtils.java
@@ -0,0 +1,65 @@ +/******************************************************************************* + * Copyright (c) 2011 CEA LIST. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Vincent Lorenzo (CEA-LIST) - Bug 351931 - Use local cell editor in table + * Gregoire Dupe (Mia-Software) - Bug 351931 - Use local cell editor in table + */ + package org.eclipse.modisco.facet.widgets.celleditors; + +import java.util.Iterator; +import java.util.List; + +import org.eclipse.emf.common.util.URI; +import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.ecore.resource.Resource; +import org.eclipse.emf.ecore.resource.ResourceSet; +import org.eclipse.modisco.facet.widgets.celleditors.modelCellEditor.AbstractModelCellEditor; +import org.eclipse.modisco.facet.widgets.celleditors.modelCellEditor.ModelCellEditorDeclarations; + +/** + * @since 0.1.1 + * @author gdupe + * + */ +public final class CellEditorsUtils { + + private static final String FILE_EXTENSION = "modelcelleditors"; //$NON-NLS-1$ + + private CellEditorsUtils() { + // This is an utility class which must not be instantiated + } + + /** + * This method allows to find the bundle name for an editor + * + * @param editor + * an editor + * @return the bundle name for this editor + */ + public static String getBundleNameFor(final AbstractModelCellEditor editor, final ResourceSet resourceSet) { + for (Resource ressource : resourceSet.getResources()) { + if (CellEditorsUtils.FILE_EXTENSION.equals(ressource.getURI().fileExtension())) { + Iterator<EObject> allContents = ressource.getContents().iterator(); + while (allContents.hasNext()) { + EObject currentContent = allContents.next(); + if (currentContent instanceof ModelCellEditorDeclarations) { + if (((ModelCellEditorDeclarations) currentContent).getModelCellEditors() + .contains(editor)) { + URI uri = ressource.getURI(); + if (uri.isPlatformPlugin()) { + List<String> list = uri.segmentsList(); + return list.get(1); + } + } + } + } + } + } + + return null; + } +}
diff --git a/org.eclipse.modisco.facet.widgets.celleditors/src/org/eclipse/modisco/facet/widgets/celleditors/ICellEditorsRegistry.java b/org.eclipse.modisco.facet.widgets.celleditors/src/org/eclipse/modisco/facet/widgets/celleditors/ICellEditorsRegistry.java new file mode 100644 index 0000000..83e2027 --- /dev/null +++ b/org.eclipse.modisco.facet.widgets.celleditors/src/org/eclipse/modisco/facet/widgets/celleditors/ICellEditorsRegistry.java
@@ -0,0 +1,84 @@ +/******************************************************************************* + * Copyright (c) 2011 Mia-Software. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Nicolas Guyomar (Mia-Software) - Bug 339554 - org.eclipse.emf.facet.widgets.celleditors API cleaning + * Nicolas Bros (Mia-Software) - Bug 339855 - ModelCellEditor class should not be exposed + *******************************************************************************/ +package org.eclipse.modisco.facet.widgets.celleditors; + +import java.util.List; + +import org.eclipse.emf.ecore.EClassifier; +import org.eclipse.modisco.facet.widgets.celleditors.internal.CellEditorsRegistry; +import org.eclipse.modisco.facet.widgets.celleditors.modelCellEditor.AbstractModelCellEditor; + +/** + * Registry for the "celleditors" extension point + * @noextend This interface is not intended to be extended by clients. + * @noimplement This interface is not intended to be implemented by clients. + */ +public interface ICellEditorsRegistry { + + static ICellEditorsRegistry INSTANCE = new CellEditorsRegistry(); + + List<IModelCellEditorContainer<? extends AbstractModelCellEditor>> getAllCellEditors(); + + /** + * Returns a cell editor to edit a single value of the given type, or <code>null</code> if none + * was found. Custom cell editors override the default ones (from + * "org.eclipse.emf.facet.widgets.celleditors"). + * + * @param type + * the type for which to get a cell editor + * @return the cell editor or <code>null</code> if none was found for the given type + */ + IModelCellEditor getCellEditorFor(EClassifier type); + + /** + * Returns a cell editor to edit a list of values of the given type, or <code>null</code> if + * none was found. Custom cell editors override the default ones (from + * "org.eclipse.emf.facet.widgets.celleditors"). + * + * @param type + * the type for which to get a cell editor + * @return the cell editor or <code>null</code> if none was found for the given type + */ + INaryFeatureCellEditor getNaryCellEditorFor(EClassifier type); + + /** + * Returns a cell editor to edit a single value of the given type, or <code>null</code> if none + * was found. Custom cell editors override the default ones (from + * "org.eclipse.emf.facet.widgets.celleditors"). + * + * @param type + * the type for which to get a cell editor + * @param preferredCellEditors + * the cell editors that should be chosen in case of conflicts (several cell editors + * defined for the same type) + * @return the cell editor or <code>null</code> if none was found for the given type + */ + IModelCellEditor getCellEditorFor(EClassifier type, + List<AbstractModelCellEditor> preferredCellEditors); + + /** + * Returns a cell editor to edit a list of values of the given type, or <code>null</code> if + * none was found. Custom cell editors override the default ones (from + * "org.eclipse.emf.facet.widgets.celleditors"). + * + * @param type + * the type for which to get a cell editor + * @param preferredCellEditors + * the cell editors that should be chosen in case of conflicts (several cell editors + * defined for the same type) + * @return the cell editor or <code>null</code> if none was found for the given type + */ + INaryFeatureCellEditor getNaryCellEditorFor(EClassifier type, + List<AbstractModelCellEditor> preferredCellEditors); + +} \ No newline at end of file
diff --git a/org.eclipse.modisco.facet.widgets.celleditors/src/org/eclipse/modisco/facet/widgets/celleditors/ICommandFactoriesRegistry.java b/org.eclipse.modisco.facet.widgets.celleditors/src/org/eclipse/modisco/facet/widgets/celleditors/ICommandFactoriesRegistry.java new file mode 100644 index 0000000..3bb8ec5 --- /dev/null +++ b/org.eclipse.modisco.facet.widgets.celleditors/src/org/eclipse/modisco/facet/widgets/celleditors/ICommandFactoriesRegistry.java
@@ -0,0 +1,42 @@ +/******************************************************************************* + * Copyright (c) 2011 Mia-Software. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Nicolas Guyomar (Mia-Software) - Bug 339554 - org.eclipse.emf.facet.widgets.celleditors API cleaning + *******************************************************************************/ +package org.eclipse.modisco.facet.widgets.celleditors; + +import java.util.List; + +import org.eclipse.emf.common.command.Command; +import org.eclipse.emf.edit.domain.EditingDomain; +import org.eclipse.modisco.facet.widgets.celleditors.internal.CommandFactoriesRegistry; + +/** + * Registry for the "commandFactories" extension point. It is used to create EMF {@link Command}s + * compatible with a given {@link EditingDomain}. + * <p> + * For example, a <code>TransactionalEditingDomain</code> doesn't work with the usual EMF commands, + * and the model must be manipulated with {@link Command}s that use transactions. + * @noimplement This interface is not intended to be implemented by clients. + * @noextend This interface is not intended to be extended by clients. + */ +public interface ICommandFactoriesRegistry { + + /** the singleton {@link ICommandFactoriesRegistry} */ + static ICommandFactoriesRegistry INSTANCE = new CommandFactoriesRegistry(); + + /** @return the list of registered command factories */ + List<ICommandFactory> getCommandFactories(); + + /** + * @return a command factory compatible with the given {@link EditingDomain}, or + * <code>null</code> if none is found + */ + ICommandFactory getCommandFactoryFor(final EditingDomain editingDomain); +} \ No newline at end of file
diff --git a/org.eclipse.modisco.facet.widgets.celleditors/src/org/eclipse/modisco/facet/widgets/celleditors/ICommandFactory.java b/org.eclipse.modisco.facet.widgets.celleditors/src/org/eclipse/modisco/facet/widgets/celleditors/ICommandFactory.java new file mode 100644 index 0000000..8fb0517 --- /dev/null +++ b/org.eclipse.modisco.facet.widgets.celleditors/src/org/eclipse/modisco/facet/widgets/celleditors/ICommandFactory.java
@@ -0,0 +1,30 @@ +/******************************************************************************* + * Copyright (c) 2010 CEA LIST. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Nicolas Bros (Mia-Software) - initial API and implementation + * Gregoire Dupe (Mia-Software) - Bug 369987 - [Restructuring][Table] Switch to the new customization and facet framework + *******************************************************************************/ +package org.eclipse.modisco.facet.widgets.celleditors; + +import org.eclipse.emf.common.command.Command; +import org.eclipse.emf.edit.domain.EditingDomain; + +/** + * Creates {@link Command}s for a specific {@link EditingDomain}. + * <p> + * See also {@link ICommandFactoriesRegistry} + */ +public interface ICommandFactory extends + org.eclipse.modisco.facet.util.emf.core.internal.exported.ICommandFactory { + + // The content of this interface ha been moved to + // org.eclipse.emf.facet.util.emf.core.internal.exported.ICommandFactory to + // solve a cyclic + // dependency issue (with the plug-in org.eclipse.emf.facet.custom.ui) +}
diff --git a/org.eclipse.modisco.facet.widgets.celleditors/src/org/eclipse/modisco/facet/widgets/celleditors/ICompositeEditorFactory.java b/org.eclipse.modisco.facet.widgets.celleditors/src/org/eclipse/modisco/facet/widgets/celleditors/ICompositeEditorFactory.java new file mode 100644 index 0000000..b0a1e05 --- /dev/null +++ b/org.eclipse.modisco.facet.widgets.celleditors/src/org/eclipse/modisco/facet/widgets/celleditors/ICompositeEditorFactory.java
@@ -0,0 +1,48 @@ +/******************************************************************************* + * Copyright (c) 2011 Mia-Software. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Fabien Giquel (Mia-Software) - initial API and implementation + * Nicolas Guyomar (Mia-Software) - Bug 334546 - [celleditors] no border on Text field + * Nicolas Bros (Mia-Software) - Bug 338437 - compositeEditors extension point cannot be used to register user types + *******************************************************************************/ +package org.eclipse.modisco.facet.widgets.celleditors; + +import org.eclipse.swt.SWT; +import org.eclipse.swt.widgets.Composite; + +/** + * The factory interface for creating some control + * {@link AbstractCellEditorComposite} dedicated to the edition of one java + * type. The developer should register some factories using the dedicated + * extension point "compositeEditors" + * + * @param <T> + * the java type managed by this composite editor factory. + */ +public interface ICompositeEditorFactory<T> { + + /** + * @return the type handled by the composite editors created by this factory. This method is + * required because of type erasure with Java generics. + */ + Class<T> getHandledType(); + + /** + * Create a cell editor composite for a value of type <T>, as a subclass of + * {@link AbstractCellEditorComposite}, which is a SWT {@link Composite} suited for use as an + * in-place editor for values of type <T>. + * + * @param parent + * the SWT parent of the new composite + * @param style + * SWT style bits ({@link SWT#BORDER}, etc.) + * @return the new cell editor composite + */ + AbstractCellEditorComposite<T> createCompositeEditor(Composite parent, int style); + +}
diff --git a/org.eclipse.modisco.facet.widgets.celleditors/src/org/eclipse/modisco/facet/widgets/celleditors/IListener.java b/org.eclipse.modisco.facet.widgets.celleditors/src/org/eclipse/modisco/facet/widgets/celleditors/IListener.java new file mode 100644 index 0000000..5e225de --- /dev/null +++ b/org.eclipse.modisco.facet.widgets.celleditors/src/org/eclipse/modisco/facet/widgets/celleditors/IListener.java
@@ -0,0 +1,16 @@ +/******************************************************************************* + * Copyright (c) 2011 Mia-Software. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Nicolas Bros (Mia-Software) - Bug 334539 - [celleditors] change listener + *******************************************************************************/ +package org.eclipse.modisco.facet.widgets.celleditors; + +public interface IListener { + /** Sent when an event that the receiver has registered for occurs. */ + void handleEvent(); +}
diff --git a/org.eclipse.modisco.facet.widgets.celleditors/src/org/eclipse/modisco/facet/widgets/celleditors/IModelCellEditHandler.java b/org.eclipse.modisco.facet.widgets.celleditors/src/org/eclipse/modisco/facet/widgets/celleditors/IModelCellEditHandler.java new file mode 100644 index 0000000..98b2b93 --- /dev/null +++ b/org.eclipse.modisco.facet.widgets.celleditors/src/org/eclipse/modisco/facet/widgets/celleditors/IModelCellEditHandler.java
@@ -0,0 +1,21 @@ +/******************************************************************************* + * Copyright (c) 2010 CEA LIST. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Nicolas Bros (Mia-Software) - initial API and implementation + *******************************************************************************/ +package org.eclipse.modisco.facet.widgets.celleditors; + +public interface IModelCellEditHandler { + /** + * Commit the value currently in the cell editor. This will get the value + * through {@link IModelCellEditor#getValue()} and set it on the model + * element under the cell. + */ + void commit(); +}
diff --git a/org.eclipse.modisco.facet.widgets.celleditors/src/org/eclipse/modisco/facet/widgets/celleditors/IModelCellEditor.java b/org.eclipse.modisco.facet.widgets.celleditors/src/org/eclipse/modisco/facet/widgets/celleditors/IModelCellEditor.java new file mode 100644 index 0000000..d6893d8 --- /dev/null +++ b/org.eclipse.modisco.facet.widgets.celleditors/src/org/eclipse/modisco/facet/widgets/celleditors/IModelCellEditor.java
@@ -0,0 +1,51 @@ +/******************************************************************************* + * Copyright (c) 2010 CEA LIST. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Nicolas Bros (Mia-Software) - initial API and implementation + *******************************************************************************/ +package org.eclipse.modisco.facet.widgets.celleditors; + +import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.ecore.EStructuralFeature; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Control; + +public interface IModelCellEditor { + + /** + * Initialize a cell for edition. This method must create a control inside + * the given parent to let the user edit the value. + * + * @param parent + * the SWT control that must contain the cell editor + * @param originalValue + * the original value of the cell being edited (that should be + * displayed in the control initially) + * @param editHandler + * call {@link IModelCellEditHandler#commit()} when the user + * "commits" the value (for example by hitting enter in a text + * cell editor) + * @param feature + * the model feature for which the value is edited + * @param source + * the object containing the attribute or reference + * + * @return the SWT {@link Control} to be used for capturing the new cell + * value + */ + Control activateCell(Composite parent, Object originalValue, IModelCellEditHandler editHandler, + EStructuralFeature feature, EObject source); + + /** + * @return the value currently in the control. This is the value that will + * be set on the model element when + * {@link IModelCellEditHandler#commit()} is called. + */ + Object getValue(); +}
diff --git a/org.eclipse.modisco.facet.widgets.celleditors/src/org/eclipse/modisco/facet/widgets/celleditors/IModelCellEditorContainer.java b/org.eclipse.modisco.facet.widgets.celleditors/src/org/eclipse/modisco/facet/widgets/celleditors/IModelCellEditorContainer.java new file mode 100644 index 0000000..40feae0 --- /dev/null +++ b/org.eclipse.modisco.facet.widgets.celleditors/src/org/eclipse/modisco/facet/widgets/celleditors/IModelCellEditorContainer.java
@@ -0,0 +1,25 @@ +/******************************************************************************* + * Copyright (c) 2011 Mia-Software. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Nicolas Guyomar (Mia-Software) - Bug 339554 - org.eclipse.emf.facet.widgets.celleditors API cleaning + *******************************************************************************/ +package org.eclipse.modisco.facet.widgets.celleditors; + +import org.eclipse.modisco.facet.widgets.celleditors.modelCellEditor.AbstractModelCellEditor; + +public interface IModelCellEditorContainer<T extends AbstractModelCellEditor> { + + public String getBundleName(); + + public void setBundleName(String bundleName); + + public AbstractModelCellEditor getModelCellEditor(); + + public void setModelCellEditor(AbstractModelCellEditor modelCellEditor); +}
diff --git a/org.eclipse.modisco.facet.widgets.celleditors/src/org/eclipse/modisco/facet/widgets/celleditors/IModelCellEditorValidator.java b/org.eclipse.modisco.facet.widgets.celleditors/src/org/eclipse/modisco/facet/widgets/celleditors/IModelCellEditorValidator.java new file mode 100644 index 0000000..fde6b2e --- /dev/null +++ b/org.eclipse.modisco.facet.widgets.celleditors/src/org/eclipse/modisco/facet/widgets/celleditors/IModelCellEditorValidator.java
@@ -0,0 +1,18 @@ +/******************************************************************************* + * Copyright (c) 2010 CEA LIST. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Nicolas Bros (Mia-Software) - initial API and implementation + *******************************************************************************/ +package org.eclipse.modisco.facet.widgets.celleditors; + +/** Allows validating a cell editor's value before it is committed */ +public interface IModelCellEditorValidator { + /** @return whether the given value is valid for this cell editor */ + boolean isValid(Object newValue); +}
diff --git a/org.eclipse.modisco.facet.widgets.celleditors/src/org/eclipse/modisco/facet/widgets/celleditors/INaryEAttributeCellEditor.java b/org.eclipse.modisco.facet.widgets.celleditors/src/org/eclipse/modisco/facet/widgets/celleditors/INaryEAttributeCellEditor.java new file mode 100644 index 0000000..7423de3 --- /dev/null +++ b/org.eclipse.modisco.facet.widgets.celleditors/src/org/eclipse/modisco/facet/widgets/celleditors/INaryEAttributeCellEditor.java
@@ -0,0 +1,47 @@ +/******************************************************************************* + * Copyright (c) 2011 CEA LIST. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Nicolas Guyomar (Mia-Software) - Bug 342451 - To be able to edit derived facet attributes and derived facet references in a table + *******************************************************************************/ +package org.eclipse.modisco.facet.widgets.celleditors; + +import java.util.List; + +import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.ecore.EStructuralFeature; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Control; + +public interface INaryEAttributeCellEditor<T extends Object> { + + /** + * Initialize a cell for edition of a n-ary feature. This method must create + * a control inside the given parent to let the user edit the value. + * + * @param parent + * the SWT control that must contain the cell editor + * @param values + * the actual values of the reference + * @param feature + * the feature + * @param eObject + * the {@link EObject} being currently edited. + * @param editHandler + * @return the SWT {@link Control} to be used for capturing the new cell + * value + */ + Control activateCell(Composite parent, List<T> values, IModelCellEditHandler editHandler, EObject eObject, EStructuralFeature feature); + + /** + * @return the value currently in the control. This is the value that will + * be set on the model element when + * {@link IModelCellEditHandler#commit()} is called. + */ + List<T> getValue(); +}
diff --git a/org.eclipse.modisco.facet.widgets.celleditors/src/org/eclipse/modisco/facet/widgets/celleditors/INaryEReferenceCellEditor.java b/org.eclipse.modisco.facet.widgets.celleditors/src/org/eclipse/modisco/facet/widgets/celleditors/INaryEReferenceCellEditor.java new file mode 100644 index 0000000..fff8ca5 --- /dev/null +++ b/org.eclipse.modisco.facet.widgets.celleditors/src/org/eclipse/modisco/facet/widgets/celleditors/INaryEReferenceCellEditor.java
@@ -0,0 +1,62 @@ +/******************************************************************************* + * Copyright (c) 2011 CEA LIST. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Nicolas Guyomar (Mia-Software) - Bug 342451 - To be able to edit derived facet attributes and derived facet references in a table + *******************************************************************************/ +package org.eclipse.modisco.facet.widgets.celleditors; + +import java.util.List; + +import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.ecore.EStructuralFeature; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Control; + +public interface INaryEReferenceCellEditor<T extends EObject> { + + /** + * Initialize a cell for edition of a n-ary feature. This method must create + * a control inside the given parent to let the user edit the value. + * + * @param parent + * the SWT control that must contain the cell editor + * @param values + * the actual values of the reference + * @param availableValues + * the available value for the reference + * @param feature + * the feature + * @param eObject + * the {@link EObject} being currently edited. + * @param editHandler + * @return the SWT {@link Control} to be used for capturing the new cell + * value + */ + Control activateCell(Composite parent, List<T> values, List<T> availableValues, IModelCellEditHandler editHandler, EObject eObject, EStructuralFeature feature); + + /* + * Both lists are given here because in some case, we cannot calculate the the available + * element, for instance when editing FacetReference, we need to have the FacetContext deal with + * it. + * + * The EStructuralFeature is given here so that in the dialog we can know whether it is a + * containment one, which has an impact on the edition. It is also needed to instantiate new + * element, because we need to know its eType. + * + * The EObject is only here for dialog customization for instance. Do not modify it in the + * dialog, the dialog has to return the new values. + */ + + /** + * @return the value currently in the control. This is the value that will + * be set on the model element when + * {@link IModelCellEditHandler#commit()} is called. + */ + List<T> getValue(); +}
diff --git a/org.eclipse.modisco.facet.widgets.celleditors/src/org/eclipse/modisco/facet/widgets/celleditors/INaryFeatureCellEditor.java b/org.eclipse.modisco.facet.widgets.celleditors/src/org/eclipse/modisco/facet/widgets/celleditors/INaryFeatureCellEditor.java new file mode 100644 index 0000000..22a111a --- /dev/null +++ b/org.eclipse.modisco.facet.widgets.celleditors/src/org/eclipse/modisco/facet/widgets/celleditors/INaryFeatureCellEditor.java
@@ -0,0 +1,41 @@ +/******************************************************************************* + * Copyright (c) 2010 CEA LIST. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Nicolas Bros (Mia-Software) - initial API and implementation + *******************************************************************************/ +package org.eclipse.modisco.facet.widgets.celleditors; + +import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.ecore.EStructuralFeature; +import org.eclipse.emf.edit.domain.EditingDomain; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Control; + +public interface INaryFeatureCellEditor { + + /** + * Initialize a cell for edition of a n-ary feature. This method must create + * a control inside the given parent to let the user edit the value. + * + * @param parent + * the SWT control that must contain the cell editor + * @param feature + * the model feature for which the value is edited + * @param source + * the object containing the attribute or reference + * @param editingDomain + * the source {@link EObject} must be edited only through this + * {@link EditingDomain} + * + * @return the SWT {@link Control} to be used for capturing the new cell + * value + */ + Control activateCell(Composite parent, EStructuralFeature feature, EObject source, + EditingDomain editingDomain); +}
diff --git a/org.eclipse.modisco.facet.widgets.celleditors/src/org/eclipse/modisco/facet/widgets/celleditors/IValidator.java b/org.eclipse.modisco.facet.widgets.celleditors/src/org/eclipse/modisco/facet/widgets/celleditors/IValidator.java new file mode 100644 index 0000000..f20dd96 --- /dev/null +++ b/org.eclipse.modisco.facet.widgets.celleditors/src/org/eclipse/modisco/facet/widgets/celleditors/IValidator.java
@@ -0,0 +1,25 @@ +/***************************************************************************** + * Copyright (c) 2010 CEA LIST. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Gregoire Dupe (Mia-Software) - initial API and implementation + *****************************************************************************/ +package org.eclipse.modisco.facet.widgets.celleditors; + +import org.eclipse.core.runtime.IStatus; + +/** Used to validate the value of a cell editor. */ +public interface IValidator { + /** + * Validates the given value for the cell editor. + * + * @return an {@link IStatus} with a status of {@link IStatus#OK} if the given value is valid, + * or with a status of {@link IStatus#ERROR} otherwise. + */ + IStatus validate(Object value); +}
diff --git a/org.eclipse.modisco.facet.widgets.celleditors/src/org/eclipse/modisco/facet/widgets/celleditors/IWidget2.java b/org.eclipse.modisco.facet.widgets.celleditors/src/org/eclipse/modisco/facet/widgets/celleditors/IWidget2.java new file mode 100644 index 0000000..c1e3dff --- /dev/null +++ b/org.eclipse.modisco.facet.widgets.celleditors/src/org/eclipse/modisco/facet/widgets/celleditors/IWidget2.java
@@ -0,0 +1,43 @@ +/***************************************************************************** + * Copyright (c) 2010 CEA LIST. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Nicolas Guyomar (Mia-Software) - initial API and implementation + * Nicolas Bros (Mia-Software) + * Nicolas Bros (Mia-Software) - Bug 334539 - [celleditors] change listener + *****************************************************************************/ +package org.eclipse.modisco.facet.widgets.celleditors; + +import org.eclipse.swt.widgets.Composite; + +/** Implemented by {@link Composite}s that are encapsulated in {@link IModelCellEditor cell editors} */ +public interface IWidget2<T extends Object> { + /** @return the validator used to determine whether an entered value is accepted */ + IValidator getValidator(); + + /** + * Add a listener that is notified when the value in the widget is "committed". That is, when + * the user hits Enter or clicks outside the widget. + */ + void addCommitListener(IListener listener); + + /** Remove an existing commit listener */ + void removeCommitListener(IListener listener); + + /** Add a listener for changes to the value */ + void addChangeListener(IListener listener); + + /** Remove an existing change listener */ + void removeChangeListener(IListener listener); + + /** Set the given value in the widget */ + void setValue(final T value); + + /** Get the value from the widget */ + T getValue(); +}
diff --git a/org.eclipse.modisco.facet.widgets.celleditors/src/org/eclipse/modisco/facet/widgets/celleditors/core/composite/registry/ICompositeEditorFactoriesRegistry.java b/org.eclipse.modisco.facet.widgets.celleditors/src/org/eclipse/modisco/facet/widgets/celleditors/core/composite/registry/ICompositeEditorFactoriesRegistry.java new file mode 100644 index 0000000..ce071ad --- /dev/null +++ b/org.eclipse.modisco.facet.widgets.celleditors/src/org/eclipse/modisco/facet/widgets/celleditors/core/composite/registry/ICompositeEditorFactoriesRegistry.java
@@ -0,0 +1,36 @@ +/******************************************************************************* + * Copyright (c) 2011 Mia-Software. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Nicolas Guyomar (Mia-Software) - Bug 339554 - org.eclipse.emf.facet.widgets.celleditors API cleaning + *******************************************************************************/ +package org.eclipse.modisco.facet.widgets.celleditors.core.composite.registry; + +import org.eclipse.modisco.facet.widgets.celleditors.ICompositeEditorFactory; +import org.eclipse.modisco.facet.widgets.celleditors.internal.composite.registries.CompositeEditorFactoriesRegistry; + +/** + * Registry for the "compositeEditorFactories" extension point + * @noimplement This interface is not intended to be implemented by clients. + * @noextend This interface is not intended to be extended by clients. + * @since 1.0 + */ +public interface ICompositeEditorFactoriesRegistry { + + /** the singleton {@link ICompositeEditorFactoriesRegistry} */ + ICompositeEditorFactoriesRegistry INSTANCE = new CompositeEditorFactoriesRegistry(); + + /** Whether there is a {@link CompositeEditorFactory} for the given type */ + boolean hasCompositeEditorFactory(final Class<?> type); + + /** + * @return the {@link CompositeEditorFactory} for the given type, or <code>null</code> if none is + * registered + */ + <T> ICompositeEditorFactory<T> getCompositeEditorFactory(final Class<T> type); + +}
diff --git a/org.eclipse.modisco.facet.widgets.celleditors/src/org/eclipse/modisco/facet/widgets/celleditors/internal/Activator.java b/org.eclipse.modisco.facet.widgets.celleditors/src/org/eclipse/modisco/facet/widgets/celleditors/internal/Activator.java new file mode 100644 index 0000000..b7d2cb9 --- /dev/null +++ b/org.eclipse.modisco.facet.widgets.celleditors/src/org/eclipse/modisco/facet/widgets/celleditors/internal/Activator.java
@@ -0,0 +1,69 @@ +/***************************************************************************** + * Copyright (c) 2010 CEA LIST. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Nicolas Guyomar (Mia-Software) - initial API and implementation + * Nicolas Bros (Mia-Software) - Bug 339664 - org.eclipse.emf.facet.widgets.celleditors API cleaning + *****************************************************************************/ +package org.eclipse.modisco.facet.widgets.celleditors.internal; + +import org.eclipse.ui.plugin.AbstractUIPlugin; +import org.osgi.framework.BundleContext; + +/** + * The activator class controls the plug-in life cycle + */ +public class Activator extends AbstractUIPlugin { + // The plug-in ID + public static final String PLUGIN_ID = "org.eclipse.emf.facet.widgets.celleditors"; //$NON-NLS-1$ + + // The shared instance + private static Activator plugin; + + /** + * The constructor + */ + public Activator() { + } + + /* + * (non-Javadoc) + * + * @see + * org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext + * ) + */ + @Override + public void start(final BundleContext context) throws Exception { + super.start(context); + Activator.plugin = this; + } + + /* + * (non-Javadoc) + * + * @see + * org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext + * ) + */ + @Override + public void stop(final BundleContext context) throws Exception { + Activator.plugin = null; + super.stop(context); + } + + /** + * Returns the shared instance + * + * @return the shared instance + */ + public static Activator getDefault() { + return Activator.plugin; + } + +}
diff --git a/org.eclipse.modisco.facet.widgets.celleditors/src/org/eclipse/modisco/facet/widgets/celleditors/internal/CellEditorsRegistry.java b/org.eclipse.modisco.facet.widgets.celleditors/src/org/eclipse/modisco/facet/widgets/celleditors/internal/CellEditorsRegistry.java new file mode 100644 index 0000000..3aa934b --- /dev/null +++ b/org.eclipse.modisco.facet.widgets.celleditors/src/org/eclipse/modisco/facet/widgets/celleditors/internal/CellEditorsRegistry.java
@@ -0,0 +1,342 @@ +/******************************************************************************* + * Copyright (c) 2010 CEA LIST. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Nicolas Bros (Mia-Software) - initial API and implementation + * Nicolas Bros (Mia-Software) - Bug 338437 - compositeEditors extension point cannot be used to register user types + * Nicolas Guyomar (Mia-Software) - Bug 339554 - org.eclipse.emf.facet.widgets.celleditors API cleaning + * Nicolas Bros (Mia-Software) - Bug 339855 - ModelCellEditor class should not be exposed + * Gregoire Dupe (Mia-Software) - Bug 369987 - [Restructuring][Table] Switch to the new customization and facet framework + *******************************************************************************/ +package org.eclipse.modisco.facet.widgets.celleditors.internal; + +import java.util.ArrayList; +import java.util.List; + +import org.eclipse.core.runtime.IConfigurationElement; +import org.eclipse.emf.common.util.EList; +import org.eclipse.emf.common.util.URI; +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.EClassifier; +import org.eclipse.emf.ecore.EDataType; +import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.ecore.EcorePackage; +import org.eclipse.emf.ecore.resource.Resource; +import org.eclipse.emf.ecore.resource.ResourceSet; +import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl; +import org.eclipse.emf.ecore.util.EcoreUtil; +import org.eclipse.modisco.facet.util.core.Logger; +import org.eclipse.modisco.facet.util.core.internal.exported.AbstractRegistry; +import org.eclipse.modisco.facet.widgets.celleditors.ICellEditorsRegistry; +import org.eclipse.modisco.facet.widgets.celleditors.IModelCellEditor; +import org.eclipse.modisco.facet.widgets.celleditors.IModelCellEditorContainer; +import org.eclipse.modisco.facet.widgets.celleditors.INaryFeatureCellEditor; +import org.eclipse.modisco.facet.widgets.celleditors.modelCellEditor.AbstractModelCellEditor; +import org.eclipse.modisco.facet.widgets.celleditors.modelCellEditor.BasicCellEditor; +import org.eclipse.modisco.facet.widgets.celleditors.modelCellEditor.ModelCellEditorDeclarations; +import org.eclipse.modisco.facet.widgets.celleditors.modelCellEditor.NaryFeatureCellEditor; +import org.eclipse.modisco.facet.widgets.celleditors.modelCellEditor.UnaryReferenceCellEditor; + +/** Registry for the "loadingDepth" extension point */ +public class CellEditorsRegistry extends AbstractRegistry implements ICellEditorsRegistry { + + private static final String EXTENSION_POINT_NAMESPACE = "org.eclipse.emf.facet.widgets.celleditors"; //$NON-NLS-1$ + private static final String EXTENSION_POINT_NAME = "celleditors"; //$NON-NLS-1$ + + private static final String CELL_EDITORS_MODEL_ELEMENT = "cellEditorsModel"; //$NON-NLS-1$ + private static final String PATH_ATTRIBUTE = "path"; //$NON-NLS-1$ + + /** A list of basic cell editors */ + private final List<ModelCellEditorContainer<BasicCellEditor>> basicCellEditors = new ArrayList<ModelCellEditorContainer<BasicCellEditor>>(); + /** A list of unary reference cell editors */ + private final List<ModelCellEditorContainer<UnaryReferenceCellEditor>> unaryReferenceCellEditors = new ArrayList<ModelCellEditorContainer<UnaryReferenceCellEditor>>(); + /** A list of n-ary reference cell editors */ + private final List<ModelCellEditorContainer<NaryFeatureCellEditor>> naryFeatureCellEditors = new ArrayList<ModelCellEditorContainer<NaryFeatureCellEditor>>(); + + public CellEditorsRegistry() { + initialize(); + } + + public List<IModelCellEditorContainer<? extends AbstractModelCellEditor>> getAllCellEditors() { + List<IModelCellEditorContainer<? extends AbstractModelCellEditor>> allCellEditors = new ArrayList<IModelCellEditorContainer<? extends AbstractModelCellEditor>>(); + for (ModelCellEditorContainer<BasicCellEditor> basicCellEditor : this.basicCellEditors) { + allCellEditors.add(basicCellEditor); + } + for (ModelCellEditorContainer<UnaryReferenceCellEditor> unaryReferenceCellEditor : this.unaryReferenceCellEditors) { + allCellEditors.add(unaryReferenceCellEditor); + } + for (ModelCellEditorContainer<NaryFeatureCellEditor> naryReferenceCellEditor : this.naryFeatureCellEditors) { + allCellEditors.add(naryReferenceCellEditor); + } + return allCellEditors; + } + + /** + * Returns a cell editor wrapper for the given type, or <code>null</code> if none was found. + * Custom cell editors override the default ones (from + * "org.eclipse.emf.facet.widgets.celleditors"). + * + * @param type + * the type for which to get a cell editor wrapper + * @param many + * whether to get a cell editor to edit a single value or a list of values + * @return the cell editor wrapper or <code>null</code> if none was found for the given type + */ + public ModelCellEditor getCellEditorWrapperFor(final EClassifier type, final boolean many) { + return getCellEditorWrapperFor(type, many, null); + } + + /** + * Returns a cell editor to edit a single value of the given type, or <code>null</code> if none + * was found. Custom cell editors override the default ones (from + * "org.eclipse.emf.facet.widgets.celleditors"). + * + * @param type + * the type for which to get a cell editor + * @return the cell editor or <code>null</code> if none was found for the given type + */ + public IModelCellEditor getCellEditorFor(final EClassifier type) { + ModelCellEditor cellEditorWrapper = getCellEditorWrapperFor(type, false); + if (cellEditorWrapper != null) { + return (IModelCellEditor) cellEditorWrapper.getCellEditorImplementation(); + } + return null; + } + + /** + * Returns a cell editor wrapper to edit a list of values of the given type, or + * <code>null</code> if none was found. Custom cell editors override the default ones (from + * "org.eclipse.emf.facet.widgets.celleditors"). + * + * @param type + * the type for which to get a cell editor + * @return the cell editor wrapper or <code>null</code> if none was found for the given type + */ + public INaryFeatureCellEditor getNaryCellEditorFor(final EClassifier type) { + ModelCellEditor cellEditorWrapper = getCellEditorWrapperFor(type, true); + if (cellEditorWrapper != null) { + return (INaryFeatureCellEditor) cellEditorWrapper.getCellEditorImplementation(); + } + return null; + } + + public IModelCellEditor getCellEditorFor(final EClassifier type, + final List<AbstractModelCellEditor> preferredCellEditors) { + ModelCellEditor cellEditorWrapper = getCellEditorWrapperFor(type, false, + preferredCellEditors); + if (cellEditorWrapper != null) { + return (IModelCellEditor) cellEditorWrapper.getCellEditorImplementation(); + } + return null; + } + + public INaryFeatureCellEditor getNaryCellEditorFor(final EClassifier type, + final List<AbstractModelCellEditor> preferredCellEditors) { + ModelCellEditor cellEditorWrapper = getCellEditorWrapperFor(type, true, + preferredCellEditors); + if (cellEditorWrapper != null) { + return (INaryFeatureCellEditor) cellEditorWrapper.getCellEditorImplementation(); + } + return null; + } + + /** + * Returns a cell editor for the given type, or <code>null</code> if none was found. Custom cell + * editors override the default ones (from "org.eclipse.emf.facet.widgets.celleditors"). + * + * @param type + * the type for which to get a cell editor + * @param many + * whether to get a cell editor to edit a single value or a list of values + * @param preferredCellEditors + * the cell editors that should be chosen in case of conflicts (several cell editors + * defined for the same type) + * @return the cell editor or <code>null</code> if none was found for the given type + */ + public ModelCellEditor getCellEditorWrapperFor(final EClassifier type, final boolean many, + final List<AbstractModelCellEditor> preferredCellEditors) { + + List<IModelCellEditorContainer<? extends AbstractModelCellEditor>> allCellEditorContainers = getAllCellEditors(); + + List<ModelCellEditor> cellEditors = new ArrayList<ModelCellEditor>(); + + for (IModelCellEditorContainer<? extends AbstractModelCellEditor> modelCellEditorContainer : allCellEditorContainers) { + AbstractModelCellEditor modelCellEditor = modelCellEditorContainer.getModelCellEditor(); + if (isCellEditorForType(modelCellEditor, type, many)) { + cellEditors.add(new ModelCellEditor(modelCellEditorContainer.getBundleName(), + modelCellEditorContainer.getModelCellEditor())); + } + } + + ModelCellEditor selectedCellEditor = null; + + if (preferredCellEditors != null) { + for (AbstractModelCellEditor preferredCellEditor : preferredCellEditors) { + if (isCellEditorForType(preferredCellEditor, type, many)) { + if (selectedCellEditor != null) { + throw new IllegalArgumentException( + "Several preferred cell editors are defined for type: " //$NON-NLS-1$ + + EcoreUtil.getURI(type)); + } + selectedCellEditor = new ModelCellEditor("", preferredCellEditor); //$NON-NLS-1$ + } + } + } + + if (selectedCellEditor == null) { + if (cellEditors.size() == 1) { + selectedCellEditor = cellEditors.get(0); + } else if (cellEditors.size() > 1) { + boolean skippedDefault = false; + for (ModelCellEditor cellEditor : cellEditors) { + // lower priority for + // org.eclipse.emf.facet.widgets.celleditors.* + if (cellEditor.getBundleName().startsWith( + "org.eclipse.emf.facet.widgets.celleditors")) { //$NON-NLS-1$ + if (skippedDefault) { + Logger.logError( + "Several default cell editors are defined in EMF Facet for type: " //$NON-NLS-1$ + + EcoreUtil.getURI(type), Activator.getDefault()); + selectedCellEditor = cellEditor; + break; + } + skippedDefault = true; + continue; + } + if (selectedCellEditor != null) { + Logger.logWarning("Several cell editors are defined for type: " //$NON-NLS-1$ + + EcoreUtil.getURI(type), Activator.getDefault()); + break; + } + selectedCellEditor = cellEditor; + } + } + } + + return selectedCellEditor; + } + + public static boolean isCellEditorForType(final AbstractModelCellEditor modelCellEditor, + final EClassifier type, final boolean many) { + if (many != (modelCellEditor instanceof NaryFeatureCellEditor)) { + return false; + } + return isSuperType(modelCellEditor.getCellType(), type); + } + + private static boolean isSuperType(final EClassifier superType, final EClassifier subType) { + if (superType == subType) { + return true; + } + + if (superType instanceof EClass && subType instanceof EClass) { + // special case because isSuperTypeOf doesn't handle it + if (superType == EcorePackage.eINSTANCE.getEObject()) { + return true; + } + + EClass superTypeEClass = (EClass) superType; + EClass subTypeEClass = (EClass) subType; + return superTypeEClass.isSuperTypeOf(subTypeEClass); + } + + if (superType == EcorePackage.eINSTANCE.getEDataType() && subType instanceof EDataType) { + // cf Bug 331539 - cell editor registered for type "EDataType" + return true; + } + + return false; + } + + public List<ModelCellEditorContainer<BasicCellEditor>> getBasicCellEditors() { + return this.basicCellEditors; + } + + public List<ModelCellEditorContainer<UnaryReferenceCellEditor>> getUnaryReferenceCellEditors() { + return this.unaryReferenceCellEditors; + } + + public List<ModelCellEditorContainer<NaryFeatureCellEditor>> getNaryFeatureCellEditors() { + return this.naryFeatureCellEditors; + } + + @Override + protected String getExtensionPointName() { + return CellEditorsRegistry.EXTENSION_POINT_NAME; + } + + @Override + protected String getExtensionPointNamespace() { + return CellEditorsRegistry.EXTENSION_POINT_NAMESPACE; + } + + @Override + protected void handleRootElement(final IConfigurationElement configurationElement) { + final String name = configurationElement.getName(); + if (name.equalsIgnoreCase(CellEditorsRegistry.CELL_EDITORS_MODEL_ELEMENT)) { + readModelElement(configurationElement); + } else { + logUnknownElement(configurationElement); + } + } + + /** Read a 'cellEditorsModel' element */ + private void readModelElement(final IConfigurationElement configurationElement) { + final String path = configurationElement.getAttribute(CellEditorsRegistry.PATH_ATTRIBUTE); + String bundleName = configurationElement.getContributor().getName(); + URI uri = URI.createURI("platform:/plugin/" //$NON-NLS-1$ + + configurationElement.getContributor().getName() + "/" + path); //$NON-NLS-1$ + ResourceSet resourceSet = new ResourceSetImpl(); + Resource resource = resourceSet.getResource(uri, true); + if (resource != null) { + EList<EObject> contents = resource.getContents(); + if (contents.size() == 1) { + EObject eObject = contents.get(0); + if (eObject instanceof ModelCellEditorDeclarations) { + ModelCellEditorDeclarations modelCellEditors = (ModelCellEditorDeclarations) eObject; + EList<AbstractModelCellEditor> allCellEditors = modelCellEditors + .getModelCellEditors(); + for (AbstractModelCellEditor modelCellEditor : allCellEditors) { + if (modelCellEditor instanceof BasicCellEditor) { + BasicCellEditor basicCellEditor = (BasicCellEditor) modelCellEditor; + ModelCellEditorContainer<BasicCellEditor> modelCellEditorContainer = new ModelCellEditorContainer<BasicCellEditor>(); + modelCellEditorContainer.setBundleName(bundleName); + modelCellEditorContainer.setModelCellEditor(basicCellEditor); + this.basicCellEditors.add(modelCellEditorContainer); + } else if (modelCellEditor instanceof UnaryReferenceCellEditor) { + UnaryReferenceCellEditor unaryReferenceCellEditor = (UnaryReferenceCellEditor) modelCellEditor; + ModelCellEditorContainer<UnaryReferenceCellEditor> modelCellEditorContainer = new ModelCellEditorContainer<UnaryReferenceCellEditor>(); + modelCellEditorContainer.setBundleName(bundleName); + modelCellEditorContainer.setModelCellEditor(unaryReferenceCellEditor); + this.unaryReferenceCellEditors.add(modelCellEditorContainer); + } else if (modelCellEditor instanceof NaryFeatureCellEditor) { + NaryFeatureCellEditor naryFeatureCellEditor = (NaryFeatureCellEditor) modelCellEditor; + ModelCellEditorContainer<NaryFeatureCellEditor> modelCellEditorContainer = new ModelCellEditorContainer<NaryFeatureCellEditor>(); + modelCellEditorContainer.setBundleName(bundleName); + modelCellEditorContainer.setModelCellEditor(naryFeatureCellEditor); + this.naryFeatureCellEditors.add(modelCellEditorContainer); + } else { + Logger.logError("Not handled: " //$NON-NLS-1$ + + modelCellEditor.getClass().getSimpleName(), + Activator.getDefault()); + } + } + } else { + Logger.logError("Root element must be of type " //$NON-NLS-1$ + + ModelCellEditorDeclarations.class.getSimpleName() + ": " + uri, //$NON-NLS-1$ + Activator.getDefault()); + } + } else { + Logger.logError("Resource should have one and only one root: " + uri, //$NON-NLS-1$ + Activator.getDefault()); + } + } else { + Logger.logError("Error reading resource: " + uri, Activator.getDefault()); //$NON-NLS-1$ + } + } +} \ No newline at end of file
diff --git a/org.eclipse.modisco.facet.widgets.celleditors/src/org/eclipse/modisco/facet/widgets/celleditors/internal/CommandFactoriesRegistry.java b/org.eclipse.modisco.facet.widgets.celleditors/src/org/eclipse/modisco/facet/widgets/celleditors/internal/CommandFactoriesRegistry.java new file mode 100644 index 0000000..9438c1e --- /dev/null +++ b/org.eclipse.modisco.facet.widgets.celleditors/src/org/eclipse/modisco/facet/widgets/celleditors/internal/CommandFactoriesRegistry.java
@@ -0,0 +1,100 @@ +/******************************************************************************* + * Copyright (c) 2010 CEA LIST. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Nicolas Bros (Mia-Software) - initial API and implementation + * Nicolas Guyomar (Mia-Software) - Bug 339554 - org.eclipse.emf.facet.widgets.celleditors API cleaning + * Gregoire Dupe (Mia-Software) - Bug 369987 - [Restructuring][Table] Switch to the new customization and facet framework + *******************************************************************************/ +package org.eclipse.modisco.facet.widgets.celleditors.internal; + +import java.util.ArrayList; +import java.util.List; + +import org.eclipse.core.runtime.CoreException; +import org.eclipse.core.runtime.IConfigurationElement; +import org.eclipse.emf.edit.domain.EditingDomain; +import org.eclipse.modisco.facet.util.core.Logger; +import org.eclipse.modisco.facet.util.core.internal.exported.AbstractRegistry; +import org.eclipse.modisco.facet.widgets.celleditors.ICommandFactoriesRegistry; +import org.eclipse.modisco.facet.widgets.celleditors.ICommandFactory; + +/** Registry for the "loadingDepth" extension point */ +public class CommandFactoriesRegistry extends AbstractRegistry implements ICommandFactoriesRegistry { + + private static final String EXTENSION_POINT_NAMESPACE = "org.eclipse.emf.facet.widgets.celleditors"; //$NON-NLS-1$ + private static final String EXTENSION_POINT_NAME = "commandFactories"; //$NON-NLS-1$ + + private static final String COMMAND_FACTORY_ELEMENT = "commandFactory"; //$NON-NLS-1$ + private static final String CLASS_ATTRIBUTE = "class"; //$NON-NLS-1$ + + + private final List<ICommandFactory> commandFactories = new ArrayList<ICommandFactory>(); + private final ICommandFactory defaultCommandFactory = new DefaultCommandFactory(); + + public CommandFactoriesRegistry() { + initialize(); + } + + public List<ICommandFactory> getCommandFactories() { + return this.commandFactories; + } + + public ICommandFactory getCommandFactoryFor(final EditingDomain editingDomain) { + for (ICommandFactory commandFactory : this.commandFactories) { + if (commandFactory.handles(editingDomain)) { + return commandFactory; + } + } + return this.defaultCommandFactory; + } + + @Override + protected String getExtensionPointName() { + return CommandFactoriesRegistry.EXTENSION_POINT_NAME; + } + + @Override + protected String getExtensionPointNamespace() { + return CommandFactoriesRegistry.EXTENSION_POINT_NAMESPACE; + } + + @Override + protected void handleRootElement(final IConfigurationElement configurationElement) { + final String name = configurationElement.getName(); + if (name.equalsIgnoreCase(CommandFactoriesRegistry.COMMAND_FACTORY_ELEMENT)) { + readModelElement(configurationElement); + } else { + logUnknownElement(configurationElement); + } + } + + /** Read a 'cellEditorsModel' element */ + private void readModelElement(final IConfigurationElement configurationElement) { + Object object; + try { + object = configurationElement + .createExecutableExtension(CommandFactoriesRegistry.CLASS_ATTRIBUTE); + } catch (CoreException e) { + Logger.logError(e, Activator.getDefault()); + return; + } + if (object == null) { + logMissingAttribute(configurationElement, CommandFactoriesRegistry.CLASS_ATTRIBUTE); + return; + } + + if (object instanceof ICommandFactory) { + ICommandFactory commandFactory = (ICommandFactory) object; + this.commandFactories.add(commandFactory); + } else { + logError(configurationElement, + "class must implement " + ICommandFactory.class.getSimpleName()); //$NON-NLS-1$ + } + } +} \ No newline at end of file
diff --git a/org.eclipse.modisco.facet.widgets.celleditors/src/org/eclipse/modisco/facet/widgets/celleditors/internal/DefaultCommandFactory.java b/org.eclipse.modisco.facet.widgets.celleditors/src/org/eclipse/modisco/facet/widgets/celleditors/internal/DefaultCommandFactory.java new file mode 100644 index 0000000..abf56b9 --- /dev/null +++ b/org.eclipse.modisco.facet.widgets.celleditors/src/org/eclipse/modisco/facet/widgets/celleditors/internal/DefaultCommandFactory.java
@@ -0,0 +1,62 @@ +/******************************************************************************* + * Copyright (c) 2010 CEA LIST. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Nicolas Bros (Mia-Software) - initial API and implementation + * Nicolas Guyomar (Mia-Software) - Bug 339554 - org.eclipse.emf.facet.widgets.celleditors API cleaning + *******************************************************************************/ +package org.eclipse.modisco.facet.widgets.celleditors.internal; + +import org.eclipse.emf.common.command.Command; +import org.eclipse.emf.edit.command.AddCommand; +import org.eclipse.emf.edit.command.DeleteCommand; +import org.eclipse.emf.edit.command.MoveCommand; +import org.eclipse.emf.edit.command.RemoveCommand; +import org.eclipse.emf.edit.command.SetCommand; +import org.eclipse.emf.edit.domain.EditingDomain; +import org.eclipse.modisco.facet.widgets.celleditors.ICommandFactory; + +/** + * This is the command factory that is used when no other command factory is + * specified through the "commandFactories" extension point. + */ +public class DefaultCommandFactory implements ICommandFactory { + + public boolean handles(final EditingDomain editingDomain) { + return true; + } + + public Command createSetCommand(final EditingDomain domain, final Object owner, + final Object feature, final Object value) { + return SetCommand.create(domain, owner, feature, value); + } + + public Command createSetCommand(final EditingDomain domain, final Object owner, + final Object feature, final Object value, final int index) { + return SetCommand.create(domain, owner, feature, value, index); + } + + public Command createMoveCommand(final EditingDomain domain, final Object owner, + final Object feature, final Object value, final int index) { + return MoveCommand.create(domain, owner, feature, value, index); + } + + public Command createAddCommand(final EditingDomain domain, final Object owner, + final Object feature, final Object value) { + return AddCommand.create(domain, owner, feature, value); + } + + public Command createRemoveCommand(final EditingDomain domain, final Object owner, + final Object feature, final Object value) { + return RemoveCommand.create(domain, owner, feature, value); + } + + public Command createDeleteCommand(final EditingDomain domain, final Object object) { + return DeleteCommand.create(domain, object); + } +}
diff --git a/org.eclipse.modisco.facet.widgets.celleditors/src/org/eclipse/modisco/facet/widgets/celleditors/internal/Messages.java b/org.eclipse.modisco.facet.widgets.celleditors/src/org/eclipse/modisco/facet/widgets/celleditors/internal/Messages.java new file mode 100644 index 0000000..eee4eb0 --- /dev/null +++ b/org.eclipse.modisco.facet.widgets.celleditors/src/org/eclipse/modisco/facet/widgets/celleditors/internal/Messages.java
@@ -0,0 +1,53 @@ +/***************************************************************************** + * Copyright (c) 2010 CEA LIST. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Nicolas Bros (Mia-Software) - initial API and implementation + * Nicolas Bros (Mia-Software) - Bug 339664 - org.eclipse.emf.facet.widgets.celleditors API cleaning + *****************************************************************************/ +package org.eclipse.modisco.facet.widgets.celleditors.internal; + +import org.eclipse.osgi.util.NLS; + +public final class Messages extends NLS { + private static final String BUNDLE_NAME = "org.eclipse.emf.facet.widgets.celleditors.internal.messages"; //$NON-NLS-1$ + public static String CoreIFileComposite_mustSelectFile; + public static String CoreIFileComposite_selectFile; + public static String NaryAttributeEditingDialog_add; + public static String NaryAttributeEditingDialog_delete; + public static String NaryAttributeEditingDialog_enterNewValuePlaceholder; + public static String NaryReferenceEditingDialog_add; + public static String NaryReferenceEditingDialog_addAll; + public static String NaryReferenceEditingDialog_addAllTooltip; + public static String NaryReferenceEditingDialog_addTooltip; + public static String NaryReferenceEditingDialog_availableValues; + public static String NaryReferenceEditingDialog_deleteElements; + public static String NaryReferenceEditingDialog_deleteElementsLong; + public static String NaryReferenceEditingDialog_down; + public static String NaryReferenceEditingDialog_moveWarning; + public static String NaryReferenceEditingDialog_moveElement; + public static String NaryReferenceEditingDialog_newInstance; + public static String NaryReferenceEditingDialog_remove; + public static String NaryReferenceEditingDialog_removeAll; + public static String NaryReferenceEditingDialog_removeAllTooltip; + public static String NaryReferenceEditingDialog_removeTooltip; + public static String NaryReferenceEditingDialog_shellTitle; + public static String NaryReferenceEditingDialog_typeFilterText; + public static String NaryReferenceEditingDialog_up; + public static String NaryReferenceEditingDialog_values; + public static String UnaryReferenceCellEditorComposite_0; + public static String UnaryReferenceCellEditorComposite_1; + public static String UnaryReferenceCellEditorComposite_2; + static { + // initialize resource bundle + NLS.initializeMessages(Messages.BUNDLE_NAME, Messages.class); + } + + private Messages() { + } +}
diff --git a/org.eclipse.modisco.facet.widgets.celleditors/src/org/eclipse/modisco/facet/widgets/celleditors/internal/ModelCellEditor.java b/org.eclipse.modisco.facet.widgets.celleditors/src/org/eclipse/modisco/facet/widgets/celleditors/internal/ModelCellEditor.java new file mode 100644 index 0000000..6936438 --- /dev/null +++ b/org.eclipse.modisco.facet.widgets.celleditors/src/org/eclipse/modisco/facet/widgets/celleditors/internal/ModelCellEditor.java
@@ -0,0 +1,81 @@ +/******************************************************************************* + * Copyright (c) 2010 CEA LIST. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Nicolas Bros (Mia-Software) - initial API and implementation + * Nicolas Bros (Mia-Software) - Bug 339855 - ModelCellEditor class should not be exposed + *******************************************************************************/ +package org.eclipse.modisco.facet.widgets.celleditors.internal; + +import org.eclipse.core.runtime.Platform; +import org.eclipse.modisco.facet.util.core.Logger; +import org.eclipse.modisco.facet.widgets.celleditors.modelCellEditor.AbstractModelCellEditor; + +public class ModelCellEditor { + private final String bundleName; + private final AbstractModelCellEditor modelCellEditor; + + public ModelCellEditor(final String bundleName, final AbstractModelCellEditor modelCellEditor) { + this.bundleName = bundleName; + this.modelCellEditor = modelCellEditor; + } + + public String getBundleName() { + return this.bundleName; + } + + public String getCellID() { + return this.modelCellEditor.getCellId(); + } + + public AbstractModelCellEditor getModelCellEditor() { + return this.modelCellEditor; + } + + public Object getCellEditorImplementation() { + String className = this.modelCellEditor.getModelCellEditorImpl(); + + Class<?> classInstance = null; + try { + classInstance = Platform.getBundle(this.bundleName).loadClass(className); + } catch (Exception e) { + Logger.logError("Could not find class: " + className, //$NON-NLS-1$ + Activator.getDefault()); + return null; + } + + Object instance = null; + try { + instance = classInstance.newInstance(); + } catch (Exception e) { + Logger.logError("Could not instantiate class: " + className, //$NON-NLS-1$ + Activator.getDefault()); + return null; + } + return instance; + } + + @Override + public boolean equals(final Object obj) { + if (obj instanceof ModelCellEditor) { + ModelCellEditor other = (ModelCellEditor) obj; + return other.getCellID().equals(getCellID()); + } + return false; + } + + @Override + public int hashCode() { + return getCellID().hashCode(); + } + + @Override + public String toString() { + return getBundleName() + "#" + getCellID(); //$NON-NLS-1$ + } +} \ No newline at end of file
diff --git a/org.eclipse.modisco.facet.widgets.celleditors/src/org/eclipse/modisco/facet/widgets/celleditors/internal/ModelCellEditorContainer.java b/org.eclipse.modisco.facet.widgets.celleditors/src/org/eclipse/modisco/facet/widgets/celleditors/internal/ModelCellEditorContainer.java new file mode 100644 index 0000000..2c2d358 --- /dev/null +++ b/org.eclipse.modisco.facet.widgets.celleditors/src/org/eclipse/modisco/facet/widgets/celleditors/internal/ModelCellEditorContainer.java
@@ -0,0 +1,39 @@ +/******************************************************************************* + * Copyright (c) 2011 Mia-Software. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Nicolas Guyomar (Mia-Software) - Bug 339554 - org.eclipse.emf.facet.widgets.celleditors API cleaning + *******************************************************************************/ +package org.eclipse.modisco.facet.widgets.celleditors.internal; + +import org.eclipse.modisco.facet.widgets.celleditors.IModelCellEditorContainer; +import org.eclipse.modisco.facet.widgets.celleditors.modelCellEditor.AbstractModelCellEditor; + +public class ModelCellEditorContainer<T extends AbstractModelCellEditor> implements + IModelCellEditorContainer<AbstractModelCellEditor> { + + private AbstractModelCellEditor modelCellEditor; + private String bundleName; + + public String getBundleName() { + return this.bundleName; + } + + public AbstractModelCellEditor getModelCellEditor() { + return this.modelCellEditor; + } + + public void setBundleName(final String bundleName) { + this.bundleName = bundleName; + } + + public void setModelCellEditor(final AbstractModelCellEditor modelCellEditor) { + this.modelCellEditor = modelCellEditor; + + } +} \ No newline at end of file
diff --git a/org.eclipse.modisco.facet.widgets.celleditors/src/org/eclipse/modisco/facet/widgets/celleditors/internal/composite/registries/CompositeEditorFactoriesRegistry.java b/org.eclipse.modisco.facet.widgets.celleditors/src/org/eclipse/modisco/facet/widgets/celleditors/internal/composite/registries/CompositeEditorFactoriesRegistry.java new file mode 100644 index 0000000..7f031a6 --- /dev/null +++ b/org.eclipse.modisco.facet.widgets.celleditors/src/org/eclipse/modisco/facet/widgets/celleditors/internal/composite/registries/CompositeEditorFactoriesRegistry.java
@@ -0,0 +1,121 @@ +/******************************************************************************* + * Copyright (c) 2011 Mia-Software. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Fabien Giquel (Mia-Software) - initial API and implementation + * Nicolas Bros (Mia-Software) - Bug 338437 - compositeEditors extension point cannot be used to register user types + * Nicolas Guyomar (Mia-Software) - Bug 338826 - CompositeEditorFactoriesRegistry.getCompositeEditorFactory() should be parameterized + * Nicolas Guyomar (Mia-Software) - Bug 339554 - org.eclipse.emf.facet.widgets.celleditors API cleaning + * Nicolas Bros (Mia-Software) - Bug 341369 - CompositeEditorFactoriesRegistry : inverted type comparison + * Gregoire Dupe (Mia-Software) - Bug 369987 - [Restructuring][Table] Switch to the new customization and facet framework + *******************************************************************************/ +package org.eclipse.modisco.facet.widgets.celleditors.internal.composite.registries; + +import java.util.ArrayList; +import java.util.List; + +import org.eclipse.core.runtime.CoreException; +import org.eclipse.core.runtime.IConfigurationElement; +import org.eclipse.modisco.facet.util.core.Logger; +import org.eclipse.modisco.facet.util.core.internal.exported.AbstractRegistry; +import org.eclipse.modisco.facet.widgets.celleditors.ICompositeEditorFactory; +import org.eclipse.modisco.facet.widgets.celleditors.internal.Activator; + +/** + * Registry for composite editors extension point + */ +public class CompositeEditorFactoriesRegistry extends AbstractRegistry + implements org.eclipse.modisco.facet.widgets.celleditors.core.composite.registry.ICompositeEditorFactoriesRegistry { + + private static final String CLASS_ATTRIBUTE = "class"; //$NON-NLS-1$ + + private static final String EXTENSION_POINT_NAMESPACE = "org.eclipse.emf.facet.widgets.celleditors"; //$NON-NLS-1$ + private static final String EXTENSION_POINT_NAME = "compositeEditorFactories"; //$NON-NLS-1$ + private final List<ICompositeEditorFactory<?>> compositeFactories; + + public CompositeEditorFactoriesRegistry() { + this.compositeFactories = new ArrayList<ICompositeEditorFactory<?>>(); + initialize(); + } + + public boolean hasCompositeEditorFactory(final Class<?> type) { + return getCompositeEditorFactory(type) != null; + } + + public <T> ICompositeEditorFactory<T> getCompositeEditorFactory(final Class<T> type) { + if (this.compositeFactories == null) { + initialize(); + } + + final Class<?> objectType; + if (type == byte.class) { + objectType = Byte.class; + } else if (type == short.class) { + objectType = Short.class; + } else if (type == int.class) { + objectType = Integer.class; + } else if (type == long.class) { + objectType = Long.class; + } else if (type == float.class) { + objectType = Float.class; + } else if (type == double.class) { + objectType = Double.class; + } else if (type == boolean.class) { + objectType = Boolean.class; + } else if (type == char.class) { + objectType = Character.class; + } else { + objectType = type; + } + + // choose the factory with the most "precise" type (lowest in the inheritance hierarchy) + Class<?> mostPreciseType = null; + ICompositeEditorFactory<T> mostPreciseFactory = null; + for (ICompositeEditorFactory<?> factory : this.compositeFactories) { + Class<?> handledType = factory.getHandledType(); + if (handledType != null && handledType.isAssignableFrom(objectType)) { + if (mostPreciseType == null || mostPreciseType.isAssignableFrom(handledType)) { + mostPreciseType = handledType; + mostPreciseFactory = castMostPreciseFactory(factory); + } + } + } + return mostPreciseFactory; + } + + // Only here to isolate the suppress warning + @SuppressWarnings("unchecked") + private <T> ICompositeEditorFactory<T> castMostPreciseFactory(final ICompositeEditorFactory<?> factory) { + ICompositeEditorFactory<T> mostPreciseFactory; + mostPreciseFactory = (ICompositeEditorFactory<T>) factory; + return mostPreciseFactory; + } + + @Override + protected String getExtensionPointNamespace() { + return CompositeEditorFactoriesRegistry.EXTENSION_POINT_NAMESPACE; + } + + @Override + protected String getExtensionPointName() { + return CompositeEditorFactoriesRegistry.EXTENSION_POINT_NAME; + } + + @Override + protected void handleRootElement(final IConfigurationElement configurationElement) { + ICompositeEditorFactory<?> factory; + try { + factory = (ICompositeEditorFactory<?>) configurationElement + .createExecutableExtension(CompositeEditorFactoriesRegistry.CLASS_ATTRIBUTE); + this.compositeFactories.add(factory); + } catch (CoreException e) { + Logger.logError( + e, + "A problem occured when instantiating a composite editor factory", Activator.getDefault()); //$NON-NLS-1$ + } + } +}
diff --git a/org.eclipse.modisco.facet.widgets.celleditors/src/org/eclipse/modisco/facet/widgets/celleditors/internal/core/EEnumCellEditor.java b/org.eclipse.modisco.facet.widgets.celleditors/src/org/eclipse/modisco/facet/widgets/celleditors/internal/core/EEnumCellEditor.java new file mode 100644 index 0000000..58f12cb --- /dev/null +++ b/org.eclipse.modisco.facet.widgets.celleditors/src/org/eclipse/modisco/facet/widgets/celleditors/internal/core/EEnumCellEditor.java
@@ -0,0 +1,62 @@ +/***************************************************************************** + * Copyright (c) 2010 CEA LIST. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Gregoire Dupe (Mia-Software) - initial API and implementation + * Nicolas Bros (Mia-Software) - Bug 339664 - org.eclipse.emf.facet.widgets.celleditors API cleaning + * Nicolas Bros (Mia-Software) - Bug 334539 - [celleditors] change listener + * Gregoire Dupe (Mia-Software) - Bug 344563 - NPE with Enum Editor + *****************************************************************************/ +package org.eclipse.modisco.facet.widgets.celleditors.internal.core; + +import org.eclipse.emf.common.util.Enumerator; +import org.eclipse.emf.ecore.EEnum; +import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.ecore.EStructuralFeature; +import org.eclipse.modisco.facet.widgets.celleditors.IListener; +import org.eclipse.modisco.facet.widgets.celleditors.IModelCellEditHandler; +import org.eclipse.modisco.facet.widgets.celleditors.IModelCellEditor; +import org.eclipse.modisco.facet.widgets.celleditors.internal.core.composite.EnumeratorComposite; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Control; + +/** + * This is a enum value editor + * + * @author Gregoire Dupe (Mia-Software) + * + */ +public class EEnumCellEditor implements IModelCellEditor { + + private EnumeratorComposite<Enumerator> composite = null; + + public Control activateCell(final Composite parent, final Object originalValue, + final IModelCellEditHandler editHandler, final EStructuralFeature feature, + final EObject source) { + if (!(feature.getEType() instanceof EEnum)) { + throw new IllegalArgumentException("EEnum feature type"); //$NON-NLS-1$ + } + this.composite = new EnumeratorComposite<Enumerator>(parent); + this.composite.setEEnum((EEnum) feature.getEType()); + + this.composite.setValue((Enumerator) originalValue); + + this.composite.addCommitListener(new IListener() { + public void handleEvent() { + editHandler.commit(); + } + }); + + return this.composite; + } + + public Object getValue() { + return this.composite.getValue(); + } + +}
diff --git a/org.eclipse.modisco.facet.widgets.celleditors/src/org/eclipse/modisco/facet/widgets/celleditors/internal/core/NaryAttributeCellEditor.java b/org.eclipse.modisco.facet.widgets.celleditors/src/org/eclipse/modisco/facet/widgets/celleditors/internal/core/NaryAttributeCellEditor.java new file mode 100644 index 0000000..3d7e3e7 --- /dev/null +++ b/org.eclipse.modisco.facet.widgets.celleditors/src/org/eclipse/modisco/facet/widgets/celleditors/internal/core/NaryAttributeCellEditor.java
@@ -0,0 +1,54 @@ +/******************************************************************************* + * Copyright (c) 2010, 2011 CEA LIST. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Nicolas Bros (Mia-Software) - initial API and implementation + * Nicolas Bros (Mia-Software) - Bug 339664 - org.eclipse.emf.facet.widgets.celleditors API cleaning + * Nicolas Guyomar (Mia-Software) - Bug 342451 - To be able to edit derived facet attributes and derived facet references in a table + *******************************************************************************/ +package org.eclipse.modisco.facet.widgets.celleditors.internal.core; + +import java.util.List; + +import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.ecore.EStructuralFeature; +import org.eclipse.modisco.facet.widgets.celleditors.IModelCellEditHandler; +import org.eclipse.modisco.facet.widgets.celleditors.INaryEAttributeCellEditor; +import org.eclipse.modisco.facet.widgets.celleditors.internal.ui.NaryAttributeEditingDialog; +import org.eclipse.swt.SWT; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Control; + +public class NaryAttributeCellEditor<T extends Object> implements INaryEAttributeCellEditor<T> { + + private NaryAttributeEditingDialog<T> naryAttributeEditingDialog; + + public Control activateCell(final Composite parent, final List<T> values, + final IModelCellEditHandler editHandler, final EObject eObject, + final EStructuralFeature feature) { + final Composite placeholderComposite = new Composite(parent, SWT.NONE); + this.naryAttributeEditingDialog = new NaryAttributeEditingDialog<T>(parent.getShell(), + values, editHandler, eObject, feature) { + @Override + public boolean close() { + placeholderComposite.dispose(); + return super.close(); + } + }; + this.naryAttributeEditingDialog.open(); + + return placeholderComposite; + } + + public List<T> getValue() { + if (this.naryAttributeEditingDialog != null) { + return this.naryAttributeEditingDialog.getValue(); + } + return null; + } +}
diff --git a/org.eclipse.modisco.facet.widgets.celleditors/src/org/eclipse/modisco/facet/widgets/celleditors/internal/core/NaryReferenceCellEditor.java b/org.eclipse.modisco.facet.widgets.celleditors/src/org/eclipse/modisco/facet/widgets/celleditors/internal/core/NaryReferenceCellEditor.java new file mode 100644 index 0000000..285f68e --- /dev/null +++ b/org.eclipse.modisco.facet.widgets.celleditors/src/org/eclipse/modisco/facet/widgets/celleditors/internal/core/NaryReferenceCellEditor.java
@@ -0,0 +1,55 @@ +/******************************************************************************* + * Copyright (c) 2010, 2011 CEA LIST. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Nicolas Bros (Mia-Software) - initial API and implementation + * Nicolas Bros (Mia-Software) - Bug 339664 - org.eclipse.emf.facet.widgets.celleditors API cleaning + * Nicolas Guyomar (Mia-Software) - Bug 342451 - To be able to edit derived facet attributes and derived facet references in a table + *******************************************************************************/ +package org.eclipse.modisco.facet.widgets.celleditors.internal.core; + +import java.util.List; + +import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.ecore.EStructuralFeature; +import org.eclipse.modisco.facet.widgets.celleditors.IModelCellEditHandler; +import org.eclipse.modisco.facet.widgets.celleditors.INaryEReferenceCellEditor; +import org.eclipse.modisco.facet.widgets.celleditors.internal.ui.NaryReferenceEditingDialog; +import org.eclipse.swt.SWT; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Control; + +public class NaryReferenceCellEditor<T extends EObject> implements INaryEReferenceCellEditor<T> { + + private NaryReferenceEditingDialog<T> naryReferenceEditingDialog; + + public Control activateCell(final Composite parent, final List<T> values, + final List<T> availableValues, final IModelCellEditHandler editHandler, + final EObject eObject, final EStructuralFeature feature) { + final Composite placeholderComposite = new Composite(parent, SWT.NONE); + this.naryReferenceEditingDialog = new NaryReferenceEditingDialog<T>(parent.getShell(), + values, availableValues, editHandler, eObject, feature) { + @Override + public boolean close() { + placeholderComposite.dispose(); + return super.close(); + } + }; + this.naryReferenceEditingDialog.open(); + + return placeholderComposite; + } + + public List<T> getValue() { + if (this.naryReferenceEditingDialog != null) { + return this.naryReferenceEditingDialog.getValue(); + } + return null; + } + +}
diff --git a/org.eclipse.modisco.facet.widgets.celleditors/src/org/eclipse/modisco/facet/widgets/celleditors/internal/core/UnaryReferenceCellEditor.java b/org.eclipse.modisco.facet.widgets.celleditors/src/org/eclipse/modisco/facet/widgets/celleditors/internal/core/UnaryReferenceCellEditor.java new file mode 100644 index 0000000..dfc5922 --- /dev/null +++ b/org.eclipse.modisco.facet.widgets.celleditors/src/org/eclipse/modisco/facet/widgets/celleditors/internal/core/UnaryReferenceCellEditor.java
@@ -0,0 +1,53 @@ +/***************************************************************************** + * Copyright (c) 2010 CEA LIST. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Nicolas Bros (Mia-Software) - initial API and implementation + * Nicolas Bros (Mia-Software) - Bug 339664 - org.eclipse.emf.facet.widgets.celleditors API cleaning + * Nicolas Bros (Mia-Software) - Bug 334539 - [celleditors] change listener + * Gregoire Dupe (Mia-Software) - Bug 369987 - [Restructuring][Table] Switch to the new customization and facet framework + *****************************************************************************/ +package org.eclipse.modisco.facet.widgets.celleditors.internal.core; + +import java.util.List; + +import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.ecore.EStructuralFeature; +import org.eclipse.modisco.facet.util.emf.core.ModelUtils; +import org.eclipse.modisco.facet.widgets.celleditors.IListener; +import org.eclipse.modisco.facet.widgets.celleditors.IModelCellEditHandler; +import org.eclipse.modisco.facet.widgets.celleditors.IModelCellEditor; +import org.eclipse.modisco.facet.widgets.celleditors.internal.core.composite.UnaryReferenceCellEditorComposite; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Control; + +/** A cell editor for unary references */ +public class UnaryReferenceCellEditor implements IModelCellEditor { + + private UnaryReferenceCellEditorComposite cellEditorComposite; + + public Control activateCell(final Composite parent, final Object originalValue, + final IModelCellEditHandler editHandler, final EStructuralFeature feature, + final EObject source) { + + List<EObject> list = ModelUtils.computeAssignableElements(feature, source); + + this.cellEditorComposite = new UnaryReferenceCellEditorComposite(parent, list); + this.cellEditorComposite.addCommitListener(new IListener() { + public void handleEvent() { + editHandler.commit(); + } + }); + + return this.cellEditorComposite; + } + + public Object getValue() { + return this.cellEditorComposite.getValue(); + } +}
diff --git a/org.eclipse.modisco.facet.widgets.celleditors/src/org/eclipse/modisco/facet/widgets/celleditors/internal/core/composite/AbstractIResourceComposite.java b/org.eclipse.modisco.facet.widgets.celleditors/src/org/eclipse/modisco/facet/widgets/celleditors/internal/core/composite/AbstractIResourceComposite.java new file mode 100644 index 0000000..ee35644 --- /dev/null +++ b/org.eclipse.modisco.facet.widgets.celleditors/src/org/eclipse/modisco/facet/widgets/celleditors/internal/core/composite/AbstractIResourceComposite.java
@@ -0,0 +1,149 @@ +/******************************************************************************* + * Copyright (c) 2011 Mia-Software. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Nicolas Bros (Mia-Software) - initial API and implementation + * Nicolas Guyomar (Mia-Software) - Bug 334546 - [celleditors] no border on Text field + * Nicolas Bros (Mia-Software) - Bug 339664 - org.eclipse.emf.facet.widgets.celleditors API cleaning + * Nicolas Bros (Mia-Software) - Bug 334539 - [celleditors] change listener + *******************************************************************************/ +package org.eclipse.modisco.facet.widgets.celleditors.internal.core.composite; + +import org.eclipse.core.resources.IResource; +import org.eclipse.modisco.facet.widgets.celleditors.AbstractCellEditorComposite; +import org.eclipse.swt.SWT; +import org.eclipse.swt.events.DisposeEvent; +import org.eclipse.swt.events.DisposeListener; +import org.eclipse.swt.events.KeyAdapter; +import org.eclipse.swt.events.KeyEvent; +import org.eclipse.swt.events.ModifyEvent; +import org.eclipse.swt.events.ModifyListener; +import org.eclipse.swt.events.SelectionAdapter; +import org.eclipse.swt.events.SelectionEvent; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.widgets.Button; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Control; +import org.eclipse.swt.widgets.Display; +import org.eclipse.swt.widgets.Event; +import org.eclipse.swt.widgets.Listener; +import org.eclipse.swt.widgets.Text; + +public abstract class AbstractIResourceComposite<T extends IResource> extends + AbstractCellEditorComposite<T> { + + /** the control that is used to edit the contents of the cell */ + private final Button button; + private Text text = null; + + private final Composite parentControl; + + public AbstractIResourceComposite(final Composite parent) { + this(parent, SWT.NONE); + } + + public AbstractIResourceComposite(final Composite parent, final int style) { + super(parent); + this.parentControl = parent; + + GridLayout gd = new GridLayout(2, false); + gd.marginHeight = 0; + gd.marginWidth = 0; + gd.horizontalSpacing = 0; + setLayout(gd); + + this.text = new Text(this, style); + this.text.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false)); + this.button = new Button(this, SWT.PUSH); + this.button.setText("..."); //$NON-NLS-1$ + GridData data = new GridData(SWT.FILL, SWT.FILL, false, true); + this.button.setLayoutData(data); + + this.button.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(final SelectionEvent e) { + browseResource(); + } + }); + + // commit the cell editor when the mouse is clicked + // anywhere outside the text field + final Listener clickListener = new Listener() { + public void handleEvent(final Event event) { + if (event.widget instanceof Control) { + Control control = (Control) event.widget; + if (control.getShell() == getParentControl().getShell()) { + if (event.widget != getButton() && event.widget != getText()) { + fireCommit(); + } + } + } + } + }; + Display.getDefault().addFilter(SWT.MouseDown, clickListener); + + // this listener is only here to remove + // the other listener from the Display + this.text.addDisposeListener(new DisposeListener() { + public void widgetDisposed(final DisposeEvent e) { + Display.getDefault().removeFilter(SWT.MouseDown, clickListener); + } + }); + + this.text.addKeyListener(new KeyAdapter() { + @Override + public void keyPressed(final KeyEvent event) { + // Enter key pressed + if ((event.keyCode == SWT.CR && event.stateMask == 0) + || (event.keyCode == SWT.KEYPAD_CR && event.stateMask == 0)) { + fireCommit(); + } else if (event.keyCode == SWT.ESC && event.stateMask == 0) { + // Escape key pressed + close(); + } + } + }); + + this.text.addModifyListener(new ModifyListener() { + public void modifyText(final ModifyEvent e) { + fireChanged(); + } + }); + + this.text.forceFocus(); + } + + protected Button getButton() { + return this.button; + } + + protected Text getText() { + return this.text; + } + + protected void commit() { + fireCommit(); + } + + protected Composite getParentControl() { + return this.parentControl; + } + + public void setValue(final IResource value) { + if (value != null) { + this.text.setText(value.getFullPath().toString()); + } else { + this.text.setText(""); //$NON-NLS-1$ + } + } + + public abstract T getValue(); + + protected abstract void browseResource(); + +}
diff --git a/org.eclipse.modisco.facet.widgets.celleditors/src/org/eclipse/modisco/facet/widgets/celleditors/internal/core/composite/CoreIFileComposite.java b/org.eclipse.modisco.facet.widgets.celleditors/src/org/eclipse/modisco/facet/widgets/celleditors/internal/core/composite/CoreIFileComposite.java new file mode 100644 index 0000000..b0fe9db --- /dev/null +++ b/org.eclipse.modisco.facet.widgets.celleditors/src/org/eclipse/modisco/facet/widgets/celleditors/internal/core/composite/CoreIFileComposite.java
@@ -0,0 +1,75 @@ +/******************************************************************************* + * Copyright (c) 2011 Mia-Software. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Nicolas Bros (Mia-Software) - initial API and implementation + * Nicolas Guyomar (Mia-Software) - Bug 334546 - [celleditors] no border on Text field + * Nicolas Bros (Mia-Software) - Bug 338437 - compositeEditors extension point cannot be used to register user types + * Nicolas Bros (Mia-Software) - Bug 339664 - org.eclipse.emf.facet.widgets.celleditors API cleaning + *******************************************************************************/ +package org.eclipse.modisco.facet.widgets.celleditors.internal.core.composite; + +import org.eclipse.core.resources.IFile; +import org.eclipse.core.resources.IResource; +import org.eclipse.core.resources.ResourcesPlugin; +import org.eclipse.core.runtime.IStatus; +import org.eclipse.core.runtime.Status; +import org.eclipse.modisco.facet.widgets.celleditors.internal.Activator; +import org.eclipse.modisco.facet.widgets.celleditors.internal.Messages; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.ui.dialogs.ElementTreeSelectionDialog; +import org.eclipse.ui.dialogs.ISelectionStatusValidator; +import org.eclipse.ui.model.WorkbenchContentProvider; +import org.eclipse.ui.model.WorkbenchLabelProvider; + +public class CoreIFileComposite extends AbstractIResourceComposite<IFile> { + + public CoreIFileComposite(final Composite parent) { + super(parent); + } + + public CoreIFileComposite(final Composite parent, final int style) { + super(parent, style); + } + + @Override + public IFile getValue() { + IResource member = ResourcesPlugin.getWorkspace().getRoot().findMember(getText().getText()); + if (member instanceof IFile) { + IFile file = (IFile) member; + return file; + } + return null; + } + + @Override + protected final void browseResource() { + ElementTreeSelectionDialog elementTreeSelectionDialog = new ElementTreeSelectionDialog( + getShell(), new WorkbenchLabelProvider(), new WorkbenchContentProvider()); + elementTreeSelectionDialog.setInput(ResourcesPlugin.getWorkspace().getRoot()); + elementTreeSelectionDialog.setMessage(Messages.CoreIFileComposite_selectFile); + elementTreeSelectionDialog.setAllowMultiple(false); + elementTreeSelectionDialog.setDoubleClickSelects(true); + elementTreeSelectionDialog.setValidator(new ISelectionStatusValidator() { + public IStatus validate(final Object[] selection) { + if (selection.length != 1 || !(selection[0] instanceof IFile)) { + return new Status(IStatus.ERROR, Activator.PLUGIN_ID, Messages.CoreIFileComposite_mustSelectFile); + } + return Status.OK_STATUS; + } + }); + elementTreeSelectionDialog.open(); + Object result = elementTreeSelectionDialog.getFirstResult(); + + if (result != null && result instanceof IFile) { + IFile selectedFile = (IFile) result; + setValue(selectedFile); + fireCommit(); + } + } + +}
diff --git a/org.eclipse.modisco.facet.widgets.celleditors/src/org/eclipse/modisco/facet/widgets/celleditors/internal/core/composite/CoreIProjectComposite.java b/org.eclipse.modisco.facet.widgets.celleditors/src/org/eclipse/modisco/facet/widgets/celleditors/internal/core/composite/CoreIProjectComposite.java new file mode 100644 index 0000000..7201364 --- /dev/null +++ b/org.eclipse.modisco.facet.widgets.celleditors/src/org/eclipse/modisco/facet/widgets/celleditors/internal/core/composite/CoreIProjectComposite.java
@@ -0,0 +1,77 @@ +/******************************************************************************* + * Copyright (c) 2011 Mia-Software. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Nicolas Bros (Mia-Software) - Bug 342548 - [Java Discovery] Illegal parameter initializer for ELEMENTS_TO_ANALYZE + *******************************************************************************/ +package org.eclipse.modisco.facet.widgets.celleditors.internal.core.composite; + +import org.eclipse.core.resources.IProject; +import org.eclipse.core.resources.IResource; +import org.eclipse.core.resources.IWorkspace; +import org.eclipse.core.resources.ResourcesPlugin; +import org.eclipse.jface.window.Window; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.ui.dialogs.ListDialog; +import org.eclipse.ui.model.WorkbenchContentProvider; +import org.eclipse.ui.model.WorkbenchLabelProvider; + +public class CoreIProjectComposite extends AbstractIResourceComposite<IProject> { + + public CoreIProjectComposite(final Composite parent) { + super(parent); + } + + public CoreIProjectComposite(final Composite parent, final int style) { + super(parent, style); + } + + @Override + public IProject getValue() { + IResource member = ResourcesPlugin.getWorkspace().getRoot().findMember(getText().getText()); + if (member instanceof IProject) { + return (IProject) member; + } + return null; + } + + @Override + protected final void browseResource() { + + WorkbenchContentProvider projectsContentProvider = new WorkbenchContentProvider() { + @Override + public Object[] getChildren(final Object element) { + if (!(element instanceof IWorkspace)) { + return new Object[0]; + } + IProject[] projects = ((IWorkspace) element).getRoot().getProjects(); + if (projects == null) { + return new Object[0]; + } + return projects; + } + }; + + ListDialog dialog = new ListDialog(getShell()); + dialog.setContentProvider(projectsContentProvider); + dialog.setLabelProvider(new WorkbenchLabelProvider()); + dialog.setInput(ResourcesPlugin.getWorkspace()); + // TODO: externalize string + dialog.setMessage("Please select a project"); //$NON-NLS-1$ + // TODO: externalize string + dialog.setTitle("Select Project"); //$NON-NLS-1$ + int code = dialog.open(); + if (code == Window.OK) { + Object[] result = dialog.getResult(); + if (result.length == 1) { + IProject selectedProject = (IProject) result[0]; + setValue(selectedProject); + fireCommit(); + } + } + } +}
diff --git a/org.eclipse.modisco.facet.widgets.celleditors/src/org/eclipse/modisco/facet/widgets/celleditors/internal/core/composite/CoreIResourceComposite.java b/org.eclipse.modisco.facet.widgets.celleditors/src/org/eclipse/modisco/facet/widgets/celleditors/internal/core/composite/CoreIResourceComposite.java new file mode 100644 index 0000000..4e0c69e --- /dev/null +++ b/org.eclipse.modisco.facet.widgets.celleditors/src/org/eclipse/modisco/facet/widgets/celleditors/internal/core/composite/CoreIResourceComposite.java
@@ -0,0 +1,55 @@ +/******************************************************************************* + * Copyright (c) 2011 Mia-Software. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Nicolas Bros (Mia-Software) - initial API and implementation + * Nicolas Guyomar (Mia-Software) - Bug 334546 - [celleditors] no border on Text field + * Nicolas Bros (Mia-Software) - Bug 339664 - org.eclipse.emf.facet.widgets.celleditors API cleaning + *******************************************************************************/ +package org.eclipse.modisco.facet.widgets.celleditors.internal.core.composite; + +import org.eclipse.core.resources.IResource; +import org.eclipse.core.resources.ResourcesPlugin; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.ui.dialogs.ElementTreeSelectionDialog; +import org.eclipse.ui.model.WorkbenchContentProvider; +import org.eclipse.ui.model.WorkbenchLabelProvider; + +public class CoreIResourceComposite extends AbstractIResourceComposite<IResource> { + + public CoreIResourceComposite(final Composite parent) { + super(parent); + } + + public CoreIResourceComposite(final Composite parent, final int style) { + super(parent, style); + } + + @Override + public IResource getValue() { + return ResourcesPlugin.getWorkspace().getRoot().findMember(getText().getText()); + } + + @Override + protected final void browseResource() { + ElementTreeSelectionDialog elementTreeSelectionDialog = new ElementTreeSelectionDialog( + getShell(), new WorkbenchLabelProvider(), new WorkbenchContentProvider()); + elementTreeSelectionDialog.setInput(ResourcesPlugin.getWorkspace().getRoot()); + elementTreeSelectionDialog.setMessage("Select a resource"); //$NON-NLS-1$ + elementTreeSelectionDialog.setAllowMultiple(false); + elementTreeSelectionDialog.setDoubleClickSelects(true); + elementTreeSelectionDialog.open(); + Object result = elementTreeSelectionDialog.getFirstResult(); + + if (result != null && result instanceof IResource) { + IResource selectedResource = (IResource) result; + setValue(selectedResource); + fireCommit(); + } + } + +}
diff --git a/org.eclipse.modisco.facet.widgets.celleditors/src/org/eclipse/modisco/facet/widgets/celleditors/internal/core/composite/EnumComposite.java b/org.eclipse.modisco.facet.widgets.celleditors/src/org/eclipse/modisco/facet/widgets/celleditors/internal/core/composite/EnumComposite.java new file mode 100644 index 0000000..105a3b9 --- /dev/null +++ b/org.eclipse.modisco.facet.widgets.celleditors/src/org/eclipse/modisco/facet/widgets/celleditors/internal/core/composite/EnumComposite.java
@@ -0,0 +1,133 @@ +/***************************************************************************** + * Copyright (c) 2010 CEA LIST. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Gregoire Dupe (Mia-Software) - initial API and implementation + * Nicolas Bros (Mia-Software) - Bug 339664 - org.eclipse.emf.facet.widgets.celleditors API cleaning + * Nicolas Bros (Mia-Software) - Bug 334539 - [celleditors] change listener + * Gregoire Dupe (Mia-Software) - Bug 344563 - NPE with Enum Editor + * Nicolas Guyomar (Mia-Software) - Bug 344563 - NPE with Enum Editor + *****************************************************************************/ +package org.eclipse.modisco.facet.widgets.celleditors.internal.core.composite; + +import org.eclipse.modisco.facet.util.core.Logger; +import org.eclipse.modisco.facet.widgets.celleditors.AbstractCellEditorComposite; +import org.eclipse.modisco.facet.widgets.celleditors.internal.Activator; +import org.eclipse.swt.SWT; +import org.eclipse.swt.events.DisposeEvent; +import org.eclipse.swt.events.DisposeListener; +import org.eclipse.swt.events.KeyAdapter; +import org.eclipse.swt.events.KeyEvent; +import org.eclipse.swt.events.SelectionAdapter; +import org.eclipse.swt.events.SelectionEvent; +import org.eclipse.swt.layout.FillLayout; +import org.eclipse.swt.widgets.Combo; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Control; +import org.eclipse.swt.widgets.Display; +import org.eclipse.swt.widgets.Event; +import org.eclipse.swt.widgets.Listener; + +public abstract class EnumComposite<T> extends AbstractCellEditorComposite<T> { + + /** the control that is used to edit the contents of the cell */ + private Combo combo = null; + + private final Composite parentControl; + + private T lastValue; + + public EnumComposite(final Composite parent) { + super(parent); + setLayout(new FillLayout()); + this.parentControl = parent; + this.combo = new Combo(this, SWT.NONE); + final Listener clickListener = new Listener() { + public void handleEvent(final Event event) { + if (event.widget instanceof Control) { + Control control = (Control) event.widget; + if (control.getShell() == EnumComposite.this.getParentControl().getShell()) { + if (event.widget != EnumComposite.this.getCombo()) { + EnumComposite.this.commit(); + } + } + } + } + }; + + this.combo.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(final SelectionEvent e) { + fireChanged(); + } + }); + + this.combo.addKeyListener(new KeyAdapter() { + @Override + public void keyPressed(final KeyEvent event) { + // Enter key pressed + if ((event.keyCode == SWT.CR && event.stateMask == 0) + || (event.keyCode == SWT.KEYPAD_CR && event.stateMask == 0)) { + commit(); + } else if (event.keyCode == SWT.ESC && event.stateMask == 0) { + // Escape key pressed + close(); + } + } + }); + + Display.getDefault().addFilter(SWT.MouseDown, clickListener); + // this listener is only here to remove + // the other listener from the Display + addDisposeListener(new DisposeListener() { + public void widgetDisposed(final DisposeEvent e) { + Display.getDefault().removeFilter(SWT.MouseDown, clickListener); + } + }); + + this.combo.forceFocus(); + } + + protected void commit() { + fireCommit(); + } + + public void setValue(final T value) { + this.lastValue = value; + if (value == null) { + this.combo.setText(""); //$NON-NLS-1$ + } else { + String strValue = getEnumString(value); + this.combo.setText(strValue); + } + } + + public T getValue() { + try { + this.lastValue = this.getEnumValue(this.combo.getText()); + } catch (Exception e) { + Logger.logError(e, Activator.getDefault()); + } + return this.lastValue; + } + + protected abstract T getEnumValue(String text); + + protected abstract String getEnumString(T value); + + protected abstract String[] getEnumStrings(); + + public Combo getCombo() { + return this.combo; + } + + protected Composite getParentControl() { + return this.parentControl; + } + +}
diff --git a/org.eclipse.modisco.facet.widgets.celleditors/src/org/eclipse/modisco/facet/widgets/celleditors/internal/core/composite/EnumeratorComposite.java b/org.eclipse.modisco.facet.widgets.celleditors/src/org/eclipse/modisco/facet/widgets/celleditors/internal/core/composite/EnumeratorComposite.java new file mode 100644 index 0000000..45b2638 --- /dev/null +++ b/org.eclipse.modisco.facet.widgets.celleditors/src/org/eclipse/modisco/facet/widgets/celleditors/internal/core/composite/EnumeratorComposite.java
@@ -0,0 +1,67 @@ +/***************************************************************************** + * Copyright (c) 2010 CEA LIST. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Gregoire Dupe (Mia-Software) - initial API and implementation + * Nicolas Bros (Mia-Software) - Bug 339664 - org.eclipse.emf.facet.widgets.celleditors API cleaning + * Gregoire Dupe (Mia-Software) - Bug 344563 - NPE with Enum Editor + *****************************************************************************/ +package org.eclipse.modisco.facet.widgets.celleditors.internal.core.composite; + +import java.util.ArrayList; +import java.util.List; + +import org.eclipse.emf.common.util.Enumerator; +import org.eclipse.emf.ecore.EEnum; +import org.eclipse.emf.ecore.EEnumLiteral; +import org.eclipse.swt.widgets.Composite; + +public class EnumeratorComposite<T extends Enumerator> extends EnumComposite<T> { + + public EnumeratorComposite(final Composite parent) { + super(parent); + + } + + private EEnum eenum = null; + + public void setEEnum(final EEnum eenum2) { + this.eenum = eenum2; + getCombo().setItems(getEnumStrings()); + } + + @SuppressWarnings("unchecked") + @Override + protected T getEnumValue(final String text) { + if (this.eenum.getEEnumLiteralByLiteral(text) == null) { + throw new RuntimeException("Invalid enumeration literal"); //$NON-NLS-1$ + } + Object result = this.eenum.getEPackage().getEFactoryInstance() + .createFromString(this.eenum, this.eenum.getEEnumLiteralByLiteral(text).getName()); + if (result instanceof Enumerator) { + return (T) result; + } + return null; + } + + @Override + public String getEnumString(final T value) { + return value.getLiteral(); + } + + @Override + protected String[] getEnumStrings() { + List<String> result = new ArrayList<String>(); + if (this.eenum != null) { + for (EEnumLiteral eeNumLiteral : this.eenum.getELiterals()) { + result.add(eeNumLiteral.getLiteral()); + } + } + return result.toArray(new String[] {}); + } +}
diff --git a/org.eclipse.modisco.facet.widgets.celleditors/src/org/eclipse/modisco/facet/widgets/celleditors/internal/core/composite/UnaryReferenceCellEditorComposite.java b/org.eclipse.modisco.facet.widgets.celleditors/src/org/eclipse/modisco/facet/widgets/celleditors/internal/core/composite/UnaryReferenceCellEditorComposite.java new file mode 100644 index 0000000..3662097 --- /dev/null +++ b/org.eclipse.modisco.facet.widgets.celleditors/src/org/eclipse/modisco/facet/widgets/celleditors/internal/core/composite/UnaryReferenceCellEditorComposite.java
@@ -0,0 +1,251 @@ +/***************************************************************************** + * Copyright (c) 2010 CEA LIST. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Nicolas Bros (Mia-Software) - initial API and implementation + * Nicolas Guyomar (Mia-Software) - initial API and implementation + * Nicolas Bros (Mia-Software) - Bug 339664 - org.eclipse.emf.facet.widgets.celleditors API cleaning + * Nicolas Bros (Mia-Software) - Bug 334539 - [celleditors] change listener + * Grégoire Dupé (Mia-Software) - Bug 424122 - [Table] Images, fonts and colors are not shared between the instances of table + *****************************************************************************/ +package org.eclipse.modisco.facet.widgets.celleditors.internal.core.composite; + +import java.util.Collection; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; +import java.util.Set; +import java.util.TreeMap; + +import org.eclipse.emf.ecore.EObject; +import org.eclipse.jface.dialogs.MessageDialog; +import org.eclipse.jface.fieldassist.ComboContentAdapter; +import org.eclipse.jface.fieldassist.ContentProposalAdapter; +import org.eclipse.jface.fieldassist.SimpleContentProposalProvider; +import org.eclipse.modisco.facet.util.swt.fontprovider.IFontProvider; +import org.eclipse.modisco.facet.util.swt.fontprovider.IFontProviderFactory; +import org.eclipse.modisco.facet.widgets.celleditors.AbstractCellEditorComposite; +import org.eclipse.modisco.facet.widgets.celleditors.internal.Messages; +import org.eclipse.modisco.facet.widgets.internal.CustomizableLabelProvider; +import org.eclipse.swt.SWT; +import org.eclipse.swt.events.DisposeEvent; +import org.eclipse.swt.events.DisposeListener; +import org.eclipse.swt.events.KeyAdapter; +import org.eclipse.swt.events.KeyEvent; +import org.eclipse.swt.events.ModifyEvent; +import org.eclipse.swt.events.ModifyListener; +import org.eclipse.swt.events.SelectionAdapter; +import org.eclipse.swt.events.SelectionEvent; +import org.eclipse.swt.graphics.Font; +import org.eclipse.swt.graphics.FontData; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.widgets.Button; +import org.eclipse.swt.widgets.Combo; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Control; +import org.eclipse.swt.widgets.Display; +import org.eclipse.swt.widgets.Event; +import org.eclipse.swt.widgets.Listener; +import org.eclipse.ui.dialogs.ElementListSelectionDialog; + +/** A cell editor for unary references */ +public class UnaryReferenceCellEditorComposite extends AbstractCellEditorComposite<EObject> { + + private static final int GRID_DATA_HEIGHT = 50; + private final Button button; + private final Combo combo; + private final Control parentControl; + private final Map<String, EObject> fElements = new TreeMap<String, EObject>(); + + /** + * @param parent + * the parent composite + * @param eObjects + * the possible choices + */ + public UnaryReferenceCellEditorComposite(final Composite parent, final List<EObject> eObjects) { + super(parent); + this.parentControl = parent; + + CustomizableLabelProvider customizableLabelProvider = new CustomizableLabelProvider(); + for (EObject eObject : eObjects) { + String label = customizableLabelProvider.getText(eObject); + // find a unique label + if (this.fElements.get(label) != null) { + int suffix = 2; + while (this.fElements.get(label + " (" + suffix + ")") != null) { //$NON-NLS-1$ //$NON-NLS-2$ + suffix++; + } + this.fElements.put(label + " (" + suffix + ")", eObject); //$NON-NLS-1$//$NON-NLS-2$ + } else { + this.fElements.put(label, eObject); + } + } + + GridLayout compositeLayout = new GridLayout(2, false); + compositeLayout.marginHeight = 0; + compositeLayout.marginWidth = 0; + compositeLayout.horizontalSpacing = 0; + setLayout(compositeLayout); + + this.combo = new Combo(this, SWT.DROP_DOWN); + // reduce the font so that the Combo fits in the cell + FontData[] fontData = Display.getDefault().getSystemFont().getFontData(); + fontData[0].setHeight(fontData[0].getHeight() - 2); + final IFontProvider fontProvider = IFontProviderFactory.DEFAULT + .getOrCreateIFontProvider(Display.getDefault()); + final Font font = fontProvider.getFont(fontData[0]); + this.combo.setFont(font); + for (String label : this.fElements.keySet()) { + this.combo.add(label); + } + GridData comboGridData = new GridData(SWT.FILL, SWT.FILL, true, true); + this.combo.setLayoutData(comboGridData); + addCompletionHandler(this.combo, this.fElements.keySet()); + + this.combo.addKeyListener(new KeyAdapter() { + @Override + public void keyPressed(final KeyEvent event) { + // Enter key pressed + if ((event.keyCode == SWT.CR && event.stateMask == 0) + || (event.keyCode == SWT.KEYPAD_CR && event.stateMask == 0)) { + if (isValid()) { + commit(); + } else { + MessageDialog.openWarning(parent.getShell(), + Messages.UnaryReferenceCellEditorComposite_0, + Messages.UnaryReferenceCellEditorComposite_1); + } + } else if (event.keyCode == SWT.ESC && event.stateMask == 0) { + // Escape key pressed + close(); + } + } + }); + + this.button = new Button(this, SWT.PUSH); + this.button.setText("..."); //$NON-NLS-1$ + GridData buttonGridData = new GridData(SWT.FILL, SWT.FILL, false, true); + buttonGridData.heightHint = UnaryReferenceCellEditorComposite.GRID_DATA_HEIGHT; + this.button.setLayoutData(buttonGridData); + this.button.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(final SelectionEvent e) { + ElementListSelectionDialog dialog = new ElementListSelectionDialog( + UnaryReferenceCellEditorComposite.this.getParentControl().getShell(), + new CustomizableLabelProvider()) { + @Override + protected void okPressed() { + Object[] selectedElements = getSelectedElements(); + String selectedElementLabel = null; + if (selectedElements.length > 0) { + Set<Entry<String, EObject>> entrySet = UnaryReferenceCellEditorComposite.this + .getfElements().entrySet(); + for (Entry<String, EObject> entry : entrySet) { + if (entry.getValue() == selectedElements[0]) { + selectedElementLabel = entry.getKey(); + break; + } + } + } + UnaryReferenceCellEditorComposite.this.getCombo().setText( + selectedElementLabel); + commit(); + super.okPressed(); + } + }; + dialog.setTitle(Messages.UnaryReferenceCellEditorComposite_2); + dialog.setElements(eObjects.toArray()); + dialog.open(); + } + }); + + // commit the cell editor when the mouse is clicked + // anywhere outside the text field + final Listener clickListener = new Listener() { + public void handleEvent(final Event event) { + if (event.widget instanceof Control) { + Control control = (Control) event.widget; + if (control.getShell() == UnaryReferenceCellEditorComposite.this + .getParentControl().getShell() + && event.widget != UnaryReferenceCellEditorComposite.this.getButton() + && event.widget != UnaryReferenceCellEditorComposite.this.getCombo()) { + if (isValid()) { + commit(); + } + } + } + + } + }; + Display.getDefault().addFilter(SWT.MouseDown, clickListener); + + // this listener is only here to remove + // the other listener from the Display + addDisposeListener(new DisposeListener() { + public void widgetDisposed(final DisposeEvent e) { + Display.getDefault().removeFilter(SWT.MouseDown, clickListener); + } + }); + + this.combo.addModifyListener(new ModifyListener() { + public void modifyText(final ModifyEvent e) { + fireChanged(); + } + }); + + this.combo.forceFocus(); + } + + protected boolean isValid() { + return this.fElements.get(this.combo.getText()) != null; + } + + private static void addCompletionHandler(final Combo comboBox, final Collection<String> completions) { + String[] completionsArray = completions.toArray(new String[completions.size()]); + SimpleContentProposalProvider contentProposalProvider = new SimpleContentProposalProvider( + completionsArray); + contentProposalProvider.setFiltering(true); + ContentProposalAdapter adapter = new ContentProposalAdapter(comboBox, + new ComboContentAdapter(), contentProposalProvider, null, null); + // adapter.setFilterStyle(ContentProposalAdapter.FILTER_CHARACTER); + adapter.setProposalAcceptanceStyle(ContentProposalAdapter.PROPOSAL_REPLACE); + + } + + public EObject getValue() { + EObject eObject = this.fElements.get(this.combo.getText()); + return eObject; + } + + protected void commit() { + fireCommit(); + } + + public void setValue(final EObject value) { + // + } + + protected Button getButton() { + return this.button; + } + + protected Combo getCombo() { + return this.combo; + } + + protected Control getParentControl() { + return this.parentControl; + } + + protected Map<String, EObject> getfElements() { + return this.fElements; + } + +}
diff --git a/org.eclipse.modisco.facet.widgets.celleditors/src/org/eclipse/modisco/facet/widgets/celleditors/internal/core/composite/factories/CoreIFileCompositeFactory.java b/org.eclipse.modisco.facet.widgets.celleditors/src/org/eclipse/modisco/facet/widgets/celleditors/internal/core/composite/factories/CoreIFileCompositeFactory.java new file mode 100644 index 0000000..389a1bd --- /dev/null +++ b/org.eclipse.modisco.facet.widgets.celleditors/src/org/eclipse/modisco/facet/widgets/celleditors/internal/core/composite/factories/CoreIFileCompositeFactory.java
@@ -0,0 +1,30 @@ +/******************************************************************************* + * Copyright (c) 2011 Mia-Software. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Nicolas Bros (Mia-Software) - initial API and implementation + * Nicolas Guyomar (Mia-Software) - Bug 334546 - [celleditors] no border on Text field + * Nicolas Bros (Mia-Software) - Bug 338437 - compositeEditors extension point cannot be used to register user types + *******************************************************************************/ +package org.eclipse.modisco.facet.widgets.celleditors.internal.core.composite.factories; + +import org.eclipse.core.resources.IFile; +import org.eclipse.modisco.facet.widgets.celleditors.AbstractCellEditorComposite; +import org.eclipse.modisco.facet.widgets.celleditors.ICompositeEditorFactory; +import org.eclipse.modisco.facet.widgets.celleditors.internal.core.composite.CoreIFileComposite; +import org.eclipse.swt.widgets.Composite; + +public class CoreIFileCompositeFactory implements ICompositeEditorFactory<IFile> { + + public Class<IFile> getHandledType() { + return IFile.class; + } + + public AbstractCellEditorComposite<IFile> createCompositeEditor(final Composite parent, final int style) { + return new CoreIFileComposite(parent, style); + } +} \ No newline at end of file
diff --git a/org.eclipse.modisco.facet.widgets.celleditors/src/org/eclipse/modisco/facet/widgets/celleditors/internal/core/composite/factories/CoreIProjectCompositeFactory.java b/org.eclipse.modisco.facet.widgets.celleditors/src/org/eclipse/modisco/facet/widgets/celleditors/internal/core/composite/factories/CoreIProjectCompositeFactory.java new file mode 100644 index 0000000..3f62f1b --- /dev/null +++ b/org.eclipse.modisco.facet.widgets.celleditors/src/org/eclipse/modisco/facet/widgets/celleditors/internal/core/composite/factories/CoreIProjectCompositeFactory.java
@@ -0,0 +1,28 @@ +/******************************************************************************* + * Copyright (c) 2011 Mia-Software. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Nicolas Bros (Mia-Software) - Bug 342548 - [Java Discovery] Illegal parameter initializer for ELEMENTS_TO_ANALYZE + *******************************************************************************/ +package org.eclipse.modisco.facet.widgets.celleditors.internal.core.composite.factories; + +import org.eclipse.core.resources.IProject; +import org.eclipse.modisco.facet.widgets.celleditors.AbstractCellEditorComposite; +import org.eclipse.modisco.facet.widgets.celleditors.ICompositeEditorFactory; +import org.eclipse.modisco.facet.widgets.celleditors.internal.core.composite.CoreIProjectComposite; +import org.eclipse.swt.widgets.Composite; + +public class CoreIProjectCompositeFactory implements ICompositeEditorFactory<IProject> { + + public Class<IProject> getHandledType() { + return IProject.class; + } + + public AbstractCellEditorComposite<IProject> createCompositeEditor(final Composite parent, final int style) { + return new CoreIProjectComposite(parent, style); + } +} \ No newline at end of file
diff --git a/org.eclipse.modisco.facet.widgets.celleditors/src/org/eclipse/modisco/facet/widgets/celleditors/internal/core/composite/factories/CoreIResourceCompositeFactory.java b/org.eclipse.modisco.facet.widgets.celleditors/src/org/eclipse/modisco/facet/widgets/celleditors/internal/core/composite/factories/CoreIResourceCompositeFactory.java new file mode 100644 index 0000000..91f2f69 --- /dev/null +++ b/org.eclipse.modisco.facet.widgets.celleditors/src/org/eclipse/modisco/facet/widgets/celleditors/internal/core/composite/factories/CoreIResourceCompositeFactory.java
@@ -0,0 +1,30 @@ +/******************************************************************************* + * Copyright (c) 2011 Mia-Software. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Nicolas Bros (Mia-Software) - initial API and implementation + * Nicolas Guyomar (Mia-Software) - Bug 334546 - [celleditors] no border on Text field + * Nicolas Bros (Mia-Software) - Bug 338437 - compositeEditors extension point cannot be used to register user types + *******************************************************************************/ +package org.eclipse.modisco.facet.widgets.celleditors.internal.core.composite.factories; + +import org.eclipse.core.resources.IResource; +import org.eclipse.modisco.facet.widgets.celleditors.AbstractCellEditorComposite; +import org.eclipse.modisco.facet.widgets.celleditors.ICompositeEditorFactory; +import org.eclipse.modisco.facet.widgets.celleditors.internal.core.composite.CoreIResourceComposite; +import org.eclipse.swt.widgets.Composite; + +public class CoreIResourceCompositeFactory implements ICompositeEditorFactory<IResource> { + public Class<IResource> getHandledType() { + return IResource.class; + } + + public AbstractCellEditorComposite<IResource> createCompositeEditor(final Composite parent, + final int style) { + return new CoreIResourceComposite(parent, style); + } +} \ No newline at end of file
diff --git a/org.eclipse.modisco.facet.widgets.celleditors/src/org/eclipse/emf/facet/widgets/celleditors/internal/messages.properties b/org.eclipse.modisco.facet.widgets.celleditors/src/org/eclipse/modisco/facet/widgets/celleditors/internal/messages.properties similarity index 100% rename from org.eclipse.modisco.facet.widgets.celleditors/src/org/eclipse/emf/facet/widgets/celleditors/internal/messages.properties rename to org.eclipse.modisco.facet.widgets.celleditors/src/org/eclipse/modisco/facet/widgets/celleditors/internal/messages.properties
diff --git a/org.eclipse.modisco.facet.widgets.celleditors/src/org/eclipse/modisco/facet/widgets/celleditors/internal/ui/AbstractNaryEditingDialog.java b/org.eclipse.modisco.facet.widgets.celleditors/src/org/eclipse/modisco/facet/widgets/celleditors/internal/ui/AbstractNaryEditingDialog.java new file mode 100644 index 0000000..0d97be8 --- /dev/null +++ b/org.eclipse.modisco.facet.widgets.celleditors/src/org/eclipse/modisco/facet/widgets/celleditors/internal/ui/AbstractNaryEditingDialog.java
@@ -0,0 +1,139 @@ +/******************************************************************************* + * Copyright (c) 2011 CEA LIST. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Nicolas Guyomar (Mia-Software) - Bug 342451 - To be able to edit derived facet attributes and derived facet references in a table + *******************************************************************************/ +package org.eclipse.modisco.facet.widgets.celleditors.internal.ui; + +import java.util.ArrayList; +import java.util.List; + +import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.ecore.EStructuralFeature; +import org.eclipse.jface.dialogs.Dialog; +import org.eclipse.jface.viewers.ISelection; +import org.eclipse.jface.viewers.IStructuredContentProvider; +import org.eclipse.jface.viewers.IStructuredSelection; +import org.eclipse.jface.viewers.StructuredSelection; +import org.eclipse.jface.viewers.Viewer; +import org.eclipse.modisco.facet.widgets.celleditors.IModelCellEditHandler; +import org.eclipse.swt.widgets.Shell; + +public abstract class AbstractNaryEditingDialog<T extends Object> extends Dialog { + + public static final int AVAILABLE_VALUES_TREE_WIDTH = 200; + public static final int AVAILABLE_VALUES_TREE_HEIGHT = 250; + + private final List<T> values; + private final IModelCellEditHandler editHandler; + private final EObject eObject; + private final EStructuralFeature feature; + + protected AbstractNaryEditingDialog(final Shell shell, final List<T> values, + final IModelCellEditHandler editHandler, final EObject eObject, + final EStructuralFeature feature) { + super(shell); + this.values = new ArrayList<T>(values); + this.feature = feature; + this.editHandler = editHandler; + this.eObject = eObject; + } + + public class AssignedValuesContentProvider implements IStructuredContentProvider { + public Object[] getElements(final Object inputElement) { + if (inputElement instanceof FeatureValuesInput) { + FeatureValuesInput valuesInput = (FeatureValuesInput) inputElement; + EObject source = valuesInput.getSource(); + List<?> list = (List<?>) source.eGet(valuesInput.getFeature()); + if (list == null) { + return new Object[0]; + } + return list.toArray(); + } else if (inputElement instanceof List<?>) { + return ((List<?>) inputElement).toArray(); + } + throw new IllegalArgumentException(FeatureValuesInput.class.getSimpleName() + + " expected"); //$NON-NLS-1$ + } + + public void dispose() { + // + } + + public void inputChanged(final Viewer viewer, final Object oldInput, final Object newInput) { + // + } + } + + public List<T> getValue() { + return this.values; + } + + @SuppressWarnings("unchecked") // type erasure on generic + public void upButtonClicked() { + final IStructuredSelection selection = (IStructuredSelection) getSelection(); + + int minIndex = 0; + for (Object element : selection.toList()) { + final int index = this.values.indexOf(element); + T object = this.values.set(Math.max(index - 1, minIndex++), (T) element); + this.values.set(index, object); + } + refresh(); + } + + @SuppressWarnings("unchecked") // type erasure on generic + public void downButtonClicked() { + final IStructuredSelection selection = (StructuredSelection) getSelection(); + + List<?> selectionList = selection.toList(); + boolean canMove = !selectionList.contains(this.values.get(this.values.size() - 1)); + for (int i = this.values.size() - 2; i >= 0; i--) { + final Object selectedObject = this.values.get(i); + if (selectionList.contains(selectedObject)) { + if (canMove) { + T object = this.values.set(i + 1, (T) selectedObject); + this.values.set(i, object); + } + } else { + canMove = true; + } + + } + + refresh(); + } + + public abstract ISelection getSelection(); + + public abstract void refresh(); + + @Override + protected void okPressed() { + super.okPressed(); + this.editHandler.commit(); + } + + protected List<T> getValues() { + return this.values; + } + + protected IModelCellEditHandler getEditHandler() { + return this.editHandler; + } + + protected EObject geteObject() { + return this.eObject; + } + + protected EStructuralFeature getFeature() { + return this.feature; + } + +}
diff --git a/org.eclipse.modisco.facet.widgets.celleditors/src/org/eclipse/modisco/facet/widgets/celleditors/internal/ui/AssignableValuesContentProvider.java b/org.eclipse.modisco.facet.widgets.celleditors/src/org/eclipse/modisco/facet/widgets/celleditors/internal/ui/AssignableValuesContentProvider.java new file mode 100644 index 0000000..a0a62bd --- /dev/null +++ b/org.eclipse.modisco.facet.widgets.celleditors/src/org/eclipse/modisco/facet/widgets/celleditors/internal/ui/AssignableValuesContentProvider.java
@@ -0,0 +1,82 @@ +/******************************************************************************* + * Copyright (c) 2010, 2011 CEA LIST. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Nicolas Bros (Mia-Software) - initial API and implementation + * Nicolas Guyomar (Mia-Software) - Bug 342451 - To be able to edit derived facet attributes and derived facet references in a table + *******************************************************************************/ +package org.eclipse.modisco.facet.widgets.celleditors.internal.ui; + +import java.util.ArrayList; +import java.util.List; + +import org.eclipse.emf.common.notify.Notifier; +import org.eclipse.emf.common.util.TreeIterator; +import org.eclipse.emf.ecore.EClassifier; +import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.ecore.EStructuralFeature; +import org.eclipse.emf.ecore.resource.Resource; +import org.eclipse.emf.ecore.resource.ResourceSet; +import org.eclipse.jface.viewers.ITreeContentProvider; +import org.eclipse.jface.viewers.Viewer; + +public class AssignableValuesContentProvider implements ITreeContentProvider { + public Object[] getElements(final Object inputElement) { + if (inputElement instanceof FeatureValuesInput) { + FeatureValuesInput assignableValuesInput = (FeatureValuesInput) inputElement; + EStructuralFeature feature = assignableValuesInput.getFeature(); + EClassifier eType = feature.getEType(); + EObject source = assignableValuesInput.getSource(); + List<?> featureValues = (List<?>) source.eGet(feature); + + // build a list of EObjects assignable to the EReference + List<EObject> list = new ArrayList<EObject>(); + Resource eResource = source.eResource(); + if (eResource == null) { + return new Object[0]; + } + ResourceSet resourceSet = eResource.getResourceSet(); + TreeIterator<Notifier> allContents = resourceSet.getAllContents(); + while (allContents.hasNext()) { + Notifier notifier = allContents.next(); + if (notifier instanceof EObject) { + EObject eObject = (EObject) notifier; + if (eType.isInstance(eObject) + && (!feature.isUnique() || !(featureValues != null && featureValues + .contains(eObject)))) { + list.add(eObject); + } + } + } + return list.toArray(); + } else if (inputElement instanceof List<?>) { + return ((List<?>) inputElement).toArray(); + } + throw new IllegalArgumentException(FeatureValuesInput.class.getSimpleName() + " expected"); //$NON-NLS-1$ + } + + public void dispose() { + // + } + + public void inputChanged(final Viewer viewer, final Object oldInput, final Object newInput) { + // + } + + public Object[] getChildren(final Object parentElement) { + return null; + } + + public Object getParent(final Object element) { + return null; + } + + public boolean hasChildren(final Object element) { + return false; + } +} \ No newline at end of file
diff --git a/org.eclipse.modisco.facet.widgets.celleditors/src/org/eclipse/modisco/facet/widgets/celleditors/internal/ui/EditingUtils.java b/org.eclipse.modisco.facet.widgets.celleditors/src/org/eclipse/modisco/facet/widgets/celleditors/internal/ui/EditingUtils.java new file mode 100644 index 0000000..f48acea --- /dev/null +++ b/org.eclipse.modisco.facet.widgets.celleditors/src/org/eclipse/modisco/facet/widgets/celleditors/internal/ui/EditingUtils.java
@@ -0,0 +1,84 @@ +/******************************************************************************* + * Copyright (c) 2010 CEA LIST. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Nicolas Bros (Mia-Software) - initial API and implementation + *******************************************************************************/ +package org.eclipse.modisco.facet.widgets.celleditors.internal.ui; + +import java.util.Collection; +import java.util.List; + +import org.eclipse.emf.common.command.Command; +import org.eclipse.emf.common.command.CompoundCommand; +import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.ecore.EStructuralFeature; +import org.eclipse.emf.edit.domain.EditingDomain; +import org.eclipse.modisco.facet.widgets.celleditors.ICommandFactory; + +public final class EditingUtils { + private EditingUtils() { + // + } + + public static void moveElementsUp(final EObject eObject, final EStructuralFeature feature, + final Collection<Object> elements, final ICommandFactory commandFactory, + final EditingDomain editingDomain) { + CompoundCommand compoundCommand = new CompoundCommand(); + + List<?> list = (List<?>) eObject.eGet(feature); + + int minIndex = 0; + for (Object element : elements) { + final int index = list.indexOf(element); + + Command moveCommand = commandFactory.createMoveCommand(editingDomain, eObject, feature, + element, Math.max(index - 1, minIndex++)); + compoundCommand.append(moveCommand); + } + editingDomain.getCommandStack().execute(compoundCommand); + // int[] selectionIndices; + // Arrays.sort(selectionIndices); + // CompoundCommand compoundCommand = new CompoundCommand(); + // int minIndex = 0; + // for(int index : selectionIndices) { + // Command moveCommand = MoveCommand.create(editingDomain, + // eObject,feature, index, Math.max(index - 1, + // minIndex++)); + // compoundCommand.append(moveCommand); + // } + // editingDomain.getCommandStack().execute(compoundCommand); + } + + public static void moveElementsDown(final EObject eObject, final EStructuralFeature feature, + final Collection<Object> elements, final ICommandFactory commandFactory, + final EditingDomain editingDomain) { + Object value = eObject.eGet(feature); + List<?> list = (List<?>) value; + + CompoundCommand compoundCommand = new CompoundCommand(); + + // prevent the last two elements from swapping + boolean canMove = !elements.contains(list.get(list.size() - 1)); + for (int i = list.size() - 2; i >= 0; i--) { + final Object selectedObject = list.get(i); + if (elements.contains(selectedObject)) { + if (canMove) { + Command moveCommand = commandFactory.createMoveCommand(editingDomain, eObject, + feature, selectedObject, i + 1); + compoundCommand.append(moveCommand); + } + } else { + canMove = true; + } + + } + editingDomain.getCommandStack().execute(compoundCommand); + } + +}
diff --git a/org.eclipse.modisco.facet.widgets.celleditors/src/org/eclipse/modisco/facet/widgets/celleditors/internal/ui/FeatureValuesInput.java b/org.eclipse.modisco.facet.widgets.celleditors/src/org/eclipse/modisco/facet/widgets/celleditors/internal/ui/FeatureValuesInput.java new file mode 100644 index 0000000..4aa2b3a --- /dev/null +++ b/org.eclipse.modisco.facet.widgets.celleditors/src/org/eclipse/modisco/facet/widgets/celleditors/internal/ui/FeatureValuesInput.java
@@ -0,0 +1,33 @@ +/******************************************************************************* + * Copyright (c) 2010 CEA LIST. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Nicolas Bros (Mia-Software) - initial API and implementation + *******************************************************************************/ +package org.eclipse.modisco.facet.widgets.celleditors.internal.ui; + +import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.ecore.EStructuralFeature; + +public class FeatureValuesInput { + private final EStructuralFeature feature; + private final EObject source; + + public FeatureValuesInput(final EStructuralFeature feature, final EObject source) { + this.feature = feature; + this.source = source; + } + + public EStructuralFeature getFeature() { + return this.feature; + } + + public EObject getSource() { + return this.source; + } +} \ No newline at end of file
diff --git a/org.eclipse.modisco.facet.widgets.celleditors/src/org/eclipse/modisco/facet/widgets/celleditors/internal/ui/ModelCellsEditingSupport.java b/org.eclipse.modisco.facet.widgets.celleditors/src/org/eclipse/modisco/facet/widgets/celleditors/internal/ui/ModelCellsEditingSupport.java new file mode 100644 index 0000000..793c647 --- /dev/null +++ b/org.eclipse.modisco.facet.widgets.celleditors/src/org/eclipse/modisco/facet/widgets/celleditors/internal/ui/ModelCellsEditingSupport.java
@@ -0,0 +1,130 @@ +/******************************************************************************* + * Copyright (c) 2010, 2011 CEA LIST. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Nicolas Bros (Mia-Software) - initial API and implementation + * Nicolas Guyomar (Mia-Software) - Bug 339554 - org.eclipse.emf.facet.widgets.celleditors API cleaning + * Nicolas Bros (Mia-Software) - Bug 339855 - ModelCellEditor class should not be exposed + * Nicolas Guyomar (Mia-Software) - Bug 342451 - To be able to edit derived facet attributes and derived facet references in a table + *******************************************************************************/ +package org.eclipse.modisco.facet.widgets.celleditors.internal.ui; + +import java.util.List; + +import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.ecore.EStructuralFeature; +import org.eclipse.jface.viewers.CellEditor; +import org.eclipse.jface.viewers.ColumnViewer; +import org.eclipse.jface.viewers.EditingSupport; +import org.eclipse.modisco.facet.widgets.celleditors.ICellEditorsRegistry; +import org.eclipse.modisco.facet.widgets.celleditors.IModelCellEditHandler; +import org.eclipse.modisco.facet.widgets.celleditors.IModelCellEditor; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Control; + +public class ModelCellsEditingSupport<T> extends EditingSupport { + + private final EStructuralFeature feature; + private final IModelCellEditor cellEditor; + private final EObject eObject; + private final ColumnViewer columnViewer; + private final Object newValuePlaceholder; + private List<T> values; + + public ModelCellsEditingSupport(final ColumnViewer columnViewer, + final EStructuralFeature feature, final EObject eObject, + final Object newValuePlaceholder, final List<T> values) { + super(columnViewer); + this.columnViewer = columnViewer; + this.feature = feature; + this.eObject = eObject; + this.values = values; + this.newValuePlaceholder = newValuePlaceholder; + this.cellEditor = ICellEditorsRegistry.INSTANCE.getCellEditorFor(this.feature.getEType()); + if (this.cellEditor == null) { + throw new IllegalStateException( + "no cell editor found for " + this.feature.getEType().getName()); //$NON-NLS-1$ + } + } + + @Override + protected CellEditor getCellEditor(final Object element) { + return new CellEditor((Composite) this.columnViewer.getControl()) { + + private Control control; + + @Override + protected void doSetValue(final Object value) { + // + } + + @Override + protected void doSetFocus() { + this.control.setFocus(); + } + + @Override + protected Object doGetValue() { + return null; + } + + @Override + protected Control createControl(final Composite parent) { + IModelCellEditHandler editHandler = new IModelCellEditHandler() { + public void commit() { + @SuppressWarnings("unchecked") + //unchecked: The cellEditor.getValue() type cannot be checked. + T value = (T) ModelCellsEditingSupport.this.cellEditor.getValue(); + int index = ModelCellsEditingSupport.this.values.indexOf(element); + if (index != -1 + || element == ModelCellsEditingSupport.this.newValuePlaceholder) { + ModelCellsEditingSupport.this.values.set(index, value); + } + close(); + ModelCellsEditingSupport.this.columnViewer.refresh(); + } + + }; + + Object originalValue = null; + if (element != ModelCellsEditingSupport.this.newValuePlaceholder) { + originalValue = element; + } + + this.control = ModelCellsEditingSupport.this.cellEditor.activateCell(parent, + originalValue, editHandler, ModelCellsEditingSupport.this.feature, + ModelCellsEditingSupport.this.eObject); + return this.control; + } + + public void close() { + deactivate(); + Control parentControl = ModelCellsEditingSupport.this.columnViewer.getControl(); + if (parentControl != null && !parentControl.isDisposed()) { + parentControl.forceFocus(); + } + dispose(); + } + }; + } + + @Override + protected boolean canEdit(final Object element) { + return true; + } + + @Override + protected Object getValue(final Object element) { + return element; + } + + @Override + protected void setValue(final Object element, final Object value) { + // TODO Auto-generated method stub + } +}
diff --git a/org.eclipse.modisco.facet.widgets.celleditors/src/org/eclipse/modisco/facet/widgets/celleditors/internal/ui/NaryAttributeEditingDialog.java b/org.eclipse.modisco.facet.widgets.celleditors/src/org/eclipse/modisco/facet/widgets/celleditors/internal/ui/NaryAttributeEditingDialog.java new file mode 100644 index 0000000..df55637 --- /dev/null +++ b/org.eclipse.modisco.facet.widgets.celleditors/src/org/eclipse/modisco/facet/widgets/celleditors/internal/ui/NaryAttributeEditingDialog.java
@@ -0,0 +1,373 @@ +/******************************************************************************* + * Copyright (c) 2010, 2011 CEA LIST. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Nicolas Bros (Mia-Software) - initial API and implementation + * Nicolas Guyomar (Mia-Software) - Bug 339554 - org.eclipse.emf.facet.widgets.celleditors API cleaning + * Nicolas Guyomar (Mia-Software) - Bug 342451 - To be able to edit derived facet attributes and derived facet references in a table + *******************************************************************************/ +package org.eclipse.modisco.facet.widgets.celleditors.internal.ui; + +import java.util.Iterator; +import java.util.List; + +import org.eclipse.emf.ecore.EAttribute; +import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.ecore.EStructuralFeature; +import org.eclipse.jface.dialogs.IDialogConstants; +import org.eclipse.jface.viewers.ColumnLabelProvider; +import org.eclipse.jface.viewers.IOpenListener; +import org.eclipse.jface.viewers.ISelection; +import org.eclipse.jface.viewers.IStructuredSelection; +import org.eclipse.jface.viewers.LabelProvider; +import org.eclipse.jface.viewers.OpenEvent; +import org.eclipse.jface.viewers.TableViewer; +import org.eclipse.jface.viewers.TableViewerColumn; +import org.eclipse.modisco.facet.widgets.celleditors.IModelCellEditHandler; +import org.eclipse.modisco.facet.widgets.celleditors.internal.Messages; +import org.eclipse.modisco.facet.widgets.internal.CustomizableLabelProvider; +import org.eclipse.osgi.util.NLS; +import org.eclipse.swt.SWT; +import org.eclipse.swt.events.ControlEvent; +import org.eclipse.swt.events.ControlListener; +import org.eclipse.swt.events.KeyAdapter; +import org.eclipse.swt.events.KeyEvent; +import org.eclipse.swt.events.SelectionAdapter; +import org.eclipse.swt.events.SelectionEvent; +import org.eclipse.swt.graphics.Color; +import org.eclipse.swt.graphics.Image; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.widgets.Button; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Control; +import org.eclipse.swt.widgets.Display; +import org.eclipse.swt.widgets.Event; +import org.eclipse.swt.widgets.Label; +import org.eclipse.swt.widgets.Listener; +import org.eclipse.swt.widgets.Shell; +import org.eclipse.swt.widgets.Table; +import org.eclipse.swt.widgets.TableColumn; + +/** A dialog to edit a multiplicity-many {@link EAttribute} */ +public class NaryAttributeEditingDialog<T extends Object> extends AbstractNaryEditingDialog<T> { + + private static final int NUM_COLUMNS = 2; + private TableViewer featureValuesTableViewer; + + private final Object newValuePlaceholder = new Object(); + + private Button addButton; + private Button removeButton; + private Button upButton; + private Button downButton; + + private final ColumnLabelProvider labelProvider = new ColumnLabelProvider() { + private final LabelProvider delegateLabelProvider = new CustomizableLabelProvider(); + + @Override + public Image getImage(final Object element) { + return this.delegateLabelProvider.getImage(element); + } + + @Override + public String getText(final Object element) { + if (element == NaryAttributeEditingDialog.this.newValuePlaceholder) { + return Messages.NaryAttributeEditingDialog_enterNewValuePlaceholder; + } + return this.delegateLabelProvider.getText(element); + } + + @Override + public Color getForeground(final Object element) { + if (element == NaryAttributeEditingDialog.this.newValuePlaceholder) { + return Display.getDefault().getSystemColor(SWT.COLOR_DARK_GRAY); + } + return null; + } + }; + + /** + * @param parent + * the parent {@link Shell} + * @param values + * the current values + * @param editHandler + * the edit handler to perform the commit. + * @param feature + * the feature to edit + * @param eObject + * the eObject being currently edited. Should not be modified in this dialog. + */ + public NaryAttributeEditingDialog(final Shell shell, final List<T> values, + final IModelCellEditHandler editHandler, final EObject eObject, final EStructuralFeature feature) { + super(shell, values, editHandler, eObject, feature); + } + + + @Override + protected void configureShell(final Shell shell) { + super.configureShell(shell); + shell.setText(NLS.bind(Messages.NaryReferenceEditingDialog_shellTitle, + getFeature().getName(), geteObject().eClass().getName())); + // prevent Escape or Enter from closing the dialog + // when a cell editor is active + shell.addListener(SWT.Traverse, new Listener() { + public void handleEvent(final Event e) { + if ((e.detail == SWT.TRAVERSE_ESCAPE || e.detail == SWT.TRAVERSE_RETURN) + && NaryAttributeEditingDialog.this.featureValuesTableViewer + .isCellEditorActive()) { + e.doit = false; + NaryAttributeEditingDialog.this.featureValuesTableViewer.cancelEditing(); + } + } + }); + } + + @Override + protected Control createDialogArea(final Composite parent) { + final Composite contents = (Composite) super.createDialogArea(parent); + + final GridLayout contentsGridLayout = (GridLayout) contents.getLayout(); + contentsGridLayout.numColumns = NaryAttributeEditingDialog.NUM_COLUMNS; + + final GridData contentsGridData = (GridData) contents.getLayoutData(); + contentsGridData.horizontalAlignment = SWT.FILL; + contentsGridData.verticalAlignment = SWT.FILL; + + createValuesPane(contents); + createButtonsPane(contents); + + this.featureValuesTableViewer.addOpenListener(new IOpenListener() { + public void open(final OpenEvent event) { + editSelectedElement(); + } + }); + + this.upButton.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(final SelectionEvent event) { + upButtonClicked(); + } + }); + + this.downButton.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(final SelectionEvent event) { + downButtonClicked(); + } + }); + + this.addButton.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(final SelectionEvent event) { + addButtonClicked(); + } + }); + + this.removeButton.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(final SelectionEvent event) { + removeButtonClicked(); + } + }); + + return contents; + } + + @SuppressWarnings("unchecked") // type erasure on generic + private void addButtonClicked() { + getValues().add(0, (T) NaryAttributeEditingDialog.this.newValuePlaceholder); + refresh(); + this.featureValuesTableViewer.editElement(this.newValuePlaceholder, 0); + } + + @SuppressWarnings("unchecked") // type erasure on generic + private void removeButtonClicked() { + final IStructuredSelection selection = (IStructuredSelection) this.featureValuesTableViewer + .getSelection(); + + for (final Iterator<T> it = selection.iterator(); it.hasNext();) { + final Object element = it.next(); + + if (getValues().contains(element)) { + getValues().remove(element); + } + } + refresh(); + } + + private void spacer(final Composite parent) { + @SuppressWarnings("unused") + Label label = new Label(parent, SWT.NONE); + } + + private void createButtonsPane(final Composite contents) { + final Composite buttonsComposite = new Composite(contents, SWT.NONE); + final GridData buttonsCompositeGridData = new GridData(); + buttonsCompositeGridData.verticalAlignment = SWT.FILL; + buttonsCompositeGridData.horizontalAlignment = SWT.FILL; + buttonsComposite.setLayoutData(buttonsCompositeGridData); + buttonsComposite.setLayout(new GridLayout()); + + // spacer + spacer(buttonsComposite); + + this.addButton = new Button(buttonsComposite, SWT.PUSH); + this.addButton.setText(Messages.NaryAttributeEditingDialog_add); + final GridData addButtonGridData = new GridData(); + addButtonGridData.verticalAlignment = SWT.FILL; + addButtonGridData.horizontalAlignment = SWT.FILL; + this.addButton.setLayoutData(addButtonGridData); + + this.removeButton = new Button(buttonsComposite, SWT.PUSH); + this.removeButton.setText(Messages.NaryAttributeEditingDialog_delete); + final GridData removeButtonGridData = new GridData(); + removeButtonGridData.verticalAlignment = SWT.FILL; + removeButtonGridData.horizontalAlignment = SWT.FILL; + this.removeButton.setLayoutData(removeButtonGridData); + + spacer(buttonsComposite); + + this.upButton = new Button(buttonsComposite, SWT.PUSH); + this.upButton.setText(Messages.NaryReferenceEditingDialog_up); + final GridData upButtonGridData = new GridData(); + upButtonGridData.verticalAlignment = SWT.FILL; + upButtonGridData.horizontalAlignment = SWT.FILL; + this.upButton.setLayoutData(upButtonGridData); + + this.downButton = new Button(buttonsComposite, SWT.PUSH); + this.downButton.setText(Messages.NaryReferenceEditingDialog_down); + final GridData downButtonGridData = new GridData(); + downButtonGridData.verticalAlignment = SWT.FILL; + downButtonGridData.horizontalAlignment = SWT.FILL; + this.downButton.setLayoutData(downButtonGridData); + } + + private void createValuesPane(final Composite contents) { + final Composite featureComposite = new Composite(contents, SWT.NONE); + final GridData featureCompositeData = new GridData(SWT.FILL, SWT.FILL, true, true); + featureCompositeData.horizontalAlignment = SWT.END; + featureComposite.setLayoutData(featureCompositeData); + + final GridLayout featureCompositeLayout = new GridLayout(); + featureCompositeData.horizontalAlignment = SWT.FILL; + featureCompositeLayout.marginHeight = 0; + featureCompositeLayout.marginWidth = 0; + featureCompositeLayout.numColumns = 1; + featureComposite.setLayout(featureCompositeLayout); + + final Label featureLabel = new Label(featureComposite, SWT.NONE); + featureLabel.setText(Messages.NaryReferenceEditingDialog_values); + final GridData valuesLabelGridData = new GridData(); + valuesLabelGridData.horizontalSpan = 2; + valuesLabelGridData.horizontalAlignment = SWT.FILL; + valuesLabelGridData.verticalAlignment = SWT.FILL; + featureLabel.setLayoutData(valuesLabelGridData); + + final Table table = new Table(featureComposite, SWT.MULTI | SWT.BORDER | SWT.FULL_SELECTION); + final GridData tableGridData = new GridData(); + tableGridData.widthHint = AbstractNaryEditingDialog.AVAILABLE_VALUES_TREE_WIDTH; + tableGridData.heightHint = AbstractNaryEditingDialog.AVAILABLE_VALUES_TREE_HEIGHT; + tableGridData.verticalAlignment = SWT.FILL; + tableGridData.horizontalAlignment = SWT.FILL; + tableGridData.grabExcessHorizontalSpace = true; + tableGridData.grabExcessVerticalSpace = true; + table.setLayoutData(tableGridData); + final TableColumn tableColumn = new TableColumn(table, SWT.CENTER); + + // full-width column + table.addControlListener(new ControlListener() { + public void controlResized(final ControlEvent e) { + tableColumn.setWidth(table.getClientArea().width); + } + + public void controlMoved(final ControlEvent e) { + // + } + }); + + this.featureValuesTableViewer = new TableViewer(table); + this.featureValuesTableViewer.setContentProvider(new AssignedValuesContentProvider()); + // this.fFeatureValuesTableViewer.setLabelProvider(this.labelProvider); + this.featureValuesTableViewer + .setInput(getValues()); + + final TableViewerColumn tableViewerColumn = new TableViewerColumn( + this.featureValuesTableViewer, tableColumn); + tableViewerColumn.setLabelProvider(this.labelProvider); + + tableViewerColumn.setEditingSupport(new ModelCellsEditingSupport<T>( + this.featureValuesTableViewer, getFeature(), geteObject(), + this.newValuePlaceholder, getValues())); + + // keyboard accessibility + table.addKeyListener(new KeyAdapter() { + @Override + public void keyPressed(final KeyEvent e) { + if (e.keyCode == SWT.F2) { + editSelectedElement(); + } + if (e.keyCode == SWT.DEL) { + if (NaryAttributeEditingDialog.this.removeButton.isEnabled()) { + NaryAttributeEditingDialog.this.removeButton.notifyListeners( + SWT.Selection, null); + } + } + if (e.keyCode == SWT.ARROW_UP + && ((e.stateMask & SWT.COMMAND) != 0 || (e.stateMask & SWT.CONTROL) != 0)) { + if (NaryAttributeEditingDialog.this.upButton.isEnabled()) { + NaryAttributeEditingDialog.this.upButton.notifyListeners(SWT.Selection, + null); + } + } + if (e.keyCode == SWT.ARROW_DOWN + && ((e.stateMask & SWT.COMMAND) != 0 || (e.stateMask & SWT.CONTROL) != 0)) { + if (NaryAttributeEditingDialog.this.downButton.isEnabled()) { + NaryAttributeEditingDialog.this.downButton.notifyListeners(SWT.Selection, + null); + } + } + } + }); + + } + + private void editSelectedElement() { + ISelection selection = NaryAttributeEditingDialog.this.featureValuesTableViewer + .getSelection(); + if (selection instanceof IStructuredSelection) { + IStructuredSelection structuredSelection = (IStructuredSelection) selection; + if (structuredSelection.getFirstElement() != null) { + NaryAttributeEditingDialog.this.featureValuesTableViewer.editElement( + structuredSelection.getFirstElement(), 0); + } + } + } + + @Override + public void refresh() { + this.featureValuesTableViewer.refresh(); + } + + @Override + protected boolean isResizable() { + return true; + } + + @Override + protected void createButtonsForButtonBar(final Composite parent) { + createButton(parent, IDialogConstants.OK_ID, IDialogConstants.OK_LABEL, true); + } + + + @Override + public ISelection getSelection() { + return this.featureValuesTableViewer.getSelection(); + } +}
diff --git a/org.eclipse.modisco.facet.widgets.celleditors/src/org/eclipse/modisco/facet/widgets/celleditors/internal/ui/NaryReferenceEditingDialog.java b/org.eclipse.modisco.facet.widgets.celleditors/src/org/eclipse/modisco/facet/widgets/celleditors/internal/ui/NaryReferenceEditingDialog.java new file mode 100644 index 0000000..f068427 --- /dev/null +++ b/org.eclipse.modisco.facet.widgets.celleditors/src/org/eclipse/modisco/facet/widgets/celleditors/internal/ui/NaryReferenceEditingDialog.java
@@ -0,0 +1,489 @@ +/******************************************************************************* + * Copyright (c) 2010, 2011 CEA LIST. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Nicolas Bros (Mia-Software) - initial API and implementation + * Nicolas Guyomar (Mia-Software) - Bug 339554 - org.eclipse.emf.facet.widgets.celleditors API cleaning + * Nicolas Guyomar (Mia-Software) - Bug 342451 - To be able to edit derived facet attributes and derived facet references in a table + * Gregoire Dupe (Mia-Software) - Bug 369987 - [Restructuring][Table] Switch to the new customization and facet framework + *******************************************************************************/ +package org.eclipse.modisco.facet.widgets.celleditors.internal.ui; + +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; + +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.EClassifier; +import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.ecore.EReference; +import org.eclipse.emf.ecore.EStructuralFeature; +import org.eclipse.jface.dialogs.IDialogConstants; +import org.eclipse.jface.dialogs.MessageDialog; +import org.eclipse.jface.viewers.IOpenListener; +import org.eclipse.jface.viewers.ISelection; +import org.eclipse.jface.viewers.IStructuredSelection; +import org.eclipse.jface.viewers.ListViewer; +import org.eclipse.jface.viewers.OpenEvent; +import org.eclipse.jface.viewers.TreeViewer; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.FacetReference; +import org.eclipse.modisco.facet.util.emf.ui.internal.dialogs.CreateInstanceDialog; +import org.eclipse.modisco.facet.widgets.celleditors.IModelCellEditHandler; +import org.eclipse.modisco.facet.widgets.celleditors.internal.Messages; +import org.eclipse.modisco.facet.widgets.internal.CustomizableLabelProvider; +import org.eclipse.osgi.util.NLS; +import org.eclipse.swt.SWT; +import org.eclipse.swt.events.ModifyEvent; +import org.eclipse.swt.events.ModifyListener; +import org.eclipse.swt.events.SelectionAdapter; +import org.eclipse.swt.events.SelectionEvent; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.widgets.Button; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Control; +import org.eclipse.swt.widgets.Label; +import org.eclipse.swt.widgets.Shell; +import org.eclipse.swt.widgets.Text; +import org.eclipse.swt.widgets.Tree; +import org.eclipse.ui.dialogs.PatternFilter; + +/** A dialog to edit a multiplicity-many {@link EReference} */ +public class NaryReferenceEditingDialog<T extends EObject> extends AbstractNaryEditingDialog<T> { + + + private Button addButton; + private Button removeButton; + private Button addAllButton; + private Button removeAllButton; + private Button upButton; + private Button downButton; + + private static final int NUM_COLUMNS = 4; + // this is a *tree* viewer because PatternFilter only supports Trees + private TreeViewer availableValuesTreeViewer; + private ListViewer featureValuesListViewer; + private Button createInstanceButton; + + private AssignableValuesContentProvider assignableValuesContentProvider; + private final List<T> availableValues; + + + /** + * + * @param parent + * the parent {@link Shell} + * @param values + * the list of current values. + * @param feature + * the feature to edit + * @param eObject + * the eObject being currently edited. Should not be modified in this dialog. + * @param editHandler + * The editHandler which has to be called when the edition is completed + */ + public NaryReferenceEditingDialog(final Shell shell, final List<T> values, + final List<T> availableValues, final IModelCellEditHandler editHandler, + final EObject eObject, final EStructuralFeature feature) { + super(shell, values, editHandler, eObject, feature); + this.availableValues = new ArrayList<T>(availableValues); + } + + @Override + protected void configureShell(final Shell shell) { + super.configureShell(shell); + shell.setText(NLS.bind(Messages.NaryReferenceEditingDialog_shellTitle, + getFeature().getName(), geteObject().eClass().getName())); + } + + @Override + protected Control createDialogArea(final Composite parent) { + final Composite contents = (Composite) super.createDialogArea(parent); + + final GridLayout contentsGridLayout = (GridLayout) contents.getLayout(); + contentsGridLayout.numColumns = NaryReferenceEditingDialog.NUM_COLUMNS; + + final GridData contentsGridData = (GridData) contents.getLayoutData(); + contentsGridData.horizontalAlignment = SWT.FILL; + contentsGridData.verticalAlignment = SWT.FILL; + + createLeftPane(contents); + createMiddleButtonsPane(contents); + createRightPane(contents); + createRightButtonsPane(contents); + + this.availableValuesTreeViewer.addOpenListener(new IOpenListener() { + public void open(final OpenEvent event) { + if (NaryReferenceEditingDialog.this.addButton.isEnabled()) { + NaryReferenceEditingDialog.this.addButton.notifyListeners(SWT.Selection, null); + } + } + }); + + this.featureValuesListViewer.addOpenListener(new IOpenListener() { + public void open(final OpenEvent event) { + if (NaryReferenceEditingDialog.this.removeButton.isEnabled()) { + NaryReferenceEditingDialog.this.removeButton.notifyListeners(SWT.Selection, + null); + } + } + }); + + this.upButton.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(final SelectionEvent event) { + upButtonClicked(); + } + }); + + this.downButton.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(final SelectionEvent event) { + downButtonClicked(); + } + }); + + this.addButton.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(final SelectionEvent event) { + addButtonClicked(); + } + }); + + this.addAllButton.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(final SelectionEvent event) { + addAllButtonClicked(); + } + }); + + this.removeButton.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(final SelectionEvent event) { + removeButtonClicked(); + } + }); + + this.removeAllButton.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(final SelectionEvent event) { + removeAllButtonClicked(); + } + }); + + if (this.createInstanceButton != null) { + this.createInstanceButton.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(final SelectionEvent event) { + createInstanceButtonClicked(); + } + }); + } + + return contents; + } + + private void addButtonClicked() { + final IStructuredSelection selection = (IStructuredSelection) this.availableValuesTreeViewer + .getSelection(); + if (selection.isEmpty() || !confirmMove()) { + return; + } + Iterator<T> it = getTCastedStructuredSelectionIterator(selection); + while (it.hasNext()) { + T element = it.next(); + if (!(getValues() != null && getValues().contains(element))) { + getValues().add(element); + this.availableValues.remove(element); + } + } + refresh(); + this.featureValuesListViewer.setSelection(selection); + } + + @SuppressWarnings({ "unchecked", "static-method" }) + //unchecked: the selection in not type parameterized, then we cannot get a cleaned cast iterator + //static-method: this method cannot be static to be able to use the T type. + private Iterator<T> getTCastedStructuredSelectionIterator(final IStructuredSelection selection) { + return selection.iterator(); + } + + private void addAllButtonClicked() { + if (this.availableValues.isEmpty() || !confirmMove()) { + return; + } + getValues().addAll(this.availableValues); + this.availableValues.removeAll(getValues()); + refresh(); + } + + private void removeButtonClicked() { + final IStructuredSelection selection = (IStructuredSelection) this.featureValuesListViewer + .getSelection(); + if (selection.isEmpty() || !confirmRemove()) { + return; + } + + Iterator<T> it = this.getTCastedStructuredSelectionIterator(selection); + while (it.hasNext()) { + T element = it.next(); + if (getValues().contains(element)) { + this.availableValues.add(element); + getValues().remove(element); + } + } + refresh(); + } + + private void removeAllButtonClicked() { + if (getValues().isEmpty() || !confirmRemove()) { + return; + } + this.availableValues.addAll(getValues()); + getValues().removeAll(getValues()); + refresh(); + } + + private boolean confirmRemove() { + if (getFeature() instanceof EReference) { + EReference eReference = (EReference) getFeature(); + if (eReference.isContainment()) { + return MessageDialog.openConfirm(getShell(), + Messages.NaryReferenceEditingDialog_deleteElements, + Messages.NaryReferenceEditingDialog_deleteElementsLong); + } + } + return true; + } + + private boolean confirmMove() { + if (getFeature() instanceof EReference || getFeature() instanceof FacetReference) { + EReference reference = (EReference) getFeature(); + if (reference.isContainment()) { + String fullMessage = Messages.NaryReferenceEditingDialog_moveWarning; + return MessageDialog.openConfirm(getShell(), + Messages.NaryReferenceEditingDialog_moveElement, fullMessage); + } + } + return true; + } + + @SuppressWarnings("unchecked") // type erasure on generic + private void createInstanceButtonClicked() { + EClassifier eType = getFeature().getEType(); + if (eType instanceof EClass) { + EClass eClass = (EClass) eType; + EObject newInstance = CreateInstanceDialog.open(getShell(), eClass, + new CustomizableLabelProvider()); + if (newInstance != null) { + getValues().add((T) newInstance); + refresh(); + } + } + } + + private void createLeftPane(final Composite contents) { + final Composite choiceComposite = new Composite(contents, SWT.NONE); + final GridData data = new GridData(SWT.FILL, SWT.FILL, true, true); + data.horizontalAlignment = SWT.END; + choiceComposite.setLayoutData(data); + + final GridLayout layout = new GridLayout(); + data.horizontalAlignment = SWT.FILL; + layout.marginHeight = 0; + layout.marginWidth = 0; + layout.numColumns = 1; + choiceComposite.setLayout(layout); + + final Label choiceLabel = new Label(choiceComposite, SWT.NONE); + choiceLabel.setText(Messages.NaryReferenceEditingDialog_availableValues); + + final GridData choiceLabelGridData = new GridData(); + choiceLabelGridData.verticalAlignment = SWT.FILL; + choiceLabelGridData.horizontalAlignment = SWT.FILL; + choiceLabel.setLayoutData(choiceLabelGridData); + + final Text patternText = createFilterText(choiceComposite); + + final Tree availableValuesTree = new Tree(choiceComposite, SWT.MULTI | SWT.BORDER); + final GridData availableValuesGridData = new GridData(); + availableValuesGridData.widthHint = AbstractNaryEditingDialog.AVAILABLE_VALUES_TREE_WIDTH; + availableValuesGridData.heightHint = AbstractNaryEditingDialog.AVAILABLE_VALUES_TREE_HEIGHT; + availableValuesGridData.horizontalAlignment = SWT.FILL; + availableValuesGridData.verticalAlignment = SWT.FILL; + availableValuesGridData.grabExcessHorizontalSpace = true; + availableValuesGridData.grabExcessVerticalSpace = true; + availableValuesTree.setLayoutData(availableValuesGridData); + + this.availableValuesTreeViewer = new TreeViewer(availableValuesTree); + this.assignableValuesContentProvider = new AssignableValuesContentProvider(); + this.availableValuesTreeViewer.setContentProvider(this.assignableValuesContentProvider); + this.availableValuesTreeViewer.setLabelProvider(new CustomizableLabelProvider()); + final PatternFilter filter = new PatternFilter(); + this.availableValuesTreeViewer.addFilter(filter); + + this.availableValuesTreeViewer.setInput(this.availableValues); + + patternText.addModifyListener(new ModifyListener() { + public void modifyText(final ModifyEvent e) { + filter.setPattern(patternText.getText()); + NaryReferenceEditingDialog.this.availableValuesTreeViewer.refresh(); + } + }); + } + + private void createMiddleButtonsPane(final Composite contents) { + final Composite buttonsComposite = new Composite(contents, SWT.NONE); + final GridData buttonsCompositeGridData = new GridData(); + buttonsCompositeGridData.verticalAlignment = SWT.CENTER; + buttonsCompositeGridData.horizontalAlignment = SWT.FILL; + buttonsComposite.setLayoutData(buttonsCompositeGridData); + buttonsComposite.setLayout(new GridLayout()); + + // new Label(buttonsComposite, SWT.NONE); + + this.addButton = new Button(buttonsComposite, SWT.PUSH); + this.addButton.setText(Messages.NaryReferenceEditingDialog_add); + this.addButton.setToolTipText(Messages.NaryReferenceEditingDialog_addTooltip); + final GridData addButtonGridData = new GridData(); + addButtonGridData.verticalAlignment = SWT.FILL; + addButtonGridData.horizontalAlignment = SWT.FILL; + this.addButton.setLayoutData(addButtonGridData); + + this.removeButton = new Button(buttonsComposite, SWT.PUSH); + this.removeButton.setText(Messages.NaryReferenceEditingDialog_remove); + this.removeButton.setToolTipText(Messages.NaryReferenceEditingDialog_removeTooltip); + final GridData removeButtonGridData = new GridData(); + removeButtonGridData.verticalAlignment = SWT.FILL; + removeButtonGridData.horizontalAlignment = SWT.FILL; + this.removeButton.setLayoutData(removeButtonGridData); + + spacer(buttonsComposite); + + this.addAllButton = new Button(buttonsComposite, SWT.PUSH); + this.addAllButton.setText(Messages.NaryReferenceEditingDialog_addAll); + this.addAllButton.setToolTipText(Messages.NaryReferenceEditingDialog_addAllTooltip); + + this.removeAllButton = new Button(buttonsComposite, SWT.PUSH); + this.removeAllButton.setText(Messages.NaryReferenceEditingDialog_removeAll); + this.removeAllButton.setToolTipText(Messages.NaryReferenceEditingDialog_removeAllTooltip); + } + + private void spacer(final Composite parent) { + @SuppressWarnings("unused") + Label label = new Label(parent, SWT.NONE); + } + + private void createRightButtonsPane(final Composite contents) { + final Composite buttonsComposite = new Composite(contents, SWT.NONE); + final GridData buttonsCompositeGridData = new GridData(); + buttonsCompositeGridData.verticalAlignment = SWT.FILL; + buttonsCompositeGridData.horizontalAlignment = SWT.FILL; + buttonsComposite.setLayoutData(buttonsCompositeGridData); + buttonsComposite.setLayout(new GridLayout()); + + // spacer + spacer(buttonsComposite); + + if (getFeature() instanceof EReference) { + EReference eReference = (EReference) getFeature(); + if (eReference.isContainment()) { + this.createInstanceButton = new Button(buttonsComposite, SWT.PUSH); + this.createInstanceButton.setText(Messages.NaryReferenceEditingDialog_newInstance); + final GridData createButtonGridData = new GridData(); + createButtonGridData.verticalAlignment = SWT.FILL; + createButtonGridData.horizontalAlignment = SWT.FILL; + this.createInstanceButton.setLayoutData(createButtonGridData); + spacer(buttonsComposite); + } + + } + + this.upButton = new Button(buttonsComposite, SWT.PUSH); + this.upButton.setText(Messages.NaryReferenceEditingDialog_up); + final GridData upButtonGridData = new GridData(); + upButtonGridData.verticalAlignment = SWT.FILL; + upButtonGridData.horizontalAlignment = SWT.FILL; + this.upButton.setLayoutData(upButtonGridData); + + this.downButton = new Button(buttonsComposite, SWT.PUSH); + this.downButton.setText(Messages.NaryReferenceEditingDialog_down); + final GridData downButtonGridData = new GridData(); + downButtonGridData.verticalAlignment = SWT.FILL; + downButtonGridData.horizontalAlignment = SWT.FILL; + this.downButton.setLayoutData(downButtonGridData); + } + + private void createRightPane(final Composite contents) { + final Composite featureComposite = new Composite(contents, SWT.NONE); + final GridData featureCompositeData = new GridData(SWT.FILL, SWT.FILL, true, true); + featureCompositeData.horizontalAlignment = SWT.END; + featureComposite.setLayoutData(featureCompositeData); + + final GridLayout featureCompositeLayout = new GridLayout(); + featureCompositeData.horizontalAlignment = SWT.FILL; + featureCompositeLayout.marginHeight = 0; + featureCompositeLayout.marginWidth = 0; + featureCompositeLayout.numColumns = 1; + featureComposite.setLayout(featureCompositeLayout); + + final Label featureLabel = new Label(featureComposite, SWT.NONE); + featureLabel.setText(Messages.NaryReferenceEditingDialog_values); + final GridData valuesLabelGridData = new GridData(); + valuesLabelGridData.horizontalSpan = 2; + valuesLabelGridData.horizontalAlignment = SWT.FILL; + valuesLabelGridData.verticalAlignment = SWT.FILL; + featureLabel.setLayoutData(valuesLabelGridData); + + final org.eclipse.swt.widgets.List availableValuesList = new org.eclipse.swt.widgets.List( + featureComposite, SWT.MULTI | SWT.BORDER | SWT.V_SCROLL); + final GridData availableValuesGridData = new GridData(); + availableValuesGridData.widthHint = AbstractNaryEditingDialog.AVAILABLE_VALUES_TREE_WIDTH; + availableValuesGridData.heightHint = AbstractNaryEditingDialog.AVAILABLE_VALUES_TREE_HEIGHT; + availableValuesGridData.verticalAlignment = SWT.FILL; + availableValuesGridData.horizontalAlignment = SWT.FILL; + availableValuesGridData.grabExcessHorizontalSpace = true; + availableValuesGridData.grabExcessVerticalSpace = true; + availableValuesList.setLayoutData(availableValuesGridData); + + this.featureValuesListViewer = new ListViewer(availableValuesList); + this.featureValuesListViewer.setContentProvider(new AssignedValuesContentProvider()); + this.featureValuesListViewer.setLabelProvider(new CustomizableLabelProvider()); + this.featureValuesListViewer + .setInput(getValues()); + } + + private Text createFilterText(final Composite contents) { + Text patternText = new Text(contents, SWT.BORDER | SWT.SEARCH); + patternText.setMessage(Messages.NaryReferenceEditingDialog_typeFilterText); + patternText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); + return patternText; + } + + @Override + public void refresh() { + this.availableValuesTreeViewer.refresh(); + this.featureValuesListViewer.refresh(); + } + + @Override + protected boolean isResizable() { + return true; + } + + @Override + protected void createButtonsForButtonBar(final Composite parent) { + createButton(parent, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL, false); + createButton(parent, IDialogConstants.OK_ID, IDialogConstants.OK_LABEL, true); + } + + @Override + public ISelection getSelection() { + return this.featureValuesListViewer.getSelection(); + } +}
diff --git a/org.eclipse.modisco.facet.widgets.celleditors/src/org/eclipse/modisco/facet/widgets/celleditors/modelCellEditor/AbstractModelCellEditor.java b/org.eclipse.modisco.facet.widgets.celleditors/src/org/eclipse/modisco/facet/widgets/celleditors/modelCellEditor/AbstractModelCellEditor.java new file mode 100644 index 0000000..0bdf19a --- /dev/null +++ b/org.eclipse.modisco.facet.widgets.celleditors/src/org/eclipse/modisco/facet/widgets/celleditors/modelCellEditor/AbstractModelCellEditor.java
@@ -0,0 +1,106 @@ +/** + * Copyright (c) 2010 CEA LIST. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Nicolas Bros (Mia-Software) - initial API and implementation + */ +package org.eclipse.modisco.facet.widgets.celleditors.modelCellEditor; + +import org.eclipse.emf.ecore.EClassifier; +import org.eclipse.emf.ecore.EObject; + +/** + * <!-- begin-user-doc --> A representation of the model object ' + * <em><b>Abstract Model Cell Editor</b></em>'. <!-- end-user-doc --> + * + * <p> + * The following features are supported: + * <ul> + * <li> + * {@link org.eclipse.modisco.facet.widgets.celleditors.modelCellEditor.AbstractModelCellEditor#getCellType + * <em>Cell Type</em>}</li> + * <li> + * {@link org.eclipse.modisco.facet.widgets.celleditors.modelCellEditor.AbstractModelCellEditor#getCellId + * <em>Cell Id</em>}</li> + * </ul> + * </p> + * + * @see org.eclipse.modisco.facet.widgets.celleditors.modelCellEditor.ModelCellEditorPackage#getAbstractModelCellEditor() + * @model abstract="true" + * @generated + */ +public interface AbstractModelCellEditor extends EObject { + /** + * Returns the value of the '<em><b>Cell Type</b></em>' reference. <!-- + * begin-user-doc --> + * <p> + * If the meaning of the '<em>Cell Type</em>' reference isn't clear, there + * really should be more of a description here... + * </p> + * <!-- end-user-doc --> + * + * @return the value of the '<em>Cell Type</em>' reference. + * @see #setCellType(EClassifier) + * @see org.eclipse.modisco.facet.widgets.celleditors.modelCellEditor.ModelCellEditorPackage#getAbstractModelCellEditor_CellType() + * @model required="true" + * @generated + */ + EClassifier getCellType(); + + /** + * Sets the value of the ' + * {@link org.eclipse.modisco.facet.widgets.celleditors.modelCellEditor.AbstractModelCellEditor#getCellType + * <em>Cell Type</em>}' reference. <!-- begin-user-doc --> <!-- end-user-doc + * --> + * + * @param value + * the new value of the '<em>Cell Type</em>' reference. + * @see #getCellType() + * @generated + */ + void setCellType(EClassifier value); + + /** + * Returns the value of the '<em><b>Cell Id</b></em>' attribute. <!-- + * begin-user-doc --> + * <p> + * If the meaning of the '<em>Cell Id</em>' attribute isn't clear, there + * really should be more of a description here... + * </p> + * <!-- end-user-doc --> + * + * @return the value of the '<em>Cell Id</em>' attribute. + * @see #setCellId(String) + * @see org.eclipse.modisco.facet.widgets.celleditors.modelCellEditor.ModelCellEditorPackage#getAbstractModelCellEditor_CellId() + * @model required="true" + * @generated + */ + String getCellId(); + + /** + * Sets the value of the ' + * {@link org.eclipse.modisco.facet.widgets.celleditors.modelCellEditor.AbstractModelCellEditor#getCellId + * <em>Cell Id</em>}' attribute. <!-- begin-user-doc --> <!-- end-user-doc + * --> + * + * @param value + * the new value of the '<em>Cell Id</em>' attribute. + * @see #getCellId() + * @generated + */ + void setCellId(String value); + + /** + * <!-- begin-user-doc --> <!-- end-user-doc --> + * + * @model kind="operation" required="true" + * @generated + */ + String getModelCellEditorImpl(); + +} // AbstractModelCellEditor
diff --git a/org.eclipse.modisco.facet.widgets.celleditors/src/org/eclipse/modisco/facet/widgets/celleditors/modelCellEditor/BasicCellEditor.java b/org.eclipse.modisco.facet.widgets.celleditors/src/org/eclipse/modisco/facet/widgets/celleditors/modelCellEditor/BasicCellEditor.java new file mode 100644 index 0000000..e4f1acc --- /dev/null +++ b/org.eclipse.modisco.facet.widgets.celleditors/src/org/eclipse/modisco/facet/widgets/celleditors/modelCellEditor/BasicCellEditor.java
@@ -0,0 +1,63 @@ +/** + * Copyright (c) 2010 CEA LIST. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Nicolas Bros (Mia-Software) - initial API and implementation + */ +package org.eclipse.modisco.facet.widgets.celleditors.modelCellEditor; + +/** + * <!-- begin-user-doc --> A representation of the model object ' + * <em><b>Basic Cell Editor</b></em>'. <!-- end-user-doc --> + * + * <p> + * The following features are supported: + * <ul> + * <li> + * {@link org.eclipse.modisco.facet.widgets.celleditors.modelCellEditor.BasicCellEditor#getBasicCellEditorImpl + * <em>Basic Cell Editor Impl</em>}</li> + * </ul> + * </p> + * + * @see org.eclipse.modisco.facet.widgets.celleditors.modelCellEditor.ModelCellEditorPackage#getBasicCellEditor() + * @model + * @generated + */ +public interface BasicCellEditor extends AbstractModelCellEditor { + /** + * Returns the value of the '<em><b>Basic Cell Editor Impl</b></em>' + * attribute. <!-- begin-user-doc --> + * <p> + * If the meaning of the '<em>Basic Cell Editor Impl</em>' attribute isn't + * clear, there really should be more of a description here... + * </p> + * <!-- end-user-doc --> + * + * @return the value of the '<em>Basic Cell Editor Impl</em>' attribute. + * @see #setBasicCellEditorImpl(String) + * @see org.eclipse.modisco.facet.widgets.celleditors.modelCellEditor.ModelCellEditorPackage#getBasicCellEditor_BasicCellEditorImpl() + * @model required="true" + * @generated + */ + String getBasicCellEditorImpl(); + + /** + * Sets the value of the ' + * {@link org.eclipse.modisco.facet.widgets.celleditors.modelCellEditor.BasicCellEditor#getBasicCellEditorImpl + * <em>Basic Cell Editor Impl</em>}' attribute. <!-- begin-user-doc --> <!-- + * end-user-doc --> + * + * @param value + * the new value of the '<em>Basic Cell Editor Impl</em>' + * attribute. + * @see #getBasicCellEditorImpl() + * @generated + */ + void setBasicCellEditorImpl(String value); + +} // BasicCellEditor
diff --git a/org.eclipse.modisco.facet.widgets.celleditors/src/org/eclipse/modisco/facet/widgets/celleditors/modelCellEditor/ModelCellEditorDeclarations.java b/org.eclipse.modisco.facet.widgets.celleditors/src/org/eclipse/modisco/facet/widgets/celleditors/modelCellEditor/ModelCellEditorDeclarations.java new file mode 100644 index 0000000..66e1a49 --- /dev/null +++ b/org.eclipse.modisco.facet.widgets.celleditors/src/org/eclipse/modisco/facet/widgets/celleditors/modelCellEditor/ModelCellEditorDeclarations.java
@@ -0,0 +1,54 @@ +/** + * Copyright (c) 2010 CEA LIST. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Nicolas Bros (Mia-Software) - initial API and implementation + */ +package org.eclipse.modisco.facet.widgets.celleditors.modelCellEditor; + +import org.eclipse.emf.common.util.EList; +import org.eclipse.emf.ecore.EObject; + +/** + * <!-- begin-user-doc --> A representation of the model object ' + * <em><b>Declarations</b></em>'. <!-- end-user-doc --> + * + * <p> + * The following features are supported: + * <ul> + * <li> + * {@link org.eclipse.modisco.facet.widgets.celleditors.modelCellEditor.ModelCellEditorDeclarations#getModelCellEditors + * <em>Model Cell Editors</em>}</li> + * </ul> + * </p> + * + * @see org.eclipse.modisco.facet.widgets.celleditors.modelCellEditor.ModelCellEditorPackage#getModelCellEditorDeclarations() + * @model + * @generated + */ +public interface ModelCellEditorDeclarations extends EObject { + /** + * Returns the value of the '<em><b>Model Cell Editors</b></em>' containment + * reference list. The list contents are of type + * {@link org.eclipse.modisco.facet.widgets.celleditors.modelCellEditor.AbstractModelCellEditor} + * . <!-- begin-user-doc --> + * <p> + * If the meaning of the '<em>Model Cell Editors</em>' containment reference + * list isn't clear, there really should be more of a description here... + * </p> + * <!-- end-user-doc --> + * + * @return the value of the '<em>Model Cell Editors</em>' containment + * reference list. + * @see org.eclipse.modisco.facet.widgets.celleditors.modelCellEditor.ModelCellEditorPackage#getModelCellEditorDeclarations_ModelCellEditors() + * @model containment="true" + * @generated + */ + EList<AbstractModelCellEditor> getModelCellEditors(); + +} // ModelCellEditorDeclarations
diff --git a/org.eclipse.modisco.facet.widgets.celleditors/src/org/eclipse/modisco/facet/widgets/celleditors/modelCellEditor/ModelCellEditorFactory.java b/org.eclipse.modisco.facet.widgets.celleditors/src/org/eclipse/modisco/facet/widgets/celleditors/modelCellEditor/ModelCellEditorFactory.java new file mode 100644 index 0000000..8c1afac --- /dev/null +++ b/org.eclipse.modisco.facet.widgets.celleditors/src/org/eclipse/modisco/facet/widgets/celleditors/modelCellEditor/ModelCellEditorFactory.java
@@ -0,0 +1,78 @@ +/** + * Copyright (c) 2010 CEA LIST. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Nicolas Bros (Mia-Software) - initial API and implementation + */ +package org.eclipse.modisco.facet.widgets.celleditors.modelCellEditor; + +import org.eclipse.emf.ecore.EFactory; + +/** + * <!-- begin-user-doc --> The <b>Factory</b> for the model. It provides a + * create method for each non-abstract class of the model. <!-- end-user-doc --> + * + * @see org.eclipse.modisco.facet.widgets.celleditors.modelCellEditor.ModelCellEditorPackage + * @generated + */ +public interface ModelCellEditorFactory extends EFactory { + /** + * The singleton instance of the factory. <!-- begin-user-doc --> <!-- + * end-user-doc --> + * + * @generated + */ + ModelCellEditorFactory eINSTANCE = org.eclipse.modisco.facet.widgets.celleditors.modelCellEditor.impl.ModelCellEditorFactoryImpl + .init(); + + /** + * Returns a new object of class '<em>Declarations</em>'. <!-- + * begin-user-doc --> <!-- end-user-doc --> + * + * @return a new object of class '<em>Declarations</em>'. + * @generated + */ + ModelCellEditorDeclarations createModelCellEditorDeclarations(); + + /** + * Returns a new object of class '<em>Basic Cell Editor</em>'. <!-- + * begin-user-doc --> <!-- end-user-doc --> + * + * @return a new object of class '<em>Basic Cell Editor</em>'. + * @generated + */ + BasicCellEditor createBasicCellEditor(); + + /** + * Returns a new object of class '<em>Unary Reference Cell Editor</em>'. + * <!-- begin-user-doc --> <!-- end-user-doc --> + * + * @return a new object of class '<em>Unary Reference Cell Editor</em>'. + * @generated + */ + UnaryReferenceCellEditor createUnaryReferenceCellEditor(); + + /** + * Returns a new object of class '<em>Nary Feature Cell Editor</em>'. <!-- + * begin-user-doc --> <!-- end-user-doc --> + * + * @return a new object of class '<em>Nary Feature Cell Editor</em>'. + * @generated + */ + NaryFeatureCellEditor createNaryFeatureCellEditor(); + + /** + * Returns the package supported by this factory. <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @return the package supported by this factory. + * @generated + */ + ModelCellEditorPackage getModelCellEditorPackage(); + +} // ModelCellEditorFactory
diff --git a/org.eclipse.modisco.facet.widgets.celleditors/src/org/eclipse/modisco/facet/widgets/celleditors/modelCellEditor/ModelCellEditorPackage.java b/org.eclipse.modisco.facet.widgets.celleditors/src/org/eclipse/modisco/facet/widgets/celleditors/modelCellEditor/ModelCellEditorPackage.java new file mode 100644 index 0000000..e60956c --- /dev/null +++ b/org.eclipse.modisco.facet.widgets.celleditors/src/org/eclipse/modisco/facet/widgets/celleditors/modelCellEditor/ModelCellEditorPackage.java
@@ -0,0 +1,567 @@ +/** + * Copyright (c) 2010 CEA LIST. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Nicolas Bros (Mia-Software) - initial API and implementation + */ +package org.eclipse.modisco.facet.widgets.celleditors.modelCellEditor; + +import org.eclipse.emf.ecore.EAttribute; +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.EPackage; +import org.eclipse.emf.ecore.EReference; + +/** + * <!-- begin-user-doc --> The <b>Package</b> for the model. It contains + * accessors for the meta objects to represent + * <ul> + * <li>each class,</li> + * <li>each feature of each class,</li> + * <li>each enum,</li> + * <li>and each data type</li> + * </ul> + * <!-- end-user-doc --> + * + * @see org.eclipse.modisco.facet.widgets.celleditors.modelCellEditor.ModelCellEditorFactory + * @model kind="package" + * @generated + */ +public interface ModelCellEditorPackage extends EPackage { + /** + * The package name. <!-- begin-user-doc --> <!-- end-user-doc --> + * + * @generated + */ + String eNAME = "modelCellEditor"; //$NON-NLS-1$ + + /** + * The package namespace URI. <!-- begin-user-doc --> <!-- end-user-doc --> + * + * @generated + */ + String eNS_URI = "http://www.eclipse.org/EMF_Facet/ModelCellEditor/0.1.0/modelCellEditor"; //$NON-NLS-1$ + + /** + * The package namespace name. <!-- begin-user-doc --> <!-- end-user-doc --> + * + * @generated + */ + String eNS_PREFIX = "modelCellEditor"; //$NON-NLS-1$ + + /** + * The singleton instance of the package. <!-- begin-user-doc --> <!-- + * end-user-doc --> + * + * @generated + */ + ModelCellEditorPackage eINSTANCE = org.eclipse.modisco.facet.widgets.celleditors.modelCellEditor.impl.ModelCellEditorPackageImpl + .init(); + + /** + * The meta object id for the ' + * {@link org.eclipse.modisco.facet.widgets.celleditors.modelCellEditor.impl.ModelCellEditorDeclarationsImpl + * <em>Declarations</em>}' class. <!-- begin-user-doc --> <!-- end-user-doc + * --> + * + * @see org.eclipse.modisco.facet.widgets.celleditors.modelCellEditor.impl.ModelCellEditorDeclarationsImpl + * @see org.eclipse.modisco.facet.widgets.celleditors.modelCellEditor.impl.ModelCellEditorPackageImpl#getModelCellEditorDeclarations() + * @generated + */ + int MODEL_CELL_EDITOR_DECLARATIONS = 0; + + /** + * The feature id for the '<em><b>Model Cell Editors</b></em>' containment + * reference list. <!-- begin-user-doc --> <!-- end-user-doc --> + * + * @generated + * @ordered + */ + int MODEL_CELL_EDITOR_DECLARATIONS__MODEL_CELL_EDITORS = 0; + + /** + * The number of structural features of the '<em>Declarations</em>' class. + * <!-- begin-user-doc --> <!-- end-user-doc --> + * + * @generated + * @ordered + */ + int MODEL_CELL_EDITOR_DECLARATIONS_FEATURE_COUNT = 1; + + /** + * The meta object id for the ' + * {@link org.eclipse.modisco.facet.widgets.celleditors.modelCellEditor.impl.AbstractModelCellEditorImpl + * <em>Abstract Model Cell Editor</em>}' class. <!-- begin-user-doc --> <!-- + * end-user-doc --> + * + * @see org.eclipse.modisco.facet.widgets.celleditors.modelCellEditor.impl.AbstractModelCellEditorImpl + * @see org.eclipse.modisco.facet.widgets.celleditors.modelCellEditor.impl.ModelCellEditorPackageImpl#getAbstractModelCellEditor() + * @generated + */ + int ABSTRACT_MODEL_CELL_EDITOR = 1; + + /** + * The feature id for the '<em><b>Cell Type</b></em>' reference. <!-- + * begin-user-doc --> <!-- end-user-doc --> + * + * @generated + * @ordered + */ + int ABSTRACT_MODEL_CELL_EDITOR__CELL_TYPE = 0; + + /** + * The feature id for the '<em><b>Cell Id</b></em>' attribute. <!-- + * begin-user-doc --> <!-- end-user-doc --> + * + * @generated + * @ordered + */ + int ABSTRACT_MODEL_CELL_EDITOR__CELL_ID = 1; + + /** + * The number of structural features of the ' + * <em>Abstract Model Cell Editor</em>' class. <!-- begin-user-doc --> <!-- + * end-user-doc --> + * + * @generated + * @ordered + */ + int ABSTRACT_MODEL_CELL_EDITOR_FEATURE_COUNT = 2; + + /** + * The meta object id for the ' + * {@link org.eclipse.modisco.facet.widgets.celleditors.modelCellEditor.impl.BasicCellEditorImpl + * <em>Basic Cell Editor</em>}' class. <!-- begin-user-doc --> <!-- + * end-user-doc --> + * + * @see org.eclipse.modisco.facet.widgets.celleditors.modelCellEditor.impl.BasicCellEditorImpl + * @see org.eclipse.modisco.facet.widgets.celleditors.modelCellEditor.impl.ModelCellEditorPackageImpl#getBasicCellEditor() + * @generated + */ + int BASIC_CELL_EDITOR = 2; + + /** + * The feature id for the '<em><b>Cell Type</b></em>' reference. <!-- + * begin-user-doc --> <!-- end-user-doc --> + * + * @generated + * @ordered + */ + int BASIC_CELL_EDITOR__CELL_TYPE = ModelCellEditorPackage.ABSTRACT_MODEL_CELL_EDITOR__CELL_TYPE; + + /** + * The feature id for the '<em><b>Cell Id</b></em>' attribute. <!-- + * begin-user-doc --> <!-- end-user-doc --> + * + * @generated + * @ordered + */ + int BASIC_CELL_EDITOR__CELL_ID = ModelCellEditorPackage.ABSTRACT_MODEL_CELL_EDITOR__CELL_ID; + + /** + * The feature id for the '<em><b>Basic Cell Editor Impl</b></em>' + * attribute. <!-- begin-user-doc --> <!-- end-user-doc --> + * + * @generated + * @ordered + */ + int BASIC_CELL_EDITOR__BASIC_CELL_EDITOR_IMPL = ModelCellEditorPackage.ABSTRACT_MODEL_CELL_EDITOR_FEATURE_COUNT + 0; + + /** + * The number of structural features of the '<em>Basic Cell Editor</em>' + * class. <!-- begin-user-doc --> <!-- end-user-doc --> + * + * @generated + * @ordered + */ + int BASIC_CELL_EDITOR_FEATURE_COUNT = ModelCellEditorPackage.ABSTRACT_MODEL_CELL_EDITOR_FEATURE_COUNT + 1; + + /** + * The meta object id for the ' + * {@link org.eclipse.modisco.facet.widgets.celleditors.modelCellEditor.impl.UnaryReferenceCellEditorImpl + * <em>Unary Reference Cell Editor</em>}' class. <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @see org.eclipse.modisco.facet.widgets.celleditors.modelCellEditor.impl.UnaryReferenceCellEditorImpl + * @see org.eclipse.modisco.facet.widgets.celleditors.modelCellEditor.impl.ModelCellEditorPackageImpl#getUnaryReferenceCellEditor() + * @generated + */ + int UNARY_REFERENCE_CELL_EDITOR = 3; + + /** + * The feature id for the '<em><b>Cell Type</b></em>' reference. <!-- + * begin-user-doc --> <!-- end-user-doc --> + * + * @generated + * @ordered + */ + int UNARY_REFERENCE_CELL_EDITOR__CELL_TYPE = ModelCellEditorPackage.ABSTRACT_MODEL_CELL_EDITOR__CELL_TYPE; + + /** + * The feature id for the '<em><b>Cell Id</b></em>' attribute. <!-- + * begin-user-doc --> <!-- end-user-doc --> + * + * @generated + * @ordered + */ + int UNARY_REFERENCE_CELL_EDITOR__CELL_ID = ModelCellEditorPackage.ABSTRACT_MODEL_CELL_EDITOR__CELL_ID; + + /** + * The feature id for the '<em><b>Unary Reference Cell Editor Impl</b></em>' + * attribute. <!-- begin-user-doc --> <!-- end-user-doc --> + * + * @generated + * @ordered + */ + int UNARY_REFERENCE_CELL_EDITOR__UNARY_REFERENCE_CELL_EDITOR_IMPL = ModelCellEditorPackage.ABSTRACT_MODEL_CELL_EDITOR_FEATURE_COUNT + 0; + + /** + * The number of structural features of the ' + * <em>Unary Reference Cell Editor</em>' class. <!-- begin-user-doc --> <!-- + * end-user-doc --> + * + * @generated + * @ordered + */ + int UNARY_REFERENCE_CELL_EDITOR_FEATURE_COUNT = ModelCellEditorPackage.ABSTRACT_MODEL_CELL_EDITOR_FEATURE_COUNT + 1; + + /** + * The meta object id for the ' + * {@link org.eclipse.modisco.facet.widgets.celleditors.modelCellEditor.impl.NaryFeatureCellEditorImpl + * <em>Nary Feature Cell Editor</em>}' class. <!-- begin-user-doc --> <!-- + * end-user-doc --> + * + * @see org.eclipse.modisco.facet.widgets.celleditors.modelCellEditor.impl.NaryFeatureCellEditorImpl + * @see org.eclipse.modisco.facet.widgets.celleditors.modelCellEditor.impl.ModelCellEditorPackageImpl#getNaryFeatureCellEditor() + * @generated + */ + int NARY_FEATURE_CELL_EDITOR = 4; + + /** + * The feature id for the '<em><b>Cell Type</b></em>' reference. <!-- + * begin-user-doc --> <!-- end-user-doc --> + * + * @generated + * @ordered + */ + int NARY_FEATURE_CELL_EDITOR__CELL_TYPE = ModelCellEditorPackage.ABSTRACT_MODEL_CELL_EDITOR__CELL_TYPE; + + /** + * The feature id for the '<em><b>Cell Id</b></em>' attribute. <!-- + * begin-user-doc --> <!-- end-user-doc --> + * + * @generated + * @ordered + */ + int NARY_FEATURE_CELL_EDITOR__CELL_ID = ModelCellEditorPackage.ABSTRACT_MODEL_CELL_EDITOR__CELL_ID; + + /** + * The feature id for the '<em><b>Nary Feature Cell Editor Impl</b></em>' + * attribute. <!-- begin-user-doc --> <!-- end-user-doc --> + * + * @generated + * @ordered + */ + int NARY_FEATURE_CELL_EDITOR__NARY_FEATURE_CELL_EDITOR_IMPL = ModelCellEditorPackage.ABSTRACT_MODEL_CELL_EDITOR_FEATURE_COUNT + 0; + + /** + * The number of structural features of the ' + * <em>Nary Feature Cell Editor</em>' class. <!-- begin-user-doc --> <!-- + * end-user-doc --> + * + * @generated + * @ordered + */ + int NARY_FEATURE_CELL_EDITOR_FEATURE_COUNT = ModelCellEditorPackage.ABSTRACT_MODEL_CELL_EDITOR_FEATURE_COUNT + 1; + + /** + * Returns the meta object for class ' + * {@link org.eclipse.modisco.facet.widgets.celleditors.modelCellEditor.ModelCellEditorDeclarations + * <em>Declarations</em>}'. <!-- begin-user-doc --> <!-- end-user-doc --> + * + * @return the meta object for class '<em>Declarations</em>'. + * @see org.eclipse.modisco.facet.widgets.celleditors.modelCellEditor.ModelCellEditorDeclarations + * @generated + */ + EClass getModelCellEditorDeclarations(); + + /** + * Returns the meta object for the containment reference list ' + * {@link org.eclipse.modisco.facet.widgets.celleditors.modelCellEditor.ModelCellEditorDeclarations#getModelCellEditors + * <em>Model Cell Editors</em>}'. <!-- begin-user-doc --> <!-- end-user-doc + * --> + * + * @return the meta object for the containment reference list ' + * <em>Model Cell Editors</em>'. + * @see org.eclipse.modisco.facet.widgets.celleditors.modelCellEditor.ModelCellEditorDeclarations#getModelCellEditors() + * @see #getModelCellEditorDeclarations() + * @generated + */ + EReference getModelCellEditorDeclarations_ModelCellEditors(); + + /** + * Returns the meta object for class ' + * {@link org.eclipse.modisco.facet.widgets.celleditors.modelCellEditor.AbstractModelCellEditor + * <em>Abstract Model Cell Editor</em>}'. <!-- begin-user-doc --> <!-- + * end-user-doc --> + * + * @return the meta object for class '<em>Abstract Model Cell Editor</em>'. + * @see org.eclipse.modisco.facet.widgets.celleditors.modelCellEditor.AbstractModelCellEditor + * @generated + */ + EClass getAbstractModelCellEditor(); + + /** + * Returns the meta object for the reference ' + * {@link org.eclipse.modisco.facet.widgets.celleditors.modelCellEditor.AbstractModelCellEditor#getCellType + * <em>Cell Type</em>}'. <!-- begin-user-doc --> <!-- end-user-doc --> + * + * @return the meta object for the reference '<em>Cell Type</em>'. + * @see org.eclipse.modisco.facet.widgets.celleditors.modelCellEditor.AbstractModelCellEditor#getCellType() + * @see #getAbstractModelCellEditor() + * @generated + */ + EReference getAbstractModelCellEditor_CellType(); + + /** + * Returns the meta object for the attribute ' + * {@link org.eclipse.modisco.facet.widgets.celleditors.modelCellEditor.AbstractModelCellEditor#getCellId + * <em>Cell Id</em>}'. <!-- begin-user-doc --> <!-- end-user-doc --> + * + * @return the meta object for the attribute '<em>Cell Id</em>'. + * @see org.eclipse.modisco.facet.widgets.celleditors.modelCellEditor.AbstractModelCellEditor#getCellId() + * @see #getAbstractModelCellEditor() + * @generated + */ + EAttribute getAbstractModelCellEditor_CellId(); + + /** + * Returns the meta object for class ' + * {@link org.eclipse.modisco.facet.widgets.celleditors.modelCellEditor.BasicCellEditor + * <em>Basic Cell Editor</em>}'. <!-- begin-user-doc --> <!-- end-user-doc + * --> + * + * @return the meta object for class '<em>Basic Cell Editor</em>'. + * @see org.eclipse.modisco.facet.widgets.celleditors.modelCellEditor.BasicCellEditor + * @generated + */ + EClass getBasicCellEditor(); + + /** + * Returns the meta object for the attribute ' + * {@link org.eclipse.modisco.facet.widgets.celleditors.modelCellEditor.BasicCellEditor#getBasicCellEditorImpl + * <em>Basic Cell Editor Impl</em>}'. <!-- begin-user-doc --> <!-- + * end-user-doc --> + * + * @return the meta object for the attribute ' + * <em>Basic Cell Editor Impl</em>'. + * @see org.eclipse.modisco.facet.widgets.celleditors.modelCellEditor.BasicCellEditor#getBasicCellEditorImpl() + * @see #getBasicCellEditor() + * @generated + */ + EAttribute getBasicCellEditor_BasicCellEditorImpl(); + + /** + * Returns the meta object for class ' + * {@link org.eclipse.modisco.facet.widgets.celleditors.modelCellEditor.UnaryReferenceCellEditor + * <em>Unary Reference Cell Editor</em>}'. <!-- begin-user-doc --> <!-- + * end-user-doc --> + * + * @return the meta object for class '<em>Unary Reference Cell Editor</em>'. + * @see org.eclipse.modisco.facet.widgets.celleditors.modelCellEditor.UnaryReferenceCellEditor + * @generated + */ + EClass getUnaryReferenceCellEditor(); + + /** + * Returns the meta object for the attribute ' + * {@link org.eclipse.modisco.facet.widgets.celleditors.modelCellEditor.UnaryReferenceCellEditor#getUnaryReferenceCellEditorImpl + * <em>Unary Reference Cell Editor Impl</em>}'. <!-- begin-user-doc --> <!-- + * end-user-doc --> + * + * @return the meta object for the attribute ' + * <em>Unary Reference Cell Editor Impl</em>'. + * @see org.eclipse.modisco.facet.widgets.celleditors.modelCellEditor.UnaryReferenceCellEditor#getUnaryReferenceCellEditorImpl() + * @see #getUnaryReferenceCellEditor() + * @generated + */ + EAttribute getUnaryReferenceCellEditor_UnaryReferenceCellEditorImpl(); + + /** + * Returns the meta object for class ' + * {@link org.eclipse.modisco.facet.widgets.celleditors.modelCellEditor.NaryFeatureCellEditor + * <em>Nary Feature Cell Editor</em>}'. <!-- begin-user-doc --> <!-- + * end-user-doc --> + * + * @return the meta object for class '<em>Nary Feature Cell Editor</em>'. + * @see org.eclipse.modisco.facet.widgets.celleditors.modelCellEditor.NaryFeatureCellEditor + * @generated + */ + EClass getNaryFeatureCellEditor(); + + /** + * Returns the meta object for the attribute ' + * {@link org.eclipse.modisco.facet.widgets.celleditors.modelCellEditor.NaryFeatureCellEditor#getNaryFeatureCellEditorImpl + * <em>Nary Feature Cell Editor Impl</em>}'. <!-- begin-user-doc --> <!-- + * end-user-doc --> + * + * @return the meta object for the attribute ' + * <em>Nary Feature Cell Editor Impl</em>'. + * @see org.eclipse.modisco.facet.widgets.celleditors.modelCellEditor.NaryFeatureCellEditor#getNaryFeatureCellEditorImpl() + * @see #getNaryFeatureCellEditor() + * @generated + */ + EAttribute getNaryFeatureCellEditor_NaryFeatureCellEditorImpl(); + + /** + * Returns the factory that creates the instances of the model. <!-- + * begin-user-doc --> <!-- end-user-doc --> + * + * @return the factory that creates the instances of the model. + * @generated + */ + ModelCellEditorFactory getModelCellEditorFactory(); + + /** + * <!-- begin-user-doc --> Defines literals for the meta objects that + * represent + * <ul> + * <li>each class,</li> + * <li>each feature of each class,</li> + * <li>each enum,</li> + * <li>and each data type</li> + * </ul> + * <!-- end-user-doc --> + * + * @generated + */ + interface Literals { + /** + * The meta object literal for the ' + * {@link org.eclipse.modisco.facet.widgets.celleditors.modelCellEditor.impl.ModelCellEditorDeclarationsImpl + * <em>Declarations</em>}' class. <!-- begin-user-doc --> <!-- + * end-user-doc --> + * + * @see org.eclipse.modisco.facet.widgets.celleditors.modelCellEditor.impl.ModelCellEditorDeclarationsImpl + * @see org.eclipse.modisco.facet.widgets.celleditors.modelCellEditor.impl.ModelCellEditorPackageImpl#getModelCellEditorDeclarations() + * @generated + */ + EClass MODEL_CELL_EDITOR_DECLARATIONS = ModelCellEditorPackage.eINSTANCE + .getModelCellEditorDeclarations(); + + /** + * The meta object literal for the '<em><b>Model Cell Editors</b></em>' + * containment reference list feature. <!-- begin-user-doc --> <!-- + * end-user-doc --> + * + * @generated + */ + EReference MODEL_CELL_EDITOR_DECLARATIONS__MODEL_CELL_EDITORS = ModelCellEditorPackage.eINSTANCE + .getModelCellEditorDeclarations_ModelCellEditors(); + + /** + * The meta object literal for the ' + * {@link org.eclipse.modisco.facet.widgets.celleditors.modelCellEditor.impl.AbstractModelCellEditorImpl + * <em>Abstract Model Cell Editor</em>}' class. <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @see org.eclipse.modisco.facet.widgets.celleditors.modelCellEditor.impl.AbstractModelCellEditorImpl + * @see org.eclipse.modisco.facet.widgets.celleditors.modelCellEditor.impl.ModelCellEditorPackageImpl#getAbstractModelCellEditor() + * @generated + */ + EClass ABSTRACT_MODEL_CELL_EDITOR = ModelCellEditorPackage.eINSTANCE + .getAbstractModelCellEditor(); + + /** + * The meta object literal for the '<em><b>Cell Type</b></em>' reference + * feature. <!-- begin-user-doc --> <!-- end-user-doc --> + * + * @generated + */ + EReference ABSTRACT_MODEL_CELL_EDITOR__CELL_TYPE = ModelCellEditorPackage.eINSTANCE + .getAbstractModelCellEditor_CellType(); + + /** + * The meta object literal for the '<em><b>Cell Id</b></em>' attribute + * feature. <!-- begin-user-doc --> <!-- end-user-doc --> + * + * @generated + */ + EAttribute ABSTRACT_MODEL_CELL_EDITOR__CELL_ID = ModelCellEditorPackage.eINSTANCE + .getAbstractModelCellEditor_CellId(); + + /** + * The meta object literal for the ' + * {@link org.eclipse.modisco.facet.widgets.celleditors.modelCellEditor.impl.BasicCellEditorImpl + * <em>Basic Cell Editor</em>}' class. <!-- begin-user-doc --> <!-- + * end-user-doc --> + * + * @see org.eclipse.modisco.facet.widgets.celleditors.modelCellEditor.impl.BasicCellEditorImpl + * @see org.eclipse.modisco.facet.widgets.celleditors.modelCellEditor.impl.ModelCellEditorPackageImpl#getBasicCellEditor() + * @generated + */ + EClass BASIC_CELL_EDITOR = ModelCellEditorPackage.eINSTANCE.getBasicCellEditor(); + + /** + * The meta object literal for the ' + * <em><b>Basic Cell Editor Impl</b></em>' attribute feature. <!-- + * begin-user-doc --> <!-- end-user-doc --> + * + * @generated + */ + EAttribute BASIC_CELL_EDITOR__BASIC_CELL_EDITOR_IMPL = ModelCellEditorPackage.eINSTANCE + .getBasicCellEditor_BasicCellEditorImpl(); + + /** + * The meta object literal for the ' + * {@link org.eclipse.modisco.facet.widgets.celleditors.modelCellEditor.impl.UnaryReferenceCellEditorImpl + * <em>Unary Reference Cell Editor</em>}' class. <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @see org.eclipse.modisco.facet.widgets.celleditors.modelCellEditor.impl.UnaryReferenceCellEditorImpl + * @see org.eclipse.modisco.facet.widgets.celleditors.modelCellEditor.impl.ModelCellEditorPackageImpl#getUnaryReferenceCellEditor() + * @generated + */ + EClass UNARY_REFERENCE_CELL_EDITOR = ModelCellEditorPackage.eINSTANCE + .getUnaryReferenceCellEditor(); + + /** + * The meta object literal for the ' + * <em><b>Unary Reference Cell Editor Impl</b></em>' attribute feature. + * <!-- begin-user-doc --> <!-- end-user-doc --> + * + * @generated + */ + EAttribute UNARY_REFERENCE_CELL_EDITOR__UNARY_REFERENCE_CELL_EDITOR_IMPL = ModelCellEditorPackage.eINSTANCE + .getUnaryReferenceCellEditor_UnaryReferenceCellEditorImpl(); + + /** + * The meta object literal for the ' + * {@link org.eclipse.modisco.facet.widgets.celleditors.modelCellEditor.impl.NaryFeatureCellEditorImpl + * <em>Nary Feature Cell Editor</em>}' class. <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @see org.eclipse.modisco.facet.widgets.celleditors.modelCellEditor.impl.NaryFeatureCellEditorImpl + * @see org.eclipse.modisco.facet.widgets.celleditors.modelCellEditor.impl.ModelCellEditorPackageImpl#getNaryFeatureCellEditor() + * @generated + */ + EClass NARY_FEATURE_CELL_EDITOR = ModelCellEditorPackage.eINSTANCE + .getNaryFeatureCellEditor(); + + /** + * The meta object literal for the ' + * <em><b>Nary Feature Cell Editor Impl</b></em>' attribute feature. + * <!-- begin-user-doc --> <!-- end-user-doc --> + * + * @generated + */ + EAttribute NARY_FEATURE_CELL_EDITOR__NARY_FEATURE_CELL_EDITOR_IMPL = ModelCellEditorPackage.eINSTANCE + .getNaryFeatureCellEditor_NaryFeatureCellEditorImpl(); + + } + +} // ModelCellEditorPackage
diff --git a/org.eclipse.modisco.facet.widgets.celleditors/src/org/eclipse/modisco/facet/widgets/celleditors/modelCellEditor/NaryFeatureCellEditor.java b/org.eclipse.modisco.facet.widgets.celleditors/src/org/eclipse/modisco/facet/widgets/celleditors/modelCellEditor/NaryFeatureCellEditor.java new file mode 100644 index 0000000..ba61df1 --- /dev/null +++ b/org.eclipse.modisco.facet.widgets.celleditors/src/org/eclipse/modisco/facet/widgets/celleditors/modelCellEditor/NaryFeatureCellEditor.java
@@ -0,0 +1,64 @@ +/** + * Copyright (c) 2010 CEA LIST. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Nicolas Bros (Mia-Software) - initial API and implementation + */ +package org.eclipse.modisco.facet.widgets.celleditors.modelCellEditor; + +/** + * <!-- begin-user-doc --> A representation of the model object ' + * <em><b>Nary Feature Cell Editor</b></em>'. <!-- end-user-doc --> + * + * <p> + * The following features are supported: + * <ul> + * <li> + * {@link org.eclipse.modisco.facet.widgets.celleditors.modelCellEditor.NaryFeatureCellEditor#getNaryFeatureCellEditorImpl + * <em>Nary Feature Cell Editor Impl</em>}</li> + * </ul> + * </p> + * + * @see org.eclipse.modisco.facet.widgets.celleditors.modelCellEditor.ModelCellEditorPackage#getNaryFeatureCellEditor() + * @model + * @generated + */ +public interface NaryFeatureCellEditor extends AbstractModelCellEditor { + /** + * Returns the value of the '<em><b>Nary Feature Cell Editor Impl</b></em>' + * attribute. <!-- begin-user-doc --> + * <p> + * If the meaning of the '<em>Nary Feature Cell Editor Impl</em>' attribute + * isn't clear, there really should be more of a description here... + * </p> + * <!-- end-user-doc --> + * + * @return the value of the '<em>Nary Feature Cell Editor Impl</em>' + * attribute. + * @see #setNaryFeatureCellEditorImpl(String) + * @see org.eclipse.modisco.facet.widgets.celleditors.modelCellEditor.ModelCellEditorPackage#getNaryFeatureCellEditor_NaryFeatureCellEditorImpl() + * @model required="true" + * @generated + */ + String getNaryFeatureCellEditorImpl(); + + /** + * Sets the value of the ' + * {@link org.eclipse.modisco.facet.widgets.celleditors.modelCellEditor.NaryFeatureCellEditor#getNaryFeatureCellEditorImpl + * <em>Nary Feature Cell Editor Impl</em>}' attribute. <!-- begin-user-doc + * --> <!-- end-user-doc --> + * + * @param value + * the new value of the '<em>Nary Feature Cell Editor Impl</em>' + * attribute. + * @see #getNaryFeatureCellEditorImpl() + * @generated + */ + void setNaryFeatureCellEditorImpl(String value); + +} // NaryFeatureCellEditor
diff --git a/org.eclipse.modisco.facet.widgets.celleditors/src/org/eclipse/modisco/facet/widgets/celleditors/modelCellEditor/UnaryReferenceCellEditor.java b/org.eclipse.modisco.facet.widgets.celleditors/src/org/eclipse/modisco/facet/widgets/celleditors/modelCellEditor/UnaryReferenceCellEditor.java new file mode 100644 index 0000000..a4be4e2 --- /dev/null +++ b/org.eclipse.modisco.facet.widgets.celleditors/src/org/eclipse/modisco/facet/widgets/celleditors/modelCellEditor/UnaryReferenceCellEditor.java
@@ -0,0 +1,66 @@ +/** + * Copyright (c) 2010 CEA LIST. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Nicolas Bros (Mia-Software) - initial API and implementation + */ +package org.eclipse.modisco.facet.widgets.celleditors.modelCellEditor; + +/** + * <!-- begin-user-doc --> A representation of the model object ' + * <em><b>Unary Reference Cell Editor</b></em>'. <!-- end-user-doc --> + * + * <p> + * The following features are supported: + * <ul> + * <li> + * {@link org.eclipse.modisco.facet.widgets.celleditors.modelCellEditor.UnaryReferenceCellEditor#getUnaryReferenceCellEditorImpl + * <em>Unary Reference Cell Editor Impl</em>}</li> + * </ul> + * </p> + * + * @see org.eclipse.modisco.facet.widgets.celleditors.modelCellEditor.ModelCellEditorPackage#getUnaryReferenceCellEditor() + * @model + * @generated + */ +public interface UnaryReferenceCellEditor extends AbstractModelCellEditor { + /** + * Returns the value of the ' + * <em><b>Unary Reference Cell Editor Impl</b></em>' attribute. <!-- + * begin-user-doc --> + * <p> + * If the meaning of the '<em>Unary Reference Cell Editor Impl</em>' + * attribute isn't clear, there really should be more of a description + * here... + * </p> + * <!-- end-user-doc --> + * + * @return the value of the '<em>Unary Reference Cell Editor Impl</em>' + * attribute. + * @see #setUnaryReferenceCellEditorImpl(String) + * @see org.eclipse.modisco.facet.widgets.celleditors.modelCellEditor.ModelCellEditorPackage#getUnaryReferenceCellEditor_UnaryReferenceCellEditorImpl() + * @model required="true" + * @generated + */ + String getUnaryReferenceCellEditorImpl(); + + /** + * Sets the value of the ' + * {@link org.eclipse.modisco.facet.widgets.celleditors.modelCellEditor.UnaryReferenceCellEditor#getUnaryReferenceCellEditorImpl + * <em>Unary Reference Cell Editor Impl</em>}' attribute. <!-- + * begin-user-doc --> <!-- end-user-doc --> + * + * @param value + * the new value of the ' + * <em>Unary Reference Cell Editor Impl</em>' attribute. + * @see #getUnaryReferenceCellEditorImpl() + * @generated + */ + void setUnaryReferenceCellEditorImpl(String value); + +} // UnaryReferenceCellEditor
diff --git a/org.eclipse.modisco.facet.widgets.celleditors/src/org/eclipse/modisco/facet/widgets/celleditors/modelCellEditor/impl/AbstractModelCellEditorImpl.java b/org.eclipse.modisco.facet.widgets.celleditors/src/org/eclipse/modisco/facet/widgets/celleditors/modelCellEditor/impl/AbstractModelCellEditorImpl.java new file mode 100644 index 0000000..04fea94 --- /dev/null +++ b/org.eclipse.modisco.facet.widgets.celleditors/src/org/eclipse/modisco/facet/widgets/celleditors/modelCellEditor/impl/AbstractModelCellEditorImpl.java
@@ -0,0 +1,260 @@ +/** + * Copyright (c) 2010 CEA LIST. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Nicolas Bros (Mia-Software) - initial API and implementation + */ +package org.eclipse.modisco.facet.widgets.celleditors.modelCellEditor.impl; + +import org.eclipse.emf.common.notify.Notification; +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.EClassifier; +import org.eclipse.emf.ecore.InternalEObject; +import org.eclipse.emf.ecore.impl.ENotificationImpl; +import org.eclipse.emf.ecore.impl.EObjectImpl; +import org.eclipse.modisco.facet.widgets.celleditors.modelCellEditor.AbstractModelCellEditor; +import org.eclipse.modisco.facet.widgets.celleditors.modelCellEditor.ModelCellEditorPackage; + +/** + * <!-- begin-user-doc --> An implementation of the model object ' + * <em><b>Abstract Model Cell Editor</b></em>'. <!-- end-user-doc --> + * <p> + * The following features are implemented: + * <ul> + * <li> + * {@link org.eclipse.modisco.facet.widgets.celleditors.modelCellEditor.impl.AbstractModelCellEditorImpl#getCellType + * <em>Cell Type</em>}</li> + * <li> + * {@link org.eclipse.modisco.facet.widgets.celleditors.modelCellEditor.impl.AbstractModelCellEditorImpl#getCellId + * <em>Cell Id</em>}</li> + * </ul> + * </p> + * + * @generated + */ +public abstract class AbstractModelCellEditorImpl extends EObjectImpl implements + AbstractModelCellEditor { + /** + * The cached value of the '{@link #getCellType() <em>Cell Type</em>}' + * reference. <!-- begin-user-doc --> <!-- end-user-doc --> + * + * @see #getCellType() + * @generated + * @ordered + */ + protected EClassifier cellType; + + /** + * The default value of the '{@link #getCellId() <em>Cell Id</em>}' + * attribute. <!-- begin-user-doc --> <!-- end-user-doc --> + * + * @see #getCellId() + * @generated + * @ordered + */ + protected static final String CELL_ID_EDEFAULT = null; + + /** + * The cached value of the '{@link #getCellId() <em>Cell Id</em>}' + * attribute. <!-- begin-user-doc --> <!-- end-user-doc --> + * + * @see #getCellId() + * @generated + * @ordered + */ + protected String cellId = AbstractModelCellEditorImpl.CELL_ID_EDEFAULT; + + /** + * <!-- begin-user-doc --> <!-- end-user-doc --> + * + * @generated + */ + protected AbstractModelCellEditorImpl() { + super(); + } + + /** + * <!-- begin-user-doc --> <!-- end-user-doc --> + * + * @generated + */ + @Override + protected EClass eStaticClass() { + return ModelCellEditorPackage.Literals.ABSTRACT_MODEL_CELL_EDITOR; + } + + /** + * <!-- begin-user-doc --> <!-- end-user-doc --> + * + * @generated + */ + public EClassifier getCellType() { + if (this.cellType != null && this.cellType.eIsProxy()) { + InternalEObject oldCellType = (InternalEObject) this.cellType; + this.cellType = (EClassifier) eResolveProxy(oldCellType); + if (this.cellType != oldCellType) { + if (eNotificationRequired()) { + eNotify(new ENotificationImpl(this, Notification.RESOLVE, + ModelCellEditorPackage.ABSTRACT_MODEL_CELL_EDITOR__CELL_TYPE, + oldCellType, this.cellType)); + } + } + } + return this.cellType; + } + + /** + * <!-- begin-user-doc --> <!-- end-user-doc --> + * + * @generated + */ + public EClassifier basicGetCellType() { + return this.cellType; + } + + /** + * <!-- begin-user-doc --> <!-- end-user-doc --> + * + * @generated + */ + public void setCellType(final EClassifier newCellType) { + EClassifier oldCellType = this.cellType; + this.cellType = newCellType; + if (eNotificationRequired()) { + eNotify(new ENotificationImpl(this, Notification.SET, + ModelCellEditorPackage.ABSTRACT_MODEL_CELL_EDITOR__CELL_TYPE, oldCellType, + this.cellType)); + } + } + + /** + * <!-- begin-user-doc --> <!-- end-user-doc --> + * + * @generated + */ + public String getCellId() { + return this.cellId; + } + + /** + * <!-- begin-user-doc --> <!-- end-user-doc --> + * + * @generated + */ + public void setCellId(final String newCellId) { + String oldCellId = this.cellId; + this.cellId = newCellId; + if (eNotificationRequired()) { + eNotify(new ENotificationImpl(this, Notification.SET, + ModelCellEditorPackage.ABSTRACT_MODEL_CELL_EDITOR__CELL_ID, oldCellId, + this.cellId)); + } + } + + /** + * <!-- begin-user-doc --> <!-- end-user-doc --> + * + * @generated + */ + public String getModelCellEditorImpl() { + // TODO: implement this method + // Ensure that you remove @generated or mark it @generated NOT + throw new UnsupportedOperationException(); + } + + /** + * <!-- begin-user-doc --> <!-- end-user-doc --> + * + * @generated + */ + @Override + public Object eGet(final int featureID, final boolean resolve, final boolean coreType) { + switch (featureID) { + case ModelCellEditorPackage.ABSTRACT_MODEL_CELL_EDITOR__CELL_TYPE: + if (resolve) { + return getCellType(); + } + return basicGetCellType(); + case ModelCellEditorPackage.ABSTRACT_MODEL_CELL_EDITOR__CELL_ID: + return getCellId(); + } + return super.eGet(featureID, resolve, coreType); + } + + /** + * <!-- begin-user-doc --> <!-- end-user-doc --> + * + * @generated + */ + @Override + public void eSet(final int featureID, final Object newValue) { + switch (featureID) { + case ModelCellEditorPackage.ABSTRACT_MODEL_CELL_EDITOR__CELL_TYPE: + setCellType((EClassifier) newValue); + return; + case ModelCellEditorPackage.ABSTRACT_MODEL_CELL_EDITOR__CELL_ID: + setCellId((String) newValue); + return; + } + super.eSet(featureID, newValue); + } + + /** + * <!-- begin-user-doc --> <!-- end-user-doc --> + * + * @generated + */ + @Override + public void eUnset(final int featureID) { + switch (featureID) { + case ModelCellEditorPackage.ABSTRACT_MODEL_CELL_EDITOR__CELL_TYPE: + setCellType((EClassifier) null); + return; + case ModelCellEditorPackage.ABSTRACT_MODEL_CELL_EDITOR__CELL_ID: + setCellId(AbstractModelCellEditorImpl.CELL_ID_EDEFAULT); + return; + } + super.eUnset(featureID); + } + + /** + * <!-- begin-user-doc --> <!-- end-user-doc --> + * + * @generated + */ + @Override + public boolean eIsSet(final int featureID) { + switch (featureID) { + case ModelCellEditorPackage.ABSTRACT_MODEL_CELL_EDITOR__CELL_TYPE: + return this.cellType != null; + case ModelCellEditorPackage.ABSTRACT_MODEL_CELL_EDITOR__CELL_ID: + return AbstractModelCellEditorImpl.CELL_ID_EDEFAULT == null ? this.cellId != null + : !AbstractModelCellEditorImpl.CELL_ID_EDEFAULT.equals(this.cellId); + } + return super.eIsSet(featureID); + } + + /** + * <!-- begin-user-doc --> <!-- end-user-doc --> + * + * @generated + */ + @Override + public String toString() { + if (eIsProxy()) { + return super.toString(); + } + + StringBuffer result = new StringBuffer(super.toString()); + result.append(" (cellId: "); //$NON-NLS-1$ + result.append(this.cellId); + result.append(')'); + return result.toString(); + } + +} // AbstractModelCellEditorImpl
diff --git a/org.eclipse.modisco.facet.widgets.celleditors/src/org/eclipse/modisco/facet/widgets/celleditors/modelCellEditor/impl/BasicCellEditorImpl.java b/org.eclipse.modisco.facet.widgets.celleditors/src/org/eclipse/modisco/facet/widgets/celleditors/modelCellEditor/impl/BasicCellEditorImpl.java new file mode 100644 index 0000000..8c1fe8c --- /dev/null +++ b/org.eclipse.modisco.facet.widgets.celleditors/src/org/eclipse/modisco/facet/widgets/celleditors/modelCellEditor/impl/BasicCellEditorImpl.java
@@ -0,0 +1,184 @@ +/** + * Copyright (c) 2010 CEA LIST. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Nicolas Bros (Mia-Software) - initial API and implementation + */ +package org.eclipse.modisco.facet.widgets.celleditors.modelCellEditor.impl; + +import org.eclipse.emf.common.notify.Notification; +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.impl.ENotificationImpl; +import org.eclipse.modisco.facet.widgets.celleditors.modelCellEditor.BasicCellEditor; +import org.eclipse.modisco.facet.widgets.celleditors.modelCellEditor.ModelCellEditorPackage; + +/** + * <!-- begin-user-doc --> An implementation of the model object ' + * <em><b>Basic Cell Editor</b></em>'. <!-- end-user-doc --> + * <p> + * The following features are implemented: + * <ul> + * <li> + * {@link org.eclipse.modisco.facet.widgets.celleditors.modelCellEditor.impl.BasicCellEditorImpl#getBasicCellEditorImpl + * <em>Basic Cell Editor Impl</em>}</li> + * </ul> + * </p> + * + * @generated + */ +public class BasicCellEditorImpl extends AbstractModelCellEditorImpl implements BasicCellEditor { + /** + * The default value of the '{@link #getBasicCellEditorImpl() + * <em>Basic Cell Editor Impl</em>}' attribute. <!-- begin-user-doc --> <!-- + * end-user-doc --> + * + * @see #getBasicCellEditorImpl() + * @generated + * @ordered + */ + protected static final String BASIC_CELL_EDITOR_IMPL_EDEFAULT = null; + + /** + * The cached value of the '{@link #getBasicCellEditorImpl() + * <em>Basic Cell Editor Impl</em>}' attribute. <!-- begin-user-doc --> <!-- + * end-user-doc --> + * + * @see #getBasicCellEditorImpl() + * @generated + * @ordered + */ + protected String basicCellEditorImpl = BasicCellEditorImpl.BASIC_CELL_EDITOR_IMPL_EDEFAULT; + + /** + * <!-- begin-user-doc --> <!-- end-user-doc --> + * + * @generated + */ + protected BasicCellEditorImpl() { + super(); + } + + /** + * <!-- begin-user-doc --> <!-- end-user-doc --> + * + * @generated + */ + @Override + protected EClass eStaticClass() { + return ModelCellEditorPackage.Literals.BASIC_CELL_EDITOR; + } + + /** + * <!-- begin-user-doc --> <!-- end-user-doc --> + * + * @generated + */ + public String getBasicCellEditorImpl() { + return this.basicCellEditorImpl; + } + + /** + * <!-- begin-user-doc --> <!-- end-user-doc --> + * + * @generated + */ + public void setBasicCellEditorImpl(final String newBasicCellEditorImpl) { + String oldBasicCellEditorImpl = this.basicCellEditorImpl; + this.basicCellEditorImpl = newBasicCellEditorImpl; + if (eNotificationRequired()) { + eNotify(new ENotificationImpl(this, Notification.SET, + ModelCellEditorPackage.BASIC_CELL_EDITOR__BASIC_CELL_EDITOR_IMPL, + oldBasicCellEditorImpl, this.basicCellEditorImpl)); + } + } + + /** + * <!-- begin-user-doc --> <!-- end-user-doc --> + * + * @generated + */ + @Override + public Object eGet(final int featureID, final boolean resolve, final boolean coreType) { + switch (featureID) { + case ModelCellEditorPackage.BASIC_CELL_EDITOR__BASIC_CELL_EDITOR_IMPL: + return getBasicCellEditorImpl(); + } + return super.eGet(featureID, resolve, coreType); + } + + /** + * <!-- begin-user-doc --> <!-- end-user-doc --> + * + * @generated + */ + @Override + public void eSet(final int featureID, final Object newValue) { + switch (featureID) { + case ModelCellEditorPackage.BASIC_CELL_EDITOR__BASIC_CELL_EDITOR_IMPL: + setBasicCellEditorImpl((String) newValue); + return; + } + super.eSet(featureID, newValue); + } + + /** + * <!-- begin-user-doc --> <!-- end-user-doc --> + * + * @generated + */ + @Override + public void eUnset(final int featureID) { + switch (featureID) { + case ModelCellEditorPackage.BASIC_CELL_EDITOR__BASIC_CELL_EDITOR_IMPL: + setBasicCellEditorImpl(BasicCellEditorImpl.BASIC_CELL_EDITOR_IMPL_EDEFAULT); + return; + } + super.eUnset(featureID); + } + + /** + * <!-- begin-user-doc --> <!-- end-user-doc --> + * + * @generated + */ + @Override + public boolean eIsSet(final int featureID) { + switch (featureID) { + case ModelCellEditorPackage.BASIC_CELL_EDITOR__BASIC_CELL_EDITOR_IMPL: + return BasicCellEditorImpl.BASIC_CELL_EDITOR_IMPL_EDEFAULT == null ? this.basicCellEditorImpl != null + : !BasicCellEditorImpl.BASIC_CELL_EDITOR_IMPL_EDEFAULT + .equals(this.basicCellEditorImpl); + } + return super.eIsSet(featureID); + } + + /** + * <!-- begin-user-doc --> <!-- end-user-doc --> + * + * @generated + */ + @Override + public String toString() { + if (eIsProxy()) { + return super.toString(); + } + + StringBuffer result = new StringBuffer(super.toString()); + result.append(" (basicCellEditorImpl: "); //$NON-NLS-1$ + result.append(this.basicCellEditorImpl); + result.append(')'); + return result.toString(); + } + + /** @generated NOT */ + @Override + public String getModelCellEditorImpl() { + return getBasicCellEditorImpl(); + } + +} // BasicCellEditorImpl
diff --git a/org.eclipse.modisco.facet.widgets.celleditors/src/org/eclipse/modisco/facet/widgets/celleditors/modelCellEditor/impl/ModelCellEditorDeclarationsImpl.java b/org.eclipse.modisco.facet.widgets.celleditors/src/org/eclipse/modisco/facet/widgets/celleditors/modelCellEditor/impl/ModelCellEditorDeclarationsImpl.java new file mode 100644 index 0000000..15f7557 --- /dev/null +++ b/org.eclipse.modisco.facet.widgets.celleditors/src/org/eclipse/modisco/facet/widgets/celleditors/modelCellEditor/impl/ModelCellEditorDeclarationsImpl.java
@@ -0,0 +1,162 @@ +/** + * Copyright (c) 2010 CEA LIST. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Nicolas Bros (Mia-Software) - initial API and implementation + */ +package org.eclipse.modisco.facet.widgets.celleditors.modelCellEditor.impl; + +import java.util.Collection; + +import org.eclipse.emf.common.notify.NotificationChain; +import org.eclipse.emf.common.util.EList; +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.InternalEObject; +import org.eclipse.emf.ecore.impl.EObjectImpl; +import org.eclipse.emf.ecore.util.EObjectContainmentEList; +import org.eclipse.emf.ecore.util.InternalEList; +import org.eclipse.modisco.facet.widgets.celleditors.modelCellEditor.AbstractModelCellEditor; +import org.eclipse.modisco.facet.widgets.celleditors.modelCellEditor.ModelCellEditorDeclarations; +import org.eclipse.modisco.facet.widgets.celleditors.modelCellEditor.ModelCellEditorPackage; + +/** + * <!-- begin-user-doc --> An implementation of the model object ' + * <em><b>Declarations</b></em>'. <!-- end-user-doc --> + * <p> + * The following features are implemented: + * <ul> + * <li> + * {@link org.eclipse.modisco.facet.widgets.celleditors.modelCellEditor.impl.ModelCellEditorDeclarationsImpl#getModelCellEditors + * <em>Model Cell Editors</em>}</li> + * </ul> + * </p> + * + * @generated + */ +public class ModelCellEditorDeclarationsImpl extends EObjectImpl implements + ModelCellEditorDeclarations { + /** + * The cached value of the '{@link #getModelCellEditors() + * <em>Model Cell Editors</em>}' containment reference list. <!-- + * begin-user-doc --> <!-- end-user-doc --> + * + * @see #getModelCellEditors() + * @generated + * @ordered + */ + protected EList<AbstractModelCellEditor> modelCellEditors; + + /** + * <!-- begin-user-doc --> <!-- end-user-doc --> + * + * @generated + */ + protected ModelCellEditorDeclarationsImpl() { + super(); + } + + /** + * <!-- begin-user-doc --> <!-- end-user-doc --> + * + * @generated + */ + @Override + protected EClass eStaticClass() { + return ModelCellEditorPackage.Literals.MODEL_CELL_EDITOR_DECLARATIONS; + } + + /** + * <!-- begin-user-doc --> <!-- end-user-doc --> + * + * @generated + */ + public EList<AbstractModelCellEditor> getModelCellEditors() { + if (this.modelCellEditors == null) { + this.modelCellEditors = new EObjectContainmentEList<AbstractModelCellEditor>( + AbstractModelCellEditor.class, this, + ModelCellEditorPackage.MODEL_CELL_EDITOR_DECLARATIONS__MODEL_CELL_EDITORS); + } + return this.modelCellEditors; + } + + /** + * <!-- begin-user-doc --> <!-- end-user-doc --> + * + * @generated + */ + @Override + public NotificationChain eInverseRemove(final InternalEObject otherEnd, final int featureID, + final NotificationChain msgs) { + switch (featureID) { + case ModelCellEditorPackage.MODEL_CELL_EDITOR_DECLARATIONS__MODEL_CELL_EDITORS: + return ((InternalEList<?>) getModelCellEditors()).basicRemove(otherEnd, msgs); + } + return super.eInverseRemove(otherEnd, featureID, msgs); + } + + /** + * <!-- begin-user-doc --> <!-- end-user-doc --> + * + * @generated + */ + @Override + public Object eGet(final int featureID, final boolean resolve, final boolean coreType) { + switch (featureID) { + case ModelCellEditorPackage.MODEL_CELL_EDITOR_DECLARATIONS__MODEL_CELL_EDITORS: + return getModelCellEditors(); + } + return super.eGet(featureID, resolve, coreType); + } + + /** + * <!-- begin-user-doc --> <!-- end-user-doc --> + * + * @generated + */ + @SuppressWarnings("unchecked") + @Override + public void eSet(final int featureID, final Object newValue) { + switch (featureID) { + case ModelCellEditorPackage.MODEL_CELL_EDITOR_DECLARATIONS__MODEL_CELL_EDITORS: + getModelCellEditors().clear(); + getModelCellEditors().addAll((Collection<? extends AbstractModelCellEditor>) newValue); + return; + } + super.eSet(featureID, newValue); + } + + /** + * <!-- begin-user-doc --> <!-- end-user-doc --> + * + * @generated + */ + @Override + public void eUnset(final int featureID) { + switch (featureID) { + case ModelCellEditorPackage.MODEL_CELL_EDITOR_DECLARATIONS__MODEL_CELL_EDITORS: + getModelCellEditors().clear(); + return; + } + super.eUnset(featureID); + } + + /** + * <!-- begin-user-doc --> <!-- end-user-doc --> + * + * @generated + */ + @Override + public boolean eIsSet(final int featureID) { + switch (featureID) { + case ModelCellEditorPackage.MODEL_CELL_EDITOR_DECLARATIONS__MODEL_CELL_EDITORS: + return this.modelCellEditors != null && !this.modelCellEditors.isEmpty(); + } + return super.eIsSet(featureID); + } + +} // ModelCellEditorDeclarationsImpl
diff --git a/org.eclipse.modisco.facet.widgets.celleditors/src/org/eclipse/modisco/facet/widgets/celleditors/modelCellEditor/impl/ModelCellEditorFactoryImpl.java b/org.eclipse.modisco.facet.widgets.celleditors/src/org/eclipse/modisco/facet/widgets/celleditors/modelCellEditor/impl/ModelCellEditorFactoryImpl.java new file mode 100644 index 0000000..9479745 --- /dev/null +++ b/org.eclipse.modisco.facet.widgets.celleditors/src/org/eclipse/modisco/facet/widgets/celleditors/modelCellEditor/impl/ModelCellEditorFactoryImpl.java
@@ -0,0 +1,144 @@ +/** + * Copyright (c) 2010 CEA LIST. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Nicolas Bros (Mia-Software) - initial API and implementation + */ +package org.eclipse.modisco.facet.widgets.celleditors.modelCellEditor.impl; + +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.ecore.EPackage; +import org.eclipse.emf.ecore.impl.EFactoryImpl; +import org.eclipse.emf.ecore.plugin.EcorePlugin; +import org.eclipse.modisco.facet.widgets.celleditors.modelCellEditor.BasicCellEditor; +import org.eclipse.modisco.facet.widgets.celleditors.modelCellEditor.ModelCellEditorDeclarations; +import org.eclipse.modisco.facet.widgets.celleditors.modelCellEditor.ModelCellEditorFactory; +import org.eclipse.modisco.facet.widgets.celleditors.modelCellEditor.ModelCellEditorPackage; +import org.eclipse.modisco.facet.widgets.celleditors.modelCellEditor.NaryFeatureCellEditor; +import org.eclipse.modisco.facet.widgets.celleditors.modelCellEditor.UnaryReferenceCellEditor; + +/** + * <!-- begin-user-doc --> An implementation of the model <b>Factory</b>. <!-- + * end-user-doc --> + * + * @generated + */ +public class ModelCellEditorFactoryImpl extends EFactoryImpl implements ModelCellEditorFactory { + /** + * Creates the default factory implementation. <!-- begin-user-doc --> <!-- + * end-user-doc --> + * + * @generated + */ + public static ModelCellEditorFactory init() { + try { + ModelCellEditorFactory theModelCellEditorFactory = (ModelCellEditorFactory) EPackage.Registry.INSTANCE + .getEFactory("http://www.eclipse.org/EMF_Facet/ModelCellEditor/0.1.0/modelCellEditor"); //$NON-NLS-1$ + if (theModelCellEditorFactory != null) { + return theModelCellEditorFactory; + } + } catch (Exception exception) { + EcorePlugin.INSTANCE.log(exception); + } + return new ModelCellEditorFactoryImpl(); + } + + /** + * Creates an instance of the factory. <!-- begin-user-doc --> <!-- + * end-user-doc --> + * + * @generated + */ + public ModelCellEditorFactoryImpl() { + super(); + } + + /** + * <!-- begin-user-doc --> <!-- end-user-doc --> + * + * @generated + */ + @Override + public EObject create(final EClass eClass) { + switch (eClass.getClassifierID()) { + case ModelCellEditorPackage.MODEL_CELL_EDITOR_DECLARATIONS: + return createModelCellEditorDeclarations(); + case ModelCellEditorPackage.BASIC_CELL_EDITOR: + return createBasicCellEditor(); + case ModelCellEditorPackage.UNARY_REFERENCE_CELL_EDITOR: + return createUnaryReferenceCellEditor(); + case ModelCellEditorPackage.NARY_FEATURE_CELL_EDITOR: + return createNaryFeatureCellEditor(); + default: + throw new IllegalArgumentException("The class '" + eClass.getName() //$NON-NLS-1$ + + "' is not a valid classifier"); //$NON-NLS-1$ + } + } + + /** + * <!-- begin-user-doc --> <!-- end-user-doc --> + * + * @generated + */ + public ModelCellEditorDeclarations createModelCellEditorDeclarations() { + ModelCellEditorDeclarationsImpl modelCellEditorDeclarations = new ModelCellEditorDeclarationsImpl(); + return modelCellEditorDeclarations; + } + + /** + * <!-- begin-user-doc --> <!-- end-user-doc --> + * + * @generated + */ + public BasicCellEditor createBasicCellEditor() { + BasicCellEditorImpl basicCellEditor = new BasicCellEditorImpl(); + return basicCellEditor; + } + + /** + * <!-- begin-user-doc --> <!-- end-user-doc --> + * + * @generated + */ + public UnaryReferenceCellEditor createUnaryReferenceCellEditor() { + UnaryReferenceCellEditorImpl unaryReferenceCellEditor = new UnaryReferenceCellEditorImpl(); + return unaryReferenceCellEditor; + } + + /** + * <!-- begin-user-doc --> <!-- end-user-doc --> + * + * @generated + */ + public NaryFeatureCellEditor createNaryFeatureCellEditor() { + NaryFeatureCellEditorImpl naryFeatureCellEditor = new NaryFeatureCellEditorImpl(); + return naryFeatureCellEditor; + } + + /** + * <!-- begin-user-doc --> <!-- end-user-doc --> + * + * @generated + */ + public ModelCellEditorPackage getModelCellEditorPackage() { + return (ModelCellEditorPackage) getEPackage(); + } + + /** + * <!-- begin-user-doc --> <!-- end-user-doc --> + * + * @deprecated + * @generated + */ + @Deprecated + public static ModelCellEditorPackage getPackage() { + return ModelCellEditorPackage.eINSTANCE; + } + +} // ModelCellEditorFactoryImpl
diff --git a/org.eclipse.modisco.facet.widgets.celleditors/src/org/eclipse/modisco/facet/widgets/celleditors/modelCellEditor/impl/ModelCellEditorPackageImpl.java b/org.eclipse.modisco.facet.widgets.celleditors/src/org/eclipse/modisco/facet/widgets/celleditors/modelCellEditor/impl/ModelCellEditorPackageImpl.java new file mode 100644 index 0000000..855ff11 --- /dev/null +++ b/org.eclipse.modisco.facet.widgets.celleditors/src/org/eclipse/modisco/facet/widgets/celleditors/modelCellEditor/impl/ModelCellEditorPackageImpl.java
@@ -0,0 +1,397 @@ +/** + * Copyright (c) 2010 CEA LIST. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Nicolas Bros (Mia-Software) - initial API and implementation + */ +package org.eclipse.modisco.facet.widgets.celleditors.modelCellEditor.impl; + +import org.eclipse.emf.ecore.EAttribute; +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.EPackage; +import org.eclipse.emf.ecore.EReference; +import org.eclipse.emf.ecore.impl.EPackageImpl; +import org.eclipse.modisco.facet.widgets.celleditors.modelCellEditor.AbstractModelCellEditor; +import org.eclipse.modisco.facet.widgets.celleditors.modelCellEditor.BasicCellEditor; +import org.eclipse.modisco.facet.widgets.celleditors.modelCellEditor.ModelCellEditorDeclarations; +import org.eclipse.modisco.facet.widgets.celleditors.modelCellEditor.ModelCellEditorFactory; +import org.eclipse.modisco.facet.widgets.celleditors.modelCellEditor.ModelCellEditorPackage; +import org.eclipse.modisco.facet.widgets.celleditors.modelCellEditor.NaryFeatureCellEditor; +import org.eclipse.modisco.facet.widgets.celleditors.modelCellEditor.UnaryReferenceCellEditor; + +/** + * <!-- begin-user-doc --> An implementation of the model <b>Package</b>. <!-- + * end-user-doc --> + * + * @generated + */ +public class ModelCellEditorPackageImpl extends EPackageImpl implements ModelCellEditorPackage { + /** + * <!-- begin-user-doc --> <!-- end-user-doc --> + * + * @generated + */ + private EClass modelCellEditorDeclarationsEClass = null; + + /** + * <!-- begin-user-doc --> <!-- end-user-doc --> + * + * @generated + */ + private EClass abstractModelCellEditorEClass = null; + + /** + * <!-- begin-user-doc --> <!-- end-user-doc --> + * + * @generated + */ + private EClass basicCellEditorEClass = null; + + /** + * <!-- begin-user-doc --> <!-- end-user-doc --> + * + * @generated + */ + private EClass unaryReferenceCellEditorEClass = null; + + /** + * <!-- begin-user-doc --> <!-- end-user-doc --> + * + * @generated + */ + private EClass naryFeatureCellEditorEClass = null; + + /** + * Creates an instance of the model <b>Package</b>, registered with + * {@link org.eclipse.emf.ecore.EPackage.Registry EPackage.Registry} by the + * package package URI value. + * <p> + * Note: the correct way to create the package is via the static factory + * method {@link #init init()}, which also performs initialization of the + * package, or returns the registered package, if one already exists. <!-- + * begin-user-doc --> <!-- end-user-doc --> + * + * @see org.eclipse.emf.ecore.EPackage.Registry + * @see org.eclipse.modisco.facet.widgets.celleditors.modelCellEditor.ModelCellEditorPackage#eNS_URI + * @see #init() + * @generated + */ + private ModelCellEditorPackageImpl() { + super(ModelCellEditorPackage.eNS_URI, ModelCellEditorFactory.eINSTANCE); + } + + /** + * <!-- begin-user-doc --> <!-- end-user-doc --> + * + * @generated + */ + private static boolean isInited = false; + + /** + * Creates, registers, and initializes the <b>Package</b> for this model, + * and for any others upon which it depends. + * + * <p> + * This method is used to initialize + * {@link ModelCellEditorPackage#eINSTANCE} when that field is accessed. + * Clients should not invoke it directly. Instead, they should simply access + * that field to obtain the package. <!-- begin-user-doc --> <!-- + * end-user-doc --> + * + * @see #eNS_URI + * @see #createPackageContents() + * @see #initializePackageContents() + * @generated + */ + public static ModelCellEditorPackage init() { + if (ModelCellEditorPackageImpl.isInited) { + return (ModelCellEditorPackage) EPackage.Registry.INSTANCE + .getEPackage(ModelCellEditorPackage.eNS_URI); + } + + // Obtain or create and register package + ModelCellEditorPackageImpl theModelCellEditorPackage = (ModelCellEditorPackageImpl) (EPackage.Registry.INSTANCE + .get(ModelCellEditorPackage.eNS_URI) instanceof ModelCellEditorPackageImpl ? EPackage.Registry.INSTANCE + .get(ModelCellEditorPackage.eNS_URI) : new ModelCellEditorPackageImpl()); + + ModelCellEditorPackageImpl.isInited = true; + + // Create package meta-data objects + theModelCellEditorPackage.createPackageContents(); + + // Initialize created meta-data + theModelCellEditorPackage.initializePackageContents(); + + // Mark meta-data to indicate it can't be changed + theModelCellEditorPackage.freeze(); + + // Update the registry and return the package + EPackage.Registry.INSTANCE.put(ModelCellEditorPackage.eNS_URI, theModelCellEditorPackage); + return theModelCellEditorPackage; + } + + /** + * <!-- begin-user-doc --> <!-- end-user-doc --> + * + * @generated + */ + public EClass getModelCellEditorDeclarations() { + return this.modelCellEditorDeclarationsEClass; + } + + /** + * <!-- begin-user-doc --> <!-- end-user-doc --> + * + * @generated + */ + public EReference getModelCellEditorDeclarations_ModelCellEditors() { + return (EReference) this.modelCellEditorDeclarationsEClass.getEStructuralFeatures().get(0); + } + + /** + * <!-- begin-user-doc --> <!-- end-user-doc --> + * + * @generated + */ + public EClass getAbstractModelCellEditor() { + return this.abstractModelCellEditorEClass; + } + + /** + * <!-- begin-user-doc --> <!-- end-user-doc --> + * + * @generated + */ + public EReference getAbstractModelCellEditor_CellType() { + return (EReference) this.abstractModelCellEditorEClass.getEStructuralFeatures().get(0); + } + + /** + * <!-- begin-user-doc --> <!-- end-user-doc --> + * + * @generated + */ + public EAttribute getAbstractModelCellEditor_CellId() { + return (EAttribute) this.abstractModelCellEditorEClass.getEStructuralFeatures().get(1); + } + + /** + * <!-- begin-user-doc --> <!-- end-user-doc --> + * + * @generated + */ + public EClass getBasicCellEditor() { + return this.basicCellEditorEClass; + } + + /** + * <!-- begin-user-doc --> <!-- end-user-doc --> + * + * @generated + */ + public EAttribute getBasicCellEditor_BasicCellEditorImpl() { + return (EAttribute) this.basicCellEditorEClass.getEStructuralFeatures().get(0); + } + + /** + * <!-- begin-user-doc --> <!-- end-user-doc --> + * + * @generated + */ + public EClass getUnaryReferenceCellEditor() { + return this.unaryReferenceCellEditorEClass; + } + + /** + * <!-- begin-user-doc --> <!-- end-user-doc --> + * + * @generated + */ + public EAttribute getUnaryReferenceCellEditor_UnaryReferenceCellEditorImpl() { + return (EAttribute) this.unaryReferenceCellEditorEClass.getEStructuralFeatures().get(0); + } + + /** + * <!-- begin-user-doc --> <!-- end-user-doc --> + * + * @generated + */ + public EClass getNaryFeatureCellEditor() { + return this.naryFeatureCellEditorEClass; + } + + /** + * <!-- begin-user-doc --> <!-- end-user-doc --> + * + * @generated + */ + public EAttribute getNaryFeatureCellEditor_NaryFeatureCellEditorImpl() { + return (EAttribute) this.naryFeatureCellEditorEClass.getEStructuralFeatures().get(0); + } + + /** + * <!-- begin-user-doc --> <!-- end-user-doc --> + * + * @generated + */ + public ModelCellEditorFactory getModelCellEditorFactory() { + return (ModelCellEditorFactory) getEFactoryInstance(); + } + + /** + * <!-- begin-user-doc --> <!-- end-user-doc --> + * + * @generated + */ + private boolean isCreated = false; + + /** + * Creates the meta-model objects for the package. This method is guarded to + * have no affect on any invocation but its first. <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + public void createPackageContents() { + if (this.isCreated) { + return; + } + this.isCreated = true; + + // Create classes and their features + this.modelCellEditorDeclarationsEClass = createEClass(ModelCellEditorPackage.MODEL_CELL_EDITOR_DECLARATIONS); + createEReference(this.modelCellEditorDeclarationsEClass, + ModelCellEditorPackage.MODEL_CELL_EDITOR_DECLARATIONS__MODEL_CELL_EDITORS); + + this.abstractModelCellEditorEClass = createEClass(ModelCellEditorPackage.ABSTRACT_MODEL_CELL_EDITOR); + createEReference(this.abstractModelCellEditorEClass, + ModelCellEditorPackage.ABSTRACT_MODEL_CELL_EDITOR__CELL_TYPE); + createEAttribute(this.abstractModelCellEditorEClass, + ModelCellEditorPackage.ABSTRACT_MODEL_CELL_EDITOR__CELL_ID); + + this.basicCellEditorEClass = createEClass(ModelCellEditorPackage.BASIC_CELL_EDITOR); + createEAttribute(this.basicCellEditorEClass, + ModelCellEditorPackage.BASIC_CELL_EDITOR__BASIC_CELL_EDITOR_IMPL); + + this.unaryReferenceCellEditorEClass = createEClass(ModelCellEditorPackage.UNARY_REFERENCE_CELL_EDITOR); + createEAttribute( + this.unaryReferenceCellEditorEClass, + ModelCellEditorPackage.UNARY_REFERENCE_CELL_EDITOR__UNARY_REFERENCE_CELL_EDITOR_IMPL); + + this.naryFeatureCellEditorEClass = createEClass(ModelCellEditorPackage.NARY_FEATURE_CELL_EDITOR); + createEAttribute(this.naryFeatureCellEditorEClass, + ModelCellEditorPackage.NARY_FEATURE_CELL_EDITOR__NARY_FEATURE_CELL_EDITOR_IMPL); + } + + /** + * <!-- begin-user-doc --> <!-- end-user-doc --> + * + * @generated + */ + private boolean isInitialized = false; + + /** + * Complete the initialization of the package and its meta-model. This + * method is guarded to have no affect on any invocation but its first. <!-- + * begin-user-doc --> <!-- end-user-doc --> + * + * @generated + */ + public void initializePackageContents() { + if (this.isInitialized) { + return; + } + this.isInitialized = true; + + // Initialize package + setName(ModelCellEditorPackage.eNAME); + setNsPrefix(ModelCellEditorPackage.eNS_PREFIX); + setNsURI(ModelCellEditorPackage.eNS_URI); + + // Create type parameters + + // Set bounds for type parameters + + // Add supertypes to classes + this.basicCellEditorEClass.getESuperTypes().add(getAbstractModelCellEditor()); + this.unaryReferenceCellEditorEClass.getESuperTypes().add(getAbstractModelCellEditor()); + this.naryFeatureCellEditorEClass.getESuperTypes().add(getAbstractModelCellEditor()); + + // Initialize classes and features; add operations and parameters + initEClass( + this.modelCellEditorDeclarationsEClass, + ModelCellEditorDeclarations.class, + "ModelCellEditorDeclarations", !EPackageImpl.IS_ABSTRACT, !EPackageImpl.IS_INTERFACE, //$NON-NLS-1$ + EPackageImpl.IS_GENERATED_INSTANCE_CLASS); + initEReference(getModelCellEditorDeclarations_ModelCellEditors(), + getAbstractModelCellEditor(), null, "modelCellEditors", null, 0, -1, //$NON-NLS-1$ + ModelCellEditorDeclarations.class, !EPackageImpl.IS_TRANSIENT, + !EPackageImpl.IS_VOLATILE, EPackageImpl.IS_CHANGEABLE, EPackageImpl.IS_COMPOSITE, + !EPackageImpl.IS_RESOLVE_PROXIES, !EPackageImpl.IS_UNSETTABLE, + EPackageImpl.IS_UNIQUE, !EPackageImpl.IS_DERIVED, EPackageImpl.IS_ORDERED); + + initEClass( + this.abstractModelCellEditorEClass, + AbstractModelCellEditor.class, + "AbstractModelCellEditor", EPackageImpl.IS_ABSTRACT, !EPackageImpl.IS_INTERFACE, EPackageImpl.IS_GENERATED_INSTANCE_CLASS); //$NON-NLS-1$ + initEReference( + getAbstractModelCellEditor_CellType(), + this.ecorePackage.getEClassifier(), + null, + "cellType", null, 1, 1, AbstractModelCellEditor.class, !EPackageImpl.IS_TRANSIENT, !EPackageImpl.IS_VOLATILE, //$NON-NLS-1$ + EPackageImpl.IS_CHANGEABLE, !EPackageImpl.IS_COMPOSITE, + EPackageImpl.IS_RESOLVE_PROXIES, !EPackageImpl.IS_UNSETTABLE, + EPackageImpl.IS_UNIQUE, !EPackageImpl.IS_DERIVED, EPackageImpl.IS_ORDERED); + initEAttribute( + getAbstractModelCellEditor_CellId(), + this.ecorePackage.getEString(), + "cellId", //$NON-NLS-1$ + null, 1, 1, AbstractModelCellEditor.class, !EPackageImpl.IS_TRANSIENT, + !EPackageImpl.IS_VOLATILE, EPackageImpl.IS_CHANGEABLE, !EPackageImpl.IS_UNSETTABLE, + !EPackageImpl.IS_ID, EPackageImpl.IS_UNIQUE, !EPackageImpl.IS_DERIVED, + EPackageImpl.IS_ORDERED); + + addEOperation(this.abstractModelCellEditorEClass, this.ecorePackage.getEString(), + "getModelCellEditorImpl", 1, 1, EPackageImpl.IS_UNIQUE, EPackageImpl.IS_ORDERED); //$NON-NLS-1$ + + initEClass(this.basicCellEditorEClass, BasicCellEditor.class, + "BasicCellEditor", !EPackageImpl.IS_ABSTRACT, //$NON-NLS-1$ + !EPackageImpl.IS_INTERFACE, EPackageImpl.IS_GENERATED_INSTANCE_CLASS); + initEAttribute( + getBasicCellEditor_BasicCellEditorImpl(), + this.ecorePackage.getEString(), + "basicCellEditorImpl", null, 1, 1, BasicCellEditor.class, !EPackageImpl.IS_TRANSIENT, //$NON-NLS-1$ + !EPackageImpl.IS_VOLATILE, EPackageImpl.IS_CHANGEABLE, !EPackageImpl.IS_UNSETTABLE, + !EPackageImpl.IS_ID, EPackageImpl.IS_UNIQUE, !EPackageImpl.IS_DERIVED, + EPackageImpl.IS_ORDERED); + + initEClass(this.unaryReferenceCellEditorEClass, UnaryReferenceCellEditor.class, + "UnaryReferenceCellEditor", !EPackageImpl.IS_ABSTRACT, !EPackageImpl.IS_INTERFACE, //$NON-NLS-1$ + EPackageImpl.IS_GENERATED_INSTANCE_CLASS); + initEAttribute(getUnaryReferenceCellEditor_UnaryReferenceCellEditorImpl(), + this.ecorePackage.getEString(), "unaryReferenceCellEditorImpl", null, 1, 1, //$NON-NLS-1$ + UnaryReferenceCellEditor.class, !EPackageImpl.IS_TRANSIENT, + !EPackageImpl.IS_VOLATILE, EPackageImpl.IS_CHANGEABLE, !EPackageImpl.IS_UNSETTABLE, + !EPackageImpl.IS_ID, EPackageImpl.IS_UNIQUE, !EPackageImpl.IS_DERIVED, + EPackageImpl.IS_ORDERED); + + initEClass( + this.naryFeatureCellEditorEClass, + NaryFeatureCellEditor.class, + "NaryFeatureCellEditor", !EPackageImpl.IS_ABSTRACT, !EPackageImpl.IS_INTERFACE, EPackageImpl.IS_GENERATED_INSTANCE_CLASS); //$NON-NLS-1$ + initEAttribute(getNaryFeatureCellEditor_NaryFeatureCellEditorImpl(), + this.ecorePackage.getEString(), "naryFeatureCellEditorImpl", null, 1, 1, //$NON-NLS-1$ + NaryFeatureCellEditor.class, !EPackageImpl.IS_TRANSIENT, !EPackageImpl.IS_VOLATILE, + EPackageImpl.IS_CHANGEABLE, !EPackageImpl.IS_UNSETTABLE, !EPackageImpl.IS_ID, + EPackageImpl.IS_UNIQUE, !EPackageImpl.IS_DERIVED, EPackageImpl.IS_ORDERED); + + // Create resource + createResource(ModelCellEditorPackage.eNS_URI); + } + +} // ModelCellEditorPackageImpl
diff --git a/org.eclipse.modisco.facet.widgets.celleditors/src/org/eclipse/modisco/facet/widgets/celleditors/modelCellEditor/impl/NaryFeatureCellEditorImpl.java b/org.eclipse.modisco.facet.widgets.celleditors/src/org/eclipse/modisco/facet/widgets/celleditors/modelCellEditor/impl/NaryFeatureCellEditorImpl.java new file mode 100644 index 0000000..5848a2d --- /dev/null +++ b/org.eclipse.modisco.facet.widgets.celleditors/src/org/eclipse/modisco/facet/widgets/celleditors/modelCellEditor/impl/NaryFeatureCellEditorImpl.java
@@ -0,0 +1,184 @@ +/** + * Copyright (c) 2010 CEA LIST. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Nicolas Bros (Mia-Software) - initial API and implementation + */ +package org.eclipse.modisco.facet.widgets.celleditors.modelCellEditor.impl; + +import org.eclipse.emf.common.notify.Notification; +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.impl.ENotificationImpl; +import org.eclipse.modisco.facet.widgets.celleditors.modelCellEditor.ModelCellEditorPackage; +import org.eclipse.modisco.facet.widgets.celleditors.modelCellEditor.NaryFeatureCellEditor; + +/** + * <!-- begin-user-doc --> An implementation of the model object ' + * <em><b>Nary Feature Cell Editor</b></em>'. <!-- end-user-doc --> + * <p> + * The following features are implemented: + * <ul> + * <li> + * {@link org.eclipse.modisco.facet.widgets.celleditors.modelCellEditor.impl.NaryFeatureCellEditorImpl#getNaryFeatureCellEditorImpl + * <em>Nary Feature Cell Editor Impl</em>}</li> + * </ul> + * </p> + * + * @generated + */ +public class NaryFeatureCellEditorImpl extends AbstractModelCellEditorImpl implements + NaryFeatureCellEditor { + /** + * The default value of the '{@link #getNaryFeatureCellEditorImpl() + * <em>Nary Feature Cell Editor Impl</em>}' attribute. <!-- begin-user-doc + * --> <!-- end-user-doc --> + * + * @see #getNaryFeatureCellEditorImpl() + * @generated + * @ordered + */ + protected static final String NARY_FEATURE_CELL_EDITOR_IMPL_EDEFAULT = null; + + /** + * The cached value of the '{@link #getNaryFeatureCellEditorImpl() + * <em>Nary Feature Cell Editor Impl</em>}' attribute. <!-- begin-user-doc + * --> <!-- end-user-doc --> + * + * @see #getNaryFeatureCellEditorImpl() + * @generated + * @ordered + */ + protected String naryFeatureCellEditorImpl = NaryFeatureCellEditorImpl.NARY_FEATURE_CELL_EDITOR_IMPL_EDEFAULT; + + /** + * <!-- begin-user-doc --> <!-- end-user-doc --> + * + * @generated + */ + protected NaryFeatureCellEditorImpl() { + super(); + } + + /** + * <!-- begin-user-doc --> <!-- end-user-doc --> + * + * @generated + */ + @Override + protected EClass eStaticClass() { + return ModelCellEditorPackage.Literals.NARY_FEATURE_CELL_EDITOR; + } + + /** + * <!-- begin-user-doc --> <!-- end-user-doc --> + * + * @generated + */ + public String getNaryFeatureCellEditorImpl() { + return this.naryFeatureCellEditorImpl; + } + + /** + * <!-- begin-user-doc --> <!-- end-user-doc --> + * + * @generated + */ + public void setNaryFeatureCellEditorImpl(final String newNaryFeatureCellEditorImpl) { + String oldNaryFeatureCellEditorImpl = this.naryFeatureCellEditorImpl; + this.naryFeatureCellEditorImpl = newNaryFeatureCellEditorImpl; + if (eNotificationRequired()) { + eNotify(new ENotificationImpl(this, Notification.SET, + ModelCellEditorPackage.NARY_FEATURE_CELL_EDITOR__NARY_FEATURE_CELL_EDITOR_IMPL, + oldNaryFeatureCellEditorImpl, this.naryFeatureCellEditorImpl)); + } + } + + /** + * <!-- begin-user-doc --> <!-- end-user-doc --> + * + * @generated + */ + @Override + public Object eGet(final int featureID, final boolean resolve, final boolean coreType) { + switch (featureID) { + case ModelCellEditorPackage.NARY_FEATURE_CELL_EDITOR__NARY_FEATURE_CELL_EDITOR_IMPL: + return getNaryFeatureCellEditorImpl(); + } + return super.eGet(featureID, resolve, coreType); + } + + /** + * <!-- begin-user-doc --> <!-- end-user-doc --> + * + * @generated + */ + @Override + public void eSet(final int featureID, final Object newValue) { + switch (featureID) { + case ModelCellEditorPackage.NARY_FEATURE_CELL_EDITOR__NARY_FEATURE_CELL_EDITOR_IMPL: + setNaryFeatureCellEditorImpl((String) newValue); + return; + } + super.eSet(featureID, newValue); + } + + /** + * <!-- begin-user-doc --> <!-- end-user-doc --> + * + * @generated + */ + @Override + public void eUnset(final int featureID) { + switch (featureID) { + case ModelCellEditorPackage.NARY_FEATURE_CELL_EDITOR__NARY_FEATURE_CELL_EDITOR_IMPL: + setNaryFeatureCellEditorImpl(NaryFeatureCellEditorImpl.NARY_FEATURE_CELL_EDITOR_IMPL_EDEFAULT); + return; + } + super.eUnset(featureID); + } + + /** + * <!-- begin-user-doc --> <!-- end-user-doc --> + * + * @generated + */ + @Override + public boolean eIsSet(final int featureID) { + switch (featureID) { + case ModelCellEditorPackage.NARY_FEATURE_CELL_EDITOR__NARY_FEATURE_CELL_EDITOR_IMPL: + return NaryFeatureCellEditorImpl.NARY_FEATURE_CELL_EDITOR_IMPL_EDEFAULT == null ? this.naryFeatureCellEditorImpl != null + : !NaryFeatureCellEditorImpl.NARY_FEATURE_CELL_EDITOR_IMPL_EDEFAULT + .equals(this.naryFeatureCellEditorImpl); + } + return super.eIsSet(featureID); + } + + /** + * <!-- begin-user-doc --> <!-- end-user-doc --> + * + * @generated + */ + @Override + public String toString() { + if (eIsProxy()) { + return super.toString(); + } + + StringBuffer result = new StringBuffer(super.toString()); + result.append(" (naryFeatureCellEditorImpl: "); //$NON-NLS-1$ + result.append(this.naryFeatureCellEditorImpl); + result.append(')'); + return result.toString(); + } + + @Override + public String getModelCellEditorImpl() { + return getNaryFeatureCellEditorImpl(); + } + +} // NaryFeatureCellEditorImpl
diff --git a/org.eclipse.modisco.facet.widgets.celleditors/src/org/eclipse/modisco/facet/widgets/celleditors/modelCellEditor/impl/UnaryReferenceCellEditorImpl.java b/org.eclipse.modisco.facet.widgets.celleditors/src/org/eclipse/modisco/facet/widgets/celleditors/modelCellEditor/impl/UnaryReferenceCellEditorImpl.java new file mode 100644 index 0000000..b16cb8f --- /dev/null +++ b/org.eclipse.modisco.facet.widgets.celleditors/src/org/eclipse/modisco/facet/widgets/celleditors/modelCellEditor/impl/UnaryReferenceCellEditorImpl.java
@@ -0,0 +1,187 @@ +/** + * Copyright (c) 2010 CEA LIST. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Nicolas Bros (Mia-Software) - initial API and implementation + */ +package org.eclipse.modisco.facet.widgets.celleditors.modelCellEditor.impl; + +import org.eclipse.emf.common.notify.Notification; +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.impl.ENotificationImpl; +import org.eclipse.modisco.facet.widgets.celleditors.modelCellEditor.ModelCellEditorPackage; +import org.eclipse.modisco.facet.widgets.celleditors.modelCellEditor.UnaryReferenceCellEditor; + +/** + * <!-- begin-user-doc --> An implementation of the model object ' + * <em><b>Unary Reference Cell Editor</b></em>'. <!-- end-user-doc --> + * <p> + * The following features are implemented: + * <ul> + * <li> + * {@link org.eclipse.modisco.facet.widgets.celleditors.modelCellEditor.impl.UnaryReferenceCellEditorImpl#getUnaryReferenceCellEditorImpl + * <em>Unary Reference Cell Editor Impl</em>}</li> + * </ul> + * </p> + * + * @generated + */ +public class UnaryReferenceCellEditorImpl extends AbstractModelCellEditorImpl implements + UnaryReferenceCellEditor { + /** + * The default value of the '{@link #getUnaryReferenceCellEditorImpl() + * <em>Unary Reference Cell Editor Impl</em>}' attribute. <!-- + * begin-user-doc --> <!-- end-user-doc --> + * + * @see #getUnaryReferenceCellEditorImpl() + * @generated + * @ordered + */ + protected static final String UNARY_REFERENCE_CELL_EDITOR_IMPL_EDEFAULT = null; + + /** + * The cached value of the '{@link #getUnaryReferenceCellEditorImpl() + * <em>Unary Reference Cell Editor Impl</em>}' attribute. <!-- + * begin-user-doc --> <!-- end-user-doc --> + * + * @see #getUnaryReferenceCellEditorImpl() + * @generated + * @ordered + */ + protected String unaryReferenceCellEditorImpl = UnaryReferenceCellEditorImpl.UNARY_REFERENCE_CELL_EDITOR_IMPL_EDEFAULT; + + /** + * <!-- begin-user-doc --> <!-- end-user-doc --> + * + * @generated + */ + protected UnaryReferenceCellEditorImpl() { + super(); + } + + /** + * <!-- begin-user-doc --> <!-- end-user-doc --> + * + * @generated + */ + @Override + protected EClass eStaticClass() { + return ModelCellEditorPackage.Literals.UNARY_REFERENCE_CELL_EDITOR; + } + + /** + * <!-- begin-user-doc --> <!-- end-user-doc --> + * + * @generated + */ + public String getUnaryReferenceCellEditorImpl() { + return this.unaryReferenceCellEditorImpl; + } + + /** + * <!-- begin-user-doc --> <!-- end-user-doc --> + * + * @generated + */ + public void setUnaryReferenceCellEditorImpl(final String newUnaryReferenceCellEditorImpl) { + String oldUnaryReferenceCellEditorImpl = this.unaryReferenceCellEditorImpl; + this.unaryReferenceCellEditorImpl = newUnaryReferenceCellEditorImpl; + if (eNotificationRequired()) { + eNotify(new ENotificationImpl( + this, + Notification.SET, + ModelCellEditorPackage.UNARY_REFERENCE_CELL_EDITOR__UNARY_REFERENCE_CELL_EDITOR_IMPL, + oldUnaryReferenceCellEditorImpl, this.unaryReferenceCellEditorImpl)); + } + } + + /** + * <!-- begin-user-doc --> <!-- end-user-doc --> + * + * @generated + */ + @Override + public Object eGet(final int featureID, final boolean resolve, final boolean coreType) { + switch (featureID) { + case ModelCellEditorPackage.UNARY_REFERENCE_CELL_EDITOR__UNARY_REFERENCE_CELL_EDITOR_IMPL: + return getUnaryReferenceCellEditorImpl(); + } + return super.eGet(featureID, resolve, coreType); + } + + /** + * <!-- begin-user-doc --> <!-- end-user-doc --> + * + * @generated + */ + @Override + public void eSet(final int featureID, final Object newValue) { + switch (featureID) { + case ModelCellEditorPackage.UNARY_REFERENCE_CELL_EDITOR__UNARY_REFERENCE_CELL_EDITOR_IMPL: + setUnaryReferenceCellEditorImpl((String) newValue); + return; + } + super.eSet(featureID, newValue); + } + + /** + * <!-- begin-user-doc --> <!-- end-user-doc --> + * + * @generated + */ + @Override + public void eUnset(final int featureID) { + switch (featureID) { + case ModelCellEditorPackage.UNARY_REFERENCE_CELL_EDITOR__UNARY_REFERENCE_CELL_EDITOR_IMPL: + setUnaryReferenceCellEditorImpl(UnaryReferenceCellEditorImpl.UNARY_REFERENCE_CELL_EDITOR_IMPL_EDEFAULT); + return; + } + super.eUnset(featureID); + } + + /** + * <!-- begin-user-doc --> <!-- end-user-doc --> + * + * @generated + */ + @Override + public boolean eIsSet(final int featureID) { + switch (featureID) { + case ModelCellEditorPackage.UNARY_REFERENCE_CELL_EDITOR__UNARY_REFERENCE_CELL_EDITOR_IMPL: + return UnaryReferenceCellEditorImpl.UNARY_REFERENCE_CELL_EDITOR_IMPL_EDEFAULT == null ? this.unaryReferenceCellEditorImpl != null + : !UnaryReferenceCellEditorImpl.UNARY_REFERENCE_CELL_EDITOR_IMPL_EDEFAULT + .equals(this.unaryReferenceCellEditorImpl); + } + return super.eIsSet(featureID); + } + + /** + * <!-- begin-user-doc --> <!-- end-user-doc --> + * + * @generated + */ + @Override + public String toString() { + if (eIsProxy()) { + return super.toString(); + } + + StringBuffer result = new StringBuffer(super.toString()); + result.append(" (unaryReferenceCellEditorImpl: "); //$NON-NLS-1$ + result.append(this.unaryReferenceCellEditorImpl); + result.append(')'); + return result.toString(); + } + + /** @generated NOT */ + @Override + public String getModelCellEditorImpl() { + return getUnaryReferenceCellEditorImpl(); + } + +} // UnaryReferenceCellEditorImpl
diff --git a/org.eclipse.modisco.facet.widgets.celleditors/src/org/eclipse/modisco/facet/widgets/celleditors/modelCellEditor/util/ModelCellEditorAdapterFactory.java b/org.eclipse.modisco.facet.widgets.celleditors/src/org/eclipse/modisco/facet/widgets/celleditors/modelCellEditor/util/ModelCellEditorAdapterFactory.java new file mode 100644 index 0000000..0cf6ea2 --- /dev/null +++ b/org.eclipse.modisco.facet.widgets.celleditors/src/org/eclipse/modisco/facet/widgets/celleditors/modelCellEditor/util/ModelCellEditorAdapterFactory.java
@@ -0,0 +1,216 @@ +/** + * Copyright (c) 2010 CEA LIST. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Nicolas Bros (Mia-Software) - initial API and implementation + */ +package org.eclipse.modisco.facet.widgets.celleditors.modelCellEditor.util; + +import org.eclipse.emf.common.notify.Adapter; +import org.eclipse.emf.common.notify.Notifier; +import org.eclipse.emf.common.notify.impl.AdapterFactoryImpl; +import org.eclipse.emf.ecore.EObject; +import org.eclipse.modisco.facet.widgets.celleditors.modelCellEditor.AbstractModelCellEditor; +import org.eclipse.modisco.facet.widgets.celleditors.modelCellEditor.BasicCellEditor; +import org.eclipse.modisco.facet.widgets.celleditors.modelCellEditor.ModelCellEditorDeclarations; +import org.eclipse.modisco.facet.widgets.celleditors.modelCellEditor.ModelCellEditorPackage; +import org.eclipse.modisco.facet.widgets.celleditors.modelCellEditor.NaryFeatureCellEditor; +import org.eclipse.modisco.facet.widgets.celleditors.modelCellEditor.UnaryReferenceCellEditor; + +/** + * <!-- begin-user-doc --> The <b>Adapter Factory</b> for the model. It provides + * an adapter <code>createXXX</code> method for each class of the model. <!-- + * end-user-doc --> + * + * @see org.eclipse.modisco.facet.widgets.celleditors.modelCellEditor.ModelCellEditorPackage + * @generated + */ +public class ModelCellEditorAdapterFactory extends AdapterFactoryImpl { + /** + * The cached model package. <!-- begin-user-doc --> <!-- end-user-doc --> + * + * @generated + */ + protected static ModelCellEditorPackage modelPackage; + + /** + * Creates an instance of the adapter factory. <!-- begin-user-doc --> <!-- + * end-user-doc --> + * + * @generated + */ + public ModelCellEditorAdapterFactory() { + if (ModelCellEditorAdapterFactory.modelPackage == null) { + ModelCellEditorAdapterFactory.modelPackage = ModelCellEditorPackage.eINSTANCE; + } + } + + /** + * Returns whether this factory is applicable for the type of the object. + * <!-- begin-user-doc --> This implementation returns <code>true</code> if + * the object is either the model's package or is an instance object of the + * model. <!-- end-user-doc --> + * + * @return whether this factory is applicable for the type of the object. + * @generated + */ + @Override + public boolean isFactoryForType(final Object object) { + if (object == ModelCellEditorAdapterFactory.modelPackage) { + return true; + } + if (object instanceof EObject) { + return ((EObject) object).eClass().getEPackage() == ModelCellEditorAdapterFactory.modelPackage; + } + return false; + } + + /** + * The switch that delegates to the <code>createXXX</code> methods. <!-- + * begin-user-doc --> <!-- end-user-doc --> + * + * @generated + */ + protected ModelCellEditorSwitch<Adapter> modelSwitch = new ModelCellEditorSwitch<Adapter>() { + @Override + public Adapter caseModelCellEditorDeclarations(final ModelCellEditorDeclarations object) { + return createModelCellEditorDeclarationsAdapter(); + } + + @Override + public Adapter caseAbstractModelCellEditor(final AbstractModelCellEditor object) { + return createAbstractModelCellEditorAdapter(); + } + + @Override + public Adapter caseBasicCellEditor(final BasicCellEditor object) { + return createBasicCellEditorAdapter(); + } + + @Override + public Adapter caseUnaryReferenceCellEditor(final UnaryReferenceCellEditor object) { + return createUnaryReferenceCellEditorAdapter(); + } + + @Override + public Adapter caseNaryFeatureCellEditor(final NaryFeatureCellEditor object) { + return createNaryFeatureCellEditorAdapter(); + } + + @Override + public Adapter defaultCase(final EObject object) { + return createEObjectAdapter(); + } + }; + + /** + * Creates an adapter for the <code>target</code>. <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @param target + * the object to adapt. + * @return the adapter for the <code>target</code>. + * @generated + */ + @Override + public Adapter createAdapter(final Notifier target) { + return this.modelSwitch.doSwitch((EObject) target); + } + + /** + * Creates a new adapter for an object of class ' + * {@link org.eclipse.modisco.facet.widgets.celleditors.modelCellEditor.ModelCellEditorDeclarations + * <em>Declarations</em>}'. <!-- begin-user-doc --> This default + * implementation returns null so that we can easily ignore cases; it's + * useful to ignore a case when inheritance will catch all the cases anyway. + * <!-- end-user-doc --> + * + * @return the new adapter. + * @see org.eclipse.modisco.facet.widgets.celleditors.modelCellEditor.ModelCellEditorDeclarations + * @generated + */ + public Adapter createModelCellEditorDeclarationsAdapter() { + return null; + } + + /** + * Creates a new adapter for an object of class ' + * {@link org.eclipse.modisco.facet.widgets.celleditors.modelCellEditor.AbstractModelCellEditor + * <em>Abstract Model Cell Editor</em>}'. <!-- begin-user-doc --> This + * default implementation returns null so that we can easily ignore cases; + * it's useful to ignore a case when inheritance will catch all the cases + * anyway. <!-- end-user-doc --> + * + * @return the new adapter. + * @see org.eclipse.modisco.facet.widgets.celleditors.modelCellEditor.AbstractModelCellEditor + * @generated + */ + public Adapter createAbstractModelCellEditorAdapter() { + return null; + } + + /** + * Creates a new adapter for an object of class ' + * {@link org.eclipse.modisco.facet.widgets.celleditors.modelCellEditor.BasicCellEditor + * <em>Basic Cell Editor</em>}'. <!-- begin-user-doc --> This default + * implementation returns null so that we can easily ignore cases; it's + * useful to ignore a case when inheritance will catch all the cases anyway. + * <!-- end-user-doc --> + * + * @return the new adapter. + * @see org.eclipse.modisco.facet.widgets.celleditors.modelCellEditor.BasicCellEditor + * @generated + */ + public Adapter createBasicCellEditorAdapter() { + return null; + } + + /** + * Creates a new adapter for an object of class ' + * {@link org.eclipse.modisco.facet.widgets.celleditors.modelCellEditor.UnaryReferenceCellEditor + * <em>Unary Reference Cell Editor</em>}'. <!-- begin-user-doc --> This + * default implementation returns null so that we can easily ignore cases; + * it's useful to ignore a case when inheritance will catch all the cases + * anyway. <!-- end-user-doc --> + * + * @return the new adapter. + * @see org.eclipse.modisco.facet.widgets.celleditors.modelCellEditor.UnaryReferenceCellEditor + * @generated + */ + public Adapter createUnaryReferenceCellEditorAdapter() { + return null; + } + + /** + * Creates a new adapter for an object of class ' + * {@link org.eclipse.modisco.facet.widgets.celleditors.modelCellEditor.NaryFeatureCellEditor + * <em>Nary Feature Cell Editor</em>}'. <!-- begin-user-doc --> This default + * implementation returns null so that we can easily ignore cases; it's + * useful to ignore a case when inheritance will catch all the cases anyway. + * <!-- end-user-doc --> + * + * @return the new adapter. + * @see org.eclipse.modisco.facet.widgets.celleditors.modelCellEditor.NaryFeatureCellEditor + * @generated + */ + public Adapter createNaryFeatureCellEditorAdapter() { + return null; + } + + /** + * Creates a new adapter for the default case. <!-- begin-user-doc --> This + * default implementation returns null. <!-- end-user-doc --> + * + * @return the new adapter. + * @generated + */ + public Adapter createEObjectAdapter() { + return null; + } + +} // ModelCellEditorAdapterFactory
diff --git a/org.eclipse.modisco.facet.widgets.celleditors/src/org/eclipse/modisco/facet/widgets/celleditors/modelCellEditor/util/ModelCellEditorSwitch.java b/org.eclipse.modisco.facet.widgets.celleditors/src/org/eclipse/modisco/facet/widgets/celleditors/modelCellEditor/util/ModelCellEditorSwitch.java new file mode 100644 index 0000000..f8dab9e --- /dev/null +++ b/org.eclipse.modisco.facet.widgets.celleditors/src/org/eclipse/modisco/facet/widgets/celleditors/modelCellEditor/util/ModelCellEditorSwitch.java
@@ -0,0 +1,254 @@ +/** + * Copyright (c) 2010 CEA LIST. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Nicolas Bros (Mia-Software) - initial API and implementation + */ +package org.eclipse.modisco.facet.widgets.celleditors.modelCellEditor.util; + +import java.util.List; + +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.EObject; +import org.eclipse.modisco.facet.widgets.celleditors.modelCellEditor.AbstractModelCellEditor; +import org.eclipse.modisco.facet.widgets.celleditors.modelCellEditor.BasicCellEditor; +import org.eclipse.modisco.facet.widgets.celleditors.modelCellEditor.ModelCellEditorDeclarations; +import org.eclipse.modisco.facet.widgets.celleditors.modelCellEditor.ModelCellEditorPackage; +import org.eclipse.modisco.facet.widgets.celleditors.modelCellEditor.NaryFeatureCellEditor; +import org.eclipse.modisco.facet.widgets.celleditors.modelCellEditor.UnaryReferenceCellEditor; + +/** + * <!-- begin-user-doc --> The <b>Switch</b> for the model's inheritance + * hierarchy. It supports the call {@link #doSwitch(EObject) doSwitch(object)} + * to invoke the <code>caseXXX</code> method for each class of the model, + * starting with the actual class of the object and proceeding up the + * inheritance hierarchy until a non-null result is returned, which is the + * result of the switch. <!-- end-user-doc --> + * + * @see org.eclipse.modisco.facet.widgets.celleditors.modelCellEditor.ModelCellEditorPackage + * @generated + */ +public class ModelCellEditorSwitch<T> { + /** + * The cached model package <!-- begin-user-doc --> <!-- end-user-doc --> + * + * @generated + */ + protected static ModelCellEditorPackage modelPackage; + + /** + * Creates an instance of the switch. <!-- begin-user-doc --> <!-- + * end-user-doc --> + * + * @generated + */ + public ModelCellEditorSwitch() { + if (ModelCellEditorSwitch.modelPackage == null) { + ModelCellEditorSwitch.modelPackage = ModelCellEditorPackage.eINSTANCE; + } + } + + /** + * Calls <code>caseXXX</code> for each class of the model until one returns + * a non null result; it yields that result. <!-- begin-user-doc --> <!-- + * end-user-doc --> + * + * @return the first non-null result returned by a <code>caseXXX</code> + * call. + * @generated + */ + public T doSwitch(final EObject theEObject) { + return doSwitch(theEObject.eClass(), theEObject); + } + + /** + * Calls <code>caseXXX</code> for each class of the model until one returns + * a non null result; it yields that result. <!-- begin-user-doc --> <!-- + * end-user-doc --> + * + * @return the first non-null result returned by a <code>caseXXX</code> + * call. + * @generated + */ + protected T doSwitch(final EClass theEClass, final EObject theEObject) { + if (theEClass.eContainer() == ModelCellEditorSwitch.modelPackage) { + return doSwitch(theEClass.getClassifierID(), theEObject); + } + List<EClass> eSuperTypes = theEClass.getESuperTypes(); + return eSuperTypes.isEmpty() ? defaultCase(theEObject) : doSwitch(eSuperTypes.get(0), + theEObject); + } + + /** + * Calls <code>caseXXX</code> for each class of the model until one returns + * a non null result; it yields that result. <!-- begin-user-doc --> <!-- + * end-user-doc --> + * + * @return the first non-null result returned by a <code>caseXXX</code> + * call. + * @generated + */ + protected T doSwitch(final int classifierID, final EObject theEObject) { + switch (classifierID) { + case ModelCellEditorPackage.MODEL_CELL_EDITOR_DECLARATIONS: { + ModelCellEditorDeclarations modelCellEditorDeclarations = (ModelCellEditorDeclarations) theEObject; + T result = caseModelCellEditorDeclarations(modelCellEditorDeclarations); + if (result == null) { + result = defaultCase(theEObject); + } + return result; + } + case ModelCellEditorPackage.ABSTRACT_MODEL_CELL_EDITOR: { + AbstractModelCellEditor abstractModelCellEditor = (AbstractModelCellEditor) theEObject; + T result = caseAbstractModelCellEditor(abstractModelCellEditor); + if (result == null) { + result = defaultCase(theEObject); + } + return result; + } + case ModelCellEditorPackage.BASIC_CELL_EDITOR: { + BasicCellEditor basicCellEditor = (BasicCellEditor) theEObject; + T result = caseBasicCellEditor(basicCellEditor); + if (result == null) { + result = caseAbstractModelCellEditor(basicCellEditor); + } + if (result == null) { + result = defaultCase(theEObject); + } + return result; + } + case ModelCellEditorPackage.UNARY_REFERENCE_CELL_EDITOR: { + UnaryReferenceCellEditor unaryReferenceCellEditor = (UnaryReferenceCellEditor) theEObject; + T result = caseUnaryReferenceCellEditor(unaryReferenceCellEditor); + if (result == null) { + result = caseAbstractModelCellEditor(unaryReferenceCellEditor); + } + if (result == null) { + result = defaultCase(theEObject); + } + return result; + } + case ModelCellEditorPackage.NARY_FEATURE_CELL_EDITOR: { + NaryFeatureCellEditor naryFeatureCellEditor = (NaryFeatureCellEditor) theEObject; + T result = caseNaryFeatureCellEditor(naryFeatureCellEditor); + if (result == null) { + result = caseAbstractModelCellEditor(naryFeatureCellEditor); + } + if (result == null) { + result = defaultCase(theEObject); + } + return result; + } + default: + return defaultCase(theEObject); + } + } + + /** + * Returns the result of interpreting the object as an instance of ' + * <em>Declarations</em>'. <!-- begin-user-doc --> This implementation + * returns null; returning a non-null result will terminate the switch. <!-- + * end-user-doc --> + * + * @param object + * the target of the switch. + * @return the result of interpreting the object as an instance of ' + * <em>Declarations</em>'. + * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) + * @generated + */ + public T caseModelCellEditorDeclarations(final ModelCellEditorDeclarations object) { + return null; + } + + /** + * Returns the result of interpreting the object as an instance of ' + * <em>Abstract Model Cell Editor</em>'. <!-- begin-user-doc --> This + * implementation returns null; returning a non-null result will terminate + * the switch. <!-- end-user-doc --> + * + * @param object + * the target of the switch. + * @return the result of interpreting the object as an instance of ' + * <em>Abstract Model Cell Editor</em>'. + * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) + * @generated + */ + public T caseAbstractModelCellEditor(final AbstractModelCellEditor object) { + return null; + } + + /** + * Returns the result of interpreting the object as an instance of ' + * <em>Basic Cell Editor</em>'. <!-- begin-user-doc --> This implementation + * returns null; returning a non-null result will terminate the switch. <!-- + * end-user-doc --> + * + * @param object + * the target of the switch. + * @return the result of interpreting the object as an instance of ' + * <em>Basic Cell Editor</em>'. + * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) + * @generated + */ + public T caseBasicCellEditor(final BasicCellEditor object) { + return null; + } + + /** + * Returns the result of interpreting the object as an instance of ' + * <em>Unary Reference Cell Editor</em>'. <!-- begin-user-doc --> This + * implementation returns null; returning a non-null result will terminate + * the switch. <!-- end-user-doc --> + * + * @param object + * the target of the switch. + * @return the result of interpreting the object as an instance of ' + * <em>Unary Reference Cell Editor</em>'. + * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) + * @generated + */ + public T caseUnaryReferenceCellEditor(final UnaryReferenceCellEditor object) { + return null; + } + + /** + * Returns the result of interpreting the object as an instance of ' + * <em>Nary Feature Cell Editor</em>'. <!-- begin-user-doc --> This + * implementation returns null; returning a non-null result will terminate + * the switch. <!-- end-user-doc --> + * + * @param object + * the target of the switch. + * @return the result of interpreting the object as an instance of ' + * <em>Nary Feature Cell Editor</em>'. + * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) + * @generated + */ + public T caseNaryFeatureCellEditor(final NaryFeatureCellEditor object) { + return null; + } + + /** + * Returns the result of interpreting the object as an instance of ' + * <em>EObject</em>'. <!-- begin-user-doc --> This implementation returns + * null; returning a non-null result will terminate the switch, but this is + * the last case anyway. <!-- end-user-doc --> + * + * @param object + * the target of the switch. + * @return the result of interpreting the object as an instance of ' + * <em>EObject</em>'. + * @see #doSwitch(org.eclipse.emf.ecore.EObject) + * @generated + */ + public T defaultCase(final EObject object) { + return null; + } + +} // ModelCellEditorSwitch
diff --git a/org.eclipse.modisco.facet.widgets/META-INF/MANIFEST.MF b/org.eclipse.modisco.facet.widgets/META-INF/MANIFEST.MF index e3c3cd5..9f7d522 100644 --- a/org.eclipse.modisco.facet.widgets/META-INF/MANIFEST.MF +++ b/org.eclipse.modisco.facet.widgets/META-INF/MANIFEST.MF
@@ -3,7 +3,7 @@ Bundle-Name: %Bundle-Name Bundle-SymbolicName: org.eclipse.emf.facet.widgets Bundle-Version: 1.3.0.qualifier -Bundle-Activator: org.eclipse.emf.facet.widgets.internal.Activator +Bundle-Activator: org.eclipse.modisco.facet.widgets.internal.Activator Bundle-Vendor: %Bundle-Vendor Require-Bundle: org.eclipse.ui, org.eclipse.core.runtime, @@ -15,5 +15,5 @@ org.eclipse.emf.facet.custom.core;bundle-version="0.2.0" Bundle-RequiredExecutionEnvironment: JavaSE-1.8 Bundle-ActivationPolicy: lazy -Export-Package: org.eclipse.emf.facet.widgets.internal;x-friends:="org.eclipse.emf.facet.widgets.celleditors,org.eclipse.emf.facet.widgets.nattable" +Export-Package: org.eclipse.modisco.facet.widgets.internal;x-friends:="org.eclipse.emf.facet.widgets.celleditors,org.eclipse.emf.facet.widgets.nattable" Automatic-Module-Name: org.eclipse.emf.facet.widgets
diff --git a/org.eclipse.modisco.facet.widgets/src/org/eclipse/emf/facet/widgets/internal/Activator.java b/org.eclipse.modisco.facet.widgets/src/org/eclipse/emf/facet/widgets/internal/Activator.java deleted file mode 100644 index 5c0b59d..0000000 --- a/org.eclipse.modisco.facet.widgets/src/org/eclipse/emf/facet/widgets/internal/Activator.java +++ /dev/null
@@ -1,69 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Mia-Software. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Nicolas Bros (Mia-Software) - initial API and implementation - * Nicolas Bros (Mia-Software) - Bug 339653 - org.eclipse.emf.facet.widgets API Cleaning - *******************************************************************************/ -package org.eclipse.emf.facet.widgets.internal; - -import org.eclipse.ui.plugin.AbstractUIPlugin; -import org.osgi.framework.BundleContext; - -/** - * The activator class controls the plug-in life cycle - */ -public class Activator extends AbstractUIPlugin { - - // The plug-in ID - public static final String PLUGIN_ID = "org.eclipse.emf.facet.widgets"; //$NON-NLS-1$ - - // The shared instance - private static Activator plugin; - - /** - * The constructor - */ - public Activator() { - } - - /* - * (non-Javadoc) - * - * @see - * org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext - * ) - */ - @Override - public void start(final BundleContext context) throws Exception { - super.start(context); - Activator.plugin = this; - } - - /* - * (non-Javadoc) - * - * @see - * org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext - * ) - */ - @Override - public void stop(final BundleContext context) throws Exception { - Activator.plugin = null; - super.stop(context); - } - - /** - * Returns the shared instance - * - * @return the shared instance - */ - public static Activator getDefault() { - return Activator.plugin; - } - -}
diff --git a/org.eclipse.modisco.facet.widgets/src/org/eclipse/emf/facet/widgets/internal/CustomizableLabelProvider.java b/org.eclipse.modisco.facet.widgets/src/org/eclipse/emf/facet/widgets/internal/CustomizableLabelProvider.java deleted file mode 100644 index d289a91..0000000 --- a/org.eclipse.modisco.facet.widgets/src/org/eclipse/emf/facet/widgets/internal/CustomizableLabelProvider.java +++ /dev/null
@@ -1,235 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Mia-Software. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Nicolas Bros (Mia-Software) - initial API and implementation - * Nicolas Bros (Mia-Software) - Bug 339653 - org.eclipse.emf.facet.widgets API Cleaning - * Gregoire Dupe (Mia-Software) - Bug 369987 - [Restructuring][Table] Switch to the new customization and facet framework - *******************************************************************************/ - -package org.eclipse.emf.facet.widgets.internal; - -import org.eclipse.emf.ecore.EAttribute; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.EReference; -import org.eclipse.emf.edit.provider.ComposedAdapterFactory; -import org.eclipse.emf.edit.provider.IItemLabelProvider; -import org.eclipse.emf.edit.provider.ReflectiveItemProviderAdapterFactory; -import org.eclipse.emf.edit.provider.resource.ResourceItemProviderAdapterFactory; -import org.eclipse.emf.edit.ui.provider.ExtendedImageRegistry; -import org.eclipse.emf.facet.custom.core.ICustomizationManager; -import org.eclipse.emf.facet.custom.ui.ICustomizedLabelProvider; -import org.eclipse.emf.facet.custom.ui.ICustomizedLabelProviderFactory; -import org.eclipse.jface.viewers.LabelProvider; -import org.eclipse.swt.graphics.Image; - -@Deprecated -public class CustomizableLabelProvider extends LabelProvider { - - private final ComposedAdapterFactory adapterFactoryWithRegistry; - private ICustomizationManager customizationEngine; - private ICustomizedLabelProvider labelProvider; - - public CustomizableLabelProvider(final ICustomizationManager customizationEngine) { - this(); - this.customizationEngine = customizationEngine; - this.labelProvider = ICustomizedLabelProviderFactory.DEFAULT.createCustomizedLabelProvider(customizationEngine); - } - - public CustomizableLabelProvider() { - this.adapterFactoryWithRegistry = new ComposedAdapterFactory( - ComposedAdapterFactory.Descriptor.Registry.INSTANCE); - this.adapterFactoryWithRegistry.addAdapterFactory(new ResourceItemProviderAdapterFactory()); - this.adapterFactoryWithRegistry - .addAdapterFactory(new ReflectiveItemProviderAdapterFactory()); - } - - @Override - public String getText(final Object element) { - if (element instanceof EReference) { - EReference eReference = (EReference) element; - return getText(eReference); - } - if (element instanceof EAttribute) { - EAttribute eAttribute = (EAttribute) element; - return getText(eAttribute); - } - if (element instanceof EObject) { - EObject eObject = (EObject) element; - return getText(eObject); - } - return element.toString(); - } - - public String getText(final EObject eObject) { - if (this.customizationEngine != null) { - String label = this.labelProvider.getText(eObject); - if (label != null) { - return label; - } - } - - final IItemLabelProvider itemLabelProvider = (IItemLabelProvider) this.adapterFactoryWithRegistry - .adapt(eObject, IItemLabelProvider.class); - - if (itemLabelProvider != null) { - return itemLabelProvider.getText(eObject); - } - return null; - } - - public static String getText(final EReference reference) { - boolean showMultiplicity = true; - boolean showOpposite = false; - // String customizedName = null; - - String multiplicity = ""; //$NON-NLS-1$ - - if (showMultiplicity) { - multiplicity = getMultiplicity(reference); - } - - String opposite = ""; //$NON-NLS-1$ - - if (showOpposite) { - final EReference oppositeRef = reference.getEOpposite(); - if (oppositeRef != null) { - String oppositeMultiplicity = ""; //$NON-NLS-1$ - if (showMultiplicity) { - oppositeMultiplicity = getMultiplicity(oppositeRef); - } - - opposite = " <-> " + oppositeRef.getName() + oppositeMultiplicity; //$NON-NLS-1$ - } - } - - final String prefix; - if (reference.isDerived()) { - prefix = "/"; //$NON-NLS-1$ - } else { - prefix = ""; //$NON-NLS-1$ - } - final String referenceName; - // if (customizedName != null) { - // referenceName = customizedName; - // } else { - referenceName = reference.getName(); - // } - return prefix + referenceName + multiplicity + opposite; - } - - public static String getMultiplicity(final EReference reference) { - final String multLow; - if (reference.isRequired()) { - multLow = "1"; //$NON-NLS-1$ - } else { - multLow = "0"; //$NON-NLS-1$ - } - final String multHigh; - if (reference.isMany()) { - multHigh = "*"; //$NON-NLS-1$ - } else { - multHigh = "1"; //$NON-NLS-1$ - } - return " [" + multLow + ".." + multHigh + "]"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ - } - - public static String getText(final EAttribute attribute) { - String multiplicity = ""; //$NON-NLS-1$ - - if (true /* showMultiplicity */) { - final String multLow; - if (attribute.isRequired()) { - multLow = "1"; //$NON-NLS-1$ - } else { - multLow = "0"; //$NON-NLS-1$ - } - final String multHigh; - if (attribute.isMany()) { - multHigh = "*"; //$NON-NLS-1$ - } else { - multHigh = "1"; //$NON-NLS-1$ - } - multiplicity = " [" + multLow + ".." + multHigh + "]"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ - } - - final String prefix; - if (attribute.isDerived()) { - prefix = "/"; //$NON-NLS-1$ - } else { - prefix = ""; //$NON-NLS-1$ - } - - final String attributeName = attribute.getName(); - return prefix + attributeName + multiplicity; - } - - @Override - public Image getImage(final Object element) { - if (element instanceof EReference) { - EReference eReference = (EReference) element; - return getImage(eReference); - } - if (element instanceof EAttribute) { - EAttribute eAttribute = (EAttribute) element; - return getImage(eAttribute); - } - if (element instanceof EObject) { - EObject eObject = (EObject) element; - return getImage(eObject); - } - return null; - } - - public Image getImage(final EObject eObject) { - if (this.customizationEngine != null) { - Image image = this.labelProvider.getImage(eObject); - if (image != null) { - return image; - } - } - - final IItemLabelProvider itemLabelProvider = (IItemLabelProvider) this.adapterFactoryWithRegistry - .adapt(eObject, IItemLabelProvider.class); - - if (itemLabelProvider != null) { - final Object image = itemLabelProvider.getImage(eObject); - return ExtendedImageRegistry.getInstance().getImage(image); - } - return null; - } - - public static Image getImage(final EReference reference) { - // if (reference instanceof FacetReference || reference instanceof - // Shortcut) { - // return ImageProvider.getInstance().getFacetLinkIcon(); - // } - - final EReference opposite = reference.getEOpposite(); - - if (reference.isContainment()) { - if (opposite == null) { - return ImageProvider.getInstance().getUnidirectionalAggregIcon(); - } - return ImageProvider.getInstance().getAggregIcon(); - } - - if (opposite != null && opposite.isContainment()) { - return ImageProvider.getInstance().getInvAggregIcon(); - } - - if (opposite == null) { - return ImageProvider.getInstance().getUnidirectionalLinkIcon(); - } - return ImageProvider.getInstance().getLinkIcon(); - } - - public static Image getImage(@SuppressWarnings("unused") final EAttribute eAttribute) { - return ImageProvider.getInstance().getAttributeIcon(); - } - -}
diff --git a/org.eclipse.modisco.facet.widgets/src/org/eclipse/emf/facet/widgets/internal/ImageProvider.java b/org.eclipse.modisco.facet.widgets/src/org/eclipse/emf/facet/widgets/internal/ImageProvider.java deleted file mode 100644 index ae20dd8..0000000 --- a/org.eclipse.modisco.facet.widgets/src/org/eclipse/emf/facet/widgets/internal/ImageProvider.java +++ /dev/null
@@ -1,652 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 2010 Mia-Software. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Nicolas Bros (Mia-Software) - initial API and implementation - * Nicolas Bros (Mia-Software) - Bug 339653 - org.eclipse.emf.facet.widgets API Cleaning - * Vincent Lorenzo (CEA-LIST) - bug 341192 - Add the method to get the image for Select Columns To Hide in the ImageManager - *******************************************************************************/ -package org.eclipse.emf.facet.widgets.internal; - -import java.net.URL; - -import org.eclipse.emf.facet.util.core.Logger; -import org.eclipse.jface.resource.ImageDescriptor; -import org.eclipse.osgi.util.NLS; -import org.eclipse.swt.graphics.Image; - -/** A singleton image provider, which caches image descriptors */ -public final class ImageProvider { - - private ImageProvider() { - // This class must only be instantiated by getInstance(). - } - - private static ImageProvider instance; - - public static ImageProvider getInstance() { - if (ImageProvider.instance == null) { - ImageProvider.instance = new ImageProvider(); - } - return ImageProvider.instance; - } - - private Image linkIcon = null; - private Image linkUniDirIcon = null; - private Image linkFacetIcon = null; - private Image aggregIcon = null; - private Image aggregUniDirIcon = null; - private Image invAggregIcon = null; - - private Image emptyLinksIcon = null; - // private Image sortInstancesIcon = null; - private Image sortLinksIcon = null; - private Image sortLinksByTypeIcon = null; - // private Image sortNumericallyIcon = null; - private Image showDerivedLinksIcon = null; - private Image showFullQualifiedNamesIcon = null; - private Image showMultiplicityIcon = null; - private Image showOppositeLinksIcon = null; - - private Image rangeIcon = null; - private Image containerIcon = null; - // private Image emptyMetaclassesIcon = null; - private Image packageIcon = null; - // private Image derivedInstancesIcon = null; - // private Image derivationTreeIcon = null; - private Image attributeIcon = null; - private Image attributeFacetIcon = null; - private Image emptyAttributeIcon = null; - private Image orderingIcon = null; - private Image linkTypeIcon = null; - - private Image facetIcon = null; - private Image viewMenuIcon = null; - - private ImageDescriptor increaseFontSizeIcon = null; - private ImageDescriptor decreaseFontSizeIcon = null; - private ImageDescriptor restoreFontSizeIcon = null; - - private Image hideEmptyColumnsIcon = null; - private Image commonColumnsIcon = null; - private Image eClassIcon = null; - private Image operationIcon = null; - private Image predicateIcon = null; - private Image emffacetIcon = null; - private Image featureIcon = null; - private Image errorIcon = null; - private Image queryIcon = null; - private Image uiCustomIcon = null; - private Image uriIcon = null; - - private Image shortcutIcon = null; - - private Image selectColumnsToHide = null; - - private static final String LINK_ICON_PATH = "/icons/full/ctool16/link.gif"; //$NON-NLS-1$ - private static final String LINK_UNIDIR_ICON_PATH = "/icons/full/ctool16/link_unidir.gif"; //$NON-NLS-1$ - private static final String LINK_FACET_ICON_PATH = "/icons/full/ctool16/link_unidir_facet.gif"; //$NON-NLS-1$ - private static final String AGGREG_ICON_PATH = "/icons/full/ctool16/aggreg.gif"; //$NON-NLS-1$ - private static final String AGGREG_UNIDIR_ICON_PATH = "/icons/full/ctool16/aggreg_unidir.gif"; //$NON-NLS-1$ - private static final String INV_AGGREG_ICON_PATH = "/icons/full/ctool16/inv_aggreg.gif"; //$NON-NLS-1$ - private static final String EMPTY_LINKS_ICON_PATH = "/icons/full/ctool16/empty_links.gif"; //$NON-NLS-1$ - private static final String SORT_INSTANCES_ICON_PATH = "/icons/full/ctool16/sort.gif"; //$NON-NLS-1$ - private static final String SORT_LINKS_ICON_PATH = "/icons/full/ctool16/sort_links.gif"; //$NON-NLS-1$ - private static final String SORT_LINKS_BY_TYPE_ICON_PATH = "/icons/full/ctool16/sort_links_by_type.gif"; //$NON-NLS-1$ - private static final String SORT_NUMERICALLY_ICON_PATH = "/icons/full/ctool16/sort_num.gif"; //$NON-NLS-1$ - private static final String SHOW_DERIVED_LINKS_ICON_PATH = "/icons/full/ctool16/derived.gif"; //$NON-NLS-1$ - private static final String SHOW_FULL_QUALIFIED_NAMES_ICON_PATH = "/icons/full/ctool16/full_name.gif"; //$NON-NLS-1$ - private static final String RANGE_ICON_PATH = "/icons/full/ctool16/range.gif"; //$NON-NLS-1$ - private static final String SHOW_MULTIPLICITY_ICON_PATH = "/icons/full/ctool16/multiplicity.gif"; //$NON-NLS-1$ - private static final String SHOW_OPPOSITE_LINKS_ICON_PATH = "/icons/full/ctool16/opposite_links.gif"; //$NON-NLS-1$ - private static final String CONTAINER_ICON_PATH = "/icons/full/ctool16/container.gif"; //$NON-NLS-1$ - private static final String EMPTY_METACLASSES_ICON_PATH = "/icons/full/ctool16/zero.gif"; //$NON-NLS-1$ - private static final String PACKAGE_ICON_PATH = "/icons/full/ctool16/package.gif"; //$NON-NLS-1$ - private static final String DERIVED_INSTANCES_ICON_PATH = "/icons/full/ctool16/derived_instances.gif"; //$NON-NLS-1$ - private static final String DERIVATION_TREE_ICON_PATH = "/icons/full/ctool16/derivation_tree.gif"; //$NON-NLS-1$ - private static final String ATTRIBUTE_ICON_PATH = "/icons/full/ctool16/attributes.gif"; //$NON-NLS-1$ - private static final String ATTRIBUTE_FACET_ICON_PATH = "/icons/full/ctool16/attribute_facet.gif"; //$NON-NLS-1$ - private static final String EMPTY_ATTRIBUTE_ICON_PATH = "/icons/full/ctool16/empty_attributes.gif"; //$NON-NLS-1$ - private static final String INCREASE_FONT_SIZE_ICON_PATH = "/icons/full/ctool16/increase_font_size.gif"; //$NON-NLS-1$ - private static final String DECREASE_FONT_SIZE_ICON_PATH = "/icons/full/ctool16/decrease_font_size.gif"; //$NON-NLS-1$ - private static final String RESTORE_FONT_SIZE_ICON_PATH = "/icons/full/ctool16/restore_font_size.gif"; //$NON-NLS-1$ - private static final String HIDE_EMPTY_COLUMNS_ICON_PATH = "/icons/full/ctool16/non-zero.gif"; //$NON-NLS-1$ - private static final String COMMON_COLUMNS_ICON_PATH = "/icons/full/ctool16/common_columns.gif"; //$NON-NLS-1$ - private static final String ORDERING_ICON_PATH = "/icons/full/ctool16/ordering.gif"; //$NON-NLS-1$ - private static final String ECLASS_ICON_PATH = "/icons/full/ctool16/eClass.gif"; //$NON-NLS-1$ - private static final String OPERATION_ICON_PATH = "/icons/full/ctool16/operation.gif"; //$NON-NLS-1$ - private static final String PREDICATE_ICON_PATH = "/icons/full/ctool16/predicate.gif"; //$NON-NLS-1$ - private static final String EMFFACET_ICON_PATH = "icons/logoEmfFacetMini.gif"; //$NON-NLS-1$ - private static final String FEATURE_ICON_PATH = "icons/full/ctool16/feature.gif"; //$NON-NLS-1$ - private static final String ERROR_ICON_PATH = "icons/error.gif"; //$NON-NLS-1$ - private static final String FACET_ICON_PATH = "icons/Facet.gif"; //$NON-NLS-1$ - private static final String ADD_UI_CUSTOM_ICON_PATH = "icons/full/ctool16/addUiCustom.gif"; //$NON-NLS-1$ - private static final String VIEW_MENU_ICON_PATH = "icons/full/ctool16/view_menu.gif"; //$NON-NLS-1$ - private static final String LINK_TYPE_ICON_PATH = "icons/full/ctool16/link_type.gif"; //$NON-NLS-1$ - private static final String QUERY_ICON_PATH = "icons/query.png"; //$NON-NLS-1$ - private static final String ELEMENT_IDS_ICON_PATH = "/icons/full/ctool16/element_id.gif"; //$NON-NLS-1$ - private static final String URI_ICON_PATH = "/icons/full/ctool16/uri.gif"; //$NON-NLS-1$ - private static final String COLLAPSE_ALL_ICON_PATH = "/icons/full/ctool16/collapseall.gif"; //$NON-NLS-1$ - private static final String SHORTCUT_ICON_PATH = "/icons/shortcut.png"; //$NON-NLS-1$ - private static final String REMOVE_LINE_ICON_PATH = "/icons/full/ctool16/remove_line.gif"; //$NON-NLS-1$ - private static final String DELETE_ELEMENT_ICON_PATH = "/icons/full/ctool16/delete.gif"; //$NON-NLS-1$ - private static final String ADD_ICON_PATH = "/icons/full/ctool16/add.gif"; //$NON-NLS-1$ - private static final String SELECT_COLUMNS_TO_HIDE = "/icons/full/ctool16/select_columns_to_hide.png"; //$NON-NLS-1$ - - /** - * Create an image descriptor from a resource - * - * @param resourcePath - * the path of the resource (in the bundle) - * @return the image descriptor - */ - private static ImageDescriptor createImageDescriptor(final String resourcePath) { - final URL url = Activator.getDefault().getBundle().getResource(resourcePath); - if (url == null) { - Logger.logError(NLS.bind("Resource not found: {0}", //$NON-NLS-1$ - resourcePath), Activator.getDefault()); - return ImageDescriptor.getMissingImageDescriptor(); - } - return ImageDescriptor.createFromURL(url); - } - - /** Return the icon representing a bidirectional link */ - public Image getLinkIcon() { - if (this.linkIcon == null) { - this.linkIcon = createImageDescriptor(ImageProvider.LINK_ICON_PATH).createImage(); - } - return this.linkIcon; - } - - /** Return the icon representing an unidirectional link */ - public Image getUnidirectionalLinkIcon() { - if (this.linkUniDirIcon == null) { - this.linkUniDirIcon = createImageDescriptor(ImageProvider.LINK_UNIDIR_ICON_PATH) - .createImage(); - } - return this.linkUniDirIcon; - } - - /** Return the icon representing a facet reference */ - public Image getFacetLinkIcon() { - if (this.linkFacetIcon == null) { - this.linkFacetIcon = createImageDescriptor(ImageProvider.LINK_FACET_ICON_PATH) - .createImage(); - } - return this.linkFacetIcon; - } - - /** Return the icon representing a composition link */ - public Image getAggregIcon() { - if (this.aggregIcon == null) { - this.aggregIcon = createImageDescriptor(ImageProvider.AGGREG_ICON_PATH).createImage(); - } - return this.aggregIcon; - } - - /** Return the icon representing an unidirectional composition link */ - public Image getUnidirectionalAggregIcon() { - if (this.aggregUniDirIcon == null) { - this.aggregUniDirIcon = createImageDescriptor(ImageProvider.AGGREG_UNIDIR_ICON_PATH) - .createImage(); - } - return this.aggregUniDirIcon; - } - - /** Return the icon representing a reverse composition link */ - public Image getInvAggregIcon() { - if (this.invAggregIcon == null) { - this.invAggregIcon = createImageDescriptor(ImageProvider.INV_AGGREG_ICON_PATH) - .createImage(); - } - return this.invAggregIcon; - } - - /** Return the icon representing empty links */ - public Image getEmptyLinksIcon() { - if (this.emptyLinksIcon == null) { - this.emptyLinksIcon = createImageDescriptor(ImageProvider.EMPTY_LINKS_ICON_PATH) - .createImage(); - } - return this.emptyLinksIcon; - } - - /** Return the icon representing empty links */ - public static ImageDescriptor getEmptyLinksImageDescriptor() { - return createImageDescriptor(ImageProvider.EMPTY_LINKS_ICON_PATH); - } - - /** Return the icon representing sorting of instances */ - public static ImageDescriptor getSortInstancesIcon() { - return createImageDescriptor(ImageProvider.SORT_INSTANCES_ICON_PATH); - } - - /** Return the icon representing sorting of links */ - public Image getSortLinksIcon() { - if (this.sortLinksIcon == null) { - this.sortLinksIcon = createImageDescriptor(ImageProvider.SORT_LINKS_ICON_PATH) - .createImage(); - } - return this.sortLinksIcon; - } - - /** Return the icon representing sorting of links */ - public static ImageDescriptor getSortLinksImageDescriptor() { - return createImageDescriptor(ImageProvider.SORT_LINKS_ICON_PATH); - } - - /** Return the icon representing sorting of links by type */ - public Image getSortLinksByTypeIcon() { - if (this.sortLinksByTypeIcon == null) { - this.sortLinksByTypeIcon = createImageDescriptor( - ImageProvider.SORT_LINKS_BY_TYPE_ICON_PATH).createImage(); - } - return this.sortLinksByTypeIcon; - } - - /** Return the icon representing sorting of links by type */ - public static ImageDescriptor getSortLinksByTypeImageDescriptor() { - return createImageDescriptor(ImageProvider.SORT_LINKS_BY_TYPE_ICON_PATH); - } - - /** Return the icon representing sorting numerically */ - public static ImageDescriptor getSortNumericallyIcon() { - return createImageDescriptor(ImageProvider.SORT_NUMERICALLY_ICON_PATH); - } - - /** Return the icon representing derived links */ - public Image getShowDerivedLinksIcon() { - if (this.showDerivedLinksIcon == null) { - this.showDerivedLinksIcon = createImageDescriptor( - ImageProvider.SHOW_DERIVED_LINKS_ICON_PATH).createImage(); - } - return this.showDerivedLinksIcon; - } - - /** Return the icon representing derived links */ - public static ImageDescriptor getShowDerivedLinksImageDescriptor() { - return createImageDescriptor(ImageProvider.SHOW_DERIVED_LINKS_ICON_PATH); - } - - /** Return the icon representing full qualified names */ - public Image getShowFullQualifiedNamesIcon() { - if (this.showFullQualifiedNamesIcon == null) { - this.showFullQualifiedNamesIcon = createImageDescriptor( - ImageProvider.SHOW_FULL_QUALIFIED_NAMES_ICON_PATH).createImage(); - } - return this.showFullQualifiedNamesIcon; - } - - /** Return the icon representing full qualified names */ - public static ImageDescriptor getShowFullQualifiedNamesImageDescriptor() { - return createImageDescriptor(ImageProvider.SHOW_FULL_QUALIFIED_NAMES_ICON_PATH); - } - - /** Return the icon representing a range */ - public Image getRangeIcon() { - if (this.rangeIcon == null) { - this.rangeIcon = createImageDescriptor(ImageProvider.RANGE_ICON_PATH).createImage(); - } - return this.rangeIcon; - } - - /** Return the multiplicity icon */ - public Image getShowMultiplicityIcon() { - if (this.showMultiplicityIcon == null) { - this.showMultiplicityIcon = createImageDescriptor( - ImageProvider.SHOW_MULTIPLICITY_ICON_PATH).createImage(); - } - return this.showMultiplicityIcon; - } - - /** Return the multiplicity icon */ - public static ImageDescriptor getShowMultiplicityImageDescriptor() { - return createImageDescriptor(ImageProvider.SHOW_MULTIPLICITY_ICON_PATH); - } - - /** Return the "opposite links" icon */ - public Image getShowOppositeLinksIcon() { - if (this.showOppositeLinksIcon == null) { - this.showOppositeLinksIcon = createImageDescriptor( - ImageProvider.SHOW_OPPOSITE_LINKS_ICON_PATH).createImage(); - } - return this.showOppositeLinksIcon; - } - - /** Return the "opposite links" icon */ - public static ImageDescriptor getShowOppositeLinksImageDescriptor() { - return createImageDescriptor(ImageProvider.SHOW_OPPOSITE_LINKS_ICON_PATH); - } - - /** Return the "container" icon */ - public Image getContainerIcon() { - if (this.containerIcon == null) { - this.containerIcon = createImageDescriptor(ImageProvider.CONTAINER_ICON_PATH) - .createImage(); - } - return this.containerIcon; - } - - /** Return the "container" icon */ - public static ImageDescriptor getContainerImageDescriptor() { - return createImageDescriptor(ImageProvider.CONTAINER_ICON_PATH); - } - - /** Return the "show empty metaclasses" icon */ - public static ImageDescriptor getShowEmptyMetaclassesIcon() { - return createImageDescriptor(ImageProvider.EMPTY_METACLASSES_ICON_PATH); - } - - /** Return the "package" icon */ - public Image getPackageIcon() { - if (this.packageIcon == null) { - this.packageIcon = createImageDescriptor(ImageProvider.PACKAGE_ICON_PATH).createImage(); - } - return this.packageIcon; - } - - /** Return the "package" icon */ - public static ImageDescriptor getPackageImageDescriptor() { - return createImageDescriptor(ImageProvider.PACKAGE_ICON_PATH); - } - - // /** Return the "derived instances" icon */ - // public Image getDerivedInstancesIcon() { - // if (this.derivedInstancesIcon == null) { - // this.derivedInstancesIcon = createImageDescriptor( - // ImageProvider.DERIVED_INSTANCES_ICON_PATH).createImage(); - // } - // return this.derivedInstancesIcon; - // } - - /** Return the "derived instances" icon */ - public static ImageDescriptor getDerivedInstancesImageDescriptor() { - return createImageDescriptor(ImageProvider.DERIVED_INSTANCES_ICON_PATH); - } - - /** Return the "derivation tree" icon */ - public static ImageDescriptor getDerivationTreeIcon() { - return createImageDescriptor(ImageProvider.DERIVATION_TREE_ICON_PATH); - } - - /** Return the "attribute" icon */ - public Image getAttributeIcon() { - if (this.attributeIcon == null) { - this.attributeIcon = createImageDescriptor(ImageProvider.ATTRIBUTE_ICON_PATH) - .createImage(); - } - return this.attributeIcon; - } - - /** Return the "attribute" icon */ - public static ImageDescriptor getAttributeImageDescriptor() { - return createImageDescriptor(ImageProvider.ATTRIBUTE_ICON_PATH); - } - - /** Return the "facet attribute" icon */ - public Image getFacetAttributeIcon() { - if (this.attributeFacetIcon == null) { - this.attributeFacetIcon = createImageDescriptor(ImageProvider.ATTRIBUTE_FACET_ICON_PATH) - .createImage(); - } - return this.attributeFacetIcon; - } - - /** Return the "empty attributes" icon */ - public Image getEmptyAttributeIcon() { - if (this.emptyAttributeIcon == null) { - this.emptyAttributeIcon = createImageDescriptor(ImageProvider.EMPTY_ATTRIBUTE_ICON_PATH) - .createImage(); - } - return this.emptyAttributeIcon; - } - - /** Return the "empty attributes" icon */ - public static ImageDescriptor getEmptyAttributeImageDescriptor() { - return createImageDescriptor(ImageProvider.EMPTY_ATTRIBUTE_ICON_PATH); - } - - /** Return the "increase font size" icon */ - public ImageDescriptor getIncreaseFontSizeIcon() { - if (this.increaseFontSizeIcon == null) { - this.increaseFontSizeIcon = createImageDescriptor(ImageProvider.INCREASE_FONT_SIZE_ICON_PATH); - } - return this.increaseFontSizeIcon; - } - - /** Return the "decrease font size" icon */ - public ImageDescriptor getDecreaseFontSizeIcon() { - if (this.decreaseFontSizeIcon == null) { - this.decreaseFontSizeIcon = createImageDescriptor(ImageProvider.DECREASE_FONT_SIZE_ICON_PATH); - } - return this.decreaseFontSizeIcon; - } - - /** Return the "restore font size" icon */ - public ImageDescriptor getRestoreFontSizeIcon() { - if (this.restoreFontSizeIcon == null) { - this.restoreFontSizeIcon = createImageDescriptor(ImageProvider.RESTORE_FONT_SIZE_ICON_PATH); - } - return this.restoreFontSizeIcon; - } - - /** Return the "hide empty columns" icon */ - public Image getHideEmptyColumnsIcon() { - if (this.hideEmptyColumnsIcon == null) { - this.hideEmptyColumnsIcon = createImageDescriptor( - ImageProvider.HIDE_EMPTY_COLUMNS_ICON_PATH).createImage(); - } - return this.hideEmptyColumnsIcon; - } - - /** Return the "hide empty columns" icon */ - public static ImageDescriptor getHideEmptyColumnsIconDescriptor() { - return createImageDescriptor(ImageProvider.HIDE_EMPTY_COLUMNS_ICON_PATH); - } - - /** Return the "common columns" icon */ - public Image getCommonColumnsIcon() { - if (this.commonColumnsIcon == null) { - this.commonColumnsIcon = createImageDescriptor(ImageProvider.COMMON_COLUMNS_ICON_PATH) - .createImage(); - } - return this.commonColumnsIcon; - } - - /** Return the "common columns" icon */ - public static ImageDescriptor getCommonColumnsIconDescriptor() { - return createImageDescriptor(ImageProvider.COMMON_COLUMNS_ICON_PATH); - } - - /** Return the "delete line" icon */ - public static ImageDescriptor getRemoveLineIconDescriptor() { - return createImageDescriptor(ImageProvider.REMOVE_LINE_ICON_PATH); - } - - /** Return the "delete element" icon */ - public static ImageDescriptor getDeleteElementIconDescriptor() { - return createImageDescriptor(ImageProvider.DELETE_ELEMENT_ICON_PATH); - } - - /** Return the "add" icon */ - public static ImageDescriptor getAddIconDescriptor() { - return createImageDescriptor(ImageProvider.ADD_ICON_PATH); - } - - /** Return the "ordering" icon */ - public Image getOrderingIcon() { - if (this.orderingIcon == null) { - this.orderingIcon = createImageDescriptor(ImageProvider.ORDERING_ICON_PATH) - .createImage(); - } - return this.orderingIcon; - } - - /** Return the "ordering" icon */ - public static ImageDescriptor getOrderingIconDescriptor() { - return createImageDescriptor(ImageProvider.ORDERING_ICON_PATH); - } - - /** Return the "ordering" icon */ - public static ImageDescriptor getOrderingImageDescriptor() { - return createImageDescriptor(ImageProvider.ORDERING_ICON_PATH); - } - - /** Return the "eClass" icon */ - public Image getEClassIcon() { - if (this.eClassIcon == null) { - this.eClassIcon = createImageDescriptor(ImageProvider.ECLASS_ICON_PATH).createImage(); - } - return this.eClassIcon; - } - - /** Return the "operation" icon */ - public Image getOperationIcon() { - if (this.operationIcon == null) { - this.operationIcon = createImageDescriptor(ImageProvider.OPERATION_ICON_PATH) - .createImage(); - } - return this.operationIcon; - } - - /** Return the "predicate" icon */ - public Image getPredicateIcon() { - if (this.predicateIcon == null) { - this.predicateIcon = createImageDescriptor(ImageProvider.PREDICATE_ICON_PATH) - .createImage(); - } - return this.predicateIcon; - } - - /** Return the "EmfFacet" icon */ - public Image getEmfFacetIcon() { - if (this.emffacetIcon == null) { - this.emffacetIcon = createImageDescriptor(ImageProvider.EMFFACET_ICON_PATH) - .createImage(); - } - return this.emffacetIcon; - } - - /** Return an icon representing the concept of "feature" */ - public Image getFeatureIcon() { - if (this.featureIcon == null) { - this.featureIcon = createImageDescriptor(ImageProvider.FEATURE_ICON_PATH).createImage(); - } - return this.featureIcon; - } - - /** Return an icon descriptor representing the concept of "feature" */ - public static ImageDescriptor getFeatureIconDescriptor() { - return createImageDescriptor(ImageProvider.FEATURE_ICON_PATH); - } - - /** Return an icon descriptor representing the concept of "facet" */ - public static ImageDescriptor getFacetIconDescriptor() { - return createImageDescriptor(ImageProvider.FACET_ICON_PATH); - } - - /** Return an icon descriptor representing the concept of "facet" */ - public Image getFacetIcon() { - if (this.facetIcon == null) { - this.facetIcon = createImageDescriptor(ImageProvider.FACET_ICON_PATH).createImage(); - } - return this.facetIcon; - } - - /** Return an icon descriptor for "uiCustom" */ - public static ImageDescriptor getAddUiCustomIconDescriptor() { - return createImageDescriptor(ImageProvider.ADD_UI_CUSTOM_ICON_PATH); - } - - /** Return an icon for "uiCustom" */ - public Image getUiCustomIcon() { - if (this.uiCustomIcon == null) { - this.uiCustomIcon = createImageDescriptor(ImageProvider.ADD_UI_CUSTOM_ICON_PATH) - .createImage(); - } - return this.uiCustomIcon; - } - - /** Return the "error" icon */ - public Image getErrorIcon() { - if (this.errorIcon == null) { - this.errorIcon = createImageDescriptor(ImageProvider.ERROR_ICON_PATH).createImage(); - } - return this.errorIcon; - } - - /** Return the toolbar menu icon */ - public Image getViewMenuIcon() { - if (this.viewMenuIcon == null) { - this.viewMenuIcon = createImageDescriptor(ImageProvider.VIEW_MENU_ICON_PATH) - .createImage(); - } - return this.viewMenuIcon; - } - - /** Return the query menu icon */ - public Image getQueryIcon() { - if (this.queryIcon == null) { - this.queryIcon = createImageDescriptor(ImageProvider.QUERY_ICON_PATH).createImage(); - } - return this.queryIcon; - } - - /** Return the link type icon */ - public Image getLinkTypeIcon() { - if (this.linkTypeIcon == null) { - this.linkTypeIcon = createImageDescriptor(ImageProvider.LINK_TYPE_ICON_PATH) - .createImage(); - } - return this.linkTypeIcon; - } - - /** Return the link type icon descriptor */ - public static ImageDescriptor getLinkTypeIconDescriptor() { - return createImageDescriptor(ImageProvider.LINK_TYPE_ICON_PATH); - } - - /** Return the "element ID" icon descriptor */ - public static ImageDescriptor getShowElementIDsDescriptor() { - return createImageDescriptor(ImageProvider.ELEMENT_IDS_ICON_PATH); - } - - public static ImageDescriptor getShowURIDescriptor() { - return createImageDescriptor(ImageProvider.URI_ICON_PATH); - } - - public Image getURIIcon() { - if (this.uriIcon == null) { - this.uriIcon = createImageDescriptor(ImageProvider.URI_ICON_PATH).createImage(); - } - return this.uriIcon; - } - - public static ImageDescriptor getCollapseAllDescriptor() { - return createImageDescriptor(ImageProvider.COLLAPSE_ALL_ICON_PATH); - } - - public Image getShortcutIcon() { - if (this.shortcutIcon == null) { - this.shortcutIcon = createImageDescriptor(ImageProvider.SHORTCUT_ICON_PATH) - .createImage(); - } - return this.shortcutIcon; - } - - public static ImageDescriptor getSelectColumnsToHideDescriptor() { - return createImageDescriptor(ImageProvider.SELECT_COLUMNS_TO_HIDE); - } - - public Image getSelectColumnsToHide() { - if (this.selectColumnsToHide == null) { - this.selectColumnsToHide = createImageDescriptor(ImageProvider.SELECT_COLUMNS_TO_HIDE) - .createImage(); - } - return this.selectColumnsToHide; - } -}
diff --git a/org.eclipse.modisco.facet.widgets/src/org/eclipse/modisco/facet/widgets/internal/Activator.java b/org.eclipse.modisco.facet.widgets/src/org/eclipse/modisco/facet/widgets/internal/Activator.java new file mode 100644 index 0000000..3910948 --- /dev/null +++ b/org.eclipse.modisco.facet.widgets/src/org/eclipse/modisco/facet/widgets/internal/Activator.java
@@ -0,0 +1,69 @@ +/******************************************************************************* + * Copyright (c) 2010 Mia-Software. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Nicolas Bros (Mia-Software) - initial API and implementation + * Nicolas Bros (Mia-Software) - Bug 339653 - org.eclipse.emf.facet.widgets API Cleaning + *******************************************************************************/ +package org.eclipse.modisco.facet.widgets.internal; + +import org.eclipse.ui.plugin.AbstractUIPlugin; +import org.osgi.framework.BundleContext; + +/** + * The activator class controls the plug-in life cycle + */ +public class Activator extends AbstractUIPlugin { + + // The plug-in ID + public static final String PLUGIN_ID = "org.eclipse.emf.facet.widgets"; //$NON-NLS-1$ + + // The shared instance + private static Activator plugin; + + /** + * The constructor + */ + public Activator() { + } + + /* + * (non-Javadoc) + * + * @see + * org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext + * ) + */ + @Override + public void start(final BundleContext context) throws Exception { + super.start(context); + Activator.plugin = this; + } + + /* + * (non-Javadoc) + * + * @see + * org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext + * ) + */ + @Override + public void stop(final BundleContext context) throws Exception { + Activator.plugin = null; + super.stop(context); + } + + /** + * Returns the shared instance + * + * @return the shared instance + */ + public static Activator getDefault() { + return Activator.plugin; + } + +}
diff --git a/org.eclipse.modisco.facet.widgets/src/org/eclipse/modisco/facet/widgets/internal/CustomizableLabelProvider.java b/org.eclipse.modisco.facet.widgets/src/org/eclipse/modisco/facet/widgets/internal/CustomizableLabelProvider.java new file mode 100644 index 0000000..9732493 --- /dev/null +++ b/org.eclipse.modisco.facet.widgets/src/org/eclipse/modisco/facet/widgets/internal/CustomizableLabelProvider.java
@@ -0,0 +1,235 @@ +/******************************************************************************* + * Copyright (c) 2010 Mia-Software. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Nicolas Bros (Mia-Software) - initial API and implementation + * Nicolas Bros (Mia-Software) - Bug 339653 - org.eclipse.emf.facet.widgets API Cleaning + * Gregoire Dupe (Mia-Software) - Bug 369987 - [Restructuring][Table] Switch to the new customization and facet framework + *******************************************************************************/ + +package org.eclipse.modisco.facet.widgets.internal; + +import org.eclipse.emf.ecore.EAttribute; +import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.ecore.EReference; +import org.eclipse.emf.edit.provider.ComposedAdapterFactory; +import org.eclipse.emf.edit.provider.IItemLabelProvider; +import org.eclipse.emf.edit.provider.ReflectiveItemProviderAdapterFactory; +import org.eclipse.emf.edit.provider.resource.ResourceItemProviderAdapterFactory; +import org.eclipse.emf.edit.ui.provider.ExtendedImageRegistry; +import org.eclipse.jface.viewers.LabelProvider; +import org.eclipse.modisco.facet.custom.core.ICustomizationManager; +import org.eclipse.modisco.facet.custom.ui.ICustomizedLabelProvider; +import org.eclipse.modisco.facet.custom.ui.ICustomizedLabelProviderFactory; +import org.eclipse.swt.graphics.Image; + +@Deprecated +public class CustomizableLabelProvider extends LabelProvider { + + private final ComposedAdapterFactory adapterFactoryWithRegistry; + private ICustomizationManager customizationEngine; + private ICustomizedLabelProvider labelProvider; + + public CustomizableLabelProvider(final ICustomizationManager customizationEngine) { + this(); + this.customizationEngine = customizationEngine; + this.labelProvider = ICustomizedLabelProviderFactory.DEFAULT.createCustomizedLabelProvider(customizationEngine); + } + + public CustomizableLabelProvider() { + this.adapterFactoryWithRegistry = new ComposedAdapterFactory( + ComposedAdapterFactory.Descriptor.Registry.INSTANCE); + this.adapterFactoryWithRegistry.addAdapterFactory(new ResourceItemProviderAdapterFactory()); + this.adapterFactoryWithRegistry + .addAdapterFactory(new ReflectiveItemProviderAdapterFactory()); + } + + @Override + public String getText(final Object element) { + if (element instanceof EReference) { + EReference eReference = (EReference) element; + return getText(eReference); + } + if (element instanceof EAttribute) { + EAttribute eAttribute = (EAttribute) element; + return getText(eAttribute); + } + if (element instanceof EObject) { + EObject eObject = (EObject) element; + return getText(eObject); + } + return element.toString(); + } + + public String getText(final EObject eObject) { + if (this.customizationEngine != null) { + String label = this.labelProvider.getText(eObject); + if (label != null) { + return label; + } + } + + final IItemLabelProvider itemLabelProvider = (IItemLabelProvider) this.adapterFactoryWithRegistry + .adapt(eObject, IItemLabelProvider.class); + + if (itemLabelProvider != null) { + return itemLabelProvider.getText(eObject); + } + return null; + } + + public static String getText(final EReference reference) { + boolean showMultiplicity = true; + boolean showOpposite = false; + // String customizedName = null; + + String multiplicity = ""; //$NON-NLS-1$ + + if (showMultiplicity) { + multiplicity = getMultiplicity(reference); + } + + String opposite = ""; //$NON-NLS-1$ + + if (showOpposite) { + final EReference oppositeRef = reference.getEOpposite(); + if (oppositeRef != null) { + String oppositeMultiplicity = ""; //$NON-NLS-1$ + if (showMultiplicity) { + oppositeMultiplicity = getMultiplicity(oppositeRef); + } + + opposite = " <-> " + oppositeRef.getName() + oppositeMultiplicity; //$NON-NLS-1$ + } + } + + final String prefix; + if (reference.isDerived()) { + prefix = "/"; //$NON-NLS-1$ + } else { + prefix = ""; //$NON-NLS-1$ + } + final String referenceName; + // if (customizedName != null) { + // referenceName = customizedName; + // } else { + referenceName = reference.getName(); + // } + return prefix + referenceName + multiplicity + opposite; + } + + public static String getMultiplicity(final EReference reference) { + final String multLow; + if (reference.isRequired()) { + multLow = "1"; //$NON-NLS-1$ + } else { + multLow = "0"; //$NON-NLS-1$ + } + final String multHigh; + if (reference.isMany()) { + multHigh = "*"; //$NON-NLS-1$ + } else { + multHigh = "1"; //$NON-NLS-1$ + } + return " [" + multLow + ".." + multHigh + "]"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + } + + public static String getText(final EAttribute attribute) { + String multiplicity = ""; //$NON-NLS-1$ + + if (true /* showMultiplicity */) { + final String multLow; + if (attribute.isRequired()) { + multLow = "1"; //$NON-NLS-1$ + } else { + multLow = "0"; //$NON-NLS-1$ + } + final String multHigh; + if (attribute.isMany()) { + multHigh = "*"; //$NON-NLS-1$ + } else { + multHigh = "1"; //$NON-NLS-1$ + } + multiplicity = " [" + multLow + ".." + multHigh + "]"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + } + + final String prefix; + if (attribute.isDerived()) { + prefix = "/"; //$NON-NLS-1$ + } else { + prefix = ""; //$NON-NLS-1$ + } + + final String attributeName = attribute.getName(); + return prefix + attributeName + multiplicity; + } + + @Override + public Image getImage(final Object element) { + if (element instanceof EReference) { + EReference eReference = (EReference) element; + return getImage(eReference); + } + if (element instanceof EAttribute) { + EAttribute eAttribute = (EAttribute) element; + return getImage(eAttribute); + } + if (element instanceof EObject) { + EObject eObject = (EObject) element; + return getImage(eObject); + } + return null; + } + + public Image getImage(final EObject eObject) { + if (this.customizationEngine != null) { + Image image = this.labelProvider.getImage(eObject); + if (image != null) { + return image; + } + } + + final IItemLabelProvider itemLabelProvider = (IItemLabelProvider) this.adapterFactoryWithRegistry + .adapt(eObject, IItemLabelProvider.class); + + if (itemLabelProvider != null) { + final Object image = itemLabelProvider.getImage(eObject); + return ExtendedImageRegistry.getInstance().getImage(image); + } + return null; + } + + public static Image getImage(final EReference reference) { + // if (reference instanceof FacetReference || reference instanceof + // Shortcut) { + // return ImageProvider.getInstance().getFacetLinkIcon(); + // } + + final EReference opposite = reference.getEOpposite(); + + if (reference.isContainment()) { + if (opposite == null) { + return ImageProvider.getInstance().getUnidirectionalAggregIcon(); + } + return ImageProvider.getInstance().getAggregIcon(); + } + + if (opposite != null && opposite.isContainment()) { + return ImageProvider.getInstance().getInvAggregIcon(); + } + + if (opposite == null) { + return ImageProvider.getInstance().getUnidirectionalLinkIcon(); + } + return ImageProvider.getInstance().getLinkIcon(); + } + + public static Image getImage(@SuppressWarnings("unused") final EAttribute eAttribute) { + return ImageProvider.getInstance().getAttributeIcon(); + } + +}
diff --git a/org.eclipse.modisco.facet.widgets/src/org/eclipse/modisco/facet/widgets/internal/ImageProvider.java b/org.eclipse.modisco.facet.widgets/src/org/eclipse/modisco/facet/widgets/internal/ImageProvider.java new file mode 100644 index 0000000..402a71d --- /dev/null +++ b/org.eclipse.modisco.facet.widgets/src/org/eclipse/modisco/facet/widgets/internal/ImageProvider.java
@@ -0,0 +1,652 @@ +/******************************************************************************* + * Copyright (c) 2008, 2010 Mia-Software. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Nicolas Bros (Mia-Software) - initial API and implementation + * Nicolas Bros (Mia-Software) - Bug 339653 - org.eclipse.emf.facet.widgets API Cleaning + * Vincent Lorenzo (CEA-LIST) - bug 341192 - Add the method to get the image for Select Columns To Hide in the ImageManager + *******************************************************************************/ +package org.eclipse.modisco.facet.widgets.internal; + +import java.net.URL; + +import org.eclipse.jface.resource.ImageDescriptor; +import org.eclipse.modisco.facet.util.core.Logger; +import org.eclipse.osgi.util.NLS; +import org.eclipse.swt.graphics.Image; + +/** A singleton image provider, which caches image descriptors */ +public final class ImageProvider { + + private ImageProvider() { + // This class must only be instantiated by getInstance(). + } + + private static ImageProvider instance; + + public static ImageProvider getInstance() { + if (ImageProvider.instance == null) { + ImageProvider.instance = new ImageProvider(); + } + return ImageProvider.instance; + } + + private Image linkIcon = null; + private Image linkUniDirIcon = null; + private Image linkFacetIcon = null; + private Image aggregIcon = null; + private Image aggregUniDirIcon = null; + private Image invAggregIcon = null; + + private Image emptyLinksIcon = null; + // private Image sortInstancesIcon = null; + private Image sortLinksIcon = null; + private Image sortLinksByTypeIcon = null; + // private Image sortNumericallyIcon = null; + private Image showDerivedLinksIcon = null; + private Image showFullQualifiedNamesIcon = null; + private Image showMultiplicityIcon = null; + private Image showOppositeLinksIcon = null; + + private Image rangeIcon = null; + private Image containerIcon = null; + // private Image emptyMetaclassesIcon = null; + private Image packageIcon = null; + // private Image derivedInstancesIcon = null; + // private Image derivationTreeIcon = null; + private Image attributeIcon = null; + private Image attributeFacetIcon = null; + private Image emptyAttributeIcon = null; + private Image orderingIcon = null; + private Image linkTypeIcon = null; + + private Image facetIcon = null; + private Image viewMenuIcon = null; + + private ImageDescriptor increaseFontSizeIcon = null; + private ImageDescriptor decreaseFontSizeIcon = null; + private ImageDescriptor restoreFontSizeIcon = null; + + private Image hideEmptyColumnsIcon = null; + private Image commonColumnsIcon = null; + private Image eClassIcon = null; + private Image operationIcon = null; + private Image predicateIcon = null; + private Image emffacetIcon = null; + private Image featureIcon = null; + private Image errorIcon = null; + private Image queryIcon = null; + private Image uiCustomIcon = null; + private Image uriIcon = null; + + private Image shortcutIcon = null; + + private Image selectColumnsToHide = null; + + private static final String LINK_ICON_PATH = "/icons/full/ctool16/link.gif"; //$NON-NLS-1$ + private static final String LINK_UNIDIR_ICON_PATH = "/icons/full/ctool16/link_unidir.gif"; //$NON-NLS-1$ + private static final String LINK_FACET_ICON_PATH = "/icons/full/ctool16/link_unidir_facet.gif"; //$NON-NLS-1$ + private static final String AGGREG_ICON_PATH = "/icons/full/ctool16/aggreg.gif"; //$NON-NLS-1$ + private static final String AGGREG_UNIDIR_ICON_PATH = "/icons/full/ctool16/aggreg_unidir.gif"; //$NON-NLS-1$ + private static final String INV_AGGREG_ICON_PATH = "/icons/full/ctool16/inv_aggreg.gif"; //$NON-NLS-1$ + private static final String EMPTY_LINKS_ICON_PATH = "/icons/full/ctool16/empty_links.gif"; //$NON-NLS-1$ + private static final String SORT_INSTANCES_ICON_PATH = "/icons/full/ctool16/sort.gif"; //$NON-NLS-1$ + private static final String SORT_LINKS_ICON_PATH = "/icons/full/ctool16/sort_links.gif"; //$NON-NLS-1$ + private static final String SORT_LINKS_BY_TYPE_ICON_PATH = "/icons/full/ctool16/sort_links_by_type.gif"; //$NON-NLS-1$ + private static final String SORT_NUMERICALLY_ICON_PATH = "/icons/full/ctool16/sort_num.gif"; //$NON-NLS-1$ + private static final String SHOW_DERIVED_LINKS_ICON_PATH = "/icons/full/ctool16/derived.gif"; //$NON-NLS-1$ + private static final String SHOW_FULL_QUALIFIED_NAMES_ICON_PATH = "/icons/full/ctool16/full_name.gif"; //$NON-NLS-1$ + private static final String RANGE_ICON_PATH = "/icons/full/ctool16/range.gif"; //$NON-NLS-1$ + private static final String SHOW_MULTIPLICITY_ICON_PATH = "/icons/full/ctool16/multiplicity.gif"; //$NON-NLS-1$ + private static final String SHOW_OPPOSITE_LINKS_ICON_PATH = "/icons/full/ctool16/opposite_links.gif"; //$NON-NLS-1$ + private static final String CONTAINER_ICON_PATH = "/icons/full/ctool16/container.gif"; //$NON-NLS-1$ + private static final String EMPTY_METACLASSES_ICON_PATH = "/icons/full/ctool16/zero.gif"; //$NON-NLS-1$ + private static final String PACKAGE_ICON_PATH = "/icons/full/ctool16/package.gif"; //$NON-NLS-1$ + private static final String DERIVED_INSTANCES_ICON_PATH = "/icons/full/ctool16/derived_instances.gif"; //$NON-NLS-1$ + private static final String DERIVATION_TREE_ICON_PATH = "/icons/full/ctool16/derivation_tree.gif"; //$NON-NLS-1$ + private static final String ATTRIBUTE_ICON_PATH = "/icons/full/ctool16/attributes.gif"; //$NON-NLS-1$ + private static final String ATTRIBUTE_FACET_ICON_PATH = "/icons/full/ctool16/attribute_facet.gif"; //$NON-NLS-1$ + private static final String EMPTY_ATTRIBUTE_ICON_PATH = "/icons/full/ctool16/empty_attributes.gif"; //$NON-NLS-1$ + private static final String INCREASE_FONT_SIZE_ICON_PATH = "/icons/full/ctool16/increase_font_size.gif"; //$NON-NLS-1$ + private static final String DECREASE_FONT_SIZE_ICON_PATH = "/icons/full/ctool16/decrease_font_size.gif"; //$NON-NLS-1$ + private static final String RESTORE_FONT_SIZE_ICON_PATH = "/icons/full/ctool16/restore_font_size.gif"; //$NON-NLS-1$ + private static final String HIDE_EMPTY_COLUMNS_ICON_PATH = "/icons/full/ctool16/non-zero.gif"; //$NON-NLS-1$ + private static final String COMMON_COLUMNS_ICON_PATH = "/icons/full/ctool16/common_columns.gif"; //$NON-NLS-1$ + private static final String ORDERING_ICON_PATH = "/icons/full/ctool16/ordering.gif"; //$NON-NLS-1$ + private static final String ECLASS_ICON_PATH = "/icons/full/ctool16/eClass.gif"; //$NON-NLS-1$ + private static final String OPERATION_ICON_PATH = "/icons/full/ctool16/operation.gif"; //$NON-NLS-1$ + private static final String PREDICATE_ICON_PATH = "/icons/full/ctool16/predicate.gif"; //$NON-NLS-1$ + private static final String EMFFACET_ICON_PATH = "icons/logoEmfFacetMini.gif"; //$NON-NLS-1$ + private static final String FEATURE_ICON_PATH = "icons/full/ctool16/feature.gif"; //$NON-NLS-1$ + private static final String ERROR_ICON_PATH = "icons/error.gif"; //$NON-NLS-1$ + private static final String FACET_ICON_PATH = "icons/Facet.gif"; //$NON-NLS-1$ + private static final String ADD_UI_CUSTOM_ICON_PATH = "icons/full/ctool16/addUiCustom.gif"; //$NON-NLS-1$ + private static final String VIEW_MENU_ICON_PATH = "icons/full/ctool16/view_menu.gif"; //$NON-NLS-1$ + private static final String LINK_TYPE_ICON_PATH = "icons/full/ctool16/link_type.gif"; //$NON-NLS-1$ + private static final String QUERY_ICON_PATH = "icons/query.png"; //$NON-NLS-1$ + private static final String ELEMENT_IDS_ICON_PATH = "/icons/full/ctool16/element_id.gif"; //$NON-NLS-1$ + private static final String URI_ICON_PATH = "/icons/full/ctool16/uri.gif"; //$NON-NLS-1$ + private static final String COLLAPSE_ALL_ICON_PATH = "/icons/full/ctool16/collapseall.gif"; //$NON-NLS-1$ + private static final String SHORTCUT_ICON_PATH = "/icons/shortcut.png"; //$NON-NLS-1$ + private static final String REMOVE_LINE_ICON_PATH = "/icons/full/ctool16/remove_line.gif"; //$NON-NLS-1$ + private static final String DELETE_ELEMENT_ICON_PATH = "/icons/full/ctool16/delete.gif"; //$NON-NLS-1$ + private static final String ADD_ICON_PATH = "/icons/full/ctool16/add.gif"; //$NON-NLS-1$ + private static final String SELECT_COLUMNS_TO_HIDE = "/icons/full/ctool16/select_columns_to_hide.png"; //$NON-NLS-1$ + + /** + * Create an image descriptor from a resource + * + * @param resourcePath + * the path of the resource (in the bundle) + * @return the image descriptor + */ + private static ImageDescriptor createImageDescriptor(final String resourcePath) { + final URL url = Activator.getDefault().getBundle().getResource(resourcePath); + if (url == null) { + Logger.logError(NLS.bind("Resource not found: {0}", //$NON-NLS-1$ + resourcePath), Activator.getDefault()); + return ImageDescriptor.getMissingImageDescriptor(); + } + return ImageDescriptor.createFromURL(url); + } + + /** Return the icon representing a bidirectional link */ + public Image getLinkIcon() { + if (this.linkIcon == null) { + this.linkIcon = createImageDescriptor(ImageProvider.LINK_ICON_PATH).createImage(); + } + return this.linkIcon; + } + + /** Return the icon representing an unidirectional link */ + public Image getUnidirectionalLinkIcon() { + if (this.linkUniDirIcon == null) { + this.linkUniDirIcon = createImageDescriptor(ImageProvider.LINK_UNIDIR_ICON_PATH) + .createImage(); + } + return this.linkUniDirIcon; + } + + /** Return the icon representing a facet reference */ + public Image getFacetLinkIcon() { + if (this.linkFacetIcon == null) { + this.linkFacetIcon = createImageDescriptor(ImageProvider.LINK_FACET_ICON_PATH) + .createImage(); + } + return this.linkFacetIcon; + } + + /** Return the icon representing a composition link */ + public Image getAggregIcon() { + if (this.aggregIcon == null) { + this.aggregIcon = createImageDescriptor(ImageProvider.AGGREG_ICON_PATH).createImage(); + } + return this.aggregIcon; + } + + /** Return the icon representing an unidirectional composition link */ + public Image getUnidirectionalAggregIcon() { + if (this.aggregUniDirIcon == null) { + this.aggregUniDirIcon = createImageDescriptor(ImageProvider.AGGREG_UNIDIR_ICON_PATH) + .createImage(); + } + return this.aggregUniDirIcon; + } + + /** Return the icon representing a reverse composition link */ + public Image getInvAggregIcon() { + if (this.invAggregIcon == null) { + this.invAggregIcon = createImageDescriptor(ImageProvider.INV_AGGREG_ICON_PATH) + .createImage(); + } + return this.invAggregIcon; + } + + /** Return the icon representing empty links */ + public Image getEmptyLinksIcon() { + if (this.emptyLinksIcon == null) { + this.emptyLinksIcon = createImageDescriptor(ImageProvider.EMPTY_LINKS_ICON_PATH) + .createImage(); + } + return this.emptyLinksIcon; + } + + /** Return the icon representing empty links */ + public static ImageDescriptor getEmptyLinksImageDescriptor() { + return createImageDescriptor(ImageProvider.EMPTY_LINKS_ICON_PATH); + } + + /** Return the icon representing sorting of instances */ + public static ImageDescriptor getSortInstancesIcon() { + return createImageDescriptor(ImageProvider.SORT_INSTANCES_ICON_PATH); + } + + /** Return the icon representing sorting of links */ + public Image getSortLinksIcon() { + if (this.sortLinksIcon == null) { + this.sortLinksIcon = createImageDescriptor(ImageProvider.SORT_LINKS_ICON_PATH) + .createImage(); + } + return this.sortLinksIcon; + } + + /** Return the icon representing sorting of links */ + public static ImageDescriptor getSortLinksImageDescriptor() { + return createImageDescriptor(ImageProvider.SORT_LINKS_ICON_PATH); + } + + /** Return the icon representing sorting of links by type */ + public Image getSortLinksByTypeIcon() { + if (this.sortLinksByTypeIcon == null) { + this.sortLinksByTypeIcon = createImageDescriptor( + ImageProvider.SORT_LINKS_BY_TYPE_ICON_PATH).createImage(); + } + return this.sortLinksByTypeIcon; + } + + /** Return the icon representing sorting of links by type */ + public static ImageDescriptor getSortLinksByTypeImageDescriptor() { + return createImageDescriptor(ImageProvider.SORT_LINKS_BY_TYPE_ICON_PATH); + } + + /** Return the icon representing sorting numerically */ + public static ImageDescriptor getSortNumericallyIcon() { + return createImageDescriptor(ImageProvider.SORT_NUMERICALLY_ICON_PATH); + } + + /** Return the icon representing derived links */ + public Image getShowDerivedLinksIcon() { + if (this.showDerivedLinksIcon == null) { + this.showDerivedLinksIcon = createImageDescriptor( + ImageProvider.SHOW_DERIVED_LINKS_ICON_PATH).createImage(); + } + return this.showDerivedLinksIcon; + } + + /** Return the icon representing derived links */ + public static ImageDescriptor getShowDerivedLinksImageDescriptor() { + return createImageDescriptor(ImageProvider.SHOW_DERIVED_LINKS_ICON_PATH); + } + + /** Return the icon representing full qualified names */ + public Image getShowFullQualifiedNamesIcon() { + if (this.showFullQualifiedNamesIcon == null) { + this.showFullQualifiedNamesIcon = createImageDescriptor( + ImageProvider.SHOW_FULL_QUALIFIED_NAMES_ICON_PATH).createImage(); + } + return this.showFullQualifiedNamesIcon; + } + + /** Return the icon representing full qualified names */ + public static ImageDescriptor getShowFullQualifiedNamesImageDescriptor() { + return createImageDescriptor(ImageProvider.SHOW_FULL_QUALIFIED_NAMES_ICON_PATH); + } + + /** Return the icon representing a range */ + public Image getRangeIcon() { + if (this.rangeIcon == null) { + this.rangeIcon = createImageDescriptor(ImageProvider.RANGE_ICON_PATH).createImage(); + } + return this.rangeIcon; + } + + /** Return the multiplicity icon */ + public Image getShowMultiplicityIcon() { + if (this.showMultiplicityIcon == null) { + this.showMultiplicityIcon = createImageDescriptor( + ImageProvider.SHOW_MULTIPLICITY_ICON_PATH).createImage(); + } + return this.showMultiplicityIcon; + } + + /** Return the multiplicity icon */ + public static ImageDescriptor getShowMultiplicityImageDescriptor() { + return createImageDescriptor(ImageProvider.SHOW_MULTIPLICITY_ICON_PATH); + } + + /** Return the "opposite links" icon */ + public Image getShowOppositeLinksIcon() { + if (this.showOppositeLinksIcon == null) { + this.showOppositeLinksIcon = createImageDescriptor( + ImageProvider.SHOW_OPPOSITE_LINKS_ICON_PATH).createImage(); + } + return this.showOppositeLinksIcon; + } + + /** Return the "opposite links" icon */ + public static ImageDescriptor getShowOppositeLinksImageDescriptor() { + return createImageDescriptor(ImageProvider.SHOW_OPPOSITE_LINKS_ICON_PATH); + } + + /** Return the "container" icon */ + public Image getContainerIcon() { + if (this.containerIcon == null) { + this.containerIcon = createImageDescriptor(ImageProvider.CONTAINER_ICON_PATH) + .createImage(); + } + return this.containerIcon; + } + + /** Return the "container" icon */ + public static ImageDescriptor getContainerImageDescriptor() { + return createImageDescriptor(ImageProvider.CONTAINER_ICON_PATH); + } + + /** Return the "show empty metaclasses" icon */ + public static ImageDescriptor getShowEmptyMetaclassesIcon() { + return createImageDescriptor(ImageProvider.EMPTY_METACLASSES_ICON_PATH); + } + + /** Return the "package" icon */ + public Image getPackageIcon() { + if (this.packageIcon == null) { + this.packageIcon = createImageDescriptor(ImageProvider.PACKAGE_ICON_PATH).createImage(); + } + return this.packageIcon; + } + + /** Return the "package" icon */ + public static ImageDescriptor getPackageImageDescriptor() { + return createImageDescriptor(ImageProvider.PACKAGE_ICON_PATH); + } + + // /** Return the "derived instances" icon */ + // public Image getDerivedInstancesIcon() { + // if (this.derivedInstancesIcon == null) { + // this.derivedInstancesIcon = createImageDescriptor( + // ImageProvider.DERIVED_INSTANCES_ICON_PATH).createImage(); + // } + // return this.derivedInstancesIcon; + // } + + /** Return the "derived instances" icon */ + public static ImageDescriptor getDerivedInstancesImageDescriptor() { + return createImageDescriptor(ImageProvider.DERIVED_INSTANCES_ICON_PATH); + } + + /** Return the "derivation tree" icon */ + public static ImageDescriptor getDerivationTreeIcon() { + return createImageDescriptor(ImageProvider.DERIVATION_TREE_ICON_PATH); + } + + /** Return the "attribute" icon */ + public Image getAttributeIcon() { + if (this.attributeIcon == null) { + this.attributeIcon = createImageDescriptor(ImageProvider.ATTRIBUTE_ICON_PATH) + .createImage(); + } + return this.attributeIcon; + } + + /** Return the "attribute" icon */ + public static ImageDescriptor getAttributeImageDescriptor() { + return createImageDescriptor(ImageProvider.ATTRIBUTE_ICON_PATH); + } + + /** Return the "facet attribute" icon */ + public Image getFacetAttributeIcon() { + if (this.attributeFacetIcon == null) { + this.attributeFacetIcon = createImageDescriptor(ImageProvider.ATTRIBUTE_FACET_ICON_PATH) + .createImage(); + } + return this.attributeFacetIcon; + } + + /** Return the "empty attributes" icon */ + public Image getEmptyAttributeIcon() { + if (this.emptyAttributeIcon == null) { + this.emptyAttributeIcon = createImageDescriptor(ImageProvider.EMPTY_ATTRIBUTE_ICON_PATH) + .createImage(); + } + return this.emptyAttributeIcon; + } + + /** Return the "empty attributes" icon */ + public static ImageDescriptor getEmptyAttributeImageDescriptor() { + return createImageDescriptor(ImageProvider.EMPTY_ATTRIBUTE_ICON_PATH); + } + + /** Return the "increase font size" icon */ + public ImageDescriptor getIncreaseFontSizeIcon() { + if (this.increaseFontSizeIcon == null) { + this.increaseFontSizeIcon = createImageDescriptor(ImageProvider.INCREASE_FONT_SIZE_ICON_PATH); + } + return this.increaseFontSizeIcon; + } + + /** Return the "decrease font size" icon */ + public ImageDescriptor getDecreaseFontSizeIcon() { + if (this.decreaseFontSizeIcon == null) { + this.decreaseFontSizeIcon = createImageDescriptor(ImageProvider.DECREASE_FONT_SIZE_ICON_PATH); + } + return this.decreaseFontSizeIcon; + } + + /** Return the "restore font size" icon */ + public ImageDescriptor getRestoreFontSizeIcon() { + if (this.restoreFontSizeIcon == null) { + this.restoreFontSizeIcon = createImageDescriptor(ImageProvider.RESTORE_FONT_SIZE_ICON_PATH); + } + return this.restoreFontSizeIcon; + } + + /** Return the "hide empty columns" icon */ + public Image getHideEmptyColumnsIcon() { + if (this.hideEmptyColumnsIcon == null) { + this.hideEmptyColumnsIcon = createImageDescriptor( + ImageProvider.HIDE_EMPTY_COLUMNS_ICON_PATH).createImage(); + } + return this.hideEmptyColumnsIcon; + } + + /** Return the "hide empty columns" icon */ + public static ImageDescriptor getHideEmptyColumnsIconDescriptor() { + return createImageDescriptor(ImageProvider.HIDE_EMPTY_COLUMNS_ICON_PATH); + } + + /** Return the "common columns" icon */ + public Image getCommonColumnsIcon() { + if (this.commonColumnsIcon == null) { + this.commonColumnsIcon = createImageDescriptor(ImageProvider.COMMON_COLUMNS_ICON_PATH) + .createImage(); + } + return this.commonColumnsIcon; + } + + /** Return the "common columns" icon */ + public static ImageDescriptor getCommonColumnsIconDescriptor() { + return createImageDescriptor(ImageProvider.COMMON_COLUMNS_ICON_PATH); + } + + /** Return the "delete line" icon */ + public static ImageDescriptor getRemoveLineIconDescriptor() { + return createImageDescriptor(ImageProvider.REMOVE_LINE_ICON_PATH); + } + + /** Return the "delete element" icon */ + public static ImageDescriptor getDeleteElementIconDescriptor() { + return createImageDescriptor(ImageProvider.DELETE_ELEMENT_ICON_PATH); + } + + /** Return the "add" icon */ + public static ImageDescriptor getAddIconDescriptor() { + return createImageDescriptor(ImageProvider.ADD_ICON_PATH); + } + + /** Return the "ordering" icon */ + public Image getOrderingIcon() { + if (this.orderingIcon == null) { + this.orderingIcon = createImageDescriptor(ImageProvider.ORDERING_ICON_PATH) + .createImage(); + } + return this.orderingIcon; + } + + /** Return the "ordering" icon */ + public static ImageDescriptor getOrderingIconDescriptor() { + return createImageDescriptor(ImageProvider.ORDERING_ICON_PATH); + } + + /** Return the "ordering" icon */ + public static ImageDescriptor getOrderingImageDescriptor() { + return createImageDescriptor(ImageProvider.ORDERING_ICON_PATH); + } + + /** Return the "eClass" icon */ + public Image getEClassIcon() { + if (this.eClassIcon == null) { + this.eClassIcon = createImageDescriptor(ImageProvider.ECLASS_ICON_PATH).createImage(); + } + return this.eClassIcon; + } + + /** Return the "operation" icon */ + public Image getOperationIcon() { + if (this.operationIcon == null) { + this.operationIcon = createImageDescriptor(ImageProvider.OPERATION_ICON_PATH) + .createImage(); + } + return this.operationIcon; + } + + /** Return the "predicate" icon */ + public Image getPredicateIcon() { + if (this.predicateIcon == null) { + this.predicateIcon = createImageDescriptor(ImageProvider.PREDICATE_ICON_PATH) + .createImage(); + } + return this.predicateIcon; + } + + /** Return the "EmfFacet" icon */ + public Image getEmfFacetIcon() { + if (this.emffacetIcon == null) { + this.emffacetIcon = createImageDescriptor(ImageProvider.EMFFACET_ICON_PATH) + .createImage(); + } + return this.emffacetIcon; + } + + /** Return an icon representing the concept of "feature" */ + public Image getFeatureIcon() { + if (this.featureIcon == null) { + this.featureIcon = createImageDescriptor(ImageProvider.FEATURE_ICON_PATH).createImage(); + } + return this.featureIcon; + } + + /** Return an icon descriptor representing the concept of "feature" */ + public static ImageDescriptor getFeatureIconDescriptor() { + return createImageDescriptor(ImageProvider.FEATURE_ICON_PATH); + } + + /** Return an icon descriptor representing the concept of "facet" */ + public static ImageDescriptor getFacetIconDescriptor() { + return createImageDescriptor(ImageProvider.FACET_ICON_PATH); + } + + /** Return an icon descriptor representing the concept of "facet" */ + public Image getFacetIcon() { + if (this.facetIcon == null) { + this.facetIcon = createImageDescriptor(ImageProvider.FACET_ICON_PATH).createImage(); + } + return this.facetIcon; + } + + /** Return an icon descriptor for "uiCustom" */ + public static ImageDescriptor getAddUiCustomIconDescriptor() { + return createImageDescriptor(ImageProvider.ADD_UI_CUSTOM_ICON_PATH); + } + + /** Return an icon for "uiCustom" */ + public Image getUiCustomIcon() { + if (this.uiCustomIcon == null) { + this.uiCustomIcon = createImageDescriptor(ImageProvider.ADD_UI_CUSTOM_ICON_PATH) + .createImage(); + } + return this.uiCustomIcon; + } + + /** Return the "error" icon */ + public Image getErrorIcon() { + if (this.errorIcon == null) { + this.errorIcon = createImageDescriptor(ImageProvider.ERROR_ICON_PATH).createImage(); + } + return this.errorIcon; + } + + /** Return the toolbar menu icon */ + public Image getViewMenuIcon() { + if (this.viewMenuIcon == null) { + this.viewMenuIcon = createImageDescriptor(ImageProvider.VIEW_MENU_ICON_PATH) + .createImage(); + } + return this.viewMenuIcon; + } + + /** Return the query menu icon */ + public Image getQueryIcon() { + if (this.queryIcon == null) { + this.queryIcon = createImageDescriptor(ImageProvider.QUERY_ICON_PATH).createImage(); + } + return this.queryIcon; + } + + /** Return the link type icon */ + public Image getLinkTypeIcon() { + if (this.linkTypeIcon == null) { + this.linkTypeIcon = createImageDescriptor(ImageProvider.LINK_TYPE_ICON_PATH) + .createImage(); + } + return this.linkTypeIcon; + } + + /** Return the link type icon descriptor */ + public static ImageDescriptor getLinkTypeIconDescriptor() { + return createImageDescriptor(ImageProvider.LINK_TYPE_ICON_PATH); + } + + /** Return the "element ID" icon descriptor */ + public static ImageDescriptor getShowElementIDsDescriptor() { + return createImageDescriptor(ImageProvider.ELEMENT_IDS_ICON_PATH); + } + + public static ImageDescriptor getShowURIDescriptor() { + return createImageDescriptor(ImageProvider.URI_ICON_PATH); + } + + public Image getURIIcon() { + if (this.uriIcon == null) { + this.uriIcon = createImageDescriptor(ImageProvider.URI_ICON_PATH).createImage(); + } + return this.uriIcon; + } + + public static ImageDescriptor getCollapseAllDescriptor() { + return createImageDescriptor(ImageProvider.COLLAPSE_ALL_ICON_PATH); + } + + public Image getShortcutIcon() { + if (this.shortcutIcon == null) { + this.shortcutIcon = createImageDescriptor(ImageProvider.SHORTCUT_ICON_PATH) + .createImage(); + } + return this.shortcutIcon; + } + + public static ImageDescriptor getSelectColumnsToHideDescriptor() { + return createImageDescriptor(ImageProvider.SELECT_COLUMNS_TO_HIDE); + } + + public Image getSelectColumnsToHide() { + if (this.selectColumnsToHide == null) { + this.selectColumnsToHide = createImageDescriptor(ImageProvider.SELECT_COLUMNS_TO_HIDE) + .createImage(); + } + return this.selectColumnsToHide; + } +}
diff --git a/org.eclipse.modisco.infra.browser.ecore.core/src/org/eclipse/modisco/infra/browser/ecore/core/internal/epackagecontainseclass/ChildrenQuery.java b/org.eclipse.modisco.infra.browser.ecore.core/src/org/eclipse/modisco/infra/browser/ecore/core/internal/epackagecontainseclass/ChildrenQuery.java index 542323a..be83aa1 100644 --- a/org.eclipse.modisco.infra.browser.ecore.core/src/org/eclipse/modisco/infra/browser/ecore/core/internal/epackagecontainseclass/ChildrenQuery.java +++ b/org.eclipse.modisco.infra.browser.ecore.core/src/org/eclipse/modisco/infra/browser/ecore/core/internal/epackagecontainseclass/ChildrenQuery.java
@@ -16,10 +16,10 @@ import org.eclipse.emf.ecore.EPackage; import org.eclipse.emf.ecore.EStructuralFeature; import org.eclipse.emf.ecore.EcorePackage; -import org.eclipse.emf.facet.efacet.core.IFacetManager; -import org.eclipse.emf.facet.efacet.core.exception.DerivedTypedElementException; -import org.eclipse.emf.facet.query.java.core.IJavaQuery2; -import org.eclipse.emf.facet.query.java.core.IParameterValueList2; +import org.eclipse.modisco.facet.efacet.core.IFacetManager; +import org.eclipse.modisco.facet.efacet.core.exception.DerivedTypedElementException; +import org.eclipse.modisco.facet.query.java.core.IJavaQuery2; +import org.eclipse.modisco.facet.query.java.core.IParameterValueList2; public class ChildrenQuery implements IJavaQuery2<EPackage, List<EStructuralFeature>> { public List<EStructuralFeature> evaluate(final EPackage context,
diff --git a/org.eclipse.modisco.infra.browser.ecore.core/src/org/eclipse/modisco/infra/browser/ecore/core/internal/hierarchicaleclass/HierarchicalEClassCustomQuery.java b/org.eclipse.modisco.infra.browser.ecore.core/src/org/eclipse/modisco/infra/browser/ecore/core/internal/hierarchicaleclass/HierarchicalEClassCustomQuery.java index 9067091..28aea2e 100644 --- a/org.eclipse.modisco.infra.browser.ecore.core/src/org/eclipse/modisco/infra/browser/ecore/core/internal/hierarchicaleclass/HierarchicalEClassCustomQuery.java +++ b/org.eclipse.modisco.infra.browser.ecore.core/src/org/eclipse/modisco/infra/browser/ecore/core/internal/hierarchicaleclass/HierarchicalEClassCustomQuery.java
@@ -18,14 +18,14 @@ import org.eclipse.emf.ecore.EStructuralFeature; import org.eclipse.emf.ecore.resource.Resource; import org.eclipse.emf.ecore.resource.ResourceSet; -import org.eclipse.emf.facet.efacet.core.FacetUtils; -import org.eclipse.emf.facet.efacet.core.IFacetManager; -import org.eclipse.emf.facet.efacet.core.exception.DerivedTypedElementException; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.DerivedTypedElement; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.Facet; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.FacetSet; -import org.eclipse.emf.facet.query.java.core.IJavaQuery3; -import org.eclipse.emf.facet.query.java.core.IParameterValueList2; +import org.eclipse.modisco.facet.efacet.core.FacetUtils; +import org.eclipse.modisco.facet.efacet.core.IFacetManager; +import org.eclipse.modisco.facet.efacet.core.exception.DerivedTypedElementException; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.DerivedTypedElement; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.Facet; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.FacetSet; +import org.eclipse.modisco.facet.query.java.core.IJavaQuery3; +import org.eclipse.modisco.facet.query.java.core.IParameterValueList2; public class HierarchicalEClassCustomQuery implements IJavaQuery3<EClass, List<EStructuralFeature>> {
diff --git a/org.eclipse.modisco.infra.browser.ecore.core/src/org/eclipse/modisco/infra/browser/ecore/core/internal/hierarchicaleclass/HierarchicalEClassFacetQuery.java b/org.eclipse.modisco.infra.browser.ecore.core/src/org/eclipse/modisco/infra/browser/ecore/core/internal/hierarchicaleclass/HierarchicalEClassFacetQuery.java index 9960478..a943660 100644 --- a/org.eclipse.modisco.infra.browser.ecore.core/src/org/eclipse/modisco/infra/browser/ecore/core/internal/hierarchicaleclass/HierarchicalEClassFacetQuery.java +++ b/org.eclipse.modisco.infra.browser.ecore.core/src/org/eclipse/modisco/infra/browser/ecore/core/internal/hierarchicaleclass/HierarchicalEClassFacetQuery.java
@@ -13,10 +13,10 @@ import java.util.List; import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.facet.efacet.core.IFacetManager; -import org.eclipse.emf.facet.efacet.core.exception.DerivedTypedElementException; -import org.eclipse.emf.facet.query.java.core.IJavaQuery2; -import org.eclipse.emf.facet.query.java.core.IParameterValueList2; +import org.eclipse.modisco.facet.efacet.core.IFacetManager; +import org.eclipse.modisco.facet.efacet.core.exception.DerivedTypedElementException; +import org.eclipse.modisco.facet.query.java.core.IJavaQuery2; +import org.eclipse.modisco.facet.query.java.core.IParameterValueList2; import org.eclipse.modisco.util.emf.core.subclasses.SubClassesUtils; public class HierarchicalEClassFacetQuery implements
diff --git a/org.eclipse.modisco.infra.browser.ecore.ui/src/org/eclipse/modisco/infra/browser/ecore/ui/internal/custom/NbInstancesEClassByResourceQuery.java b/org.eclipse.modisco.infra.browser.ecore.ui/src/org/eclipse/modisco/infra/browser/ecore/ui/internal/custom/NbInstancesEClassByResourceQuery.java index 9301ee7..9e1306b 100644 --- a/org.eclipse.modisco.infra.browser.ecore.ui/src/org/eclipse/modisco/infra/browser/ecore/ui/internal/custom/NbInstancesEClassByResourceQuery.java +++ b/org.eclipse.modisco.infra.browser.ecore.ui/src/org/eclipse/modisco/infra/browser/ecore/ui/internal/custom/NbInstancesEClassByResourceQuery.java
@@ -14,11 +14,11 @@ import org.eclipse.emf.ecore.EClass; import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.facet.efacet.core.IFacetManager; -import org.eclipse.emf.facet.efacet.core.exception.DerivedTypedElementException; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.DerivedTypedElement; -import org.eclipse.emf.facet.query.java.core.IJavaQuery3; -import org.eclipse.emf.facet.query.java.core.IParameterValueList2; +import org.eclipse.modisco.facet.efacet.core.IFacetManager; +import org.eclipse.modisco.facet.efacet.core.exception.DerivedTypedElementException; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.DerivedTypedElement; +import org.eclipse.modisco.facet.query.java.core.IJavaQuery3; +import org.eclipse.modisco.facet.query.java.core.IParameterValueList2; import org.eclipse.modisco.infra.browser.ecore.ui.internal.widget.InternalUtils; /**
diff --git a/org.eclipse.modisco.infra.browser.ecore.ui/src/org/eclipse/modisco/infra/browser/ecore/ui/internal/custom/NbInstancesEClassByResourceSetQuery.java b/org.eclipse.modisco.infra.browser.ecore.ui/src/org/eclipse/modisco/infra/browser/ecore/ui/internal/custom/NbInstancesEClassByResourceSetQuery.java index b4ee94f..d5bad88 100644 --- a/org.eclipse.modisco.infra.browser.ecore.ui/src/org/eclipse/modisco/infra/browser/ecore/ui/internal/custom/NbInstancesEClassByResourceSetQuery.java +++ b/org.eclipse.modisco.infra.browser.ecore.ui/src/org/eclipse/modisco/infra/browser/ecore/ui/internal/custom/NbInstancesEClassByResourceSetQuery.java
@@ -15,11 +15,11 @@ import org.eclipse.emf.ecore.EClass; import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.facet.efacet.core.IFacetManager; -import org.eclipse.emf.facet.efacet.core.exception.DerivedTypedElementException; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.DerivedTypedElement; -import org.eclipse.emf.facet.query.java.core.IJavaQuery3; -import org.eclipse.emf.facet.query.java.core.IParameterValueList2; +import org.eclipse.modisco.facet.efacet.core.IFacetManager; +import org.eclipse.modisco.facet.efacet.core.exception.DerivedTypedElementException; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.DerivedTypedElement; +import org.eclipse.modisco.facet.query.java.core.IJavaQuery3; +import org.eclipse.modisco.facet.query.java.core.IParameterValueList2; import org.eclipse.modisco.infra.browser.ecore.ui.internal.widget.InternalUtils; /**
diff --git a/org.eclipse.modisco.infra.browser.ecore.ui/src/org/eclipse/modisco/infra/browser/ecore/ui/internal/handler/LoadCustomShortcutsMenu.java b/org.eclipse.modisco.infra.browser.ecore.ui/src/org/eclipse/modisco/infra/browser/ecore/ui/internal/handler/LoadCustomShortcutsMenu.java index 2fb4016..805590f 100644 --- a/org.eclipse.modisco.infra.browser.ecore.ui/src/org/eclipse/modisco/infra/browser/ecore/ui/internal/handler/LoadCustomShortcutsMenu.java +++ b/org.eclipse.modisco.infra.browser.ecore.ui/src/org/eclipse/modisco/infra/browser/ecore/ui/internal/handler/LoadCustomShortcutsMenu.java
@@ -10,8 +10,8 @@ */ package org.eclipse.modisco.infra.browser.ecore.ui.internal.handler; -import org.eclipse.emf.facet.custom.ui.LoadCustomShortcutsMenuUtils; import org.eclipse.jface.action.IContributionItem; +import org.eclipse.modisco.facet.custom.ui.LoadCustomShortcutsMenuUtils; import org.eclipse.ui.actions.CompoundContributionItem; public class LoadCustomShortcutsMenu extends CompoundContributionItem {
diff --git a/org.eclipse.modisco.infra.browser.ecore.ui/src/org/eclipse/modisco/infra/browser/ecore/ui/internal/handler/LoadFacetSetShortcutsMenu.java b/org.eclipse.modisco.infra.browser.ecore.ui/src/org/eclipse/modisco/infra/browser/ecore/ui/internal/handler/LoadFacetSetShortcutsMenu.java index 94e0bc5..967a36c 100644 --- a/org.eclipse.modisco.infra.browser.ecore.ui/src/org/eclipse/modisco/infra/browser/ecore/ui/internal/handler/LoadFacetSetShortcutsMenu.java +++ b/org.eclipse.modisco.infra.browser.ecore.ui/src/org/eclipse/modisco/infra/browser/ecore/ui/internal/handler/LoadFacetSetShortcutsMenu.java
@@ -10,8 +10,8 @@ */ package org.eclipse.modisco.infra.browser.ecore.ui.internal.handler; -import org.eclipse.emf.facet.efacet.ui.LoadFacetSetShortcutsMenuUtils; import org.eclipse.jface.action.IContributionItem; +import org.eclipse.modisco.facet.efacet.ui.LoadFacetSetShortcutsMenuUtils; import org.eclipse.ui.actions.CompoundContributionItem; public class LoadFacetSetShortcutsMenu extends CompoundContributionItem {
diff --git a/org.eclipse.modisco.infra.browser.ecore.ui/src/org/eclipse/modisco/infra/browser/ecore/ui/internal/sync/generated/SynchronizedEcoreExplorerWidget.java b/org.eclipse.modisco.infra.browser.ecore.ui/src/org/eclipse/modisco/infra/browser/ecore/ui/internal/sync/generated/SynchronizedEcoreExplorerWidget.java index 32020e4..d2769f3 100644 --- a/org.eclipse.modisco.infra.browser.ecore.ui/src/org/eclipse/modisco/infra/browser/ecore/ui/internal/sync/generated/SynchronizedEcoreExplorerWidget.java +++ b/org.eclipse.modisco.infra.browser.ecore.ui/src/org/eclipse/modisco/infra/browser/ecore/ui/internal/sync/generated/SynchronizedEcoreExplorerWidget.java
@@ -11,10 +11,10 @@ */ package org.eclipse.modisco.infra.browser.ecore.ui.internal.sync.generated; -import org.eclipse.emf.facet.util.ui.internal.exported.displaysync.SynchronizedObject; +import org.eclipse.modisco.facet.util.ui.internal.exported.displaysync.AbstractExceptionFreeRunnable; +import org.eclipse.modisco.facet.util.ui.internal.exported.displaysync.AbstractVoidExceptionFreeRunnable; +import org.eclipse.modisco.facet.util.ui.internal.exported.displaysync.SynchronizedObject; import org.eclipse.swt.widgets.Display; -import org.eclipse.emf.facet.util.ui.internal.exported.displaysync.AbstractVoidExceptionFreeRunnable; -import org.eclipse.emf.facet.util.ui.internal.exported.displaysync.AbstractExceptionFreeRunnable; @SuppressWarnings("PMD.ExcessivePublicCount") public class SynchronizedEcoreExplorerWidget extends SynchronizedObject<org.eclipse.modisco.infra.browser.ecore.ui.internal.exported.IEcoreExplorerWidget> implements org.eclipse.modisco.infra.browser.ecore.ui.internal.exported.IEcoreExplorerWidget {
diff --git a/org.eclipse.modisco.infra.browser.ecore.ui/src/org/eclipse/modisco/infra/browser/ecore/ui/internal/view/Utils.java b/org.eclipse.modisco.infra.browser.ecore.ui/src/org/eclipse/modisco/infra/browser/ecore/ui/internal/view/Utils.java index 839b31c..8513c71 100644 --- a/org.eclipse.modisco.infra.browser.ecore.ui/src/org/eclipse/modisco/infra/browser/ecore/ui/internal/view/Utils.java +++ b/org.eclipse.modisco.infra.browser.ecore.ui/src/org/eclipse/modisco/infra/browser/ecore/ui/internal/view/Utils.java
@@ -15,9 +15,9 @@ import org.eclipse.emf.ecore.EObject; import org.eclipse.emf.ecore.EPackage; import org.eclipse.emf.ecore.resource.ResourceSet; -import org.eclipse.emf.facet.custom.metamodel.v0_2_0.internal.treeproxy.EObjectTreeElement; -import org.eclipse.emf.facet.custom.metamodel.v0_2_0.internal.treeproxy.EStructuralFeatureTreeElement; -import org.eclipse.emf.facet.custom.ui.CustomizedContentProviderUtils; +import org.eclipse.modisco.facet.custom.metamodel.v0_2_0.internal.treeproxy.EObjectTreeElement; +import org.eclipse.modisco.facet.custom.metamodel.v0_2_0.internal.treeproxy.EStructuralFeatureTreeElement; +import org.eclipse.modisco.facet.custom.ui.CustomizedContentProviderUtils; public final class Utils {
diff --git a/org.eclipse.modisco.infra.browser.ecore.ui/src/org/eclipse/modisco/infra/browser/ecore/ui/internal/widget/EcoreExplorerShortcutUtils.java b/org.eclipse.modisco.infra.browser.ecore.ui/src/org/eclipse/modisco/infra/browser/ecore/ui/internal/widget/EcoreExplorerShortcutUtils.java index 825267f..622654f 100644 --- a/org.eclipse.modisco.infra.browser.ecore.ui/src/org/eclipse/modisco/infra/browser/ecore/ui/internal/widget/EcoreExplorerShortcutUtils.java +++ b/org.eclipse.modisco.infra.browser.ecore.ui/src/org/eclipse/modisco/infra/browser/ecore/ui/internal/widget/EcoreExplorerShortcutUtils.java
@@ -18,11 +18,11 @@ import org.eclipse.emf.ecore.EObject; import org.eclipse.emf.ecore.resource.Resource; import org.eclipse.emf.ecore.resource.ResourceSet; -import org.eclipse.emf.facet.custom.metamodel.v0_2_0.custom.Customization; -import org.eclipse.emf.facet.custom.ui.ICustomizationManagerProvider2.ICustomShortcut; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.FacetSet; -import org.eclipse.emf.facet.efacet.ui.IFacetManagerProvider2.IFacetSetShortcut; import org.eclipse.jface.resource.ImageDescriptor; +import org.eclipse.modisco.facet.custom.metamodel.v0_2_0.custom.Customization; +import org.eclipse.modisco.facet.custom.ui.ICustomizationManagerProvider2.ICustomShortcut; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.FacetSet; +import org.eclipse.modisco.facet.efacet.ui.IFacetManagerProvider2.IFacetSetShortcut; import org.eclipse.modisco.infra.browser.ecore.ui.internal.Activator; import org.eclipse.modisco.infra.browser.ecore.ui.internal.Messages; import org.osgi.framework.Bundle;
diff --git a/org.eclipse.modisco.infra.browser.ecore.ui/src/org/eclipse/modisco/infra/browser/ecore/ui/internal/widget/EcoreExplorerWidgetComposite.java b/org.eclipse.modisco.infra.browser.ecore.ui/src/org/eclipse/modisco/infra/browser/ecore/ui/internal/widget/EcoreExplorerWidgetComposite.java index 926870d..0b699f2 100644 --- a/org.eclipse.modisco.infra.browser.ecore.ui/src/org/eclipse/modisco/infra/browser/ecore/ui/internal/widget/EcoreExplorerWidgetComposite.java +++ b/org.eclipse.modisco.infra.browser.ecore.ui/src/org/eclipse/modisco/infra/browser/ecore/ui/internal/widget/EcoreExplorerWidgetComposite.java
@@ -22,16 +22,16 @@ import org.eclipse.emf.ecore.EObject; import org.eclipse.emf.ecore.EPackage; import org.eclipse.emf.ecore.resource.ResourceSet; -import org.eclipse.emf.facet.custom.core.ICustomizationManager; -import org.eclipse.emf.facet.custom.ui.ICustomizationManagerProvider2; -import org.eclipse.emf.facet.efacet.core.IFacetManager; -import org.eclipse.emf.facet.efacet.ui.IFacetManagerProvider2; import org.eclipse.jface.action.MenuManager; import org.eclipse.jface.viewers.ISelection; import org.eclipse.jface.viewers.ISelectionChangedListener; import org.eclipse.jface.viewers.ISelectionProvider; import org.eclipse.jface.viewers.IStructuredSelection; import org.eclipse.jface.viewers.SelectionChangedEvent; +import org.eclipse.modisco.facet.custom.core.ICustomizationManager; +import org.eclipse.modisco.facet.custom.ui.ICustomizationManagerProvider2; +import org.eclipse.modisco.facet.efacet.core.IFacetManager; +import org.eclipse.modisco.facet.efacet.ui.IFacetManagerProvider2; import org.eclipse.modisco.infra.browser.ecore.ui.internal.view.Utils; import org.eclipse.swt.SWT; import org.eclipse.swt.custom.SashForm;
diff --git a/org.eclipse.modisco.infra.browser.ecore.ui/src/org/eclipse/modisco/infra/browser/ecore/ui/internal/widget/EcoreInstancesExplorerComposite.java b/org.eclipse.modisco.infra.browser.ecore.ui/src/org/eclipse/modisco/infra/browser/ecore/ui/internal/widget/EcoreInstancesExplorerComposite.java index 9be012f..74f7ff8 100644 --- a/org.eclipse.modisco.infra.browser.ecore.ui/src/org/eclipse/modisco/infra/browser/ecore/ui/internal/widget/EcoreInstancesExplorerComposite.java +++ b/org.eclipse.modisco.infra.browser.ecore.ui/src/org/eclipse/modisco/infra/browser/ecore/ui/internal/widget/EcoreInstancesExplorerComposite.java
@@ -15,19 +15,19 @@ import org.eclipse.emf.ecore.EObject; import org.eclipse.emf.ecore.resource.Resource; import org.eclipse.emf.ecore.resource.ResourceSet; -import org.eclipse.emf.facet.custom.core.ICustomizationManager; -import org.eclipse.emf.facet.custom.core.ICustomizationManagerFactory; -import org.eclipse.emf.facet.custom.ui.ICustomizedContentProviderFactory; -import org.eclipse.emf.facet.custom.ui.IResolvingCustomizedLabelProviderFactory; -import org.eclipse.emf.facet.efacet.core.IFacetManager; -import org.eclipse.emf.facet.efacet.core.IFacetManagerFactory; -import org.eclipse.emf.facet.efacet.core.IFacetManagerListener; import org.eclipse.jface.viewers.IContentProvider; import org.eclipse.jface.viewers.ILabelProvider; import org.eclipse.jface.viewers.ISelection; import org.eclipse.jface.viewers.ISelectionChangedListener; import org.eclipse.jface.viewers.ISelectionProvider; import org.eclipse.jface.viewers.TreeViewer; +import org.eclipse.modisco.facet.custom.core.ICustomizationManager; +import org.eclipse.modisco.facet.custom.core.ICustomizationManagerFactory; +import org.eclipse.modisco.facet.custom.ui.ICustomizedContentProviderFactory; +import org.eclipse.modisco.facet.custom.ui.IResolvingCustomizedLabelProviderFactory; +import org.eclipse.modisco.facet.efacet.core.IFacetManager; +import org.eclipse.modisco.facet.efacet.core.IFacetManagerFactory; +import org.eclipse.modisco.facet.efacet.core.IFacetManagerListener; import org.eclipse.modisco.infra.browser.ecore.ui.internal.Messages; import org.eclipse.swt.SWT; import org.eclipse.swt.layout.GridData;
diff --git a/org.eclipse.modisco.infra.browser.ecore.ui/src/org/eclipse/modisco/infra/browser/ecore/ui/internal/widget/EcoreMetaExplorerComposite.java b/org.eclipse.modisco.infra.browser.ecore.ui/src/org/eclipse/modisco/infra/browser/ecore/ui/internal/widget/EcoreMetaExplorerComposite.java index 3042fdf..d7c2f8f 100644 --- a/org.eclipse.modisco.infra.browser.ecore.ui/src/org/eclipse/modisco/infra/browser/ecore/ui/internal/widget/EcoreMetaExplorerComposite.java +++ b/org.eclipse.modisco.infra.browser.ecore.ui/src/org/eclipse/modisco/infra/browser/ecore/ui/internal/widget/EcoreMetaExplorerComposite.java
@@ -15,13 +15,6 @@ import org.eclipse.emf.ecore.EPackage; import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl; -import org.eclipse.emf.facet.custom.core.ICustomizationManager; -import org.eclipse.emf.facet.custom.core.ICustomizationManagerFactory; -import org.eclipse.emf.facet.custom.ui.ICustomizedContentProviderFactory; -import org.eclipse.emf.facet.custom.ui.IResolvingCustomizedLabelProviderFactory; -import org.eclipse.emf.facet.efacet.core.IFacetManager; -import org.eclipse.emf.facet.efacet.core.IFacetManagerFactory; -import org.eclipse.emf.facet.efacet.core.IFacetManagerListener; import org.eclipse.jface.action.MenuManager; import org.eclipse.jface.viewers.IContentProvider; import org.eclipse.jface.viewers.ILabelProvider; @@ -29,6 +22,13 @@ import org.eclipse.jface.viewers.ISelectionChangedListener; import org.eclipse.jface.viewers.ISelectionProvider; import org.eclipse.jface.viewers.TreeViewer; +import org.eclipse.modisco.facet.custom.core.ICustomizationManager; +import org.eclipse.modisco.facet.custom.core.ICustomizationManagerFactory; +import org.eclipse.modisco.facet.custom.ui.ICustomizedContentProviderFactory; +import org.eclipse.modisco.facet.custom.ui.IResolvingCustomizedLabelProviderFactory; +import org.eclipse.modisco.facet.efacet.core.IFacetManager; +import org.eclipse.modisco.facet.efacet.core.IFacetManagerFactory; +import org.eclipse.modisco.facet.efacet.core.IFacetManagerListener; import org.eclipse.modisco.infra.browser.ecore.ui.internal.Messages; import org.eclipse.swt.SWT; import org.eclipse.swt.layout.GridData;
diff --git a/org.eclipse.modisco.infra.browser.editor.ui/src/org/eclipse/modisco/infra/browser/editor/ui/internal/editor/TreeEditor.java b/org.eclipse.modisco.infra.browser.editor.ui/src/org/eclipse/modisco/infra/browser/editor/ui/internal/editor/TreeEditor.java index 9d93dd1..b842286 100644 --- a/org.eclipse.modisco.infra.browser.editor.ui/src/org/eclipse/modisco/infra/browser/editor/ui/internal/editor/TreeEditor.java +++ b/org.eclipse.modisco.infra.browser.editor.ui/src/org/eclipse/modisco/infra/browser/editor/ui/internal/editor/TreeEditor.java
@@ -37,23 +37,23 @@ import org.eclipse.emf.edit.domain.EditingDomain; import org.eclipse.emf.edit.domain.IEditingDomainProvider; import org.eclipse.emf.edit.provider.ComposedAdapterFactory; -import org.eclipse.emf.facet.custom.core.ICustomizationManager; -import org.eclipse.emf.facet.custom.core.ICustomizationManagerFactory; -import org.eclipse.emf.facet.custom.ui.ICustomizationManagerProvider2; -import org.eclipse.emf.facet.custom.ui.ICustomizedContentProviderFactory; -import org.eclipse.emf.facet.custom.ui.ICustomizedContentProviderFactory.IContentListener; -import org.eclipse.emf.facet.custom.ui.IResolvingCustomizedLabelProviderFactory; -import org.eclipse.emf.facet.efacet.core.IFacetManager; -import org.eclipse.emf.facet.efacet.core.IFacetManagerFactory; -import org.eclipse.emf.facet.efacet.core.IFacetManagerListener; -import org.eclipse.emf.facet.efacet.ui.IFacetManagerProvider2; -import org.eclipse.emf.facet.util.ui.internal.exported.dialog.IOkDialog; -import org.eclipse.emf.facet.util.ui.internal.exported.dialog.IOkDialogFactory; import org.eclipse.jface.action.MenuManager; import org.eclipse.jface.viewers.IContentProvider; import org.eclipse.jface.viewers.ILabelProvider; import org.eclipse.jface.viewers.ISelectionProvider; import org.eclipse.jface.viewers.TreeViewer; +import org.eclipse.modisco.facet.custom.core.ICustomizationManager; +import org.eclipse.modisco.facet.custom.core.ICustomizationManagerFactory; +import org.eclipse.modisco.facet.custom.ui.ICustomizationManagerProvider2; +import org.eclipse.modisco.facet.custom.ui.ICustomizedContentProviderFactory; +import org.eclipse.modisco.facet.custom.ui.IResolvingCustomizedLabelProviderFactory; +import org.eclipse.modisco.facet.custom.ui.ICustomizedContentProviderFactory.IContentListener; +import org.eclipse.modisco.facet.efacet.core.IFacetManager; +import org.eclipse.modisco.facet.efacet.core.IFacetManagerFactory; +import org.eclipse.modisco.facet.efacet.core.IFacetManagerListener; +import org.eclipse.modisco.facet.efacet.ui.IFacetManagerProvider2; +import org.eclipse.modisco.facet.util.ui.internal.exported.dialog.IOkDialog; +import org.eclipse.modisco.facet.util.ui.internal.exported.dialog.IOkDialogFactory; import org.eclipse.modisco.infra.browser.editor.ui.ITreeEditor; import org.eclipse.modisco.infra.browser.editor.ui.internal.Activator; import org.eclipse.modisco.infra.browser.editor.ui.internal.opener.ResourceEditorInput;
diff --git a/org.eclipse.modisco.infra.browser.editor.ui/src/org/eclipse/modisco/infra/browser/editor/ui/internal/editor/TreeEditorDragListener.java b/org.eclipse.modisco.infra.browser.editor.ui/src/org/eclipse/modisco/infra/browser/editor/ui/internal/editor/TreeEditorDragListener.java index 5281793..ecea525 100644 --- a/org.eclipse.modisco.infra.browser.editor.ui/src/org/eclipse/modisco/infra/browser/editor/ui/internal/editor/TreeEditorDragListener.java +++ b/org.eclipse.modisco.infra.browser.editor.ui/src/org/eclipse/modisco/infra/browser/editor/ui/internal/editor/TreeEditorDragListener.java
@@ -11,9 +11,9 @@ package org.eclipse.modisco.infra.browser.editor.ui.internal.editor; import org.eclipse.emf.edit.ui.dnd.LocalTransfer; -import org.eclipse.emf.facet.custom.ui.CustomizedContentProviderUtils; import org.eclipse.jface.viewers.ISelection; import org.eclipse.jface.viewers.TreeViewer; +import org.eclipse.modisco.facet.custom.ui.CustomizedContentProviderUtils; import org.eclipse.swt.dnd.DragSourceEvent; import org.eclipse.swt.dnd.DragSourceListener;
diff --git a/org.eclipse.modisco.infra.browser.editor.ui/src/org/eclipse/modisco/infra/browser/editor/ui/internal/editor/TreeEditorDropListener.java b/org.eclipse.modisco.infra.browser.editor.ui/src/org/eclipse/modisco/infra/browser/editor/ui/internal/editor/TreeEditorDropListener.java index 4b5c0d0..1b6edff 100644 --- a/org.eclipse.modisco.infra.browser.editor.ui/src/org/eclipse/modisco/infra/browser/editor/ui/internal/editor/TreeEditorDropListener.java +++ b/org.eclipse.modisco.infra.browser.editor.ui/src/org/eclipse/modisco/infra/browser/editor/ui/internal/editor/TreeEditorDropListener.java
@@ -20,8 +20,8 @@ import org.eclipse.emf.edit.command.AddCommand; import org.eclipse.emf.edit.command.SetCommand; import org.eclipse.emf.edit.domain.EditingDomain; -import org.eclipse.emf.facet.custom.ui.CustomizedContentProviderUtils; import org.eclipse.jface.viewers.IStructuredSelection; +import org.eclipse.modisco.facet.custom.ui.CustomizedContentProviderUtils; import org.eclipse.swt.dnd.DropTargetEvent; import org.eclipse.swt.dnd.DropTargetListener; import org.eclipse.swt.widgets.TreeItem;
diff --git a/org.eclipse.modisco.infra.browser.editor.ui/src/org/eclipse/modisco/infra/browser/editor/ui/internal/editor/TreeEditorOpener.java b/org.eclipse.modisco.infra.browser.editor.ui/src/org/eclipse/modisco/infra/browser/editor/ui/internal/editor/TreeEditorOpener.java index 11d9b84..c5159b0 100644 --- a/org.eclipse.modisco.infra.browser.editor.ui/src/org/eclipse/modisco/infra/browser/editor/ui/internal/editor/TreeEditorOpener.java +++ b/org.eclipse.modisco.infra.browser.editor.ui/src/org/eclipse/modisco/infra/browser/editor/ui/internal/editor/TreeEditorOpener.java
@@ -13,7 +13,7 @@ import org.eclipse.emf.ecore.EObject; import org.eclipse.emf.ecore.resource.Resource; import org.eclipse.emf.ecore.resource.ResourceSet; -import org.eclipse.emf.facet.util.ui.internal.exported.handler.HandlerUtils; +import org.eclipse.modisco.facet.util.ui.internal.exported.handler.HandlerUtils; import org.eclipse.modisco.infra.browser.editor.ui.ITreeEditor; import org.eclipse.modisco.infra.browser.editor.ui.ITreeEditorOpener; import org.eclipse.modisco.infra.browser.editor.ui.exceptions.TreeEditorOpenerException;
diff --git a/org.eclipse.modisco.infra.browser.editor.ui/src/org/eclipse/modisco/infra/browser/editor/ui/internal/editor/TreeEditorSelectionProvider.java b/org.eclipse.modisco.infra.browser.editor.ui/src/org/eclipse/modisco/infra/browser/editor/ui/internal/editor/TreeEditorSelectionProvider.java index 36d3972..e95bb61 100644 --- a/org.eclipse.modisco.infra.browser.editor.ui/src/org/eclipse/modisco/infra/browser/editor/ui/internal/editor/TreeEditorSelectionProvider.java +++ b/org.eclipse.modisco.infra.browser.editor.ui/src/org/eclipse/modisco/infra/browser/editor/ui/internal/editor/TreeEditorSelectionProvider.java
@@ -13,12 +13,12 @@ import java.util.ArrayList; import java.util.List; -import org.eclipse.emf.facet.custom.ui.CustomizedContentProviderUtils; -import org.eclipse.emf.facet.util.core.DebugUtils; import org.eclipse.jface.viewers.ISelection; import org.eclipse.jface.viewers.ISelectionChangedListener; import org.eclipse.jface.viewers.ISelectionProvider; import org.eclipse.jface.viewers.SelectionChangedEvent; +import org.eclipse.modisco.facet.custom.ui.CustomizedContentProviderUtils; +import org.eclipse.modisco.facet.util.core.DebugUtils; import org.eclipse.modisco.infra.browser.editor.ui.internal.Activator; public class TreeEditorSelectionProvider implements ISelectionProvider {
diff --git a/org.eclipse.modisco.infra.browser.editor.ui/src/org/eclipse/modisco/infra/browser/editor/ui/internal/editor/TreeEditorShortcutUtils.java b/org.eclipse.modisco.infra.browser.editor.ui/src/org/eclipse/modisco/infra/browser/editor/ui/internal/editor/TreeEditorShortcutUtils.java index 2e84d16..a7e26bf 100644 --- a/org.eclipse.modisco.infra.browser.editor.ui/src/org/eclipse/modisco/infra/browser/editor/ui/internal/editor/TreeEditorShortcutUtils.java +++ b/org.eclipse.modisco.infra.browser.editor.ui/src/org/eclipse/modisco/infra/browser/editor/ui/internal/editor/TreeEditorShortcutUtils.java
@@ -20,12 +20,12 @@ import org.eclipse.emf.ecore.EObject; import org.eclipse.emf.ecore.resource.Resource; import org.eclipse.emf.ecore.resource.ResourceSet; -import org.eclipse.emf.facet.custom.metamodel.v0_2_0.custom.Customization; -import org.eclipse.emf.facet.custom.ui.ICustomizationManagerProvider2.ICustomShortcut; -import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.FacetSet; -import org.eclipse.emf.facet.efacet.ui.IFacetManagerProvider2.IFacetSetShortcut; -import org.eclipse.emf.facet.util.core.Logger; import org.eclipse.jface.resource.ImageDescriptor; +import org.eclipse.modisco.facet.custom.metamodel.v0_2_0.custom.Customization; +import org.eclipse.modisco.facet.custom.ui.ICustomizationManagerProvider2.ICustomShortcut; +import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.FacetSet; +import org.eclipse.modisco.facet.efacet.ui.IFacetManagerProvider2.IFacetSetShortcut; +import org.eclipse.modisco.facet.util.core.Logger; import org.eclipse.modisco.infra.browser.editor.ui.internal.Activator; import org.eclipse.modisco.infra.browser.editor.ui.internal.Messages;
diff --git a/org.eclipse.modisco.infra.browser.editor.ui/src/org/eclipse/modisco/infra/browser/editor/ui/internal/handlers/LoadCustomShortcutsMenu.java b/org.eclipse.modisco.infra.browser.editor.ui/src/org/eclipse/modisco/infra/browser/editor/ui/internal/handlers/LoadCustomShortcutsMenu.java index 594245b..89c0a88 100644 --- a/org.eclipse.modisco.infra.browser.editor.ui/src/org/eclipse/modisco/infra/browser/editor/ui/internal/handlers/LoadCustomShortcutsMenu.java +++ b/org.eclipse.modisco.infra.browser.editor.ui/src/org/eclipse/modisco/infra/browser/editor/ui/internal/handlers/LoadCustomShortcutsMenu.java
@@ -10,8 +10,8 @@ */ package org.eclipse.modisco.infra.browser.editor.ui.internal.handlers; -import org.eclipse.emf.facet.custom.ui.LoadCustomShortcutsMenuUtils; import org.eclipse.jface.action.IContributionItem; +import org.eclipse.modisco.facet.custom.ui.LoadCustomShortcutsMenuUtils; import org.eclipse.ui.actions.CompoundContributionItem; public class LoadCustomShortcutsMenu extends CompoundContributionItem {
diff --git a/org.eclipse.modisco.infra.browser.editor.ui/src/org/eclipse/modisco/infra/browser/editor/ui/internal/handlers/LoadFacetSetShortcutsMenu.java b/org.eclipse.modisco.infra.browser.editor.ui/src/org/eclipse/modisco/infra/browser/editor/ui/internal/handlers/LoadFacetSetShortcutsMenu.java index 6b10bf3..99be4a4 100644 --- a/org.eclipse.modisco.infra.browser.editor.ui/src/org/eclipse/modisco/infra/browser/editor/ui/internal/handlers/LoadFacetSetShortcutsMenu.java +++ b/org.eclipse.modisco.infra.browser.editor.ui/src/org/eclipse/modisco/infra/browser/editor/ui/internal/handlers/LoadFacetSetShortcutsMenu.java
@@ -10,8 +10,8 @@ */ package org.eclipse.modisco.infra.browser.editor.ui.internal.handlers; -import org.eclipse.emf.facet.efacet.ui.LoadFacetSetShortcutsMenuUtils; import org.eclipse.jface.action.IContributionItem; +import org.eclipse.modisco.facet.efacet.ui.LoadFacetSetShortcutsMenuUtils; import org.eclipse.ui.actions.CompoundContributionItem; public class LoadFacetSetShortcutsMenu extends CompoundContributionItem {
diff --git a/org.eclipse.modisco.infra.browser.editor.ui/src/org/eclipse/modisco/infra/browser/editor/ui/internal/opener/ResourceBrowserOpener.java b/org.eclipse.modisco.infra.browser.editor.ui/src/org/eclipse/modisco/infra/browser/editor/ui/internal/opener/ResourceBrowserOpener.java index 8524001..2322822 100644 --- a/org.eclipse.modisco.infra.browser.editor.ui/src/org/eclipse/modisco/infra/browser/editor/ui/internal/opener/ResourceBrowserOpener.java +++ b/org.eclipse.modisco.infra.browser.editor.ui/src/org/eclipse/modisco/infra/browser/editor/ui/internal/opener/ResourceBrowserOpener.java
@@ -14,10 +14,10 @@ import org.eclipse.emf.ecore.EObject; import org.eclipse.emf.ecore.EPackage; import org.eclipse.emf.ecore.resource.Resource; -import org.eclipse.emf.facet.util.core.Logger; -import org.eclipse.emf.facet.util.emf.core.IEObjectBrowserOpener; -import org.eclipse.emf.facet.util.emf.core.IEPackageBrowserOpener; -import org.eclipse.emf.facet.util.emf.core.IResourceBrowserOpener; +import org.eclipse.modisco.facet.util.core.Logger; +import org.eclipse.modisco.facet.util.emf.core.IEObjectBrowserOpener; +import org.eclipse.modisco.facet.util.emf.core.IEPackageBrowserOpener; +import org.eclipse.modisco.facet.util.emf.core.IResourceBrowserOpener; import org.eclipse.modisco.infra.browser.editor.ui.ITreeEditorOpener; import org.eclipse.modisco.infra.browser.editor.ui.exceptions.TreeEditorOpenerException; import org.eclipse.modisco.infra.browser.editor.ui.internal.Activator;
diff --git a/org.eclipse.modisco.infra.browser.tests/src/org/eclipse/modisco/infra/browser/tests/TestMetaclasses.java b/org.eclipse.modisco.infra.browser.tests/src/org/eclipse/modisco/infra/browser/tests/TestMetaclasses.java index da8d4b2..c326228 100644 --- a/org.eclipse.modisco.infra.browser.tests/src/org/eclipse/modisco/infra/browser/tests/TestMetaclasses.java +++ b/org.eclipse.modisco.infra.browser.tests/src/org/eclipse/modisco/infra/browser/tests/TestMetaclasses.java
@@ -21,12 +21,12 @@ import java.util.regex.Matcher; import java.util.regex.Pattern; -import org.eclipse.emf.facet.util.tests.swtbot.internal.exported.SWTBotUtils; import org.eclipse.gmt.modisco.infra.browser.MoDiscoBrowserPlugin; import org.eclipse.gmt.modisco.infra.browser.editors.EcoreBrowser; import org.eclipse.gmt.modisco.infra.browser.editors.MetaclassViewer; import org.eclipse.gmt.modisco.infra.browser.preferences.PreferenceConstants; import org.eclipse.gmt.modisco.infra.browser.uicore.internal.model.BigListItem; +import org.eclipse.modisco.facet.util.tests.swtbot.internal.exported.SWTBotUtils; import org.eclipse.modisco.infra.browser.tests.project.WorkspaceSetup; import org.eclipse.modisco.infra.browser.tests.utils.TestUtils; import org.eclipse.swt.widgets.Menu;
diff --git a/org.eclipse.modisco.infra.browser.tests/src/org/eclipse/modisco/infra/browser/tests/TestOpenModel.java b/org.eclipse.modisco.infra.browser.tests/src/org/eclipse/modisco/infra/browser/tests/TestOpenModel.java index 0fefff7..cfb4136 100644 --- a/org.eclipse.modisco.infra.browser.tests/src/org/eclipse/modisco/infra/browser/tests/TestOpenModel.java +++ b/org.eclipse.modisco.infra.browser.tests/src/org/eclipse/modisco/infra/browser/tests/TestOpenModel.java
@@ -16,9 +16,9 @@ import java.util.Arrays; import java.util.Collection; -import org.eclipse.emf.facet.util.tests.swtbot.internal.ContextMenuUtils; -import org.eclipse.emf.facet.util.tests.swtbot.internal.exported.SWTBotUtils; import org.eclipse.gmt.modisco.infra.browser.editors.EcoreBrowser; +import org.eclipse.modisco.facet.util.tests.swtbot.internal.ContextMenuUtils; +import org.eclipse.modisco.facet.util.tests.swtbot.internal.exported.SWTBotUtils; import org.eclipse.modisco.infra.browser.tests.project.WorkspaceSetup; import org.eclipse.modisco.infra.browser.tests.utils.TestUtils; import org.eclipse.swtbot.eclipse.finder.SWTWorkbenchBot;
diff --git a/org.eclipse.modisco.infra.browser.tests/src/org/eclipse/modisco/infra/browser/tests/project/WorkspaceSetup.java b/org.eclipse.modisco.infra.browser.tests/src/org/eclipse/modisco/infra/browser/tests/project/WorkspaceSetup.java index f79ffef..ff4e0e5 100644 --- a/org.eclipse.modisco.infra.browser.tests/src/org/eclipse/modisco/infra/browser/tests/project/WorkspaceSetup.java +++ b/org.eclipse.modisco.infra.browser.tests/src/org/eclipse/modisco/infra/browser/tests/project/WorkspaceSetup.java
@@ -22,7 +22,7 @@ import org.eclipse.core.resources.ResourcesPlugin; import org.eclipse.core.runtime.FileLocator; import org.eclipse.core.runtime.Platform; -import org.eclipse.emf.facet.util.tests.swtbot.internal.exported.SWTBotUtils; +import org.eclipse.modisco.facet.util.tests.swtbot.internal.exported.SWTBotUtils; import org.eclipse.swt.widgets.Display; import org.eclipse.swtbot.eclipse.finder.SWTWorkbenchBot; import org.eclipse.swtbot.eclipse.finder.widgets.SWTBotView;
diff --git a/org.eclipse.modisco.infra.browser.tests/src/org/eclipse/modisco/infra/browser/tests/utils/TestUtils.java b/org.eclipse.modisco.infra.browser.tests/src/org/eclipse/modisco/infra/browser/tests/utils/TestUtils.java index 07e48e6..f562c89 100644 --- a/org.eclipse.modisco.infra.browser.tests/src/org/eclipse/modisco/infra/browser/tests/utils/TestUtils.java +++ b/org.eclipse.modisco.infra.browser.tests/src/org/eclipse/modisco/infra/browser/tests/utils/TestUtils.java
@@ -17,10 +17,10 @@ import java.util.ArrayList; import java.util.List; -import org.eclipse.emf.facet.util.tests.swtbot.internal.ContextMenuUtils; import org.eclipse.gmt.modisco.infra.browser.editors.EcoreBrowser; import org.eclipse.gmt.modisco.infra.browser.editors.LeftPane; import org.eclipse.gmt.modisco.infra.browser.editors.TreeToolBar; +import org.eclipse.modisco.facet.util.tests.swtbot.internal.ContextMenuUtils; import org.eclipse.swt.SWT; import org.eclipse.swt.widgets.Display; import org.eclipse.swt.widgets.Event;
diff --git a/org.eclipse.modisco.infra.discovery.benchmark.core/src/org/eclipse/modisco/infra/discovery/benchmark/core/internal/Application.java b/org.eclipse.modisco.infra.discovery.benchmark.core/src/org/eclipse/modisco/infra/discovery/benchmark/core/internal/Application.java index bc223aa..dd893ad 100644 --- a/org.eclipse.modisco.infra.discovery.benchmark.core/src/org/eclipse/modisco/infra/discovery/benchmark/core/internal/Application.java +++ b/org.eclipse.modisco.infra.discovery.benchmark.core/src/org/eclipse/modisco/infra/discovery/benchmark/core/internal/Application.java
@@ -27,10 +27,10 @@ import org.eclipse.core.runtime.NullProgressMonitor; import org.eclipse.core.runtime.Path; import org.eclipse.emf.common.util.URI; -import org.eclipse.emf.facet.util.core.DebugUtils; -import org.eclipse.emf.facet.util.core.Logger; import org.eclipse.equinox.app.IApplication; import org.eclipse.equinox.app.IApplicationContext; +import org.eclipse.modisco.facet.util.core.DebugUtils; +import org.eclipse.modisco.facet.util.core.Logger; import org.eclipse.modisco.infra.discovery.benchmark.core.internal.exported.IDiscovererList; import org.eclipse.modisco.infra.discovery.benchmark.core.internal.exported.IDiscovererListFactory; import org.eclipse.modisco.infra.discovery.benchmark.core.internal.exported.IProjectSet;
diff --git a/org.eclipse.modisco.infra.discovery.benchmark.core/src/org/eclipse/modisco/infra/discovery/benchmark/core/internal/DiscovererListSerializer.java b/org.eclipse.modisco.infra.discovery.benchmark.core/src/org/eclipse/modisco/infra/discovery/benchmark/core/internal/DiscovererListSerializer.java index 757b9c6..0be350a 100644 --- a/org.eclipse.modisco.infra.discovery.benchmark.core/src/org/eclipse/modisco/infra/discovery/benchmark/core/internal/DiscovererListSerializer.java +++ b/org.eclipse.modisco.infra.discovery.benchmark.core/src/org/eclipse/modisco/infra/discovery/benchmark/core/internal/DiscovererListSerializer.java
@@ -23,8 +23,8 @@ import org.eclipse.emf.ecore.resource.ResourceSet; import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl; import org.eclipse.emf.ecore.xmi.impl.XMIResourceFactoryImpl; -import org.eclipse.emf.facet.util.emf.core.serialization.ISerializer; import org.eclipse.gmt.modisco.infra.common.core.logging.MoDiscoLogger; +import org.eclipse.modisco.facet.util.emf.core.serialization.ISerializer; import org.eclipse.modisco.infra.discovery.benchmark.core.internal.exported.IDiscovererList; import org.eclipse.modisco.infra.discovery.benchmark.core.internal.exported.IDiscovererListFactory; import org.eclipse.modisco.infra.discovery.benchmark.metamodel.internal.benchmark.Discovery;
diff --git a/org.eclipse.modisco.infra.discovery.benchmark.core/src/org/eclipse/modisco/infra/discovery/benchmark/core/internal/api/IProjectSetSerializer.java b/org.eclipse.modisco.infra.discovery.benchmark.core/src/org/eclipse/modisco/infra/discovery/benchmark/core/internal/api/IProjectSetSerializer.java index 03c8a6f..9139d89 100644 --- a/org.eclipse.modisco.infra.discovery.benchmark.core/src/org/eclipse/modisco/infra/discovery/benchmark/core/internal/api/IProjectSetSerializer.java +++ b/org.eclipse.modisco.infra.discovery.benchmark.core/src/org/eclipse/modisco/infra/discovery/benchmark/core/internal/api/IProjectSetSerializer.java
@@ -11,7 +11,7 @@ import org.eclipse.core.resources.IProject; import org.eclipse.core.resources.ResourcesPlugin; -import org.eclipse.emf.facet.util.emf.core.serialization.ISerializer; +import org.eclipse.modisco.facet.util.emf.core.serialization.ISerializer; import org.eclipse.modisco.infra.discovery.benchmark.core.internal.exported.IProjectSet; import org.eclipse.modisco.infra.discovery.benchmark.core.internal.exported.IProjectSetFactory;
diff --git a/org.eclipse.modisco.infra.discovery.benchmark.core/src/org/eclipse/modisco/infra/discovery/benchmark/core/internal/impl/DiscovererBenchmarkDiscoverer.java b/org.eclipse.modisco.infra.discovery.benchmark.core/src/org/eclipse/modisco/infra/discovery/benchmark/core/internal/impl/DiscovererBenchmarkDiscoverer.java index 1f2ae76..e95b1e5 100644 --- a/org.eclipse.modisco.infra.discovery.benchmark.core/src/org/eclipse/modisco/infra/discovery/benchmark/core/internal/impl/DiscovererBenchmarkDiscoverer.java +++ b/org.eclipse.modisco.infra.discovery.benchmark.core/src/org/eclipse/modisco/infra/discovery/benchmark/core/internal/impl/DiscovererBenchmarkDiscoverer.java
@@ -53,8 +53,8 @@ import org.eclipse.emf.ecore.resource.ResourceSet; import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl; import org.eclipse.emf.ecore.xmi.impl.XMIResourceFactoryImpl; -import org.eclipse.emf.facet.util.core.Logger; import org.eclipse.jdt.core.dom.Modifier; +import org.eclipse.modisco.facet.util.core.Logger; import org.eclipse.modisco.infra.discovery.benchmark.core.ISizeDiscoverer; import org.eclipse.modisco.infra.discovery.benchmark.core.internal.Activator; import org.eclipse.modisco.infra.discovery.benchmark.core.internal.MathUtils;
diff --git a/org.eclipse.modisco.infra.discovery.benchmark.ui/src/org/eclipse/modisco/infra/discovery/benchmark/ui/util/DiscovererListComposite.java b/org.eclipse.modisco.infra.discovery.benchmark.ui/src/org/eclipse/modisco/infra/discovery/benchmark/ui/util/DiscovererListComposite.java index da73214..aab66e7 100644 --- a/org.eclipse.modisco.infra.discovery.benchmark.ui/src/org/eclipse/modisco/infra/discovery/benchmark/ui/util/DiscovererListComposite.java +++ b/org.eclipse.modisco.infra.discovery.benchmark.ui/src/org/eclipse/modisco/infra/discovery/benchmark/ui/util/DiscovererListComposite.java
@@ -13,9 +13,9 @@ import java.util.List; import org.eclipse.core.resources.IProject; -import org.eclipse.emf.facet.widgets.celleditors.AbstractCellEditorComposite; import org.eclipse.jface.viewers.LabelProvider; import org.eclipse.jface.window.Window; +import org.eclipse.modisco.facet.widgets.celleditors.AbstractCellEditorComposite; import org.eclipse.modisco.infra.discovery.benchmark.core.internal.exported.IDiscovererList; import org.eclipse.modisco.infra.discovery.benchmark.core.internal.exported.IDiscovererListFactory; import org.eclipse.modisco.infra.discovery.benchmark.metamodel.internal.benchmark.BenchmarkFactory;
diff --git a/org.eclipse.modisco.infra.discovery.benchmark.ui/src/org/eclipse/modisco/infra/discovery/benchmark/ui/util/DiscovererListCompositeFactory.java b/org.eclipse.modisco.infra.discovery.benchmark.ui/src/org/eclipse/modisco/infra/discovery/benchmark/ui/util/DiscovererListCompositeFactory.java index 2339f9c..5b3f172 100644 --- a/org.eclipse.modisco.infra.discovery.benchmark.ui/src/org/eclipse/modisco/infra/discovery/benchmark/ui/util/DiscovererListCompositeFactory.java +++ b/org.eclipse.modisco.infra.discovery.benchmark.ui/src/org/eclipse/modisco/infra/discovery/benchmark/ui/util/DiscovererListCompositeFactory.java
@@ -9,7 +9,7 @@ ******************************************************************************/ package org.eclipse.modisco.infra.discovery.benchmark.ui.util; -import org.eclipse.emf.facet.widgets.celleditors.ICompositeEditorFactory; +import org.eclipse.modisco.facet.widgets.celleditors.ICompositeEditorFactory; import org.eclipse.modisco.infra.discovery.benchmark.core.internal.exported.IDiscovererList; import org.eclipse.swt.widgets.Composite;
diff --git a/org.eclipse.modisco.infra.discovery.benchmark.ui/src/org/eclipse/modisco/infra/discovery/benchmark/ui/util/MultiIProjectComposite.java b/org.eclipse.modisco.infra.discovery.benchmark.ui/src/org/eclipse/modisco/infra/discovery/benchmark/ui/util/MultiIProjectComposite.java index 0c8ff02..b23eaae 100644 --- a/org.eclipse.modisco.infra.discovery.benchmark.ui/src/org/eclipse/modisco/infra/discovery/benchmark/ui/util/MultiIProjectComposite.java +++ b/org.eclipse.modisco.infra.discovery.benchmark.ui/src/org/eclipse/modisco/infra/discovery/benchmark/ui/util/MultiIProjectComposite.java
@@ -12,8 +12,8 @@ import org.eclipse.core.resources.IProject; import org.eclipse.core.resources.IWorkspace; import org.eclipse.core.resources.ResourcesPlugin; -import org.eclipse.emf.facet.widgets.celleditors.AbstractCellEditorComposite; import org.eclipse.jface.window.Window; +import org.eclipse.modisco.facet.widgets.celleditors.AbstractCellEditorComposite; import org.eclipse.modisco.infra.discovery.benchmark.core.internal.exported.IProjectSet; import org.eclipse.modisco.infra.discovery.benchmark.core.internal.exported.IProjectSetFactory; import org.eclipse.swt.SWT;
diff --git a/org.eclipse.modisco.infra.discovery.benchmark.ui/src/org/eclipse/modisco/infra/discovery/benchmark/ui/util/MultiIProjectCompositeFactory.java b/org.eclipse.modisco.infra.discovery.benchmark.ui/src/org/eclipse/modisco/infra/discovery/benchmark/ui/util/MultiIProjectCompositeFactory.java index a3aa53c..ece3c5c 100644 --- a/org.eclipse.modisco.infra.discovery.benchmark.ui/src/org/eclipse/modisco/infra/discovery/benchmark/ui/util/MultiIProjectCompositeFactory.java +++ b/org.eclipse.modisco.infra.discovery.benchmark.ui/src/org/eclipse/modisco/infra/discovery/benchmark/ui/util/MultiIProjectCompositeFactory.java
@@ -9,8 +9,8 @@ ******************************************************************************/ package org.eclipse.modisco.infra.discovery.benchmark.ui.util; -import org.eclipse.emf.facet.widgets.celleditors.AbstractCellEditorComposite; -import org.eclipse.emf.facet.widgets.celleditors.ICompositeEditorFactory; +import org.eclipse.modisco.facet.widgets.celleditors.AbstractCellEditorComposite; +import org.eclipse.modisco.facet.widgets.celleditors.ICompositeEditorFactory; import org.eclipse.modisco.infra.discovery.benchmark.core.internal.exported.IProjectSet; import org.eclipse.swt.widgets.Composite;
diff --git a/org.eclipse.modisco.infra.discovery.core.tests/src/org/eclipse/modisco/infra/discovery/core/tests/TestDiscoverersReferential.java b/org.eclipse.modisco.infra.discovery.core.tests/src/org/eclipse/modisco/infra/discovery/core/tests/TestDiscoverersReferential.java index 0709f7f..f4a7445 100644 --- a/org.eclipse.modisco.infra.discovery.core.tests/src/org/eclipse/modisco/infra/discovery/core/tests/TestDiscoverersReferential.java +++ b/org.eclipse.modisco.infra.discovery.core.tests/src/org/eclipse/modisco/infra/discovery/core/tests/TestDiscoverersReferential.java
@@ -21,10 +21,10 @@ import org.eclipse.emf.common.util.EList; import org.eclipse.emf.common.util.URI; import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl; -import org.eclipse.emf.facet.util.emf.catalog.Catalog; -import org.eclipse.emf.facet.util.emf.catalog.CatalogSet; -import org.eclipse.emf.facet.util.emf.core.ICatalogSetManager2; -import org.eclipse.emf.facet.util.emf.core.ICatalogSetManagerFactory; +import org.eclipse.modisco.facet.util.emf.catalog.Catalog; +import org.eclipse.modisco.facet.util.emf.catalog.CatalogSet; +import org.eclipse.modisco.facet.util.emf.core.ICatalogSetManager2; +import org.eclipse.modisco.facet.util.emf.core.ICatalogSetManagerFactory; import org.eclipse.modisco.infra.discovery.catalog.DirectionKind; import org.eclipse.modisco.infra.discovery.catalog.DiscovererCatalog; import org.eclipse.modisco.infra.discovery.catalog.DiscovererDescription;
diff --git a/org.eclipse.modisco.infra.discovery.core/src/org/eclipse/modisco/infra/discovery/core/internal/catalog/DiscovererCatalogManager.java b/org.eclipse.modisco.infra.discovery.core/src/org/eclipse/modisco/infra/discovery/core/internal/catalog/DiscovererCatalogManager.java index 5dda0bc..ea66feb 100644 --- a/org.eclipse.modisco.infra.discovery.core/src/org/eclipse/modisco/infra/discovery/core/internal/catalog/DiscovererCatalogManager.java +++ b/org.eclipse.modisco.infra.discovery.core/src/org/eclipse/modisco/infra/discovery/core/internal/catalog/DiscovererCatalogManager.java
@@ -11,8 +11,8 @@ package org.eclipse.modisco.infra.discovery.core.internal.catalog; import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.facet.util.emf.catalog.CatalogSet; -import org.eclipse.emf.facet.util.emf.core.ICatalogManager; +import org.eclipse.modisco.facet.util.emf.catalog.CatalogSet; +import org.eclipse.modisco.facet.util.emf.core.ICatalogManager; public class DiscovererCatalogManager implements ICatalogManager {
diff --git a/org.eclipse.modisco.infra.discovery.ui/src/org/eclipse/modisco/infra/discovery/ui/internal/actions/MoDiscoMenuSelectionListener.java b/org.eclipse.modisco.infra.discovery.ui/src/org/eclipse/modisco/infra/discovery/ui/internal/actions/MoDiscoMenuSelectionListener.java index 9a30658..2f28096 100644 --- a/org.eclipse.modisco.infra.discovery.ui/src/org/eclipse/modisco/infra/discovery/ui/internal/actions/MoDiscoMenuSelectionListener.java +++ b/org.eclipse.modisco.infra.discovery.ui/src/org/eclipse/modisco/infra/discovery/ui/internal/actions/MoDiscoMenuSelectionListener.java
@@ -22,10 +22,10 @@ import org.eclipse.core.runtime.jobs.Job; import org.eclipse.emf.common.util.URI; import org.eclipse.emf.ecore.resource.Resource; -import org.eclipse.emf.facet.util.emf.core.IBrowserRegistry; import org.eclipse.gmt.modisco.infra.common.core.logging.MoDiscoLogger; import org.eclipse.jface.dialogs.MessageDialog; import org.eclipse.jface.window.Window; +import org.eclipse.modisco.facet.util.emf.core.IBrowserRegistry; import org.eclipse.modisco.infra.discovery.catalog.DiscovererDescription; import org.eclipse.modisco.infra.discovery.catalog.DiscovererParameter; import org.eclipse.modisco.infra.discovery.core.AbstractModelDiscoverer;
diff --git a/org.eclipse.modisco.infra.discovery.ui/src/org/eclipse/modisco/infra/discovery/ui/internal/celleditors/composite/ComposedCellEditor.java b/org.eclipse.modisco.infra.discovery.ui/src/org/eclipse/modisco/infra/discovery/ui/internal/celleditors/composite/ComposedCellEditor.java index 71167ab..81986d9 100644 --- a/org.eclipse.modisco.infra.discovery.ui/src/org/eclipse/modisco/infra/discovery/ui/internal/celleditors/composite/ComposedCellEditor.java +++ b/org.eclipse.modisco.infra.discovery.ui/src/org/eclipse/modisco/infra/discovery/ui/internal/celleditors/composite/ComposedCellEditor.java
@@ -15,11 +15,11 @@ import java.util.ArrayList; import java.util.List; -import org.eclipse.emf.facet.widgets.celleditors.AbstractCellEditorComposite; -import org.eclipse.emf.facet.widgets.celleditors.ICompositeEditorFactory; -import org.eclipse.emf.facet.widgets.celleditors.IListener; -import org.eclipse.emf.facet.widgets.celleditors.IWidget2; import org.eclipse.jface.viewers.CellEditor; +import org.eclipse.modisco.facet.widgets.celleditors.AbstractCellEditorComposite; +import org.eclipse.modisco.facet.widgets.celleditors.ICompositeEditorFactory; +import org.eclipse.modisco.facet.widgets.celleditors.IListener; +import org.eclipse.modisco.facet.widgets.celleditors.IWidget2; import org.eclipse.swt.SWT; import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Control;
diff --git a/org.eclipse.modisco.infra.discovery.ui/src/org/eclipse/modisco/infra/discovery/ui/internal/celleditors/composite/TargetURIComposite.java b/org.eclipse.modisco.infra.discovery.ui/src/org/eclipse/modisco/infra/discovery/ui/internal/celleditors/composite/TargetURIComposite.java index dd80dde..35672bb 100644 --- a/org.eclipse.modisco.infra.discovery.ui/src/org/eclipse/modisco/infra/discovery/ui/internal/celleditors/composite/TargetURIComposite.java +++ b/org.eclipse.modisco.infra.discovery.ui/src/org/eclipse/modisco/infra/discovery/ui/internal/celleditors/composite/TargetURIComposite.java
@@ -17,8 +17,8 @@ import org.eclipse.core.runtime.Path; import org.eclipse.emf.common.ui.dialogs.WorkspaceResourceDialog; import org.eclipse.emf.common.util.URI; -import org.eclipse.emf.facet.widgets.celleditors.AbstractCellEditorComposite; import org.eclipse.gmt.modisco.infra.common.core.logging.MoDiscoLogger; +import org.eclipse.modisco.facet.widgets.celleditors.AbstractCellEditorComposite; import org.eclipse.modisco.infra.discovery.ui.Activator; import org.eclipse.modisco.infra.discovery.ui.Messages; import org.eclipse.swt.SWT;
diff --git a/org.eclipse.modisco.infra.discovery.ui/src/org/eclipse/modisco/infra/discovery/ui/internal/celleditors/composite/TargetURICompositeFactory.java b/org.eclipse.modisco.infra.discovery.ui/src/org/eclipse/modisco/infra/discovery/ui/internal/celleditors/composite/TargetURICompositeFactory.java index 10937b4..db39b98 100644 --- a/org.eclipse.modisco.infra.discovery.ui/src/org/eclipse/modisco/infra/discovery/ui/internal/celleditors/composite/TargetURICompositeFactory.java +++ b/org.eclipse.modisco.infra.discovery.ui/src/org/eclipse/modisco/infra/discovery/ui/internal/celleditors/composite/TargetURICompositeFactory.java
@@ -11,8 +11,8 @@ package org.eclipse.modisco.infra.discovery.ui.internal.celleditors.composite; import org.eclipse.emf.common.util.URI; -import org.eclipse.emf.facet.widgets.celleditors.AbstractCellEditorComposite; -import org.eclipse.emf.facet.widgets.celleditors.ICompositeEditorFactory; +import org.eclipse.modisco.facet.widgets.celleditors.AbstractCellEditorComposite; +import org.eclipse.modisco.facet.widgets.celleditors.ICompositeEditorFactory; import org.eclipse.swt.widgets.Composite; public class TargetURICompositeFactory implements ICompositeEditorFactory<URI> {
diff --git a/org.eclipse.modisco.infra.discovery.ui/src/org/eclipse/modisco/infra/discovery/ui/internal/dialogs/GenericParametersDialog.java b/org.eclipse.modisco.infra.discovery.ui/src/org/eclipse/modisco/infra/discovery/ui/internal/dialogs/GenericParametersDialog.java index 3a27c7b..12842b8 100644 --- a/org.eclipse.modisco.infra.discovery.ui/src/org/eclipse/modisco/infra/discovery/ui/internal/dialogs/GenericParametersDialog.java +++ b/org.eclipse.modisco.infra.discovery.ui/src/org/eclipse/modisco/infra/discovery/ui/internal/dialogs/GenericParametersDialog.java
@@ -15,8 +15,6 @@ import org.eclipse.core.runtime.IStatus; import org.eclipse.core.runtime.Status; import org.eclipse.emf.common.util.EList; -import org.eclipse.emf.facet.widgets.celleditors.AbstractCellEditorComposite; -import org.eclipse.emf.facet.widgets.celleditors.IValidator; import org.eclipse.gmt.modisco.infra.common.core.logging.MoDiscoLogger; import org.eclipse.jface.dialogs.IDialogConstants; import org.eclipse.jface.dialogs.IDialogSettings; @@ -29,6 +27,8 @@ import org.eclipse.jface.viewers.TableViewerColumn; import org.eclipse.jface.viewers.Viewer; import org.eclipse.jface.window.ToolTip; +import org.eclipse.modisco.facet.widgets.celleditors.AbstractCellEditorComposite; +import org.eclipse.modisco.facet.widgets.celleditors.IValidator; import org.eclipse.modisco.infra.discovery.catalog.DiscovererParameter; import org.eclipse.modisco.infra.discovery.launch.LaunchConfiguration; import org.eclipse.modisco.infra.discovery.launch.ParameterValue;
diff --git a/org.eclipse.modisco.infra.discovery.ui/src/org/eclipse/modisco/infra/discovery/ui/internal/dialogs/ParameterValueEditingSupport.java b/org.eclipse.modisco.infra.discovery.ui/src/org/eclipse/modisco/infra/discovery/ui/internal/dialogs/ParameterValueEditingSupport.java index 8337ce4..c46ec74 100644 --- a/org.eclipse.modisco.infra.discovery.ui/src/org/eclipse/modisco/infra/discovery/ui/internal/dialogs/ParameterValueEditingSupport.java +++ b/org.eclipse.modisco.infra.discovery.ui/src/org/eclipse/modisco/infra/discovery/ui/internal/dialogs/ParameterValueEditingSupport.java
@@ -12,12 +12,12 @@ *******************************************************************************/ package org.eclipse.modisco.infra.discovery.ui.internal.dialogs; -import org.eclipse.emf.facet.widgets.celleditors.ICompositeEditorFactory; -import org.eclipse.emf.facet.widgets.celleditors.core.composite.registry.ICompositeEditorFactoriesRegistry; import org.eclipse.jface.viewers.CellEditor; import org.eclipse.jface.viewers.ColumnViewer; import org.eclipse.jface.viewers.EditingSupport; import org.eclipse.jface.viewers.TableViewer; +import org.eclipse.modisco.facet.widgets.celleditors.ICompositeEditorFactory; +import org.eclipse.modisco.facet.widgets.celleditors.core.composite.registry.ICompositeEditorFactoriesRegistry; import org.eclipse.modisco.infra.discovery.catalog.DiscovererParameter; import org.eclipse.modisco.infra.discovery.ui.internal.celleditors.composite.ComposedCellEditor; import org.eclipse.modisco.infra.discovery.ui.internal.celleditors.composite.IComposedCellEditorListener;
diff --git a/org.eclipse.modisco.infra.discovery.ui/src/org/eclipse/modisco/infra/discovery/ui/internal/launch/DiscovererLaunchConfigurationDelegate.java b/org.eclipse.modisco.infra.discovery.ui/src/org/eclipse/modisco/infra/discovery/ui/internal/launch/DiscovererLaunchConfigurationDelegate.java index a90e9cd..2f86eb5 100644 --- a/org.eclipse.modisco.infra.discovery.ui/src/org/eclipse/modisco/infra/discovery/ui/internal/launch/DiscovererLaunchConfigurationDelegate.java +++ b/org.eclipse.modisco.infra.discovery.ui/src/org/eclipse/modisco/infra/discovery/ui/internal/launch/DiscovererLaunchConfigurationDelegate.java
@@ -27,7 +27,7 @@ import org.eclipse.emf.common.util.EList; import org.eclipse.emf.common.util.URI; import org.eclipse.emf.ecore.resource.Resource; -import org.eclipse.emf.facet.util.emf.core.IBrowserRegistry; +import org.eclipse.modisco.facet.util.emf.core.IBrowserRegistry; import org.eclipse.modisco.infra.discovery.catalog.DiscovererDescription; import org.eclipse.modisco.infra.discovery.core.AbstractModelDiscoverer; import org.eclipse.modisco.infra.discovery.core.IDiscoverer;
diff --git a/org.eclipse.modisco.infra.discovery.ui/src/org/eclipse/modisco/infra/discovery/ui/internal/launch/DiscoverersMainTab.java b/org.eclipse.modisco.infra.discovery.ui/src/org/eclipse/modisco/infra/discovery/ui/internal/launch/DiscoverersMainTab.java index dbcced4..121e295 100644 --- a/org.eclipse.modisco.infra.discovery.ui/src/org/eclipse/modisco/infra/discovery/ui/internal/launch/DiscoverersMainTab.java +++ b/org.eclipse.modisco.infra.discovery.ui/src/org/eclipse/modisco/infra/discovery/ui/internal/launch/DiscoverersMainTab.java
@@ -23,11 +23,11 @@ import org.eclipse.debug.core.ILaunchConfiguration; import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy; import org.eclipse.debug.ui.AbstractLaunchConfigurationTab; -import org.eclipse.emf.facet.widgets.celleditors.AbstractCellEditorComposite; -import org.eclipse.emf.facet.widgets.celleditors.ICompositeEditorFactory; -import org.eclipse.emf.facet.widgets.celleditors.IListener; -import org.eclipse.emf.facet.widgets.celleditors.core.composite.registry.ICompositeEditorFactoriesRegistry; import org.eclipse.gmt.modisco.infra.common.core.logging.MoDiscoLogger; +import org.eclipse.modisco.facet.widgets.celleditors.AbstractCellEditorComposite; +import org.eclipse.modisco.facet.widgets.celleditors.ICompositeEditorFactory; +import org.eclipse.modisco.facet.widgets.celleditors.IListener; +import org.eclipse.modisco.facet.widgets.celleditors.core.composite.registry.ICompositeEditorFactoriesRegistry; import org.eclipse.modisco.infra.discovery.catalog.DiscovererDescription; import org.eclipse.modisco.infra.discovery.catalog.DiscovererParameter; import org.eclipse.modisco.infra.discovery.core.AbstractModelDiscoverer;
diff --git a/org.eclipse.modisco.infra.discovery.ui/src/org/eclipse/modisco/infra/discovery/ui/internal/launch/parametersdisplay/ParametersTableEditingSupport.java b/org.eclipse.modisco.infra.discovery.ui/src/org/eclipse/modisco/infra/discovery/ui/internal/launch/parametersdisplay/ParametersTableEditingSupport.java index 46d8f0d..95d9839 100644 --- a/org.eclipse.modisco.infra.discovery.ui/src/org/eclipse/modisco/infra/discovery/ui/internal/launch/parametersdisplay/ParametersTableEditingSupport.java +++ b/org.eclipse.modisco.infra.discovery.ui/src/org/eclipse/modisco/infra/discovery/ui/internal/launch/parametersdisplay/ParametersTableEditingSupport.java
@@ -17,11 +17,11 @@ import java.util.ArrayList; import java.util.List; -import org.eclipse.emf.facet.widgets.celleditors.ICompositeEditorFactory; -import org.eclipse.emf.facet.widgets.celleditors.core.composite.registry.ICompositeEditorFactoriesRegistry; import org.eclipse.jface.viewers.CellEditor; import org.eclipse.jface.viewers.EditingSupport; import org.eclipse.jface.viewers.TableViewer; +import org.eclipse.modisco.facet.widgets.celleditors.ICompositeEditorFactory; +import org.eclipse.modisco.facet.widgets.celleditors.core.composite.registry.ICompositeEditorFactoriesRegistry; import org.eclipse.modisco.infra.discovery.ui.internal.celleditors.composite.ComposedCellEditor; import org.eclipse.modisco.infra.discovery.ui.internal.celleditors.composite.IComposedCellEditorListener; import org.eclipse.modisco.infra.discovery.ui.internal.launch.data.DiscovererParameterDisplay;
diff --git a/org.eclipse.modisco.infra.discovery.ui/src/org/eclipse/modisco/infra/discovery/ui/internal/views/DiscoverersView.java b/org.eclipse.modisco.infra.discovery.ui/src/org/eclipse/modisco/infra/discovery/ui/internal/views/DiscoverersView.java index 44753da..a7aa69b 100644 --- a/org.eclipse.modisco.infra.discovery.ui/src/org/eclipse/modisco/infra/discovery/ui/internal/views/DiscoverersView.java +++ b/org.eclipse.modisco.infra.discovery.ui/src/org/eclipse/modisco/infra/discovery/ui/internal/views/DiscoverersView.java
@@ -13,7 +13,6 @@ import java.util.Collection; import java.util.List; -import org.eclipse.emf.facet.common.ui.internal.controls.PersistableColumn; import org.eclipse.jface.action.Action; import org.eclipse.jface.action.IAction; import org.eclipse.jface.resource.ImageDescriptor; @@ -25,6 +24,7 @@ import org.eclipse.jface.viewers.SelectionChangedEvent; import org.eclipse.jface.viewers.TableViewer; import org.eclipse.jface.viewers.Viewer; +import org.eclipse.modisco.facet.common.ui.internal.controls.PersistableColumn; import org.eclipse.modisco.infra.discovery.catalog.DiscovererDescription; import org.eclipse.modisco.infra.discovery.catalog.DiscovererParameter; import org.eclipse.modisco.infra.discovery.core.IDiscoveryManager;
diff --git a/org.eclipse.modisco.infra.discovery/src-gen/org/eclipse/modisco/infra/discovery/catalog/CatalogPackage.java b/org.eclipse.modisco.infra.discovery/src-gen/org/eclipse/modisco/infra/discovery/catalog/CatalogPackage.java index a6c2b03..956fc9a 100644 --- a/org.eclipse.modisco.infra.discovery/src-gen/org/eclipse/modisco/infra/discovery/catalog/CatalogPackage.java +++ b/org.eclipse.modisco.infra.discovery/src-gen/org/eclipse/modisco/infra/discovery/catalog/CatalogPackage.java
@@ -256,7 +256,7 @@ * @generated * @ordered */ - int DISCOVERER_CATALOG__INSTALLED_ENTRIES = org.eclipse.emf.facet.util.emf.catalog.CatalogPackage.CATALOG__INSTALLED_ENTRIES; + int DISCOVERER_CATALOG__INSTALLED_ENTRIES = org.eclipse.modisco.facet.util.emf.catalog.CatalogPackage.CATALOG__INSTALLED_ENTRIES; /** * The feature id for the '<em><b>Name</b></em>' attribute. @@ -265,7 +265,7 @@ * @generated * @ordered */ - int DISCOVERER_CATALOG__NAME = org.eclipse.emf.facet.util.emf.catalog.CatalogPackage.CATALOG__NAME; + int DISCOVERER_CATALOG__NAME = org.eclipse.modisco.facet.util.emf.catalog.CatalogPackage.CATALOG__NAME; /** * The feature id for the '<em><b>Installed Discoverers</b></em>' reference list. @@ -274,7 +274,7 @@ * @generated * @ordered */ - int DISCOVERER_CATALOG__INSTALLED_DISCOVERERS = org.eclipse.emf.facet.util.emf.catalog.CatalogPackage.CATALOG_FEATURE_COUNT + 0; + int DISCOVERER_CATALOG__INSTALLED_DISCOVERERS = org.eclipse.modisco.facet.util.emf.catalog.CatalogPackage.CATALOG_FEATURE_COUNT + 0; /** * The number of structural features of the '<em>Discoverer Catalog</em>' class. @@ -283,7 +283,7 @@ * @generated * @ordered */ - int DISCOVERER_CATALOG_FEATURE_COUNT = org.eclipse.emf.facet.util.emf.catalog.CatalogPackage.CATALOG_FEATURE_COUNT + 1; + int DISCOVERER_CATALOG_FEATURE_COUNT = org.eclipse.modisco.facet.util.emf.catalog.CatalogPackage.CATALOG_FEATURE_COUNT + 1; /** * The meta object id for the '{@link org.eclipse.modisco.infra.discovery.catalog.DirectionKind <em>Direction Kind</em>}' enum.
diff --git a/org.eclipse.modisco.infra.discovery/src-gen/org/eclipse/modisco/infra/discovery/catalog/DiscovererCatalog.java b/org.eclipse.modisco.infra.discovery/src-gen/org/eclipse/modisco/infra/discovery/catalog/DiscovererCatalog.java index 6523261..5d421db 100644 --- a/org.eclipse.modisco.infra.discovery/src-gen/org/eclipse/modisco/infra/discovery/catalog/DiscovererCatalog.java +++ b/org.eclipse.modisco.infra.discovery/src-gen/org/eclipse/modisco/infra/discovery/catalog/DiscovererCatalog.java
@@ -12,8 +12,7 @@ package org.eclipse.modisco.infra.discovery.catalog; import org.eclipse.emf.common.util.EList; - -import org.eclipse.emf.facet.util.emf.catalog.Catalog; +import org.eclipse.modisco.facet.util.emf.catalog.Catalog; /** * <!-- begin-user-doc -->
diff --git a/org.eclipse.modisco.infra.discovery/src-gen/org/eclipse/modisco/infra/discovery/catalog/impl/CatalogPackageImpl.java b/org.eclipse.modisco.infra.discovery/src-gen/org/eclipse/modisco/infra/discovery/catalog/impl/CatalogPackageImpl.java index 45d8824..fb3d5a9 100644 --- a/org.eclipse.modisco.infra.discovery/src-gen/org/eclipse/modisco/infra/discovery/catalog/impl/CatalogPackageImpl.java +++ b/org.eclipse.modisco.infra.discovery/src-gen/org/eclipse/modisco/infra/discovery/catalog/impl/CatalogPackageImpl.java
@@ -26,9 +26,7 @@ import org.eclipse.emf.ecore.EReference; import org.eclipse.emf.ecore.impl.EPackageImpl; - -import org.eclipse.emf.facet.util.emf.core.serialization.model.serialization.SerializationPackage; - +import org.eclipse.modisco.facet.util.emf.core.serialization.model.serialization.SerializationPackage; import org.eclipse.modisco.infra.discovery.catalog.CatalogFactory; import org.eclipse.modisco.infra.discovery.catalog.CatalogPackage; import org.eclipse.modisco.infra.discovery.catalog.DirectionKind; @@ -152,7 +150,7 @@ isInited = true; // Initialize simple dependencies - org.eclipse.emf.facet.util.emf.catalog.CatalogPackage.eINSTANCE.eClass(); + org.eclipse.modisco.facet.util.emf.catalog.CatalogPackage.eINSTANCE.eClass(); SerializationPackage.eINSTANCE.eClass(); // Obtain or create and register interdependencies @@ -475,7 +473,7 @@ setNsURI(eNS_URI); // Obtain other dependent packages - org.eclipse.emf.facet.util.emf.catalog.CatalogPackage theCatalogPackage_1 = (org.eclipse.emf.facet.util.emf.catalog.CatalogPackage)EPackage.Registry.INSTANCE.getEPackage(org.eclipse.emf.facet.util.emf.catalog.CatalogPackage.eNS_URI); + org.eclipse.modisco.facet.util.emf.catalog.CatalogPackage theCatalogPackage_1 = (org.eclipse.modisco.facet.util.emf.catalog.CatalogPackage)EPackage.Registry.INSTANCE.getEPackage(org.eclipse.modisco.facet.util.emf.catalog.CatalogPackage.eNS_URI); // Create type parameters
diff --git a/org.eclipse.modisco.infra.discovery/src-gen/org/eclipse/modisco/infra/discovery/catalog/util/CatalogAdapterFactory.java b/org.eclipse.modisco.infra.discovery/src-gen/org/eclipse/modisco/infra/discovery/catalog/util/CatalogAdapterFactory.java index 24d3d6a..d3440d7 100644 --- a/org.eclipse.modisco.infra.discovery/src-gen/org/eclipse/modisco/infra/discovery/catalog/util/CatalogAdapterFactory.java +++ b/org.eclipse.modisco.infra.discovery/src-gen/org/eclipse/modisco/infra/discovery/catalog/util/CatalogAdapterFactory.java
@@ -17,9 +17,7 @@ import org.eclipse.emf.common.notify.impl.AdapterFactoryImpl; import org.eclipse.emf.ecore.EObject; - -import org.eclipse.emf.facet.util.emf.catalog.Catalog; - +import org.eclipse.modisco.facet.util.emf.catalog.Catalog; import org.eclipse.modisco.infra.discovery.catalog.*; /** @@ -157,13 +155,13 @@ } /** - * Creates a new adapter for an object of class '{@link org.eclipse.emf.facet.util.emf.catalog.Catalog <em>Catalog</em>}'. + * Creates a new adapter for an object of class '{@link org.eclipse.modisco.facet.util.emf.catalog.Catalog <em>Catalog</em>}'. * <!-- begin-user-doc --> * This default implementation returns null so that we can easily ignore cases; * it's useful to ignore a case when inheritance will catch all the cases anyway. * <!-- end-user-doc --> * @return the new adapter. - * @see org.eclipse.emf.facet.util.emf.catalog.Catalog + * @see org.eclipse.modisco.facet.util.emf.catalog.Catalog * @generated */ public Adapter createCatalogAdapter() {
diff --git a/org.eclipse.modisco.infra.discovery/src-gen/org/eclipse/modisco/infra/discovery/catalog/util/CatalogSwitch.java b/org.eclipse.modisco.infra.discovery/src-gen/org/eclipse/modisco/infra/discovery/catalog/util/CatalogSwitch.java index e7fd69c..9fe026f 100644 --- a/org.eclipse.modisco.infra.discovery/src-gen/org/eclipse/modisco/infra/discovery/catalog/util/CatalogSwitch.java +++ b/org.eclipse.modisco.infra.discovery/src-gen/org/eclipse/modisco/infra/discovery/catalog/util/CatalogSwitch.java
@@ -15,9 +15,7 @@ import org.eclipse.emf.ecore.EClass; import org.eclipse.emf.ecore.EObject; - -import org.eclipse.emf.facet.util.emf.catalog.Catalog; - +import org.eclipse.modisco.facet.util.emf.catalog.Catalog; import org.eclipse.modisco.infra.discovery.catalog.*; /**
diff --git a/org.eclipse.modisco.infra.discovery/src-gen/org/eclipse/modisco/infra/discovery/launch/impl/LaunchPackageImpl.java b/org.eclipse.modisco.infra.discovery/src-gen/org/eclipse/modisco/infra/discovery/launch/impl/LaunchPackageImpl.java index 58830ba..c4f3e7f 100644 --- a/org.eclipse.modisco.infra.discovery/src-gen/org/eclipse/modisco/infra/discovery/launch/impl/LaunchPackageImpl.java +++ b/org.eclipse.modisco.infra.discovery/src-gen/org/eclipse/modisco/infra/discovery/launch/impl/LaunchPackageImpl.java
@@ -17,11 +17,8 @@ import org.eclipse.emf.ecore.EReference; import org.eclipse.emf.ecore.impl.EPackageImpl; - -import org.eclipse.emf.facet.util.emf.catalog.CatalogPackage; - -import org.eclipse.emf.facet.util.emf.core.serialization.model.serialization.SerializationPackage; - +import org.eclipse.modisco.facet.util.emf.catalog.CatalogPackage; +import org.eclipse.modisco.facet.util.emf.core.serialization.model.serialization.SerializationPackage; import org.eclipse.modisco.infra.discovery.catalog.impl.CatalogPackageImpl; import org.eclipse.modisco.infra.discovery.launch.LaunchConfiguration;
diff --git a/org.eclipse.modisco.infra.facet.tests/src/org/eclipse/modisco/infra/facet/tests/FacetTests.java b/org.eclipse.modisco.infra.facet.tests/src/org/eclipse/modisco/infra/facet/tests/FacetTests.java index 16d6027..8de0874 100644 --- a/org.eclipse.modisco.infra.facet.tests/src/org/eclipse/modisco/infra/facet/tests/FacetTests.java +++ b/org.eclipse.modisco.infra.facet.tests/src/org/eclipse/modisco/infra/facet/tests/FacetTests.java
@@ -45,8 +45,6 @@ import org.eclipse.emf.ecore.resource.Resource; import org.eclipse.emf.ecore.resource.ResourceSet; import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl; -import org.eclipse.emf.facet.util.pde.core.internal.exported.TargetPlatformUtils; -import org.eclipse.emf.facet.util.pde.core.internal.exported.exception.PdeCoreUtilsException; import org.eclipse.gmt.modisco.infra.common.core.internal.builder.AbstractMoDiscoCatalog; import org.eclipse.gmt.modisco.infra.common.core.internal.builder.EcoreCatalog; import org.eclipse.gmt.modisco.infra.common.core.internal.resource.MoDiscoResourceSet; @@ -65,7 +63,8 @@ import org.eclipse.gmt.modisco.infra.query.ModelQuery; import org.eclipse.gmt.modisco.infra.query.ModelQuerySet; import org.eclipse.gmt.modisco.infra.query.core.ModelQuerySetCatalog; -import org.eclipse.modisco.common.tests.TestUIUtil; +import org.eclipse.modisco.facet.util.pde.core.internal.exported.TargetPlatformUtils; +import org.eclipse.modisco.facet.util.pde.core.internal.exported.exception.PdeCoreUtilsException; import org.eclipse.modisco.infra.query.tests.Utils; import org.junit.Assert; import org.junit.BeforeClass; @@ -89,13 +88,7 @@ @BeforeClass public static void loadTarget() throws PdeCoreUtilsException { - TestUIUtil.suppressGitPrefixPopUp(); - System.out.println("closeIntro"); - TestUIUtil.closeIntro(); - System.out.println("loadTargetPlatform"); // TargetPlatformUtils.loadTargetPlatform(); - System.out.println("wait 1"); - // TestUIUtil.wait(10000); } /** @@ -108,8 +101,6 @@ @Test public void test001() throws Exception { final String name = "test001"; - System.out.println("start " + name); - // TestUIUtil.wait(10000); IProject projectToCreate = this.utils.createProject(name); IFile queryFile = FileUtils.copyFileFromBundle("resources/" + name + ".querySet", projectToCreate, "/" + name + ".querySet", Activator.getDefault().getBundle()); @@ -121,11 +112,7 @@ projectToCreate, "/src/org/eclipse/modisco/infra/facet/tests/samples/GetSubClasses.java", Activator.getDefault().getBundle()); - System.out.println("pre-refresh"); - // TestUIUtil.wait(10000); ProjectUtils.refresh(projectToCreate); - System.out.println("post-refresh wait"); - // TestUIUtil.wait(1000000); FileUtils.checkNoMoreMarkerOn(javaFile, NB_MARKER_GETSUBCLASSES); FileUtils.checkNoMarkerOn(queryFile); FileUtils.checkNoMarkerOn(facetFile);
diff --git a/org.eclipse.modisco.infra.query.tests/src/org/eclipse/modisco/infra/query/tests/UnitTests.java b/org.eclipse.modisco.infra.query.tests/src/org/eclipse/modisco/infra/query/tests/UnitTests.java index acd397b..83c1503 100644 --- a/org.eclipse.modisco.infra.query.tests/src/org/eclipse/modisco/infra/query/tests/UnitTests.java +++ b/org.eclipse.modisco.infra.query.tests/src/org/eclipse/modisco/infra/query/tests/UnitTests.java
@@ -38,9 +38,6 @@ import org.eclipse.emf.ecore.resource.Resource; import org.eclipse.emf.ecore.resource.ResourceSet; import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl; -import org.eclipse.emf.facet.util.core.DebugUtils; -import org.eclipse.emf.facet.util.pde.core.internal.exported.TargetPlatformUtils; -import org.eclipse.emf.facet.util.pde.core.internal.exported.exception.PdeCoreUtilsException; import org.eclipse.gmt.modisco.infra.common.core.internal.builder.AbstractMoDiscoCatalog; import org.eclipse.gmt.modisco.infra.common.core.internal.utils.FileUtils; import org.eclipse.gmt.modisco.infra.common.core.internal.utils.ProjectUtils; @@ -57,6 +54,9 @@ import org.eclipse.gmt.modisco.infra.query.runtime.ModelQueryContext; import org.eclipse.gmt.modisco.infra.query.runtime.ModelQueryResult; import org.eclipse.gmt.modisco.infra.query.runtime.RuntimeFactory; +import org.eclipse.modisco.facet.util.core.DebugUtils; +import org.eclipse.modisco.facet.util.pde.core.internal.exported.TargetPlatformUtils; +import org.eclipse.modisco.facet.util.pde.core.internal.exported.exception.PdeCoreUtilsException; import org.eclipse.modisco.infra.query.tests.samples.Bug303036Test003Query; import org.junit.Assert; import org.junit.BeforeClass;
diff --git a/org.eclipse.modisco.java.composition.discoverer.tests/src/org/eclipse/modisco/java/composition/discoverer/tests/TestMemoryUsage.java b/org.eclipse.modisco.java.composition.discoverer.tests/src/org/eclipse/modisco/java/composition/discoverer/tests/TestMemoryUsage.java index 02dbee3..13ed32e 100644 --- a/org.eclipse.modisco.java.composition.discoverer.tests/src/org/eclipse/modisco/java/composition/discoverer/tests/TestMemoryUsage.java +++ b/org.eclipse.modisco.java.composition.discoverer.tests/src/org/eclipse/modisco/java/composition/discoverer/tests/TestMemoryUsage.java
@@ -28,12 +28,12 @@ import org.eclipse.emf.common.util.EList; import org.eclipse.emf.ecore.EObject; import org.eclipse.emf.ecore.resource.Resource; -import org.eclipse.emf.facet.util.core.Logger; import org.eclipse.jdt.core.IClasspathEntry; import org.eclipse.jdt.core.IJavaProject; import org.eclipse.jdt.core.JavaCore; import org.eclipse.jdt.core.JavaModelException; import org.eclipse.jdt.launching.JavaRuntime; +import org.eclipse.modisco.facet.util.core.Logger; import org.eclipse.modisco.infra.discovery.core.exception.DiscoveryException; import org.eclipse.modisco.java.composition.discoverer.DiscoverKDMSourceAndJavaModelFromJavaProject; import org.eclipse.modisco.java.composition.javaapplication.JavaApplication;
diff --git a/org.eclipse.modisco.java.composition.discoverer/src/org/eclipse/modisco/java/composition/discoverer/DiscoverKDMSourceAndJavaModelFromProject.java b/org.eclipse.modisco.java.composition.discoverer/src/org/eclipse/modisco/java/composition/discoverer/DiscoverKDMSourceAndJavaModelFromProject.java index 33641dc..0a9ac75 100644 --- a/org.eclipse.modisco.java.composition.discoverer/src/org/eclipse/modisco/java/composition/discoverer/DiscoverKDMSourceAndJavaModelFromProject.java +++ b/org.eclipse.modisco.java.composition.discoverer/src/org/eclipse/modisco/java/composition/discoverer/DiscoverKDMSourceAndJavaModelFromProject.java
@@ -13,8 +13,8 @@ import org.eclipse.core.resources.IProject; import org.eclipse.core.runtime.CoreException; -import org.eclipse.emf.facet.util.core.Logger; import org.eclipse.jdt.core.JavaCore; +import org.eclipse.modisco.facet.util.core.Logger; import org.eclipse.modisco.infra.discovery.core.annotations.ParameterInitialValue; import org.eclipse.modisco.java.discoverer.AbstractDiscoverJavaModelFromProject; import org.eclipse.modisco.java.discoverer.DiscoverJavaModelFromProject;
diff --git a/org.eclipse.modisco.java.discoverer.ui/src/org/eclipse/modisco/java/discoverer/ui/internal/JavaElementsToAnalyzeComposite.java b/org.eclipse.modisco.java.discoverer.ui/src/org/eclipse/modisco/java/discoverer/ui/internal/JavaElementsToAnalyzeComposite.java index 404143e..405254f 100644 --- a/org.eclipse.modisco.java.discoverer.ui/src/org/eclipse/modisco/java/discoverer/ui/internal/JavaElementsToAnalyzeComposite.java +++ b/org.eclipse.modisco.java.discoverer.ui/src/org/eclipse/modisco/java/discoverer/ui/internal/JavaElementsToAnalyzeComposite.java
@@ -10,8 +10,8 @@ *******************************************************************************/ package org.eclipse.modisco.java.discoverer.ui.internal; -import org.eclipse.emf.facet.widgets.celleditors.AbstractCellEditorComposite; import org.eclipse.jface.dialogs.MessageDialog; +import org.eclipse.modisco.facet.widgets.celleditors.AbstractCellEditorComposite; import org.eclipse.modisco.java.discoverer.ElementsToAnalyze; import org.eclipse.swt.SWT; import org.eclipse.swt.events.SelectionAdapter;
diff --git a/org.eclipse.modisco.java.discoverer.ui/src/org/eclipse/modisco/java/discoverer/ui/internal/JavaElementsToAnalyzeCompositeFactory.java b/org.eclipse.modisco.java.discoverer.ui/src/org/eclipse/modisco/java/discoverer/ui/internal/JavaElementsToAnalyzeCompositeFactory.java index 5ec27fa..1ad956c 100644 --- a/org.eclipse.modisco.java.discoverer.ui/src/org/eclipse/modisco/java/discoverer/ui/internal/JavaElementsToAnalyzeCompositeFactory.java +++ b/org.eclipse.modisco.java.discoverer.ui/src/org/eclipse/modisco/java/discoverer/ui/internal/JavaElementsToAnalyzeCompositeFactory.java
@@ -10,8 +10,8 @@ *******************************************************************************/ package org.eclipse.modisco.java.discoverer.ui.internal; -import org.eclipse.emf.facet.widgets.celleditors.AbstractCellEditorComposite; -import org.eclipse.emf.facet.widgets.celleditors.ICompositeEditorFactory; +import org.eclipse.modisco.facet.widgets.celleditors.AbstractCellEditorComposite; +import org.eclipse.modisco.facet.widgets.celleditors.ICompositeEditorFactory; import org.eclipse.modisco.java.discoverer.ElementsToAnalyze; import org.eclipse.swt.widgets.Composite;
diff --git a/org.eclipse.modisco.java.discoverer/src/org/eclipse/modisco/java/discoverer/internal/serialization/ElementsToAnalyzeSerializer.java b/org.eclipse.modisco.java.discoverer/src/org/eclipse/modisco/java/discoverer/internal/serialization/ElementsToAnalyzeSerializer.java index 802e6d3..6aa5bb1 100644 --- a/org.eclipse.modisco.java.discoverer/src/org/eclipse/modisco/java/discoverer/internal/serialization/ElementsToAnalyzeSerializer.java +++ b/org.eclipse.modisco.java.discoverer/src/org/eclipse/modisco/java/discoverer/internal/serialization/ElementsToAnalyzeSerializer.java
@@ -18,14 +18,14 @@ import org.eclipse.core.resources.IProject; import org.eclipse.core.resources.ResourcesPlugin; import org.eclipse.core.runtime.Path; -import org.eclipse.emf.facet.util.emf.core.serialization.ISerializationRegistry; -import org.eclipse.emf.facet.util.emf.core.serialization.ISerializationService; -import org.eclipse.emf.facet.util.emf.core.serialization.ISerializer; import org.eclipse.gmt.modisco.infra.common.core.internal.utils.StringUtils; import org.eclipse.gmt.modisco.infra.common.core.logging.MoDiscoLogger; import org.eclipse.jdt.core.IJavaElement; import org.eclipse.jdt.core.IJavaProject; import org.eclipse.jdt.core.JavaCore; +import org.eclipse.modisco.facet.util.emf.core.serialization.ISerializationRegistry; +import org.eclipse.modisco.facet.util.emf.core.serialization.ISerializationService; +import org.eclipse.modisco.facet.util.emf.core.serialization.ISerializer; import org.eclipse.modisco.java.discoverer.ElementsToAnalyze; import org.eclipse.modisco.java.discoverer.internal.JavaActivator;
diff --git a/org.eclipse.modisco.java.discoverer/src/org/eclipse/modisco/java/discoverer/internal/serialization/JavaProjectSerializer.java b/org.eclipse.modisco.java.discoverer/src/org/eclipse/modisco/java/discoverer/internal/serialization/JavaProjectSerializer.java index f2fa525..834b580 100644 --- a/org.eclipse.modisco.java.discoverer/src/org/eclipse/modisco/java/discoverer/internal/serialization/JavaProjectSerializer.java +++ b/org.eclipse.modisco.java.discoverer/src/org/eclipse/modisco/java/discoverer/internal/serialization/JavaProjectSerializer.java
@@ -14,10 +14,10 @@ import org.eclipse.core.resources.IProject; import org.eclipse.core.resources.ResourcesPlugin; import org.eclipse.core.runtime.CoreException; -import org.eclipse.emf.facet.util.emf.core.serialization.ISerializer; import org.eclipse.gmt.modisco.infra.common.core.logging.MoDiscoLogger; import org.eclipse.jdt.core.IJavaProject; import org.eclipse.jdt.core.JavaCore; +import org.eclipse.modisco.facet.util.emf.core.serialization.ISerializer; import org.eclipse.modisco.java.discoverer.internal.JavaActivator; public class JavaProjectSerializer implements ISerializer<IJavaProject> {
diff --git a/org.eclipse.modisco.manifest.discoverer/src/org/eclipse/modisco/manifest/discoverer/ManifestModelDiscoverer2.java b/org.eclipse.modisco.manifest.discoverer/src/org/eclipse/modisco/manifest/discoverer/ManifestModelDiscoverer2.java index 0ef4be0..7bf698f 100644 --- a/org.eclipse.modisco.manifest.discoverer/src/org/eclipse/modisco/manifest/discoverer/ManifestModelDiscoverer2.java +++ b/org.eclipse.modisco.manifest.discoverer/src/org/eclipse/modisco/manifest/discoverer/ManifestModelDiscoverer2.java
@@ -23,7 +23,7 @@ import org.eclipse.core.runtime.IProgressMonitor; import org.eclipse.emf.common.util.URI; import org.eclipse.emf.ecore.resource.Resource; -import org.eclipse.emf.facet.util.core.Logger; +import org.eclipse.modisco.facet.util.core.Logger; import org.eclipse.modisco.infra.discovery.core.AbstractModelDiscoverer; import org.eclipse.modisco.infra.discovery.core.exception.DiscoveryException; import org.eclipse.modisco.manifest.Bundle;
diff --git a/org.eclipse.modisco.util.emf.core/src/org/eclipse/modisco/util/emf/core/internal/allinstances/MetaclassInstancesAdapter.java b/org.eclipse.modisco.util.emf.core/src/org/eclipse/modisco/util/emf/core/internal/allinstances/MetaclassInstancesAdapter.java index 0efff1d..5e99cc5 100644 --- a/org.eclipse.modisco.util.emf.core/src/org/eclipse/modisco/util/emf/core/internal/allinstances/MetaclassInstancesAdapter.java +++ b/org.eclipse.modisco.util.emf.core/src/org/eclipse/modisco/util/emf/core/internal/allinstances/MetaclassInstancesAdapter.java
@@ -39,8 +39,8 @@ import org.eclipse.emf.ecore.resource.impl.ResourceImpl; import org.eclipse.emf.edit.domain.EditingDomain; import org.eclipse.emf.edit.domain.IEditingDomainProvider; -import org.eclipse.emf.facet.util.core.Logger; import org.eclipse.emf.transaction.TransactionalEditingDomain; +import org.eclipse.modisco.facet.util.core.Logger; import org.eclipse.modisco.util.emf.core.internal.Activator; /**
diff --git a/org.eclipse.modisco.utils.core/src/org/eclipse/modisco/utils/core/internal/exported/SystemInfo.java b/org.eclipse.modisco.utils.core/src/org/eclipse/modisco/utils/core/internal/exported/SystemInfo.java index 05e05b3..fe2bd8a 100644 --- a/org.eclipse.modisco.utils.core/src/org/eclipse/modisco/utils/core/internal/exported/SystemInfo.java +++ b/org.eclipse.modisco.utils.core/src/org/eclipse/modisco/utils/core/internal/exported/SystemInfo.java
@@ -28,7 +28,7 @@ import java.util.regex.Matcher; import java.util.regex.Pattern; -import org.eclipse.emf.facet.util.core.Logger; +import org.eclipse.modisco.facet.util.core.Logger; import org.eclipse.modisco.utils.core.internal.Activator; /**